Class AbstractCrudFrontend<Model,Key>
java.lang.Object
com.persequor.saga.modules.autocrud.crud.AbstractCrudFrontend<Model,Key>
- All Implemented Interfaces:
com.persequor.extension.frontend.IFrontendComponent
public abstract class AbstractCrudFrontend<Model,Key>
extends Object
implements com.persequor.extension.frontend.IFrontendComponent
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractCrudFrontend
(Class<Model> modelClass, com.valqueries.automapper.ValqueriesCrudRepository<Model, Key> repository) -
Method Summary
Modifier and TypeMethodDescriptionvoid
configure
(com.persequor.extension.frontend.ConfigurerDetails configurer) void
createHydrateAndInsert
(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) Creates a new object, fills its fields from the inputData and inserts it into the repository.Creates a new instance of the model class without any values set.void
getBackLinkPath
(com.persequor.extension.frontend.IInputData inputData) protected String
getCompoundKeyParamName
(io.ran.KeySet.Field primaryKey) getDataRowForAction
(com.persequor.extension.frontend.IInputData inputData) Deprecated.com.persequor.extension.frontend.link.ExtensionLink
getLinkForAction
(String action, Model model, String redirectBackUrl) com.persequor.extension.frontend.link.PageBuilderLink
getLinkToModelTable
(com.persequor.extension.frontend.IInputData inputData, boolean isPreserveFilters) protected int
protected abstract String
protected String
Sets the title of the menu item.protected Stream<?>
getOptionsForRelation
(io.ran.RelationDescriber relation) protected String
Sets the title of the page.getSelectOptionsForRelation
(io.ran.RelationDescriber relationDescriber) static com.persequor.extension.frontend.Width
getWidthFromCount
(int count) void
handle
(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) protected void
handleList
(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) Renders the table.handleList_RenderTable
(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, Stream<Model> items) Render the table, one row for every item and return the items rendered.void
hydrateAndSave
(Model model, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) protected void
insertCells
(com.persequor.extension.frontend.ITableRow row, Model object) protected Optional<com.persequor.extension.frontend.IFormField<?>>
insertEditField
(com.persequor.extension.frontend.IForm form, io.ran.Property<Model> field, io.ran.Mapping object, com.persequor.extension.frontend.IInputData inputData) void
insertEditFields
(com.persequor.extension.frontend.IForm form, com.persequor.extension.frontend.IInputData inputData, Model object) Adds edit field for each field in the model to the form.protected boolean
listFilter
(Model element, com.persequor.extension.frontend.IInputData inputData) Insures that the given object passes all registered filters.protected void
onAfterInsert
(Model newObject, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) This method is invoked after a new object has been inserted.protected void
onAfterSave
(Model object, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) This method is invoked after an object has been saved.protected void
onBeforeInsert
(Model newObject, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) Method which will be invoked before an object is inserted - adding errors will stop the insertion.protected void
onBeforeSave
(Model object, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) Method which will be invoked before an object is saved - adding errors will stop the insertion.void
setFormActionForObject
(com.persequor.extension.frontend.IForm form, Model object, String action) Updates form's fields with details about: 1.com.persequor.extension.frontend.link.ParametrizableLink<?>
setLinkActionForObject
(com.persequor.extension.frontend.link.ParametrizableLink<?> link, Model dataRow, String action) void
setup
(IAutoCrudModelSetup<Model> setup) This method is invoked once when the frontend is set up, here you can modify the default behaviour of the table, its data and filters.protected boolean
Whether the list table should convert the stream to a list to show total rows.protected boolean
Indicate whether the search form and buttons "Filter" and "Clear" should be shown or notprotected boolean
Indicate whether created_at/updated_at/created_by/updated_by should be handled automaticallyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.persequor.extension.frontend.IFrontendComponent
enabled
-
Field Details
-
PARAM_ACTION_TYPE
- See Also:
-
PARAM_ACTION
- See Also:
-
PARAM_BACK_LINK_PATH
- See Also:
-
PARAM_PRESERVE_FILTERS
- See Also:
-
ACTION_TYPE_ROW
- See Also:
-
ACTION_TYPE_TABLE
- See Also:
-
ACTION_LIST
- See Also:
-
FILTER_FORM_SUBMIT
- See Also:
-
modelDesc
-
repository
-
-
Constructor Details
-
AbstractCrudFrontend
-
-
Method Details
-
getPagePath
- Specified by:
getPagePath
in interfacecom.persequor.extension.frontend.IFrontendComponent
-
configure
public void configure(com.persequor.extension.frontend.ConfigurerDetails configurer) - Specified by:
configure
in interfacecom.persequor.extension.frontend.IFrontendComponent
-
getPageTitle
Sets the title of the page. This title will be displayed in the browser tab.- Returns:
- the title of the page
-
getMenuSectionTitle
Sets the title of the menu item.- Returns:
- the title of the menu item
-
getMenuSectionId
- Returns:
- the id of the section under which this crud-page should appear, null if it's not supposed to appear
-
handle
public void handle(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) - Specified by:
handle
in interfacecom.persequor.extension.frontend.IFrontendComponent
-
setup
This method is invoked once when the frontend is set up, here you can modify the default behaviour of the table, its data and filters.- Parameters:
setup
- the default setup for the given model which you can change.
-
getWidthFromCount
public static com.persequor.extension.frontend.Width getWidthFromCount(int count) -
getBackLinkPath
-
getLinkToModelTable
public com.persequor.extension.frontend.link.PageBuilderLink getLinkToModelTable(com.persequor.extension.frontend.IInputData inputData, boolean isPreserveFilters) -
handleList
protected void handleList(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) Renders the table. -
handleList_RenderTable
public List<Model> handleList_RenderTable(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, Stream<Model> items) Render the table, one row for every item and return the items rendered.- Parameters:
page
-inputData
-items
-- Returns:
-
showListTableTotalRows
protected boolean showListTableTotalRows()Whether the list table should convert the stream to a list to show total rows.- Returns:
- true to convert to list, false otherwise
-
getListTableLimit
protected int getListTableLimit()- Returns:
- the number of rows to show in the list table by default.
-
listFilter
Insures that the given object passes all registered filters. -
createHydrateAndInsert
public void createHydrateAndInsert(com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) Creates a new object, fills its fields from the inputData and inserts it into the repository. -
createNewObject
Creates a new instance of the model class without any values set. -
insertEditFields
public void insertEditFields(com.persequor.extension.frontend.IForm form, com.persequor.extension.frontend.IInputData inputData, Model object) Adds edit field for each field in the model to the form. -
onBeforeInsert
protected void onBeforeInsert(Model newObject, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) Method which will be invoked before an object is inserted - adding errors will stop the insertion.- Parameters:
newObject
- the object to be insertedpage
- the page where this is happeninginputData
- the inputData which can be inspected for additional valuescreationMessage
- the result into which errors can be registered
-
onAfterInsert
protected void onAfterInsert(Model newObject, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) This method is invoked after a new object has been inserted. Exceptions thrown from this methods will be logged or ignored.- Parameters:
newObject
- the new object after insertion, modifications to this object will not be persisted.page
- the page where this is happeninginputData
- the inputData which can be inspected for additional values
-
onBeforeSave
protected void onBeforeSave(Model object, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) Method which will be invoked before an object is saved - adding errors will stop the insertion.- Parameters:
object
- the object to be insertedpage
- the page where this is happeninginputData
- the inputData which can be inspected for additional valuescreationMessage
- the result into which errors can be registered
-
onAfterSave
protected void onAfterSave(Model object, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData) This method is invoked after an object has been saved. Exceptions thrown from this methods will be logged or ignored.- Parameters:
object
- the object after saving, modifications to this object will not be persisted.page
- the page where this is happeninginputData
- the inputData which can be inspected for additional values
-
setFormActionForObject
public void setFormActionForObject(com.persequor.extension.frontend.IForm form, Model object, String action) Updates form's fields with details about: 1. the object's key (or keys if many); 2. the action and action's type. -
getLinkForAction
-
setLinkActionForObject
-
getCompoundKeyParamName
-
delete
-
hydrateAndSave
public void hydrateAndSave(Model model, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage) -
insertCells
-
insertEditField
-
getOptionsForRelation
-
getSelectOptionsForRelation
-
getDateFormat
Deprecated. -
getDataRowForAction
-
getModelName
-
showSearchForm
protected boolean showSearchForm()Indicate whether the search form and buttons "Filter" and "Clear" should be shown or not -
useMagicFields
protected boolean useMagicFields()Indicate whether created_at/updated_at/created_by/updated_by should be handled automatically -
getModelClass
-