Develop > Business logic layer > Name-value pair command framework
Customize existing controller commands
A controller command encapsulates the business logic for a business process. Individual units of work within the business process may be performed by task commands. As such, there are several ways in which a controller command can be customized, some of which involve customizing task commands.
- Add new business logic to a controller command
New business logic can be added before existing business logic, after existing logic, or both before and after. Suppose there is an existing WebSphere Commerce controller command, called ExistingControllerCmd. Following the WebSphere Commerce naming conventions, this controller command would have an interface class named ExistingControllerCmd and an implementation class named ExistingControllerCmdImpl. Now assume that a business requirement arises and add new business logic to this existing command. One portion of the logic must be executed before the existing command logic and another portion must be executed after the existing command logic.
- Replace task commands called by a controller command
Replacing task commands allows you to modify how a particular step in the business process is performed. A controller command often calls several task commands that perform individual tasks. Collectively, these tasks make up the business process represented by the controller command. You may need to change the way in which a particular step in the process is performed, rather than adding new business logic to the beginning or end of the controller command. In this case, replace the implementation of the task command that to override, with the implementation of a new task command that performs the task in the desired manner.
- Replace the view called by a controller command
To replace the view that is called by a controller command, create a new implementation class for the controller command. For example, create a new ModifiedControllerCmdImpl that extends ExistingControllerCmdImpl and implements the ExistingControllerCmd interface. Note that this is only applicable to the Web application layer.
Related concepts
Controller command programming model
Related information
Create a new controller command