java.lang.Object
is.codion.framework.model.DefaultEntityEditModel
- All Implemented Interfaces:
EntityEditModel
- Direct Known Subclasses:
SwingEntityEditModel
A default
EntityEditModel implementation-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classManages theEntityPersistenceused by this modelNested classes/interfaces inherited from interface is.codion.framework.model.EntityEditModel
EntityEditModel.PersistEvents, EntityEditModel.PersistTask, EntityEditModel.PersistTasks, EntityEditModel.Settings -
Field Summary
Fields inherited from interface is.codion.framework.model.EntityEditModel
PUBLISH_PERSISTENCE_EVENTS -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEntityEditModel(EntityType entityType, EntityConnectionProvider connectionProvider) Instantiates a newDefaultEntityEditModelbased on the given editorDefaultEntityEditModel(EntityEditor editor) Instantiates a newDefaultEntityEditModelbased on the given editor -
Method Summary
Modifier and TypeMethodDescriptionfinal EntityConnectionDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.final EntityConnectionProviderfinal Entitydelete()Note: This method must be called on the UI thread in case a panel has been based on this model.final Collection<Entity> 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.final Entitiesentities()final EntityDefinitionfinal EntityTypeevents()final Entityinsert()Note: This method must be called on the UI thread in case a panel has been based on this model.final Collection<Entity> insert(Collection<Entity> entities) Note: This method must be called on the UI thread in case a panel has been based on this model.protected final DefaultEntityEditModel.EditPersistencefinal EntityEditModel.Settingssettings()tasks()final StringtoString()final Entityupdate()Note: This method must be called on the UI thread in case a panel has been based on this model.final Collection<Entity> update(Collection<Entity> entities) Note: This method must be called on the UI thread in case a panel has been based on this model.
-
Constructor Details
-
DefaultEntityEditModel
Instantiates a newDefaultEntityEditModelbased on the given editor- Parameters:
entityType- the type of the entity to base thisDefaultEntityEditModelonconnectionProvider- theEntityConnectionProviderinstance
-
DefaultEntityEditModel
Instantiates a newDefaultEntityEditModelbased on the given editor- Parameters:
editor- the editor
-
-
Method Details
-
entities
- Specified by:
entitiesin interfaceEntityEditModel- Returns:
- the underlying domain entities
-
entityDefinition
- Specified by:
entityDefinitionin interfaceEntityEditModel- Returns:
- the definition of the underlying entity
-
toString
-
settings
- Specified by:
settingsin interfaceEntityEditModel- Returns:
- the edit model settings
-
entityType
- Specified by:
entityTypein interfaceEntityEditModel- Returns:
- the type of the entity this edit model is based on
-
connectionProvider
- Specified by:
connectionProviderin interfaceEntityEditModel- Returns:
- the connection provider used by this edit model
-
connection
Description copied from interface:EntityEditModelDo not cache or keep the connection returned by this method in a long living field, since it may become invalid and thereby unusable.- Specified by:
connectionin interfaceEntityEditModel- Returns:
- the connection used by this edit model
-
editor
Description copied from interface:EntityEditModelReturns 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).- Specified by:
editorin interfaceEntityEditModel- Returns:
- the
EntityEditorwrapping theEntityinstance being edited - See Also:
-
tasks
- Specified by:
tasksin interfaceEntityEditModel- Returns:
- the
EntityEditModel.PersistTasks
-
events
- Specified by:
eventsin interfaceEntityEditModel- Returns:
- the
EntityEditModel.PersistEvents
-
insert
Description copied from interface:EntityEditModelNote: 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- Specified by:
insertin interfaceEntityEditModel- Returns:
- the inserted entity
- See Also:
-
insert
Description copied from interface:EntityEditModelNote: 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.- Specified by:
insertin interfaceEntityEditModel- Parameters:
entities- the entities to insert- Returns:
- a list containing the inserted entities
- See Also:
-
update
Description copied from interface:EntityEditModelNote: 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- Specified by:
updatein interfaceEntityEditModel- Returns:
- the updated entity
- See Also:
-
update
Description copied from interface:EntityEditModelNote: This method must be called on the UI thread in case a panel has been based on this model. Updates the given entities.- Specified by:
updatein interfaceEntityEditModel- Parameters:
entities- the entities to update- Returns:
- the updated entities
- See Also:
-
delete
Description copied from interface:EntityEditModelNote: This method must be called on the UI thread in case a panel has been based on this model.- Specified by:
deletein interfaceEntityEditModel- Returns:
- the deleted entity
- See Also:
-
delete
Description copied from interface:EntityEditModelNote: This method must be called on the UI thread in case a panel has been based on this model.- Specified by:
deletein interfaceEntityEditModel- Parameters:
entities- the entities to delete- Returns:
- the deleted entities
- See Also:
-
persistence
- Returns:
- the
DefaultEntityEditModel.EditPersistenceused by this edit model
-