Obtaining the command context
Commands can obtain information from the command context. For example, available information includes the user's ID, the user object, the language identifier, and the store identifier. The command context must be set to a controller command before it is run. The following logic exists in the REST framework to facilitate the command context:
- A business context is created based on the resolved context data and activity token. A generic activity token is generated when no activity token is presented.
- The startRequest(ActivityToken, ActivityData) method is called on the Business Context Service (BCS) to indicate that a controller command or data bean is about to start.
- The created business context is associated to the controller command or the data bean manager.
- The controller command is run, or the data bean to run the action is activated.
- The endRequest(ActivityToken) method is called on the BCS to indicate that the operation is complete.