|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.odata4j.producer.inmemory.InMemoryProducer
public class InMemoryProducer
An in-memory implementation of an ODATA Producer. Uses the standard Java bean and property model to access information within entities.
Constructor Summary | |
---|---|
InMemoryProducer(String namespace)
Create a new instance of an in-memory POJO/JPA producer |
|
InMemoryProducer(String namespace,
int maxResults)
Create a new instance of an in-memory POJO/JPA producer |
Method Summary | ||
---|---|---|
void |
close()
Releases any resources managed by this producer. |
|
EntityResponse |
createEntity(String entitySetName,
OEntity entity)
Creates a new OData entity. |
|
EntityResponse |
createEntity(String entitySetName,
OEntityKey entityKey,
String navProp,
OEntity entity)
Creates a new OData entity as a reference of an existing entity, implicitly linked to the existing entity by a navigation property. |
|
void |
deleteEntity(String entitySetName,
OEntityKey entityKey)
Deletes an existing entity. |
|
EntitiesResponse |
getEntities(String entitySetName,
QueryInfo queryInfo)
Gets all the entities for a given set matching the query information. |
|
EntityResponse |
getEntity(String entitySetName,
OEntityKey entityKey)
Obtains a single entity based on its type and key. |
|
EdmDataServices |
getMetadata()
Obtains the service metadata for this producer. |
|
EntitiesResponse |
getNavProperty(String entitySetName,
OEntityKey entityKey,
String navProp,
QueryInfo queryInfo)
Given a specific entity, follow one of its navigation properties, applying constraints as appropriate. |
|
void |
mergeEntity(String entitySetName,
OEntity entity)
Modifies an existing entity using merge semantics. |
|
|
register(Class<TEntity> entityClass,
Class<TKey> keyClass,
String entitySetName,
Func<Iterable<TEntity>> get,
Func1<TEntity,TKey> id)
Register a new ODATA endpoint for an entity set. |
|
|
register(Class<TEntity> entityClass,
Class<TKey> keyClass,
String entitySetName,
Func<Iterable<TEntity>> get,
String idPropertyName)
|
|
|
register(Class<TEntity> entityClass,
PropertyModel propertyModel,
Class<TKey> keyClass,
String entitySetName,
Func<Iterable<TEntity>> get,
Func1<TEntity,TKey> id)
|
|
void |
updateEntity(String entitySetName,
OEntity entity)
Modifies an existing entity using update semantics. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InMemoryProducer(String namespace)
namespace
- - the namespace that the schema registrations will be inpublic InMemoryProducer(String namespace, int maxResults)
namespace
- - the names apce that the schema registrations will be inmaxResults
- - the maximum number of entities to returnMethod Detail |
---|
public void close()
ODataProducer
close
in interface ODataProducer
public EntityResponse createEntity(String entitySetName, OEntity entity)
ODataProducer
createEntity
in interface ODataProducer
entitySetName
- the entity-set nameentity
- the request entity sent from the client
public EntityResponse createEntity(String entitySetName, OEntityKey entityKey, String navProp, OEntity entity)
ODataProducer
createEntity
in interface ODataProducer
entitySetName
- the entity-set name of the existing entityentityKey
- the entity-key of the existing entitynavProp
- the navigation property off of the existing entityentity
- the request entity sent from the client
public void deleteEntity(String entitySetName, OEntityKey entityKey)
ODataProducer
deleteEntity
in interface ODataProducer
entitySetName
- the entity-set name of the entityentityKey
- the entity-key of the entitypublic EntitiesResponse getEntities(String entitySetName, QueryInfo queryInfo)
ODataProducer
getEntities
in interface ODataProducer
entitySetName
- the entity-set name for entities to returnqueryInfo
- the additional constraints to apply to the entities
public EntityResponse getEntity(String entitySetName, OEntityKey entityKey)
ODataProducer
getEntity
in interface ODataProducer
entitySetName
- the entity-set name for the entity to returnentityKey
- the unique entity-key within the set
public EdmDataServices getMetadata()
ODataProducer
getMetadata
in interface ODataProducer
public EntitiesResponse getNavProperty(String entitySetName, OEntityKey entityKey, String navProp, QueryInfo queryInfo)
ODataProducer
getNavProperty
in interface ODataProducer
entitySetName
- the entity-set of the entity to start withentityKey
- the unique entity-key of the entity to start withnavProp
- the navigation property to followqueryInfo
- additional constraints to apply to the result
public void mergeEntity(String entitySetName, OEntity entity)
ODataProducer
mergeEntity
in interface ODataProducer
entitySetName
- the entity-set nameentity
- the entity modifications sent from the clientpublic <TEntity,TKey> void register(Class<TEntity> entityClass, Class<TKey> keyClass, String entitySetName, Func<Iterable<TEntity>> get, Func1<TEntity,TKey> id)
entityClass
- the class of the entities that are to be stored in the setkeyClass
- the class of the key element of the setentitySetName
- the alias the set will be known by; this is what is used in the ODATA URLget
- a function to iterate over the elements in the setid
- a function to extract the id from any given element in the setpublic <TEntity,TKey> void register(Class<TEntity> entityClass, Class<TKey> keyClass, String entitySetName, Func<Iterable<TEntity>> get, String idPropertyName)
public <TEntity,TKey> void register(Class<TEntity> entityClass, PropertyModel propertyModel, Class<TKey> keyClass, String entitySetName, Func<Iterable<TEntity>> get, Func1<TEntity,TKey> id)
public void updateEntity(String entitySetName, OEntity entity)
ODataProducer
updateEntity
in interface ODataProducer
entitySetName
- the entity-set nameentity
- the entity modifications sent from the client
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |