Java Code Examples for org.apache.olingo.commons.api.edm.provider.CsdlEntityType#getName()

The following examples show how to use org.apache.olingo.commons.api.edm.provider.CsdlEntityType#getName() . 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 vote down vote up
/**
 * 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: EdmSchemaImpl.java    From olingo-odata4 with Apache License 2.0 5 votes vote down vote up
protected List<EdmEntityType> createEntityTypes() {
  final List<EdmEntityType> edmEntityTypes = new ArrayList<>();
  final List<CsdlEntityType> providerEntityTypes = schema.getEntityTypes();
  if (providerEntityTypes != null) {
    for (CsdlEntityType entityType : providerEntityTypes) {
      FullQualifiedName entityTypeName = new FullQualifiedName(namespace, entityType.getName());
      edm.addStructuralTypeAnnotations(entityType, entityTypeName, schema.getEntityContainer());
      EdmEntityTypeImpl entityTypeImpl = new EdmEntityTypeImpl(edm, entityTypeName, entityType);
      edmEntityTypes.add(entityTypeImpl);
      edm.cacheEntityType(entityTypeName, entityTypeImpl);
    }
  }
  return edmEntityTypes;
}