Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityEditor<R extends EntityEditor<R>>
- Type Parameters:
R- the editor type
- All Known Implementing Classes:
AbstractEntityEditor,SwingEntityEditor
public interface EntityEditor<R extends EntityEditor<R>>
Provides edit access to an underlying entity.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides models for editor components requiring database access.static interfaceEntityEditor.DetailEditors<R extends EntityEditor<R>>Manages detail editors for one-to-one entity composition within anEntityEditor.static interfaceProvides access to the entity instance being edited.static interfaceManages theEntityPersistenceused by this editorstatic interfaceRepresents a background enabled task for entities, used for inserting, updating, deleting, refreshing, setting or replacing, split up for use with a background thread.static interfaceProvides factory methods for creatingEntityEditor.EditorTaskinstances.static interfaceProvides edit access to anAttributevalue in the underlying entity being edited.static interfaceProvides access to the underlying values.static interfaceIndicates whether the active entity exists in the database.static interfaceIndicates whether the active entity is modified, that is, exists and has one or more modified attribute values.static interfaceProvides persistence event observers for the editorstatic interfaceIndicates whether an entity is present, according to the predicate specified viaEntityEditor.Present.predicate().static interfaceManages theEntitySearchModels used by aEntityEditModelstatic interfaceThe editor settings. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Boolean> Specifies whether foreign key values should persist by default when defaults are set Value type: Boolean Default value: truestatic final PropertyValue<Boolean> Specifies whether editors publish their insert, update and delete events toPersistenceEventsValue type: Boolean Default value: true -
Method Summary
Modifier and TypeMethodDescriptiondelete()Note: This method must be called on the UI thread in case a panel has been based on this model.delete(Collection<Entity> entities) Note: This method must be called on the UI thread in case a panel has been based on this model.detail()entities()entity()events()insert()Note: This method must be called on the UI thread in case a panel has been based on this model.insert(Collection<Entity> entities) Note: This method must be called on the UI thread in case a panel has been based on this model.settings()tasks()tasks(EntityConnection connection) update()Note: This method must be called on the UI thread in case a panel has been based on this model.update(Collection<Entity> entities) Note: This method must be called on the UI thread in case a panel has been based on this model.voidvalidate()Validates the current state of the entityvoidValidates the value associated with the given attribute, using the underlying validator.voidValidates the given entity, using the underlying validator.voidvalidate(Collection<Entity> entities) Validates the given entities, using the underlying validator.Controls the validator used by this editor.<T> EntityEditor.EditorValue<T> values()
-
Field Details
-
PUBLISH_PERSISTENCE_EVENTS
Specifies whether editors publish their insert, update and delete events toPersistenceEvents- Value type: Boolean
- Default value: true
- See Also:
-
PERSIST_FOREIGN_KEYS
Specifies whether foreign key values should persist by default when defaults are set- Value type: Boolean
- Default value: true
- See Also:
-
-
Method Details
-
entities
Entities entities()- Returns:
- the underlying domain entities
-
entityDefinition
EntityDefinition entityDefinition()- Returns:
- the entity definition
-
connectionProvider
EntityConnectionProvider connectionProvider()- Returns:
- the connection provider
-
settings
EntityEditor.Settings settings()- Returns:
- the editor settings
-
events
EntityEditor.PersistEvents events()- Returns:
- the
EntityEditor.PersistEvents
-
entity
EntityEditor.EditorEntity entity()- Returns:
- the
EntityEditor.EditorEntityinstance
-
validator
Value<EntityValidator> validator()Controls the validator used by this editor.- Returns:
- the
Valuecontrolling the validator - See Also:
-
validate
Validates the current state of the entity- Throws:
EntityValidationException- in case the entity is invalid
-
validate
Validates the value associated with the given attribute, using the underlying validator.- Parameters:
attribute- the attribute the value is associated with- Throws:
AttributeValidationException- if the given value is not valid for the given attribute
-
validate
Validates the given entities, using the underlying validator. For entities of a type other than this editor is based on, their respective validators are used.- Parameters:
entities- the entities to validate- Throws:
EntityValidationException- on finding the first invalid entity- See Also:
-
validate
Validates the given entity, using the underlying validator. For entities of a type other than this editor is based on, their respective validators are used.- Parameters:
entity- the entity to validate- Throws:
EntityValidationException- in case the entity is invalidNullPointerException- in case the entity is null
-
value
- Type Parameters:
T- the value type- Parameters:
attribute- the attribute- Returns:
- the
EntityEditor.EditorValuerepresenting the given attribute
-
searchModels
EntityEditor.SearchModels searchModels()- Returns:
- the
EntityEditor.SearchModelsinstance
-
detail
EntityEditor.DetailEditors<R> detail()- Returns:
- the
EntityEditor.DetailEditorsinstance
-
persistence
EntityEditor.EditorPersistence persistence()- Returns:
- the
EntityEditor.EditorPersistenceused by this editor
-
values
EntityEditor.EditorValues values()- Returns:
- the
EntityEditor.EditorValues
-
tasks
EntityEditor.EditorTasks tasks()- Returns:
- the
EntityEditor.EditorTasksinstance
-
tasks
- Parameters:
connection- the connection to use when persisting- Returns:
- the
EntityEditor.EditorTasksinstance
-
insert
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:
DatabaseException- in case of a database exceptionEntityValidationException- in case validation failsIllegalStateException- in case inserting is not enabled- See Also:
-
insert
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:
DatabaseException- in case of a database exceptionEntityValidationException- in case validation failsIllegalStateException- in case inserting is not enabled- See Also:
-
update
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:
DatabaseException- in case of a database exceptionEntityModifiedException- in case the entity has been modified since it was loadedEntityValidationException- in case validation failsIllegalStateException- in case updating is not enabledUpdateEntityException- in case the active entity is not modified- See Also:
-
update
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:
DatabaseException- in case of a database exceptionEntityModifiedException- in case an entity has been modified since it was loadedEntityValidationException- in case validation failsIllegalStateException- in case updating is not enabledUpdateEntityException- in case any of the given entities are not modified- See Also:
-
delete
Entity delete()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:
DatabaseException- in case of a database exceptionIllegalStateException- in case deleting is not enabled- See Also:
-
delete
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:
DatabaseException- in case of a database exceptionIllegalStateException- in case deleting is not enabled- See Also:
-