private EntityType fetchLastBaseType (FullQualifiedName baseTypeFQName, Map<FullQualifiedName, EntityType> entityTypesMap) throws EntityProviderException { EntityType baseEntityType = null ; while(baseTypeFQName!=null){ baseEntityType = entityTypesMap.get(baseTypeFQName); if(baseEntityType.getKey()!=null){ break; }else if(baseEntityType !=null && baseEntityType.getBaseType() !=null){ baseTypeFQName = baseEntityType.getBaseType(); }else if(baseEntityType.getBaseType() == null){ break; } } return baseEntityType; }
private EntityType fetchLastBaseType (FullQualifiedName baseTypeFQName, Map<FullQualifiedName, EntityType> entityTypesMap) throws EntityProviderException { EntityType baseEntityType = null ; while(baseTypeFQName!=null){ baseEntityType = entityTypesMap.get(baseTypeFQName); if(baseEntityType.getKey()!=null){ break; }else if(baseEntityType !=null && baseEntityType.getBaseType() !=null){ baseTypeFQName = baseEntityType.getBaseType(); }else if(baseEntityType.getBaseType() == null){ break; } } return baseEntityType; }
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())); } } } }
xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_ENTITY_TYPE); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, entityType.getName()); if (entityType.getBaseType() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_BASE_TYPE, entityType.getBaseType().toString());
xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_ENTITY_TYPE); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, entityType.getName()); if (entityType.getBaseType() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_BASE_TYPE, entityType.getBaseType().toString());
xmlStreamWriter.writeStartElement(XmlMetadataConstants.EDM_ENTITY_TYPE); xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_NAME, entityType.getName()); if (entityType.getBaseType() != null) { xmlStreamWriter.writeAttribute(XmlMetadataConstants.EDM_BASE_TYPE, entityType.getBaseType().toString());
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; }