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

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


      addProblem(expression, startPosition, endPosition, TrimExpression_InvalidExpression);
    }

    // Invalid trim character
    if (expression.hasTrimCharacter()) {
      Expression trimCharacter = expression.getTrimCharacter();

      // Make sure it's not an input parameter
      String inputParameter = queryContext.literal(trimCharacter, LiteralType.INPUT_PARAMETER);

      if (ExpressionTools.stringIsEmpty(inputParameter)) {
View Full Code Here


    private void validateSeparation(CollectionExpression expression) {

      for (int index = 0, count = expression.childrenSize(); index + 1 < count; index++) {

        Expression expression1 = expression.getChild(index);

        if (isNull(expression1)) {
          int startPosition = position(expression1);
          int endPosition   = startPosition;

          addProblem(
            expression,
            startPosition,
            endPosition,
            CollectionExpression_MissingExpression,
            String.valueOf(index + 1)
          );
        }

        if (!validateSeparator(expression, index)) {
          Expression expression2 = expression.getChild(index + 1);

          int startPosition = position(expression1) + length(expression1);
          int endPosition   = position(expression2);

          // The space is part of the child expression, move backward
          if (!expression.hasSpace(index)) {
            startPosition--;
          }

          if (!validateOnly) {
            addProblem(
              expression,
              startPosition,
              endPosition,
              wrongSeparatorProblemKey,
              expression1.toParsedText(),
              expression2.toParsedText()
            );
          }
        }
      }
    }
View Full Code Here

    // The KEY, VALUE, and ENTRY operators may only be applied to
    // identification variables that correspond to map-valued associations
    // or map-valued element collections
    if (expression.hasExpression()) {

      Expression childExpression = expression.getExpression();
      String variableName = queryContext.literal(childExpression, LiteralType.IDENTIFICATION_VARIABLE);

      // Retrieve the identification variable's type without traversing the type parameters
      if (ExpressionTools.stringIsNotEmpty(variableName)) {
        ITypeDeclaration typeDeclaration = getTypeDeclaration(childExpression);
View Full Code Here

  private void validateUpdateItemTypes(UpdateItem expression, IType type) {

    if (expression.hasNewValue()) {

      Expression newValue = expression.getNewValue();
      TypeHelper typeHelper = getTypeHelper();
      boolean nullValue = isNullValue(newValue);

      // A NULL value is ignored, except if the type is a primitive, null cannot be
      // assigned to a mapping of primitive type
View Full Code Here

  public void visit(CollectionMemberExpression expression) {

    // Expressions that evaluate to embeddable types are not supported in
    // collection member expressions
    if (expression.hasEntityExpression()) {
      Expression entityExpression = expression.getEntityExpression();

      // Check for embeddable type
      IType type = getType(entityExpression);
      IManagedType managedType = getManagedType(type);
View Full Code Here

    // embeddable types or map entry types (weird because map entry is not
    // an allowed in a COUNT expression)
    if (expression.hasExpression() &&
        expression.hasDistinct()) {

      Expression childExpression = expression.getExpression();

      // Check for embeddable type
      IType type = getType(childExpression);
      IManagedType managedType = getManagedType(type);
View Full Code Here

   * {@inheritDoc}
   */
  @Override
  public void visit(Join expression) {

    Expression joinAssociationPath = expression.getJoinAssociationPath();
    validateCollectionValuedPathExpression(joinAssociationPath, false);
    joinAssociationPath.accept(this);

    try {
      registerIdentificationVariable = false;
      expression.getIdentificationVariable().accept(this);
    }
View Full Code Here

    // If the GROUP BY clause is not defined but the HAVING clause is, the result is treated as a
    // single group, and the select list can only consist of aggregate functions. (page 159)
    if (!expression.hasGroupByClause() &&
         expression.hasHavingClause()) {

      Expression selectExpression = expression.getSelectClause().getSelectExpression();

      if (!isValidWithChildCollectionBypass(selectExpression, AggregateExpressionBNF.ID)) {
        addProblem(selectExpression, SelectStatement_SelectClauseHasNonAggregateFunctions);
      }
    }
View Full Code Here

    CollectionExpression collectionExpression = collectionExpression(expression.getSelectExpression());

    if (collectionExpression != null) {

      for (int index = 0, count = collectionExpression.childrenSize(); index < count; index++) {
        Expression child = collectionExpression.getChild(index);

        // At the beginning of the child expression
        if (position == length) {
          addAllIdentificationVariables(expression);
          addAllFunctions(SelectItemBNF.ID);
View Full Code Here

    return getHelper(AcceptableTypeVisitor.class);
  }

  private int findExpressionPosition(CollectionExpression expression) {

    Expression leafExpression = queryPosition.getExpression();

    if (leafExpression != expression) {
      for (int index = 0, count = expression.childrenSize(); index < count; index++) {
        Expression child = expression.getChild(index);

        if (child.isAncestor(leafExpression)) {
          return index;
        }
      }
    }

    int position = position(expression);

    if (position > -1) {
      for (int index = 0, count = expression.childrenSize(); index < count; index++) {
        Expression child = expression.getChild(index);
        String text = child.toActualText();

        if (position <= text.length()) {
          return index;
        }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.internal.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.