java.lang.Object
is.codion.framework.domain.DefaultDomain
- All Implemented Interfaces:
Domain
A default
Domain implementation. Extend to define a domain model.-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefaultDomain(DomainType domainType) Instantiates a new DefaultDomain identified by the givenDomainType. -
Method Summary
Modifier and TypeMethodDescriptionprotected final <C,T, R> void add(is.codion.common.db.operation.FunctionType<C, T, R> functionType, is.codion.common.db.operation.DatabaseFunction<C, T, R> function) Adds the given function to this domainprotected final <C,T> void add(is.codion.common.db.operation.ProcedureType<C, T> procedureType, is.codion.common.db.operation.DatabaseProcedure<C, T> procedure) Adds the given procedure to this domainprotected final <T,R, P> void add(is.codion.common.db.report.ReportType<T, R, P> reportType, is.codion.common.db.report.Report<T, R, P> report) Adds a report to this domain model.protected final voidadd(EntityDefinition definition) Adds a newEntityDefinitionto this domain model.protected final voidadd(EntityDefinition.Builder definitionBuilder) Adds a newEntityDefinitionto this domain model, by callingEntityDefinition.Builder.build().protected final voidAdds all entities, procedures, functions and reports from the given 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> is.codion.common.db.operation.DatabaseFunction<C, T, R> function(is.codion.common.db.operation.FunctionType<C, T, R> functionType) Retrieves the function of the given type.final Map<is.codion.common.db.operation.FunctionType<?,?, ?>, is.codion.common.db.operation.DatabaseFunction<?, ?, ?>> final <C,T> is.codion.common.db.operation.DatabaseProcedure<C, T> procedure(is.codion.common.db.operation.ProcedureType<C, T> procedureType) Retrieves the procedure of the given type.final Map<is.codion.common.db.operation.ProcedureType<?,?>, is.codion.common.db.operation.DatabaseProcedure<?, ?>> final <T,R, P> is.codion.common.db.report.Report<T, R, P> report(is.codion.common.db.report.ReportType<T, R, P> reportType) Retrieves the report of the given type.final Map<is.codion.common.db.report.ReportType<?,?, ?>, is.codion.common.db.report.Report<?, ?, ?>> reports()protected final voidsetStrictForeignKeys(boolean strictForeignKeys) Specifies whether it should be possible to define foreign keys referencing entities that have not been defined, this can be disabled in cases where entities have circular references.final DomainTypetype()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface is.codion.framework.domain.Domain
configureConnection, configureDatabase
-
Constructor Details
-
DefaultDomain
Instantiates a new DefaultDomain identified by the givenDomainType.- Parameters:
domainType- the Domain model type to associate with this domain model
-
-
Method Details
-
type
-
entities
-
reports
public final Map<is.codion.common.db.report.ReportType<?,?, reports()?>, is.codion.common.db.report.Report<?, ?, ?>> -
procedures
public final Map<is.codion.common.db.operation.ProcedureType<?,?>, procedures()is.codion.common.db.operation.DatabaseProcedure<?, ?>> - Specified by:
proceduresin interfaceDomain- Returns:
- an unmodifiable view of this domain's procedures
-
functions
public final Map<is.codion.common.db.operation.FunctionType<?,?, functions()?>, is.codion.common.db.operation.DatabaseFunction<?, ?, ?>> -
report
public final <T,R, is.codion.common.db.report.Report<T,P> R, reportP> (is.codion.common.db.report.ReportType<T, R, P> reportType) Description copied from interface:DomainRetrieves the report of the given type. -
procedure
public final <C,T> is.codion.common.db.operation.DatabaseProcedure<C,T> procedure(is.codion.common.db.operation.ProcedureType<C, T> procedureType) Description copied from interface:DomainRetrieves the procedure of the given type. -
function
public final <C,T, is.codion.common.db.operation.DatabaseFunction<C,R> T, functionR> (is.codion.common.db.operation.FunctionType<C, T, R> functionType) Description copied from interface:DomainRetrieves the function of the given type. -
add
Adds a newEntityDefinitionto this domain model, by callingEntityDefinition.Builder.build(). Note that any subsequent changes in the builder are not reflected in the entity definition.- Parameters:
definitionBuilder- the builder which definition to add- Throws:
IllegalArgumentException- in case the entityType has already been used to define an entityIllegalArgumentException- in case no attribute definitions are specified
-
add
Adds a newEntityDefinitionto this domain model.- Parameters:
definition- the definition to add- Throws:
IllegalArgumentException- in case the entityType has already been used to define an entityIllegalArgumentException- in case no attribute definitions are specified
-
add
protected final <T,R, void addP> (is.codion.common.db.report.ReportType<T, R, P> reportType, is.codion.common.db.report.Report<T, R, P> report) 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
protected final <C,T> void add(is.codion.common.db.operation.ProcedureType<C, T> procedureType, is.codion.common.db.operation.DatabaseProcedure<C, T> procedure) Adds the given procedure to this domain- Type Parameters:
C- the connection typeT- the argument 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> (is.codion.common.db.operation.FunctionType<C, T, R> functionType, is.codion.common.db.operation.DatabaseFunction<C, T, R> function) Adds the given function to this domain- Type Parameters:
C- the connection typeT- the argument 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
-
setStrictForeignKeys
protected final void setStrictForeignKeys(boolean strictForeignKeys) Specifies whether it should be possible to define foreign keys referencing entities that have not been defined, this can be disabled in cases where entities have circular references.- Parameters:
strictForeignKeys- true for strict foreign key validation
-
addAll
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
-