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

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


        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());
          }
          else {
            managedType = null;
          }
        }
View Full Code Here


   * {@inheritDoc}
   */
  @Override
  protected IManagedType resolveManagedType() {

    IMapping mapping = getMapping();

    if (mapping == null) {
      return null;
    }

    TypeHelper typeHelper = getTypeHelper();
    ITypeDeclaration typeDeclaration = mapping.getTypeDeclaration();
    IType type = typeDeclaration.getType();

    // Collection type cannot be traversed
    // Example: SELECT e.employees. FROM Employee e where employees is a collection,
    // it cannot be traversed
View Full Code Here

    if (relationshipMapping == null) {
      return null;
    }

    IMapping mapping = (IMapping) relationshipMapping;
    return mapping.getParent().getProvider().getManagedType(mapping.getType());
  }
View Full Code Here

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

        IMapping mapping = childResolver.getMapping();

        // Invalid path expression
        if (mapping == null) {
          break;
        }

        // The name matches
        if (mapping.getName().equals(oldAttributeName)) {

          // Make sure the field name is from the right type
          String parentTypeName = mapping.getParent().getType().getName();

          if (parentTypeName.equals(typeName)) {
            int extraOffset = expression.toParsedText(0, index).length() + 1 /* '.' */;
            addTextEdit(expression, extraOffset, oldAttributeName, newAttributeName);
            break;
View Full Code Here

        appendable = !conditionalExpression;
      }
      else {

        // Resolve the mapping so we can determine what is valid based on its type
        IMapping mapping = queryContext.getMapping(expression);

        if (mapping == null) {
          appendable = false;
        }
        else {
          IType type = mapping.getType();

          switch (appendableType) {
            case ARITHMETIC: {
              // e.name (String) cannot be followed by +,-,/,*
              // e.age (int) can be followed by an arithmetic operator
View Full Code Here

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

        IMapping mapping = childResolver.getMapping();

        // Invalid path expression
        if (mapping == null) {
          break;
        }

        // The name matches
        if (mapping.getName().equals(oldAttributeName)) {

          // Make sure the field name is from the right type
          String parentTypeName = mapping.getParent().getType().getName();

          if (parentTypeName.equals(typeName)) {
            int extraOffset = expression.toParsedText(0, index).length() + 1 /* '.' */;
            addTextEdit(expression, extraOffset, oldAttributeName, newAttributeName);
            break;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public int getMappingType() {
      IMapping mapping = resolver.getMapping();
      return (mapping != null) ? mapping.getMappingType() : IMappingType.TRANSIENT;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public boolean isCollection() {
      IMapping mapping = resolver.getMapping();
      return (mapping != null) ? mapping.isCollection() : false;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public boolean isProperty() {
      IMapping mapping = resolver.getMapping();
      return (mapping != null) ? mapping.isProperty() : (mappingType == MappingType.PROPERTY);
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public boolean isRelationship() {
      IMapping mapping = resolver.getMapping();
      return (mapping != null) ? mapping.isRelationship() : (mappingType == MappingType.RELATIONSHIP);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.persistence.jpa.jpql.tools.spi.IMapping

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.