Examples of IManagedType


Examples of org.eclipse.persistence.jpa.jpql.spi.IManagedType

  protected void resolveMappings() {

    if (!resolved) {
      resolved = true;
      IManagedTypeProvider provider = getManagedTypeProvider();
      IManagedType managedType = null;

      for (int index = 0, count = itemsSize(); index < count; index++) {

        // Identification variable
        if (index == 0) {
          StateObject stateObject = getIdentificationVariable();

          // The identification variable is not set, which means the traversal can happen
          if (stateObject != null) {
            managedType = getDeclaration().findManagedType(stateObject);
          }

          mappings.add(null);
        }
        // Resolve the path expression after the identification variable
        else if (managedType != null) {

          String path = getItem(index);

          // Cache the mapping
          IMapping mapping = managedType.getMappingNamed(path);
          mappings.add(mapping);

          // Continue by retrieving the managed type
          if (mapping != null) {
            managedType = provider.getManagedType(mapping.getType());
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.IManagedType

   */
  public IManagedType getManagedType(StateObject stateObject) {

    for (VariableDeclarationStateObject declaration : declarations()) {

      IManagedType managedType = declaration.getManagedType(stateObject);

      if (managedType != null) {
        return managedType;
      }
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.IManagedType

   */
  @Override
  public void visit(AbstractSchemaName expression) {

    String abstractSchemaName = expression.getText();
    IManagedType managedType = getManagedType(abstractSchemaName);

    // If a subquery defined in a WHERE clause of an update query,
    // then check for a path expression
    if (managedType == null) {

      // Find the identification variable from the UPDATE range declaration
      IdentificationVariable identificationVariable = findVirtualIdentificationVariable(expression);
      String variableName = (identificationVariable != null) ? identificationVariable.getText() : null;

      if (ExpressionTools.stringIsNotEmpty(variableName)) {

        Resolver parentResolver = queryContext.getResolver(identificationVariable);
        Resolver resolver = buildStateFieldResolver(parentResolver, abstractSchemaName);

        // Does not resolve to a valid path
        if (!resolver.getType().isResolvable()) {
          addProblem(expression, StateFieldPathExpression_NotResolvable, expression.toParsedText());
        }
        // Is not a relationship mapping
        else if (!MappingTypeHelper.isRelationshipMapping(resolver.getMapping())) {
          addProblem(expression, PathExpression_NotRelationshipMapping, expression.toParsedText());
        }
      }
      // The managed type does not exist
      else {
        addProblem(expression, AbstractSchemaName_Invalid, abstractSchemaName);
      }
    }
    // The managed type cannot be resolved
    else if (!managedType.getType().isResolvable()) {
      addProblem(expression, AbstractSchemaName_NotResolvable, abstractSchemaName);
    }
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.IManagedType

    if (expression.hasEntityExpression()) {
      Expression entityExpression = expression.getEntityExpression();

      // Check for embeddable type
      IType type = getType(entityExpression);
      IManagedType managedType = getManagedType(type);

      if (isEmbeddable(managedType)) {
        addProblem(entityExpression, CollectionMemberExpression_Embeddable);
      }
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.spi.IManagedType

      Expression childExpression = expression.getExpression();

      // Check for embeddable type
      IType type = getType(childExpression);
      IManagedType managedType = getManagedType(type);

      if (isEmbeddable(managedType)) {
        int distinctLength = Expression.DISTINCT.length() + 1; // +1 = space
        int startIndex  = position(childExpression) - distinctLength;
        int endIndex    = startIndex + length(childExpression) + distinctLength;
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType

   */
  public IManagedType getManagedType(StateObject stateObject) {

    for (VariableDeclarationStateObject declaration : declarations()) {

      IManagedType managedType = declaration.getManagedType(stateObject);

      if (managedType != null) {
        return managedType;
      }
    }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType

    /**
     * {@inheritDoc}
     */
    public Collection<IMapping> buildProposals() {

      IManagedType managedType = resolver.getManagedType();

      if (managedType == null) {
        return Collections.emptyList();
      }

View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType

  protected void resolveMappings() {

    if (!resolved) {
      resolved = true;
      IManagedTypeProvider provider = getManagedTypeProvider();
      IManagedType managedType = null;

      for (int index = 0, count = itemsSize(); index < count; index++) {

        // Identification variable
        if (index == 0) {
          StateObject stateObject = getIdentificationVariable();

          // The identification variable is not set, which means the traversal can happen
          if (stateObject != null) {
            managedType = getDeclaration().findManagedType(stateObject);
          }

          mappings.add(null);
        }
        // Resolve the path expression after the identification variable
        else if (managedType != null) {

          String path = getItem(index);

          // Cache the mapping
          IMapping mapping = managedType.getMappingNamed(path);
          mappings.add(mapping);

          // Continue by retrieving the managed type
          if (mapping != null) {
            managedType = provider.getManagedType(mapping.getType());
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType

  /**
   * {@inheritDoc}
   */
  public IManagedType findManagedType(StateObject stateObject) {
    IManagedType managedType = getManagedType(stateObject);
    if (managedType == null) {
      managedType = getParent().getParent().getDeclaration().findManagedType(stateObject);
    }
    return managedType;
  }
View Full Code Here

Examples of org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType

    /**
     * {@inheritDoc}
     */
    public Collection<IMapping> buildProposals() {

      IManagedType managedType = resolver.getManagedType();

      if (managedType == null) {
        return Collections.emptyList();
      }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.