Class TreeInputBuilder


public class TreeInputBuilder extends AbstractInputBuilder<TreeInputBuilder,Object>
  • Constructor Details

  • Method Details

    • setTree

      public TreeInputBuilder setTree(List<Map<String,Object>> tree)
      Adds data set in the predefined structure to the TreeInputBuilder instance.
      The data set needs to be in the proper structure (title/value/children), otherwise the InputBuilderExceptions.IllegalDataStructureException is thrown.
      The PriceFxInterface.TREE_INPUT_KEY_TITLE and PriceFxInterface.TREE_INPUT_KEY_VALUE keys are mandatory. The PriceFxInterface.TREE_INPUT_KEY_CHILDREN key is optional, but when present, needs to be null, empty collection or contains PriceFxInterface.TREE_INPUT_KEY_TITLE and PriceFxInterface.TREE_INPUT_KEY_VALUE.
      Example:
      
         // data set where 'title' and 'value' keys are mandatory and 'children' is optional
         // (can be null, empty collection or title/value/children structure)
         // values for 'value' key needs to be unique across all data set
         def data = [[title   : 'Cars',
                      value   : '[Cars]',
                      children: [[title: 'Bugatti', value: '[Cars, Bugatti]']]],
                     [title   : 'Bikes',
                      value   : '[Bikes]',
                      children: [[title: 'Bugatti', value: '[Bikes, Bugatti]']]]]
      
         if(api.isInputGenerationExecution()) {
            return api.inputBuilderFactory()
                        .createTreeEntry('hierarchicalFilter')
                        .setTree(data)
                        .getInput()
         }
      
         return input.hierarchicalFilter
       
      Parameters:
      tree - List of Map with the data in predefined structure, where 'title' and 'value' keys are mandatory and 'children' is optional (can be null, empty collection or title/value/children structure)
      Returns:
      self
      Since:
      15.0 - Southside
      See Also:
    • setMultiple

      public TreeInputBuilder setMultiple(boolean isMultiple)
      Sets the PriceFxInterface.FIELD_CONTEXTPARAM_MULTIPLE key for the TreeInputBuilder instance.
      Default value is false.
      Example:
      
        return api.inputBuilderFactory()
                    .createTreeEntry('hierarchicalFilter')
                    .setTree(someData)
                    .setMultiple(true)
                    .getInput()
       
      Parameters:
      isMultiple - The multiple flag, default value is false.
      Returns:
      self
      Since:
      15.0 - Southside
    • setCheckedStrategy

      public TreeInputBuilder setCheckedStrategy(TreeInputBuilder.CheckedStrategy strategy)
      Sets the PriceFxInterface.FIELD_CONTEXTPARAM_CHECKED_STRATEGY key for the TreeInputBuilder instance.
      Default value is TreeInputBuilder.CheckedStrategy.PARENT.
      Example:
      
        // the import or static import is required for the CheckedStrategy enum
        import net.pricefx.formulaengine.scripting.inputbuilder.TreeInputBuilder.CheckedStrategy
      
        return api.inputBuilderFactory()
                    .createTreeEntry('hierarchicalFilter')
                    .setTree(someData)
                    .setCheckedStrategy(CheckedStrategy.CHILD)
                    .getInput()
       
      Parameters:
      strategy - The checkedStrategy value, default value is TreeInputBuilder.CheckedStrategy.PARENT.
      Returns:
      self
      Since:
      15.0 - Southside
    • _getInput

      protected Object _getInput()
      Specified by:
      _getInput in class AbstractInputBuilder<TreeInputBuilder,Object>