org.odata4j.consumer
Interface ODataConsumer

All Known Implementing Classes:
AbstractODataConsumer, ODataCxfConsumer, ODataJerseyConsumer

public interface ODataConsumer

ODataConsumer is the client-side interface to an OData service.

Use ODataConsumers.create(String) or ODataConsumers.newBuilder(String) to connect to an existing OData service.

See Also:
ODataConsumers

Nested Class Summary
static interface ODataConsumer.Builder
          Mutable builder for ODataConsumer instances.
static class ODataConsumer.Dump
          Sends http request and/or response information to standard out.
 
Field Summary
static ODataConsumer.Dump dump
          Sends http request and/or response information to standard out.
 
Method Summary
 OFunctionRequest<OObject> callFunction(String functionName)
          Call a server-side function (also known as a service operation).
 OCreateRequest<OEntity> createEntity(String entitySetName)
          Creates a new entity in the given entity-set.
 OEntityRequest<Void> createLink(OEntityId sourceEntity, String targetNavProp, OEntityId targetEntity)
          Creates a new related entity link between two entities.
 OEntityDeleteRequest deleteEntity(OEntity entity)
          Deletes an existing entity.
 OEntityDeleteRequest deleteEntity(String entitySetName, Object keyValue)
          Deletes an existing entity.
 OEntityDeleteRequest deleteEntity(String entitySetName, OEntityKey key)
          Deletes an existing entity.
 OEntityRequest<Void> deleteLink(OEntityId sourceEntity, String targetNavProp, Object... targetKeyValues)
          Deletes related entity links between two entities by navigation property.
<T> OQueryRequest<T>
getEntities(Class<T> entityType, String entitySetHref)
          Gets entities from the given entity-set.
 OQueryRequest<OEntity> getEntities(ORelatedEntitiesLink link)
          Gets entities referred to by the given related-entities link.
 OQueryRequest<OEntity> getEntities(String entitySetHref)
          Gets entities from the given entity-set.
 OCountRequest getEntitiesCount(String entitySetName)
          Returns a single value request which can be extended by query options.
<T> OEntityGetRequest<T>
getEntity(Class<T> entityType, String entitySetName, Object keyValue)
          Gets the entity by entity-set name and entity-key value.
<T> OEntityGetRequest<T>
getEntity(Class<T> entityType, String entitySetName, OEntityKey key)
          Gets the entity by entity-set name and entity-key.
 OEntityGetRequest<OEntity> getEntity(OEntity entity)
          Gets the latest version of an entity using the given entity as a template.
 OEntityGetRequest<OEntity> getEntity(ORelatedEntityLink link)
          Gets the entity referred to by the given related entity link.
 OEntityGetRequest<OEntity> getEntity(String entitySetName, Object keyValue)
          Gets the entity by entity-set name and entity-key value.
 OEntityGetRequest<OEntity> getEntity(String entitySetName, OEntityKey key)
          Gets the entity by entity-set name and entity-key.
 Enumerable<EntitySetInfo> getEntitySets()
          Lists all top-level entity-sets for the OData service.
 OQueryRequest<OEntityId> getLinks(OEntityId sourceEntity, String targetNavProp)
          Gets related entity links for a given source entity by navigation property.
 EdmDataServices getMetadata()
          Gets the OData service metadata.
 String getServiceRootUri()
          Gets the OData service uri.
 OModifyRequest<OEntity> mergeEntity(OEntity entity)
          Modifies an existing entity using merge semantics.
 OModifyRequest<OEntity> mergeEntity(String entitySetName, Object keyValue)
          Modifies an existing entity using merge semantics.
 OModifyRequest<OEntity> mergeEntity(String entitySetName, OEntityKey key)
          Modifies an existing entity using merge semantics.
 OModifyRequest<OEntity> updateEntity(OEntity entity)
          Modifies an existing entity using update semantics.
 OEntityRequest<Void> updateLink(OEntityId sourceEntity, OEntityId newTargetEntity, String targetNavProp, Object... oldTargetKeyValues)
          Updates related entity links between two entities by navigation property.
 

Field Detail

dump

static final ODataConsumer.Dump dump
Sends http request and/or response information to standard out. Useful for debugging.

Method Detail

callFunction

OFunctionRequest<OObject> callFunction(String functionName)
Call a server-side function (also known as a service operation).

The functioncall-request builder returned can be used to add parameters. Call OQueryRequest.execute() to issue request.

Parameters:
functionName - the function name
Returns:
a new functioncall-request builder

createEntity

OCreateRequest<OEntity> createEntity(String entitySetName)
Creates a new entity in the given entity-set.

The create-request builder returned can be used to construct the new entity. Call OCreateRequest.execute() to issue request.

Parameters:
entitySetName - the name of the entity-set
Returns:
a new create-request builder

createLink

OEntityRequest<Void> createLink(OEntityId sourceEntity,
                                String targetNavProp,
                                OEntityId targetEntity)
Creates a new related entity link between two entities.

Call OEntityRequest.execute() on the returned request builder to issue request.

Parameters:
sourceEntity - the entity to start from
targetNavProp - the relationship navigation property
targetEntity - the entity to use as the target of the relationship
Returns:
a request builder

deleteEntity

OEntityDeleteRequest deleteEntity(OEntity entity)
Deletes an existing entity.

The delete-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
entity - the entity identity
Returns:
a new delete-request builder

deleteEntity

OEntityDeleteRequest deleteEntity(String entitySetName,
                                  Object keyValue)
Deletes an existing entity.

The delete-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
entitySetName - the entity identity entity-set name
keyValue - the entity identity key value
Returns:
a new entity-request builder

deleteEntity

OEntityDeleteRequest deleteEntity(String entitySetName,
                                  OEntityKey key)
Deletes an existing entity.

The delete-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
entitySetName - the entity identity entity-set name
key - the entity identity key
Returns:
a new entity-request builder

deleteLink

OEntityRequest<Void> deleteLink(OEntityId sourceEntity,
                                String targetNavProp,
                                Object... targetKeyValues)
Deletes related entity links between two entities by navigation property.

Call OEntityRequest.execute() on the returned request builder to issue request.

Parameters:
sourceEntity - the entity to start from
targetNavProp - the relationship navigation property
targetKeyValues - the target entity-key, applicable if the navigation property represents a collection
Returns:
a request builder

getEntities

<T> OQueryRequest<T> getEntities(Class<T> entityType,
                                 String entitySetHref)
Gets entities from the given entity-set. The entities will be represented as the given java-type.

The query-request builder returned can be used for further server-side filtering. Call OQueryRequest.execute() to issue request.

Type Parameters:
T - the entity representation as a java type
Parameters:
entityType - the entity representation as a java type
entitySetHref - the entity-set href
Returns:
a new query-request builder

getEntities

OQueryRequest<OEntity> getEntities(ORelatedEntitiesLink link)
Gets entities referred to by the given related-entities link.

The query-request builder returned can be used for further server-side filtering. Call OQueryRequest.execute() to issue request.

Parameters:
link - the link
Returns:
a new query-request builder

getEntities

OQueryRequest<OEntity> getEntities(String entitySetHref)
Gets entities from the given entity-set.

The query-request builder returned can be used for further server-side filtering. Call OQueryRequest.execute() to issue request.

Parameters:
entitySetHref - the entity-set href
Returns:
a new query-request builder

getEntitiesCount

OCountRequest getEntitiesCount(String entitySetName)
Returns a single value request which can be extended by query options. The execution of the request will return a single value for $count.

Parameters:
entitySetName - the entity identity entity-set name
Returns:
a new count-request builder

getEntity

<T> OEntityGetRequest<T> getEntity(Class<T> entityType,
                                   String entitySetName,
                                   Object keyValue)
Gets the entity by entity-set name and entity-key value. The entity will be represented as the given java-type.

The entity-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Type Parameters:
T - the entity representation as a java type
Parameters:
entityType - the entity representation as a java type
entitySetName - the name of the entity-set
keyValue - the entity-key value
Returns:
a new entity-request builder

getEntity

<T> OEntityGetRequest<T> getEntity(Class<T> entityType,
                                   String entitySetName,
                                   OEntityKey key)
Gets the entity by entity-set name and entity-key. The entity will be represented as the given java-type.

The entity-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Type Parameters:
T - the entity representation as a java type
Parameters:
entityType - the entity representation as a java type
entitySetName - the name of the entity-set
key - the entity-key
Returns:
a new entity-request builder

getEntity

OEntityGetRequest<OEntity> getEntity(OEntity entity)
Gets the latest version of an entity using the given entity as a template.

The entity-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
entity - an existing entity to use as a template, using its entity-set and entity-key
Returns:
a new entity-request builder

getEntity

OEntityGetRequest<OEntity> getEntity(ORelatedEntityLink link)
Gets the entity referred to by the given related entity link.

The entity-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
link - the link
Returns:
a new entity-request builder

getEntity

OEntityGetRequest<OEntity> getEntity(String entitySetName,
                                     Object keyValue)
Gets the entity by entity-set name and entity-key value.

The entity-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
entitySetName - the name of the entity-set
keyValue - the entity-key value
Returns:
a new entity-request builder

getEntity

OEntityGetRequest<OEntity> getEntity(String entitySetName,
                                     OEntityKey key)
Gets the entity by entity-set name and entity-key.

The entity-request builder returned can be used for further navigation. Call OEntityRequest.execute() to issue request.

Parameters:
entitySetName - the name of the entity-set
key - the entity-key
Returns:
a new entity-request builder

getEntitySets

Enumerable<EntitySetInfo> getEntitySets()
                                        throws ODataProducerException
Lists all top-level entity-sets for the OData service.

Returns:
the entity-set information
Throws:
ODataProducerException - error from the producer

getLinks

OQueryRequest<OEntityId> getLinks(OEntityId sourceEntity,
                                  String targetNavProp)
Gets related entity links for a given source entity by navigation property.

The entityid-request builder returned can be used for further server-side filtering. Call OQueryRequest.execute() to issue request.

Parameters:
sourceEntity - the entity to start from
targetNavProp - the relationship navigation property
Returns:
a new entityid-request builder

getMetadata

EdmDataServices getMetadata()
Gets the OData service metadata.

Returns:
the service metadata
See Also:
[msdn] 2.2 <edmx:DataServices>

getServiceRootUri

String getServiceRootUri()
Gets the OData service uri.

e.g. http://services.odata.org/Northwind/Northwind.svc/

Returns:
the service uri

mergeEntity

OModifyRequest<OEntity> mergeEntity(OEntity entity)
Modifies an existing entity using merge semantics.

The modification-request builder returned can be used to modify the new entity. Call OModifyRequest.execute() to issue request.

Parameters:
entity - the entity identity
Returns:
a new modification-request builder

mergeEntity

OModifyRequest<OEntity> mergeEntity(String entitySetName,
                                    Object keyValue)
Modifies an existing entity using merge semantics.

The modification-request builder returned can be used to modify the new entity. Call OModifyRequest.execute() to issue request.

Parameters:
entitySetName - the entity identity entity-set name
keyValue - the entity identity key value
Returns:
a new modification-request builder

mergeEntity

OModifyRequest<OEntity> mergeEntity(String entitySetName,
                                    OEntityKey key)
Modifies an existing entity using merge semantics.

The modification-request builder returned can be used to modify the new entity. Call OModifyRequest.execute() to issue request.

Parameters:
entitySetName - the entity identity entity-set name
key - the entity identity key
Returns:
a new modification-request builder

updateEntity

OModifyRequest<OEntity> updateEntity(OEntity entity)
Modifies an existing entity using update semantics.

The modification-request builder returned can be used to redefine the new entity. Call OModifyRequest.execute() to issue request.

Parameters:
entity - the entity identity
Returns:
a new modification-request builder

updateLink

OEntityRequest<Void> updateLink(OEntityId sourceEntity,
                                OEntityId newTargetEntity,
                                String targetNavProp,
                                Object... oldTargetKeyValues)
Updates related entity links between two entities by navigation property.

Call OEntityRequest.execute() on the returned request builder to issue request.

Parameters:
sourceEntity - the entity to start from
newTargetEntity - the entity to use as the new target of the relationship
targetNavProp - the relationship navigation property
oldTargetKeyValues - the target entity-key, applicable if the navigation property represents a collection
Returns:
a request builder


http://odata4j.org