Package org.eclipse.persistence.jpa.jpql.parser

Examples of org.eclipse.persistence.jpa.jpql.parser.Expression


     * {@inheritDoc}
     */
    public boolean isClauseComplete(AbstractSelectStatement expression) {

      AbstractSelectClause selectClause = expression.getSelectClause();
      Expression items = selectClause.getSelectExpression();
      boolean complete = isValid(items, selectClause.selectItemBNF());

      if (complete) {
        complete = isComplete(items);
      }
View Full Code Here


     * {@inheritDoc}
     */
    public boolean isClauseComplete(AbstractSelectStatement expression) {

      AbstractSelectClause selectClause = expression.getSelectClause();
      Expression items = selectClause.getSelectExpression();
      boolean complete = isValid(items, selectClause.selectItemBNF());

      if (complete) {
        complete = isComplete(items);
      }
View Full Code Here

     * {@inheritDoc}
     */
    public boolean isClauseComplete(T expression) {

      WhereClause whereClause = (WhereClause) expression.getWhereClause();
      Expression condition = whereClause.getConditionalExpression();
      boolean complete = isValid(condition, ConditionalExpressionBNF.ID);

      if (complete) {
        complete = isComplete(condition);
      }
View Full Code Here

     * {@inheritDoc}
     */
    public boolean isClauseComplete(T expression) {

      WhereClause whereClause = (WhereClause) expression.getWhereClause();
      Expression condition = whereClause.getConditionalExpression();
      boolean complete = isValid(condition, ConditionalExpressionBNF.ID);

      if (complete) {
        complete = isComplete(condition);
      }
View Full Code Here

      // After "<collection-valued path expression> "
      if (expression.hasCollectionValuedPathExpression() &&
          expression.hasSpaceAfterCollectionValuedPathExpression()) {

        Expression collectionValuedPathExpression = expression.getCollectionValuedPathExpression();
        length += collectionValuedPathExpression.getLength() + SPACE_LENGTH;

        // Within "AS"
        if (isPositionWithin(position, length, AS)) {
          addIdentifier(AS);
View Full Code Here

        int count = Math.min(childrenCount, helper.maxCollectionSize(expression));

        // Iterate through each child of the collection
        for (int index = 0; index < count; index++) {

          Expression child = collectionExpression.getChild(index);
          int childLength = 0;

          // At the beginning of the child
          if (position == length) {
            helper.addTheBeginningOfChild(expression, collectionExpression, index, hasComma);
            break;
          }
          // Each expression within the collection has to be separated by a comma, the previous
          // expression and the expression at the current index are not separated by a comma
          // Example: "SELECT e FROM Employee e GROUP" <- [ "Employee e", "GROUP" ]
          else if ((index > 0) && !hasComma) {

            length += child.getLength();

            // At the end of the child
            if (position == length) {
              helper.addAtTheEndOfChild(expression, collectionExpression, index, hasComma, false);
              break;
            }

            // To be valid, each child has to be separated by a comma,
            // ask the helper if it should continue with the next child
            if (!helper.canContinue(expression, collectionExpression, index)) {
              break;
            }
            // Special case when reaching the end of the collection
            else if (index + 1 == count) {
              helper.addAtTheEndOfChild(expression, collectionExpression, index, hasComma, false);
            }
          }
          else {
            childLength = child.getLength();

            // At the end of the child
            if ((position == length + childLength) ||
                (virtualSpace && (position == length + childLength + SPACE_LENGTH))) {
View Full Code Here

      int length = 0;

      while (helper != null) {

        // Add the length of the clause to the current length
        Expression clause = helper.getClause(expression);
        length += clause.getLength();

        // Within the clause, not handled here
        if (position < length) {
          break;
        }
View Full Code Here

      // The only thing that is appendable is an arithmetic operator
      // Example: "SELECT e FROM Employee e WHERE e.name|"
      // Example: "SELECT e FROM Employee e WHERE I|"
      if ((index == 0) && !virtualSpace) {

        Expression child = collectionExpression.getChild(0);

        if (areArithmeticSymbolsAppendable(child)) {
          addArithmeticIdentifiers();
        }
      }
      else {

        Object[] result = findChild(collectionExpression, index);

        if (result == null) {
          return;
        }

        Expression child = (Expression) result[0];
        boolean hasIs  = (Boolean) result[1];
        boolean hasNot = (Boolean) result[2];

        // If 'IS' or 'IS NOT' is present, then none of the following are valid proposals
        if (!hasIs && !hasNot) {
View Full Code Here

     */
    public boolean canContinue(AbstractConditionalClause expression,
                               CollectionExpression collectionExpression,
                               int index) {

      Expression child = collectionExpression.getChild(index);

      if (isNotExpression(child)) {
        return true;
      }

      String text = child.toParsedText();

      return text.equalsIgnoreCase(IS||
             text.equalsIgnoreCase(NOT) ||
             text.equalsIgnoreCase("IS NOT");
    }
View Full Code Here

      boolean isFound = false;
      boolean scanPrevious = false;

      for (; index > -1; index--) {

        Expression child = collectionExpression.getChild(index);
        String text = child.toParsedText();

        // Handle 'NOT'
        if (text.equalsIgnoreCase(NOT) || isNotExpression(child)) {

          // Two consecutive 'NOT' or 'IS' is invalid or 'NOT IS' is not valid
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.parser.Expression

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.