/* * ************************************************************************ * EDM Complex Property Name - RULES * ************************************************************************ * The first character of JPA complex attribute name is converted to * uppercase. The modified JPA complex attribute name is assigned as EDM * complex property name. The unmodified JPA complex attribute name is * assigned as internal name. * ************************************************************************ * EDM Complex Property Name - RULES * ************************************************************************ */ public static void build( final JPAEdmComplexPropertyView complexView, final JPAEdmPropertyView propertyView) { ComplexProperty complexProperty = complexView.getEdmComplexProperty(); String jpaAttributeName = propertyView.getJPAAttribute().getName(); String jpaEntityTypeName = propertyView.getJPAEdmEntityTypeView().getJPAEntityType().getName(); JPAEdmMappingModelAccess mappingModelAccess = complexView.getJPAEdmMappingModelAccess(); String propertyName = null; if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { propertyName = mappingModelAccess.mapJPAAttribute(jpaEntityTypeName, jpaAttributeName); } if (propertyName == null) { propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1); } // change for navigation property issue JPAEdmMapping mapping = new JPAEdmMappingImpl(); ((Mapping) mapping).setInternalName(jpaAttributeName); mapping.setJPAType(propertyView.getJPAAttribute().getJavaType()); complexProperty.setMapping((Mapping) mapping); complexProperty.setName(propertyName); }
/* * ************************************************************************ * EDM EntityType Name - RULES * ************************************************************************ * EDM Entity Type Name = JPA Entity Name EDM Entity Type Internal Name = * JPA Entity Name * ************************************************************************ * EDM Entity Type Name - RULES * ************************************************************************ */ public static void build(final JPAEdmEntityTypeView view) { EntityType edmEntityType = view.getEdmEntityType(); String jpaEntityName = view.getJPAEntityType().getName(); JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess(); 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 edmEntityType.setMapping(((Mapping) mapping).setInternalName(jpaEntityName)); edmEntityType.setName(edmEntityTypeName); }
public static void build( final JPAEdmComplexPropertyView complexView, final String parentComplexTypeName) { ComplexProperty complexProperty = complexView.getEdmComplexProperty(); JPAEdmMappingModelAccess mappingModelAccess = complexView.getJPAEdmMappingModelAccess(); JPAEdmPropertyView propertyView = ((JPAEdmPropertyView) complexView); String jpaAttributeName = propertyView.getJPAAttribute().getName(); String propertyName = null; if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { propertyName = mappingModelAccess.mapJPAEmbeddableTypeAttribute(parentComplexTypeName, jpaAttributeName); } if (propertyName == null) { propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1); } JPAEdmMapping mapping = new JPAEdmMappingImpl(); ((Mapping) mapping).setInternalName(jpaAttributeName); mapping.setJPAType(propertyView.getJPAAttribute().getJavaType()); complexProperty.setMapping((Mapping) mapping); complexProperty.setName(propertyName); }