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 Classes
    Modifier and Type
    Class
    Description
    protected static class 
    AbstractAggregateCommand.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

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default 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

    Modifier and Type
    Method
    Description
    final ROOT_ID
    Returns the identifier of the aggregate root this command targets.
    final org.fuin.ddd4j.ddd.AggregateVersion
     
    final Integer
     
    final ENTITY_ID
     
    final @NotNull org.fuin.ddd4j.ddd.EntityIdPath
     

    Methods inherited from class org.fuin.ddd4j.ddd.AbstractEvent

    equals, getCausationId, getCorrelationId, getEventId, getEventTimestamp, hashCode

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods 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:
      getEntityIdPath in interface org.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
    • getEntityId

      @NotNull public final ENTITY_ID getEntityId()
      Specified by:
      getEntityId in interface org.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
    • getAggregateRootId

      @Nullable public final ROOT_ID getAggregateRootId()
      Description copied from interface: AggregateCommand
      Returns the identifier of the aggregate root this command targets.
      Specified by:
      getAggregateRootId in interface AggregateCommand<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:
      getAggregateVersion in interface org.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>
    • getAggregateVersionInteger

      @Nullable public final Integer getAggregateVersionInteger()
      Specified by:
      getAggregateVersionInteger in interface org.fuin.ddd4j.ddd.DomainEvent<ROOT_ID extends org.fuin.ddd4j.ddd.AggregateRootId>