Interface Port<R extends Realm>
- Type Parameters:
R- Realm of the bounded domain
public interface Port<R extends Realm>
Defines the inbound and outbound communication port to the bounded domain. It is a secondary port in the DDD terminology.
The realm is available to the port due to the default import and export functionality specific to this framework.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidclearEntities(@NotNull DomainAudit audit) Clears all entities of the bounded domain.static voidcreateDirectories(@NotNull Path directory) static voidentitiesCleared(@NotNull DomainAudit audit, @NotNull String entities) voidexportEntities(@NotNull DomainAudit audit) Exports all entities of the bounded domain to the file system as TSV, JSON, TOML, and YAML files.default voidimportConfiguration(@NotNull DomainAudit audit, @NotNull TypeRegistry registry) Imports configuration specific to the bounded domain in the context of a tenant.voidimportEntities(@NotNull DomainAudit audit) Imports all entities of the bounded domain from the file system.realm()Returns the realm containing all the entities of the bounded domain.static PathresolvePath(@NotNull Path directory, int year, @NotNull String filename) Resolves the uri to where a document should be located in the file system.static PathresolvePath(@NotNull Path directory, int year, Month month, @NotNull String filename) Resolves the uri to where a document should be located in the file system.
-
Field Details
-
PATTERN
-
-
Method Details
-
importEntities
Imports all entities of the bounded domain from the file system. All TSV, JSON, TOML, and YAML files are imported. The domain is responsible for the order of the import and the handling of the entities. A bounded domain should not depend on other domains to perform the operation.You should trigger a user interface update by calling
DomainAudit.entityImported(String)for each entity clas which was imported.- Parameters:
audit- domain audit sink to log the operation events- See Also:
-
exportEntities
Exports all entities of the bounded domain to the file system as TSV, JSON, TOML, and YAML files. A bounded domain should not depend on other domains to perform the operation.- Parameters:
audit- domain audit sink to log the operation events- See Also:
-
clearEntities
Clears all entities of the bounded domain. All generated documents and reports are cleared. Upon execution, the domain is empty. Use with caution as the operation is not reversible. Typically, the operation is used before an import to ensure that the domain is empty.You should trigger a user interface update by calling
DomainAudit.entityImported(String)for each entity clas which was cleared.- Parameters:
audit- domain audit sink to log the operation events
-
importConfiguration
default void importConfiguration(@NotNull @NotNull DomainAudit audit, @NotNull @NotNull TypeRegistry registry) Imports configuration specific to the bounded domain in the context of a tenant. The reference code values and tags are imported and registered in the type registry. The configuration is typically used to configure codes and tags.- Parameters:
audit- domain audit sink to log the operation events
-
realm
R realm()Returns the realm containing all the entities of the bounded domain.- Returns:
- realm of the bounded domain
-
entitiesCleared
-
resolvePath
static Path resolvePath(@NotNull @NotNull Path directory, int year, @NotNull @NotNull String filename) Resolves the uri to where a document should be located in the file system. The convention is base directory/year. If folders do not exist, they are created. The year must contain four digits.- Parameters:
directory- base directory containing all reports and documentsyear- year of the documentfilename- filename of the document to write- Returns:
- uri to the file where the document should be written
-
resolvePath
static Path resolvePath(@NotNull @NotNull Path directory, int year, Month month, @NotNull @NotNull String filename) Resolves the uri to where a document should be located in the file system. The convention is base directory/year/month. If folders do not exist, they are created. The year must contain four digits. The month is transformed to a two-digit string.- Parameters:
directory- base directory containing all reports and documentsyear- year of the documentfilename- filename of the document to write- Returns:
- uri to the file where the document should be written
-
createDirectories
-