Module is.codion.framework.model
Package is.codion.framework.model
Interface EntityEditModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<M,E,T,R>,T extends EntityTableModel<M,E,T,R>,R extends EntityEditor>
- Type Parameters:
M- theEntityModeltypeE- theEntityEditModeltypeT- theEntityTableModeltypeR- theEntityEditortype
- All Known Implementing Classes:
DefaultEntityEditModel,SwingEntityEditModel
public interface EntityEditModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<M,E,T,R>,T extends EntityTableModel<M,E,T,R>,R extends EntityEditor>
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 interfaceThe edit model settings. -
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()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()Note that the task builder methods throw anIllegalStateExceptionin case the requested action is disabled.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.
-
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
R 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
EntityEditor.PersistTasks tasks()Note that the task builder methods throw anIllegalStateExceptionin case the requested action is disabled.- Returns:
- the
EntityEditor.PersistTasks - See Also:
-
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
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:
-