Interface XHTMLFormEventHandler<T extends DMSForm>

All Superinterfaces:
ObjectFormHandler<T>
All Known Subinterfaces:
XHTMLFolderFormEventHandler<T>
All Known Implementing Classes:
XHTMLFolderFormEventAdapter, XHTMLFormEventAdapter

public interface XHTMLFormEventHandler<T extends DMSForm> extends ObjectFormHandler<T>
This interface is used for writing callback classes enhancing the functionality of forms. The methods onInsert, onUpdate, and onDelete are called before the database operation is performed.
Additional information can be taken from the ThreadContext. If the database operation is done in the context of a HTTP interaction, the ThreadContext contains the HTTP-request with the following parameters:
  • task: the oid of the activity instance (if it is a process form or sub-form)
  • _src: the oid of the main form, if it is a subform
  • _srcclass: the class name of the main form
  • _id: the id of the form relation

In case of View Forms the resolution of the handlers to execute is as follows:
  1. If there are handlers defined for the FormType of the View Form those handlers will be called for the View Form itself.
  2. If no handlers are defined for the FormType of the View Form but there are handlers defined for the FormType of the base form of the View Form, those handlers will be performed on the base form object.
But resolution step 2 is only performed for the follwing methods:
API Note
Objects of this class are cached in the form object for which they are used. As a consequence, consecutive calls of handler methods for that form will be performed by the very same handler objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    This method is called after the form has been deleted from the store.
    default void
    This method is called after the form has been inserted into the store.
    default void
    This method is called after the form has been updated in the store.
    default void
    This method is called before the form is deleted.
    default void
    This method is called before the form is inserted into the store.
    default void
    This method will be called before the page for the passed form is build.
    default void
    This method is called before the form is updated in the store (the existing form in the store will be overwritten with the values of this form).
    default OrgUnit
    Return the org.unit the form belongs to.
    default String[][]
    A class may return key field groups in order to identify already existing objects of that class.
    default String
    Returns the name of this form.
    default void
    modifyModel(T f, Element formElement, FormContext ctx)
    Callback for modifying the model element.
    default void
    This method is called before the form is sent to the browser.
  • Method Details

    • beforeInsert

      default void beforeInsert(T f) throws Exception
      This method is called before the form is inserted into the store.
      Parameters:
      f - the form to insert
      Throws:
      Exception
    • beforeUpdate

      default void beforeUpdate(T f) throws Exception
      This method is called before the form is updated in the store (the existing form in the store will be overwritten with the values of this form).
      Parameters:
      f - the form to update
      Throws:
      Exception
    • beforeDelete

      default void beforeDelete(T f) throws Exception
      This method is called before the form is deleted.
      Parameters:
      f - the form to delete
      Throws:
      Exception
    • afterInsert

      default void afterInsert(T f) throws Exception
      This method is called after the form has been inserted into the store.
      Parameters:
      f - the inserted form
      Throws:
      Exception
    • afterUpdate

      default void afterUpdate(T f) throws Exception
      This method is called after the form has been updated in the store.
      Parameters:
      f - the updated form
      Throws:
      Exception
    • afterDelete

      default void afterDelete(T f) throws Exception
      This method is called after the form has been deleted from the store.
      Parameters:
      f - the deleted form
      Throws:
      Exception
    • beforeShow

      default void beforeShow(T f, FormContext ctx, HttpServletRequest req) throws Exception
      This method will be called before the page for the passed form is build. This allows particularly to set default values for form attributes which will be used when building the page.
      Specified by:
      beforeShow in interface ObjectFormHandler<T extends DMSForm>
      Parameters:
      f - the form to show
      ctx - holds context information for the form
      req - the http request requesting the form's page
      Throws:
      Exception
    • onShow

      default void onShow(T f, FormContext ctx, XHTMLPage p, HttpServletRequest req) throws Exception
      This method is called before the form is sent to the browser.
      Specified by:
      onShow in interface ObjectFormHandler<T extends DMSForm>
      Parameters:
      f - the form to show
      ctx - holds context information for the form
      p - the xhtml page which will be sent to the browser
      req - the http request requesting the form's page
      Throws:
      Exception
    • getName

      default String getName(T f) throws Exception
      Returns the name of this form. If null is returned the default naming mechanism will be used.
      Parameters:
      f - the form which name is wanted
      Returns:
      Default returns null.
      Throws:
      Exception
    • getDefaultOrgUnit

      default OrgUnit getDefaultOrgUnit(T f)
      Return the org.unit the form belongs to. This can be used for permission checks.
      Returns:
      Default returns null
    • getKeys

      default String[][] getKeys(T f)
      A class may return key field groups in order to identify already existing objects of that class. A key field group must uniquely identify an object. Multiple such key field groups can be defined. Each of the key field groups must be unique for an object to be unique (thus, group1 matches OR group2 matches etc.).

      The first key field group is occasionally treated in a special manner as the primary business key. E.g. the export import functionality checks for object existence according to just the first key field group.

      Returns:
      An array of arrays containing object field names of those fields which constitute key field groups for uniquely identifying objects of classes implementing this interface. An example would be {{"name", "birthdate"},{"ssn"}} for a class defining two key field groups. The first one contains the fields name and birthdate, the second key field group has just one field ssn. Default returns empty structure.
    • modifyModel

      default void modifyModel(T f, Element formElement, FormContext ctx)
      Callback for modifying the model element.