Package org.dbwiki.exception

Examples of org.dbwiki.exception.WikiFatalException


   */
 
  public WhereClause getWhereClause(QueryVariableListing variables, XAQLToken token, VersionIndex versionIndex) throws org.dbwiki.exception.WikiException {
   
    if (token.type() != XAQLToken.WHERE_CLAUSE) {
      throw new WikiFatalException("Invalid token type " + token.type() + " in getWhereClause()");
    }
   
    WhereClause whereClause = new WhereClause();
    for (int iExpression = 0; iExpression < token.children().size(); iExpression++) {
      whereClause.add(this.getWhereExpression(variables, token.children().get(iExpression), versionIndex));
View Full Code Here


  }
 
  public WhereCondition getWhereCondition(QueryVariableListing variables, XAQLToken token, VersionIndex versionIndexthrows org.dbwiki.exception.WikiException {
   
    if ((token.type() != XAQLToken.WHERE_CLAUSE_EXPRESSION) && (token.type() != XAQLToken.COINCIDES_LIST_ELEMENT)) {
      throw new WikiFatalException("Invalid token type " + token.type() + " in getWhereCondition()");
    }

    QueryVariable variable = null;
   
    for (XAQLToken childToken : token.children()) {
View Full Code Here

   */
 
  private WhereExpression getWhereExpression(QueryVariableListing variables, XAQLToken token, VersionIndex versionIndex) throws org.dbwiki.exception.WikiException {
   
    if (token.type() != XAQLToken.WHERE_CLAUSE_EXPRESSION) {
      throw new WikiFatalException("Invalid token type " + token.type() + " in getWhereExpression()");
    }
   
    int offset = 0;
    if (token.children().firstElement().type() == XAQLToken.NOT_OPERATOR) {
      offset++;
View Full Code Here

   */
 
  public XAQLQuery getStatement(Database database, XAQLToken token) throws org.dbwiki.exception.WikiException {
   
    if (token.type() != XAQLToken.QUERY_STATEMENT) {
      throw new WikiFatalException("Invalid token type " + token.type());
    }

      FromClause fromClause = new FromClauseGenerator().getFromClause(database.schema().root(), database.versionIndex(), token.children().get(1));
     
      SelectClause selectClause = new SelectClauseGenerator().getSelectClause(database.versionIndex(), fromClause.variables(), token.children().get(0));
View Full Code Here

   */
 
  public FromClause getFromClause(SchemaNode schemaRoot, VersionIndex versionIndex, XAQLToken token) throws org.dbwiki.exception.WikiException {
   
    if (token.type() != XAQLToken.FROM_CLAUSE) {
      throw new WikiFatalException("Invalid token type " + token.type() + " in FromClauseGenerator.getFromClause()");
    }

    Vector<XAQLToken> fromClauseTokens = token.children();
    int iToken = 0;
   
View Full Code Here

 

  public FromClause getSubqueryFromClause(QueryVariableListing variables, XAQLToken token, VersionIndex versionIndex) throws org.dbwiki.exception.WikiException {
   
    if (token.type() != XAQLToken.SUBQUERY_FROM_CLAUSE) {
      throw new WikiFatalException("Invalid token type " + token.type() + " in FromClauseGenerator.getSubqueryFromClause()");
    }

    Vector<XAQLToken> fromClauseTokens = token.children();
    int iToken = 0;
   
View Full Code Here

      while (index < tokens.size()) {
        inOp.add(new ValueOpFactory().get("=", tokens.get(index++).value()));
      }
      return new ValueCondition(targetPath, quantifier, negated, inOp, valueQuantifier);
    default:
      throw new WikiFatalException("Unknown operator type");
    }
  }
View Full Code Here

   */
 
  private ProvenanceCondition getProvenanceCondition(XAQLToken collection, VersionIndex versionIndex) throws org.dbwiki.exception.WikiException {
   
    if (collection.type() != XAQLToken.PROVENANCE_EXPRESSION) {
      throw new WikiFatalException("Invalid token type " + collection.type() + " in getProvenanceCondition()");
    }
   
    Date startDate = null;
    Date endDate = null;
    String dateOp = null;
    byte provenanceType = Provenance.ProvenanceTypeUnknown;
    String username = null;
   
    for (int iToken = 0; iToken < collection.children().size(); iToken++) {
      XAQLToken token = collection.children().get(iToken);
      if (token.type() == XAQLToken.PROVENANCE_DATE_OPERATOR) {
        dateOp = token.value();
        iToken++;
        try {
          if (dateOp.equalsIgnoreCase(XAQLSyntaxParser.KeywordAfter)) {
            startDate = org.dbwiki.lib.DateTime.getDate(collection.children().get(iToken).value());
          } else if (dateOp.equalsIgnoreCase(XAQLSyntaxParser.KeywordBefore)) {
            endDate = org.dbwiki.lib.DateTime.getDate(collection.children().get(iToken).value());
          } else if (dateOp.equalsIgnoreCase(XAQLSyntaxParser.KeywordSince)) {
            startDate = org.dbwiki.lib.DateTime.getDate(collection.children().get(iToken).value());
          } else if (dateOp.equalsIgnoreCase(XAQLSyntaxParser.KeywordUntil)) {
            endDate = org.dbwiki.lib.DateTime.getDate(collection.children().get(iToken).value());
          } else if (dateOp.equalsIgnoreCase(XAQLSyntaxParser.KeywordBetween)) {
            startDate = org.dbwiki.lib.DateTime.getDate(collection.children().get(iToken).value());
            iToken++;
            endDate = org.dbwiki.lib.DateTime.getDate(collection.children().get(iToken).value());
          } else {
            throw new WikiFatalException("Unknown date operation " + token.value() + " in getProvenanceCondition()");
          }
        } catch (java.text.ParseException parseException) {
          throw new WikiFatalException(parseException);
        }
      } else if (token.type() == XAQLToken.PROVENANCE_USER_NAME) {
        username = token.value().substring(1, token.value().length() - 1);
      } else if (token.type() == XAQLToken.PROVENANCE_OPERATION) {
        if (token.value().equalsIgnoreCase(XAQLSyntaxParser.KeywordCopy)) {
          provenanceType = Provenance.ProvenanceTypeCopy;
        } else if (token.value().equalsIgnoreCase(XAQLSyntaxParser.KeywordDelete)) {
          provenanceType = Provenance.ProvenanceTypeDelete;
        } else if (token.value().equalsIgnoreCase(XAQLSyntaxParser.KeywordInsert)) {
          provenanceType = Provenance.ProvenanceTypeInsert;
        } else if (token.value().equalsIgnoreCase(XAQLSyntaxParser.KeywordUpdate)) {
          provenanceType = Provenance.ProvenanceTypeUpdate;
        } else {
          throw new WikiFatalException("Unknown operation name " + token.value() + " in getProvenanceCondition()");
        }
      } else {
        throw new WikiFatalException("Invalid token type " + token.type() + " in getProvenanceCondition()");
      }
    }
   
    assert(startDate != null); // because the condition list is nonempty
    assert(endDate != null); // because the condition list is nonempty
View Full Code Here

   */
 
  public SelectClause getSelectClause(VersionIndex versionIndex, QueryVariableListing variables, XAQLToken token) throws org.dbwiki.exception.WikiException {
   
    if (token.type() != XAQLToken.SELECT_CLAUSE) {
      throw new WikiFatalException("Invalid token type " + token.type() + " in getSelectClause()");
    }
   
    SelectClause selectClause = new SelectClause();
   
    XAQLToken selectToken = token.children().firstElement();
    switch (selectToken.type()) {
    case XAQLToken.SUBTREE_SELECT_CLAUSE:
      Vector<XAQLToken> subtreeSelectTokens = selectToken.children();
      int iOffset = 0;
        if (subtreeSelectTokens.firstElement().type() == XAQLToken.SUBTREE_SELECT_LIST) {
          this.getSubTreeSelectExpressions(selectClause, versionIndex, variables, subtreeSelectTokens.get(iOffset));
        } else {
          throw new WikiFatalException("Invalid token type for select clause: " + subtreeSelectTokens.firstElement().type());
        }
        return selectClause;
    default:
      throw new WikiFatalException("Invalid token type " + selectToken.type() + " as child in getSelectClause()");
    }
  }
View Full Code Here

  public SubTreeSelectStatement getVariableSelectStatement(Vector<XAQLToken> statementTokens, QueryVariableListing variables, VersionIndex versionIndex) throws org.dbwiki.exception.WikiException {
   
    String variableName = statementTokens.firstElement().children().firstElement().value();
    QueryVariable variable = variables.get(variableName);
    if (variable == null) {
      throw new WikiFatalException("Unknown variable $" + variableName);
    }
    VariableXPath targetPath = new VariableTargetPathGenerator().getTargetPath(variable.targetEntity(), versionIndex, statementTokens.firstElement().children().iterator());
   
    String label = null;
    if (statementTokens.size() > 1) {
View Full Code Here

TOP

Related Classes of org.dbwiki.exception.WikiFatalException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.