Aggregate

The Aggregate pattern implementation from Sculptor has been adapted within CML to represent it with a separate grammar rule. Note that all other tactic DDD patterns are not documented on this website. We refer to the Sculptor project and their documentation.

Syntax

The aggregate supports the Responsibility Layers pattern and the Knowledge Level pattern. An aggregate can further contain Services, Resources, Consumers and SimpleDomainObjects (Entities, Value Objects, Domain Events, etc.) which are not further introduced here. The according rules are defined by the Sculptor DSL, as already mentioned. However, the following CML snippet illustrates an example of an aggregate to provide an impression how the rule can be used.

Aggregate Contract {
  responsibilities = Contracts, Policies
  knowledgeLevel = CONCRETE
  
  Entity Contract {
    aggregateRoot
    
    - ContractId identifier
    - Customer client
    - List<Product> products
  }
  
  ValueObject ContractId {
    int contractId key
  }
  
  Entity Policy {
    int policyNr
    - Contract contract
    BigDecimal price
  }
}

Further examples can be found within our Github example repository context-mapper-examples.