public class DataService
extends java.lang.Object
Encapsulates an OData data service.
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); }
public void dataServiceExample() { OnlineODataProvider provider = new OnlineODataProvider("NorthwindService", "http://services.odata.org/V4/Northwind/Northwind.svc/"); DataService service = new DataService(provider); 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); }
Constructor and Description |
---|
DataService(DataServiceProvider provider)
Construct a new data service using a specified provider.
|
Modifier and Type | Method and Description |
---|---|
void |
applyChanges(ChangeSet changes)
|
void |
applyChanges(ChangeSet changes,
HttpHeaders headers)
|
void |
applyChanges(ChangeSet changes,
HttpHeaders headers,
RequestOptions options)
Apply the changes from a change set to the target system.
|
void |
createEntity(EntityValue entity)
|
void |
createEntity(EntityValue entity,
HttpHeaders headers)
|
void |
createEntity(EntityValue entity,
HttpHeaders headers,
RequestOptions options)
Create an entity in the target system.
|
void |
createLink(EntityValue from,
Property property,
EntityValue to)
|
void |
createLink(EntityValue from,
Property property,
EntityValue to,
HttpHeaders headers)
|
void |
createLink(EntityValue from,
Property property,
EntityValue to,
HttpHeaders headers,
RequestOptions options)
Create a link from a source entity to a target entity in the target system.
|
void |
createMedia(EntityValue entity,
StreamBase content)
|
void |
createMedia(EntityValue entity,
StreamBase content,
HttpHeaders headers)
|
void |
createMedia(EntityValue entity,
StreamBase content,
HttpHeaders headers,
RequestOptions options)
Create a media entity with the specified content.
|
void |
createRelatedEntity(EntityValue entity,
EntityValue parent,
Property property)
|
void |
createRelatedEntity(EntityValue entity,
EntityValue parent,
Property property,
HttpHeaders headers)
|
void |
createRelatedEntity(EntityValue entity,
EntityValue parent,
Property property,
HttpHeaders headers,
RequestOptions options)
Create an entity in the target system, related to a parent entity via a parent navigation property.
|
void |
createRelatedMedia(EntityValue entity,
StreamBase content,
EntityValue parent,
Property property)
|
void |
createRelatedMedia(EntityValue entity,
StreamBase content,
EntityValue parent,
Property property,
HttpHeaders headers)
|
void |
createRelatedMedia(EntityValue entity,
StreamBase content,
EntityValue parent,
Property property,
HttpHeaders headers,
RequestOptions options)
Create an media entity in the target system, related to a parent entity via a parent navigation property.
|
void |
deleteByQuery(DataQuery query)
|
void |
deleteByQuery(DataQuery query,
HttpHeaders headers)
|
void |
deleteByQuery(DataQuery query,
HttpHeaders headers,
RequestOptions options)
Execute query to delete data from the target system.
|
void |
deleteEntity(EntityValue entity)
|
void |
deleteEntity(EntityValue entity,
HttpHeaders headers)
|
void |
deleteEntity(EntityValue entity,
HttpHeaders headers,
RequestOptions options)
Delete an entity from the target system.
|
void |
deleteLink(EntityValue from,
Property property)
|
void |
deleteLink(EntityValue from,
Property property,
EntityValue to)
|
void |
deleteLink(EntityValue from,
Property property,
EntityValue to,
HttpHeaders headers)
|
void |
deleteLink(EntityValue from,
Property property,
EntityValue to,
HttpHeaders headers,
RequestOptions options)
Delete a link from a source entity to a target entity.
|
void |
deleteStream(EntityValue entity,
StreamLink link)
|
void |
deleteStream(EntityValue entity,
StreamLink link,
HttpHeaders headers)
|
void |
deleteStream(EntityValue entity,
StreamLink link,
HttpHeaders headers,
RequestOptions options)
Delete the content of a stream property from the target system.
|
ByteStream |
downloadMedia(EntityValue entity)
|
ByteStream |
downloadMedia(EntityValue entity,
HttpHeaders headers)
|
ByteStream |
downloadMedia(EntityValue entity,
HttpHeaders headers,
RequestOptions options)
Obtain a stream for downloading the content of a media entity from the target system.
|
ByteStream |
downloadStream(EntityValue entity,
StreamLink link)
|
ByteStream |
downloadStream(EntityValue entity,
StreamLink link,
HttpHeaders headers)
|
ByteStream |
downloadStream(EntityValue entity,
StreamLink link,
HttpHeaders headers,
RequestOptions options)
Obtain a stream for downloading the content of a stream property from the target system.
|
DataValue |
executeMethod(DataMethod method)
|
DataValue |
executeMethod(DataMethod method,
ParameterList parameters)
|
DataValue |
executeMethod(DataMethod method,
ParameterList parameters,
HttpHeaders headers)
|
DataValue |
executeMethod(DataMethod method,
ParameterList parameters,
HttpHeaders headers,
RequestOptions options)
Execute a data method (action or function) in the target system.
|
QueryResult |
executeQuery(DataQuery query)
|
QueryResult |
executeQuery(DataQuery query,
HttpHeaders headers)
|
QueryResult |
executeQuery(DataQuery query,
HttpHeaders headers,
RequestOptions options)
Execute a data query to get data from the target system.
|
DataMethod |
getDataMethod(java.lang.String name)
Lookup a data method by qualified name (for function/action definitions) or by unqualified name (for function/action imports).
|
EntitySet |
getEntitySet(java.lang.String name)
Lookup an entity set (or singleton entity) by name.
|
CsdlDocument |
getMetadata()
Service metadata.
|
java.lang.String |
getName()
Service name.
|
DataServiceProvider |
getProvider()
The data service provider.
|
boolean |
hasMetadata()
Has service metadata been loaded.
|
void |
loadEntity(EntityValue entity)
|
void |
loadEntity(EntityValue entity,
DataQuery query)
Reload an existing entity from the target system.
|
void |
loadMetadata()
Load service metadata (if not already loaded).
|
void |
loadProperty(Property property,
EntityValue into)
|
void |
loadProperty(Property property,
EntityValue into,
DataQuery query)
Load the value of a property into an existing entity.
|
void |
pingServer()
Ping the server.
|
void |
processBatch(RequestBatch batch)
|
void |
processBatch(RequestBatch batch,
HttpHeaders headers)
|
void |
processBatch(RequestBatch batch,
HttpHeaders headers,
RequestOptions options)
Execute a request batch in the target system.
|
void |
refreshMetadata()
Reload latest metadata from the backend server.
|
void |
saveEntity(EntityValue entity)
|
void |
saveEntity(EntityValue entity,
HttpHeaders headers)
|
void |
saveEntity(EntityValue entity,
HttpHeaders headers,
RequestOptions options)
Create (if
EntityValue.isNew ) or update (if existing) an entity in the target system. |
void |
unloadMetadata()
Unload service metadata (if previously loaded).
|
void |
updateEntity(EntityValue entity)
|
void |
updateEntity(EntityValue entity,
HttpHeaders headers)
|
void |
updateEntity(EntityValue entity,
HttpHeaders headers,
RequestOptions options)
Update an entity in the target system.
|
void |
updateLink(EntityValue from,
Property property,
EntityValue to)
|
void |
updateLink(EntityValue from,
Property property,
EntityValue to,
HttpHeaders headers)
|
void |
updateLink(EntityValue from,
Property property,
EntityValue to,
HttpHeaders headers,
RequestOptions options)
Update a link from a source entity to a target entity.
|
void |
uploadMedia(EntityValue entity,
StreamBase content)
|
void |
uploadMedia(EntityValue entity,
StreamBase content,
HttpHeaders headers)
|
void |
uploadMedia(EntityValue entity,
StreamBase content,
HttpHeaders headers,
RequestOptions options)
Upload content for a media entity to the target system.
|
void |
uploadStream(EntityValue entity,
StreamLink link,
StreamBase content)
|
void |
uploadStream(EntityValue entity,
StreamLink link,
StreamBase content,
HttpHeaders headers)
|
void |
uploadStream(EntityValue entity,
StreamLink link,
StreamBase content,
HttpHeaders headers,
RequestOptions options)
Upload content for a stream property to the target system.
|
public DataService(DataServiceProvider provider)
Construct a new data service using a specified provider.
provider
- Data service provider.public void applyChanges(ChangeSet changes)
public void applyChanges(ChangeSet changes, HttpHeaders headers)
public void applyChanges(ChangeSet changes, HttpHeaders headers, RequestOptions options)
Apply the changes from a change set to the target system.
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); }
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); }
changes
- The change set.headers
- Optional request-specific headers.options
- Optional request-specific options.public void createEntity(EntityValue entity)
public void createEntity(EntityValue entity, HttpHeaders headers)
public void createEntity(EntityValue entity, HttpHeaders headers, RequestOptions options)
Create an entity in the target system.
Automatically calls CsdlDocument.resolveEntity
to ensure that EntityValue.entitySet
is available.
public void createEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.createEntityExample"); { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Enterprise Inc."); customer.setContactName("Jean-Luc Picard"); service.createEntity(customer); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:565:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.createEntityExample"); } }
public void createEntityInSetExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.createEntityInSetExample"); { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCompanyName("Voyager Inc."); customer.setContactName("Kathryn Janeway"); service.createEntity(customer.inSet(NorthwindServiceMetadata.EntitySets.customers)); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:575:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.createEntityInSetExample"); } }
public void createEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:652:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.createEntityExample"); } }
public void createEntityInSetExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.createEntityInSetExample"); { 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, "Voyager Inc."); contactNameProperty.setString(customer, "Kathryn Janeway"); service.createEntity(customer.inSet(customersEntitySet)); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:666:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.createEntityInSetExample"); } }
entity
- Entity to be created.headers
- Optional request-specific headers.options
- Optional request-specific options.public void createLink(EntityValue from, Property property, EntityValue to)
public void createLink(EntityValue from, Property property, EntityValue to, HttpHeaders headers)
public void createLink(EntityValue from, Property property, EntityValue to, HttpHeaders headers, RequestOptions options)
Create a link from a source entity to a target entity in the target system.
public void createLinkExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:647:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.createLinkExample"); } }
public void createLinkExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:761:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.createLinkExample"); } }
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
- Optional request-specific headers.options
- Optional request-specific options.public void createMedia(EntityValue entity, StreamBase content)
public void createMedia(EntityValue entity, StreamBase content, HttpHeaders headers)
public void createMedia(EntityValue entity, StreamBase content, HttpHeaders headers, RequestOptions options)
Create a media entity with the specified content.
If the entity
has non-stream structural properties in addition to the key properties and media content, such as label
in 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.
public void createMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaProxyClient.createMediaExample"); { MediaService service = this.getService(); Image image = new Image(); image.setLabel("Smiley"); ByteStream content = ByteStream.fromBinary(com.sap.client.odata.v4.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaProxyClient.xs:50:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaProxyClient.createMediaExample"); } }
public void createMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaClient.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.client.odata.v4.core.StringFunction.toBinary(":-)")); content.setMediaType("text/plain"); service.createMedia(image, content); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaClient.xs:50:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaClient.createMediaExample"); } }
entity
- Entity to be created.content
- Initial content. Must be a ByteStream
or CharStream
. Will be closed before this function returns.headers
- Optional request-specific headers.options
- Optional request-specific options.public void createRelatedEntity(EntityValue entity, EntityValue parent, Property property)
public void createRelatedEntity(EntityValue entity, EntityValue parent, Property property, HttpHeaders headers)
public void createRelatedEntity(EntityValue entity, EntityValue parent, Property property, HttpHeaders headers, RequestOptions options)
Create an entity in the target system, related to a parent entity via a parent navigation property.
public void createRelatedEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:481:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.createRelatedEntityExample"); } }
public void createRelatedEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:539:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.createRelatedEntityExample"); } }
entity
- Entity to be created.parent
- Previously created parent entity.property
- Parent's navigation property.headers
- Optional request-specific headers.options
- Optional request-specific options.public void createRelatedMedia(EntityValue entity, StreamBase content, EntityValue parent, Property property)
public void createRelatedMedia(EntityValue entity, StreamBase content, EntityValue parent, Property property, HttpHeaders headers)
public void createRelatedMedia(EntityValue entity, StreamBase content, EntityValue parent, Property property, HttpHeaders headers, RequestOptions options)
Create an media entity in the target system, related to a parent entity via a parent navigation property.
public void createRelatedMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaProxyClient.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.client.odata.v4.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaProxyClient.xs:61:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaProxyClient.createRelatedMediaExample"); } }
public void createRelatedMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaClient.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.client.odata.v4.core.StringFunction.toBinary("Drawing Hands")); content.setMediaType("text/plain"); service.createRelatedMedia(image, content, artist, imagesProperty); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaClient.xs:64:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaClient.createRelatedMediaExample"); } }
entity
- Entity to be created.content
- Initial content. Must be a ByteStream
or CharStream
. Will be closed before this function returns.parent
- Previously created parent entity.property
- Parent's navigation property.headers
- Optional request-specific headers.options
- Optional request-specific options.public void deleteByQuery(DataQuery query)
public void deleteByQuery(DataQuery query, HttpHeaders headers)
public void deleteByQuery(DataQuery query, HttpHeaders headers, RequestOptions options)
Execute query to delete data from the target system.
query
- Data query specifying the information to be deleted.headers
- Optional request-specific headers.options
- Optional request-specific options.public void deleteEntity(EntityValue entity)
public void deleteEntity(EntityValue entity, HttpHeaders headers)
public void deleteEntity(EntityValue entity, HttpHeaders headers, RequestOptions options)
Delete an entity from the target system.
public void deleteEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:636:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.deleteEntityExample"); } }
public void deleteEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:746:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.deleteEntityExample"); } }
entity
- Entity to be deleted.headers
- Optional request-specific headers.options
- Optional request-specific options.public void deleteLink(EntityValue from, Property property)
public void deleteLink(EntityValue from, Property property, EntityValue to)
public void deleteLink(EntityValue from, Property property, EntityValue to, HttpHeaders headers)
public void deleteLink(EntityValue from, Property property, EntityValue to, HttpHeaders headers, RequestOptions options)
Delete a link from a source entity to a target entity.
public void deleteLinkExample1() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.deleteLinkExample1"); { NorthwindService service = this.getService(); Product product = service.getProduct(new DataQuery().top(1)); service.deleteLink(product, Product.supplier); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:665:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.deleteLinkExample1"); } }
public void deleteLinkExample2() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.deleteLinkExample2"); { 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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:674:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.deleteLinkExample2"); } }
public void deleteLinkExample1() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.deleteLinkExample1"); { 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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:787:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.deleteLinkExample1"); } }
public void deleteLinkExample2() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.deleteLinkExample2"); { 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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:799:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.deleteLinkExample2"); } }
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. Can be omitted for a single-valued navigation property.headers
- Optional request-specific headers.options
- Optional request-specific options.public void deleteStream(EntityValue entity, StreamLink link)
public void deleteStream(EntityValue entity, StreamLink link, HttpHeaders headers)
public void deleteStream(EntityValue entity, StreamLink link, HttpHeaders headers, RequestOptions options)
Delete the content of a stream property from the target system.
entity
- Entity containing the stream property whose content is to be deleted.link
- Stream link for the stream to be deleted.headers
- Optional request-specific headers.options
- Optional request-specific options.public ByteStream downloadMedia(EntityValue entity)
public ByteStream downloadMedia(EntityValue entity, HttpHeaders headers)
public ByteStream downloadMedia(EntityValue entity, HttpHeaders headers, 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.
public void downloadMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaProxyClient.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.client.odata.v4.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaProxyClient.xs:89:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaProxyClient.downloadMediaExample"); } }
public void downloadMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaClient.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.client.odata.v4.core.StringFunction.toBinary(";-)")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaClient.xs:105:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaClient.downloadMediaExample"); } }
entity
- Entity whose content is to be downloaded.headers
- Optional request-specific headers.options
- Optional request-specific options.public ByteStream downloadStream(EntityValue entity, StreamLink link)
public ByteStream downloadStream(EntityValue entity, StreamLink link, HttpHeaders headers)
public ByteStream downloadStream(EntityValue entity, StreamLink link, HttpHeaders headers, 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.
public void downloadStreamExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaProxyClient.downloadStreamExample"); { MediaService service = this.getService(); DataQuery query = new DataQuery().filter(Video.label.equal("Happy")) .top(1); Video video = service.getVideo(query); ByteStream stream = service.downloadStream(video, video.getContent()); byte[] data = stream.readAndClose(); assert BinaryOperator.equal(data, com.sap.client.odata.v4.core.StringFunction.toBinary("...")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaProxyClient.xs:118:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaProxyClient.downloadStreamExample"); } }
public void downloadStreamExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaClient.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("Happy")).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.client.odata.v4.core.StringFunction.toBinary("...")); assert NullableString.hasValue(stream.getMediaType(), "text/plain"); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaClient.xs:143:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaClient.downloadStreamExample"); } }
entity
- Entity containing the stream property whose content is to be downloaded.link
- Stream link for the stream to be downloaded.headers
- Optional request-specific headers.options
- Optional request-specific options.public DataValue executeMethod(DataMethod method)
public DataValue executeMethod(DataMethod method, ParameterList parameters)
public DataValue executeMethod(DataMethod method, ParameterList parameters, HttpHeaders headers)
public DataValue executeMethod(DataMethod method, ParameterList parameters, HttpHeaders headers, 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.
method
- Data method.parameters
- Method parameters.headers
- Optional request-specific headers.options
- Optional request-specific options.null
if the method has no result.public QueryResult executeQuery(DataQuery query)
public QueryResult executeQuery(DataQuery query, HttpHeaders headers)
public QueryResult executeQuery(DataQuery query, HttpHeaders headers, RequestOptions options)
Execute a data query to get data from the target system.
query
- Data query specifying the information to be returned.headers
- Optional request-specific headers.options
- Optional request-specific options.public DataMethod getDataMethod(java.lang.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 FatalException
will 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 the FatalException
by looking up data methods before calling this function like in the
following code snippet:
public void checkDataMethodExistsExample() { DataService service = this.getService(); com.sap.client.odata.v4.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 { } }
DataService.metadata
.dataMethods
, for looking up data methods that might not exist.
name
- Name of the data method to be returned.public EntitySet getEntitySet(java.lang.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 FatalException
will 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 the FatalException
by 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
is true
.
public void checkEntitySetExistsExample() { DataService service = this.getService(); if (service.getMetadata().getEntitySets().has("Categories")) { Ignore.valueOf_any(service.getEntitySet("Categories")); } else { } }
DataService.metadata
.entitySets
, for looking up entity sets that might not exist.
name
- Name of the entity set to be returned.public CsdlDocument getMetadata()
Service metadata.
public java.lang.String getName()
Service name.
public DataServiceProvider getProvider()
The data service provider.
public boolean hasMetadata()
Has service metadata been loaded.
public void loadEntity(EntityValue entity)
public void loadEntity(EntityValue entity, DataQuery query)
Reload an existing entity from the target system.
public void loadEntityExample() { NorthwindService service = this.getService(); Customer customer = new Customer(); customer.setCustomerID("ALFKI"); service.loadEntity(customer); this.showCustomer(customer); }
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); }
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).public void loadMetadata()
Load service metadata (if not already loaded).
public void loadProperty(Property property, EntityValue into)
public void loadProperty(Property property, EntityValue into, DataQuery query)
Load the value of a property into an existing entity. This can be applied to both structural and navigation properties.
public void loadPropertyExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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"))); List<Customer> customers = service.getCustomers(query); 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; } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:431:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.loadPropertyExample"); } }
public void loadPropertyInBatchExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); RequestBatch batch = new RequestBatch(); batch.addQuery(query1); batch.addQuery(query2); 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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:455:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.loadPropertyInBatchExample"); } }
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; }
public void loadPropertyInBatchExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:506:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.loadPropertyInBatchExample"); } }
property
- Property to load.into
- Existing entity.query
- (nullable) Optional data query, to specify loading criteria (especially for navigation properties).public void pingServer()
Ping the server.
public void processBatch(RequestBatch batch)
public void processBatch(RequestBatch batch, HttpHeaders headers)
public void processBatch(RequestBatch batch, HttpHeaders headers, RequestOptions options)
Execute a request batch in the target system.
public void processBatchExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); 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."); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:715:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.processBatchExample"); } }
public void processBatchExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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."); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:849:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.processBatchExample"); } }
batch
- The request batch.headers
- Optional request-specific headers.options
- Optional request-specific options.public 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, 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.
Compatible metadata changes include:
Other additions, changes, and removals are considered incompatible by default, including:
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. The hasOpenEnumerations
flag should only be explicitly set when using the dynamic API.
Explicitly setting the hasOpenEnumerations
flag 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 the canBeRemoved
flag 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 calling refreshMetadata
could result in runtime exceptions.
If refreshMetadata succeeds, then any added model elements will have isExtension == true
, and any removed model elements will have isRemoved == true
.
Changed model elements will not be distinguishable.
public void saveEntity(EntityValue entity)
public void saveEntity(EntityValue entity, HttpHeaders headers)
public void saveEntity(EntityValue entity, HttpHeaders headers, RequestOptions options)
Create (if EntityValue.isNew
) or update (if existing) an entity in the target system.
entity
- Entity to be created or updated.headers
- Optional request-specific headers.options
- Optional request-specific options.public void unloadMetadata()
Unload service metadata (if previously loaded).
public void updateEntity(EntityValue entity)
public void updateEntity(EntityValue entity, HttpHeaders headers)
public void updateEntity(EntityValue entity, HttpHeaders headers, RequestOptions options)
Update an entity in the target system.
public void updateEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:585:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.updateEntityExample"); } }
public void updateEntityExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:680:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.updateEntityExample"); } }
public void updateEntityWithReplaceExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.updateEntityWithReplaceExample"); { 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(); options.setUpdateMode(UpdateMode.REPLACE); service.updateEntity(customer, com.sap.client.odata.v4.http.HttpHeaders.empty, options); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:596:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.updateEntityWithReplaceExample"); } }
public void updateEntityWithReplaceExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.updateEntityWithReplaceExample"); { 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("Beverly Crusher")); EntityValue customer = service.executeQuery(query) .getRequiredEntity(); contactNameProperty.setString(customer, "William Riker"); RequestOptions options = new RequestOptions(); options.setUpdateMode(UpdateMode.REPLACE); service.updateEntity(customer, com.sap.client.odata.v4.http.HttpHeaders.empty, options); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:695:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.updateEntityWithReplaceExample"); } }
entity
- Entity to be updated.headers
- Optional request-specific headers.options
- Optional request-specific options.public void updateLink(EntityValue from, Property property, EntityValue to)
public void updateLink(EntityValue from, Property property, EntityValue to, HttpHeaders headers)
public void updateLink(EntityValue from, Property property, EntityValue to, HttpHeaders headers, RequestOptions options)
Update a link from a source entity to a target entity.
public void updateLinkExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindProxyClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindProxyClient.xs:656:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindProxyClient.updateLinkExample"); } }
public void updateLinkExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.NorthwindClient.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); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.NorthwindClient.xs:774:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.NorthwindClient.updateLinkExample"); } }
from
- Source entity for the link to be updated.property
- Source navigation property for the link to be updated. This must be a one-to-one navigation property.to
- Target entity for the link to be updated.headers
- Optional request-specific headers.options
- Optional request-specific options.public void uploadMedia(EntityValue entity, StreamBase content)
public void uploadMedia(EntityValue entity, StreamBase content, HttpHeaders headers)
public void uploadMedia(EntityValue entity, StreamBase content, HttpHeaders headers, 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
.
public void uploadMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaProxyClient.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.client.odata.v4.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaProxyClient.xs:78:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaProxyClient.uploadMediaExample"); } }
public void uploadMediaExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaClient.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.client.odata.v4.core.StringFunction.toBinary(";-)")); content.setMediaType("text/plain"); service.uploadMedia(image, content); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaClient.xs:91:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaClient.uploadMediaExample"); } }
content
- Upload stream content. Will be closed before this function returns.entity
- Entity whose content is to be uploaded.headers
- Optional request-specific headers.options
- Optional request-specific options.public void uploadStream(EntityValue entity, StreamLink link, StreamBase content)
public void uploadStream(EntityValue entity, StreamLink link, StreamBase content, HttpHeaders headers)
public void uploadStream(EntityValue entity, StreamLink link, StreamBase content, HttpHeaders headers, 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.
public void uploadStreamExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaProxyClient.uploadStreamExample"); { MediaService service = this.getService(); Video video = new Video(); video.setLabel("Happy"); ByteStream content = ByteStream.fromBinary(com.sap.client.odata.v4.core.StringFunction.toBinary("...")); content.setMediaType("text/plain"); service.createEntity(video); String oldTag = video.getContent().getEntityTag(); assert oldTag == null; service.uploadStream(video, video.getContent(), content); Video updated = service.getVideo(new DataQuery().load(video)); String newTag = updated.getContent().getEntityTag(); assert (newTag != null) && NullableString.notEqual(newTag, oldTag); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaProxyClient.xs:101:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaProxyClient.uploadStreamExample"); } }
public void uploadStreamExample() { try { com.sap.client.odata.v4.core.DebugConsole.traceIn("example.MediaClient.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.client.odata.v4.core.StringFunction.toBinary("...")); content.setMediaType("text/plain"); service.createEntity(video); StreamLink link = contentProperty.getStreamLink(video); String oldTag = link.getEntityTag(); assert oldTag == null; service.uploadStream(video, link, content); EntityValue updated = service.executeQuery(new DataQuery() .load(video)) .getRequiredEntity(); link = contentProperty.getStreamLink(updated); String newTag = link.getEntityTag(); assert (newTag != null) && NullableString.notEqual(newTag, oldTag); } } catch (java.lang.RuntimeException _tex_) { com.sap.client.odata.v4.core.Assert.error("/data/home/ppurple/xMDP/workspace/NAAS-Mobile-com.sap.odata.core.framework-OD-darwinintel64_ent_indirectshipment-darwinintel64_ent/src/main/xs/examples/example.MediaClient.xs:120:11", _tex_); throw _tex_; } finally { com.sap.client.odata.v4.core.DebugConsole.traceOut("example.MediaClient.uploadStreamExample"); } }
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. Will be closed before this function returns.headers
- Optional request-specific headers.options
- Optional request-specific options.