Interface FormProvider

All Superinterfaces:
PluginProvider

public interface FormProvider extends PluginProvider
Provides support for defining custom forms with validation and submission logic. This interface allows plugins to create custom forms with server-side validation and processing capabilities.
Since:
1.2.6
  • Method Details

    • getFormName

      String getFormName()
      Returns the display name for this form
      Returns:
      form display name
    • getFormDescription

      default String getFormDescription()
      Returns a description of this form's purpose
      Returns:
      form description
    • hasAccess

      default boolean hasAccess(User user)
      Determines whether the specified user has permission to access this form. This method allows providers to implement custom authorization logic based on user roles, permissions, or other criteria.
      Parameters:
      user - the user to check access for
      Returns:
      true if the user can access this form, false otherwise
    • getFormFields

      Collection<OptionType> getFormFields()
      Provides the collection of OptionType fields that make up this form
      Returns:
      Collection of OptionType inputs for the form
    • getFormFieldGroups

      default Collection<OptionTypeFieldGroup> getFormFieldGroups()
      Provides the collection of OptionTypeFieldGroup objects that define groupings for form fields. Field groups allow organizing related fields together in the UI with collapsible sections and custom headings.
      Returns:
      Collection of OptionTypeFieldGroup for the form, or null/empty if no groups are defined
    • validateForm

      ServiceResponse validateForm(Map data, Map opts)
      Validates the submitted form data before processing. This method should check all required fields, data formats, business rules, etc.
      Parameters:
      data - the form data submitted by the user
      opts - additional options or context for validation
      Returns:
      ServiceResponse containing validation results. If validation fails, the response should contain error messages explaining what went wrong.
    • submitForm

      ServiceResponse submitForm(Map data, Map opts)
      Processes and submits the form data after successful validation. This method will only be called if validateForm() returns a successful response.
      Parameters:
      data - the form data to process
      opts - additional options or context for submission
      Returns:
      ServiceResponse containing the result of the form submission, including any data that should be returned to the caller
    • prepareFormData

      default Map prepareFormData(Map data, Map opts)
      Optional method to transform or prepare form data before validation. This can be used to normalize data, set defaults, or perform conversions.
      Parameters:
      data - the raw form data
      opts - additional options or context
      Returns:
      the prepared form data