use of io.spine.test.aggregate.rejection.AggCannotReassignUnassignedTask in project core-java by SpineEventEngine.
the class TaskAggregate method handle.
@Assign
AggTaskAssigned handle(AggReassignTask command) throws AggCannotReassignUnassignedTask {
final AggTaskId id = command.getTaskId();
final UserId newAssignee = command.getAssignee();
final UserId previousAssignee = getState().getAssignee();
if (previousAssignee.equals(EMPTY_USER_ID)) {
throw new AggCannotReassignUnassignedTask(id, previousAssignee);
}
final AggTaskAssigned event = taskAssigned(id, previousAssignee, newAssignee);
return event;
}
Aggregations