Search in sources :

Example 1 with AggregateStateId

use of io.spine.server.stand.AggregateStateId in project core-java by SpineEventEngine.

the class RecordStorage method writeLifecycleFlags.

@Override
public void writeLifecycleFlags(I id, LifecycleFlags flags) {
    final Optional<EntityRecord> optional = read(id);
    if (optional.isPresent()) {
        final EntityRecord record = optional.get();
        final EntityRecord updated = record.toBuilder().setLifecycleFlags(flags).build();
        write(id, updated);
    } else {
        // The AggregateStateId is a special case, which is not handled by the Identifier class.
        final String idStr = id instanceof AggregateStateId ? id.toString() : idToString(id);
        throw newIllegalStateException("Unable to load record for entity with ID: %s", idStr);
    }
}
Also used : EntityRecord(io.spine.server.entity.EntityRecord) Identifiers.idToString(io.spine.base.Identifiers.idToString) AggregateStateId(io.spine.server.stand.AggregateStateId)

Aggregations

Identifiers.idToString (io.spine.base.Identifiers.idToString)1 EntityRecord (io.spine.server.entity.EntityRecord)1 AggregateStateId (io.spine.server.stand.AggregateStateId)1