public EntityType getEntityType(String name) { for (EntityType type: entityTypes) { if (name.equals(type.getName())) { return type; } } return null; }
private EntityType getEntityType(Schema schema, String entityTypeName) throws ODataException { List<EntityType> types = schema.getEntityTypes(); if (types == null) { return null; } for (EntityType type : types) { if (type.getName().equals(entityTypeName)) { return type; } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { Schema schema = namespace2Schema.get(edmFQName.getNamespace()); if (schema != null) { List<EntityType> complexTypes = schema.getEntityTypes(); for (EntityType complexType : complexTypes) { if (complexType.getName().equals(edmFQName.getName())) { return complexType; } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { Schema schema = namespace2Schema.get(edmFQName.getNamespace()); if (schema != null) { List<EntityType> complexTypes = schema.getEntityTypes(); for (EntityType complexType : complexTypes) { if (complexType.getName().equals(edmFQName.getName())) { return complexType; } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { Schema schema = namespace2Schema.get(edmFQName.getNamespace()); if (schema != null) { List<EntityType> complexTypes = schema.getEntityTypes(); for (EntityType complexType : complexTypes) { if (complexType.getName().equals(edmFQName.getName())) { return complexType; } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { for (Schema schema : dataServices.getSchemas()) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { for (EntityType entityType : schema.getEntityTypes()) { if (entityType.getName().equals(edmFQName.getName())) { return entityType; } } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { for (Schema schema : dataServices.getSchemas()) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { for (EntityType entityType : schema.getEntityTypes()) { if (entityType.getName().equals(edmFQName.getName())) { return entityType; } } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { for (Schema schema : dataServices.getSchemas()) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { for (EntityType entityType : schema.getEntityTypes()) { if (entityType.getName().equals(edmFQName.getName())) { return entityType; } } } } return null; }
private void validateEntityTypes() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityType> entityTypes : entityTypesMap.entrySet()) { if (entityTypes.getValue() != null && entityTypes.getKey() != null) { EntityType entityType = entityTypes.getValue(); if (entityType.getBaseType() != null) { FullQualifiedName baseTypeFQName = entityType.getBaseType(); EntityType baseEntityType; if (!entityTypesMap.containsKey(baseTypeFQName)) { FullQualifiedName fqName = validateEntityTypeWithAlias(baseTypeFQName); baseEntityType = entityTypesMap.get(fqName); } else { baseEntityType = entityTypesMap.get(baseTypeFQName); } if (baseEntityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + baseEntityType.getName())); } } else if (entityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + entityType.getName())); } } } }
private void validateEntityTypes() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityType> entityTypes : entityTypesMap.entrySet()) { if (entityTypes.getValue() != null && entityTypes.getKey() != null) { EntityType entityType = entityTypes.getValue(); if (entityType.getBaseType() != null) { FullQualifiedName baseTypeFQName = entityType.getBaseType(); EntityType baseEntityType; if (!entityTypesMap.containsKey(baseTypeFQName)) { FullQualifiedName fqName = validateEntityTypeWithAlias(baseTypeFQName); baseEntityType = entityTypesMap.get(fqName); } else { baseEntityType = fetchLastBaseType(baseTypeFQName,entityTypesMap); } if (baseEntityType != null && baseEntityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + baseEntityType.getName())); } } else if (entityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + entityType.getName())); } } } }
private void validateEntityTypes() throws EntityProviderException { for (Map.Entry<FullQualifiedName, EntityType> entityTypes : entityTypesMap.entrySet()) { if (entityTypes.getValue() != null && entityTypes.getKey() != null) { EntityType entityType = entityTypes.getValue(); if (entityType.getBaseType() != null) { FullQualifiedName baseTypeFQName = entityType.getBaseType(); EntityType baseEntityType; if (!entityTypesMap.containsKey(baseTypeFQName)) { FullQualifiedName fqName = validateEntityTypeWithAlias(baseTypeFQName); baseEntityType = entityTypesMap.get(fqName); } else { baseEntityType = fetchLastBaseType(baseTypeFQName,entityTypesMap); } if (baseEntityType != null && baseEntityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + baseEntityType.getName())); } } else if (entityType.getKey() == null) { throw new EntityProviderException(EntityProviderException.ILLEGAL_ARGUMENT .addContent("Missing key for EntityType " + entityType.getName())); } } } }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { List<Schema> schemas = getSchemas(); if (schemas == null) { return null; } for (Schema schema : schemas) { if (schema.getNamespace().equals(edmFQName.getNamespace())) { List<EntityType> types = schema.getEntityTypes(); if (types == null) { return null; } for (EntityType type : types) { if (type.getName().equals(edmFQName.getName())) { return type; } } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { String strEdmFQName = null; if (edmFQName != null) { strEdmFQName = edmFQName.toString(); if (entityTypes.containsKey(strEdmFQName)) { return entityTypes.get(strEdmFQName); } else if (schemas == null) { getSchemas(); } String entityTypeNamespace = edmFQName.getNamespace(); String entityTypeName = edmFQName.getName(); for (Schema schema : schemas) { String schemaNamespace = schema.getNamespace(); if (schemaNamespace.equals(entityTypeNamespace)) { if (schema.getEntityTypes() == null) { return null; } for (EntityType et : schema.getEntityTypes()) { if (et.getName().equals(entityTypeName)) { entityTypes.put(strEdmFQName, et); return et; } } } } } return null; }
@Override public EntityType getEntityType(final FullQualifiedName edmFQName) throws ODataException { String strEdmFQName = null; if (edmFQName != null) { strEdmFQName = edmFQName.toString(); if (entityTypes.containsKey(strEdmFQName)) { return entityTypes.get(strEdmFQName); } else if (schemas == null) { getSchemas(); } String entityTypeNamespace = edmFQName.getNamespace(); String entityTypeName = edmFQName.getName(); for (Schema schema : schemas) { String schemaNamespace = schema.getNamespace(); if (schemaNamespace.equals(entityTypeNamespace)) { if (schema.getEntityTypes() == null) { return null; } for (EntityType et : schema.getEntityTypes()) { if (et.getName().equals(entityTypeName)) { entityTypes.put(strEdmFQName, et); return et; } } } } } return null; }
@Override public void build() throws ODataJPAModelException, ODataJPARuntimeException { if (consistentEntitySetList == null) { consistentEntitySetList = new ArrayList<EntitySet>(); } entityTypeView = new JPAEdmEntityType(schemaView); entityTypeView.getBuilder().build(); if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) { String nameSpace = schemaView.getEdmSchema().getNamespace(); for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) { currentEntitySet = new EntitySet(); currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName())); JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView); consistentEntitySetList.add(currentEntitySet); } isConsistent = true; } else { isConsistent = false; return; } }
@Override public void build() throws ODataJPAModelException, ODataJPARuntimeException { if (consistentEntitySetList == null) { consistentEntitySetList = new ArrayList<EntitySet>(); } entityTypeView = new JPAEdmEntityType(schemaView); entityTypeView.getBuilder().build(); if (entityTypeView.isConsistent() && entityTypeView.getConsistentEdmEntityTypes() != null) { String nameSpace = schemaView.getEdmSchema().getNamespace(); for (EntityType entityType : entityTypeView.getConsistentEdmEntityTypes()) { currentEntitySet = new EntitySet(); currentEntitySet.setEntityType(new FullQualifiedName(nameSpace, entityType.getName())); JPAEdmNameBuilder.build(JPAEdmEntitySet.this, entityTypeView); consistentEntitySetList.add(currentEntitySet); } isConsistent = true; } else { isConsistent = false; return; } }
public static void build(final JPAEdmAssociationEndView assocaitionEndView, final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) { String namespace = buildNamespace(assocaitionEndView); String name = entityTypeView.getEdmEntityType().getName(); FullQualifiedName fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd1().setType(fQName); name = null; String jpaEntityTypeName = null; Attribute<?, ?> jpaAttribute = propertyView.getJPAAttribute(); if (jpaAttribute.isCollection()) { jpaEntityTypeName = ((PluralAttribute<?, ?, ?>) jpaAttribute).getElementType().getJavaType() .getSimpleName(); } else { jpaEntityTypeName = propertyView.getJPAAttribute().getJavaType() .getSimpleName(); } JPAEdmMappingModelAccess mappingModelAccess = assocaitionEndView.getJPAEdmMappingModelAccess(); if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { name = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName); } if (name == null) { name = jpaEntityTypeName; } fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd2().setType(fQName); }
public static void build(final JPAEdmAssociationEndView assocaitionEndView, final JPAEdmEntityTypeView entityTypeView, final JPAEdmPropertyView propertyView) { String namespace = buildNamespace(assocaitionEndView); String name = entityTypeView.getEdmEntityType().getName(); FullQualifiedName fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd1().setType(fQName); name = null; String jpaEntityTypeName = null; Attribute<?, ?> jpaAttribute = propertyView.getJPAAttribute(); if (jpaAttribute.isCollection()) { jpaEntityTypeName = ((PluralAttribute<?, ?, ?>) jpaAttribute).getElementType().getJavaType() .getSimpleName(); } else { jpaEntityTypeName = propertyView.getJPAAttribute().getJavaType() .getSimpleName(); } JPAEdmMappingModelAccess mappingModelAccess = assocaitionEndView.getJPAEdmMappingModelAccess(); if (mappingModelAccess != null && mappingModelAccess.isMappingModelExists()) { name = mappingModelAccess.mapJPAEntityType(jpaEntityTypeName); } if (name == null) { name = jpaEntityTypeName; } fQName = new FullQualifiedName(namespace, name); assocaitionEndView.getEdmAssociationEnd2().setType(fQName); }
private EntityType clone(EntityType type) { if (type == null) { return null; } EntityType newType = new EntityType(); newType.setAbstract(type.isAbstract()); newType.setAnnotationAttributes(type.getAnnotationAttributes()); newType.setAnnotationElements(type.getAnnotationElements()); newType.setBaseType(type.getBaseType()); newType.setCustomizableFeedMappings(type.getCustomizableFeedMappings()); newType.setDocumentation(type.getDocumentation()); newType.setHasStream(type.isHasStream()); newType.setKey(type.getKey()); newType.setMapping(type.getMapping()); newType.setName(type.getName()); newType.setNavigationProperties(cloneNavigationProperties(type .getNavigationProperties())); newType.setProperties(cloneProperties(type.getProperties())); return newType; }