Search in sources :

Example 1 with Assign

use of io.spine.server.command.Assign in project core-java by SpineEventEngine.

the class AmishAggregate method handle.

@Assign
List<Message> handle(AggCancelProject cmd, CommandContext ctx) {
    final AggProjectPaused firstPaused = projectPaused(cmd.getProjectId());
    final AggProjectCancelled thenCancelled = projectCancelled(cmd.getProjectId());
    return Lists.<Message>newArrayList(firstPaused, thenCancelled);
}
Also used : AggProjectCancelled(io.spine.test.aggregate.event.AggProjectCancelled) AggProjectPaused(io.spine.test.aggregate.event.AggProjectPaused) Message(com.google.protobuf.Message) Assign(io.spine.server.command.Assign)

Example 2 with Assign

use of io.spine.server.command.Assign in project core-java by SpineEventEngine.

the class TaskAggregate method handle.

@Assign
AggTaskAssigned handle(AggAssignTask command) {
    final AggTaskId id = command.getTaskId();
    final UserId newAssignee = command.getAssignee();
    final UserId previousAssignee = getState().getAssignee();
    final AggTaskAssigned event = taskAssigned(id, previousAssignee, newAssignee);
    return event;
}
Also used : UserId(io.spine.core.UserId) AggTaskAssigned(io.spine.test.aggregate.event.AggTaskAssigned) AggTaskId(io.spine.test.aggregate.task.AggTaskId) Assign(io.spine.server.command.Assign)

Example 3 with Assign

use of io.spine.server.command.Assign in project core-java by SpineEventEngine.

the class TestAggregate method handle.

@Assign
AggProjectCreated handle(AggCreateProject cmd, CommandContext ctx) {
    isCreateProjectCommandHandled = true;
    final AggProjectCreated event = projectCreated(cmd.getProjectId(), cmd.getName());
    return event;
}
Also used : AggProjectCreated(io.spine.test.aggregate.event.AggProjectCreated) Assign(io.spine.server.command.Assign)

Example 4 with Assign

use of io.spine.server.command.Assign in project core-java by SpineEventEngine.

the class TestAggregate method handle.

@Assign
List<AggProjectStarted> handle(AggStartProject cmd, CommandContext ctx) {
    isStartProjectCommandHandled = true;
    final AggProjectStarted message = projectStarted(cmd.getProjectId());
    return newArrayList(message);
}
Also used : AggProjectStarted(io.spine.test.aggregate.event.AggProjectStarted) Assign(io.spine.server.command.Assign)

Example 5 with Assign

use of io.spine.server.command.Assign 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;
}
Also used : UserId(io.spine.core.UserId) AggTaskAssigned(io.spine.test.aggregate.event.AggTaskAssigned) AggCannotReassignUnassignedTask(io.spine.test.aggregate.rejection.AggCannotReassignUnassignedTask) AggTaskId(io.spine.test.aggregate.task.AggTaskId) Assign(io.spine.server.command.Assign)

Aggregations

Assign (io.spine.server.command.Assign)7 UserId (io.spine.core.UserId)3 AggTaskAssigned (io.spine.test.aggregate.event.AggTaskAssigned)3 AggTaskId (io.spine.test.aggregate.task.AggTaskId)3 Message (com.google.protobuf.Message)1 AggProjectCancelled (io.spine.test.aggregate.event.AggProjectCancelled)1 AggProjectCreated (io.spine.test.aggregate.event.AggProjectCreated)1 AggProjectPaused (io.spine.test.aggregate.event.AggProjectPaused)1 AggProjectStarted (io.spine.test.aggregate.event.AggProjectStarted)1 AggTaskAdded (io.spine.test.aggregate.event.AggTaskAdded)1 AggTaskCreated (io.spine.test.aggregate.event.AggTaskCreated)1 AggCannotReassignUnassignedTask (io.spine.test.aggregate.rejection.AggCannotReassignUnassignedTask)1