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

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


    boolean valid = true;

    if (expression.hasStateFieldPathExpression()) {

      // Retrieve the state field path expression
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(expression.getStateFieldPathExpression());

      if ((pathExpression != null) &&
          (pathExpression.hasIdentificationVariable() ||
           pathExpression.hasVirtualIdentificationVariable())) {

        // Start traversing the path expression by first retrieving the managed type
        Object managedType = helper.getManagedType(pathExpression.getIdentificationVariable());

        if (managedType != null) {

          // Continue to traverse the path expression
          for (int index = pathExpression.hasVirtualIdentificationVariable() ? 0 : 1, count = pathExpression.pathSize(); index < count; index++) {

            // Retrieve the mapping
            String path = pathExpression.getPath(index);
            Object mapping = helper.getMappingNamed(managedType, path);

            // A collection mapping cannot be traversed
            if (helper.isCollectionMapping(mapping)) {
              addProblem(pathExpression, UpdateItem_RelationshipPathExpression);
              valid = false;
            }
            // Validate an intermediate path (n + 1, ..., n - 2)
            else if (index + 1 < count) {

              // A relationship mapping cannot be traversed
              if (helper.isRelationshipMapping(mapping)) {
                addProblem(pathExpression, UpdateItem_RelationshipPathExpression);
                valid = false;
              }
              // A basic mapping cannot be traversed
              else if (helper.isPropertyMapping(mapping)) {
                addProblem(pathExpression, UpdateItem_RelationshipPathExpression);
                valid = false;
              }
            }
          }
        }
        else {
          addProblem(pathExpression, StateFieldPathExpression_NotResolvable, pathExpression.toParsedText());
          valid = false;
        }
      }
    }
View Full Code Here


    if (expression.hasExpression()) {
      Expression factor = expression.getExpression();

      // Special case for state field path expression, association field is not allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(factor);

      if (pathExpression != null) {
        valid = validateStateFieldPathExpression(pathExpression, PathType.BASIC_FIELD_ONLY);
      }
      else {
View Full Code Here

    // Validate the "first" expression
    if (expression.hasExpression()) {
      Expression firstExpression = expression.getExpression();

      // Special case for state field path expression, association field is not allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(firstExpression);

      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, PathType.BASIC_FIELD_ONLY);
        updateStatus(result, 0, valid);
      }
View Full Code Here

    // Validate the entity expression
    if (expression.hasEntityExpression()) {
      Expression entityExpression = expression.getEntityExpression();

      // Special case for state field path expression, association field is allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(entityExpression);

      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, PathType.ASSOCIATION_FIELD_ONLY);
        updateStatus(result, 0, valid);
      }
View Full Code Here

    if (expression.hasEncapsulatedExpression()) {
      Expression encapsulatedExpression = expression.getExpression();

      // Special case for state field path expression, association field is not allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(encapsulatedExpression);

      if (pathExpression != null) {
        valid = validateStateFieldPathExpression(pathExpression, PathType.BASIC_FIELD_ONLY);
      }
      else {
View Full Code Here

    int result = 0;

    // Left expression
    if (expression.hasLeftExpression()) {
      Expression leftExpression = expression.getLeftExpression();
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(leftExpression);
      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, pathType);
        updateStatus(result, 0, valid);
      }
      else {
        leftExpression.accept(this);
      }
    }

    // Right expression
    if (expression.hasRightExpression()) {
      Expression rightExpression = expression.getRightExpression();
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(rightExpression);
      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, pathType);
        updateStatus(result, 1, valid);
      }
      else {
View Full Code Here

      }
    }
    // The identification variable actually represents a state field path expression that has
    // a virtual identification, validate that state field path expression instead
    else {
      StateFieldPathExpression pathExpression = expression.getStateFieldPathExpression();

      if (pathExpression != null) {
        pathExpression.accept(this);
      }
    }

    return valid;
  }
View Full Code Here

    // Validate the "first" expression
    if (expression.hasStringExpression()) {
      Expression stringExpression = expression.getStringExpression();

      // Special case for state field path expression, association field is not allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(stringExpression);

      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, PathType.BASIC_FIELD_ONLY);
        updateStatus(result, 0, valid);
      }
View Full Code Here

    // Validate the first expression
    if (expression.hasFirstExpression()) {
      Expression firstExpression = expression.getFirstExpression();

      // Special case for state field path expression, association field is not allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(firstExpression);

      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, PathType.BASIC_FIELD_ONLY);
        updateStatus(result, 0, valid);
      }
View Full Code Here

    // Validate the first expression
    if (expression.hasFirstExpression()) {
      Expression firstExpression = expression.getFirstExpression();

      // Special case for state field path expression, association field is not allowed
      StateFieldPathExpression pathExpression = getStateFieldPathExpression(firstExpression);

      if (pathExpression != null) {
        boolean valid = validateStateFieldPathExpression(pathExpression, PathType.BASIC_FIELD_ONLY);
        updateStatus(result, 0, valid);
      }
View Full Code Here

TOP

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

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.