Class AbstractGenerator

Object
AbstractGenerator
All Implemented Interfaces:
ConfigurableGenerator, StructureGenerator
Direct Known Subclasses:
AbstractGenerator.Extender, AbstractGenerator.Filter, AbstractGenerator.Grouper, AbstractGenerator.Inserter, AbstractGenerator.Sorter

public abstract class AbstractGenerator extends Object implements ConfigurableGenerator
  • Constructor Details

    • AbstractGenerator

      public AbstractGenerator()
  • Method Details

    • addDefaultFormParameters

      public void addDefaultFormParameters(@NotNull Map<String,Object> form) throws GeneratorUnavailableException
      Description copied from interface: StructureGenerator
      Fills the parameter map for the edit form Velocity template with default values for a new generator item of this type.
      Specified by:
      addDefaultFormParameters in interface StructureGenerator
      Parameters:
      form - form template parameters (output)
      Throws:
      GeneratorUnavailableException - if the operation cannot be performed
    • addParametersToForm

      public void addParametersToForm(@NotNull Map<String,Object> parameters, @NotNull Map<String,Object> form) throws GeneratorUnavailableException
      Description copied from interface: StructureGenerator
      Given the generator-specific parameters, fills the parameter map for the edit form Velocity template.
      Specified by:
      addParametersToForm in interface StructureGenerator
      Parameters:
      parameters - generator parameters (input)
      form - edit form template parameters (output)
      Throws:
      GeneratorUnavailableException - if the operation cannot be performed
    • buildParametersFromForm

      @NotNull public Map<String,Object> buildParametersFromForm(@NotNull Map<String,Object> form, @NotNull ErrorCollection errors) throws GeneratorUnavailableException
      Description copied from interface: StructureGenerator

      Validates the parameters from the edit HTML form and constructs a serializable map of generator-specific parameters.

      Any errors for invalid input parameters must be reported to the provided ErrorCollection; if it contains any error messages after this method is called, they are reported to the user and the resulting map is ignored.

      The resulting parameter map could be stored in the database or transferred over the wire, so it must be serializable to JSON. We advise that you put in only simple objects (strings, numbers, booleans), serializable maps, or lists thereof.

      Specified by:
      buildParametersFromForm in interface StructureGenerator
      Parameters:
      form - the parameters from the edit HTML form (input)
      errors - the collector for error messages (output)
      Returns:
      serializable map of generator-specific parameters
      Throws:
      GeneratorUnavailableException - if the operation cannot be performed
    • addParametersForSummary

      public void addParametersForSummary(@NotNull Map<String,Object> parameters, @NotNull Map<String,Object> summaryParameters)
      Description copied from interface: StructureGenerator

      Given the generator-specific parameters, fills the parameter map for the summary Velocity template.

      Specified by:
      addParametersForSummary in interface StructureGenerator
      Parameters:
      parameters - generator parameters (input)
      summaryParameters - summary template parameters (output)
    • mapOf

      protected static Map<String,Object> mapOf(String key, Object value)
    • mapOf

      protected static Map<String,Object> mapOf(String key1, Object value1, String key2, Object value2)
    • getPresets

      @Nullable public List<GeneratorPreset> getPresets()
      Specified by:
      getPresets in interface ConfigurableGenerator
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: StructureGenerator

      Checks if this generator is currently available in the Automation menu on UI.

      For example, a generator can be unavailable when a certain plug-in is missing, or a certain application feature is disabled.

      Note that Structure doesn't stop work of existing generator items if the generator is unavailable. Structure only hides the generator from the Automation menu so users can't create new items from UI.

      Specified by:
      isAvailable in interface StructureGenerator
      Returns:
      true if the generator must be available in the Automation menu