Interface FormStructureHelper


public interface FormStructureHelper
Interface for retrieving form properties from different form node structures. A form node structure consists of following kinds of nodes:
  1. Form node which has form properties like FormsConstants.START_PROPERTY_ACTION_TYPE, FormsConstants.START_PROPERTY_LOAD_PATH.
  2. Form field node which correspond to various input elements which can be present in form.
Multiple implementations of this interface may be provided. Highest ranked FormStructureHelper whose canManage(Resource) returns true for a given resource, will get used. For getting an instance of this interface check FormStructureHelperFactory
  • Method Details

    • canManage

      boolean canManage(Resource resource)
      Tests whether this FormStructureHelper can obtain form properties from the given node.
      Parameters:
      resource - Resource.
      Returns:
      true if this FormStructureHelper can obtain form properties, false otherwise.
    • getFormResource

      Resource getFormResource(Resource resource)
      Gets the resource corresponding to form element i.e. the resource with form properties.
      Parameters:
      resource - Resource
      Returns:
      form element Resource or null if no form resource is found.
    • getFormElements

      Iterable<Resource> getFormElements(Resource resource)
      Gets the resources corresponding to fields of given form resource.
      Parameters:
      resource - Resource.
      Returns:
      form field Resources.
    • updateFormStructure

      Resource updateFormStructure(Resource resource)
      Updates necessary changes to the form resource. Can be used to set minimal default values for the form (e.g. action type) and to ensure additional mandatory resources (e.g. form start and form end resource)
      Parameters:
      resource - Resource any resource.
      Returns:
      updated form resource or null if it wasn't a form related resource or nothing has to be adapted.