Class DataService

  • All Implemented Interfaces:

    
    public class DataService
    
                        

    Encapsulates an OData data service.

    • 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);
      }
      
    • 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, @NonNull() @NotNull() HttpHeaders headers, @NonNull() @NotNull() RequestOptions options)

        Activate a draft entity.

        • 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.

        • 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.

        • 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, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)

        Apply the changes from a change set to the target system.

        • 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.

        • 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.

        • 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.
      • 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.

        • 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.

        • 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.

        • 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, @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, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() 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.

        • 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 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.

        • 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 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.

        • 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, @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, @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, @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, @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, @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, @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, @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, @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.

        • 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.

        • 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.

        • 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, @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 null if 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 null if 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 null if the method has no result.

      • 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.

      • 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 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:

        • 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..
              }
          }
          
        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 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.

        • 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..
              }
          }
          
        Parameters:
        name - Name of the entity set to be returned.
        Returns:

        The entity set, which must exist.

      • getName

        @NonNull()@NotNull() String getName()

        Return service name.

        Returns:

        Service name.

      • isClientRegistered

         boolean isClientRegistered()

        Checks locally whether a previous DataService.registerClient call successfuly created a client registration for the remote OData service.

        Returns:

        true if a registration was already established.

      • 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.
      • 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);
          }
          
        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);
          }
          
        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);
          }
          
        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, @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.

        • 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.

        • 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.

        • 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(@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, @Nullable() @Nullable() HttpHeaders headers, @Nullable() @Nullable() RequestOptions options)

        Execute a request batch in the target system.

        • 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.

        • 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.

        • 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. 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.

      • 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. 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.

      • 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. 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.

      • 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 a ClientRegistrationSet entity set with entity type ClientRegistration, a key property named ClientID of type long (Edm.Int64), and a property named ClientGUID of type guid (Edm.Guid). If a new registration is successfully created, ServiceOptions.clientInstanceID is set, and will subsequently be used to populate the Client-Instance-ID HTTP 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 of ClientRegistration entity 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 a ClientRegistrationSet entity set with entity type ClientRegistration, a key property named ClientID of type long (Edm.Int64), and a property named ClientGUID of type guid (Edm.Guid). If a new registration is successfully created, ServiceOptions.clientInstanceID is set, and will subsequently be used to populate the Client-Instance-ID HTTP 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 of ClientRegistration entity 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 a ClientRegistrationSet entity set with entity type ClientRegistration, a key property named ClientID of type long (Edm.Int64), and a property named ClientGUID of type guid (Edm.Guid). If a new registration is successfully created, ServiceOptions.clientInstanceID is set, and will subsequently be used to populate the Client-Instance-ID HTTP 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 of ClientRegistration entity type.
      • 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.
      • 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 deleteFromServer parameter is true.

        Parameters:
        deleteFromServer - Specify a value of true to 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 deleteFromServer parameter is true.

        Parameters:
        deleteFromServer - Specify a value of true to 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 deleteFromServer parameter is true.

        Parameters:
        deleteFromServer - Specify a value of true to request the server to also delete the corresponding entity.
      • 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, @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, @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, @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.

        • 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.

        • 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.

        • 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.