Examples of JPAEdmMapping


Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

      final String accessModifier)
      throws ODataJPARuntimeException {

    try {

      JPAEdmMapping navPropMapping = (JPAEdmMapping) navigationProperty.getMapping();
      String name = getAccessModifierName(navigationProperty.getName(), (EdmMapping) navPropMapping, accessModifier);

      Class<?>[] params = null;
      if (accessModifier.equals(ACCESS_MODIFIER_SET)) {
        EdmAssociationEnd end = navigationProperty.getRelationship().getEnd(navigationProperty.getToRole());
        switch (end.getMultiplicity()) {
        case MANY:
          params = new Class<?>[] { navPropMapping.getJPAType() };
          break;
        case ONE:
          params = new Class<?>[] { ((JPAEdmMapping) end.getEntityType().getMapping()).getJPAType() };
        default:
          break;
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

              embeddableKey.put(propertyName, methodName);
              continue;
            }
          } else {
            if (accessModifier.equals(ACCESS_MODIFIER_SET)) {
              JPAEdmMapping jpaEdmMapping = (JPAEdmMapping) property.getMapping();
              accessModifierMap.put(propertyName, jpaEntityType.getMethod(methodName,
                  new Class<?>[] { jpaEdmMapping.getJPAType() }));
            } else {
              method = jpaEntityType.getMethod(methodName, (Class<?>[]) null);
            }
          }
        } catch (EdmException exp) {
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

          functionImport.setName(method.getName());
        } else {
          functionImport.setName(edmAnnotationFunctionImport.name());
        }

        JPAEdmMapping mapping = new JPAEdmMappingImpl();
        ((Mapping) mapping).setInternalName(method.getName());
        mapping.setJPAType(method.getDeclaringClass());
        functionImport.setMapping((Mapping) mapping);

        functionImport.setHttpMethod(edmAnnotationFunctionImport.httpMethod().name().toString());

        buildEdmReturnType(functionImport, method, edmAnnotationFunctionImport);
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

    private void buildEdmParameter(final FunctionImport functionImport, final Method method)
        throws ODataJPAModelException {
      Annotation[][] annotations = method.getParameterAnnotations();
      Class<?>[] parameterTypes = method.getParameterTypes();
      List<FunctionImportParameter> funcImpList = new ArrayList<FunctionImportParameter>();
      JPAEdmMapping mapping = null;
      int j = 0;
      for (Annotation[] annotationArr : annotations) {
        Class<?> parameterType = parameterTypes[j++];

        for (Annotation element : annotationArr) {
          if (element instanceof EdmFunctionImportParameter) {
            EdmFunctionImportParameter annotation = (EdmFunctionImportParameter) element;
            FunctionImportParameter functionImportParameter = new FunctionImportParameter();
            if (annotation.name().equals("")) {
              throw ODataJPAModelException.throwException(ODataJPAModelException.FUNC_PARAM_NAME_EXP.addContent(method
                  .getDeclaringClass().getName(), method.getName()), null);
            } else {
              functionImportParameter.setName(annotation.name());
            }

            functionImportParameter.setType(JPATypeConvertor.convertToEdmSimpleType(parameterType, null));

            Facets facets = new Facets();
            if (annotation.facets().maxLength() > 0) {
              facets.setMaxLength(annotation.facets().maxLength());
            }
            if (annotation.facets().nullable() == false) {
              facets.setNullable(false);
            } else {
              facets.setNullable(true);
            }

            if (annotation.facets().precision() > 0) {
              facets.setPrecision(annotation.facets().precision());
            }
            if (annotation.facets().scale() >= 0) {
              facets.setScale(annotation.facets().scale());
            }

            functionImportParameter.setFacets(facets);
            mapping = new JPAEdmMappingImpl();
            mapping.setJPAType(parameterType);
            functionImportParameter.setMapping((Mapping) mapping);
            funcImpList.add(functionImportParameter);
          }
        }
      }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

        if (isExcluded(JPAEdmEntityType.this)) {
          continue;
        }

        JPAEdmNameBuilder.build(JPAEdmEntityType.this);
        JPAEdmMapping jpaEdmMapping = (JPAEdmMapping) currentEdmEntityType.getMapping();
        EntityListeners entityListners = currentJPAEntityType.getJavaType().getAnnotation(EntityListeners.class);
        if (entityListners != null) {
          for (Class<? extends ODataJPATombstoneEntityListener> entityListner : entityListners.value())
          {
            try {
              jpaEdmMapping.setODataJPATombstoneEntityListener(entityListner);
              break;
            } catch (ClassCastException e) {
              continue;
            }
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

      final String accessModifier)
      throws ODataJPARuntimeException {

    try {

      JPAEdmMapping navPropMapping = (JPAEdmMapping) navigationProperty.getMapping();
      String name = getAccessModifierName(navigationProperty.getName(), (EdmMapping) navPropMapping, accessModifier);

      Class<?>[] params = null;
      if (accessModifier.equals(ACCESS_MODIFIER_SET)) {
        EdmAssociationEnd end = navigationProperty.getRelationship().getEnd(navigationProperty.getToRole());
        switch (end.getMultiplicity()) {
        case MANY:
          params = new Class<?>[] { navPropMapping.getJPAType() };
          break;
        case ONE:
          params = new Class<?>[] { ((JPAEdmMapping) end.getEntityType().getMapping()).getJPAType() };
        default:
          break;
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

              embeddableKey.put(propertyName, methodName);
              continue;
            }
          } else {
            if (accessModifier.equals(ACCESS_MODIFIER_SET)) {
              JPAEdmMapping jpaEdmMapping = (JPAEdmMapping) property.getMapping();
              accessModifierMap.put(propertyName, jpaEntityType.getMethod(methodName,
                  new Class<?>[] { jpaEdmMapping.getJPAType() }));
            } else {
              method = jpaEntityType.getMethod(methodName, (Class<?>[]) null);
            }
          }
        } catch (EdmException exp) {
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

  @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;
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

    String edmEntityTypeName = null;
    if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) {
      edmEntityTypeName = mappingModelAccess.mapJPAEntityType(jpaEntityName);
    }

    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAType(view.getJPAEntityType().getJavaType());

    if (edmEntityTypeName == null) {
      edmEntityTypeName = jpaEntityName;
    }
    // Setting the mapping object
View Full Code Here

Examples of org.apache.olingo.odata2.jpa.processor.api.model.JPAEdmMapping

      propertyName = jpaAttributeName;
    }

    view.getEdmSimpleProperty().setName(propertyName);

    JPAEdmMapping mapping = new JPAEdmMappingImpl();
    mapping.setJPAType(jpaAttribute.getJavaType());

    AnnotatedElement annotatedElement = (AnnotatedElement) jpaAttribute.getJavaMember();
    if (annotatedElement != null) {
      Column column = annotatedElement.getAnnotation(Column.class);
      if (column != null) {
        mapping.setJPAColumnName(column.name());
      } else {
        JoinColumn joinColumn = annotatedElement.getAnnotation(JoinColumn.class);
        if (joinColumn != null) {
          mapping.setJPAColumnName(joinColumn.name());
          jpaAttributeName += "." + view.getJPAReferencedAttribute().getName();
        }
      }
    } else {
      ManagedType<?> managedType = jpaAttribute.getDeclaringType();
      if (managedType != null) {
        Class<?> clazz = managedType.getJavaType();
        try {
          Field field = clazz.getField(jpaAttributeName);
          Column column = field.getAnnotation(Column.class);
          if (column != null) {
            mapping.setJPAColumnName(column.name());
          }
        } catch (SecurityException e) {

        } catch (NoSuchFieldException e) {
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.