Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
- Type Parameters:
M
- the type ofEntityModel
this application model is based onE
- the type ofEntityEditModel
used by thisEntityModel
T
- the type ofEntityTableModel
used by thisEntityModel
- All Known Implementing Classes:
DefaultEntityApplicationModel
,SwingEntityApplicationModel
public interface EntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
A central application model class.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final PropertyValue<Boolean>
Specifies whether user authentication is required Value type: Boolean Default value: truestatic final PropertyValue<Boolean>
Specifies whether the client saves the last successful login username, which is then displayed as the default username the next time the application is started Value type: Boolean Default value: truestatic final PropertyValue<String>
Specifies a string to prepend to the username field in the login dialog Value type: String Default value: [empty string] -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEntityModel
(M entityModel) Adds the given entity model to this modelvoid
addEntityModels
(M... entityModels) Adds the given entity models to this model.Do not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.boolean
containsEntityModel
(EntityType entityType) boolean
containsEntityModel
(Class<? extends M> modelClass) boolean
containsEntityModel
(M entityModel) entities()
<C extends M>
CentityModel
(EntityType entityType) <C extends M>
CentityModel
(Class<C> modelClass) void
refresh()
Refreshes all data models contained in this application modeluser()
version()
-
Field Details
-
USERNAME_PREFIX
Specifies a string to prepend to the username field in the login dialog- Value type: String
- Default value: [empty string]
-
AUTHENTICATION_REQUIRED
Specifies whether user authentication is required- Value type: Boolean
- Default value: true
-
SAVE_DEFAULT_USERNAME
Specifies whether the client saves the last successful login username, which is then displayed as the default username the next time the application is started- Value type: Boolean
- Default value: true
-
-
Method Details
-
user
User user()- Returns:
- the current user
-
connectionProvider
EntityConnectionProvider connectionProvider()- Returns:
- the EntityConnectionProvider instance being used by this EntityApplicationModel
-
connection
EntityConnection connection()Do not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.- Returns:
- the connection used by this application model
-
version
- Returns:
- the application version, an empty Optional in case no version information is available
-
entities
Entities entities()- Returns:
- the underlying domain entities
-
addEntityModels
Adds the given entity models to this model.- Parameters:
entityModels
- the entity models to add- Throws:
IllegalArgumentException
- in case any of the models has already been added
-
addEntityModel
Adds the given entity model to this model- Parameters:
entityModel
- the detail model- Throws:
IllegalArgumentException
- in case the model has already been added
-
containsEntityModel
- Parameters:
modelClass
- the application model class- Returns:
- true if this model contains a EntityModel instance of the given class
-
containsEntityModel
- Parameters:
entityType
- the entityType- Returns:
- true if this model contains a EntityModel for the given entityType
-
containsEntityModel
- Parameters:
entityModel
- the entity model- Returns:
- true if this model contains the given EntityModel
-
entityModels
- Returns:
- an unmodifiable List containing the EntityModel instances contained in this EntityApplicationModel
-
entityModel
- Type Parameters:
C
- the model type- Parameters:
modelClass
- the model class- Returns:
- the EntityModel of the given type
-
entityModel
- Type Parameters:
C
- the model type- Parameters:
entityType
- the entityType- Returns:
- the EntityModel based on the given entityType
-
refresh
void refresh()Refreshes all data models contained in this application model
-