Search in sources :

Example 1 with CsdlPropertyRef

use of org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef in project cxf by apache.

the class DemoEdmProvider method getEntityType.

@Override
public CsdlEntityType getEntityType(FullQualifiedName entityTypeName) {
    // this method is called for one of the EntityTypes that are configured in the Schema
    if (entityTypeName.equals(ET_PRODUCT_FQN)) {
        // create EntityType properties
        CsdlProperty id = new CsdlProperty().setName("ID").setType(EdmPrimitiveTypeKind.Int32.getFullQualifiedName());
        CsdlProperty name = new CsdlProperty().setName("Name").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
        CsdlProperty description = new CsdlProperty().setName("Description").setType(EdmPrimitiveTypeKind.String.getFullQualifiedName());
        // create CsdlPropertyRef for Key element
        CsdlPropertyRef propertyRef = new CsdlPropertyRef();
        propertyRef.setName("ID");
        // configure EntityType
        CsdlEntityType entityType = new CsdlEntityType();
        entityType.setName(ET_PRODUCT_NAME);
        entityType.setProperties(Arrays.asList(id, name, description));
        entityType.setKey(Collections.singletonList(propertyRef));
        return entityType;
    }
    return null;
}
Also used : CsdlEntityType(org.apache.olingo.commons.api.edm.provider.CsdlEntityType) CsdlPropertyRef(org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef) CsdlProperty(org.apache.olingo.commons.api.edm.provider.CsdlProperty)

Aggregations

CsdlEntityType (org.apache.olingo.commons.api.edm.provider.CsdlEntityType)1 CsdlProperty (org.apache.olingo.commons.api.edm.provider.CsdlProperty)1 CsdlPropertyRef (org.apache.olingo.commons.api.edm.provider.CsdlPropertyRef)1