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 ofEntityModelthis application model is based onE- the type ofEntityEditModelused by thisEntityModelT- the type ofEntityTableModelused by thisEntityModel
- All Known Implementing Classes:
DefaultEntityApplicationModel
public interface EntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>
A central application model class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final is.codion.common.property.PropertyValue<Boolean>Specifies whether user authentication is required
Value type: Boolean
Default value: truestatic final is.codion.common.property.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 is.codion.common.property.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 TypeMethodDescriptionvoidaddEntityModel(M entityModel) Adds the given entity model to this modelvoidaddEntityModels(M... entityModels) Adds the given entity models to this model.is.codion.framework.db.EntityConnectionProviderbooleancontainsEntityModel(is.codion.framework.domain.entity.EntityType entityType) booleancontainsEntityModel(Class<? extends M> modelClass) booleancontainsEntityModel(M entityModel) booleanis.codion.framework.domain.entity.Entitiesentities()<C extends M>
CentityModel(is.codion.framework.domain.entity.EntityType entityType) <C extends M>
CentityModel(Class<C> modelClass) voidrefresh()Refreshes all data models contained in this application modelvoidSaves any user preferences.is.codion.common.user.Useruser()Optional<is.codion.common.version.Version>version()is.codion.common.state.State
-
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
is.codion.common.user.User user()- Returns:
- the current user
-
connectionProvider
is.codion.framework.db.EntityConnectionProvider connectionProvider()- Returns:
- the EntityConnectionProvider instance being used by this EntityApplicationModel
-
version
Optional<is.codion.common.version.Version> version()- Returns:
- the application version, an empty Optional in case no version information is available
-
entities
is.codion.framework.domain.entity.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
boolean containsEntityModel(is.codion.framework.domain.entity.EntityType entityType) - 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
-
warnAboutUnsavedData
is.codion.common.state.State warnAboutUnsavedData()- Returns:
- the State controlling whether this model warns about unsaved data
- See Also:
-
containsUnsavedData
boolean containsUnsavedData()- Returns:
- true if any edit model associated with this application model contains modified and unsaved data, that is, existing entities that have been modified but not saved
-
savePreferences
void savePreferences()Saves any user preferences. Note that ifEntityModel.USE_CLIENT_PREFERENCESis set to 'false', calling this method has no effect. Remember to call super.savePreferences() when overriding. -
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
-