Class DataService
-
- All Implemented Interfaces:
public class DataServiceEncapsulates an OData data service.
- See Also:
- Example using proxy classes:
public void dataServiceExample() { OnlineODataProvider provider = new OnlineODataProvider("NorthwindService", "http://services.odata.org/V4/Northwind/Northwind.svc/"); NorthwindService service = new NorthwindService(provider); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .orderBy(Customer.companyName); List<Customer> customers = service.getCustomers(query); this.showCustomers(customers); Customer customer = customers.get(0).copy(); customer.setCompanyName("Created Inc."); service.createEntity(customer); customer.setCompanyName("Updated Inc."); service.updateEntity(customer); service.deleteEntity(customer); }
- Example using dynamic API:
public void dataServiceExample() { OnlineODataProvider provider = new OnlineODataProvider("NorthwindService", "http://services.odata.org/V4/Northwind/Northwind.svc/"); DataService service = new DataService(provider); service.loadMetadata(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet).orderBy(companyNameProperty); EntityValueList customers = service.executeQuery(query).getEntityList(); this.showCustomers(customers); EntityValue customer = customers.first().copyEntity(); companyNameProperty.setString(customer, "Created Inc."); service.createEntity(customer); companyNameProperty.setString(customer, "Updated Inc."); service.updateEntity(customer); service.deleteEntity(customer); }
-
-
Field Summary
Fields Modifier and Type Field Description public final static intLOG_LEVEL_ERRORpublic final static intLOG_LEVEL_WARNpublic final static intLOG_LEVEL_INFOpublic final static intLOG_LEVEL_DEBUGpublic final static intLOG_LEVEL_TRACE
-
Constructor Summary
Constructors Constructor Description DataService(DataServiceProvider provider)Construct a new data service using a specified provider.
-
Method Summary
Modifier and Type Method Description ExecutorgetActionExecutor()ExecutorgetFunctionExecutor()voidsetActionExecutor(@NonNull() @NotNull() Executor executor)Set the executor for async actions (e.g. voidsetFunctionExecutor(@NonNull() @NotNull() Executor executor)Set the executor for async functions (e.g. voidasyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Invoke an action asynchronously. voidasyncAction(@NonNull() @NotNull() Action0 action, @Nullable() @Nullable() RequestOptions requestOptions, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Invoke an action asynchronously. voidasyncAction(@NonNull() @NotNull() Action0 action, @Nullable() @Nullable() RequestOptions requestOptions, boolean functionExecutor, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Invoke an action asynchronously. voidasyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)Invoke an action asynchronously. voidasyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions)Invoke an action asynchronously. <T> voidasyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() AsyncResult.Handler<T> resultHandler)Invoke a function asynchronously. <T> voidasyncFunction(@NonNull() @NotNull() Function0<T> function, @Nullable() @Nullable() RequestOptions requestOptions, @NonNull() @NotNull() AsyncResult.Handler<T> resultHandler)Invoke a function asynchronously. <T> voidasyncFunction(@NonNull() @NotNull() Function0<T> function, @Nullable() @Nullable() RequestOptions requestOptions, boolean actionExecutor, @NonNull() @NotNull() AsyncResult.Handler<T> resultHandler)Invoke a function asynchronously. <T> voidasyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() Action1<T> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)Invoke a function asynchronously. <T> voidasyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() Action1<T> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions)Invoke a function asynchronously. voidasyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions, boolean functionExecutor)Invoke an action asynchronously. <T> voidasyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() Action1<T> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions, boolean actionExecutor)Invoke a function asynchronously. EntityValueactivateDraft(@NonNull() @NotNull() EntityValue entity)See activateDraft(EntityValue, HttpHeaders, RequestOptions). voidactivateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See activateDraft(EntityValue, HttpHeaders, RequestOptions). voidactivateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)See activateDraft(EntityValue, HttpHeaders, RequestOptions). EntityValueactivateDraft(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers)See activateDraft(EntityValue, HttpHeaders, RequestOptions). voidactivateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers)See activateDraft(EntityValue, HttpHeaders, RequestOptions). voidactivateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)See activateDraft(EntityValue, HttpHeaders, RequestOptions). EntityValueactivateDraft(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)Activate a draft entity. voidactivateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)Activate a draft entity. voidactivateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)Activate a draft entity. voidapplyChanges(@NonNull() @NotNull() ChangeSet changes)See applyChanges(ChangeSet, HttpHeaders, RequestOptions). voidapplyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See applyChanges(ChangeSet, HttpHeaders, RequestOptions). voidapplyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See applyChanges(ChangeSet, HttpHeaders, RequestOptions). voidapplyChanges(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers)See applyChanges(ChangeSet, HttpHeaders, RequestOptions). voidapplyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See applyChanges(ChangeSet, HttpHeaders, RequestOptions). voidapplyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See applyChanges(ChangeSet, HttpHeaders, RequestOptions). voidapplyChanges(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Apply the changes from a change set to the target system. voidapplyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Apply the changes from a change set to the target system. voidapplyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Apply the changes from a change set to the target system. voidcheckIfCancelled(@Nullable() @Nullable() CancelToken token)Check if tokenhas been marked for cancellation.voidcreateEntity(@NonNull() @NotNull() EntityValue entity)See createEntity(EntityValue, HttpHeaders, RequestOptions). voidcreateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See createEntity(EntityValue, HttpHeaders, RequestOptions). voidcreateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createEntity(EntityValue, HttpHeaders, RequestOptions). voidcreateEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)See createEntity(EntityValue, HttpHeaders, RequestOptions). voidcreateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See createEntity(EntityValue, HttpHeaders, RequestOptions). voidcreateEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createEntity(EntityValue, HttpHeaders, RequestOptions). voidcreateEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create an entity in the target system. voidcreateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create an entity in the target system. voidcreateEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Create an entity in the target system. voidcreateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to)See createLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidcreateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See createLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidcreateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidcreateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers)See createLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidcreateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See createLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidcreateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidcreateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create a link from a source entity to a target entity in the target system. voidcreateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create a link from a source entity to a target entity in the target system. voidcreateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Create a link from a source entity to a target entity in the target system. voidcreateMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content)See createMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voidcreateMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See createMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voidcreateMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voidcreateMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers)See createMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voidcreateMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See createMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voidcreateMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voidcreateMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create a media entity with the specified content. voidcreateMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create a media entity with the specified content. voidcreateMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Create a media entity with the specified content. voidcreateRelatedEntity(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property)See createRelatedEntity(EntityValue, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See createRelatedEntity(EntityValue, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createRelatedEntity(EntityValue, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedEntity(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers)See createRelatedEntity(EntityValue, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See createRelatedEntity(EntityValue, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createRelatedEntity(EntityValue, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedEntity(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create an entity in the target system, related to an existing parent entity via a parent navigation property. voidcreateRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create an entity in the target system, related to an existing parent entity via a parent navigation property. voidcreateRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Create an entity in the target system, related to an existing parent entity via a parent navigation property. voidcreateRelatedMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property)See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers)See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions). voidcreateRelatedMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create an media entity in the target system, related to a parent entity via a parent navigation property. voidcreateRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create an media entity in the target system, related to a parent entity via a parent navigation property. voidcreateRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Create an media entity in the target system, related to a parent entity via a parent navigation property. voiddeleteByQuery(@NonNull() @NotNull() DataQuery query)See deleteByQuery(DataQuery, HttpHeaders, RequestOptions). voiddeleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See deleteByQuery(DataQuery, HttpHeaders, RequestOptions). voiddeleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteByQuery(DataQuery, HttpHeaders, RequestOptions). voiddeleteByQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers)See deleteByQuery(DataQuery, HttpHeaders, RequestOptions). voiddeleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See deleteByQuery(DataQuery, HttpHeaders, RequestOptions). voiddeleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteByQuery(DataQuery, HttpHeaders, RequestOptions). voiddeleteByQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute query to delete data from the target system. voiddeleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute query to delete data from the target system. voiddeleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Execute query to delete data from the target system. voiddeleteEntity(@NonNull() @NotNull() EntityValue entity)See deleteEntity(EntityValue, HttpHeaders, RequestOptions). voiddeleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See deleteEntity(EntityValue, HttpHeaders, RequestOptions). voiddeleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteEntity(EntityValue, HttpHeaders, RequestOptions). voiddeleteEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)See deleteEntity(EntityValue, HttpHeaders, RequestOptions). voiddeleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See deleteEntity(EntityValue, HttpHeaders, RequestOptions). voiddeleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteEntity(EntityValue, HttpHeaders, RequestOptions). voiddeleteEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Delete an entity from the target system. voiddeleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Delete an entity from the target system. voiddeleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Delete an entity from the target system. voiddeleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voiddeleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Delete a link from a source entity to a target entity. voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Delete a link from a source entity to a target entity. voiddeleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Delete a link from a source entity to a target entity. voiddeleteStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link)See deleteStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddeleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See deleteStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddeleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddeleteStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers)See deleteStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddeleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See deleteStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddeleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See deleteStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddeleteStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Delete the content of a stream property from the target system. voiddeleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Delete the content of a stream property from the target system. voiddeleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Delete the content of a stream property from the target system. ByteStreamdownloadMedia(@NonNull() @NotNull() EntityValue entity)See downloadMedia(EntityValue, HttpHeaders, RequestOptions). voiddownloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See downloadMedia(EntityValue, HttpHeaders, RequestOptions). voiddownloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)See downloadMedia(EntityValue, HttpHeaders, RequestOptions). ByteStreamdownloadMedia(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)See downloadMedia(EntityValue, HttpHeaders, RequestOptions). voiddownloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See downloadMedia(EntityValue, HttpHeaders, RequestOptions). voiddownloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)See downloadMedia(EntityValue, HttpHeaders, RequestOptions). ByteStreamdownloadMedia(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Obtain a stream for downloading the content of a media entity from the target system. voiddownloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Obtain a stream for downloading the content of a media entity from the target system. voiddownloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)Obtain a stream for downloading the content of a media entity from the target system. ByteStreamdownloadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link)See downloadStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddownloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See downloadStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddownloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)See downloadStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). ByteStreamdownloadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers)See downloadStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddownloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See downloadStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). voiddownloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)See downloadStream(EntityValue, StreamLink, HttpHeaders, RequestOptions). ByteStreamdownloadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Obtain a stream for downloading the content of a stream property from the target system. voiddownloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Obtain a stream for downloading the content of a stream property from the target system. voiddownloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)Obtain a stream for downloading the content of a stream property from the target system. DataValueexecuteMethod(@NonNull() @NotNull() DataMethod method)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). DataValueexecuteMethod(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). DataValueexecuteMethod(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)See executeMethod(DataMethod, ParameterList, HttpHeaders, RequestOptions). DataValueexecuteMethod(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute a data method (action or function) in the target system. voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute a data method (action or function) in the target system. voidexecuteMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)Execute a data method (action or function) in the target system. QueryResultexecuteQuery(@NonNull() @NotNull() DataQuery query)See executeQuery(DataQuery, HttpHeaders, RequestOptions). voidexecuteQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action1<QueryResult> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See executeQuery(DataQuery, HttpHeaders, RequestOptions). voidexecuteQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<QueryResult> resultHandler)See executeQuery(DataQuery, HttpHeaders, RequestOptions). QueryResultexecuteQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers)See executeQuery(DataQuery, HttpHeaders, RequestOptions). voidexecuteQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action1<QueryResult> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See executeQuery(DataQuery, HttpHeaders, RequestOptions). voidexecuteQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<QueryResult> resultHandler)See executeQuery(DataQuery, HttpHeaders, RequestOptions). QueryResultexecuteQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute a data query to get data from the target system. voidexecuteQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action1<QueryResult> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute a data query to get data from the target system. voidexecuteQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<QueryResult> resultHandler)Execute a data query to get data from the target system. CsdlDocumentfetchMetadata()See fetchMetadata(HttpHeaders, RequestOptions). voidfetchMetadataAsync(@NonNull() @NotNull() Action1<CsdlDocument> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See fetchMetadata(HttpHeaders, RequestOptions). voidfetchMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<CsdlDocument> resultHandler)See fetchMetadata(HttpHeaders, RequestOptions). CsdlDocumentfetchMetadata(@Nullable() @Nullable() HttpHeaders headers)See fetchMetadata(HttpHeaders, RequestOptions). voidfetchMetadataAsync(@NonNull() @NotNull() Action1<CsdlDocument> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See fetchMetadata(HttpHeaders, RequestOptions). voidfetchMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<CsdlDocument> resultHandler)See fetchMetadata(HttpHeaders, RequestOptions). CsdlDocumentfetchMetadata(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Fetch latest service metadata and return it, but don't change the DataService.metadata property. voidfetchMetadataAsync(@NonNull() @NotNull() Action1<CsdlDocument> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Fetch latest service metadata and return it, but don't change the DataService.metadata property. voidfetchMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<CsdlDocument> resultHandler)Fetch latest service metadata and return it, but don't change the DataService.metadata property. DataMethodgetDataMethod(@NonNull() @NotNull() String name)Lookup a data method by qualified name (for function/action definitions) or by unqualified name (for function/action imports). EntitySetgetEntitySet(@NonNull() @NotNull() String name)Lookup an entity set (or singleton entity) by name. CsdlDocumentgetMetadata()Return service metadata. MetadataLockgetMetadataLock()Return a readers/writer lock that can be used to prevent readers from using the data service while the DataService.metadata is being refreshed. StringgetName()Return service name. DataServiceProvidergetProvider()Return the data service provider. booleanhasMetadata()Return has service metadata been loaded. booleanisClientRegistered()Checks locally whether a previous DataService.registerClient call successfuly created a client registration for the remote OData service. voidloadEntity(@NonNull() @NotNull() EntityValue entity)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadEntity(EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)Reload an existing entity from the target system. voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)Reload an existing entity from the target system. voidloadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Reload an existing entity from the target system. voidloadMetadata()See loadMetadata(HttpHeaders, RequestOptions). voidloadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See loadMetadata(HttpHeaders, RequestOptions). voidloadMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadMetadata(HttpHeaders, RequestOptions). voidloadMetadata(@Nullable() @Nullable() HttpHeaders headers)See loadMetadata(HttpHeaders, RequestOptions). voidloadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See loadMetadata(HttpHeaders, RequestOptions). voidloadMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadMetadata(HttpHeaders, RequestOptions). voidloadMetadata(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Load service metadata into DataService.provider (if not already loaded). voidloadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Load service metadata into DataService.provider (if not already loaded). voidloadMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Load service metadata into DataService.provider (if not already loaded). voidloadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See loadProperty(Property, EntityValue, DataQuery, HttpHeaders, RequestOptions). voidloadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Load the value of a property into an existing entity. voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Load the value of a property into an existing entity. voidloadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Load the value of a property into an existing entity. EntityValuemakeDraftCopy(@NonNull() @NotNull() EntityValue entity)See makeDraftCopy(EntityValue, HttpHeaders, RequestOptions). voidmakeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See makeDraftCopy(EntityValue, HttpHeaders, RequestOptions). voidmakeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)See makeDraftCopy(EntityValue, HttpHeaders, RequestOptions). EntityValuemakeDraftCopy(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers)See makeDraftCopy(EntityValue, HttpHeaders, RequestOptions). voidmakeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers)See makeDraftCopy(EntityValue, HttpHeaders, RequestOptions). voidmakeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)See makeDraftCopy(EntityValue, HttpHeaders, RequestOptions). EntityValuemakeDraftCopy(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)Create a draft copy of an entity. voidmakeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)Create a draft copy of an entity. voidmakeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)Create a draft copy of an entity. voidpingServer()See pingServer(HttpHeaders, RequestOptions). voidpingServerAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See pingServer(HttpHeaders, RequestOptions). voidpingServerAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See pingServer(HttpHeaders, RequestOptions). voidpingServer(@Nullable() @Nullable() HttpHeaders headers)See pingServer(HttpHeaders, RequestOptions). voidpingServerAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See pingServer(HttpHeaders, RequestOptions). voidpingServerAsync(@Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See pingServer(HttpHeaders, RequestOptions). voidpingServer(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Ping the server. voidpingServerAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Ping the server. voidpingServerAsync(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Ping the server. voidprocessBatch(@NonNull() @NotNull() RequestBatch batch)See processBatch(RequestBatch, HttpHeaders, RequestOptions). voidprocessBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See processBatch(RequestBatch, HttpHeaders, RequestOptions). voidprocessBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See processBatch(RequestBatch, HttpHeaders, RequestOptions). voidprocessBatch(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers)See processBatch(RequestBatch, HttpHeaders, RequestOptions). voidprocessBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See processBatch(RequestBatch, HttpHeaders, RequestOptions). voidprocessBatchAsync(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See processBatch(RequestBatch, HttpHeaders, RequestOptions). voidprocessBatch(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute a request batch in the target system. voidprocessBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Execute a request batch in the target system. voidprocessBatchAsync(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Execute a request batch in the target system. voidrefreshMetadata()Reload latest metadata from the backend server. voidrefreshMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)Reload latest metadata from the backend server. voidrefreshMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Reload latest metadata from the backend server. voidregisterClient()See registerClient(EntityValue). voidregisterClientAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See registerClient(EntityValue). voidregisterClientAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See registerClient(EntityValue). voidregisterClient(@Nullable() @Nullable() EntityValue client)If DataService.isClientRegistered would return false, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json.voidregisterClientAsync(@Nullable() @Nullable() EntityValue client, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)If DataService.isClientRegistered would return false, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json.voidregisterClientAsync(@Nullable() @Nullable() EntityValue client, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)If DataService.isClientRegistered would return false, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json.voidsaveEntity(@NonNull() @NotNull() EntityValue entity)See saveEntity(EntityValue, HttpHeaders, RequestOptions). voidsaveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See saveEntity(EntityValue, HttpHeaders, RequestOptions). voidsaveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See saveEntity(EntityValue, HttpHeaders, RequestOptions). voidsaveEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)See saveEntity(EntityValue, HttpHeaders, RequestOptions). voidsaveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See saveEntity(EntityValue, HttpHeaders, RequestOptions). voidsaveEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See saveEntity(EntityValue, HttpHeaders, RequestOptions). voidsaveEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create (if EntityValue.isNew) or update (if existing) an entity in the target system. voidsaveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Create (if EntityValue.isNew) or update (if existing) an entity in the target system. voidsaveEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Create (if EntityValue.isNew) or update (if existing) an entity in the target system. voidunloadMetadata()Unload service metadata DataService.provider (if previously loaded). voidunloadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)Unload service metadata DataService.provider (if previously loaded). voidunloadMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Unload service metadata DataService.provider (if previously loaded). voidunregisterClient()See unregisterClient(boolean). voidunregisterClientAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See unregisterClient(boolean). voidunregisterClientAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See unregisterClient(boolean). voidunregisterClient(boolean deleteFromServer)Forget any client registration previously established by DataService.registerClient. voidunregisterClientAsync(boolean deleteFromServer, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)Forget any client registration previously established by DataService.registerClient. voidunregisterClientAsync(boolean deleteFromServer, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Forget any client registration previously established by DataService.registerClient. voidupdateEntity(@NonNull() @NotNull() EntityValue entity)See updateEntity(EntityValue, HttpHeaders, RequestOptions). voidupdateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See updateEntity(EntityValue, HttpHeaders, RequestOptions). voidupdateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See updateEntity(EntityValue, HttpHeaders, RequestOptions). voidupdateEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)See updateEntity(EntityValue, HttpHeaders, RequestOptions). voidupdateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See updateEntity(EntityValue, HttpHeaders, RequestOptions). voidupdateEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See updateEntity(EntityValue, HttpHeaders, RequestOptions). voidupdateEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Update an entity in the target system. voidupdateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Update an entity in the target system. voidupdateEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Update an entity in the target system. voidupdateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to)See updateLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidupdateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See updateLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidupdateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See updateLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidupdateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers)See updateLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidupdateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See updateLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidupdateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See updateLink(EntityValue, Property, EntityValue, HttpHeaders, RequestOptions). voidupdateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Update a link from a source entity to a target entity. voidupdateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Update a link from a source entity to a target entity. voidupdateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Update a link from a source entity to a target entity. voiduploadMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content)See uploadMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voiduploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See uploadMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voiduploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See uploadMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voiduploadMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers)See uploadMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voiduploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See uploadMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voiduploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See uploadMedia(EntityValue, StreamBase, HttpHeaders, RequestOptions). voiduploadMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Upload content for a media entity to the target system. voiduploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Upload content for a media entity to the target system. voiduploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Upload content for a media entity to the target system. voiduploadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content)See uploadStream(EntityValue, StreamLink, StreamBase, HttpHeaders, RequestOptions). voiduploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)See uploadStream(EntityValue, StreamLink, StreamBase, HttpHeaders, RequestOptions). voiduploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See uploadStream(EntityValue, StreamLink, StreamBase, HttpHeaders, RequestOptions). voiduploadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers)See uploadStream(EntityValue, StreamLink, StreamBase, HttpHeaders, RequestOptions). voiduploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)See uploadStream(EntityValue, StreamLink, StreamBase, HttpHeaders, RequestOptions). voiduploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)See uploadStream(EntityValue, StreamLink, StreamBase, HttpHeaders, RequestOptions). voiduploadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Upload content for a stream property to the target system. voiduploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)Upload content for a stream property to the target system. voiduploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)Upload content for a stream property to the target system. -
-
Constructor Detail
-
DataService
DataService(DataServiceProvider provider)
Construct a new data service using a specified provider.- Parameters:
provider- Data service provider.
-
-
Method Detail
-
getActionExecutor
@NonNull()@NotNull() Executor getActionExecutor()
- Returns:
the executor for async actions (e.g. create / update / delete methods). By default, this will be a serial executor.
-
getFunctionExecutor
@NonNull()@NotNull() Executor getFunctionExecutor()
- Returns:
the executor for async functions (e.g. query methods). By default, this will be a parallel executor.
-
setActionExecutor
void setActionExecutor(@NonNull() @NotNull() Executor executor)
Set the executor for async actions (e.g. create / update / delete methods). It is recommended that this be a serial executor (i.e. one thread at a time).
- Parameters:
executor- Action executor.
-
setFunctionExecutor
void setFunctionExecutor(@NonNull() @NotNull() Executor executor)
Set the executor for async functions (e.g. query methods). It is recommended that this be a parallel executor (i.e. multiple threads at a time), but with the number of threads limited to avoid resource exhaustion in the application.
- Parameters:
executor- Function executor.
-
asyncAction
void asyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Invoke an action asynchronously.
- Parameters:
action- Action to be invoked.resultHandler- Result handler.
-
asyncAction
void asyncAction(@NonNull() @NotNull() Action0 action, @Nullable() @Nullable() RequestOptions requestOptions, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Invoke an action asynchronously.
- Parameters:
action- Action to be invoked.requestOptions- (nullable) Request options.resultHandler- Result handler.
-
asyncAction
void asyncAction(@NonNull() @NotNull() Action0 action, @Nullable() @Nullable() RequestOptions requestOptions, boolean functionExecutor, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Invoke an action asynchronously.
- Parameters:
action- Action to be invoked.requestOptions- (nullable) Request options.functionExecutor- True if the action should be executed by the function exector.resultHandler- Result handler.
-
asyncAction
void asyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
Invoke an action asynchronously.
- Parameters:
action- Action to be invoked.successHandler- Success handler.failureHandler- Failure handler.
-
asyncAction
void asyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions)
Invoke an action asynchronously.
- Parameters:
action- Action to be invoked.successHandler- Success handler.failureHandler- Failure handler.requestOptions- Request options.
-
asyncFunction
<T> void asyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() AsyncResult.Handler<T> resultHandler)
Invoke a function asynchronously.
- Parameters:
function- Function to be invoked.resultHandler- Result handler.
-
asyncFunction
<T> void asyncFunction(@NonNull() @NotNull() Function0<T> function, @Nullable() @Nullable() RequestOptions requestOptions, @NonNull() @NotNull() AsyncResult.Handler<T> resultHandler)
Invoke a function asynchronously.
- Parameters:
function- Function to be invoked.requestOptions- (nullable) Request options.resultHandler- Result handler.
-
asyncFunction
<T> void asyncFunction(@NonNull() @NotNull() Function0<T> function, @Nullable() @Nullable() RequestOptions requestOptions, boolean actionExecutor, @NonNull() @NotNull() AsyncResult.Handler<T> resultHandler)
Invoke a function asynchronously.
- Parameters:
function- Function to be invoked.requestOptions- (nullable) Request options.actionExecutor- True if the function should be executed by the action exector.resultHandler- Result handler.
-
asyncFunction
<T> void asyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() Action1<T> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
Invoke a function asynchronously.
- Parameters:
function- Function to be invoked.successHandler- Success handler.failureHandler- Failure handler.
-
asyncFunction
<T> void asyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() Action1<T> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions)
Invoke a function asynchronously.
- Parameters:
function- Function to be invoked.successHandler- Success handler.failureHandler- Failure handler.requestOptions- (nullable) Request options.
-
asyncAction
void asyncAction(@NonNull() @NotNull() Action0 action, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions, boolean functionExecutor)
Invoke an action asynchronously.
- Parameters:
action- Action to be invoked.successHandler- Success handler.failureHandler- Failure handler.requestOptions- (nullable) Request options.functionExecutor- True if the action should be executed by the function exector.
-
asyncFunction
<T> void asyncFunction(@NonNull() @NotNull() Function0<T> function, @NonNull() @NotNull() Action1<T> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() RequestOptions requestOptions, boolean actionExecutor)
Invoke a function asynchronously.
- Parameters:
function- Function to be invoked.successHandler- Success handler.failureHandler- Failure handler.requestOptions- (nullable) Request options.actionExecutor- True if the function should be executed by the action exector.
-
activateDraft
@NonNull()@NotNull() EntityValue activateDraft(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
activateDraftAsync
void activateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
activateDraftAsync
void activateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
activateDraft
@NonNull()@NotNull() EntityValue activateDraft(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
activateDraftAsync
void activateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
activateDraftAsync
void activateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
activateDraft
@NonNull()@NotNull() EntityValue activateDraft(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)
Activate a draft entity.
- See Also:
DataService.makeDraftCopy, EntityValue.withCreate, EntityValue.withUpdate, EntityValue.withDeepCreate, EntityValue.withDeepUpdate.
- Example using proxy classes:
public void activateDraftExample() { HealthService service = this.getHealthService(); Patient patient = new Patient(); patient.setFirstName("Sherlock"); patient.setLastName("Holmes"); service.createEntity(patient.asDraft()); // Upload pending requests, but not the draft patient. service.upload(); // Associate a new draft appointment with the draft patient. Appointment appointment = new Appointment(); appointment.setPurpose("General Checkup"); service.createRelatedEntity(appointment.asDraft(), patient, Patient.appointments); // Some time later... Activate the patient (and related appointments). patient = ((Patient)service.activateDraft(patient.withDeepCreate(Patient.appointments))); // Some time later... Upload the create of patient (and deep-created appointments). service.upload(); }
- Parameters:
entity- Draft entity.headers- Optional request-specific headers.options- Optional request-specific options.- Returns:
Newly activated copy of the draft entity.
-
activateDraftAsync
void activateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)
Activate a draft entity.
- See Also:
DataService.makeDraftCopy, EntityValue.withCreate, EntityValue.withUpdate, EntityValue.withDeepCreate, EntityValue.withDeepUpdate.
- Example using proxy classes:
public void activateDraftExample() { HealthService service = this.getHealthService(); Patient patient = new Patient(); patient.setFirstName("Sherlock"); patient.setLastName("Holmes"); service.createEntity(patient.asDraft()); // Upload pending requests, but not the draft patient. service.upload(); // Associate a new draft appointment with the draft patient. Appointment appointment = new Appointment(); appointment.setPurpose("General Checkup"); service.createRelatedEntity(appointment.asDraft(), patient, Patient.appointments); // Some time later... Activate the patient (and related appointments). patient = ((Patient)service.activateDraft(patient.withDeepCreate(Patient.appointments))); // Some time later... Upload the create of patient (and deep-created appointments). service.upload(); }
- Parameters:
entity- Draft entity.headers- Optional request-specific headers.options- Optional request-specific options.- Returns:
Newly activated copy of the draft entity.
-
activateDraftAsync
void activateDraftAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)
Activate a draft entity.
- See Also:
DataService.makeDraftCopy, EntityValue.withCreate, EntityValue.withUpdate, EntityValue.withDeepCreate, EntityValue.withDeepUpdate.
- Example using proxy classes:
public void activateDraftExample() { HealthService service = this.getHealthService(); Patient patient = new Patient(); patient.setFirstName("Sherlock"); patient.setLastName("Holmes"); service.createEntity(patient.asDraft()); // Upload pending requests, but not the draft patient. service.upload(); // Associate a new draft appointment with the draft patient. Appointment appointment = new Appointment(); appointment.setPurpose("General Checkup"); service.createRelatedEntity(appointment.asDraft(), patient, Patient.appointments); // Some time later... Activate the patient (and related appointments). patient = ((Patient)service.activateDraft(patient.withDeepCreate(Patient.appointments))); // Some time later... Upload the create of patient (and deep-created appointments). service.upload(); }
- Parameters:
entity- Draft entity.headers- Optional request-specific headers.options- Optional request-specific options.- Returns:
Newly activated copy of the draft entity.
-
applyChanges
void applyChanges(@NonNull() @NotNull() ChangeSet changes)
- Parameters:
changes- Changes parameter.
-
applyChangesAsync
void applyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
changes- Changes parameter.
-
applyChangesAsync
void applyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
changes- Changes parameter.
-
applyChanges
void applyChanges(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
changes- Changes parameter.headers- Headers parameter.
-
applyChangesAsync
void applyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
changes- Changes parameter.headers- Headers parameter.
-
applyChangesAsync
void applyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
changes- Changes parameter.headers- Headers parameter.
-
applyChanges
void applyChanges(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Apply the changes from a change set to the target system.
- See Also:
- Example using proxy classes:
public void applyChangesExample() { NorthwindService service = this.getService(); List<Supplier> suppliers = service.getSuppliers(new DataQuery().top(2)); List<Product> products = service.getProducts(new DataQuery().top(3)); Product product1 = products.get(0).copy(); Product product2 = products.get(1).copy(); Product product3 = products.get(2).copy(); product1.setProductName("Blueberry Muffins"); product2.setProductName("Strawberry Yoghurt"); product3.setProductName("Raspberry Pie"); ChangeSet entityCreates = new ChangeSet(); entityCreates.createEntity(product1); entityCreates.createEntity(product2); entityCreates.createEntity(product3); service.applyChanges(entityCreates); ChangeSet entityChanges = new ChangeSet(); product2.setProductName("Blackberry Yoghurt"); entityChanges.updateEntity(product2); entityChanges.deleteEntity(product3); service.applyChanges(entityChanges); ChangeSet linkChanges = new ChangeSet(); Supplier supplier1 = suppliers.get(0); Supplier supplier2 = suppliers.get(1); linkChanges.createLink(product1, Product.supplier, supplier1); linkChanges.updateLink(product1, Product.supplier, supplier2); linkChanges.deleteLink(product1, Product.supplier); service.applyChanges(linkChanges); }
- Example using dynamic API:
public void applyChangesExample() { DataService service = this.getService(); EntitySet suppliersEntitySet = service.getEntitySet("Suppliers"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType productEntityType = productsEntitySet.getEntityType(); Property productNameProperty = productEntityType.getProperty("ProductName"); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValueList suppliers = service.executeQuery(new DataQuery() .from(suppliersEntitySet).top(2)) .getEntityList(); EntityValueList products = service.executeQuery(new DataQuery() .from(productsEntitySet).top(3)) .getEntityList(); EntityValue product1 = products.get(0).copyEntity(); EntityValue product2 = products.get(1).copyEntity(); EntityValue product3 = products.get(1).copyEntity(); productNameProperty.setString(product1, "Blueberry Yoghurt"); productNameProperty.setString(product2, "Strawberry Yoghurt"); productNameProperty.setString(product3, "Raspberry Pie"); ChangeSet entityCreates = new ChangeSet(); entityCreates.createEntity(product1); entityCreates.createEntity(product2); entityCreates.createEntity(product3); service.applyChanges(entityCreates); ChangeSet entityChanges = new ChangeSet(); productNameProperty.setString(product2, "Blackberry Yoghurt"); entityChanges.updateEntity(product2); entityChanges.deleteEntity(product3); service.applyChanges(entityChanges); ChangeSet linkChanges = new ChangeSet(); EntityValue supplier1 = suppliers.get(0); EntityValue supplier2 = suppliers.get(1); linkChanges.createLink(product1, supplierProperty, supplier1); linkChanges.updateLink(product1, supplierProperty, supplier2); linkChanges.deleteLink(product1, supplierProperty); service.applyChanges(linkChanges); }
- Parameters:
changes- The change set.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
applyChangesAsync
void applyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Apply the changes from a change set to the target system.
- See Also:
- Example using proxy classes:
public void applyChangesExample() { NorthwindService service = this.getService(); List<Supplier> suppliers = service.getSuppliers(new DataQuery().top(2)); List<Product> products = service.getProducts(new DataQuery().top(3)); Product product1 = products.get(0).copy(); Product product2 = products.get(1).copy(); Product product3 = products.get(2).copy(); product1.setProductName("Blueberry Muffins"); product2.setProductName("Strawberry Yoghurt"); product3.setProductName("Raspberry Pie"); ChangeSet entityCreates = new ChangeSet(); entityCreates.createEntity(product1); entityCreates.createEntity(product2); entityCreates.createEntity(product3); service.applyChanges(entityCreates); ChangeSet entityChanges = new ChangeSet(); product2.setProductName("Blackberry Yoghurt"); entityChanges.updateEntity(product2); entityChanges.deleteEntity(product3); service.applyChanges(entityChanges); ChangeSet linkChanges = new ChangeSet(); Supplier supplier1 = suppliers.get(0); Supplier supplier2 = suppliers.get(1); linkChanges.createLink(product1, Product.supplier, supplier1); linkChanges.updateLink(product1, Product.supplier, supplier2); linkChanges.deleteLink(product1, Product.supplier); service.applyChanges(linkChanges); }
- Example using dynamic API:
public void applyChangesExample() { DataService service = this.getService(); EntitySet suppliersEntitySet = service.getEntitySet("Suppliers"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType productEntityType = productsEntitySet.getEntityType(); Property productNameProperty = productEntityType.getProperty("ProductName"); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValueList suppliers = service.executeQuery(new DataQuery() .from(suppliersEntitySet).top(2)) .getEntityList(); EntityValueList products = service.executeQuery(new DataQuery() .from(productsEntitySet).top(3)) .getEntityList(); EntityValue product1 = products.get(0).copyEntity(); EntityValue product2 = products.get(1).copyEntity(); EntityValue product3 = products.get(1).copyEntity(); productNameProperty.setString(product1, "Blueberry Yoghurt"); productNameProperty.setString(product2, "Strawberry Yoghurt"); productNameProperty.setString(product3, "Raspberry Pie"); ChangeSet entityCreates = new ChangeSet(); entityCreates.createEntity(product1); entityCreates.createEntity(product2); entityCreates.createEntity(product3); service.applyChanges(entityCreates); ChangeSet entityChanges = new ChangeSet(); productNameProperty.setString(product2, "Blackberry Yoghurt"); entityChanges.updateEntity(product2); entityChanges.deleteEntity(product3); service.applyChanges(entityChanges); ChangeSet linkChanges = new ChangeSet(); EntityValue supplier1 = suppliers.get(0); EntityValue supplier2 = suppliers.get(1); linkChanges.createLink(product1, supplierProperty, supplier1); linkChanges.updateLink(product1, supplierProperty, supplier2); linkChanges.deleteLink(product1, supplierProperty); service.applyChanges(linkChanges); }
- Parameters:
changes- The change set.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
applyChangesAsync
void applyChangesAsync(@NonNull() @NotNull() ChangeSet changes, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Apply the changes from a change set to the target system.
- See Also:
- Example using proxy classes:
public void applyChangesExample() { NorthwindService service = this.getService(); List<Supplier> suppliers = service.getSuppliers(new DataQuery().top(2)); List<Product> products = service.getProducts(new DataQuery().top(3)); Product product1 = products.get(0).copy(); Product product2 = products.get(1).copy(); Product product3 = products.get(2).copy(); product1.setProductName("Blueberry Muffins"); product2.setProductName("Strawberry Yoghurt"); product3.setProductName("Raspberry Pie"); ChangeSet entityCreates = new ChangeSet(); entityCreates.createEntity(product1); entityCreates.createEntity(product2); entityCreates.createEntity(product3); service.applyChanges(entityCreates); ChangeSet entityChanges = new ChangeSet(); product2.setProductName("Blackberry Yoghurt"); entityChanges.updateEntity(product2); entityChanges.deleteEntity(product3); service.applyChanges(entityChanges); ChangeSet linkChanges = new ChangeSet(); Supplier supplier1 = suppliers.get(0); Supplier supplier2 = suppliers.get(1); linkChanges.createLink(product1, Product.supplier, supplier1); linkChanges.updateLink(product1, Product.supplier, supplier2); linkChanges.deleteLink(product1, Product.supplier); service.applyChanges(linkChanges); }
- Example using dynamic API:
public void applyChangesExample() { DataService service = this.getService(); EntitySet suppliersEntitySet = service.getEntitySet("Suppliers"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType productEntityType = productsEntitySet.getEntityType(); Property productNameProperty = productEntityType.getProperty("ProductName"); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValueList suppliers = service.executeQuery(new DataQuery() .from(suppliersEntitySet).top(2)) .getEntityList(); EntityValueList products = service.executeQuery(new DataQuery() .from(productsEntitySet).top(3)) .getEntityList(); EntityValue product1 = products.get(0).copyEntity(); EntityValue product2 = products.get(1).copyEntity(); EntityValue product3 = products.get(1).copyEntity(); productNameProperty.setString(product1, "Blueberry Yoghurt"); productNameProperty.setString(product2, "Strawberry Yoghurt"); productNameProperty.setString(product3, "Raspberry Pie"); ChangeSet entityCreates = new ChangeSet(); entityCreates.createEntity(product1); entityCreates.createEntity(product2); entityCreates.createEntity(product3); service.applyChanges(entityCreates); ChangeSet entityChanges = new ChangeSet(); productNameProperty.setString(product2, "Blackberry Yoghurt"); entityChanges.updateEntity(product2); entityChanges.deleteEntity(product3); service.applyChanges(entityChanges); ChangeSet linkChanges = new ChangeSet(); EntityValue supplier1 = suppliers.get(0); EntityValue supplier2 = suppliers.get(1); linkChanges.createLink(product1, supplierProperty, supplier1); linkChanges.updateLink(product1, supplierProperty, supplier2); linkChanges.deleteLink(product1, supplierProperty); service.applyChanges(linkChanges); }
- Parameters:
changes- The change set.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
checkIfCancelled
void checkIfCancelled(@Nullable() @Nullable() CancelToken token)
Check if
tokenhas been marked for cancellation. If it has, throw com.sap.cloud.mobile.odata.RequestCancelledException.- Parameters:
token- (nullable) Cancellation token.
-
createEntity
void createEntity(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.
-
createEntityAsync
void createEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.
-
createEntityAsync
void createEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.
-
createEntity
void createEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
createEntityAsync
void createEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
createEntityAsync
void createEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
createEntity
void createEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create an entity in the target system. Automatically calls CsdlDocument.resolveEntity to ensure that EntityValue.entitySet is available.
- See Also:
EntityValue.ofType, EntityValue.inSet, DataService.createRelatedEntity, Create Related Entities When Creating an Entity.
- Example using proxy classes:
public void createEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("Jean-Luc Picard"); service.createEntity(customer); }
- Example using proxy classes:
public void deepCreateExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("LeVar Burton"); Order order1 = new Order(); Order order2 = new Order(); customer.bindEntity(order1, Customer.orders); customer.bindEntity(order2, Customer.orders); service.createEntity(customer.withDeepCreate()); }
- Example using proxy classes:
public void createInSetExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Voyager Inc."); customer.setContactName("Kathryn Janeway"); service.createEntity(customer.inSet(NorthwindService.customers)); }
- Example using dynamic API:
public void createEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); EntityValue customer = EntityValue.ofType(customerEntityType); companyNameProperty.setString(customer, "Enterprise Inc."); contactNameProperty.setString(customer, "Jean-Luc Picard"); service.createEntity(customer); }
- Parameters:
entity- Entity to be created.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createEntityAsync
void createEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create an entity in the target system. Automatically calls CsdlDocument.resolveEntity to ensure that EntityValue.entitySet is available.
- See Also:
EntityValue.ofType, EntityValue.inSet, DataService.createRelatedEntity, Create Related Entities When Creating an Entity.
- Example using proxy classes:
public void createEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("Jean-Luc Picard"); service.createEntity(customer); }
- Example using proxy classes:
public void deepCreateExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("LeVar Burton"); Order order1 = new Order(); Order order2 = new Order(); customer.bindEntity(order1, Customer.orders); customer.bindEntity(order2, Customer.orders); service.createEntity(customer.withDeepCreate()); }
- Example using proxy classes:
public void createInSetExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Voyager Inc."); customer.setContactName("Kathryn Janeway"); service.createEntity(customer.inSet(NorthwindService.customers)); }
- Example using dynamic API:
public void createEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); EntityValue customer = EntityValue.ofType(customerEntityType); companyNameProperty.setString(customer, "Enterprise Inc."); contactNameProperty.setString(customer, "Jean-Luc Picard"); service.createEntity(customer); }
- Parameters:
entity- Entity to be created.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createEntityAsync
void createEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Create an entity in the target system. Automatically calls CsdlDocument.resolveEntity to ensure that EntityValue.entitySet is available.
- See Also:
EntityValue.ofType, EntityValue.inSet, DataService.createRelatedEntity, Create Related Entities When Creating an Entity.
- Example using proxy classes:
public void createEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("Jean-Luc Picard"); service.createEntity(customer); }
- Example using proxy classes:
public void deepCreateExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("LeVar Burton"); Order order1 = new Order(); Order order2 = new Order(); customer.bindEntity(order1, Customer.orders); customer.bindEntity(order2, Customer.orders); service.createEntity(customer.withDeepCreate()); }
- Example using proxy classes:
public void createInSetExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Voyager Inc."); customer.setContactName("Kathryn Janeway"); service.createEntity(customer.inSet(NorthwindService.customers)); }
- Example using dynamic API:
public void createEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); EntityValue customer = EntityValue.ofType(customerEntityType); companyNameProperty.setString(customer, "Enterprise Inc."); contactNameProperty.setString(customer, "Jean-Luc Picard"); service.createEntity(customer); }
- Parameters:
entity- Entity to be created.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createLink
void createLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
createLinkAsync
void createLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
createLinkAsync
void createLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
createLink
void createLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
createLinkAsync
void createLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
createLinkAsync
void createLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
createLink
void createLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create a link from a source entity to a target entity in the target system.
- Example using proxy classes:
public void createLinkExample() { NorthwindService service = this.getService(); Category category = service.getCategory(new DataQuery().skip(1).top(1)); Product product = service.getProduct(new DataQuery().top(1)); service.createLink(category, Category.products, product); }
- Example using dynamic API:
public void createLinkExample() { DataService service = this.getService(); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType categoryEntityType = categoriesEntitySet.getEntityType(); Property productsProperty = categoryEntityType.getProperty("Products"); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(1).top(1)) .getRequiredEntity(); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.createLink(category, productsProperty, product); }
- Parameters:
from- Source entity for the link to be created.property- Source navigation property for the link to be created.to- Target entity for the link to be created.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createLinkAsync
void createLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create a link from a source entity to a target entity in the target system.
- Example using proxy classes:
public void createLinkExample() { NorthwindService service = this.getService(); Category category = service.getCategory(new DataQuery().skip(1).top(1)); Product product = service.getProduct(new DataQuery().top(1)); service.createLink(category, Category.products, product); }
- Example using dynamic API:
public void createLinkExample() { DataService service = this.getService(); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType categoryEntityType = categoriesEntitySet.getEntityType(); Property productsProperty = categoryEntityType.getProperty("Products"); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(1).top(1)) .getRequiredEntity(); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.createLink(category, productsProperty, product); }
- Parameters:
from- Source entity for the link to be created.property- Source navigation property for the link to be created.to- Target entity for the link to be created.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createLinkAsync
void createLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Create a link from a source entity to a target entity in the target system.
- Example using proxy classes:
public void createLinkExample() { NorthwindService service = this.getService(); Category category = service.getCategory(new DataQuery().skip(1).top(1)); Product product = service.getProduct(new DataQuery().top(1)); service.createLink(category, Category.products, product); }
- Example using dynamic API:
public void createLinkExample() { DataService service = this.getService(); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType categoryEntityType = categoriesEntitySet.getEntityType(); Property productsProperty = categoryEntityType.getProperty("Products"); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(1).top(1)) .getRequiredEntity(); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.createLink(category, productsProperty, product); }
- Parameters:
from- Source entity for the link to be created.property- Source navigation property for the link to be created.to- Target entity for the link to be created.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createMedia
void createMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content)
- Parameters:
entity- Entity parameter.content- Content parameter.
-
createMediaAsync
void createMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.content- Content parameter.
-
createMediaAsync
void createMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.content- Content parameter.
-
createMedia
void createMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.content- Content parameter.headers- Headers parameter.
-
createMediaAsync
void createMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.content- Content parameter.headers- Headers parameter.
-
createMediaAsync
void createMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.content- Content parameter.headers- Headers parameter.
-
createMedia
void createMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create a media entity with the specified content. If the
entityhas non-stream structural properties in addition to the key properties and media content, such aslabelin the examples below, then this function will send two requests to the server: a first request to upload (POST) the media stream, and a second request (PATCH/PUT) to update the non-stream properties. It is not currently supported to make these two calls atomic. Caution: Having too many threads simultaneously creating streams may result in out-of-memory conditions on memory-constrained devices.- Example using proxy classes:
public void createMediaExample() { MediaService service = this.getService(); Image image = new Image(); image.setLabel("Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); }
- Example using dynamic API:
public void createMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); EntityValue image = EntityValue.ofType(imageEntityType); labelProperty.setString(image, "Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); }
- Parameters:
entity- Entity to be created.content- Initial content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createMediaAsync
void createMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create a media entity with the specified content. If the
entityhas non-stream structural properties in addition to the key properties and media content, such aslabelin the examples below, then this function will send two requests to the server: a first request to upload (POST) the media stream, and a second request (PATCH/PUT) to update the non-stream properties. It is not currently supported to make these two calls atomic. Caution: Having too many threads simultaneously creating streams may result in out-of-memory conditions on memory-constrained devices.- Example using proxy classes:
public void createMediaExample() { MediaService service = this.getService(); Image image = new Image(); image.setLabel("Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); }
- Example using dynamic API:
public void createMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); EntityValue image = EntityValue.ofType(imageEntityType); labelProperty.setString(image, "Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); }
- Parameters:
entity- Entity to be created.content- Initial content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createMediaAsync
void createMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Create a media entity with the specified content. If the
entityhas non-stream structural properties in addition to the key properties and media content, such aslabelin the examples below, then this function will send two requests to the server: a first request to upload (POST) the media stream, and a second request (PATCH/PUT) to update the non-stream properties. It is not currently supported to make these two calls atomic. Caution: Having too many threads simultaneously creating streams may result in out-of-memory conditions on memory-constrained devices.- Example using proxy classes:
public void createMediaExample() { MediaService service = this.getService(); Image image = new Image(); image.setLabel("Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); }
- Example using dynamic API:
public void createMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); EntityValue image = EntityValue.ofType(imageEntityType); labelProperty.setString(image, "Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); }
- Parameters:
entity- Entity to be created.content- Initial content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createRelatedEntity
void createRelatedEntity(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property)
- Parameters:
entity- Entity parameter.parent- Parent parameter.property- Property parameter.
-
createRelatedEntityAsync
void createRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.parent- Parent parameter.property- Property parameter.
-
createRelatedEntityAsync
void createRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.parent- Parent parameter.property- Property parameter.
-
createRelatedEntity
void createRelatedEntity(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.parent- Parent parameter.property- Property parameter.headers- Headers parameter.
-
createRelatedEntityAsync
void createRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.parent- Parent parameter.property- Property parameter.headers- Headers parameter.
-
createRelatedEntityAsync
void createRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.parent- Parent parameter.property- Property parameter.headers- Headers parameter.
-
createRelatedEntity
void createRelatedEntity(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create an entity in the target system, related to an existing parent entity via a parent navigation property.
- Example using proxy classes:
public void createRelatedEntityExample() { NorthwindService service = this.getService(); Customer customer = service.getCustomer(new DataQuery().top(1) .filter(Customer.customerID.equal("ALFKI"))); List<Order> orders = service.getOrders(new DataQuery().top(1)); Order newOrder = orders.get(0).copy(); service.createRelatedEntity(newOrder, customer, Customer.orders); }
- Example using dynamic API:
public void createRelatedEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntitySet ordersEntitySet = service.getEntitySet("Orders"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property ordersProperty = customerEntityType.getProperty("Orders"); EntityValueList customers = service.executeQuery(new DataQuery() .from(customersEntitySet).filter(customerIDProperty.equal("ALFKI"))) .getEntityList(); EntityValueList orders = service.executeQuery(new DataQuery() .from(ordersEntitySet).top(1)) .getEntityList(); EntityValue customer = customers.first(); EntityValue newOrder = orders.first().copyEntity(); service.createRelatedEntity(newOrder, customer, ordersProperty); }
- Parameters:
entity- Entity to be created.parent- Previously created parent entity.property- Parent's navigation property.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createRelatedEntityAsync
void createRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create an entity in the target system, related to an existing parent entity via a parent navigation property.
- Example using proxy classes:
public void createRelatedEntityExample() { NorthwindService service = this.getService(); Customer customer = service.getCustomer(new DataQuery().top(1) .filter(Customer.customerID.equal("ALFKI"))); List<Order> orders = service.getOrders(new DataQuery().top(1)); Order newOrder = orders.get(0).copy(); service.createRelatedEntity(newOrder, customer, Customer.orders); }
- Example using dynamic API:
public void createRelatedEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntitySet ordersEntitySet = service.getEntitySet("Orders"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property ordersProperty = customerEntityType.getProperty("Orders"); EntityValueList customers = service.executeQuery(new DataQuery() .from(customersEntitySet).filter(customerIDProperty.equal("ALFKI"))) .getEntityList(); EntityValueList orders = service.executeQuery(new DataQuery() .from(ordersEntitySet).top(1)) .getEntityList(); EntityValue customer = customers.first(); EntityValue newOrder = orders.first().copyEntity(); service.createRelatedEntity(newOrder, customer, ordersProperty); }
- Parameters:
entity- Entity to be created.parent- Previously created parent entity.property- Parent's navigation property.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createRelatedEntityAsync
void createRelatedEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Create an entity in the target system, related to an existing parent entity via a parent navigation property.
- Example using proxy classes:
public void createRelatedEntityExample() { NorthwindService service = this.getService(); Customer customer = service.getCustomer(new DataQuery().top(1) .filter(Customer.customerID.equal("ALFKI"))); List<Order> orders = service.getOrders(new DataQuery().top(1)); Order newOrder = orders.get(0).copy(); service.createRelatedEntity(newOrder, customer, Customer.orders); }
- Example using dynamic API:
public void createRelatedEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntitySet ordersEntitySet = service.getEntitySet("Orders"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property ordersProperty = customerEntityType.getProperty("Orders"); EntityValueList customers = service.executeQuery(new DataQuery() .from(customersEntitySet).filter(customerIDProperty.equal("ALFKI"))) .getEntityList(); EntityValueList orders = service.executeQuery(new DataQuery() .from(ordersEntitySet).top(1)) .getEntityList(); EntityValue customer = customers.first(); EntityValue newOrder = orders.first().copyEntity(); service.createRelatedEntity(newOrder, customer, ordersProperty); }
- Parameters:
entity- Entity to be created.parent- Previously created parent entity.property- Parent's navigation property.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createRelatedMedia
void createRelatedMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property)
See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions).
- Parameters:
entity- Entity parameter.content- Content parameter.parent- Parent parameter.property- Property parameter.
-
createRelatedMediaAsync
void createRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions).
- Parameters:
entity- Entity parameter.content- Content parameter.parent- Parent parameter.property- Property parameter.
-
createRelatedMediaAsync
void createRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions).
- Parameters:
entity- Entity parameter.content- Content parameter.parent- Parent parameter.property- Property parameter.
-
createRelatedMedia
void createRelatedMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers)
See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions).
- Parameters:
entity- Entity parameter.content- Content parameter.parent- Parent parameter.property- Property parameter.headers- Headers parameter.
-
createRelatedMediaAsync
void createRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions).
- Parameters:
entity- Entity parameter.content- Content parameter.parent- Parent parameter.property- Property parameter.headers- Headers parameter.
-
createRelatedMediaAsync
void createRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
See createRelatedMedia(EntityValue, StreamBase, EntityValue, Property, HttpHeaders, RequestOptions).
- Parameters:
entity- Entity parameter.content- Content parameter.parent- Parent parameter.property- Property parameter.headers- Headers parameter.
-
createRelatedMedia
void createRelatedMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create an media entity in the target system, related to a parent entity via a parent navigation property.
- Example using proxy classes:
public void createRelatedMediaExample() { MediaService service = this.getService(); Artist artist = new Artist(); artist.setFirstName("Salvador"); artist.setLastName("Dali"); artist.setDateOfBirth(LocalDate.of(1904, 5, 11)); artist.setPlaceOfBirth(GeographyPoint.withLatitudeLongitude(42.266667d, 2.965d)); service.createEntity(artist); Image image = new Image(); image.setLabel("Dream"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("Dream Caused by the Flight of a Bee around a Pomegranate a Second Before Awakening")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, Artist.images); }
- Example using dynamic API:
public void createRelatedMediaExample() { DataService service = this.getService(); EntitySet artistsEntitySet = service.getEntitySet("Artists"); EntityType artistEntityType = artistsEntitySet.getEntityType(); Property firstNameProperty = artistEntityType.getProperty("firstName"); Property lastNameProperty = artistEntityType.getProperty("lastName"); Property dateOfBirthProperty = artistEntityType.getProperty("dateOfBirth"); Property placeOfBirthProperty = artistEntityType.getProperty("placeOfBirth"); Property imagesProperty = artistEntityType.getProperty("images"); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); EntityValue artist = EntityValue.ofType(artistEntityType); firstNameProperty.setString(artist, "Maurits"); lastNameProperty.setString(artist, "Escher"); dateOfBirthProperty.setValue(artist, LocalDate.of(1898, 6, 17)); placeOfBirthProperty.setValue(artist, GeographyPoint.withLatitudeLongitude(53.2d, 5.783333d)); service.createEntity(artist); EntityValue image = EntityValue.ofType(imageEntityType); labelProperty.setString(image, "Hands"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("Drawing Hands")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, imagesProperty); }
- Parameters:
entity- Entity to be created.content- Initial content.parent- Previously created parent entity.property- Parent's navigation property.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createRelatedMediaAsync
void createRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create an media entity in the target system, related to a parent entity via a parent navigation property.
- Example using proxy classes:
public void createRelatedMediaExample() { MediaService service = this.getService(); Artist artist = new Artist(); artist.setFirstName("Salvador"); artist.setLastName("Dali"); artist.setDateOfBirth(LocalDate.of(1904, 5, 11)); artist.setPlaceOfBirth(GeographyPoint.withLatitudeLongitude(42.266667d, 2.965d)); service.createEntity(artist); Image image = new Image(); image.setLabel("Dream"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("Dream Caused by the Flight of a Bee around a Pomegranate a Second Before Awakening")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, Artist.images); }
- Example using dynamic API:
public void createRelatedMediaExample() { DataService service = this.getService(); EntitySet artistsEntitySet = service.getEntitySet("Artists"); EntityType artistEntityType = artistsEntitySet.getEntityType(); Property firstNameProperty = artistEntityType.getProperty("firstName"); Property lastNameProperty = artistEntityType.getProperty("lastName"); Property dateOfBirthProperty = artistEntityType.getProperty("dateOfBirth"); Property placeOfBirthProperty = artistEntityType.getProperty("placeOfBirth"); Property imagesProperty = artistEntityType.getProperty("images"); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); EntityValue artist = EntityValue.ofType(artistEntityType); firstNameProperty.setString(artist, "Maurits"); lastNameProperty.setString(artist, "Escher"); dateOfBirthProperty.setValue(artist, LocalDate.of(1898, 6, 17)); placeOfBirthProperty.setValue(artist, GeographyPoint.withLatitudeLongitude(53.2d, 5.783333d)); service.createEntity(artist); EntityValue image = EntityValue.ofType(imageEntityType); labelProperty.setString(image, "Hands"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("Drawing Hands")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, imagesProperty); }
- Parameters:
entity- Entity to be created.content- Initial content.parent- Previously created parent entity.property- Parent's navigation property.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
createRelatedMediaAsync
void createRelatedMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() EntityValue parent, @NonNull() @NotNull() Property property, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Create an media entity in the target system, related to a parent entity via a parent navigation property.
- Example using proxy classes:
public void createRelatedMediaExample() { MediaService service = this.getService(); Artist artist = new Artist(); artist.setFirstName("Salvador"); artist.setLastName("Dali"); artist.setDateOfBirth(LocalDate.of(1904, 5, 11)); artist.setPlaceOfBirth(GeographyPoint.withLatitudeLongitude(42.266667d, 2.965d)); service.createEntity(artist); Image image = new Image(); image.setLabel("Dream"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("Dream Caused by the Flight of a Bee around a Pomegranate a Second Before Awakening")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, Artist.images); }
- Example using dynamic API:
public void createRelatedMediaExample() { DataService service = this.getService(); EntitySet artistsEntitySet = service.getEntitySet("Artists"); EntityType artistEntityType = artistsEntitySet.getEntityType(); Property firstNameProperty = artistEntityType.getProperty("firstName"); Property lastNameProperty = artistEntityType.getProperty("lastName"); Property dateOfBirthProperty = artistEntityType.getProperty("dateOfBirth"); Property placeOfBirthProperty = artistEntityType.getProperty("placeOfBirth"); Property imagesProperty = artistEntityType.getProperty("images"); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); EntityValue artist = EntityValue.ofType(artistEntityType); firstNameProperty.setString(artist, "Maurits"); lastNameProperty.setString(artist, "Escher"); dateOfBirthProperty.setValue(artist, LocalDate.of(1898, 6, 17)); placeOfBirthProperty.setValue(artist, GeographyPoint.withLatitudeLongitude(53.2d, 5.783333d)); service.createEntity(artist); EntityValue image = EntityValue.ofType(imageEntityType); labelProperty.setString(image, "Hands"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("Drawing Hands")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, imagesProperty); }
- Parameters:
entity- Entity to be created.content- Initial content.parent- Previously created parent entity.property- Parent's navigation property.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteByQuery
void deleteByQuery(@NonNull() @NotNull() DataQuery query)
- Parameters:
query- Query parameter.
-
deleteByQueryAsync
void deleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
query- Query parameter.
-
deleteByQueryAsync
void deleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
query- Query parameter.
-
deleteByQuery
void deleteByQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
query- Query parameter.headers- Headers parameter.
-
deleteByQueryAsync
void deleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
query- Query parameter.headers- Headers parameter.
-
deleteByQueryAsync
void deleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
query- Query parameter.headers- Headers parameter.
-
deleteByQuery
void deleteByQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute query to delete data from the target system.
- Parameters:
query- Data query specifying the information to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteByQueryAsync
void deleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute query to delete data from the target system.
- Parameters:
query- Data query specifying the information to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteByQueryAsync
void deleteByQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Execute query to delete data from the target system.
- Parameters:
query- Data query specifying the information to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteEntity
void deleteEntity(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.
-
deleteEntityAsync
void deleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.
-
deleteEntityAsync
void deleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.
-
deleteEntity
void deleteEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
deleteEntityAsync
void deleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
deleteEntityAsync
void deleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
deleteEntity
void deleteEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Delete an entity from the target system.
- Example using proxy classes:
public void deleteEntityExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1).selectKey() .filter(Customer.contactName.equal("William Riker")); Customer customer = service.getCustomer(query); service.deleteEntity(customer); }
- Example using dynamic API:
public void deleteEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery().top(1).selectKey().from(customersEntitySet) .filter(contactNameProperty.equal("William Riker")); EntityValue customer = service.executeQuery(query).getRequiredEntity(); service.deleteEntity(customer); }
- Parameters:
entity- Entity to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteEntityAsync
void deleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Delete an entity from the target system.
- Example using proxy classes:
public void deleteEntityExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1).selectKey() .filter(Customer.contactName.equal("William Riker")); Customer customer = service.getCustomer(query); service.deleteEntity(customer); }
- Example using dynamic API:
public void deleteEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery().top(1).selectKey().from(customersEntitySet) .filter(contactNameProperty.equal("William Riker")); EntityValue customer = service.executeQuery(query).getRequiredEntity(); service.deleteEntity(customer); }
- Parameters:
entity- Entity to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteEntityAsync
void deleteEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Delete an entity from the target system.
- Example using proxy classes:
public void deleteEntityExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1).selectKey() .filter(Customer.contactName.equal("William Riker")); Customer customer = service.getCustomer(query); service.deleteEntity(customer); }
- Example using dynamic API:
public void deleteEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery().top(1).selectKey().from(customersEntitySet) .filter(contactNameProperty.equal("William Riker")); EntityValue customer = service.executeQuery(query).getRequiredEntity(); service.deleteEntity(customer); }
- Parameters:
entity- Entity to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteLink
void deleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property)
- Parameters:
from- From parameter.property- Property parameter.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
from- From parameter.property- Property parameter.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.
-
deleteLink
void deleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
deleteLink
void deleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
deleteLink
void deleteLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Delete a link from a source entity to a target entity.
- Example using proxy classes:
public void deleteLinkExample1() { // Delete link from many-to-one relationship. NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(product, Product.supplier); }
- Example using proxy classes:
public void deleteLinkExample2() { // Delete link from one-to-many relationship. NorthwindService service = this.getService(); Category category = service.getCategory(new DataQuery().skip(1).top(1)); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(category, Category.products, product); }
- Example using dynamic API:
public void deleteLinkExample1() { // Delete link from many-to-one relationship. DataService service = this.getService(); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType productEntityType = productsEntitySet.getEntityType(); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.deleteLink(product, supplierProperty); }
- Example using dynamic API:
public void deleteLinkExample2() { // Delete link from one-to-many relationship. DataService service = this.getService(); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType categoryEntityType = categoriesEntitySet.getEntityType(); Property productsProperty = categoryEntityType.getProperty("Products"); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(1).top(1)) .getRequiredEntity(); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.deleteLink(category, productsProperty, product); }
- Parameters:
from- Source entity for the link to be deleted.property- Source navigation property for the link to be deleted.to- Target entity for the link to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Delete a link from a source entity to a target entity.
- Example using proxy classes:
public void deleteLinkExample1() { // Delete link from many-to-one relationship. NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(product, Product.supplier); }
- Example using proxy classes:
public void deleteLinkExample2() { // Delete link from one-to-many relationship. NorthwindService service = this.getService(); Category category = service.getCategory(new DataQuery().skip(1).top(1)); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(category, Category.products, product); }
- Example using dynamic API:
public void deleteLinkExample1() { // Delete link from many-to-one relationship. DataService service = this.getService(); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType productEntityType = productsEntitySet.getEntityType(); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.deleteLink(product, supplierProperty); }
- Example using dynamic API:
public void deleteLinkExample2() { // Delete link from one-to-many relationship. DataService service = this.getService(); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType categoryEntityType = categoriesEntitySet.getEntityType(); Property productsProperty = categoryEntityType.getProperty("Products"); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(1).top(1)) .getRequiredEntity(); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.deleteLink(category, productsProperty, product); }
- Parameters:
from- Source entity for the link to be deleted.property- Source navigation property for the link to be deleted.to- Target entity for the link to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteLinkAsync
void deleteLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Delete a link from a source entity to a target entity.
- Example using proxy classes:
public void deleteLinkExample1() { // Delete link from many-to-one relationship. NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(product, Product.supplier); }
- Example using proxy classes:
public void deleteLinkExample2() { // Delete link from one-to-many relationship. NorthwindService service = this.getService(); Category category = service.getCategory(new DataQuery().skip(1).top(1)); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(category, Category.products, product); }
- Example using dynamic API:
public void deleteLinkExample1() { // Delete link from many-to-one relationship. DataService service = this.getService(); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType productEntityType = productsEntitySet.getEntityType(); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.deleteLink(product, supplierProperty); }
- Example using dynamic API:
public void deleteLinkExample2() { // Delete link from one-to-many relationship. DataService service = this.getService(); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType categoryEntityType = categoriesEntitySet.getEntityType(); Property productsProperty = categoryEntityType.getProperty("Products"); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(1).top(1)) .getRequiredEntity(); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); service.deleteLink(category, productsProperty, product); }
- Parameters:
from- Source entity for the link to be deleted.property- Source navigation property for the link to be deleted.to- Target entity for the link to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteStream
void deleteStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link)
- Parameters:
entity- Entity parameter.link- Link parameter.
-
deleteStreamAsync
void deleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.
-
deleteStreamAsync
void deleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.
-
deleteStream
void deleteStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.link- Link parameter.headers- Headers parameter.
-
deleteStreamAsync
void deleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.link- Link parameter.headers- Headers parameter.
-
deleteStreamAsync
void deleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.headers- Headers parameter.
-
deleteStream
void deleteStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Delete the content of a stream property from the target system.
- Parameters:
entity- Entity containing the stream property whose content is to be deleted.link- Stream link for the stream to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteStreamAsync
void deleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Delete the content of a stream property from the target system.
- Parameters:
entity- Entity containing the stream property whose content is to be deleted.link- Stream link for the stream to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
deleteStreamAsync
void deleteStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Delete the content of a stream property from the target system.
- Parameters:
entity- Entity containing the stream property whose content is to be deleted.link- Stream link for the stream to be deleted.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
downloadMedia
@NonNull()@NotNull() ByteStream downloadMedia(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
downloadMediaAsync
void downloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
downloadMediaAsync
void downloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
downloadMedia
@NonNull()@NotNull() ByteStream downloadMedia(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
downloadMediaAsync
void downloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
downloadMediaAsync
void downloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
downloadMedia
@NonNull()@NotNull() ByteStream downloadMedia(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Obtain a stream for downloading the content of a media entity from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using ByteStream.readAndClose, may result in out-of-memory conditions on memory-constrained devices.
- Example using proxy classes:
public void downloadMediaExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Image.label.equal("Smiley")) .top(1); Image image = service.getImage(query); ByteStream stream = service.downloadMedia(image); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Example using dynamic API:
public void downloadMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); DataQuery query = new DataQuery().from(imagesEntitySet) .filter(labelProperty.equal("Smiley")).top(1); EntityValue image = service.executeQuery(query).getRequiredEntity(); ByteStream stream = service.downloadMedia(image); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Parameters:
entity- Entity whose content is to be downloaded.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
A stream for downloading the content of a media entity. This must be closed by the caller, or else a resource leak may occur.
-
downloadMediaAsync
void downloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Obtain a stream for downloading the content of a media entity from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using ByteStream.readAndClose, may result in out-of-memory conditions on memory-constrained devices.
- Example using proxy classes:
public void downloadMediaExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Image.label.equal("Smiley")) .top(1); Image image = service.getImage(query); ByteStream stream = service.downloadMedia(image); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Example using dynamic API:
public void downloadMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); DataQuery query = new DataQuery().from(imagesEntitySet) .filter(labelProperty.equal("Smiley")).top(1); EntityValue image = service.executeQuery(query).getRequiredEntity(); ByteStream stream = service.downloadMedia(image); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Parameters:
entity- Entity whose content is to be downloaded.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
A stream for downloading the content of a media entity. This must be closed by the caller, or else a resource leak may occur.
-
downloadMediaAsync
void downloadMediaAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)
Obtain a stream for downloading the content of a media entity from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using ByteStream.readAndClose, may result in out-of-memory conditions on memory-constrained devices.
- Example using proxy classes:
public void downloadMediaExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Image.label.equal("Smiley")) .top(1); Image image = service.getImage(query); ByteStream stream = service.downloadMedia(image); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Example using dynamic API:
public void downloadMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); DataQuery query = new DataQuery().from(imagesEntitySet) .filter(labelProperty.equal("Smiley")).top(1); EntityValue image = service.executeQuery(query).getRequiredEntity(); ByteStream stream = service.downloadMedia(image); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Parameters:
entity- Entity whose content is to be downloaded.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
A stream for downloading the content of a media entity. This must be closed by the caller, or else a resource leak may occur.
-
downloadStream
@NonNull()@NotNull() ByteStream downloadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link)
- Parameters:
entity- Entity parameter.link- Link parameter.- Returns:
(see linked method).
-
downloadStreamAsync
void downloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.- Returns:
(see linked method).
-
downloadStreamAsync
void downloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.- Returns:
(see linked method).
-
downloadStream
@NonNull()@NotNull() ByteStream downloadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.link- Link parameter.headers- Headers parameter.- Returns:
(see linked method).
-
downloadStreamAsync
void downloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.link- Link parameter.headers- Headers parameter.- Returns:
(see linked method).
-
downloadStreamAsync
void downloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.headers- Headers parameter.- Returns:
(see linked method).
-
downloadStream
@NonNull()@NotNull() ByteStream downloadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Obtain a stream for downloading the content of a stream property from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using ByteStream.readAndClose, may result in out-of-memory conditions on memory-constrained devices.
- See Also:
- Example using proxy classes:
public void downloadStreamExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Video.label.equal("Happier")) .top(1); Video video = service.getVideo(query); ByteStream stream = service.downloadStream(video, video.getContent()); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary("happy-stuff")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Example using dynamic API:
public void downloadStreamExample() { DataService service = this.getService(); EntitySet videosEntitySet = service.getEntitySet("Videos"); EntityType videoEntityType = videosEntitySet.getEntityType(); Property labelProperty = videoEntityType.getProperty("label"); Property contentProperty = videoEntityType.getProperty("content"); DataQuery query = new DataQuery().from(videosEntitySet) .filter(labelProperty.equal("Happier")).top(1); EntityValue video = service.executeQuery(query).getRequiredEntity(); StreamLink link = contentProperty.getStreamLink(video); ByteStream stream = service.downloadStream(video, link); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary("...")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Parameters:
entity- Entity containing the stream property whose content is to be downloaded.link- Stream link for the stream to be downloaded.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
A stream for downloading the content of a stream property. This must be closed by the caller, or else a resource leak may occur.
-
downloadStreamAsync
void downloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() Action1<Array<byte>> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Obtain a stream for downloading the content of a stream property from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using ByteStream.readAndClose, may result in out-of-memory conditions on memory-constrained devices.
- See Also:
- Example using proxy classes:
public void downloadStreamExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Video.label.equal("Happier")) .top(1); Video video = service.getVideo(query); ByteStream stream = service.downloadStream(video, video.getContent()); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary("happy-stuff")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Example using dynamic API:
public void downloadStreamExample() { DataService service = this.getService(); EntitySet videosEntitySet = service.getEntitySet("Videos"); EntityType videoEntityType = videosEntitySet.getEntityType(); Property labelProperty = videoEntityType.getProperty("label"); Property contentProperty = videoEntityType.getProperty("content"); DataQuery query = new DataQuery().from(videosEntitySet) .filter(labelProperty.equal("Happier")).top(1); EntityValue video = service.executeQuery(query).getRequiredEntity(); StreamLink link = contentProperty.getStreamLink(video); ByteStream stream = service.downloadStream(video, link); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary("...")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Parameters:
entity- Entity containing the stream property whose content is to be downloaded.link- Stream link for the stream to be downloaded.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
A stream for downloading the content of a stream property. This must be closed by the caller, or else a resource leak may occur.
-
downloadStreamAsync
void downloadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Array<byte>> resultHandler)
Obtain a stream for downloading the content of a stream property from the target system. Caution: streams are often used for large content that may not fit (all at once) in available application memory. Having too many threads simultaneously downloading streams, or using ByteStream.readAndClose, may result in out-of-memory conditions on memory-constrained devices.
- See Also:
- Example using proxy classes:
public void downloadStreamExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Video.label.equal("Happier")) .top(1); Video video = service.getVideo(query); ByteStream stream = service.downloadStream(video, video.getContent()); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary("happy-stuff")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Example using dynamic API:
public void downloadStreamExample() { DataService service = this.getService(); EntitySet videosEntitySet = service.getEntitySet("Videos"); EntityType videoEntityType = videosEntitySet.getEntityType(); Property labelProperty = videoEntityType.getProperty("label"); Property contentProperty = videoEntityType.getProperty("content"); DataQuery query = new DataQuery().from(videosEntitySet) .filter(labelProperty.equal("Happier")).top(1); EntityValue video = service.executeQuery(query).getRequiredEntity(); StreamLink link = contentProperty.getStreamLink(video); ByteStream stream = service.downloadStream(video, link); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.cloud.mobile.odata.core.StringFunction.toBinary("...")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); }
- Parameters:
entity- Entity containing the stream property whose content is to be downloaded.link- Stream link for the stream to be downloaded.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
A stream for downloading the content of a stream property. This must be closed by the caller, or else a resource leak may occur.
-
executeMethod
@Nullable()@Nullable() DataValue executeMethod(@NonNull() @NotNull() DataMethod method)
- Parameters:
method- Method parameter.- Returns:
(see linked method).
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
method- Method parameter.- Returns:
(see linked method).
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)
- Parameters:
method- Method parameter.- Returns:
(see linked method).
-
executeMethod
@Nullable()@Nullable() DataValue executeMethod(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters)
- Parameters:
method- Method parameter.parameters- Parameters parameter.- Returns:
(see linked method).
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
method- Method parameter.parameters- Parameters parameter.- Returns:
(see linked method).
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)
- Parameters:
method- Method parameter.parameters- Parameters parameter.- Returns:
(see linked method).
-
executeMethod
@Nullable()@Nullable() DataValue executeMethod(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
method- Method parameter.parameters- Parameters parameter.headers- Headers parameter.- Returns:
(see linked method).
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
method- Method parameter.parameters- Parameters parameter.headers- Headers parameter.- Returns:
(see linked method).
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)
- Parameters:
method- Method parameter.parameters- Parameters parameter.headers- Headers parameter.- Returns:
(see linked method).
-
executeMethod
@Nullable()@Nullable() DataValue executeMethod(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute a data method (action or function) in the target system. Actions may have backend side-effects. Functions should not have backend side-effects.
- Parameters:
method- Data method.parameters- Method parameters.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
(nullable) The method result, or
nullif the method has no result.
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @NonNull() @NotNull() Action1<DataValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute a data method (action or function) in the target system. Actions may have backend side-effects. Functions should not have backend side-effects.
- Parameters:
method- Data method.parameters- Method parameters.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
(nullable) The method result, or
nullif the method has no result.
-
executeMethodAsync
void executeMethodAsync(@NonNull() @NotNull() DataMethod method, @NonNull() @NotNull() ParameterList parameters, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<DataValue> resultHandler)
Execute a data method (action or function) in the target system. Actions may have backend side-effects. Functions should not have backend side-effects.
- Parameters:
method- Data method.parameters- Method parameters.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
(nullable) The method result, or
nullif the method has no result.
-
executeQuery
@NonNull()@NotNull() QueryResult executeQuery(@NonNull() @NotNull() DataQuery query)
- Parameters:
query- Query parameter.- Returns:
(see linked method).
-
executeQueryAsync
void executeQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action1<QueryResult> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
query- Query parameter.- Returns:
(see linked method).
-
executeQueryAsync
void executeQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<QueryResult> resultHandler)
- Parameters:
query- Query parameter.- Returns:
(see linked method).
-
executeQuery
@NonNull()@NotNull() QueryResult executeQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
query- Query parameter.headers- Headers parameter.- Returns:
(see linked method).
-
executeQueryAsync
void executeQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action1<QueryResult> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
query- Query parameter.headers- Headers parameter.- Returns:
(see linked method).
-
executeQueryAsync
void executeQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<QueryResult> resultHandler)
- Parameters:
query- Query parameter.headers- Headers parameter.- Returns:
(see linked method).
-
executeQuery
@NonNull()@NotNull() QueryResult executeQuery(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute a data query to get data from the target system.
- Parameters:
query- Data query specifying the information to be returned.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
The query result.
-
executeQueryAsync
void executeQueryAsync(@NonNull() @NotNull() DataQuery query, @NonNull() @NotNull() Action1<QueryResult> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute a data query to get data from the target system.
- Parameters:
query- Data query specifying the information to be returned.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
The query result.
-
executeQueryAsync
void executeQueryAsync(@NonNull() @NotNull() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<QueryResult> resultHandler)
Execute a data query to get data from the target system.
- Parameters:
query- Data query specifying the information to be returned.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
The query result.
-
fetchMetadata
@NonNull()@NotNull() CsdlDocument fetchMetadata()
- Returns:
(see linked method).
-
fetchMetadataAsync
void fetchMetadataAsync(@NonNull() @NotNull() Action1<CsdlDocument> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Returns:
(see linked method).
-
fetchMetadataAsync
void fetchMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<CsdlDocument> resultHandler)
- Returns:
(see linked method).
-
fetchMetadata
@NonNull()@NotNull() CsdlDocument fetchMetadata(@Nullable() @Nullable() HttpHeaders headers)
- Parameters:
headers- Headers parameter.- Returns:
(see linked method).
-
fetchMetadataAsync
void fetchMetadataAsync(@NonNull() @NotNull() Action1<CsdlDocument> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
headers- Headers parameter.- Returns:
(see linked method).
-
fetchMetadataAsync
void fetchMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<CsdlDocument> resultHandler)
- Parameters:
headers- Headers parameter.- Returns:
(see linked method).
-
fetchMetadata
@NonNull()@NotNull() CsdlDocument fetchMetadata(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Fetch latest service metadata and return it, but don't change the DataService.metadata property.
- See Also:
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
Latest service metadata.
-
fetchMetadataAsync
void fetchMetadataAsync(@NonNull() @NotNull() Action1<CsdlDocument> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Fetch latest service metadata and return it, but don't change the DataService.metadata property.
- See Also:
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
Latest service metadata.
-
fetchMetadataAsync
void fetchMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<CsdlDocument> resultHandler)
Fetch latest service metadata and return it, but don't change the DataService.metadata property.
- See Also:
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.- Returns:
Latest service metadata.
-
getDataMethod
@NonNull()@NotNull() DataMethod getDataMethod(@NonNull() @NotNull() String name)
Lookup a data method by qualified name (for function/action definitions) or by unqualified name (for function/action imports). If the data method does not exist it indicates a fundamental implementation problem, therefore a non-catchable
FatalExceptionwill be thrown, and the app intentionally crashes. The reason behind this drastic behaviour is to avoid mismatch between server and client. It is still possible to avoid theFatalExceptionby looking up data methods before calling this function like in the following code snippet:- Example checking if a data method exists:
public void checkDataMethodExistsExample() { DataService service = this.getService(); com.sap.cloud.mobile.odata.csdl.CsdlDocument csdlDocument = service.getMetadata(); if (csdlDocument.getDataMethods() .has("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person.UpdatePersonLastName")) { Ignore.valueOf_any(service.getDataMethod("Microsoft.OData.Service.Sample.TrippinInMemory.Models.Person.UpdatePersonLastName")); } else { // The data method UpdatePersonLastName does not exists, add logic to handle the issue/throw an Exception, etc.. } }
- See Also:
DataService.metadata.
dataMethods, for looking up data methods that might not exist.
- Parameters:
name- Name of the data method to be returned.- Returns:
The data method, which must exist.
-
getEntitySet
@NonNull()@NotNull() EntitySet getEntitySet(@NonNull() @NotNull() String name)
Lookup an entity set (or singleton entity) by name. If the entity set does not exist it indicates a fundamental implementation problem, therefore a non-catchable
FatalExceptionwill be thrown, and the app intentionally crashes. The reason behind this drastic behaviour is to avoid mismatch between server and client. It is still possible to avoid theFatalExceptionby looking up entity sets before calling this method like in the following code snippet: Note that OData singleton entities are represented by entity sets where EntitySet.isSingleton istrue.- Example checking if an entity set exists:
public void checkEntitySetExistsExample() { DataService service = this.getService(); if (service.getMetadata().getEntitySets().has("Categories")) { Ignore.valueOf_any(service.getEntitySet("Categories")); } else { // The entity set Categories does not exists, add logic to handle the issue/throw an Exception, etc.. } }
- See Also:
DataService.metadata.
entitySets, for looking up entity sets that might not exist.
- Parameters:
name- Name of the entity set to be returned.- Returns:
The entity set, which must exist.
-
getMetadata
@NonNull()@NotNull() CsdlDocument getMetadata()
Return service metadata.
- See Also:
- Returns:
Service metadata.
-
getMetadataLock
@NonNull()@NotNull() MetadataLock getMetadataLock()
Return a readers/writer lock that can be used to prevent readers from using the data service while the DataService.metadata is being refreshed.
- See Also:
- Returns:
A readers/writer lock that can be used to prevent readers from using the data service while the DataService.metadata is being refreshed.
-
getName
@NonNull()@NotNull() String getName()
Return service name.
- Returns:
Service name.
-
getProvider
@NonNull()@NotNull() DataServiceProvider getProvider()
Return the data service provider.
- Returns:
The data service provider.
-
hasMetadata
boolean hasMetadata()
Return has service metadata been loaded.
- See Also:
- Returns:
Has service metadata been loaded.
-
isClientRegistered
boolean isClientRegistered()
Checks locally whether a previous DataService.registerClient call successfuly created a client registration for the remote OData service.
- Returns:
trueif a registration was already established.
-
loadEntity
void loadEntity(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.
-
loadEntity
void loadEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query)
- Parameters:
entity- Entity parameter.query- Query parameter.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.query- Query parameter.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.query- Query parameter.
-
loadEntity
void loadEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers)
- Parameters:
entity- Entity parameter.query- Query parameter.headers- Headers parameter.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers)
- Parameters:
entity- Entity parameter.query- Query parameter.headers- Headers parameter.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.query- Query parameter.headers- Headers parameter.
-
loadEntity
void loadEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)
Reload an existing entity from the target system.
- Example using proxy classes:
public void loadEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCustomerID("ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
- Example using dynamic API:
public void loadEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); EntityValue customer = EntityValue.ofType(customerEntityType); customerIDProperty.setString(customer, "ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
- Parameters:
entity- Previously loaded entity, whose properties will be modified to reflect the loaded state.query- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).headers- Optional request-specific headers.options- Optional request-specific options.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)
Reload an existing entity from the target system.
- Example using proxy classes:
public void loadEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCustomerID("ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
- Example using dynamic API:
public void loadEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); EntityValue customer = EntityValue.ofType(customerEntityType); customerIDProperty.setString(customer, "ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
- Parameters:
entity- Previously loaded entity, whose properties will be modified to reflect the loaded state.query- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).headers- Optional request-specific headers.options- Optional request-specific options.
-
loadEntityAsync
void loadEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Reload an existing entity from the target system.
- Example using proxy classes:
public void loadEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCustomerID("ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
- Example using dynamic API:
public void loadEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); EntityValue customer = EntityValue.ofType(customerEntityType); customerIDProperty.setString(customer, "ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
- Parameters:
entity- Previously loaded entity, whose properties will be modified to reflect the loaded state.query- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).headers- Optional request-specific headers.options- Optional request-specific options.
-
loadMetadata
void loadMetadata()
-
loadMetadataAsync
void loadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
-
loadMetadataAsync
void loadMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
-
loadMetadata
void loadMetadata(@Nullable() @Nullable() HttpHeaders headers)
- Parameters:
headers- Headers parameter.
-
loadMetadataAsync
void loadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
headers- Headers parameter.
-
loadMetadataAsync
void loadMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
headers- Headers parameter.
-
loadMetadata
void loadMetadata(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Load service metadata into DataService.provider (if not already loaded).
- See Also:
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
loadMetadataAsync
void loadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Load service metadata into DataService.provider (if not already loaded).
- See Also:
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
loadMetadataAsync
void loadMetadataAsync(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Load service metadata into DataService.provider (if not already loaded).
- See Also:
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
loadProperty
void loadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into)
- Parameters:
property- Property parameter.into- Into parameter.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
property- Property parameter.into- Into parameter.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
property- Property parameter.into- Into parameter.
-
loadProperty
void loadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query)
- Parameters:
property- Property parameter.into- Into parameter.query- Query parameter.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
property- Property parameter.into- Into parameter.query- Query parameter.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
property- Property parameter.into- Into parameter.query- Query parameter.
-
loadProperty
void loadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
property- Property parameter.into- Into parameter.query- Query parameter.headers- Headers parameter.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
property- Property parameter.into- Into parameter.query- Query parameter.headers- Headers parameter.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
property- Property parameter.into- Into parameter.query- Query parameter.headers- Headers parameter.
-
loadProperty
void loadProperty(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Load the value of a property into an existing entity. This can be applied to both structural and navigation properties.
- Example using proxy classes:
public void loadPropertyExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .filter(Customer.customerID.equal("ALFKI") .or(Customer.customerID.equal("ANATR"))); com.sap.cloud.mobile.odata.http.HttpHeaders responseHeaders = new com.sap.cloud.mobile.odata.http.HttpHeaders(); RequestOptions requestOptions = new RequestOptions(); requestOptions.setCaptureResponseHeaders(responseHeaders); List<Customer> customers = service.getCustomers(query, null, requestOptions); int countOrders = 0; for (Customer customer : customers) { this.showCustomer(customer); service.loadProperty(Customer.orders, customer); List<Order> orders = customer.getOrders(); for (Order order : orders) { int orderID = order.getOrderID(); Example.show(" Order ", Example.formatInt(orderID)); countOrders++; } } assert countOrders > 0; assert this.checkContentTypeJson(responseHeaders); }
- Example using proxy classes (in request batch):
public void loadPropertyInBatchExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .filter(Customer.customerID.equal("ALFKI") .or(Customer.customerID.equal("ANATR"))); List<Customer> customers = service.getCustomers(query); Customer customer1 = customers.get(0); Customer customer2 = customers.get(1); DataQuery query1 = new DataQuery().load(customer1, Customer.orders); DataQuery query2 = new DataQuery().load(customer2, Customer.orders); com.sap.cloud.mobile.odata.http.HttpHeaders secondResponseHeaders = new com.sap.cloud.mobile.odata.http.HttpHeaders(); RequestOptions secondRequestOptions = new RequestOptions(); secondRequestOptions.setCaptureResponseHeaders(secondResponseHeaders); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2, null, secondRequestOptions); service.processBatch(batch); QueryResult result1 = batch.getQueryResult(query1); QueryResult result2 = batch.getQueryResult(query2); List<Order> orders1 = Order.list(result1.getEntityList()); List<Order> orders2 = Order.list(result2.getEntityList()); assert orders1.size() != 0; assert orders2.size() != 0; customer1.setOrders(orders1); customer2.setOrders(orders2); assert this.checkContentTypeJson(secondResponseHeaders); }
- Example using dynamic API:
public void loadPropertyExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); Property ordersProperty = customerEntityType.getProperty("Orders"); Property orderIDProperty = ordersProperty.getItemEntityType() .getProperty("OrderID"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet) .filter(customerIDProperty.equal("ALFKI") .or(customerIDProperty.equal("ANATR"))); EntityValueList customers = service.executeQuery(query).getEntityList(); int countOrders = 0; for (EntityValue customer : customers) { this.showCustomer(customer); service.loadProperty(ordersProperty, customer); EntityValueList orders = ordersProperty.getEntityList(customer); for (EntityValue order : orders) { int orderID = orderIDProperty.getInt(order); Example.show(" Order ", Example.formatInt(orderID)); countOrders++; } } assert countOrders > 0; }
- Example using dynamic API (in request batch):
public void loadPropertyInBatchExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); Property ordersProperty = customerEntityType.getProperty("Orders"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet) .filter(customerIDProperty.equal("ALFKI") .or(customerIDProperty.equal("ANATR"))); EntityValueList customers = service.executeQuery(query).getEntityList(); EntityValue customer1 = customers.get(0); EntityValue customer2 = customers.get(1); DataQuery query1 = new DataQuery().load(customer1, ordersProperty); DataQuery query2 = new DataQuery().load(customer2, ordersProperty); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2); service.processBatch(batch); QueryResult result1 = batch.getQueryResult(query1); QueryResult result2 = batch.getQueryResult(query2); EntityValueList orders1 = result1.getEntityList(); EntityValueList orders2 = result2.getEntityList(); assert orders1.length() != 0; assert orders2.length() != 0; ordersProperty.setEntityList(customer1, orders1); ordersProperty.setEntityList(customer2, orders2); }
- See Also:
- Parameters:
property- Property to load.into- Existing entity.query- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Load the value of a property into an existing entity. This can be applied to both structural and navigation properties.
- Example using proxy classes:
public void loadPropertyExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .filter(Customer.customerID.equal("ALFKI") .or(Customer.customerID.equal("ANATR"))); com.sap.cloud.mobile.odata.http.HttpHeaders responseHeaders = new com.sap.cloud.mobile.odata.http.HttpHeaders(); RequestOptions requestOptions = new RequestOptions(); requestOptions.setCaptureResponseHeaders(responseHeaders); List<Customer> customers = service.getCustomers(query, null, requestOptions); int countOrders = 0; for (Customer customer : customers) { this.showCustomer(customer); service.loadProperty(Customer.orders, customer); List<Order> orders = customer.getOrders(); for (Order order : orders) { int orderID = order.getOrderID(); Example.show(" Order ", Example.formatInt(orderID)); countOrders++; } } assert countOrders > 0; assert this.checkContentTypeJson(responseHeaders); }
- Example using proxy classes (in request batch):
public void loadPropertyInBatchExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .filter(Customer.customerID.equal("ALFKI") .or(Customer.customerID.equal("ANATR"))); List<Customer> customers = service.getCustomers(query); Customer customer1 = customers.get(0); Customer customer2 = customers.get(1); DataQuery query1 = new DataQuery().load(customer1, Customer.orders); DataQuery query2 = new DataQuery().load(customer2, Customer.orders); com.sap.cloud.mobile.odata.http.HttpHeaders secondResponseHeaders = new com.sap.cloud.mobile.odata.http.HttpHeaders(); RequestOptions secondRequestOptions = new RequestOptions(); secondRequestOptions.setCaptureResponseHeaders(secondResponseHeaders); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2, null, secondRequestOptions); service.processBatch(batch); QueryResult result1 = batch.getQueryResult(query1); QueryResult result2 = batch.getQueryResult(query2); List<Order> orders1 = Order.list(result1.getEntityList()); List<Order> orders2 = Order.list(result2.getEntityList()); assert orders1.size() != 0; assert orders2.size() != 0; customer1.setOrders(orders1); customer2.setOrders(orders2); assert this.checkContentTypeJson(secondResponseHeaders); }
- Example using dynamic API:
public void loadPropertyExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); Property ordersProperty = customerEntityType.getProperty("Orders"); Property orderIDProperty = ordersProperty.getItemEntityType() .getProperty("OrderID"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet) .filter(customerIDProperty.equal("ALFKI") .or(customerIDProperty.equal("ANATR"))); EntityValueList customers = service.executeQuery(query).getEntityList(); int countOrders = 0; for (EntityValue customer : customers) { this.showCustomer(customer); service.loadProperty(ordersProperty, customer); EntityValueList orders = ordersProperty.getEntityList(customer); for (EntityValue order : orders) { int orderID = orderIDProperty.getInt(order); Example.show(" Order ", Example.formatInt(orderID)); countOrders++; } } assert countOrders > 0; }
- Example using dynamic API (in request batch):
public void loadPropertyInBatchExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); Property ordersProperty = customerEntityType.getProperty("Orders"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet) .filter(customerIDProperty.equal("ALFKI") .or(customerIDProperty.equal("ANATR"))); EntityValueList customers = service.executeQuery(query).getEntityList(); EntityValue customer1 = customers.get(0); EntityValue customer2 = customers.get(1); DataQuery query1 = new DataQuery().load(customer1, ordersProperty); DataQuery query2 = new DataQuery().load(customer2, ordersProperty); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2); service.processBatch(batch); QueryResult result1 = batch.getQueryResult(query1); QueryResult result2 = batch.getQueryResult(query2); EntityValueList orders1 = result1.getEntityList(); EntityValueList orders2 = result2.getEntityList(); assert orders1.length() != 0; assert orders2.length() != 0; ordersProperty.setEntityList(customer1, orders1); ordersProperty.setEntityList(customer2, orders2); }
- See Also:
- Parameters:
property- Property to load.into- Existing entity.query- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
loadPropertyAsync
void loadPropertyAsync(@NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue into, @Nullable() @Nullable() DataQuery query, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Load the value of a property into an existing entity. This can be applied to both structural and navigation properties.
- Example using proxy classes:
public void loadPropertyExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .filter(Customer.customerID.equal("ALFKI") .or(Customer.customerID.equal("ANATR"))); com.sap.cloud.mobile.odata.http.HttpHeaders responseHeaders = new com.sap.cloud.mobile.odata.http.HttpHeaders(); RequestOptions requestOptions = new RequestOptions(); requestOptions.setCaptureResponseHeaders(responseHeaders); List<Customer> customers = service.getCustomers(query, null, requestOptions); int countOrders = 0; for (Customer customer : customers) { this.showCustomer(customer); service.loadProperty(Customer.orders, customer); List<Order> orders = customer.getOrders(); for (Order order : orders) { int orderID = order.getOrderID(); Example.show(" Order ", Example.formatInt(orderID)); countOrders++; } } assert countOrders > 0; assert this.checkContentTypeJson(responseHeaders); }
- Example using proxy classes (in request batch):
public void loadPropertyInBatchExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery() .select(Customer.customerID, Customer.companyName, Customer.contactName) .filter(Customer.customerID.equal("ALFKI") .or(Customer.customerID.equal("ANATR"))); List<Customer> customers = service.getCustomers(query); Customer customer1 = customers.get(0); Customer customer2 = customers.get(1); DataQuery query1 = new DataQuery().load(customer1, Customer.orders); DataQuery query2 = new DataQuery().load(customer2, Customer.orders); com.sap.cloud.mobile.odata.http.HttpHeaders secondResponseHeaders = new com.sap.cloud.mobile.odata.http.HttpHeaders(); RequestOptions secondRequestOptions = new RequestOptions(); secondRequestOptions.setCaptureResponseHeaders(secondResponseHeaders); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2, null, secondRequestOptions); service.processBatch(batch); QueryResult result1 = batch.getQueryResult(query1); QueryResult result2 = batch.getQueryResult(query2); List<Order> orders1 = Order.list(result1.getEntityList()); List<Order> orders2 = Order.list(result2.getEntityList()); assert orders1.size() != 0; assert orders2.size() != 0; customer1.setOrders(orders1); customer2.setOrders(orders2); assert this.checkContentTypeJson(secondResponseHeaders); }
- Example using dynamic API:
public void loadPropertyExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); Property ordersProperty = customerEntityType.getProperty("Orders"); Property orderIDProperty = ordersProperty.getItemEntityType() .getProperty("OrderID"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet) .filter(customerIDProperty.equal("ALFKI") .or(customerIDProperty.equal("ANATR"))); EntityValueList customers = service.executeQuery(query).getEntityList(); int countOrders = 0; for (EntityValue customer : customers) { this.showCustomer(customer); service.loadProperty(ordersProperty, customer); EntityValueList orders = ordersProperty.getEntityList(customer); for (EntityValue order : orders) { int orderID = orderIDProperty.getInt(order); Example.show(" Order ", Example.formatInt(orderID)); countOrders++; } } assert countOrders > 0; }
- Example using dynamic API (in request batch):
public void loadPropertyInBatchExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property customerIDProperty = customerEntityType.getProperty("CustomerID"); Property companyNameProperty = customerEntityType.getProperty("CompanyName"); Property contactNameProperty = customerEntityType.getProperty("ContactName"); Property ordersProperty = customerEntityType.getProperty("Orders"); DataQuery query = new DataQuery() .select(customerIDProperty, companyNameProperty, contactNameProperty) .from(customersEntitySet) .filter(customerIDProperty.equal("ALFKI") .or(customerIDProperty.equal("ANATR"))); EntityValueList customers = service.executeQuery(query).getEntityList(); EntityValue customer1 = customers.get(0); EntityValue customer2 = customers.get(1); DataQuery query1 = new DataQuery().load(customer1, ordersProperty); DataQuery query2 = new DataQuery().load(customer2, ordersProperty); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2); service.processBatch(batch); QueryResult result1 = batch.getQueryResult(query1); QueryResult result2 = batch.getQueryResult(query2); EntityValueList orders1 = result1.getEntityList(); EntityValueList orders2 = result2.getEntityList(); assert orders1.length() != 0; assert orders2.length() != 0; ordersProperty.setEntityList(customer1, orders1); ordersProperty.setEntityList(customer2, orders2); }
- See Also:
- Parameters:
property- Property to load.into- Existing entity.query- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
makeDraftCopy
@NonNull()@NotNull() EntityValue makeDraftCopy(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
makeDraftCopyAsync
void makeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
makeDraftCopyAsync
void makeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)
- Parameters:
entity- Entity parameter.- Returns:
(see linked method).
-
makeDraftCopy
@NonNull()@NotNull() EntityValue makeDraftCopy(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
makeDraftCopyAsync
void makeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
makeDraftCopyAsync
void makeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.- Returns:
(see linked method).
-
makeDraftCopy
@NonNull()@NotNull() EntityValue makeDraftCopy(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)
Create a draft copy of an entity. If the draft copy is intended to be subsequently activated to update (edit) the original entity, use EntityValue.forUpdate or EntityValue.forDeepUpdate to indicate this. If the draft copy is intended to be subsequently activated to create a clone of the original entity, use EntityValue.forCreate or EntityValue.forDeepCreate to indicate this.
- See Also:
DataService.activateDraft, EntityValue.forCreate, EntityValue.forUpdate, EntityValue.forDeepCreate, EntityValue.forDeepUpdate.
- Example using proxy classes:
public void makeDraftCopyExample() { HealthService service = this.getHealthService(); Patient patient = this.selectPatient(); patient = ((Patient)service.makeDraftCopy(patient.forDeepUpdate(Patient.appointments))); patient.setAddress("221B Baker Street"); service.updateEntity(patient); service.loadProperty(Patient.appointments, patient); for (Appointment appointment : patient.getAppointments()) { appointment.setDateTime(appointment.getDateTime().plusDays(7)); service.updateEntity(appointment); } // Some time later... Activate the draft copy of patient (and related appointments). patient = ((Patient)service.activateDraft(patient.withDeepUpdate(Patient.appointments))); // Some time later... Upload the update of patient (and deep-updated appointments). service.upload(); }
- Parameters:
entity- Original entity.headers- Optional request-specific headers.options- Optional request-specific options.- Returns:
Newly created draft copy of the original entity.
-
makeDraftCopyAsync
void makeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action1<EntityValue> successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)
Create a draft copy of an entity. If the draft copy is intended to be subsequently activated to update (edit) the original entity, use EntityValue.forUpdate or EntityValue.forDeepUpdate to indicate this. If the draft copy is intended to be subsequently activated to create a clone of the original entity, use EntityValue.forCreate or EntityValue.forDeepCreate to indicate this.
- See Also:
DataService.activateDraft, EntityValue.forCreate, EntityValue.forUpdate, EntityValue.forDeepCreate, EntityValue.forDeepUpdate.
- Example using proxy classes:
public void makeDraftCopyExample() { HealthService service = this.getHealthService(); Patient patient = this.selectPatient(); patient = ((Patient)service.makeDraftCopy(patient.forDeepUpdate(Patient.appointments))); patient.setAddress("221B Baker Street"); service.updateEntity(patient); service.loadProperty(Patient.appointments, patient); for (Appointment appointment : patient.getAppointments()) { appointment.setDateTime(appointment.getDateTime().plusDays(7)); service.updateEntity(appointment); } // Some time later... Activate the draft copy of patient (and related appointments). patient = ((Patient)service.activateDraft(patient.withDeepUpdate(Patient.appointments))); // Some time later... Upload the update of patient (and deep-updated appointments). service.upload(); }
- Parameters:
entity- Original entity.headers- Optional request-specific headers.options- Optional request-specific options.- Returns:
Newly created draft copy of the original entity.
-
makeDraftCopyAsync
void makeDraftCopyAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<EntityValue> resultHandler)
Create a draft copy of an entity. If the draft copy is intended to be subsequently activated to update (edit) the original entity, use EntityValue.forUpdate or EntityValue.forDeepUpdate to indicate this. If the draft copy is intended to be subsequently activated to create a clone of the original entity, use EntityValue.forCreate or EntityValue.forDeepCreate to indicate this.
- See Also:
DataService.activateDraft, EntityValue.forCreate, EntityValue.forUpdate, EntityValue.forDeepCreate, EntityValue.forDeepUpdate.
- Example using proxy classes:
public void makeDraftCopyExample() { HealthService service = this.getHealthService(); Patient patient = this.selectPatient(); patient = ((Patient)service.makeDraftCopy(patient.forDeepUpdate(Patient.appointments))); patient.setAddress("221B Baker Street"); service.updateEntity(patient); service.loadProperty(Patient.appointments, patient); for (Appointment appointment : patient.getAppointments()) { appointment.setDateTime(appointment.getDateTime().plusDays(7)); service.updateEntity(appointment); } // Some time later... Activate the draft copy of patient (and related appointments). patient = ((Patient)service.activateDraft(patient.withDeepUpdate(Patient.appointments))); // Some time later... Upload the update of patient (and deep-updated appointments). service.upload(); }
- Parameters:
entity- Original entity.headers- Optional request-specific headers.options- Optional request-specific options.- Returns:
Newly created draft copy of the original entity.
-
pingServer
void pingServer()
-
pingServerAsync
void pingServerAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
-
pingServerAsync
void pingServerAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
-
pingServer
void pingServer(@Nullable() @Nullable() HttpHeaders headers)
- Parameters:
headers- Headers parameter.
-
pingServerAsync
void pingServerAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
headers- Headers parameter.
-
pingServerAsync
void pingServerAsync(@Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
headers- Headers parameter.
-
pingServer
void pingServer(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Ping the server.
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
pingServerAsync
void pingServerAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Ping the server.
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
pingServerAsync
void pingServerAsync(@Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Ping the server.
- Parameters:
headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
processBatch
void processBatch(@NonNull() @NotNull() RequestBatch batch)
- Parameters:
batch- Batch parameter.
-
processBatchAsync
void processBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
batch- Batch parameter.
-
processBatchAsync
void processBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
batch- Batch parameter.
-
processBatch
void processBatch(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
batch- Batch parameter.headers- Headers parameter.
-
processBatchAsync
void processBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
batch- Batch parameter.headers- Headers parameter.
-
processBatchAsync
void processBatchAsync(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
batch- Batch parameter.headers- Headers parameter.
-
processBatch
void processBatch(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute a request batch in the target system.
- See Also:
- Example using proxy classes:
public void processBatchExample() { NorthwindService service = this.getService(); Supplier supplier1 = service.getSupplier(new DataQuery().top(1)); Supplier supplier2 = supplier1.copy(); Supplier supplier3 = supplier1.copy(); Supplier supplier4 = supplier1.copy(); supplier2.setCompanyName("Alpha Inc."); supplier3.setCompanyName("Beta Inc."); service.createEntity(supplier2); service.createEntity(supplier3); supplier3.setCompanyName("Gamma Inc."); Product product1 = service.getProduct(new DataQuery().top(1)); Product product2 = product1.copy(); product2.setProductName("Delta Cake"); RequestBatch batch = new RequestBatch(); ChangeSet changes = new ChangeSet(); changes.createEntity(supplier4); changes.updateEntity(supplier3); changes.deleteEntity(supplier2); changes.createEntity(product2); changes.createLink(product2, Product.supplier, supplier4); changes.updateLink(product2, Product.supplier, supplier3); changes.deleteLink(product2, Product.supplier, supplier3); DataQuery query = new DataQuery() .from(NorthwindServiceMetadata.EntitySets.suppliers); batch.addChanges(changes); batch.addQuery(query); service.processBatch(batch); List<Supplier> suppliers = Supplier.list(batch.getQueryResult(query) .getEntityList()); Example.show("There are now ", Example.formatInt(suppliers.size()), " suppliers."); }
- Example using dynamic API:
public void processBatchExample() { DataService service = this.getService(); EntitySet suppliersEntitySet = service.getEntitySet("Suppliers"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType supplierEntityType = suppliersEntitySet.getEntityType(); Property companyNameProperty = supplierEntityType.getProperty("CompanyName"); EntityType productEntityType = productsEntitySet.getEntityType(); Property productNameProperty = productEntityType.getProperty("ProductName"); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValue supplier1 = service.executeQuery(new DataQuery() .from(suppliersEntitySet).top(1)) .getRequiredEntity(); EntityValue supplier2 = supplier1.copyEntity(); EntityValue supplier3 = supplier1.copyEntity(); EntityValue supplier4 = supplier1.copyEntity(); companyNameProperty.setString(supplier2, "Alpha Inc."); companyNameProperty.setString(supplier3, "Beta Inc."); service.createEntity(supplier2); service.createEntity(supplier3); companyNameProperty.setString(supplier3, "Gamma Inc."); EntityValue product1 = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); EntityValue product2 = product1.copyEntity(); productNameProperty.setString(product2, "Delta Cake"); RequestBatch batch = new RequestBatch(); ChangeSet changes = new ChangeSet(); changes.createEntity(supplier4); changes.updateEntity(supplier3); changes.deleteEntity(supplier2); changes.createEntity(product2); changes.createLink(product2, supplierProperty, supplier4); DataQuery query = new DataQuery().from(suppliersEntitySet); batch.addChanges(changes); batch.addQuery(query); service.processBatch(batch); EntityValueList suppliers = batch.getQueryResult(query).getEntityList(); Example.show("There are now ", Example.formatInt(suppliers.length()), " suppliers."); }
- Parameters:
batch- The request batch.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
processBatchAsync
void processBatchAsync(@NonNull() @NotNull() RequestBatch batch, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Execute a request batch in the target system.
- See Also:
- Example using proxy classes:
public void processBatchExample() { NorthwindService service = this.getService(); Supplier supplier1 = service.getSupplier(new DataQuery().top(1)); Supplier supplier2 = supplier1.copy(); Supplier supplier3 = supplier1.copy(); Supplier supplier4 = supplier1.copy(); supplier2.setCompanyName("Alpha Inc."); supplier3.setCompanyName("Beta Inc."); service.createEntity(supplier2); service.createEntity(supplier3); supplier3.setCompanyName("Gamma Inc."); Product product1 = service.getProduct(new DataQuery().top(1)); Product product2 = product1.copy(); product2.setProductName("Delta Cake"); RequestBatch batch = new RequestBatch(); ChangeSet changes = new ChangeSet(); changes.createEntity(supplier4); changes.updateEntity(supplier3); changes.deleteEntity(supplier2); changes.createEntity(product2); changes.createLink(product2, Product.supplier, supplier4); changes.updateLink(product2, Product.supplier, supplier3); changes.deleteLink(product2, Product.supplier, supplier3); DataQuery query = new DataQuery() .from(NorthwindServiceMetadata.EntitySets.suppliers); batch.addChanges(changes); batch.addQuery(query); service.processBatch(batch); List<Supplier> suppliers = Supplier.list(batch.getQueryResult(query) .getEntityList()); Example.show("There are now ", Example.formatInt(suppliers.size()), " suppliers."); }
- Example using dynamic API:
public void processBatchExample() { DataService service = this.getService(); EntitySet suppliersEntitySet = service.getEntitySet("Suppliers"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType supplierEntityType = suppliersEntitySet.getEntityType(); Property companyNameProperty = supplierEntityType.getProperty("CompanyName"); EntityType productEntityType = productsEntitySet.getEntityType(); Property productNameProperty = productEntityType.getProperty("ProductName"); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValue supplier1 = service.executeQuery(new DataQuery() .from(suppliersEntitySet).top(1)) .getRequiredEntity(); EntityValue supplier2 = supplier1.copyEntity(); EntityValue supplier3 = supplier1.copyEntity(); EntityValue supplier4 = supplier1.copyEntity(); companyNameProperty.setString(supplier2, "Alpha Inc."); companyNameProperty.setString(supplier3, "Beta Inc."); service.createEntity(supplier2); service.createEntity(supplier3); companyNameProperty.setString(supplier3, "Gamma Inc."); EntityValue product1 = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); EntityValue product2 = product1.copyEntity(); productNameProperty.setString(product2, "Delta Cake"); RequestBatch batch = new RequestBatch(); ChangeSet changes = new ChangeSet(); changes.createEntity(supplier4); changes.updateEntity(supplier3); changes.deleteEntity(supplier2); changes.createEntity(product2); changes.createLink(product2, supplierProperty, supplier4); DataQuery query = new DataQuery().from(suppliersEntitySet); batch.addChanges(changes); batch.addQuery(query); service.processBatch(batch); EntityValueList suppliers = batch.getQueryResult(query).getEntityList(); Example.show("There are now ", Example.formatInt(suppliers.length()), " suppliers."); }
- Parameters:
batch- The request batch.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
processBatchAsync
void processBatchAsync(@NonNull() @NotNull() RequestBatch batch, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Execute a request batch in the target system.
- See Also:
- Example using proxy classes:
public void processBatchExample() { NorthwindService service = this.getService(); Supplier supplier1 = service.getSupplier(new DataQuery().top(1)); Supplier supplier2 = supplier1.copy(); Supplier supplier3 = supplier1.copy(); Supplier supplier4 = supplier1.copy(); supplier2.setCompanyName("Alpha Inc."); supplier3.setCompanyName("Beta Inc."); service.createEntity(supplier2); service.createEntity(supplier3); supplier3.setCompanyName("Gamma Inc."); Product product1 = service.getProduct(new DataQuery().top(1)); Product product2 = product1.copy(); product2.setProductName("Delta Cake"); RequestBatch batch = new RequestBatch(); ChangeSet changes = new ChangeSet(); changes.createEntity(supplier4); changes.updateEntity(supplier3); changes.deleteEntity(supplier2); changes.createEntity(product2); changes.createLink(product2, Product.supplier, supplier4); changes.updateLink(product2, Product.supplier, supplier3); changes.deleteLink(product2, Product.supplier, supplier3); DataQuery query = new DataQuery() .from(NorthwindServiceMetadata.EntitySets.suppliers); batch.addChanges(changes); batch.addQuery(query); service.processBatch(batch); List<Supplier> suppliers = Supplier.list(batch.getQueryResult(query) .getEntityList()); Example.show("There are now ", Example.formatInt(suppliers.size()), " suppliers."); }
- Example using dynamic API:
public void processBatchExample() { DataService service = this.getService(); EntitySet suppliersEntitySet = service.getEntitySet("Suppliers"); EntitySet productsEntitySet = service.getEntitySet("Products"); EntityType supplierEntityType = suppliersEntitySet.getEntityType(); Property companyNameProperty = supplierEntityType.getProperty("CompanyName"); EntityType productEntityType = productsEntitySet.getEntityType(); Property productNameProperty = productEntityType.getProperty("ProductName"); Property supplierProperty = productEntityType.getProperty("Supplier"); EntityValue supplier1 = service.executeQuery(new DataQuery() .from(suppliersEntitySet).top(1)) .getRequiredEntity(); EntityValue supplier2 = supplier1.copyEntity(); EntityValue supplier3 = supplier1.copyEntity(); EntityValue supplier4 = supplier1.copyEntity(); companyNameProperty.setString(supplier2, "Alpha Inc."); companyNameProperty.setString(supplier3, "Beta Inc."); service.createEntity(supplier2); service.createEntity(supplier3); companyNameProperty.setString(supplier3, "Gamma Inc."); EntityValue product1 = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); EntityValue product2 = product1.copyEntity(); productNameProperty.setString(product2, "Delta Cake"); RequestBatch batch = new RequestBatch(); ChangeSet changes = new ChangeSet(); changes.createEntity(supplier4); changes.updateEntity(supplier3); changes.deleteEntity(supplier2); changes.createEntity(product2); changes.createLink(product2, supplierProperty, supplier4); DataQuery query = new DataQuery().from(suppliersEntitySet); batch.addChanges(changes); batch.addQuery(query); service.processBatch(batch); EntityValueList suppliers = batch.getQueryResult(query).getEntityList(); Example.show("There are now ", Example.formatInt(suppliers.length()), " suppliers."); }
- Parameters:
batch- The request batch.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
refreshMetadata
void refreshMetadata()
Reload latest metadata from the backend server. If the metadata was previously loaded (or was obtained from generated proxy classes), then a compatibility check is performed. If the latest metadata is not compatible with the previous metadata, com.sap.cloud.mobile.odata.csdl.CsdlException will be thrown. If the latest metadata is compatible with the previous metadata, the latest metadata will be applied. It is generally recommended to use this function during application startup to check if the server's metadata has been updated since the client application was constructed. If an application wishes to use the data service for actions or updates, while refreshing the metadata in another thread, the code using the data service for actions or updates should perform those operations while holding a read lock on the DataService.metadataLock. Execution of functions or queries will automatically obtain a read lock on DataService.metadataLock.
Compatible metadata changes include:
- Adding structural/navigation properties to complex/entity types.
- Adding new types (enumeration, simple, complex, entity).
- Adding new entity sets or singletons.
- Adding new actions or functions.
- Adding an action parameter that is nullable to the end of the parameter list.
Other additions, changes, and removals are considered incompatible by default, including:
- Adding members to an enumeration type.
- Changing the base type for any type.
- Changing the value of an enumeration member.
- Changing the type (or nullability) of any structural/navigation property.
- Changing the type (or nullability) of any action/function parameter or result.
- Removing the definition of a model element.
- Removing members from an enumeration type.
- Removing structural/navigation properties from a complex/entity type.
Addition of enumeration members can be pre-approved by a caller using the dynamic API before calling
refreshMetadata(see CsdlDocument.hasOpenEnumerations). If an application uses generated proxy classes, then generating them with the "-open:enumerations" option will automate the necessary pre-approval. ThehasOpenEnumerationsflag should only be explicitly set when using the dynamic API. Explicitly setting thehasOpenEnumerationsflag when using generated proxy classes (generated without the "-open:enumerations" option) could result in runtime exceptions.Changes to model elements can be pre-approved by a caller using the dynamic API before calling
refreshMetadata(see CsdlDocument.canChangeAnything). Applications using generated proxy classes should not pre-approve such changes, as they are likely to result in application instability. For example, if a property's data type is changed, it could result in runtime exceptions since proxy class properties have a pre-determined type that is embedded into the application's compiled code.Removal of model elements can be pre-approved by the caller before calling
refreshMetadata(see CsdlDocument.canRemoveAnything), or preferably by setting thecanBeRemovedflag on model elements that the application is prepared for the removal of. Application developers should take care not to pre-approve the removal of model elements unless the application is coded to check at runtime for the possible removal of those elements. The allowance for removals is intended to support "newer" versions of client applications communicating with "older" service implementations but in the general case may require the application to have some embedded knowledge of the changes that were made to the service metadata between the older and newer service implementations. If a newer client application makes unconditional use of a model element that did not exist in an older service implementation, then the non-existence of that model element after callingrefreshMetadatacould result in runtime exceptions.If refreshMetadata succeeds, then any added model elements will have
isExtension == true, and any removed model elements will haveisRemoved == true. Changed model elements will not be distinguishable.
-
refreshMetadataAsync
void refreshMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
Reload latest metadata from the backend server. If the metadata was previously loaded (or was obtained from generated proxy classes), then a compatibility check is performed. If the latest metadata is not compatible with the previous metadata, com.sap.cloud.mobile.odata.csdl.CsdlException will be thrown. If the latest metadata is compatible with the previous metadata, the latest metadata will be applied. It is generally recommended to use this function during application startup to check if the server's metadata has been updated since the client application was constructed. If an application wishes to use the data service for actions or updates, while refreshing the metadata in another thread, the code using the data service for actions or updates should perform those operations while holding a read lock on the DataService.metadataLock. Execution of functions or queries will automatically obtain a read lock on DataService.metadataLock.
Compatible metadata changes include:
- Adding structural/navigation properties to complex/entity types.
- Adding new types (enumeration, simple, complex, entity).
- Adding new entity sets or singletons.
- Adding new actions or functions.
- Adding an action parameter that is nullable to the end of the parameter list.
Other additions, changes, and removals are considered incompatible by default, including:
- Adding members to an enumeration type.
- Changing the base type for any type.
- Changing the value of an enumeration member.
- Changing the type (or nullability) of any structural/navigation property.
- Changing the type (or nullability) of any action/function parameter or result.
- Removing the definition of a model element.
- Removing members from an enumeration type.
- Removing structural/navigation properties from a complex/entity type.
Addition of enumeration members can be pre-approved by a caller using the dynamic API before calling
refreshMetadata(see CsdlDocument.hasOpenEnumerations). If an application uses generated proxy classes, then generating them with the "-open:enumerations" option will automate the necessary pre-approval. ThehasOpenEnumerationsflag should only be explicitly set when using the dynamic API. Explicitly setting thehasOpenEnumerationsflag when using generated proxy classes (generated without the "-open:enumerations" option) could result in runtime exceptions.Changes to model elements can be pre-approved by a caller using the dynamic API before calling
refreshMetadata(see CsdlDocument.canChangeAnything). Applications using generated proxy classes should not pre-approve such changes, as they are likely to result in application instability. For example, if a property's data type is changed, it could result in runtime exceptions since proxy class properties have a pre-determined type that is embedded into the application's compiled code.Removal of model elements can be pre-approved by the caller before calling
refreshMetadata(see CsdlDocument.canRemoveAnything), or preferably by setting thecanBeRemovedflag on model elements that the application is prepared for the removal of. Application developers should take care not to pre-approve the removal of model elements unless the application is coded to check at runtime for the possible removal of those elements. The allowance for removals is intended to support "newer" versions of client applications communicating with "older" service implementations but in the general case may require the application to have some embedded knowledge of the changes that were made to the service metadata between the older and newer service implementations. If a newer client application makes unconditional use of a model element that did not exist in an older service implementation, then the non-existence of that model element after callingrefreshMetadatacould result in runtime exceptions.If refreshMetadata succeeds, then any added model elements will have
isExtension == true, and any removed model elements will haveisRemoved == true. Changed model elements will not be distinguishable.
-
refreshMetadataAsync
void refreshMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Reload latest metadata from the backend server. If the metadata was previously loaded (or was obtained from generated proxy classes), then a compatibility check is performed. If the latest metadata is not compatible with the previous metadata, com.sap.cloud.mobile.odata.csdl.CsdlException will be thrown. If the latest metadata is compatible with the previous metadata, the latest metadata will be applied. It is generally recommended to use this function during application startup to check if the server's metadata has been updated since the client application was constructed. If an application wishes to use the data service for actions or updates, while refreshing the metadata in another thread, the code using the data service for actions or updates should perform those operations while holding a read lock on the DataService.metadataLock. Execution of functions or queries will automatically obtain a read lock on DataService.metadataLock.
Compatible metadata changes include:
- Adding structural/navigation properties to complex/entity types.
- Adding new types (enumeration, simple, complex, entity).
- Adding new entity sets or singletons.
- Adding new actions or functions.
- Adding an action parameter that is nullable to the end of the parameter list.
Other additions, changes, and removals are considered incompatible by default, including:
- Adding members to an enumeration type.
- Changing the base type for any type.
- Changing the value of an enumeration member.
- Changing the type (or nullability) of any structural/navigation property.
- Changing the type (or nullability) of any action/function parameter or result.
- Removing the definition of a model element.
- Removing members from an enumeration type.
- Removing structural/navigation properties from a complex/entity type.
Addition of enumeration members can be pre-approved by a caller using the dynamic API before calling
refreshMetadata(see CsdlDocument.hasOpenEnumerations). If an application uses generated proxy classes, then generating them with the "-open:enumerations" option will automate the necessary pre-approval. ThehasOpenEnumerationsflag should only be explicitly set when using the dynamic API. Explicitly setting thehasOpenEnumerationsflag when using generated proxy classes (generated without the "-open:enumerations" option) could result in runtime exceptions.Changes to model elements can be pre-approved by a caller using the dynamic API before calling
refreshMetadata(see CsdlDocument.canChangeAnything). Applications using generated proxy classes should not pre-approve such changes, as they are likely to result in application instability. For example, if a property's data type is changed, it could result in runtime exceptions since proxy class properties have a pre-determined type that is embedded into the application's compiled code.Removal of model elements can be pre-approved by the caller before calling
refreshMetadata(see CsdlDocument.canRemoveAnything), or preferably by setting thecanBeRemovedflag on model elements that the application is prepared for the removal of. Application developers should take care not to pre-approve the removal of model elements unless the application is coded to check at runtime for the possible removal of those elements. The allowance for removals is intended to support "newer" versions of client applications communicating with "older" service implementations but in the general case may require the application to have some embedded knowledge of the changes that were made to the service metadata between the older and newer service implementations. If a newer client application makes unconditional use of a model element that did not exist in an older service implementation, then the non-existence of that model element after callingrefreshMetadatacould result in runtime exceptions.If refreshMetadata succeeds, then any added model elements will have
isExtension == true, and any removed model elements will haveisRemoved == true. Changed model elements will not be distinguishable.
-
registerClient
void registerClient()
-
registerClientAsync
void registerClientAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
-
registerClientAsync
void registerClientAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
-
registerClient
void registerClient(@Nullable() @Nullable() EntityValue client)
If DataService.isClientRegistered would return
false, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json. Otherwise just load the previously locally-saved registration ID into the ServiceOptions.clientInstanceID. The server's metadata is expected to include aClientRegistrationSetentity set with entity typeClientRegistration, a key property namedClientIDof typelong(Edm.Int64), and a property namedClientGUIDof typeguid(Edm.Guid). If a new registration is successfully created, ServiceOptions.clientInstanceID is set, and will subsequently be used to populate theClient-Instance-IDHTTP header for all OData calls. The purpose of creating such a client registration is to enable the server to associate various resources with the current instance of the current client application. A "current instance" can survive multiple restarts of the client application so long as the same Client-Instance-ID header value is provided for each OData call to the remote service. This is particularly useful for offline applications which rely on server-side OData change tracking implementations that store per-client server-side state to facilitate change tracking.- Parameters:
client- (nullable) Instance ofClientRegistrationentity type.
-
registerClientAsync
void registerClientAsync(@Nullable() @Nullable() EntityValue client, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
If DataService.isClientRegistered would return
false, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json. Otherwise just load the previously locally-saved registration ID into the ServiceOptions.clientInstanceID. The server's metadata is expected to include aClientRegistrationSetentity set with entity typeClientRegistration, a key property namedClientIDof typelong(Edm.Int64), and a property namedClientGUIDof typeguid(Edm.Guid). If a new registration is successfully created, ServiceOptions.clientInstanceID is set, and will subsequently be used to populate theClient-Instance-IDHTTP header for all OData calls. The purpose of creating such a client registration is to enable the server to associate various resources with the current instance of the current client application. A "current instance" can survive multiple restarts of the client application so long as the same Client-Instance-ID header value is provided for each OData call to the remote service. This is particularly useful for offline applications which rely on server-side OData change tracking implementations that store per-client server-side state to facilitate change tracking.- Parameters:
client- (nullable) Instance ofClientRegistrationentity type.
-
registerClientAsync
void registerClientAsync(@Nullable() @Nullable() EntityValue client, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
If DataService.isClientRegistered would return
false, create a new client registration and record its key (ClientID property of type GUID) in local file~/ClientRegistration/<ServiceName>.json. Otherwise just load the previously locally-saved registration ID into the ServiceOptions.clientInstanceID. The server's metadata is expected to include aClientRegistrationSetentity set with entity typeClientRegistration, a key property namedClientIDof typelong(Edm.Int64), and a property namedClientGUIDof typeguid(Edm.Guid). If a new registration is successfully created, ServiceOptions.clientInstanceID is set, and will subsequently be used to populate theClient-Instance-IDHTTP header for all OData calls. The purpose of creating such a client registration is to enable the server to associate various resources with the current instance of the current client application. A "current instance" can survive multiple restarts of the client application so long as the same Client-Instance-ID header value is provided for each OData call to the remote service. This is particularly useful for offline applications which rely on server-side OData change tracking implementations that store per-client server-side state to facilitate change tracking.- Parameters:
client- (nullable) Instance ofClientRegistrationentity type.
-
saveEntity
void saveEntity(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.
-
saveEntityAsync
void saveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.
-
saveEntityAsync
void saveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.
-
saveEntity
void saveEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
saveEntityAsync
void saveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
saveEntityAsync
void saveEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
saveEntity
void saveEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create (if EntityValue.isNew) or update (if existing) an entity in the target system.
- Parameters:
entity- Entity to be created or updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
saveEntityAsync
void saveEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Create (if EntityValue.isNew) or update (if existing) an entity in the target system.
- Parameters:
entity- Entity to be created or updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
saveEntityAsync
void saveEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Create (if EntityValue.isNew) or update (if existing) an entity in the target system.
- Parameters:
entity- Entity to be created or updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
unloadMetadata
void unloadMetadata()
Unload service metadata DataService.provider (if previously loaded).
- See Also:
-
unloadMetadataAsync
void unloadMetadataAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
Unload service metadata DataService.provider (if previously loaded).
- See Also:
-
unloadMetadataAsync
void unloadMetadataAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Unload service metadata DataService.provider (if previously loaded).
- See Also:
-
unregisterClient
void unregisterClient()
-
unregisterClientAsync
void unregisterClientAsync(@NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
-
unregisterClientAsync
void unregisterClientAsync(@NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
-
unregisterClient
void unregisterClient(boolean deleteFromServer)
Forget any client registration previously established by DataService.registerClient. Also attempts to make a call to the server to delete the associated entity, if the
deleteFromServerparameter istrue.- Parameters:
deleteFromServer- Specify a value oftrueto request the server to also delete the corresponding entity.
-
unregisterClientAsync
void unregisterClientAsync(boolean deleteFromServer, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
Forget any client registration previously established by DataService.registerClient. Also attempts to make a call to the server to delete the associated entity, if the
deleteFromServerparameter istrue.- Parameters:
deleteFromServer- Specify a value oftrueto request the server to also delete the corresponding entity.
-
unregisterClientAsync
void unregisterClientAsync(boolean deleteFromServer, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Forget any client registration previously established by DataService.registerClient. Also attempts to make a call to the server to delete the associated entity, if the
deleteFromServerparameter istrue.- Parameters:
deleteFromServer- Specify a value oftrueto request the server to also delete the corresponding entity.
-
updateEntity
void updateEntity(@NonNull() @NotNull() EntityValue entity)
- Parameters:
entity- Entity parameter.
-
updateEntityAsync
void updateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.
-
updateEntityAsync
void updateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.
-
updateEntity
void updateEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
updateEntityAsync
void updateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
updateEntityAsync
void updateEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.headers- Headers parameter.
-
updateEntity
void updateEntity(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Update an entity in the target system.
- Example using proxy classes:
public void updateEntityExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1) .filter(Customer.contactName.equal("Jean-Luc Picard")); Customer customer = service.getCustomer(query); customer.setContactName("Beverly Crusher"); service.updateEntity(customer); }
- Example with proxy classes:
public void deepUpdateExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1).expand(Customer.orders) .filter(Customer.contactName.equal("Beverly Crusher")); Customer customer = service.getCustomer(query); List<Order> orders = customer.getOrders(); Order firstOrder = orders.get(0); Order nextOrder = orders.get(1); Order newOrder = new Order(); newOrder.setOrderDate(GlobalDateTime.now()); customer.unbindEntity(firstOrder, Customer.orders); nextOrder.setRequiredDate(GlobalDateTime.now().plusDays(7)); customer.bindEntity(newOrder, Customer.orders); customer.setDeepUpdateDelta(true); service.updateEntity(customer.withDeepUpdate()); }
- Example using proxy classes:
public void updateReplaceExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1) .filter(Customer.contactName.equal("Beverly Crusher")); Customer customer = service.getCustomer(query); customer.setContactName("William Riker"); RequestOptions options = new RequestOptions().update(UpdateMode.REPLACE); service.updateEntity(customer, null, options); }
- Example using dynamic API:
public void updateEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery().top(1).from(customersEntitySet) .filter(contactNameProperty.equal("Jean-Luc Picard")); EntityValue customer = service.executeQuery(query).getRequiredEntity(); contactNameProperty.setString(customer, "Beverly Crusher"); service.updateEntity(customer); }
- Parameters:
entity- Entity to be updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
updateEntityAsync
void updateEntityAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Update an entity in the target system.
- Example using proxy classes:
public void updateEntityExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1) .filter(Customer.contactName.equal("Jean-Luc Picard")); Customer customer = service.getCustomer(query); customer.setContactName("Beverly Crusher"); service.updateEntity(customer); }
- Example with proxy classes:
public void deepUpdateExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1).expand(Customer.orders) .filter(Customer.contactName.equal("Beverly Crusher")); Customer customer = service.getCustomer(query); List<Order> orders = customer.getOrders(); Order firstOrder = orders.get(0); Order nextOrder = orders.get(1); Order newOrder = new Order(); newOrder.setOrderDate(GlobalDateTime.now()); customer.unbindEntity(firstOrder, Customer.orders); nextOrder.setRequiredDate(GlobalDateTime.now().plusDays(7)); customer.bindEntity(newOrder, Customer.orders); customer.setDeepUpdateDelta(true); service.updateEntity(customer.withDeepUpdate()); }
- Example using proxy classes:
public void updateReplaceExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1) .filter(Customer.contactName.equal("Beverly Crusher")); Customer customer = service.getCustomer(query); customer.setContactName("William Riker"); RequestOptions options = new RequestOptions().update(UpdateMode.REPLACE); service.updateEntity(customer, null, options); }
- Example using dynamic API:
public void updateEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery().top(1).from(customersEntitySet) .filter(contactNameProperty.equal("Jean-Luc Picard")); EntityValue customer = service.executeQuery(query).getRequiredEntity(); contactNameProperty.setString(customer, "Beverly Crusher"); service.updateEntity(customer); }
- Parameters:
entity- Entity to be updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
updateEntityAsync
void updateEntityAsync(@NonNull() @NotNull() EntityValue entity, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Update an entity in the target system.
- Example using proxy classes:
public void updateEntityExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1) .filter(Customer.contactName.equal("Jean-Luc Picard")); Customer customer = service.getCustomer(query); customer.setContactName("Beverly Crusher"); service.updateEntity(customer); }
- Example with proxy classes:
public void deepUpdateExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1).expand(Customer.orders) .filter(Customer.contactName.equal("Beverly Crusher")); Customer customer = service.getCustomer(query); List<Order> orders = customer.getOrders(); Order firstOrder = orders.get(0); Order nextOrder = orders.get(1); Order newOrder = new Order(); newOrder.setOrderDate(GlobalDateTime.now()); customer.unbindEntity(firstOrder, Customer.orders); nextOrder.setRequiredDate(GlobalDateTime.now().plusDays(7)); customer.bindEntity(newOrder, Customer.orders); customer.setDeepUpdateDelta(true); service.updateEntity(customer.withDeepUpdate()); }
- Example using proxy classes:
public void updateReplaceExample() { NorthwindService service = this.getService(); DataQuery query = new DataQuery().top(1) .filter(Customer.contactName.equal("Beverly Crusher")); Customer customer = service.getCustomer(query); customer.setContactName("William Riker"); RequestOptions options = new RequestOptions().update(UpdateMode.REPLACE); service.updateEntity(customer, null, options); }
- Example using dynamic API:
public void updateEntityExample() { DataService service = this.getService(); EntitySet customersEntitySet = service.getEntitySet("Customers"); EntityType customerEntityType = customersEntitySet.getEntityType(); Property contactNameProperty = customerEntityType.getProperty("ContactName"); DataQuery query = new DataQuery().top(1).from(customersEntitySet) .filter(contactNameProperty.equal("Jean-Luc Picard")); EntityValue customer = service.executeQuery(query).getRequiredEntity(); contactNameProperty.setString(customer, "Beverly Crusher"); service.updateEntity(customer); }
- Parameters:
entity- Entity to be updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
updateLink
void updateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
updateLinkAsync
void updateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
updateLinkAsync
void updateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.
-
updateLink
void updateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
updateLinkAsync
void updateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
updateLinkAsync
void updateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
from- From parameter.property- Property parameter.to- To parameter.headers- Headers parameter.
-
updateLink
void updateLink(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Update a link from a source entity to a target entity.
- Example using proxy classes:
public void updateLinkExample() { NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); Category category = service.getCategory(new DataQuery().skip(2).top(1)); service.updateLink(product, Product.category, category); }
- Example using dynamic API:
public void updateLinkExample() { DataService service = this.getService(); EntitySet productsEntitySet = service.getEntitySet("Products"); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntityType productEntityType = productsEntitySet.getEntityType(); Property categoryProperty = productEntityType.getProperty("Category"); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(2).top(1)) .getRequiredEntity(); service.updateLink(product, categoryProperty, category); }
- Parameters:
from- Source entity for the link to be updated.property- Source navigation property for the link to be updated.to- Target entity for the link to be updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
updateLinkAsync
void updateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Update a link from a source entity to a target entity.
- Example using proxy classes:
public void updateLinkExample() { NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); Category category = service.getCategory(new DataQuery().skip(2).top(1)); service.updateLink(product, Product.category, category); }
- Example using dynamic API:
public void updateLinkExample() { DataService service = this.getService(); EntitySet productsEntitySet = service.getEntitySet("Products"); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntityType productEntityType = productsEntitySet.getEntityType(); Property categoryProperty = productEntityType.getProperty("Category"); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(2).top(1)) .getRequiredEntity(); service.updateLink(product, categoryProperty, category); }
- Parameters:
from- Source entity for the link to be updated.property- Source navigation property for the link to be updated.to- Target entity for the link to be updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
updateLinkAsync
void updateLinkAsync(@NonNull() @NotNull() EntityValue from, @NonNull() @NotNull() Property property, @NonNull() @NotNull() EntityValue to, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Update a link from a source entity to a target entity.
- Example using proxy classes:
public void updateLinkExample() { NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); Category category = service.getCategory(new DataQuery().skip(2).top(1)); service.updateLink(product, Product.category, category); }
- Example using dynamic API:
public void updateLinkExample() { DataService service = this.getService(); EntitySet productsEntitySet = service.getEntitySet("Products"); EntitySet categoriesEntitySet = service.getEntitySet("Categories"); EntityType productEntityType = productsEntitySet.getEntityType(); Property categoryProperty = productEntityType.getProperty("Category"); EntityValue product = service.executeQuery(new DataQuery() .from(productsEntitySet).top(1)) .getRequiredEntity(); EntityValue category = service.executeQuery(new DataQuery() .from(categoriesEntitySet).skip(2).top(1)) .getRequiredEntity(); service.updateLink(product, categoryProperty, category); }
- Parameters:
from- Source entity for the link to be updated.property- Source navigation property for the link to be updated.to- Target entity for the link to be updated.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
uploadMedia
void uploadMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content)
- Parameters:
entity- Entity parameter.content- Content parameter.
-
uploadMediaAsync
void uploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.content- Content parameter.
-
uploadMediaAsync
void uploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.content- Content parameter.
-
uploadMedia
void uploadMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.content- Content parameter.headers- Headers parameter.
-
uploadMediaAsync
void uploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.content- Content parameter.headers- Headers parameter.
-
uploadMediaAsync
void uploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.content- Content parameter.headers- Headers parameter.
-
uploadMedia
void uploadMedia(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Upload content for a media entity to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices. Note: this function cannot be used to create a media entity. See DataService.createMedia.
- Example using proxy classes:
public void uploadMediaExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Image.label.equal("Smiley")) .top(1); Image image = service.getImage(query); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); }
- Example using dynamic API:
public void uploadMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); DataQuery query = new DataQuery().from(imagesEntitySet) .filter(labelProperty.equal("Smiley")).top(1); EntityValue image = service.executeQuery(query).getRequiredEntity(); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); }
- Parameters:
entity- Entity whose content is to be uploaded.content- Upload stream content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
uploadMediaAsync
void uploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Upload content for a media entity to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices. Note: this function cannot be used to create a media entity. See DataService.createMedia.
- Example using proxy classes:
public void uploadMediaExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Image.label.equal("Smiley")) .top(1); Image image = service.getImage(query); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); }
- Example using dynamic API:
public void uploadMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); DataQuery query = new DataQuery().from(imagesEntitySet) .filter(labelProperty.equal("Smiley")).top(1); EntityValue image = service.executeQuery(query).getRequiredEntity(); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); }
- Parameters:
entity- Entity whose content is to be uploaded.content- Upload stream content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
uploadMediaAsync
void uploadMediaAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Upload content for a media entity to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices. Note: this function cannot be used to create a media entity. See DataService.createMedia.
- Example using proxy classes:
public void uploadMediaExample() { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Image.label.equal("Smiley")) .top(1); Image image = service.getImage(query); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); }
- Example using dynamic API:
public void uploadMediaExample() { DataService service = this.getService(); EntitySet imagesEntitySet = service.getEntitySet("Images"); EntityType imageEntityType = imagesEntitySet.getEntityType(); Property labelProperty = imageEntityType.getProperty("label"); DataQuery query = new DataQuery().from(imagesEntitySet) .filter(labelProperty.equal("Smiley")).top(1); EntityValue image = service.executeQuery(query).getRequiredEntity(); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); }
- Parameters:
entity- Entity whose content is to be uploaded.content- Upload stream content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
uploadStream
void uploadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content)
- Parameters:
entity- Entity parameter.link- Link parameter.content- Content parameter.
-
uploadStreamAsync
void uploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.content- Content parameter.
-
uploadStreamAsync
void uploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.content- Content parameter.
-
uploadStream
void uploadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.link- Link parameter.content- Content parameter.headers- Headers parameter.
-
uploadStreamAsync
void uploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers)
- Parameters:
entity- Entity parameter.link- Link parameter.content- Content parameter.headers- Headers parameter.
-
uploadStreamAsync
void uploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
- Parameters:
entity- Entity parameter.link- Link parameter.content- Content parameter.headers- Headers parameter.
-
uploadStream
void uploadStream(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Upload content for a stream property to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices.
- See Also:
- Example using proxy classes:
public void uploadStreamExample() { MediaService service = this.getService(); Video video = new Video(); video.setLabel("Happy"); service.createEntity(video); String contentETagAfterCreate = video.getContent().getEntityTag(); assert contentETagAfterCreate == null; ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("happy-stuff")); content.setMediaType("text/plain"); service.uploadStream(video, video.getContent(), content); service.loadEntity(video); String contentETagAfterUpload = video.getContent().getEntityTag(); assert contentETagAfterUpload != null; video.setLabel("Happier"); service.updateEntity(video); String contentETagAfterUpdate = video.getContent().getEntityTag(); assert NullableString.equal(contentETagAfterUpdate, contentETagAfterUpload); }
- Example using dynamic API:
public void uploadStreamExample() { DataService service = this.getService(); EntitySet videosEntitySet = service.getEntitySet("Videos"); EntityType videoEntityType = videosEntitySet.getEntityType(); Property labelProperty = videoEntityType.getProperty("label"); Property contentProperty = videoEntityType.getProperty("content"); EntityValue video = EntityValue.ofType(videoEntityType); labelProperty.setString(video, "Happy"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("...")); content.setMediaType("text/plain"); service.createEntity(video); StreamLink link = contentProperty.getStreamLink(video); String contentETagAfterCreate = link.getEntityTag(); assert contentETagAfterCreate == null; service.uploadStream(video, link, content); service.loadEntity(video); String contentETagAfterUpload = link.getEntityTag(); assert contentETagAfterUpload != null; labelProperty.setString(video, "Happier"); service.updateEntity(video); String contentETagAfterUpdate = link.getEntityTag(); assert NullableString.equal(contentETagAfterUpdate, contentETagAfterUpload); }
- Parameters:
entity- Entity containing the stream property whose content is to be uploaded.link- Stream link for the stream to be uploaded.content- Upload stream content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
uploadStreamAsync
void uploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @NonNull() @NotNull() Action0 successHandler, @NonNull() @NotNull() Action1<RuntimeException> failureHandler, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)
Upload content for a stream property to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices.
- See Also:
- Example using proxy classes:
public void uploadStreamExample() { MediaService service = this.getService(); Video video = new Video(); video.setLabel("Happy"); service.createEntity(video); String contentETagAfterCreate = video.getContent().getEntityTag(); assert contentETagAfterCreate == null; ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("happy-stuff")); content.setMediaType("text/plain"); service.uploadStream(video, video.getContent(), content); service.loadEntity(video); String contentETagAfterUpload = video.getContent().getEntityTag(); assert contentETagAfterUpload != null; video.setLabel("Happier"); service.updateEntity(video); String contentETagAfterUpdate = video.getContent().getEntityTag(); assert NullableString.equal(contentETagAfterUpdate, contentETagAfterUpload); }
- Example using dynamic API:
public void uploadStreamExample() { DataService service = this.getService(); EntitySet videosEntitySet = service.getEntitySet("Videos"); EntityType videoEntityType = videosEntitySet.getEntityType(); Property labelProperty = videoEntityType.getProperty("label"); Property contentProperty = videoEntityType.getProperty("content"); EntityValue video = EntityValue.ofType(videoEntityType); labelProperty.setString(video, "Happy"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("...")); content.setMediaType("text/plain"); service.createEntity(video); StreamLink link = contentProperty.getStreamLink(video); String contentETagAfterCreate = link.getEntityTag(); assert contentETagAfterCreate == null; service.uploadStream(video, link, content); service.loadEntity(video); String contentETagAfterUpload = link.getEntityTag(); assert contentETagAfterUpload != null; labelProperty.setString(video, "Happier"); service.updateEntity(video); String contentETagAfterUpdate = link.getEntityTag(); assert NullableString.equal(contentETagAfterUpdate, contentETagAfterUpload); }
- Parameters:
entity- Entity containing the stream property whose content is to be uploaded.link- Stream link for the stream to be uploaded.content- Upload stream content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
uploadStreamAsync
void uploadStreamAsync(@NonNull() @NotNull() EntityValue entity, @NonNull() @NotNull() StreamLink link, @NonNull() @NotNull() StreamBase content, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options, @NonNull() @NotNull() AsyncResult.Handler<Void> resultHandler)
Upload content for a stream property to the target system. Caution: Having too many threads simultaneously uploading streams may result in out-of-memory conditions on memory-constrained devices.
- See Also:
- Example using proxy classes:
public void uploadStreamExample() { MediaService service = this.getService(); Video video = new Video(); video.setLabel("Happy"); service.createEntity(video); String contentETagAfterCreate = video.getContent().getEntityTag(); assert contentETagAfterCreate == null; ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("happy-stuff")); content.setMediaType("text/plain"); service.uploadStream(video, video.getContent(), content); service.loadEntity(video); String contentETagAfterUpload = video.getContent().getEntityTag(); assert contentETagAfterUpload != null; video.setLabel("Happier"); service.updateEntity(video); String contentETagAfterUpdate = video.getContent().getEntityTag(); assert NullableString.equal(contentETagAfterUpdate, contentETagAfterUpload); }
- Example using dynamic API:
public void uploadStreamExample() { DataService service = this.getService(); EntitySet videosEntitySet = service.getEntitySet("Videos"); EntityType videoEntityType = videosEntitySet.getEntityType(); Property labelProperty = videoEntityType.getProperty("label"); Property contentProperty = videoEntityType.getProperty("content"); EntityValue video = EntityValue.ofType(videoEntityType); labelProperty.setString(video, "Happy"); ByteStream content = ByteStream.fromBinary(com.sap.cloud.mobile.odata.core.StringFunction.toBinary("...")); content.setMediaType("text/plain"); service.createEntity(video); StreamLink link = contentProperty.getStreamLink(video); String contentETagAfterCreate = link.getEntityTag(); assert contentETagAfterCreate == null; service.uploadStream(video, link, content); service.loadEntity(video); String contentETagAfterUpload = link.getEntityTag(); assert contentETagAfterUpload != null; labelProperty.setString(video, "Happier"); service.updateEntity(video); String contentETagAfterUpdate = link.getEntityTag(); assert NullableString.equal(contentETagAfterUpdate, contentETagAfterUpload); }
- Parameters:
entity- Entity containing the stream property whose content is to be uploaded.link- Stream link for the stream to be uploaded.content- Upload stream content.headers- (nullable) Optional request-specific headers.options- (nullable) Optional request-specific options.
-
-
-
-