use of io.spine.base.CommandId in project core-java by SpineEventEngine.
the class CommandScheduler method isScheduledAlready.
private static boolean isScheduledAlready(Command command) {
final CommandId id = command.getId();
final boolean isScheduledAlready = scheduledCommandIds.contains(id);
return isScheduledAlready;
}
use of io.spine.base.CommandId in project core-java by SpineEventEngine.
the class CommandStore method updateCommandStatus.
// OK for this consolidated error handling.
@SuppressWarnings("ChainOfInstanceofChecks")
public void updateCommandStatus(CommandEnvelope commandEnvelope, Throwable cause, Log log) {
final Message commandMessage = commandEnvelope.getMessage();
final CommandId commandId = commandEnvelope.getCommandId();
if (cause instanceof FailureThrowable) {
final FailureThrowable failure = (FailureThrowable) cause;
log.failureHandling(failure, commandMessage, commandId);
updateStatus(commandEnvelope, failure.toFailure(commandEnvelope.getCommand()));
} else if (cause instanceof Exception) {
final Exception exception = (Exception) cause;
log.errorHandling(exception, commandMessage, commandId);
updateStatus(commandEnvelope, exception);
} else {
log.errorHandlingUnknown(cause, commandMessage, commandId);
final Error error = Errors.fromThrowable(cause);
updateStatus(commandEnvelope, error);
}
}
use of io.spine.base.CommandId in project core-java by SpineEventEngine.
the class Entity method createForError.
static Entity createForError(Command command, Error error) {
checkNotNull(command);
checkNotNull(error);
final CommandId id = Records.getOrGenerateCommandId(command);
final Entity result = create(id);
result.setError(id, command, error);
return result;
}
use of io.spine.base.CommandId in project core-java by SpineEventEngine.
the class Entity method createForStatus.
static Entity createForStatus(Command command, CommandStatus status) {
checkNotNull(command);
checkNotNull(status);
final CommandId commandId = command.getId();
final Entity entity = create(commandId);
entity.setCommandAndStatus(command, status);
return entity;
}
use of io.spine.base.CommandId in project core-java by SpineEventEngine.
the class TestActorRequestFactory method createCommandId.
public CommandId createCommandId() {
final String uid = Identifiers.newUuid();
final CommandId commandId = CommandId.newBuilder().setUuid(uid).build();
return commandId;
}
Aggregations