java.lang.Object
org.fuin.cqrs4j.AbstractMultiCommandExecutor<CONTEXT,RESULT>
- Type Parameters:
CONTEXT- Type of context for the command execution.RESULT- Result of the command execution.
- All Implemented Interfaces:
CommandExecutor<CONTEXT,RESULT, Command>
- Direct Known Subclasses:
MultiCommandExecutor
public abstract class AbstractMultiCommandExecutor<CONTEXT,RESULT>
extends Object
implements CommandExecutor<CONTEXT,RESULT,Command>
Handles multiple commands by delegating the call to other executors.
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractMultiCommandExecutor(@NotEmpty List<CommandExecutor> cmdExecutors) Constructor with mandatory data.AbstractMultiCommandExecutor(@NotEmpty CommandExecutor... cmdExecutors) Constructor with command handler array. -
Method Summary
-
Constructor Details
-
AbstractMultiCommandExecutor
Constructor with command handler array.- Parameters:
cmdExecutors- Array of command executors.
-
AbstractMultiCommandExecutor
Constructor with mandatory data.- Parameters:
cmdExecutors- List of command executors.
-
-
Method Details
-
getCommandTypes
Description copied from interface:CommandExecutorReturns a list of commands this executor can handle.- Specified by:
getCommandTypesin interfaceCommandExecutor<CONTEXT,RESULT, Command> - Returns:
- List of unique command types.
-
execute
public final RESULT execute(CONTEXT ctx, Command cmd) throws org.fuin.ddd4j.ddd.AggregateVersionConflictException, org.fuin.ddd4j.ddd.AggregateNotFoundException, org.fuin.ddd4j.ddd.AggregateVersionNotFoundException, org.fuin.ddd4j.ddd.AggregateDeletedException, org.fuin.ddd4j.ddd.AggregateAlreadyExistsException, CommandExecutionFailedException Description copied from interface:CommandExecutorExecutes the given command. Only the main aggregate related exceptions are modeled via throws. All other checked exceptions must be wrapped into aCommandExecutionFailedException.- Specified by:
executein interfaceCommandExecutor<CONTEXT,RESULT, Command> - Parameters:
ctx- Context of the execute.cmd- Command to execute.- Returns:
- Result.
- Throws:
org.fuin.ddd4j.ddd.AggregateVersionConflictException- There is a conflict between an expected and an actual version for the aggregate targeted by the command.org.fuin.ddd4j.ddd.AggregateNotFoundException- The aggregate targeted by the command with a given type and identifier was not found in the repository.org.fuin.ddd4j.ddd.AggregateVersionNotFoundException- The requested version for the aggregate targeted by the command does not exist.org.fuin.ddd4j.ddd.AggregateDeletedException- The aggregate targeted by the command was deleted from the repository.org.fuin.ddd4j.ddd.AggregateAlreadyExistsException- The aggregate targeted by the command already exists when trying to create it.CommandExecutionFailedException- Other checked exceptions are wrapped into this one.
-