Announcement: You can find the guides for Commerce 7.5 and later on the new Elastic Path Documentation site. This site contains the guides for Commerce 6.13.0 through 7.4.1.Visit new site

This version of Elastic Path Commerce is no longer supported or maintained. To upgrade to the latest version, contact your Elastic Path representative.

ChangeSetService

ChangeSetService

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

Adding objects to a Change Set

  1. ChangeSetService changeSetService = beanFactory.getBean(ContextIdNames.CHANGESET_SERVICE);
  2. Map<String, String> metadata = new HashMap<String, String>();
  3.  
  4. changeSetService.addObjectToChangeSet(changeSetGuid, object, metadata);

Copy

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.

  1. Object domainObject
  2. ...
  3. ChangeSet changeSet = changeSetService.findChangeSet(domainObject);

Copy

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