@Override public ScopeDescriptor describeScope() { return new AggregateScopeDescriptor(type(), this::identifier); }
/** * {@inheritDoc} * If this Builder is used to instantiate a {@link CachingEventSourcingRepository}, do note that an optimistic * locking strategy is not compatible with a caching approach. */ @Override public Builder<T> lockFactory(LockFactory lockFactory) { super.lockFactory(lockFactory); return this; }
@Override public Builder<T> parameterResolverFactory(ParameterResolverFactory parameterResolverFactory) { super.parameterResolverFactory(parameterResolverFactory); return this; }
static class Create { @TargetAggregateIdentifier String id; public Create(String id) { this.id = id; } }
@Override public Builder<T> aggregateModel(AggregateModel<T> aggregateModel) { super.aggregateModel(aggregateModel); return this; }
/** * Marks this aggregate as deleted, instructing a repository to remove that aggregate at an appropriate time. * <p/> * Note that different repository implementations may react differently to aggregates marked for deletion. * Typically, Event Sourced Repositories will ignore the marking and expect deletion to be provided as part of Event * information. */ public static void markDeleted() { getInstance().doMarkDeleted(); }
@Override public Builder<T> handlerDefinition(HandlerDefinition handlerDefinition) { super.handlerDefinition(handlerDefinition); return this; }
/** * Activates this lifecycle instance. Any invocations to static AggregateLifecycle methods will use this instance * until {@link #close()} is called. */ public void activate() { super.startScope(); this.registration = () -> super.endScope(); }
/** * Initializes a {@link AnnotationCommandTargetResolver} as specified through this Builder. * * @return a {@link AnnotationCommandTargetResolver} as specified through this Builder */ public AnnotationCommandTargetResolver build() { return new AnnotationCommandTargetResolver(this); } }
@Override public Builder<T> aggregateModel(AggregateModel<T> aggregateModel) { super.aggregateModel(aggregateModel); return this; }
@Override public Builder<T> parameterResolverFactory(ParameterResolverFactory parameterResolverFactory) { super.parameterResolverFactory(parameterResolverFactory); return this; }
@Override public Builder<T> handlerDefinition(HandlerDefinition handlerDefinition) { super.handlerDefinition(handlerDefinition); return this; }
static class ShowItems { @TargetAggregateIdentifier String id; String message; public ShowItems(String id, String message) { this.id = id; this.message = message; } }
/** * Creates a builder for a Repository for given {@code aggregateType}. * * @param aggregateType the {@code aggregateType} specifying the type of aggregate this {@link Repository} will * store */ protected Builder(Class<T> aggregateType) { super(aggregateType); super.lockFactory(NullLockFactory.INSTANCE); }
public static class FailingCreateCommand { @TargetAggregateIdentifier private final String id; public FailingCreateCommand(String id) { this.id = id; } }
static class Crash { @TargetAggregateIdentifier String id; public Crash(String id) { this.id = id; } }
static class Hello { @TargetAggregateIdentifier String id; public Hello(String id) { this.id = id; } }
public static class CreatePageCommand { @TargetAggregateIdentifier private final String bookId; private CreatePageCommand(String bookId) { this.bookId = bookId; } public String getBookId() { return bookId; } }
public static class FailCommand { @TargetAggregateIdentifier private final String id; public FailCommand(String id) { this.id = id; } }
private static class TriggerDeadlineInChildEntityCommand { @TargetAggregateIdentifier private final String id; private TriggerDeadlineInChildEntityCommand(String id) { this.id = id; } }