Class FieldProcessorRegistry

java.lang.Object
org.alfresco.repo.forms.processor.FieldProcessorRegistry
Direct Known Subclasses:
ContentModelFieldProcessorRegistry

public class FieldProcessorRegistry extends Object
Holds a FieldProcessor implementation for the fields that can be processed by the FormProcessor.
Since:
3.4
Author:
Nick Smith
  • Constructor Details

    • FieldProcessorRegistry

      public FieldProcessorRegistry()
  • Method Details

    • register

      public void register(String key, FieldProcessor processor)
      Registers a FieldProcessor with this registry using the specified key.
      Parameters:
      key - String
      processor - FieldProcessor
    • get

      public FieldProcessor get(String key)
      Returns the FieldProcessor that was registered witht he specified key.
      Parameters:
      key - String
      Returns:
      FieldProcessor
    • buildField

      public Field buildField(String fieldName, FormCreationData data)
      Attempts to build a Field. The method first tries to derive a key from the fieldname, then uses this key to look up a FieldProcessor. This FieldProcessor is then used to generate a Field.
      Parameters:
      fieldName - the name of the field to be created.
      data - A data object used by the FieldProcessor to build the Field.
      Returns:
      a Field or null.
    • getFieldProcessor

      protected FieldProcessor getFieldProcessor(String fieldName)
      Returns a FieldProcessor for the given field name.
      Parameters:
      fieldName - String
      Returns:
      The FieldProcessor implementation for the field or null if there isn't one regsitered.
    • useDefaultProcessor

      protected boolean useDefaultProcessor(String fieldName)
      Determines if the defaultProcessor should be used.
      Parameters:
      fieldName - String
      Returns:
      true if the defaultProcessor should be used, otherwise false.
    • getKey

      protected String getKey(String fieldName)
      Derives the key used to look up the FieldProcessor from the fieldName.
      Parameters:
      fieldName - String
      Returns:
      the key used to look up the FieldProcessor.
    • setDefaultProcessor

      public void setDefaultProcessor(FieldProcessor defaultProcessor)
      Sets the default field processor instance.
      Parameters:
      defaultProcessor - the defaultProcessor to set