Interface EntityApplicationModel<M extends EntityModel<M,E,T>,E extends EntityEditModel,T extends EntityTableModel<E>>

Type Parameters:
M - the type of EntityModel this application model is based on
E - the type of EntityEditModel used by this EntityModel
T - the type of EntityTableModel used by this EntityModel
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

    Fields
    Modifier and Type
    Field
    Description
    static final is.codion.common.property.PropertyValue<Boolean>
    Specifies whether user authentication is required
    Value type: Boolean
    Default value: true
    static 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: true
    static 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 Type
    Method
    Description
    void
    addEntityModel(M entityModel)
    Adds the given entity model to this model
    void
    addEntityModels(M... entityModels)
    Adds the given entity models to this model.
    is.codion.framework.db.EntityConnectionProvider
     
    boolean
    containsEntityModel(is.codion.framework.domain.entity.EntityType entityType)
     
    boolean
    containsEntityModel(Class<? extends M> modelClass)
     
    boolean
    containsEntityModel(M entityModel)
     
    boolean
     
    is.codion.framework.domain.entity.Entities
     
    <C extends M>
    C
    entityModel(is.codion.framework.domain.entity.EntityType entityType)
     
    <C extends M>
    C
    entityModel(Class<C> modelClass)
     
     
    void
    Refreshes all data models contained in this application model
    void
    Saves any user preferences.
    is.codion.common.user.User
     
    Optional<is.codion.common.version.Version>
     
    is.codion.common.state.State
     
  • Field Details

    • USERNAME_PREFIX

      static final is.codion.common.property.PropertyValue<String> USERNAME_PREFIX
      Specifies a string to prepend to the username field in the login dialog
      Value type: String
      Default value: [empty string]
    • AUTHENTICATION_REQUIRED

      static final is.codion.common.property.PropertyValue<Boolean> AUTHENTICATION_REQUIRED
      Specifies whether user authentication is required
      Value type: Boolean
      Default value: true
    • SAVE_DEFAULT_USERNAME

      static final is.codion.common.property.PropertyValue<Boolean> 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

      void addEntityModels(M... entityModels)
      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

      void addEntityModel(M entityModel)
      Adds the given entity model to this model
      Parameters:
      entityModel - the detail model
      Throws:
      IllegalArgumentException - in case the model has already been added
    • containsEntityModel

      boolean containsEntityModel(Class<? extends M> modelClass)
      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

      boolean containsEntityModel(M entityModel)
      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 if EntityModel.USE_CLIENT_PREFERENCES is set to 'false', calling this method has no effect. Remember to call super.savePreferences() when overriding.
    • entityModels

      List<M> entityModels()
      Returns:
      an unmodifiable List containing the EntityModel instances contained in this EntityApplicationModel
    • entityModel

      <C extends M> C entityModel(Class<C> modelClass)
      Type Parameters:
      C - the model type
      Parameters:
      modelClass - the model class
      Returns:
      the EntityModel of the given type
    • entityModel

      <C extends M> C entityModel(is.codion.framework.domain.entity.EntityType entityType)
      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