Create new BOD commands

The associated BOD command for the UpdateGiftRegistryCmd class is UpdateGiftRegistryBOD. You can create additional BOD commands for new services. As an example, this section illustrates how to create a new service to store a "fraud list". This is a list of e-mail addresses that you can use to restrict users, with a history of fraudulent or unethical behavior, from creating gift registries at your store. The example also discusses creating the new UpdateGiftRegistryFraudListCmd BOD command, with the following definition:

public class UpdateGiftRegistryFraudListCmdImpl 
 extends BusinessObjectDocumentCmdImpl 
 implements UpdateGiftRegistryFraudListCmd {

 public void performExecute() throws ECException {
  super.performExecute();

  // call several other task commands
  BusinessObjectDocument inputBOD = super.getRequestBOD();

  PersistGiftRegistryFraudListCmd cmd =
   (PersistGiftRegistryFraudListCmd)CommandFactory
   .createCommand(
PersistGiftRegistryFraudListCmd.NAME, 
getStoreId());
  cmd.setRequestBOD(getRequestBOD());
  cmd.setCommandContext(getCommandContext());
  cmd.execute();

  setResultBOD(cmd.getResultBOD());
 }
}

This code is called from the GiftRegistryServiceBeanBase, and calls other BOD task commands such as PersistGiftRegistryFraudListCmd. The PersistGiftRegistryFraudListCmd returns a confirmation BOD, and upon failure, this BOD is returned to the caller. The UpdateGiftRegistryFraudListCmdImpl may call several BOD subtasks to help complete its action. Each subtask is a potential customization point, where it can be extended, changed, or removed.