Module org.fuin.cqrs4j
Package org.fuin.cqrs4j
Class AbstractAggregateCommand<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId>
java.lang.Object
org.fuin.ddd4j.ddd.AbstractEvent
org.fuin.cqrs4j.AbstractCommand
org.fuin.cqrs4j.AbstractAggregateCommand<ROOT_ID,ENTITY_ID>
- Type Parameters:
ROOT_ID- Type of the aggregate root identifier.ENTITY_ID- Type of the identifier (the last one in the path).
- All Implemented Interfaces:
Serializable,AggregateCommand<ROOT_ID,,ENTITY_ID> Command,org.fuin.ddd4j.ddd.DomainEvent<ENTITY_ID>,org.fuin.ddd4j.ddd.Event
public abstract class AbstractAggregateCommand<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId>
extends AbstractCommand
implements AggregateCommand<ROOT_ID,ENTITY_ID>
Base class for all commands that are directed to an existing aggregate.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAbstractAggregateCommand.Builder<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId, TYPE extends AbstractAggregateCommand<ROOT_ID, ENTITY_ID>, BUILDER extends AbstractCommand.Builder<ROOT_ID, TYPE, BUILDER>> Base class for event builders. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor for JAXB.AbstractAggregateCommand(@NotNull org.fuin.ddd4j.ddd.AggregateRootId aggregateRootId, org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion) Constructor with aggregate root id and version.AbstractAggregateCommand(@NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath, org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion) Constructor with entitiy id path and version.AbstractAggregateCommand(@NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath, org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion, @NotNull org.fuin.ddd4j.ddd.Event respondTo) Constructor with event this one responds to.AbstractAggregateCommand(@NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath, org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion, org.fuin.ddd4j.ddd.EventId correlationId, org.fuin.ddd4j.ddd.EventId causationId) Constructor with optional data. -
Method Summary
Methods inherited from class org.fuin.ddd4j.ddd.AbstractEvent
equals, getCausationId, getCorrelationId, getEventId, getEventTimestamp, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.fuin.ddd4j.ddd.Event
getCausationId, getCorrelationId, getEventId, getEventTimestamp, getEventType
-
Constructor Details
-
AbstractAggregateCommand
protected AbstractAggregateCommand()Default constructor for JAXB. -
AbstractAggregateCommand
public AbstractAggregateCommand(@NotNull @NotNull org.fuin.ddd4j.ddd.AggregateRootId aggregateRootId, @Nullable org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion) Constructor with aggregate root id and version.- Parameters:
aggregateRootId- Aggregate root identifier.aggregateVersion- Expected aggregate version.
-
AbstractAggregateCommand
public AbstractAggregateCommand(@NotNull @NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath, @Nullable org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion) Constructor with entitiy id path and version.- Parameters:
entityIdPath- Path from root aggregate to target entity.aggregateVersion- Expected aggregate version.
-
AbstractAggregateCommand
public AbstractAggregateCommand(@NotNull @NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath, @Nullable org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion, @NotNull @NotNull org.fuin.ddd4j.ddd.Event respondTo) Constructor with event this one responds to. Convenience method to set the correlation and causation identifiers correctly.- Parameters:
entityIdPath- Path from root aggregate to target entity.aggregateVersion- Expected aggregate version.respondTo- Causing event.
-
AbstractAggregateCommand
public AbstractAggregateCommand(@NotNull @NotNull org.fuin.ddd4j.ddd.EntityIdPath entityIdPath, @Nullable org.fuin.ddd4j.ddd.AggregateVersion aggregateVersion, @Nullable org.fuin.ddd4j.ddd.EventId correlationId, @Nullable org.fuin.ddd4j.ddd.EventId causationId) Constructor with optional data.- Parameters:
entityIdPath- Path from root aggregate to target entity.aggregateVersion- Expected aggregate version.correlationId- Correlation ID.causationId- ID of the event that caused this one.
-
-
Method Details
-
getEntityIdPath
@NotNull public final @NotNull org.fuin.ddd4j.ddd.EntityIdPath getEntityIdPath()- Specified by:
getEntityIdPathin interfaceorg.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
-
getEntityId
- Specified by:
getEntityIdin interfaceorg.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
-
getAggregateRootId
Description copied from interface:AggregateCommandReturns the identifier of the aggregate root this command targets.- Specified by:
getAggregateRootIdin interfaceAggregateCommand<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId,ENTITY_ID extends org.fuin.ddd4j.ddd.EntityId> - Returns:
- Aggregate root identifier.
-
getAggregateVersion
@Nullable public final org.fuin.ddd4j.ddd.AggregateVersion getAggregateVersion()- Specified by:
getAggregateVersionin interfaceorg.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
-
getAggregateVersionInteger
- Specified by:
getAggregateVersionIntegerin interfaceorg.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
-