java.lang.Object
net.tangly.core.domain.BoundedDomain<R,B,P>
- Type Parameters:
R- realm handles all entities and values objects of the domain modelB- business logic provides complex domain business logic functionsP- port empowers the business domain to communicate with outer layers or external systems. The communication is generally asynchronous
- All Implemented Interfaces:
DomainAudit,HasName
public class BoundedDomain<R extends Realm,B,P extends Port<R>>
extends Object
implements HasName, DomainAudit
A bounded domain as defined in the DDD approach has a domain-specific model and a set of adapters.
A bounded domain is a cohesive and decoupled unit of functionality that is relevant to the business.
It has a unique name.
The lifecycle of a bounded domain is:
- Bounded domain creation. The creation sets the realm, logic, ports, tenant directory are set.
- Define codes and tags into the domain type registry. The port interface provides a method
Port.importConfiguration(DomainAudit, TypeRegistry) - Startup of the domain after construction
- Shutdown of the domain after startup
The tenant directory provides access to tenant configuration information.
The type registry is the source of codes and tags. These concepts support dynamic extension points into the domain. Each tenant can defines code values and tags.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceDefines a refined event listener interface to handle events in the domain or from another domain. -
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionBoundedDomain(@NotNull String name, R realm, B logic, P port, TenantDirectory directory) Constructor of the bounded domain. -
Method Summary
Modifier and TypeMethodDescriptionprotected static <I extends HasTags>
voidaddTagCounts(@NotNull TypeRegistry registry, @NotNull List<I> entities, Map<TagType<?>, Integer> counts) protected static <I extends HasOid & HasMutableTags>
voidaddTagCounts(@NotNull TypeRegistry registry, @NotNull Provider<I> provider, Map<TagType<?>, Integer> counts) List<net.tangly.commons.logger.EventData> channel()booleanenabled()List<DomainEntity<?>> entities()voidentityImported(@NotNull String entityName) Instances were added, deleted or modified in the domain programmatically and not through the user interface.voidlog(@NotNull net.tangly.commons.logger.EventData auditEvent) logic()name()Returns the name of the domain audit.port()realm()registry()voidshutdown()voidstartup()voidSubmit an event to the external public event channel of the domain.voidsubmitInterally(@NotNull Object event) Submit an event to the internal event channel of the domain.voidsubscribe(@NotNull BoundedDomain.EventListener listener) Subscribes to the public event channel of the domain.voidsubscribeInternally(@NotNull BoundedDomain.EventListener listener) Subscribes to the internal event channel of the domain.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.tangly.core.domain.DomainAudit
log, log
-
Constructor Details
-
BoundedDomain
public BoundedDomain(@NotNull @NotNull String name, @NotNull R realm, @NotNull B logic, @NotNull P port, TenantDirectory directory) Constructor of the bounded domain.- Parameters:
name- human-readable name of the domainrealm- realm handles all entities and values objects of the domain modellogic- logic provides complex domain business logic functionsport- port empowers the business domain to communicate with external systemsdirectory- directory of the tenant to support inter-domain communication
-
-
Method Details
-
addTagCounts
protected static <I extends HasOid & HasMutableTags> void addTagCounts(@NotNull @NotNull TypeRegistry registry, @NotNull @NotNull Provider<I> provider, Map<TagType<?>, Integer> counts) -
addTagCounts
-
subscribe
Subscribes to the public event channel of the domain.- Parameters:
listener- event listener
-
subscribeInternally
Subscribes to the internal event channel of the domain.- Parameters:
listener- event listener
-
countTags
-
name
Description copied from interface:DomainAuditReturns the name of the domain audit. It should be the name of the bounded domain.- Specified by:
namein interfaceDomainAudit- Specified by:
namein interfaceHasName- Returns:
- name of the domain audit
-
realm
-
logic
-
port
-
registry
-
directory
-
entities
-
auditEvents
-
enabled
public boolean enabled() -
log
public void log(@NotNull @NotNull net.tangly.commons.logger.EventData auditEvent) - Specified by:
login interfaceDomainAudit
-
entityImported
Description copied from interface:DomainAuditInstances were added, deleted or modified in the domain programmatically and not through the user interface.- Specified by:
entityImportedin interfaceDomainAudit- Parameters:
entityName- name of the entity
-
submitInterally
Description copied from interface:DomainAuditSubmit an event to the internal event channel of the domain. The channel is used to publish events within the domain.- Specified by:
submitInterallyin interfaceDomainAudit- Parameters:
event- event to submit
-
submit
Description copied from interface:DomainAuditSubmit an event to the external public event channel of the domain. The channel is used to publish events to other domains.- Specified by:
submitin interfaceDomainAudit- Parameters:
event- event to submit
-
channel
-
internalChannel
-
startup
public void startup() -
shutdown
public void shutdown()
-