Interface EntityEditModel

All Known Implementing Classes:
AbstractEntityEditModel

public interface EntityEditModel
Specifies a class for editing Entity instances.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Represents a task for deleting entities.
    static interface 
    Represents a task for inserting entities, split up for use with a background thread.
    static interface 
    Represents a task for updating entities.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final is.codion.common.property.PropertyValue<Boolean>
    Specifies whether writable foreign key values should persist when the model is cleared or set to null
    Value type: Boolean
    Default value: true
    static final is.codion.common.property.PropertyValue<Boolean>
    Specifies whether edit models post their insert, update and delete events to EntityEditEvents
    Value type: Boolean
    Default value: true
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, Collection<is.codion.framework.domain.entity.Entity> entities)
    Adds the given entities to all foreign key models based on that entity type
    is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>>
     
    is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>>
     
    is.codion.common.event.EventObserver<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>>
     
    is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>>
     
    is.codion.common.event.EventObserver<is.codion.framework.domain.entity.Entity>
     
    is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>>
     
    is.codion.common.event.EventObserver<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>>
     
    is.codion.framework.db.EntityConnection
    Do not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.
    is.codion.framework.db.EntityConnectionProvider
     
    Creates a new EntityEditModel.Delete instance for deleting the active entity.
    createDelete(Collection<is.codion.framework.domain.entity.Entity> entities)
    Creates a new EntityEditModel.Delete instance for deleting the given entities.
    createForeignKeySearchModel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
    Creates a EntitySearchModel for looking up entities referenced by the given foreign key, using the search attributes defined for that entity type.
    Creates a new EntityEditModel.Insert instance for inserting the active entity.
    createInsert(Collection<is.codion.framework.domain.entity.Entity> entities)
    Creates a new EntityEditModel.Insert instance for inserting the given entities.
    Creates a new EntityEditModel.Update instance for updating the active entity.
    createUpdate(Collection<is.codion.framework.domain.entity.Entity> entities)
    Creates a new EntityEditModel.Update instance for updating the given entities.
    void
    Populates this edit model with default values for all attributes.
    <S extends Supplier<T>, T>
    is.codion.common.value.Value<S>
    defaultValue(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns the Value instance controlling the default value supplier for the given attribute.
    is.codion.framework.domain.entity.Entity
    Note: This method must be called on the UI thread in case a panel has been based on this model.
    Collection<is.codion.framework.domain.entity.Entity>
    delete(Collection<is.codion.framework.domain.entity.Entity> entities)
    Note: This method must be called on the UI thread in case a panel has been based on this model.
    is.codion.common.state.State
    Disabling delete causes an exception being thrown when deleting.
    <T> is.codion.common.event.EventObserver<T>
    editEvent(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns an observer notified each time the value associated with the given attribute is edited via put(Attribute, Object) or remove(Attribute), note that this event is only fired if the value actually changes.
    is.codion.common.state.StateObserver
     
    is.codion.framework.domain.entity.Entities
     
    is.codion.framework.domain.entity.Entity
     
    is.codion.framework.domain.entity.EntityDefinition
     
    is.codion.common.event.EventObserver<is.codion.framework.domain.entity.Entity>
     
    is.codion.framework.domain.entity.EntityType
     
    is.codion.common.state.StateObserver
     
    foreignKeySearchModel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
     
    <T> T
    get(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns the value associated with the given attribute
    is.codion.framework.domain.entity.Entity
    Note: This method must be called on the UI thread in case a panel has been based on this model.
    Collection<is.codion.framework.domain.entity.Entity>
    insert(Collection<is.codion.framework.domain.entity.Entity> entities)
    Note: This method must be called on the UI thread in case a panel has been based on this model.
    is.codion.common.state.State
    Disabling insert causes an exception being thrown when inserting.
    is.codion.common.event.EventObserver<?>
     
    is.codion.common.state.StateObserver
    isNotNull(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
     
    is.codion.common.state.StateObserver
    isNull(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
     
    is.codion.common.state.StateObserver
    Returns a StateObserver indicating when and if any values in the underlying Entity have been modified.
    is.codion.common.state.StateObserver
    modified(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
    Returns a StateObserver instance indicating whether the value of the given attribute has been modified.
    boolean
    nullable(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
     
    <T> Optional<T>
    optional(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns the value associated with the given attribute
    is.codion.common.state.State
    persist(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
    Returns a State controlling whether the last used value for this attribute should persist when the model is cleared.
    is.codion.common.state.State
     
    is.codion.common.state.StateObserver
     
    <T> T
    put(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, T value)
    Sets the given value in the underlying Entity
    is.codion.common.state.State
    Making this edit model read-only prevents any changes from being persisted to the database, trying to insert, update or delete will cause an exception being thrown, it does not prevent editing.
    void
    Refreshes the active Entity from the database, discarding all changes.
    <T> T
    remove(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Removes the given value from the underlying Entity
    void
    remove(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, Collection<is.codion.framework.domain.entity.Entity> entities)
    Removes the given entities from all foreign key models based on that entity type and clears any foreign key values referencing them.
    void
    replace(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, Collection<is.codion.framework.domain.entity.Entity> entities)
    For every field referencing the given foreign key values, replaces that foreign key instance with the corresponding entity from entities, useful when attribute values have been changed in the referenced entity that must be reflected in the edit model.
    void
    Reverts all attribute value changes.
    <T> void
    revert(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
     
    void
    set(is.codion.framework.domain.entity.Entity entity)
    Copies the values from the given Entity into the underlying Entity being edited by this edit model.
    is.codion.framework.domain.entity.Entity
    Note: This method must be called on the UI thread in case a panel has been based on this model.
    Collection<is.codion.framework.domain.entity.Entity>
    update(Collection<is.codion.framework.domain.entity.Entity> entities)
    Note: This method must be called on the UI thread in case a panel has been based on this model.
    is.codion.common.state.State
    Disabling update causes an exception being thrown when updating.
    is.codion.common.state.State
    Disabling updating multiple entities causes an exception being thrown when trying to update multiple entities at a time.
    is.codion.common.state.StateObserver
     
    is.codion.common.state.StateObserver
    valid(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
     
    void
    Validates the current state of the entity
    void
    validate(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
    Validates the value associated with the given attribute, using the underlying validator.
    void
    validate(is.codion.framework.domain.entity.Entity entity)
    Validates the given entity, using the underlying validator.
    void
    validate(Collection<is.codion.framework.domain.entity.Entity> entities)
    Validates the given entities, using the underlying validator.
    <T> is.codion.common.value.Value<T>
    value(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns a Value based on attribute in this edit model, note that subsequent calls for the same attribute return the same value instance.
    is.codion.common.event.EventObserver<is.codion.framework.domain.entity.attribute.Attribute<?>>
     
    <T> is.codion.common.event.EventObserver<T>
    valueEvent(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
    Returns an observer notified each time the value associated with the given attribute changes, either via editing or when the active entity is set.
  • Field Details

    • PERSIST_FOREIGN_KEYS

      static final is.codion.common.property.PropertyValue<Boolean> PERSIST_FOREIGN_KEYS
      Specifies whether writable foreign key values should persist when the model is cleared or set to null
      Value type: Boolean
      Default value: true
    • POST_EDIT_EVENTS

      static final is.codion.common.property.PropertyValue<Boolean> POST_EDIT_EVENTS
      Specifies whether edit models post their insert, update and delete events to EntityEditEvents
      Value type: Boolean
      Default value: true
      See Also:
  • Method Details

    • entityType

      is.codion.framework.domain.entity.EntityType entityType()
      Returns:
      the type of the entity this edit model is based on
    • connectionProvider

      is.codion.framework.db.EntityConnectionProvider connectionProvider()
      Returns:
      the connection provider used by this edit model
    • connection

      is.codion.framework.db.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 edit model
    • defaults

      void defaults()
      Populates this edit model with default values for all attributes.
      See Also:
    • set

      void set(is.codion.framework.domain.entity.Entity entity)
      Copies the values from the given Entity into the underlying Entity being edited by this edit model. If entity is null the effect is the same as calling defaults().
      Parameters:
      entity - the entity
      See Also:
    • refresh

      void refresh()
      Refreshes the active Entity from the database, discarding all changes. If the active Entity is new then calling this method has no effect.
    • entity

      is.codion.framework.domain.entity.Entity entity()
      Returns:
      an immutable version of the Entity instance being edited
      See Also:
      • Entity.immutable()
    • isNull

      is.codion.common.state.StateObserver isNull(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Parameters:
      attribute - the attribute
      Returns:
      a StateObserver indicating whether the value of the given attribute is null
    • isNotNull

      is.codion.common.state.StateObserver isNotNull(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Parameters:
      attribute - the attribute
      Returns:
      a StateObserver indicating whether the value of the given attribute is not null
    • revert

      void revert()
      Reverts all attribute value changes.
    • revert

      <T> void revert(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Parameters:
      attribute - the attribute to revert
    • nullable

      boolean nullable(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Parameters:
      attribute - the attribute
      Returns:
      true if this value is allowed to be null in the underlying entity
    • put

      <T> T put(is.codion.framework.domain.entity.attribute.Attribute<T> attribute, T value)
      Sets the given value in the underlying Entity
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute to associate the given value with
      value - the value to associate with the given attribute
      Returns:
      the previous value, if any
    • remove

      <T> T remove(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Removes the given value from the underlying Entity
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      Returns:
      the value, if any
    • get

      <T> T get(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns the value associated with the given attribute
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      Returns:
      the value associated with the given attribute
    • optional

      <T> Optional<T> optional(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns the value associated with the given attribute
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      Returns:
      the value associated with the given attribute, an empty Optional in case it is null
    • value

      <T> is.codion.common.value.Value<T> value(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns a Value based on attribute in this edit model, note that subsequent calls for the same attribute return the same value instance.
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute
      Returns:
      a Value based on the given edit model value
    • entities

      is.codion.framework.domain.entity.Entities entities()
      Returns:
      the underlying domain entities
    • entityDefinition

      is.codion.framework.domain.entity.EntityDefinition entityDefinition()
      Returns:
      the definition of the underlying entity
    • readOnly

      is.codion.common.state.State readOnly()
      Making this edit model read-only prevents any changes from being persisted to the database, trying to insert, update or delete will cause an exception being thrown, it does not prevent editing. Use insertEnabled(), updateEnabled() and deleteEnabled() to configure the enabled state of those specific actions.
      Returns:
      the State controlling whether this model is read only
    • insertEnabled

      is.codion.common.state.State insertEnabled()
      Disabling insert causes an exception being thrown when inserting.
      Returns:
      the state controlling whether inserting is enabled via this edit model
    • updateEnabled

      is.codion.common.state.State updateEnabled()
      Disabling update causes an exception being thrown when updating.
      Returns:
      the state controlling whether updating is enabled via this edit model
    • updateMultipleEnabled

      is.codion.common.state.State updateMultipleEnabled()
      Disabling updating multiple entities causes an exception being thrown when trying to update multiple entities at a time.
      Returns:
      the state controlling whether updating multiple entities is enabled
    • deleteEnabled

      is.codion.common.state.State deleteEnabled()
      Disabling delete causes an exception being thrown when deleting.
      Returns:
      the state controlling whether deleting is enabled via this edit model
    • createForeignKeySearchModel

      EntitySearchModel createForeignKeySearchModel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
      Creates a EntitySearchModel for looking up entities referenced by the given foreign key, using the search attributes defined for that entity type.
      Parameters:
      foreignKey - the foreign key for which to create a EntitySearchModel
      Returns:
      a EntitySearchModel for looking up entities of the type referenced by the given foreign key attribute,
      Throws:
      IllegalStateException - in case no searchable attributes can be found for the entity type referenced by the given foreign key
    • foreignKeySearchModel

      EntitySearchModel foreignKeySearchModel(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey)
      Parameters:
      foreignKey - the foreign key for which to retrieve the EntitySearchModel
      Returns:
      the EntitySearchModel associated with the foreignKey, if no search model has been initialized for the given foreign key, a new one is created, associated with the foreign key and returned.
    • defaultValue

      <S extends Supplier<T>, T> is.codion.common.value.Value<S> defaultValue(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns the Value instance controlling the default value supplier for the given attribute. Used when the underlying value is not persistent. Use defaults() or set(Entity) with a null parameter to populate the model with the default values.
      Type Parameters:
      S - the value supplier type
      T - the value type
      Parameters:
      attribute - the attribute
      Returns:
      the Value instance controlling the default value supplier
      See Also:
    • postEditEvents

      is.codion.common.state.State postEditEvents()
      Returns:
      a state controlling whether this edit model posts insert, update and delete events on the EntityEditEvents event bus.
      See Also:
    • persist

      is.codion.common.state.State persist(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Returns a State controlling whether the last used value for this attribute should persist when the model is cleared.
      Parameters:
      attribute - the attribute
      Returns:
      a State controlling whether the given attribute value should persist when the model is cleared
      See Also:
    • insert

      is.codion.framework.domain.entity.Entity insert() throws is.codion.common.db.exception.DatabaseException, is.codion.framework.domain.entity.exception.ValidationException
      Note: This method must be called on the UI thread in case a panel has been based on this model. Performs an insert on the active entity, sets the primary key values of the active entity according to the primary key of the inserted entity
      Returns:
      the inserted entity
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
      IllegalStateException - in case inserting is not enabled
      See Also:
      • EntityValidator.validate(Entity)
    • insert

      Collection<is.codion.framework.domain.entity.Entity> insert(Collection<is.codion.framework.domain.entity.Entity> entities) throws is.codion.common.db.exception.DatabaseException, is.codion.framework.domain.entity.exception.ValidationException
      Note: This method must be called on the UI thread in case a panel has been based on this model. Performs an insert on the given entities.
      Parameters:
      entities - the entities to insert
      Returns:
      a list containing the inserted entities
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
      IllegalStateException - in case inserting is not enabled
      See Also:
    • update

      is.codion.framework.domain.entity.Entity update() throws is.codion.common.db.exception.DatabaseException, is.codion.framework.domain.entity.exception.ValidationException
      Note: This method must be called on the UI thread in case a panel has been based on this model. Performs an update on the active entity
      Returns:
      the updated entity
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
      is.codion.common.db.exception.RecordModifiedException - in case the entity has been modified since it was loaded
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
      IllegalStateException - in case updating is not enabled
      is.codion.common.db.exception.UpdateException - in case the active entity is not modified
      See Also:
      • EntityValidator.validate(Entity)
    • update

      Collection<is.codion.framework.domain.entity.Entity> update(Collection<is.codion.framework.domain.entity.Entity> entities) throws is.codion.common.db.exception.DatabaseException, is.codion.framework.domain.entity.exception.ValidationException
      Note: This method must be called on the UI thread in case a panel has been based on this model. Updates the given entities.
      Parameters:
      entities - the entities to update
      Returns:
      the updated entities
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
      is.codion.common.db.exception.RecordModifiedException - in case an entity has been modified since it was loaded
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
      IllegalStateException - in case updating is not enabled
      See Also:
    • delete

      is.codion.framework.domain.entity.Entity delete() throws is.codion.common.db.exception.DatabaseException
      Note: This method must be called on the UI thread in case a panel has been based on this model.
      Returns:
      the deleted entity
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
      IllegalStateException - in case deleting is not enabled
      See Also:
    • delete

      Collection<is.codion.framework.domain.entity.Entity> delete(Collection<is.codion.framework.domain.entity.Entity> entities) throws is.codion.common.db.exception.DatabaseException
      Note: This method must be called on the UI thread in case a panel has been based on this model.
      Parameters:
      entities - the entities to delete
      Returns:
      the deleted entities
      Throws:
      is.codion.common.db.exception.DatabaseException - in case of a database exception
      IllegalStateException - in case deleting is not enabled
      See Also:
    • createInsert

      EntityEditModel.Insert createInsert() throws is.codion.framework.domain.entity.exception.ValidationException
      Creates a new EntityEditModel.Insert instance for inserting the active entity.
      Returns:
      a new EntityEditModel.Insert instance
      Throws:
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
    • createInsert

      EntityEditModel.Insert createInsert(Collection<is.codion.framework.domain.entity.Entity> entities) throws is.codion.framework.domain.entity.exception.ValidationException
      Creates a new EntityEditModel.Insert instance for inserting the given entities.
      Parameters:
      entities - the entities to insert
      Returns:
      a new EntityEditModel.Insert instance
      Throws:
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
    • createUpdate

      EntityEditModel.Update createUpdate() throws is.codion.framework.domain.entity.exception.ValidationException
      Creates a new EntityEditModel.Update instance for updating the active entity.
      Returns:
      a new EntityEditModel.Update instance
      Throws:
      IllegalArgumentException - in case the active entity is unmodified
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
    • createUpdate

      EntityEditModel.Update createUpdate(Collection<is.codion.framework.domain.entity.Entity> entities) throws is.codion.framework.domain.entity.exception.ValidationException
      Creates a new EntityEditModel.Update instance for updating the given entities.
      Parameters:
      entities - the entities to update
      Returns:
      a new EntityEditModel.Update instance
      Throws:
      IllegalArgumentException - in case any of the given entities are unmodified
      is.codion.framework.domain.entity.exception.ValidationException - in case validation fails
    • createDelete

      EntityEditModel.Delete createDelete()
      Creates a new EntityEditModel.Delete instance for deleting the active entity.
      Returns:
      a new EntityEditModel.Delete instance
    • createDelete

      EntityEditModel.Delete createDelete(Collection<is.codion.framework.domain.entity.Entity> entities)
      Creates a new EntityEditModel.Delete instance for deleting the given entities.
      Parameters:
      entities - the entities to delete
      Returns:
      a new EntityEditModel.Delete instance
    • add

      void add(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, Collection<is.codion.framework.domain.entity.Entity> entities)
      Adds the given entities to all foreign key models based on that entity type
      Parameters:
      foreignKey - the foreign key
      entities - the values
    • remove

      void remove(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, Collection<is.codion.framework.domain.entity.Entity> entities)
      Removes the given entities from all foreign key models based on that entity type and clears any foreign key values referencing them.
      Parameters:
      foreignKey - the foreign key
      entities - the values
    • replace

      void replace(is.codion.framework.domain.entity.attribute.ForeignKey foreignKey, Collection<is.codion.framework.domain.entity.Entity> entities)
      For every field referencing the given foreign key values, replaces that foreign key instance with the corresponding entity from entities, useful when attribute values have been changed in the referenced entity that must be reflected in the edit model.
      Parameters:
      foreignKey - the foreign key
      entities - the foreign key entities
    • validate

      void validate(is.codion.framework.domain.entity.attribute.Attribute<?> attribute) throws is.codion.framework.domain.entity.exception.ValidationException
      Validates the value associated with the given attribute, using the underlying validator.
      Parameters:
      attribute - the attribute the value is associated with
      Throws:
      is.codion.framework.domain.entity.exception.ValidationException - if the given value is not valid for the given attribute
    • validate

      void validate() throws is.codion.framework.domain.entity.exception.ValidationException
      Validates the current state of the entity
      Throws:
      is.codion.framework.domain.entity.exception.ValidationException - in case the entity is invalid
    • validate

      void validate(Collection<is.codion.framework.domain.entity.Entity> entities) throws is.codion.framework.domain.entity.exception.ValidationException
      Validates the given entities, using the underlying validator. For entities of a type other than this edit model is based on, their respective validators are used.
      Parameters:
      entities - the entities to validate
      Throws:
      is.codion.framework.domain.entity.exception.ValidationException - on finding the first invalid entity
      See Also:
      • EntityDefinition.validator()
    • validate

      void validate(is.codion.framework.domain.entity.Entity entity) throws is.codion.framework.domain.entity.exception.ValidationException
      Validates the given entity, using the underlying validator. For entities of a type other than this edit model is based on, their respective validators are used.
      Parameters:
      entity - the entity to validate
      Throws:
      is.codion.framework.domain.entity.exception.ValidationException - in case the entity is invalid
      NullPointerException - in case the entity is null
    • valid

      is.codion.common.state.StateObserver valid()
      Returns:
      a StateObserver indicating the valid status of the underlying Entity.
      See Also:
    • valid

      is.codion.common.state.StateObserver valid(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Parameters:
      attribute - the attribute
      Returns:
      a StateObserver indicating the valid status of the given attribute.
    • modified

      is.codion.common.state.StateObserver modified()
      Returns a StateObserver indicating when and if any values in the underlying Entity have been modified.
      Returns:
      a StateObserver indicating the modified state of this edit model
    • modified

      is.codion.common.state.StateObserver modified(is.codion.framework.domain.entity.attribute.Attribute<?> attribute)
      Returns a StateObserver instance indicating whether the value of the given attribute has been modified.
      Parameters:
      attribute - the attribute
      Returns:
      a StateObserver indicating the modified state of the value of the given attribute
      Throws:
      IllegalArgumentException - in case attribute is not part of the underlying entity
      See Also:
    • exists

      is.codion.common.state.StateObserver exists()
      Returns:
      a StateObserver indicating whether the active entity exists in the database
    • editing

      is.codion.common.state.StateObserver editing()
      Returns:
      a StateObserver indicating whether the active entity exists and is modified
      See Also:
    • primaryKeyNull

      is.codion.common.state.StateObserver primaryKeyNull()
      Returns:
      a StateObserver indicating whether the primary key of the active entity is null
    • editEvent

      <T> is.codion.common.event.EventObserver<T> editEvent(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns an observer notified each time the value associated with the given attribute is edited via put(Attribute, Object) or remove(Attribute), note that this event is only fired if the value actually changes.
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute which edit observer to return
      Returns:
      an observer for the given attribute value edits
    • valueEvent

      <T> is.codion.common.event.EventObserver<T> valueEvent(is.codion.framework.domain.entity.attribute.Attribute<T> attribute)
      Returns an observer notified each time the value associated with the given attribute changes, either via editing or when the active entity is set.
      Type Parameters:
      T - the value type
      Parameters:
      attribute - the attribute which value observer to return
      Returns:
      an observer for the given attribute value changes
      See Also:
    • valueEvent

      is.codion.common.event.EventObserver<is.codion.framework.domain.entity.attribute.Attribute<?>> valueEvent()
      Returns:
      an observer for attribute value changes
    • entityEvent

      is.codion.common.event.EventObserver<is.codion.framework.domain.entity.Entity> entityEvent()
      Returns:
      an observer notified each time the entity is set via set(Entity) or defaults().
      See Also:
    • beforeEntityEvent

      is.codion.common.event.EventObserver<is.codion.framework.domain.entity.Entity> beforeEntityEvent()
      Returns:
      an observer notified each time the active entity is about to be set
      See Also:
    • beforeInsertEvent

      is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>> beforeInsertEvent()
      Returns:
      an observer notified before an insert is performed
    • afterInsertEvent

      is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>> afterInsertEvent()
      Returns:
      an observer notified after an insert is performed
    • beforeUpdateEvent

      is.codion.common.event.EventObserver<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>> beforeUpdateEvent()
      Returns:
      an observer notified before an update is performed
    • afterUpdateEvent

      is.codion.common.event.EventObserver<Map<is.codion.framework.domain.entity.Entity.Key,is.codion.framework.domain.entity.Entity>> afterUpdateEvent()
      Returns:
      an observer notified after an update is performed
    • beforeDeleteEvent

      is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>> beforeDeleteEvent()
      Returns:
      an observer notified before a delete is performed
    • afterDeleteEvent

      is.codion.common.event.EventObserver<Collection<is.codion.framework.domain.entity.Entity>> afterDeleteEvent()
      Returns:
      an observer notified after a delete is performed
    • insertUpdateOrDeleteEvent

      is.codion.common.event.EventObserver<?> insertUpdateOrDeleteEvent()
      Returns:
      an observer notified each time one or more entities are updated, inserted or deleted via this model