Managing Business Objects

The WorkflowService provides methods to create, update and delete business object instances.

Creating a new Business Object Instance

The following method creates a new business object instance in case it does not exist:

BusinessObject createBusinessObjectInstance(String qualifiedBusinessObjectId, Object initialValue);

The business object is created for the specified qualified Id of the business object with a given initial value. The initial value can also be null.

Usage:

org.eclipse.stardust.engine.api.runtime.WorkflowService service;

org.eclipse.stardust.engine.api.runtime.BusinessObject bo=service.createBusinessObjectInstance(qualifiedBusinessObjectId, initialValue)

This method requires execution permission modifyDataValues.

Updating the Value of a Business Object Instance

The following method updates the value of an existing business object instance having a specific qualified Id with a new given value.

BusinessObject updateBusinessObjectInstance(String qualifiedBusinessObjectId, Object newValue);

This method requires execution permission modifyDataValues.

Usage:

org.eclipse.stardust.engine.api.runtime.WorkflowService service;

org.eclipse.stardust.engine.api.runtime.BusinessObject bo=service.updateBusinessObjectInstance(qualifiedBusinessObjectId, newValue);

Deleting a Business Object Instance

To delete a business object instance with a specific qualified business object Id and the primary key identifying the instance, use the following method:

void deleteBusinessObjectInstance(String qualifiedBusinessObjectId, Object primaryKey);

This method also requires execution permission modifyDataValues.

Usage:

org.eclipse.stardust.engine.api.runtime.WorkflowService service;

service.deleteBusinessObjectInstance(qualifiedBusinessObjectId, primaryKey);

REST Endpoints exposed by the Business Object Management Service

The following endpoints are exposed by the Business Object Management Service:

/language
/{bundleName}/{locale}

/businessObject.json (GET)
/businessObject/{businessObjectQualifiedId}.json (GET)
/businessObject/{businessObjectQualifiedId}/instances.json (GET)

/businessObject/{businessObjectQualifiedId}/relationships.json (GET)
/businessObject/{businessObjectQualifiedId}/instance/{primaryKey}.json (PUT, POST and DELETE)
/businessObject/{businessObjectQualifiedId}/{primaryKey}/processInstances.json (GET)
/businessObject/{businessObjectQualifiedId}/relatedInstances.json (POST)
/businessObject/{businessObjectQualifiedId}.form-data (POST)

The invocation pattern is the following:

http://<serverName>:<port>/<context-root>/services/rest/business-object-management/<endpoint>

The following example invocation pattern invokes the json source for a Business Object FundData in a model with id NewSimpleModel1:

http://localhost:8080/DemoProject/services/rest/business-object-management/businessObject/{NewSimpleModel1}FundData.json

Business Object Instances Endpoints

To retrieve Business Object instances of a Business Object, you can use query parameters to filter the query result. Example usage in a class:

   url = this.rootUrl
      + "/services/rest/business-object-management/businessObject/"
      + businessObject.businessObjectQualifiedId + "/instances.json" + queryString;
   
   $http({
      url : url,
      method : "GET"
   })

The following URL returns all Business Object instances with ID 123 of Business Object FundData in model NewSimpleModel1:

http://localhost:8080/DemoProject/services/rest/business-object-management/businessObject/{NewSimpleModel1}FundData/instances.json?ID=123&