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 Details

  • Constructor Details

    • AbstractCrudFrontend

      protected AbstractCrudFrontend(Class<Model> modelClass, com.valqueries.automapper.ValqueriesCrudRepository<Model,Key> repository)
  • Method Details

    • getPagePath

      public String getPagePath()
      Specified by:
      getPagePath in interface com.persequor.extension.frontend.IFrontendComponent
    • configure

      public void configure(com.persequor.extension.frontend.ConfigurerDetails configurer)
      Specified by:
      configure in interface com.persequor.extension.frontend.IFrontendComponent
    • getPageTitle

      protected String getPageTitle()
      Sets the title of the page. This title will be displayed in the browser tab.
      Returns:
      the title of the page
    • getMenuSectionTitle

      protected String getMenuSectionTitle()
      Sets the title of the menu item.
      Returns:
      the title of the menu item
    • getMenuSectionId

      protected abstract String 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 interface com.persequor.extension.frontend.IFrontendComponent
    • setup

      public 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.
      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

      public String getBackLinkPath(com.persequor.extension.frontend.IInputData inputData)
    • 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

      protected boolean listFilter(Model element, com.persequor.extension.frontend.IInputData inputData)
      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

      public Model 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 inserted
      page - the page where this is happening
      inputData - the inputData which can be inspected for additional values
      creationMessage - 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 happening
      inputData - 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 inserted
      page - the page where this is happening
      inputData - the inputData which can be inspected for additional values
      creationMessage - 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 happening
      inputData - 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

      public com.persequor.extension.frontend.link.ExtensionLink getLinkForAction(String action, Model model, String redirectBackUrl)
    • setLinkActionForObject

      public com.persequor.extension.frontend.link.ParametrizableLink<?> setLinkActionForObject(com.persequor.extension.frontend.link.ParametrizableLink<?> link, Model dataRow, String action)
    • getCompoundKeyParamName

      protected String getCompoundKeyParamName(io.ran.KeySet.Field primaryKey)
    • delete

      public void delete(Model object)
    • hydrateAndSave

      public void hydrateAndSave(Model model, com.persequor.extension.frontend.IPage page, com.persequor.extension.frontend.IInputData inputData, ICreationActionResult creationMessage)
    • insertCells

      protected void insertCells(com.persequor.extension.frontend.ITableRow row, Model object)
    • insertEditField

      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)
    • getOptionsForRelation

      protected Stream<?> getOptionsForRelation(io.ran.RelationDescriber relation)
    • getSelectOptionsForRelation

      protected Map<String,com.persequor.extension.frontend.IString> getSelectOptionsForRelation(io.ran.RelationDescriber relationDescriber)
    • getDateFormat

      @Deprecated protected Map<String,String> getDateFormat()
      Deprecated.
    • getDataRowForAction

      protected Optional<Model> getDataRowForAction(com.persequor.extension.frontend.IInputData inputData)
    • getModelName

      public String 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

      public Class<Model> getModelClass()