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

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


    // 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, validPathExpressionTypeForStringExpression());
        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

  protected void validateSelectClause(SelectClause expression) {

    Expression selectExpression = expression.getSelectExpression();

    // Special case for state field path expression, all types are allowed
    StateFieldPathExpression pathExpression = getStateFieldPathExpression(selectExpression);

    if (pathExpression != null) {
      validateStateFieldPathExpression(pathExpression, selectClausePathExpressionPathType());
    }
    else {
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 expression
    if (expression.hasEncapsulatedExpression()) {
      Expression encapsulatedExpression = expression.getExpression();

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

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

    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);

            // Not resolvable
            if (mapping == null) {
              addProblem(pathExpression, UpdateItem_NotResolvable, pathExpression.toParsedText());
              valid = false;
              break;
            }
            // A collection mapping cannot be traversed or a value cannot be assigned to it
            else if (helper.isCollectionMapping(mapping)) {
              addProblem(pathExpression, UpdateItem_RelationshipPathExpression);
              valid = false;
              break;
            }
            // 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;
                break;
              }
              // A basic mapping cannot be traversed
              else if (helper.isPropertyMapping(mapping)) {
                addProblem(pathExpression, UpdateItem_RelationshipPathExpression);
                valid = false;
                break;
              }
              // Retrieve the embeddable mapping's reference managed type
              else {
                managedType = helper.getReferenceManagedType(mapping);

                if (managedType == null) {
                  addProblem(pathExpression, UpdateItem_NotResolvable, pathExpression.toParsedText());
                  valid = false;
                  break;
                }
              }
            }
          }
        }
        else {
          addProblem(pathExpression, UpdateItem_NotResolvable, pathExpression.toParsedText());
          valid = false;
        }
      }
      else {
        addProblem(pathExpression, UpdateItem_NotResolvable, expression.getStateFieldPathExpression().toParsedText());
View Full Code Here

  public void visit(IdentificationVariable expression) {

    // The identification variable is virtual, only do something
    // if it falsely represents a state field path expression
    if (expression.isVirtual()) {
      StateFieldPathExpression stateFieldPathExpression = expression.getStateFieldPathExpression();

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

    String variableName = expression.getVariableName();
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 expression
    if (expression.hasEncapsulatedExpression()) {
      Expression encapsulatedExpression = expression.getExpression();

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

      if (pathExpression != null) {
        return validateStateFieldPathExpression(pathExpression, PathType.ASSOCIATION_FIELD_ONLY);
      }
      else {
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.