- All Known Implementing Classes:
DefaultEntityEditModel,SwingEntityEditModel
public interface EntityEditModel
Specifies a class for editing an
Entity instance.
The underlying attribute values are available via EntityEditor.value(Attribute).- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceProvides event observers for the edit model.static interfaceRepresents a task for persisting entities, inserting, updating or deleting, split up for use with a background thread.static interfaceProvidesEntityEditModel.PersistTasksstatic interfaceThe edit model settings. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PropertyValue<Boolean> Specifies whether edit models publish their insert, update and delete events toPersistenceEventsValue type: Boolean Default value: true -
Method Summary
Modifier and TypeMethodDescriptionDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.delete()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.editor()Returns aEntityEditorwrapping the entity being edited.entities()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()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.
-
Field Details
-
PUBLISH_PERSISTENCE_EVENTS
Specifies whether edit models publish their insert, update and delete events toPersistenceEvents- Value type: Boolean
- Default value: true
- See Also:
-
-
Method Details
-
entityType
EntityType entityType()- Returns:
- the type of the entity this edit model is based on
-
connectionProvider
EntityConnectionProvider connectionProvider()- Returns:
- the connection provider used by this edit model
-
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 edit model
-
editor
EntityEditor editor()Returns aEntityEditorwrapping the entity being edited.EntityEditor.EditorEntity.get()returns an immutable copy of theEntityinstance being edited, whileEntityEditor.EditorEntity.set(Entity)copies the values from the givenEntityinto the underlyingEntity. Note that value changes must go through theEntityEditor.EditorValueaccessible viaEntityEditor.value(Attribute).- Returns:
- the
EntityEditorwrapping theEntityinstance being edited - See Also:
-
tasks
EntityEditModel.PersistTasks tasks()- Returns:
- the
EntityEditModel.PersistTasks
-
events
EntityEditModel.PersistEvents events()- Returns:
- the
EntityEditModel.PersistEvents
-
entities
Entities entities()- Returns:
- the underlying domain entities
-
entityDefinition
EntityDefinition entityDefinition()- Returns:
- the definition of the underlying entity
-
settings
EntityEditModel.Settings settings()- Returns:
- the edit model settings
-
insert
Entity 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 exceptionValidationException- 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 exceptionValidationException- in case validation failsIllegalStateException- in case inserting is not enabled- See Also:
-
update
Entity 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 loadedValidationException- 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 loadedValidationException- 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:
-