Java Code Examples for org.apache.olingo.commons.api.edm.provider.CsdlEntityType#getBaseType()
The following examples show how to use
org.apache.olingo.commons.api.edm.provider.CsdlEntityType#getBaseType() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 6 votes |
/** * This method validates Csdl Entity types. * Looks for correct namespace aliases and correct base types */ private void validateCsdlEntityTypes() { for (Map.Entry<FullQualifiedName, CsdlEntityType> entityTypes : csdlEntityTypesMap.entrySet()) { if (entityTypes.getValue() != null && entityTypes.getKey() != null) { CsdlEntityType entityType = entityTypes.getValue(); if (entityType.getBaseType() != null) { CsdlEntityType baseEntityType; FullQualifiedName baseTypeFQName = entityType.getBaseTypeFQN(); if (!csdlEntityTypesMap.containsKey(baseTypeFQName)) { FullQualifiedName fqName = validateCsdlEntityTypeWithAlias(baseTypeFQName); baseEntityType = fetchLastCsdlBaseType(fqName); } else { baseEntityType = fetchLastCsdlBaseType(baseTypeFQName); } if (baseEntityType != null && (baseEntityType.getKey() == null || baseEntityType.getKey().isEmpty())) { throw new RuntimeException("Missing key for EntityType " + baseEntityType.getName()); } } else if (entityType.getKey() == null || entityType.getKey().isEmpty()) { throw new RuntimeException("Missing key for EntityType " + entityType.getName()); } } } }
Example 2
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 6 votes |
/** * This fetches the last Base Type entity from a hierarchy of base type derived types * @param baseTypeFQName * @return CsdlEntityType */ private CsdlEntityType fetchLastCsdlBaseType(FullQualifiedName baseTypeFQName) { CsdlEntityType baseEntityType = null; while (baseTypeFQName != null) { if (!(csdlEntityTypesMap.containsKey(baseTypeFQName))) { baseTypeFQName = validateCsdlEntityTypeWithAlias(baseTypeFQName); } baseEntityType = csdlEntityTypesMap.get(baseTypeFQName); if (baseEntityType != null) { if (baseEntityType.getKey() != null) { break; } else if (baseEntityType.getBaseType() != null) { baseTypeFQName = baseEntityType.getBaseTypeFQN(); } else if (baseEntityType.getBaseType() == null) { break; } } } return baseEntityType; }
Example 3
Source File: CsdlTypeValidator.java From olingo-odata4 with Apache License 2.0 | 6 votes |
/** * This fetches the last Base Type entity from a hierarchy of base type derived types * @param baseTypeFQName * @return CsdlNavigationProperty */ private CsdlNavigationProperty fetchLastBaseEntityHavingNavigationProperty( FullQualifiedName baseTypeFQName, String navBindingProperty) { CsdlEntityType baseEntityType = null; while (baseTypeFQName != null) { if (!(csdlEntityTypesMap.containsKey(baseTypeFQName))) { baseTypeFQName = validateCsdlEntityTypeWithAlias(baseTypeFQName); } baseEntityType = csdlEntityTypesMap.get(baseTypeFQName); if (baseEntityType != null) { if (baseEntityType.getNavigationProperty(navBindingProperty) != null) { break; } else if (baseEntityType.getBaseType() != null) { baseTypeFQName = baseEntityType.getBaseTypeFQN(); } else if (baseEntityType.getBaseType() == null) { break; } } } if (baseEntityType == null) { throw new RuntimeException("Entity Type is null with fully qualified name:" + baseTypeFQName); } return baseEntityType.getNavigationProperty(navBindingProperty); }