T
- The type of the encapsulated entity.public interface IEntitySelectModel<T extends ITransferableEntity>
IEntityListModel
describes a list of entities of which one can be selected. It is used mainly for views with
editable lists of entities. In contrast, this interface is meant for views that only require access to a particular
given entity.Modifier and Type | Method and Description |
---|---|
T |
addNew()
Sets the currently selected model to a new model.
|
String |
delete()
Deletes the currently selected model from the database.
|
String |
delete(String targetView)
Deletes the currently selected model from the database.
|
T |
getSelected() |
boolean |
isNew() |
void |
loadLazyData()
Can be overriden to initialize lazily loaded fields on the entity.
|
String |
save()
Saves the currently selected model to the database.
|
String |
save(String targetView)
Saves the currently selected model to the database.
|
String |
save(String targetView,
boolean addSuccessMessage,
boolean addErrorMessage)
Saves the currently selected model to the database.
|
void |
setSelected(T selected)
Sets the currently selected model to the given model.
|
boolean |
setSelectedById(long id)
Sets the selected model to one with the given ID.
|
void |
updateSelected()
Rereads the currently model from the database, discarding any local, unsaved changes.
|
T addNew()
String delete()
isNew()
, does
nothing.String delete(String targetView)
isNew()
, does
nothing.targetView
- The Enum.name()
of a view whose view ID is returned after this operation completes
successfully. Can also be a relative path, in which case that path is returned.T getSelected()
boolean isNew()
void loadLazyData()
String save()
isNew()
, creates a new entry in the database,
otherwise updates the existing entry.String save(String targetView, boolean addSuccessMessage, boolean addErrorMessage)
isNew()
, creates a new entry in the database,
otherwise updates the existing entry. Performs a redirect to the view, if given.addSuccessMessage
- Whether a success message is added to the faces context (in case of success).addErrorMessage
- Whether an error message is added to the faces context (in case of an error).targetView
- If given, performs a redirect to this view if the action succeeds. Must be a name of
Enum.name()
, or a relative link.String save(String targetView)
isNew()
, creates a new entry in the database,
otherwise updates the existing entry. Performs a redirect to the view, if given.targetView
- If given, performs a redirect to this view if the action succeeds. Must be a name of
Enum.name()
, or a relative link.void setSelected(T selected)
getSelected()
model
may not refer to the same instance as the given model.selected
- The model to be selected.boolean setSelectedById(long id)
id
- ID of the model to be selected, as returned by IEntity.getId()
.void updateSelected()
isNew()
.Copyright © 2021 XIMA MEDIA GmbH. All rights reserved.