Package org.eclipse.persistence.jpa.jpql.tools.resolver

Examples of org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver


  /**
   * {@inheritDoc}
   */
  public IMapping resolveMapping(String variableName, String name) {

    Resolver parent = queryContext.getResolver(variableName);
    Resolver resolver = parent.getChild(name);

    if (resolver == null) {
      resolver = new StateFieldResolver(parent, name);
      parent.addChild(variableName, resolver);
    }

    return resolver.getMapping();
  }
View Full Code Here


           expression.startsWithDot()) {

        return;
      }

      Resolver resolver = queryContext.getResolver(expression.getIdentificationVariable());

      // Can't continue to resolve the path expression
      if (resolver == null) {
        return;
      }

      // Now traverse the path expression after the identification variable
      for (int index = expression.hasVirtualIdentificationVariable() ? 0 : 1, count = expression.pathSize(); index < count; index++) {

        // Retrieve the mapping for the path at the current position
        String path = expression.getPath(index);
        Resolver childResolver = resolver.getChild(path);

        if (childResolver == null) {
          childResolver = new StateFieldResolver(resolver, path);
          resolver.addChild(path, childResolver);
        }

        IMapping mapping = childResolver.getMapping();

        // Invalid path expression
        if (mapping == null) {
          break;
        }
View Full Code Here

    if (ExpressionTools.stringIsNotEmpty(identificationVariable) &&
        isValidProposal(identificationVariable, word)) {

      // Resolve the identification variable
      Resolver resolver = queryContext.getResolver(identificationVariable);
      IEntity entity = queryContext.getProvider().getEntity(resolver.getType());

      // The identification variable identifies an entity, add the extra information
      if (entity != null) {
        proposals.addRangeIdentificationVariable(identificationVariable, entity);
      }
View Full Code Here

  protected void visitPathExpression(AbstractPathExpression expression, Filter<IMapping> filter) {

    MappingCollector mappingCollector = getDefaultMappingCollector();
    int position = queryPosition.getPosition(expression);
    boolean mappingCollectorCreated = false;
    Resolver resolver = null;
    int length = 0;

    for (int index = 0, count = expression.pathSize(); index < count; index++) {
      String path = expression.getPath(index);

      // We're at the position, create the ChoiceBuilder
      if (position <= length + path.length()) {

        if (length == position) {
          path = ExpressionTools.EMPTY_STRING;
        }
        else if (position - length > -1) {
          path = path.substring(0, position - length);
        }

        // Special case where the path expression only has the
        // identification variable set
        if (resolver == null) {
          break;
        }

        mappingCollector = buildFilteringMappingCollector(expression, resolver, filter, path);
        mappingCollectorCreated = true;
        break;
      }
      // The path is entirely before the position of the cursor
      else {
        // The first path is always an identification variable
        if (resolver == null) {
          resolver = queryContext.getResolver(expression.getIdentificationVariable());
        }
        // Any other path is a property or collection-valued path
        else if ((index + 1 < count) || expression.endsWithDot()) {
          Resolver childResolver = resolver.getChild(path);
          if (childResolver == null) {
            childResolver = new StateFieldResolver(resolver, path);
            resolver.addChild(path, childResolver);
            resolver = childResolver;
          }
View Full Code Here

           expression.startsWithDot()) {

        return;
      }

      Resolver resolver = queryContext.getResolver(expression.getIdentificationVariable());

      // Can't continue to resolve the path expression
      if (resolver == null) {
        return;
      }

      // Now traverse the path expression after the identification variable
      for (int index = expression.hasVirtualIdentificationVariable() ? 0 : 1, count = expression.pathSize(); index < count; index++) {

        // Retrieve the mapping for the path at the current position
        String path = expression.getPath(index);
        Resolver childResolver = resolver.getChild(path);

        if (childResolver == null) {
          childResolver = new StateFieldResolver(resolver, path);
          resolver.addChild(path, childResolver);
        }

        IMapping mapping = childResolver.getMapping();

        // Invalid path expression
        if (mapping == null) {
          break;
        }
View Full Code Here

  /**
   * {@inheritDoc}
   */
  public IMapping resolveMapping(String variableName, String name) {

    Resolver parent = queryContext.getResolver(variableName);
    Resolver resolver = parent.getChild(name);

    if (resolver == null) {
      resolver = new StateFieldResolver(parent, name);
      parent.addChild(variableName, resolver);
    }

    return resolver.getMapping();
  }
View Full Code Here

    if (ExpressionTools.stringIsNotEmpty(identificationVariable) &&
        isValidProposal(identificationVariable, word)) {

      // Resolve the identification variable
      Resolver resolver = queryContext.getResolver(identificationVariable);
      IEntity entity = queryContext.getProvider().getEntity(resolver.getType());

      // The identification variable identifies an entity, add the extra information
      if (entity != null) {
        proposals.addRangeIdentificationVariable(identificationVariable, entity);
      }
View Full Code Here

  protected void visitPathExpression(AbstractPathExpression expression, Filter<IMapping> filter) {

    MappingCollector mappingCollector = getDefaultMappingCollector();
    int position = queryPosition.getPosition(expression);
    boolean mappingCollectorCreated = false;
    Resolver resolver = null;
    int length = 0;

    for (int index = 0, count = expression.pathSize(); index < count; index++) {
      String path = expression.getPath(index);

      // We're at the position, create the ChoiceBuilder
      if (position <= length + path.length()) {

        if (length == position) {
          path = ExpressionTools.EMPTY_STRING;
        }
        else if (position - length > -1) {
          path = path.substring(0, position - length);
        }

        // Special case where the path expression only has the
        // identification variable set
        if (resolver == null) {
          break;
        }

        mappingCollector = buildFilteringMappingCollector(expression, resolver, filter, path);
        mappingCollectorCreated = true;
        break;
      }
      // The path is entirely before the position of the cursor
      else {
        // The first path is always an identification variable
        if (resolver == null) {
          resolver = queryContext.getResolver(expression.getIdentificationVariable());
        }
        // Any other path is a property or collection-valued path
        else if ((index + 1 < count) || expression.endsWithDot()) {
          Resolver childResolver = resolver.getChild(path);
          if (childResolver == null) {
            childResolver = new StateFieldResolver(resolver, path);
            resolver.addChild(path, childResolver);
            resolver = childResolver;
          }
View Full Code Here

           expression.startsWithDot()) {

        return;
      }

      Resolver resolver = queryContext.getResolver(expression.getIdentificationVariable());

      // Can't continue to resolve the path expression
      if (resolver == null) {
        return;
      }

      // Now traverse the path expression after the identification variable
      for (int index = expression.hasVirtualIdentificationVariable() ? 0 : 1, count = expression.pathSize(); index < count; index++) {

        // Retrieve the mapping for the path at the current position
        String path = expression.getPath(index);
        Resolver childResolver = resolver.getChild(path);

        if (childResolver == null) {
          childResolver = new StateFieldResolver(resolver, path);
          resolver.addChild(path, childResolver);
        }

        IMapping mapping = childResolver.getMapping();

        // Invalid path expression
        if (mapping == null) {
          break;
        }
View Full Code Here

    if (ExpressionTools.stringIsNotEmpty(identificationVariable) &&
        isValidProposal(identificationVariable, word)) {

      // Resolve the identification variable
      Resolver resolver = queryContext.getResolver(identificationVariable);
      IEntity entity = queryContext.getProvider().getEntity(resolver.getType());

      // The identification variable identifies an entity, add the extra information
      if (entity != null) {
        proposals.addRangeIdentificationVariable(identificationVariable, entity);
      }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.tools.resolver.Resolver

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.