Interface FormEventHandler<T extends DMSForm>

All Known Implementing Classes:
FormEventAdapter

public interface FormEventHandler<T extends DMSForm>
This interface is used for writing callback classes enhancing the functionality of forms. The methods beforeInsert, beforeUpdate, and beforeDelete 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 String
    Returns the name of this form.
    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.
      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, ActivityInstance ai, HTMLPage p, HttpServletRequest req) throws Exception
      This method is called before the form is sent to the browser.
      Parameters:
      f - the form to show
      ai - the actual activity instance (in case of process forms)
      p - the html 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