java.lang.Object
is.codion.framework.domain.DomainModel
- All Implemented Interfaces:
Domain
- Direct Known Subclasses:
SchemaDomain,TestDomain
A default
Domain implementation. Extend to define a domain model.- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDomainModel(DomainType domainType) Instantiates a new DomainModel identified by the givenDomainType. -
Method Summary
Modifier and TypeMethodDescriptionprotected final <C,T, R> void add(FunctionType<C, T, R> functionType, DatabaseFunction<C, T, R> function) Adds the given function to this domainprotected final <C,T> void add(ProcedureType<C, T> procedureType, DatabaseProcedure<C, T> procedure) Adds the given procedure to this domainprotected final <T,R, P> void add(ReportType<T, R, P> reportType, Report<T, R, P> report) Adds a report to this domain model.protected final voidAdds all entities, procedures, functions and reports from the given domain model.protected final voidadd(EntityDefinition... definitions) Adds a newEntityDefinitionto this domain model.protected final voidaddEntities(Domain domain) Adds all the entities from the given domain to this domain.protected final voidaddFunctions(Domain domain) Adds all the functions from the given domain to this domain.protected final voidaddProcedures(Domain domain) Adds all the procedures from the given domain to this domain.protected final voidaddReports(Domain domain) Adds all the reports from the given domain to this domain.final Entitiesentities()final <C,T, R> DatabaseFunction <C, T, R> function(FunctionType<C, T, R> functionType) Retrieves the function of the given type.final Map<FunctionType<?, ?, ?>, DatabaseFunction<?, ?, ?>> final <C,T> DatabaseProcedure <C, T> procedure(ProcedureType<C, T> procedureType) Retrieves the procedure of the given type.final Map<ProcedureType<?, ?>, DatabaseProcedure<?, ?>> final <T,R, P> Report <T, R, P> report(ReportType<T, R, P> reportType) Retrieves the report of the given type.final Map<ReportType<?, ?, ?>, Report<?, ?, ?>> reports()final DomainTypetype()protected final voidvalidateForeignKeys(boolean validateForeignKeys) Specifies whether foreign keys are validated by asserting that the referenced entity has been defined.
-
Constructor Details
-
DomainModel
Instantiates a new DomainModel identified by the givenDomainType.- Parameters:
domainType- the Domain model type to associate with this domain model
-
-
Method Details
-
type
-
entities
-
reports
-
procedures
- Specified by:
proceduresin interfaceDomain- Returns:
- an unmodifiable view of this domain's procedures
-
functions
-
report
Description copied from interface:DomainRetrieves the report of the given type. -
procedure
Description copied from interface:DomainRetrieves the procedure of the given type. -
function
Description copied from interface:DomainRetrieves the function of the given type. -
add
Adds a newEntityDefinitionto this domain model.- Parameters:
definitions- the definitions to add- Throws:
IllegalArgumentException- in case a entityType has already been used to define an entityIllegalArgumentException- in case no attribute definitions are specified for an entityIllegalArgumentException- in case an entity definition is not associated with this domain
-
add
Adds a report to this domain model.- Type Parameters:
T- the report typeR- the report result typeP- the report parameters type- Parameters:
reportType- the report to addreport- the actual report to associate with the report type- Throws:
RuntimeException- in case loading the report failedIllegalArgumentException- in case the report has already been added
-
add
Adds the given procedure to this domain- Type Parameters:
C- the connection typeT- the parameter type- Parameters:
procedureType- the procedure type to identify the procedureprocedure- the procedure to add- Throws:
IllegalArgumentException- in case a procedure has already been associated with the given type
-
add
protected final <C,T, void addR> (FunctionType<C, T, R> functionType, DatabaseFunction<C, T, R> function) Adds the given function to this domain- Type Parameters:
C- the connection typeT- the parameter typeR- the result type- Parameters:
functionType- the function type to identify the functionfunction- the function to add- Throws:
IllegalArgumentException- in case a function has already been associated with the given type
-
validateForeignKeys
protected final void validateForeignKeys(boolean validateForeignKeys) Specifies whether foreign keys are validated by asserting that the referenced entity has been defined. Disable this validation in cases where entities have circular references.- Parameters:
validateForeignKeys- true to enable foreign key validation, false to disable
-
add
Adds all entities, procedures, functions and reports from the given domain model.- Parameters:
domain- the domain model to copy from- See Also:
-
addEntities
Adds all the entities from the given domain to this domain. Note that the entity type names must be unique.- Parameters:
domain- the domain model which entities to add- Throws:
IllegalArgumentException- in case a non-unique entity type name is encountered- See Also:
-
addProcedures
Adds all the procedures from the given domain to this domain.- Parameters:
domain- the domain model which procedures to add
-
addFunctions
Adds all the functions from the given domain to this domain.- Parameters:
domain- the domain model which functions to add
-
addReports
Adds all the reports from the given domain to this domain.- Parameters:
domain- the domain model which reports to add
-