Pre-persist


Interface IPluginFormPrePersist

Position of pre-persist plugins in Xima® Formcycle's program flow. They are run before submitted forms are saved.

Use cases

Allows you to add a custom check whether submitted forms are to be saved, or rejected. When a submitted form is rejected, it will not be processed any further.

When multiple pre-persist plugins are installed, their order of execution is arbitrary. You should not rely on a certain fixed order.

Pre-persist plugins are run for all forms of the client they belong to, or for all existing forms when installed as a system plugin. We recommend you check whether the plugin should be executed for the current form, for example by defining a plugin property containing a list of allowed forms.

Method signature

IPluginFormPrePersistRetVal execute(IPluginFormPrePersistParams params) throws FCPluginException

Parameters

An object of type IPluginFormPrePersistParams will be passed to the execute method, providing access to an object of type IFormRequestContext. A form request context provides you with access to many properties of the submitted form, including:

  • the current project (getProjekt())
  • the current client ((getMandant())
  • the current form record (getVorgang())
  • the current version of the form with all form fields (getFormVersion())
  • session attributes (getSessionAttributes())
  • current user context that can be used for accessing the database(getUserContext())

Return value

The execute method must return an object implementing IPluginFormPrePersistRetVal.

The class IPluginFormPrePersistRetVal provides a reference implementation. Its constructor expects a boolean flag continueProcessing:

  • true
    The form will be accepted and processed further.

  • false
    The form will not be saved and all further processing stops.