Adding post-processing business logic for Change and Sync services

The PostChangeNounPartCmd extension point allows you to add custom business logic that is performed after the Change or Sync service processing is complete.

About this task

You can have logic that executes after each part is updated.

Procedure

  1. Create an interface for your PostChangeNounPartCmd that extends the following interface: com.ibm.commerce.infrastructure.facade.server.commands.ChangeOnlineStorePartPostActionCmd.
  2. Create a class that implements your PostChangeNounPartCmd. The class must extend com.ibm.commerce.infrastructure.facade.server.commands.AbstractChangeNounPartPostActionCmdImpl.
  3. In your Post Part Change command implementation, create a performExecute() method. This method should include the extra logic you want to execute after your part is changed. You can use the getNoun and getActionExpressions() methods to get details on the object that is being updated.
  4. Register your new command in the Command Registry. The default * interface name is the same interface name of the current implementation class with * PostPartAction occurring before Cmd. For example, for the ChangeOnlineStore service, it will be com.ibm.commerce.infrastructure.facade.server.commands.ChangeOnlineStorePartPostActionCmd . For more information see the getChangeNounPartPostActionCommandInterface method of com.ibm.commerce.foundation.server.command.bod.AbstractChangeBusinessObjectDocumentCmdImpl Since you can have multiple parts for each noun, the interface must also include the XPath of the noun part. A full example interface would be: com.ibm.commerce.infrastructure.facade.server.commands.ChangeOnlineStorePartPostActionCmd+/OnlineStore[]/OnlineStoreContactInfo[] .
  5. Restart your server to pick up the changed configuration.