Search in sources :

Example 16 with TenantAwareOperation

use of io.spine.server.tenant.TenantAwareOperation in project core-java by SpineEventEngine.

the class CommandStore method updateStatus.

/**
 * Updates the status of the command with the passed error.
 *
 * @param commandEnvelope the ID of the command
 * @param error           the error, which occurred during command processing
 */
private void updateStatus(CommandEnvelope commandEnvelope, final Error error) {
    keepTenantId(commandEnvelope.getCommand());
    final TenantAwareOperation op = new CommandOperation(commandEnvelope.getCommand()) {

        @Override
        public void run() {
            repository.updateStatus(commandId(), error);
        }
    };
    op.execute();
}
Also used : CommandOperation(io.spine.server.tenant.CommandOperation) TenantAwareOperation(io.spine.server.tenant.TenantAwareOperation)

Example 17 with TenantAwareOperation

use of io.spine.server.tenant.TenantAwareOperation in project core-java by SpineEventEngine.

the class CommandStore method store.

/**
 * Stores a command with the error status.
 *
 * @param command a command to store
 * @param error an error occurred
 */
public void store(final Command command, final Error error) {
    keepTenantId(command);
    final TenantAwareOperation op = new Operation(this, command) {

        @Override
        public void run() {
            repository.store(command, error);
        }
    };
    op.execute();
}
Also used : TenantAwareOperation(io.spine.server.tenant.TenantAwareOperation) CommandOperation(io.spine.server.tenant.CommandOperation) TenantAwareOperation(io.spine.server.tenant.TenantAwareOperation)

Example 18 with TenantAwareOperation

use of io.spine.server.tenant.TenantAwareOperation in project core-java by SpineEventEngine.

the class CommandStore method setCommandStatusOk.

/**
 * Sets the status of the command to {@link CommandStatus#OK}
 */
public void setCommandStatusOk(CommandEnvelope commandEnvelope) {
    keepTenantId(commandEnvelope.getCommand());
    final TenantAwareOperation op = new Operation(this, commandEnvelope) {

        @Override
        public void run() {
            repository.setOkStatus(commandId());
        }
    };
    op.execute();
}
Also used : TenantAwareOperation(io.spine.server.tenant.TenantAwareOperation) CommandOperation(io.spine.server.tenant.CommandOperation) TenantAwareOperation(io.spine.server.tenant.TenantAwareOperation)

Aggregations

TenantAwareOperation (io.spine.server.tenant.TenantAwareOperation)18 CommandOperation (io.spine.server.tenant.CommandOperation)7 Event (io.spine.core.Event)4 TenantId (io.spine.core.TenantId)2 EventOperation (io.spine.server.tenant.EventOperation)2 Test (org.junit.Test)2 Subscription (io.spine.client.Subscription)1 Command (io.spine.core.Command)1 ProjectAggregate (io.spine.server.aggregate.given.AggregateRepositoryTestEnv.ProjectAggregate)1 TenantAwareFunction0 (io.spine.server.tenant.TenantAwareFunction0)1 Iterator (java.util.Iterator)1