Elastic Path Commerce Development

ChangeSetService

ChangeSetService

The ChangeSetService provides methods for adding objects to and removing objects from Change Sets.

Adding objects to a Change Set

ChangeSetService changeSetService = beanFactory.getBean(ContextIdNames.CHANGESET_SERVICE);
Map<String, String> metadata = new HashMap<String, String>();

changeSetService.addObjectToChangeSet(changeSetGuid, object, metadata);

changeSetGuid is the Change Set GUID. The object parameter can be either a domain object (Product, Category, etc.) or a BusinessObjectDescriptor. The metadata map can be used to pass information during synchronization, for example, to pass Change Set update information to the Data Sync Tool.

Finding an object's Change Sets

An object can only belong to one active (non-finalized) Change Set at any given time. Use the ChangeSetService's findChangeSet methods to get an object's active Change Set.

Object domainObject
...
ChangeSet changeSet = changeSetService.findChangeSet(domainObject);

findChangeSet can take either a domain object (Product, Category, etc.) or a BusinessObjectDescriptor as a parameter.