public EntityType buildEntityType() { EntityType entityType = new EntityType(); if (baseEntityType != null) { entityType.setBaseType(baseEntityType); } if (!keyProperties.isEmpty()) { entityType.setKey(new Key().setKeys(keyProperties)); } if (!navProperties.isEmpty()) { entityType.setNavigationProperties(navProperties); } return entityType.setName(name) .setAbstract(isAbstract) .setHasStream(isMediaResource) .setProperties(properties) .setMapping(new Mapping().setMediaResourceMimeTypeKey(mediaResourceMimeTypeKey) .setMediaResourceSourceKey(mediaResourceSourceKey)); }
private FunctionImport buildEdmFunctionImport(final Method method, final EdmFunctionImport edmAnnotationFunctionImport) throws ODataJPAModelException { if (edmAnnotationFunctionImport != null && edmAnnotationFunctionImport.returnType() != null) { FunctionImport functionImport = new FunctionImport(); if ("".equals(edmAnnotationFunctionImport.name())) { 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); buildEdmParameter(functionImport, method); return functionImport; } return null; }
JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name);
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
JPAEdmMapping oldMapping = (JPAEdmMapping) mapping; newMapping.setJPAColumnName(oldMapping.getJPAColumnName()); newMapping.setInternalName(embeddablePropertyName + "." + mapping.getInternalName()); newMapping.setObject(mapping.getObject()); newMapping.setJPAType(oldMapping.getJPAType()); newSimpleProperty.setMapping(newMapping); } catch (ClassCastException e) { ComplexProperty complexProperty = (ComplexProperty) property; String name = embeddablePropertyName + "." + complexProperty.getMapping().getInternalName(); expandEdmComplexType(searchComplexTypeByName(complexProperty.getName()), expandedList, name);
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entityView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entityView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entityView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
public EntityType buildEntityType() { EntityType entityType = new EntityType(); if (baseEntityType != null) { entityType.setBaseType(baseEntityType); } if (!keyProperties.isEmpty()) { entityType.setKey(new Key().setKeys(keyProperties)); } if (!navProperties.isEmpty()) { entityType.setNavigationProperties(navProperties); } return entityType.setName(name) .setAbstract(isAbstract) .setHasStream(isMediaResource) .setProperties(properties) .setMapping(new Mapping().setMediaResourceMimeTypeKey(mediaResourceMimeTypeKey) .setMediaResourceSourceKey(mediaResourceSourceKey)); }
private FunctionImport buildEdmFunctionImport(final Method method, final EdmFunctionImport edmAnnotationFunctionImport) throws ODataJPAModelException { if (edmAnnotationFunctionImport != null && edmAnnotationFunctionImport.returnType() != null) { FunctionImport functionImport = new FunctionImport(); if ("".equals(edmAnnotationFunctionImport.name())) { 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); buildEdmParameter(functionImport, method); return functionImport; } return null; }
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entitySetView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entitySetView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entitySetView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
public static void build(final JPAEdmComplexPropertyView complexView, final String parentComplexTypeName, final boolean skipDefaultNaming) { 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 (skipDefaultNaming == false && propertyName == null) { propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1); } else if (propertyName == null) { propertyName = jpaAttributeName; } JPAEdmMapping mapping = new JPAEdmMappingImpl(); ((Mapping) mapping).setInternalName(jpaAttributeName); mapping.setJPAType(propertyView.getJPAAttribute().getJavaType()); complexProperty.setMapping((Mapping) mapping); complexProperty.setName(propertyName); }
protected List<JPAJoinClause> generateJoinClauses() throws ODataJPARuntimeException, EdmException { List<JPAJoinClause> jpaOuterJoinClauses = new ArrayList<JPAJoinClause>(); JPAJoinClause jpaOuterJoinClause = null; String joinCondition = null; String entityAlias = generateJPAEntityAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(entityView.getKeyPredicates(), entityAlias); EdmEntityType entityType = entityView.getStartEntitySet().getEntityType(); Mapping mapping = (Mapping) entityType.getMapping(); String entityTypeName = null; if (mapping != null) { entityTypeName = mapping.getInternalName(); } else { entityTypeName = entityType.getName(); } jpaOuterJoinClause = new JPAJoinClause(entityTypeName, entityAlias, null, null, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); for (NavigationSegment navigationSegment : entityView.getNavigationSegments()) { EdmNavigationProperty navigationProperty = navigationSegment.getNavigationProperty(); String relationShipAlias = generateRelationShipAlias(); joinCondition = ODataExpressionParser.parseKeyPredicates(navigationSegment.getKeyPredicates(), relationShipAlias); jpaOuterJoinClause = new JPAJoinClause(getFromEntityName(navigationProperty), entityAlias, getRelationShipName(navigationProperty), relationShipAlias, joinCondition, JPAJoinClause.JOIN.INNER); jpaOuterJoinClauses.add(jpaOuterJoinClause); } return jpaOuterJoinClauses; }
public static void build(final JPAEdmComplexPropertyView complexView, final String parentComplexTypeName, final boolean skipDefaultNaming) { 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 (skipDefaultNaming == false && propertyName == null) { propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1); } else if (propertyName == null) { propertyName = jpaAttributeName; } JPAEdmMapping mapping = new JPAEdmMappingImpl(); ((Mapping) mapping).setInternalName(jpaAttributeName); mapping.setJPAType(propertyView.getJPAAttribute().getJavaType()); complexProperty.setMapping((Mapping) mapping); complexProperty.setName(propertyName); }
public static void build(final JPAEdmEntitySetView view, final JPAEdmEntityTypeView entityTypeView) { FullQualifiedName fQname = view.getEdmEntitySet().getEntityType(); JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess(); String entitySetName = null; if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { Mapping mapping = entityTypeView.getEdmEntityType().getMapping(); if (mapping != null) { entitySetName = mappingModelAccess.mapJPAEntitySet(mapping.getInternalName()); } } if (entitySetName == null) { entitySetName = fQname.getName(); } view.getEdmEntitySet().setName(entitySetName); }
public static void build(final JPAEdmComplexPropertyView complexView, final JPAEdmPropertyView propertyView, final boolean skipDefaultNaming) { 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 (skipDefaultNaming == false && propertyName == null) { propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1); } else if (propertyName == null) { propertyName = jpaAttributeName; } // 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); }
public static void build(final JPAEdmEntitySetView view, final JPAEdmEntityTypeView entityTypeView) { FullQualifiedName fQname = view.getEdmEntitySet().getEntityType(); JPAEdmMappingModelAccess mappingModelAccess = view.getJPAEdmMappingModelAccess(); String entitySetName = null; if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { Mapping mapping = entityTypeView.getEdmEntityType().getMapping(); if (mapping != null) { entitySetName = mappingModelAccess.mapJPAEntitySet(mapping.getInternalName()); } } if (entitySetName == null) { entitySetName = fQname.getName() + ENTITY_SET_SUFFIX; } view.getEdmEntitySet().setName(entitySetName); }
public static void build(final JPAEdmComplexPropertyView complexView, final JPAEdmPropertyView propertyView, final boolean skipDefaultNaming) { 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 (skipDefaultNaming == false && propertyName == null) { propertyName = Character.toUpperCase(jpaAttributeName.charAt(0)) + jpaAttributeName.substring(1); } else if (propertyName == null) { propertyName = jpaAttributeName; } // 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); }
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); }
((Mapping) mapping).setInternalName(jpaAttributeName); view.getEdmSimpleProperty().setMapping((Mapping) mapping);
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); }
((Mapping) mapping).setInternalName(jpaAttributeName); view.getEdmSimpleProperty().setMapping((Mapping) mapping);