org.odata4j.consumer
Class ConsumerCreateEntityRequest<T>

java.lang.Object
  extended by org.odata4j.consumer.AbstractConsumerEntityPayloadRequest
      extended by org.odata4j.consumer.ConsumerCreateEntityRequest<T>
All Implemented Interfaces:
OCreateRequest<T>

public class ConsumerCreateEntityRequest<T>
extends AbstractConsumerEntityPayloadRequest
implements OCreateRequest<T>

Create-request implementation.


Field Summary
 
Fields inherited from class org.odata4j.consumer.AbstractConsumerEntityPayloadRequest
entitySetName, links, metadata, props, serviceRootUri
 
Constructor Summary
ConsumerCreateEntityRequest(ODataClient client, String serviceRootUri, EdmDataServices metadata, String entitySetName, FeedCustomizationMapping fcMapping)
           
 
Method Summary
 OCreateRequest<T> addToRelation(OEntity parent, String navProperty)
          Use a related parent entity's relationship collection to define an implicit link.
 T execute()
          Sends the create-request to the OData service and returns the newly created entity.
 T get()
          Returns a locally-built entity and does not send the create-request to the service.
 OCreateRequest<T> inline(String navProperty, Iterable<OEntity> entities)
          Create related entities inline as part of a single request.
 OCreateRequest<T> inline(String navProperty, OEntity... entities)
          Create related entities inline as part of a single request.
 OCreateRequest<T> link(String navProperty, OEntity target)
          Define an explicit link to another related entity.
 OCreateRequest<T> link(String navProperty, OEntityKey targetKey)
          Define an explicit link to another related entity.
 OCreateRequest<T> properties(Iterable<OProperty<?>> props)
          Set properties on the new entity.
 OCreateRequest<T> properties(OProperty<?>... props)
          Set properties on the new entity.
 
Methods inherited from class org.odata4j.consumer.AbstractConsumerEntityPayloadRequest
inline, link, link, properties, properties
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConsumerCreateEntityRequest

public ConsumerCreateEntityRequest(ODataClient client,
                                   String serviceRootUri,
                                   EdmDataServices metadata,
                                   String entitySetName,
                                   FeedCustomizationMapping fcMapping)
Method Detail

addToRelation

public OCreateRequest<T> addToRelation(OEntity parent,
                                       String navProperty)
Description copied from interface: OCreateRequest
Use a related parent entity's relationship collection to define an implicit link.

e.g. create a new Product entity using /Categories(10)/Products instead of /Products

Specified by:
addToRelation in interface OCreateRequest<T>
Parameters:
parent - the parent entity
navProperty - the parent entity's relationship collection navigation property
Returns:
the create-request builder
See Also:
OCreateRequest.link(String, OEntity), http://www.odata.org/developers/protocols/operations#CreatingnewEntries

execute

public T execute()
          throws ODataProducerException
Description copied from interface: OCreateRequest
Sends the create-request to the OData service and returns the newly created entity.

Specified by:
execute in interface OCreateRequest<T>
Returns:
newly created entity
Throws:
ODataProducerException - error from the producer

get

public T get()
Description copied from interface: OCreateRequest
Returns a locally-built entity and does not send the create-request to the service. The locally-built entity can be used inline as part of other create-requests.

Specified by:
get in interface OCreateRequest<T>
Returns:
new locally built entity
See Also:
OCreateRequest.inline(String, OEntity...)

inline

public OCreateRequest<T> inline(String navProperty,
                                Iterable<OEntity> entities)
Description copied from interface: OCreateRequest
Create related entities inline as part of a single request.

Specified by:
inline in interface OCreateRequest<T>
Parameters:
navProperty - the new entity's relationship navigation property
entities - related entities, returned by OCreateRequest.get()
Returns:
the create-request builder
See Also:
OCreateRequest.get()

inline

public OCreateRequest<T> inline(String navProperty,
                                OEntity... entities)
Description copied from interface: OCreateRequest
Create related entities inline as part of a single request.

Specified by:
inline in interface OCreateRequest<T>
Parameters:
navProperty - the new entity's relationship navigation property
entities - related entities, returned by OCreateRequest.get()
Returns:
the create-request builder
See Also:
OCreateRequest.get()

link

public OCreateRequest<T> link(String navProperty,
                              OEntity target)
Description copied from interface: OCreateRequest
Define an explicit link to another related entity.

Specified by:
link in interface OCreateRequest<T>
Parameters:
navProperty - the new entity's relationship navigation property
target - the link target entity
Returns:
the create-request builder
See Also:
OCreateRequest.addToRelation(OEntity, String), http://www.odata.org/developers/protocols/operations#CreatingnewEntries

link

public OCreateRequest<T> link(String navProperty,
                              OEntityKey targetKey)
Description copied from interface: OCreateRequest
Define an explicit link to another related entity.

Specified by:
link in interface OCreateRequest<T>
Parameters:
navProperty - the new entity's relationship navigation property
targetKey - the key of the link target entity
Returns:
the create-request builder
See Also:
OCreateRequest.addToRelation(OEntity, String), http://www.odata.org/developers/protocols/operations#CreatingnewEntries

properties

public OCreateRequest<T> properties(Iterable<OProperty<?>> props)
Description copied from interface: OCreateRequest
Set properties on the new entity.

Specified by:
properties in interface OCreateRequest<T>
Parameters:
props - the properties
Returns:
the create-request builder

properties

public OCreateRequest<T> properties(OProperty<?>... props)
Description copied from interface: OCreateRequest
Set properties on the new entity.

Specified by:
properties in interface OCreateRequest<T>
Parameters:
props - the properties
Returns:
the create-request builder


http://odata4j.org