Class AbstractFormProcessor

  • All Implemented Interfaces:
    FormProcessor
    Direct Known Subclasses:
    FilteredFormProcessor

    public abstract class AbstractFormProcessor
    extends java.lang.Object
    implements FormProcessor
    Abstract base class for all FormProcessor implementations provides a regex pattern match to test for processor applicability
    Author:
    Gavin Cornwell
    • Field Detail

      • matchPattern

        protected java.lang.String matchPattern
      • active

        protected boolean active
      • patternMatcher

        protected java.util.regex.Pattern patternMatcher
    • Constructor Detail

      • AbstractFormProcessor

        public AbstractFormProcessor()
    • Method Detail

      • setProcessorRegistry

        public void setProcessorRegistry​(FormProcessorRegistry processorRegistry)
        Sets the form process registry
        Parameters:
        processorRegistry - The FormProcessorRegistry instance
      • setMatchPattern

        public void setMatchPattern​(java.lang.String pattern)
        Sets the match pattern
        Parameters:
        pattern - The regex pattern to use to determine if this processor is applicable
      • setActive

        public void setActive​(boolean active)
        Sets whether this processor is active
        Parameters:
        active - true if the processor should be active
      • register

        public void register()
        Registers this processor with the processor registry
      • isActive

        public boolean isActive()
        Description copied from interface: FormProcessor
        Determines whether this form processor is active
        Specified by:
        isActive in interface FormProcessor
        Returns:
        true if the processor is active
      • isApplicable

        public boolean isApplicable​(Item item)
        Description copied from interface: FormProcessor
        Determines whether this form processor is applicable for the supplied item
        Specified by:
        isApplicable in interface FormProcessor
        Parameters:
        item - The item the form is being generated for
        Returns:
        true if the processor is applicable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • setFormItemType

        protected void setFormItemType​(Form form,
                                       java.lang.String type)
        Gets the Item from the form parameter and sets its type field to type.
        Parameters:
        form - Form
        type - String
      • setFormItemUrl

        protected void setFormItemUrl​(Form form,
                                      java.lang.String url)
        Gets the Item from the form parameter and sets its URL field to url.
        Parameters:
        form - Form
        url - String