Module is.codion.framework.model
Package is.codion.framework.model
Class AbstractEntityEditor<R extends AbstractEntityEditor<R>>
java.lang.Object
is.codion.framework.model.AbstractEntityEditor<R>
- Type Parameters:
R- the editor type
- All Implemented Interfaces:
EntityEditor<R>
- Direct Known Subclasses:
SwingEntityEditor
public abstract class AbstractEntityEditor<R extends AbstractEntityEditor<R>>
extends Object
implements EntityEditor<R>
An abstract
EntityEditor implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface is.codion.framework.model.EntityEditor
EntityEditor.ComponentModels, EntityEditor.DetailEditors<R extends EntityEditor<R>>, EntityEditor.EditorEntity, EntityEditor.EditorPersistence, EntityEditor.EditorTask<T>, EntityEditor.EditorTasks, EntityEditor.EditorValue<T>, EntityEditor.EditorValues, EntityEditor.Exists, EntityEditor.Modified, EntityEditor.PersistEvents, EntityEditor.Present, EntityEditor.SearchModels, EntityEditor.Settings -
Field Summary
Fields inherited from interface is.codion.framework.model.EntityEditor
PERSIST_FOREIGN_KEYS, PUBLISH_PERSISTENCE_EVENTS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractEntityEditor(EntityType entityType, EntityConnectionProvider connectionProvider, EntityEditor.ComponentModels componentModels) Instantiates anAbstractEntityEditor -
Method Summary
Modifier and TypeMethodDescriptionprotected EntityEditor.ComponentModelsfinal 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 EntityEditor.DetailEditors<R> detail()final Entitiesentities()entity()final EntityDefinitionevents()protected voidexecute(EntityEditor.EditorTask<Entity> task) Executes the given task, by default this is done synchronously, override to provide async executionfinal 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 EntityEditor.Settingssettings()final EntityEditor.EditorTaskstasks()final EntityEditor.EditorTaskstasks(EntityConnection connection) 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.final voidvalidate()Validates the current state of the entityfinal voidValidates the value associated with the given attribute, using the underlying validator.final voidValidates the given entity, using the underlying validator.final voidvalidate(Collection<Entity> entities) Validates the given entities, using the underlying validator.final Value<EntityValidator> Controls the validator used by this editor.final <T> EntityEditor.EditorValue<T> values()
-
Constructor Details
-
AbstractEntityEditor
protected AbstractEntityEditor(EntityType entityType, EntityConnectionProvider connectionProvider, EntityEditor.ComponentModels componentModels) Instantiates anAbstractEntityEditor- Parameters:
entityType- the entity typeconnectionProvider- the connection providercomponentModels- the editor component models
-
-
Method Details
-
entities
- Specified by:
entitiesin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the underlying domain entities
-
entityDefinition
- Specified by:
entityDefinitionin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the entity definition
-
connectionProvider
- Specified by:
connectionProviderin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the connection provider
-
settings
- Specified by:
settingsin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the editor settings
-
events
- Specified by:
eventsin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.PersistEvents
-
entity
- Specified by:
entityin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.EditorEntityinstance
-
values
- Specified by:
valuesin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.EditorValues
-
validator
Description copied from interface:EntityEditorControls the validator used by this editor.- Specified by:
validatorin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
Valuecontrolling the validator - See Also:
-
validate
Description copied from interface:EntityEditorValidates the current state of the entity- Specified by:
validatein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Throws:
EntityValidationException- in case the entity is invalid
-
validate
Description copied from interface:EntityEditorValidates the value associated with the given attribute, using the underlying validator.- Specified by:
validatein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Parameters:
attribute- the attribute the value is associated with- Throws:
AttributeValidationException- if the given value is not valid for the given attribute
-
validate
Description copied from interface:EntityEditorValidates the given entities, using the underlying validator. For entities of a type other than this editor is based on, their respective validators are used.- Specified by:
validatein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Parameters:
entities- the entities to validate- Throws:
EntityValidationException- on finding the first invalid entity- See Also:
-
validate
Description copied from interface:EntityEditorValidates the given entity, using the underlying validator. For entities of a type other than this editor is based on, their respective validators are used.- Specified by:
validatein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Parameters:
entity- the entity to validate- Throws:
EntityValidationException- in case the entity is invalid
-
value
Description copied from interface:EntityEditor- Specified by:
valuein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Type Parameters:
T- the value type- Parameters:
attribute- the attribute- Returns:
- the
EntityEditor.EditorValuerepresenting the given attribute
-
searchModels
- Specified by:
searchModelsin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.SearchModelsinstance
-
detail
- Specified by:
detailin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.DetailEditorsinstance
-
persistence
- Specified by:
persistencein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.EditorPersistenceused by this editor
-
tasks
- Specified by:
tasksin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the
EntityEditor.EditorTasksinstance
-
tasks
- Specified by:
tasksin interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Parameters:
connection- the connection to use when persisting- Returns:
- the
EntityEditor.EditorTasksinstance
-
insert
Description copied from interface:EntityEditorNote: 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 interfaceEntityEditor<R extends AbstractEntityEditor<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:EntityEditorNote: 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 interfaceEntityEditor<R extends AbstractEntityEditor<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:EntityEditorNote: 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 interfaceEntityEditor<R extends AbstractEntityEditor<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:EntityEditorNote: 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 interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Parameters:
entities- the entities to update- Returns:
- the updated entities
- Throws:
EntityValidationException- in case validation fails- See Also:
-
delete
Description copied from interface:EntityEditorNote: This method must be called on the UI thread in case a panel has been based on this model.- Specified by:
deletein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Returns:
- the deleted entity
- See Also:
-
delete
Description copied from interface:EntityEditorNote: This method must be called on the UI thread in case a panel has been based on this model.- Specified by:
deletein interfaceEntityEditor<R extends AbstractEntityEditor<R>>- Parameters:
entities- the entities to delete- Returns:
- the deleted entities
- See Also:
-
toString
-
componentModels
- Returns:
- the
EntityEditor.ComponentModelsinstance
-
execute
Executes the given task, by default this is done synchronously, override to provide async execution- Parameters:
task- the task to execute
-