CommandExecutorService
Provides a mechanism to execute a Command .
API
interface CommandExecutorService {
Try<Bookmark> executeCommand(InteractionContextPolicy interactionContextPolicy, Command command) (1)
Try<Bookmark> executeCommand(InteractionContextPolicy interactionContextPolicy, CommandDto commandDto) (2)
Try<Bookmark> executeCommand(Command command) (3)
Try<Bookmark> executeCommand(CommandDto commandDto) (4)
}
1 | executeCommand(InteractionContextPolicy, Command)
Executes the specified Command using the required InteractionContextPolicy , updating the Command (or its persistent equivalent) afterwards (for example, setting its Command#getCommandDto() commandDto field. |
2 | executeCommand(InteractionContextPolicy, CommandDto)
Executes the specified command (represented as a CommandDto using the required InteractionContextPolicy . |
3 | executeCommand(Command)
As per #executeCommand(InteractionContextPolicy, Command) , with a policy of InteractionContextPolicy#NO_SWITCH no switch . |
4 | executeCommand(CommandDto)
As per #executeCommand(InteractionContextPolicy, CommandDto) , with a policy of InteractionContextPolicy#NO_SWITCH no switch . |
Members
executeCommand(InteractionContextPolicy, Command)
Executes the specified Command using the required InteractionContextPolicy , updating the Command (or its persistent equivalent) afterwards (for example, setting its Command#getCommandDto() commandDto field.
executeCommand(InteractionContextPolicy, CommandDto)
Executes the specified command (represented as a CommandDto using the required InteractionContextPolicy .
THIS METHOD HAS SIGNIFICANT SIDE-EFFECTS. Specifically, the Command of the executing thread (obtained using org.apache.causeway.applib.services.iactn.InteractionProvider to obtain the Interaction , and then Interaction#getCommand() to obtain the Command ) will be UPDATED to hold the CommandDto passed in. |
executeCommand(Command)
As per #executeCommand(InteractionContextPolicy, Command) , with a policy of InteractionContextPolicy#NO_SWITCH no switch .
Note that this method updates the Command as a side-effect.
executeCommand(CommandDto)
As per #executeCommand(InteractionContextPolicy, CommandDto) , with a policy of InteractionContextPolicy#NO_SWITCH no switch .
THIS METHOD HAS SIGNIFICANT SIDE-EFFECTS. Specifically, the Command of the executing thread (obtained using org.apache.causeway.applib.services.iactn.InteractionProvider to obtain the Interaction , and then Interaction#getCommand() to obtain the Command ) will be UPDATED to hold the CommandDto passed in. |
Implementation
The Core Runtime Services module provides a default implementation of this service, CommandExecutorServiceDefault.
Usage
The CommandExecutorService
domain service is provides the ability to execute a specified Command, optionally running the command with the identity of the user captured in that Command.
One use case is the RunBackgroundCommandsJob provided by Command Log extension. This picks up commands persisted as "background" CommandLogEntrys, and executes them against their target domain object.