I'm reading this documentation in order to figure out how to create an odata service.
I don't quite figure out what are EntityContainer
and EntitySet
for...
[EDIT]
I'd like to ask for a misunderstanding I don't quite figure out yet. If a EntitySet
straightforwardly is a set of entities:
Why do I need to implement a EntitySet CsdlAbstractEdmProvider.getEntitySet()
method on my OData provider? As you can see on here I need to implement this method that returns an EntitySet
. This is the implementation on Olingo documentation:
public CsdlEntitySet getEntitySet(FullQualifiedName entityContainer, String entitySetName) {
if(entityContainer.equals(CONTAINER)){
if(entitySetName.equals(ES_PRODUCTS_NAME)){
CsdlEntitySet entitySet = new CsdlEntitySet();
entitySet.setName(ES_PRODUCTS_NAME);
entitySet.setType(ET_PRODUCT_FQN);
return entitySet;
}
}
return null;
}
I don't quite figure out what's this implementation for.
By other hand, on EntityCollectionProcessor
documentation implementation you can see they are using EntitySet
as well.
I don't understand which are the differences between both EntitySet
inside a Provider and inside Processor.
I don't know if I've explained so well
Based on the OData documentation, section 4.1:
The central concepts in the EDM are entities and associations. Entities are instances of Entity Types (for example, Customer, Employee, and so on) which are structured records consisting of named and typed properties and with a key. Complex Types are structured types also consisting of a list of properties but with no key, and thus can only exist as a property of a containing entity or as a temporary value. An Entity Key is formed from a subset of properties of the Entity Type. The Entity Key (for example, CustomerId or OrderId) is a fundamental concept for uniquely identifying instances of Entity Types and allowing Entity Type instances to participate in relationships. Entities are grouped in Entity Sets (for example, Customers is a set of Customer Entity Type instances).
Associations define the relationship between two or more Entity Types (for example, Employee WorksFor Department). Instances of associations are grouped in Association Sets. Navigation Properties are special properties on Entity Types which are bound to a specific association and can be used to refer to associations of an entity.
Finally, all instance containers (Entity Sets and Association Sets) are grouped in an Entity Container.
Summary:
Hope this helps.
EDIT, following your question change:
The difference between the Provider.getEntitySet() method and the Processor.getEntitySet() comes down to differences in the purpose of the Provider and the Processor classes.