Package org.apache.olingo.odata2.api.edm.provider

Examples of org.apache.olingo.odata2.api.edm.provider.ComplexType


    assertTrue(objComplexType.getConsistentEdmComplexTypes().size() > 1);
  }

  @Test
  public void testExpandEdmComplexType() {
    ComplexType complexType = new ComplexType();
    List<Property> properties = new ArrayList<Property>();
    JPAEdmMapping mapping1 = new JPAEdmMappingImpl();
    mapping1.setJPAColumnName("LINEITEMID");
    ((Mapping) mapping1).setInternalName("LineItemKey.LiId");
    JPAEdmMapping mapping2 = new JPAEdmMappingImpl();
    mapping2.setJPAColumnName("LINEITEMNAME");
    ((Mapping) mapping2).setInternalName("LineItemKey.LiName");
    properties.add(new SimpleProperty().setName("LIID").setMapping((Mapping) mapping1));
    properties.add(new SimpleProperty().setName("LINAME").setMapping((Mapping) mapping2));
    complexType.setProperties(properties);
    List<Property> expandedList = null;
    try {
      objComplexType.expandEdmComplexType(complexType, expandedList, "SalesOrderItemKey");
    } catch (ClassCastException e) {
      assertTrue(false);
View Full Code Here


  }

  @Override
  public ComplexType searchEdmComplexType(final String arg0) {
    if (arg0.equals(JPACustomProcessorMock.class.getName())) {
      return new ComplexType().setName(JPACustomProcessorMock.edmName);
    } else {
      return null;
    }
  }
View Full Code Here

    return null;

  }

  private ComplexType buildComplexTypeB() {
    ComplexType complexType = new ComplexType();
    complexType.setProperties(buildPropertiesB());

    return complexType;
  }
View Full Code Here

    return propertyList;
  }

  private ComplexType buildComplexTypeA() {
    ComplexType complexType = new ComplexType();
    complexType.setProperties(buildPropertiesA());

    return complexType;
  }
View Full Code Here

      } else {
        propertyRefList = key.getKeys();
      }

      if (isBuildModeComplexType) {
        ComplexType complexType =
            complexTypeView.searchEdmComplexType(propertyView.getJPAAttribute().getJavaType().getName());
        normalizeComplexKey(complexType, propertyRefList);
      } else {
        PropertyRef propertyRef = new PropertyRef();
        propertyRef.setName(propertyView.getEdmSimpleProperty().getName());
View Full Code Here

    EdmProvider edmProvider = mock(EdmProvider.class);

    EntityType entityType = new EntityType().setName("EntityType1");
    when(edmProvider.getEntityType(new FullQualifiedName("EntityType1Ns", "EntityType1"))).thenReturn(entityType);

    ComplexType complexType = new ComplexType().setName("ComplexType1");
    when(edmProvider.getComplexType(new FullQualifiedName("ComplexType1Ns", "ComplexType1"))).thenReturn(complexType);

    Association association = new Association().setName("Association1");
    when(edmProvider.getAssociation(new FullQualifiedName("Association1Ns", "Association1"))).thenReturn(association);
View Full Code Here

          EdmSimpleTypeKind edmSimpleTypeKind = JPATypeConvertor.convertToEdmSimpleType(methodReturnType, null);
          functionReturnType.setTypeName(edmSimpleTypeKind.getFullQualifiedName());

          break;
        case COMPLEX_TYPE:
          ComplexType complexType = null;
          if (multiplicity == Multiplicity.ONE) {
            complexType = jpaEdmComplexTypeView.searchEdmComplexType(methodReturnType.getName());
          } else if (multiplicity == Multiplicity.MANY) {
            complexType = jpaEdmComplexTypeView.searchEdmComplexType(getReturnTypeName(method));
          }
          if (complexType == null) {
            throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_RETURN_TYPE_ENTITY_NOT_FOUND
                .addContent(method.getDeclaringClass(), method.getName(), methodReturnType.getSimpleName()), null);
          }
          functionReturnType.setTypeName(JPAEdmNameBuilder.build(schemaView, complexType.getName()));
          break;
        default:
          break;
        }
        functionImport.setReturnType(functionReturnType);
View Full Code Here

    if (edmComplexTypeName == null) {
      edmComplexTypeName = jpaEmbeddableTypeName;
    }

    view.getEdmComplexType().setName(edmComplexTypeName);
    ComplexType complexType = view.getEdmComplexType();
    complexType.setName(edmComplexTypeName);
    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAType(view.getJPAEmbeddableType().getJavaType());
    complexType.setMapping((Mapping) mapping);

  }
View Full Code Here

        }

        JPAEdmPropertyView propertyView = new JPAEdmProperty(schemaView, JPAEdmComplexType.this);
        propertyView.getBuilder().build();

        currentComplexType = new ComplexType();
        currentComplexType.setProperties(propertyView.getEdmPropertyList());
        JPAEdmNameBuilder.build(JPAEdmComplexType.this);

        searchMap.put(searchKey, currentComplexType);
        consistentComplextTypes.add(currentComplexType);
View Full Code Here

            keyViewBuilder.build();
          }

          break;
        case EMBEDDED:
          ComplexType complexType = complexTypeView
              .searchEdmComplexType(currentAttribute.getJavaType().getName());

          if (complexType == null) {
            JPAEdmComplexTypeView complexTypeViewLocal = new JPAEdmComplexType(
                schemaView, currentAttribute);
            complexTypeViewLocal.getBuilder().build();
            complexType = complexTypeViewLocal.getEdmComplexType();
            complexTypeView.addJPAEdmCompleTypeView(complexTypeViewLocal);

          }

          if (isBuildModeComplexType == false
              && entityTypeView.getJPAEntityType().getIdType()
                  .getJavaType()
                  .equals(currentAttribute.getJavaType())) {

            if (keyView == null) {
              keyView = new JPAEdmKey(complexTypeView,
                  JPAEdmProperty.this);
            }
            keyView.getBuilder().build();
            complexTypeView.expandEdmComplexType(complexType, properties, currentAttribute.getName());
          } else {
            currentComplexProperty = new ComplexProperty();
            if (isBuildModeComplexType) {
              JPAEdmNameBuilder
                  .build((JPAEdmComplexPropertyView) JPAEdmProperty.this,
                      complexTypeView.getJPAEmbeddableType().getJavaType().getSimpleName());
            } else {
              JPAEdmNameBuilder
                  .build((JPAEdmComplexPropertyView) JPAEdmProperty.this,
                      JPAEdmProperty.this);
            }
            currentComplexProperty.setType(new FullQualifiedName(
                schemaView.getEdmSchema().getNamespace(),
                complexType.getName()));

            properties.add(currentComplexProperty);
            List<String> nonKeyComplexTypes = schemaView.getNonKeyComplexTypeList();
            if (!nonKeyComplexTypes.contains(currentComplexProperty.getType().getName()))
            {
View Full Code Here

TOP

Related Classes of org.apache.olingo.odata2.api.edm.provider.ComplexType

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.