Module is.codion.framework.model
Package is.codion.framework.model
Class DefaultEntityEditModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<M,E,T,R>,T extends EntityTableModel<M,E,T,R>,R extends EntityEditor<M,E,T,R>>
java.lang.Object
is.codion.framework.model.DefaultEntityEditModel<M,E,T,R>
- Type Parameters:
M- theEntityModeltypeE- theEntityEditModeltypeT- theEntityTableModeltypeR- theEntityEditortype
- All Implemented Interfaces:
EntityEditModel<M,E, T, R>
- Direct Known Subclasses:
SwingEntityEditModel
public class DefaultEntityEditModel<M extends EntityModel<M,E,T,R>,E extends EntityEditModel<M,E,T,R>,T extends EntityTableModel<M,E,T,R>,R extends EntityEditor<M,E,T,R>>
extends Object
implements EntityEditModel<M,E,T,R>
A default
EntityEditModel implementation-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityEditModel
EntityEditModel.PersistEvents, EntityEditModel.PersistTasks, EntityEditModel.Settings -
Field Summary
Fields inherited from interface is.codion.framework.model.EntityEditModel
PUBLISH_PERSISTENCE_EVENTS -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEntityEditModel(R 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.final Reditor()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.final 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:
editor- the editor
-
-
Method Details
-
entities
-
entityDefinition
- Specified by:
entityDefinitionin interfaceEntityEditModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the definition of the underlying entity
-
toString
-
settings
-
entityType
- Specified by:
entityTypein interfaceEntityEditModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the type of the entity this edit model is based on
-
connectionProvider
- Specified by:
connectionProviderin interfaceEntityEditModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the
EntityEditorwrapping theEntityinstance being edited - See Also:
-
tasks
- Specified by:
tasksin interfaceEntityEditModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the
EntityEditModel.PersistTasks
-
events
- Specified by:
eventsin interfaceEntityEditModel<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the inserted entity
- Throws:
EntityValidationException- in case validation fails- See Also:
-
insert
public final Collection<Entity> insert(Collection<Entity> entities) throws EntityValidationException 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Parameters:
entities- the entities to insert- Returns:
- a list containing the inserted entities
- Throws:
EntityValidationException- in case validation fails- 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Returns:
- the updated entity
- Throws:
EntityValidationException- in case validation fails- See Also:
-
update
public final Collection<Entity> update(Collection<Entity> entities) throws EntityValidationException 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<M extends EntityModel<M,E, T, R>, E extends EntityEditModel<M, E, T, R>, T extends EntityTableModel<M, E, T, R>, R extends EntityEditor<M, E, T, R>> - Parameters:
entities- the entities to update- Returns:
- the updated entities
- Throws:
EntityValidationException- in case validation fails- 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. -
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.
-