Replacing business logic of an existing task command
To replace the business logic of an existing task command, we must create a new implementation class for the task command. This new implementation class must extend from the existing task command but it should not implement the existing interface. Additionally, in the new implementation class, do not call the performExecute method of the superclass.
About this task
While extending from the exact command that we are replacing may seem counter-intuitive, the reason for taking this approach is related to support for future versions of WebSphere Commerce. This approach shields your code from changes that may be made to command interfaces in future versions of WebSphere Commerce.
As an example, suppose we wanted to replace the business logic of the OrderNotifyCmdImpl task command. In this case, you would create a new task command called CustomizedOrderNotifyCmdImpl. This command extends OrderNotifyCmdImpl. In the new CustomizedOrderNotifyCmdImpl, you create the new business logic, but do not call the performExecute method from the superclass. If a future version of WebSphere Commerce then introduces a new method, called newMethod in the interface, the corresponding version of the OrderNotifyCmdImpl command will include a default implementation of the newMethod method. Then, since your new command extends from OrderNotifyCmdImpl, the compiler will find the default implementation of this new method in the OrderNotifyCmdImpl command and your new command is shielded from the interface change.
Related tasks
Customizing existing task commands