public interface

ODataConsumer

org.odata4j.consumer.ODataConsumer
Known Indirect Subclasses

Summary

Nested Classes
enum ODataConsumer.Dump Sends http request and/or response information to standard out. 
Fields
public static final ODataConsumer.Dump dump Sends http request and/or response information to standard out.
Public Methods
abstract OFunctionRequest<OObject> callFunction(String functionName)
Call a server-side function (also known as a service operation).
abstract OBatchRequest createBatch(String url)
Creates a request to perform batch operations
abstract OCreateRequest<OEntity> createEntity(String entitySetName)
Creates a new entity in the given entity-set.
abstract OEntityRequest<Void> createLink(OEntityId sourceEntity, String targetNavProp, OEntityId targetEntity)
Creates a new related entity link between two entities.
abstract ConsumerDeleteEntityRequest deleteEntity(String entitySetName, Object keyValue, boolean keyIsGuid)
Deletes an existing entity.
abstract ConsumerDeleteEntityRequest deleteEntity(OEntityId entity)
Deletes an existing entity.
abstract ConsumerDeleteEntityRequest deleteEntity(String entitySetName, OEntityKey key)
Deletes an existing entity.
abstract OEntityRequest<Void> deleteLink(OEntityId sourceEntity, String targetNavProp, Object... targetKeyValues)
Deletes related entity links between two entities by navigation property.
abstract <T> OQueryRequest<T> getEntities(Class<T> entityType, String entitySetHref)
Gets entities from the given entity-set.
abstract OQueryRequest<OEntity> getEntities(String entitySetHref)
Gets entities from the given entity-set.
abstract OQueryRequest<OEntity> getEntities(ORelatedEntitiesLink link)
Gets entities referred to by the given related-entities link.
abstract OEntityGetRequest<OEntity> getEntity(String entitySetName, Object keyValue)
Gets the entity by entity-set name and entity-key value.
abstract OEntityGetRequest<OEntity> getEntity(OEntity entity)
Gets the latest version of an entity using the given entity as a template.
abstract OEntityGetRequest<OEntity> getEntity(ORelatedEntityLink link)
Gets the entity referred to by the given related entity link.
abstract OEntityGetRequest<OEntity> getEntity(String entitySetName, OEntityKey key)
Gets the entity by entity-set name and entity-key.
abstract <T> OEntityGetRequest<T> getEntity(Class<T> entityType, String entitySetName, OEntityKey key)
Gets the entity by entity-set name and entity-key.
abstract <T> OEntityGetRequest<T> getEntity(Class<T> entityType, String entitySetName, Object keyValue)
Gets the entity by entity-set name and entity-key value.
abstract Enumerable<EntitySetInfo> getEntitySets()
Lists all top-level entity-sets for the OData service.
abstract OQueryRequest<OEntityId> getLinks(OEntityId sourceEntity, String targetNavProp)
Gets related entity links for a given source entity by navigation property.
abstract EdmDataServices getMetadata()
Gets the OData service metadata.
abstract String getServiceRootUri()
Gets the OData service uri.
abstract OModifyRequest<OEntity> mergeEntity(String entitySetName, Object keyValue, boolean keyIsGuid)
Modifies an existing entity using merge semantics.
abstract OModifyRequest<OEntity> mergeEntity(OEntity entity)
Modifies an existing entity using merge semantics.
abstract OModifyRequest<OEntity> mergeEntity(String entitySetName, OEntityKey key)
Modifies an existing entity using merge semantics.
abstract OModifyRequest<OEntity> updateEntity(OEntity entity)
Modifies an existing entity using update semantics.
abstract OEntityRequest<Void> updateLink(OEntityId sourceEntity, OEntityId newTargetEntity, String targetNavProp, Object... oldTargetKeyValues)
Updates related entity links between two entities by navigation property.

Fields

public static final ODataConsumer.Dump dump

Sends http request and/or response information to standard out. Useful for debugging.

Public Methods

public abstract 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 execute() to issue request.

Parameters
functionName The function name
Returns
  • the functioncall-builder

public abstract OBatchRequest createBatch (String url)

Creates a request to perform batch operations

Parameters
url

public abstract 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

public abstract OEntityRequest<Void> createLink (OEntityId sourceEntity, String targetNavProp, OEntityId targetEntity)

Creates a new related entity link between two entities.

Call 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

public abstract ConsumerDeleteEntityRequest deleteEntity (String entitySetName, Object keyValue, boolean keyIsGuid)

Deletes an existing entity.

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

Parameters
entitySetName The entity identity entity-set name
keyValue The entity identity key value
keyIsGuid True if the key is a guid
Returns
  • a new entity-request builder

public abstract ConsumerDeleteEntityRequest deleteEntity (OEntityId entity)

Deletes an existing entity.

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

Parameters
entity The entity identity
Returns
  • a new entity-request builder

public abstract ConsumerDeleteEntityRequest deleteEntity (String entitySetName, OEntityKey key)

Deletes an existing entity.

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

Parameters
entitySetName The entity identity entity-set name
key The entity identity key
Returns
  • a new entity-request builder

public abstract OEntityRequest<Void> deleteLink (OEntityId sourceEntity, String targetNavProp, Object... targetKeyValues)

Deletes related entity links between two entities by navigation property.

Call 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

public abstract 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 execute() or simply iterate to issue request.

Parameters
entityType The entity representation as a java type
entitySetHref The entity-set href
Returns
  • a new query-request builder

public abstract 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 execute() or simply iterate to issue request.

Parameters
entitySetHref The entity-set href
Returns
  • a new query-request builder

public abstract 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 execute() or simply iterate to issue request.

Parameters
link The link
Returns
  • a new query-request builder

public abstract 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 execute() to issue request.

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

public abstract 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 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

public abstract 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 execute() to issue request.

Parameters
link The link
Returns
  • a new entity-request builder

public abstract 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 execute() to issue request.

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

public abstract 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 execute() to issue request.

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

public abstract 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 execute() to issue request.

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

public abstract Enumerable<EntitySetInfo> getEntitySets ()

Lists all top-level entity-sets for the OData service.

Returns
  • the entity-set information

public abstract 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 execute() to issue request.

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

public abstract EdmDataServices getMetadata ()

Gets the OData service metadata.

Returns
  • the service metadata

public abstract String getServiceRootUri ()

Gets the OData service uri.

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

Returns
  • the service uri

public abstract OModifyRequest<OEntity> mergeEntity (String entitySetName, Object keyValue, boolean keyIsGuid)

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
keyIsGuid True if the key is a guid
Returns
  • a new modification-request builder

public abstract 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

public abstract 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

public abstract 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

public abstract OEntityRequest<Void> updateLink (OEntityId sourceEntity, OEntityId newTargetEntity, String targetNavProp, Object... oldTargetKeyValues)

Updates related entity links between two entities by navigation property.

Call 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