Class InputBuilderFactory
- Object
-
- InputBuilderFactory
-
public class InputBuilderFactory extends Object
Input Builder Factory class as a convenient way to create inputs (user entries, context parameters).Overview of various input types can be found in article Input Functions.
Example
def nameInput = api.inputBuilderFactory() .createTextUserEntry("Name") .buildContextParameter()
-
-
Constructor Summary
Constructors Constructor Description InputBuilderFactory(FormulaEngineContext context, SandboxCallback callback)
Useapi.inputBuilderFactory()
PublicGroovyAPI.inputBuilderFactory()
to obtain instance of this class from Groovy API.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SimpleInputBuilder<String>
createAnyUserEntry(String paramName)
Creates newUserEntry
InputType.USERENTRY
input (context parameter).SimpleInputBuilder<Boolean>
createBooleanUserEntry(String paramName)
Creates newBooleanUserEntry
Boolean
input (context parameter).ButtonInputBuilder
createButtonEntry(String paramName)
Creates new button input.ConfiguratorInputBuilder
createConfiguratorInputBuilder(String paramName, String formulaName, boolean isInline)
Creates newConfiguratorEntry
CustomerInputBuilder
createCustomerEntry()
Creates newCustomerEntry
InputType.CUSTOMER
input (context parameter).CustomerInputBuilder
createCustomerEntry(String paramName)
Creates newCustomerEntry
InputType.CUSTOMER
input (context parameter).PCGroupInputBuilder
createCustomerGroupEntry()
Creates newCustomerGroupEntry
InputType.CUSTOMERGROUP
input (context parameter).PCGroupInputBuilder
createCustomerGroupEntry(String paramName)
Creates newCustomerGroupEntry
InputType.CUSTOMERGROUP
input (context parameter).DateRangeInputBuilder
createDateRangeUserEntry(String paramName)
Creates newDateRangeUserEntry
input (context parameter).Creates an input parameter Rendered as two date picker fields that let the user enter a date range (start and end date).SimpleInputBuilder<String>
createDateTimeUserEntry(String paramName)
Creates newDateTimeUserEntry
input (context parameter).SimpleInputBuilder<String>
createDateUserEntry(String paramName)
Creates newDateUserEntry
Date
input (context parameter).DmFilterBuilder
createDmFilter(String paramName, String fcTypedId, String field)
Creates newDataMartFilterBuilderUserEntry
InputType.DMFILTERBUILDER
input (context parameter).FilterBuilderInputBuilder
createFilterBuilder(String paramName, String typeCode)
Creates newFilterBuilderUserEntry
InputType.FILTERBUILDER
input (context parameter).SimpleInputBuilder<Object>
createHiddenEntry(String paramName)
Creates new hidden input (context parameter).InputMatrixInputBuilder
createInputMatrix(String paramName)
Creates newInputMatrix
InputType.INPUTMATRIX
input (context parameter).SimpleInputBuilder<Integer>
createIntegerUserEntry(String paramName)
Creates newIntegerUserEntry
Integer
input (context parameter).MultiTierInputBuilder
createMultiTierEntryInputBuilder(String paramName)
Creates a newMultiTierInputBuilder
OptionInputBuilder
createOptionEntry(String paramName)
Creates newOptionEntry
InputType.OPTION
input (context parameter).OptionInputBuilder
createOptionsEntry(String paramName)
Creates newOptionsEntry
InputType.OPTIONS
input (context parameter).ProductInputBuilder
createProductEntry()
Creates newProductEntry
InputType.PRODUCT
input (context parameter).ProductInputBuilder
createProductEntry(String paramName)
Creates newProductEntry
InputType.PRODUCT
input (context parameter).PCGroupInputBuilder
createProductGroupEntry()
Creates newProductGroupEntry
InputType.PRODUCTGROUP
input (context parameter).PCGroupInputBuilder
createProductGroupEntry(String paramName)
Creates newProductGroupEntry
InputType.PRODUCTGROUP
input (context parameter).OptionInputBuilder
createRadioEntry(String paramName)
Creates new radio input (context parameter).StringInputBuilder<String>
createStringUserEntry(String paramName)
Creates newStringUserEntry
input (context parameter).SimpleInputBuilder<String>
createTextUserEntry(String paramName)
Creates newTextUserEntry
InputType.TEXTUSERENTRY
input (context parameter).SimpleInputBuilder<String>
createTimeUserEntry(String paramName)
Creates newTimeUserEntry
input (context parameter).SimpleInputBuilder<BigDecimal>
createUserEntry(String paramName)
Creates newUserEntry
BigDecimal
input (context parameter).VLookupBuilder
createVLookup(String paramName)
Creates newAnyUserEntry
InputType.USERENTRY
input (context parameter).
-
-
-
Constructor Detail
-
InputBuilderFactory
public InputBuilderFactory(FormulaEngineContext context, SandboxCallback callback)
Useapi.inputBuilderFactory()
PublicGroovyAPI.inputBuilderFactory()
to obtain instance of this class from Groovy API.- See Also:
PublicGroovyAPI.inputBuilderFactory()
-
-
Method Detail
-
createUserEntry
public SimpleInputBuilder<BigDecimal> createUserEntry(String paramName)
Creates newUserEntry
BigDecimal
input (context parameter).Side effect: During the Syntax Check mode, this function triggers creation of the input parameter.
- When the user-entered number is a whole number (integer), the value returned is java.lang.Integer.
- When the user-entered number is a decimal number, the value returned is java.math.BigDecimal.
- If you always need the result as a BigDecimal, you can cast it, e.g. api.decimalUserEntry("number") as BigDecimal.
- Parameters:
paramName
- Name of the user input parameter. For the names use the "camel case" (no spaces and capital letters). This value is not meant as a label of the input field, but rather a name which should stay stable for a long time. Remember, the input fields are stored e.g. on every single Quote line item and are created only once when adding the new line. If you need to modify the label (or other properties) of the input parameter, you can use getParameter(String).- Returns:
- User entry input builder.
- See Also:
PublicGroovyAPI.userEntry(String)
,SimpleInputBuilder
-
createIntegerUserEntry
public SimpleInputBuilder<Integer> createIntegerUserEntry(String paramName)
Creates newIntegerUserEntry
Integer
input (context parameter).Side effect: During the Syntax Check mode, this function triggers creation of the input parameter that lets the user enter an integer value. The input is rendered as a numeric field.
- Parameters:
paramName
- Name of the user input parameter. Use "camel case" for the names (no spaces and capital letters). This value is not meant as a label of the input field, but rather a name which should stay stable for a long time. Remember, the input fields are stored e.g. on every single Quote line item and are created only once, when adding the new line. If you need to modify the label (or other properties) of the input parameter, you can use getParameter(String).- Returns:
- Integer user entry builder.
- See Also:
PublicGroovyAPI.integerUserEntry(String)
,SimpleInputBuilder
-
createBooleanUserEntry
public SimpleInputBuilder<Boolean> createBooleanUserEntry(String paramName)
Creates newBooleanUserEntry
Boolean
input (context parameter). Rendered as a checkbox.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Boolean user entry builder.
- See Also:
PublicGroovyAPI.booleanUserEntry(String)
,SimpleInputBuilder
-
createDateUserEntry
public SimpleInputBuilder<String> createDateUserEntry(String paramName)
Creates newDateUserEntry
Date
input (context parameter). Rendered as a date picker field that lets the user enter a date value.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Date user entry builder.
- See Also:
PublicGroovyAPI.dateUserEntry(String)
,SimpleInputBuilder
-
createDateRangeUserEntry
public DateRangeInputBuilder createDateRangeUserEntry(String paramName)
Creates newDateRangeUserEntry
input (context parameter).Creates an input parameter Rendered as two date picker fields that let the user enter a date range (start and end date).Note: This is available in Unity UI only.
- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Date range user entry builder.
- See Also:
PublicGroovyAPI.dateRangeUserEntry(String)
,SimpleInputBuilder
-
createTimeUserEntry
public SimpleInputBuilder<String> createTimeUserEntry(String paramName)
Creates newTimeUserEntry
input (context parameter). Rendered as a time picker field that lets the user enter a time value in the format "HH:mm" (e.g. "23:59").- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Time user entry builder.
- See Also:
PublicGroovyAPI.timeUserEntry(String)
,SimpleInputBuilder
-
createDateTimeUserEntry
public SimpleInputBuilder<String> createDateTimeUserEntry(String paramName)
Creates newDateTimeUserEntry
input (context parameter). Rendered as a datetime picker field that lets the user enter a date time value in the format "dd/MM/yyyy HH:mm" (e.g. "23/01/2019 10:30").Note: The format implicitly uses the GMT/UTC time zone and so the returned value may differ from what was entered on the client side (as the client time may be in a different time zone).
- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- DateTime user entry builder.
- See Also:
PublicGroovyAPI.parseDate(String, String)
,PublicGroovyAPI.dateTimeUserEntry(String)
,InputType.DATETIMEUSERENTRY
,SimpleInputBuilder
-
createRadioEntry
public OptionInputBuilder createRadioEntry(String paramName)
Creates new radio input (context parameter). User can select one value from many by clicking a radio button.- Parameters:
paramName
- Name of the parameter.- Returns:
- Radio user entry builder.
- See Also:
InputType.RADIO
,OptionInputBuilder
-
createHiddenEntry
public SimpleInputBuilder<Object> createHiddenEntry(String paramName)
Creates new hidden input (context parameter). This type of input is not visible to the user.- Parameters:
paramName
- Name of the parameter.- Returns:
- Hidden entry builder.
- See Also:
InputType.HIDDEN
,SimpleInputBuilder
-
createButtonEntry
public ButtonInputBuilder createButtonEntry(String paramName)
Creates new button input.- Parameters:
paramName
- Name of the parameter.- Returns:
- Button entry builder.
- See Also:
ButtonInputBuilder
-
createStringUserEntry
public StringInputBuilder<String> createStringUserEntry(String paramName)
Creates newStringUserEntry
input (context parameter). Returns a text value entered by the user in the input parameter.Side effect: During the Syntax Check mode, this function triggers creation of the single-text input parameter.
- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- String user entry builder.
- See Also:
PublicGroovyAPI.stringUserEntry(String)
,InputType.STRINGUSERENTRY
,StringInputBuilder
-
createTextUserEntry
public SimpleInputBuilder<String> createTextUserEntry(String paramName)
Creates newTextUserEntry
InputType.TEXTUSERENTRY
input (context parameter). Rendered as a multi-line text box that lets the user enter a longer text value.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Text user entry builder.
- See Also:
PublicGroovyAPI.textUserEntry(String)
,PublicGroovyAPI.textUserEntry(String, String)
,InputType.TEXTUSERENTRY
,SimpleInputBuilder
-
createAnyUserEntry
public SimpleInputBuilder<String> createAnyUserEntry(String paramName)
Creates newUserEntry
InputType.USERENTRY
input (context parameter). It is rendered as a user picker dialog / select list.- Parameters:
paramName
- Name of the entry parameter.- Returns:
- User entry input builder.
- See Also:
PublicGroovyAPI.anyUser(String)
,InputType.USERENTRY
,SimpleInputBuilder
-
createVLookup
public VLookupBuilder createVLookup(String paramName)
Creates newAnyUserEntry
InputType.USERENTRY
input (context parameter). Searches for a record in the price parameter table namedparameterName
where the column 'name' matches the value entered by the user (in a drop-down input parameter) and returns the value from the column 'value'.Side effect: During the Syntax Check mode this function creates a new input parameter (drop-down) whose values are taken from the column "Name" of the given Price Parameter.
- Parameters:
paramName
- Name of the price parameter table to look up.- Returns:
- User entry input builder.
- See Also:
PublicGroovyAPI.vLookup(String)
,PublicGroovyAPI.vLookup(String, String, String, String, String, String, String, String)
,InputType.LOOKUP
,InputType.MATRIXLOOKUP
,VLookupBuilder
-
createProductEntry
public ProductInputBuilder createProductEntry()
Creates newProductEntry
InputType.PRODUCT
input (context parameter). This is an empty product entry object that must be filled with input parameters by calling createParameter on the object.- Returns:
- Product entry builder.
- See Also:
PublicGroovyAPI.product()
,InputType.PRODUCT
,ProductInputBuilder
-
createProductEntry
public ProductInputBuilder createProductEntry(String paramName)
Creates newProductEntry
InputType.PRODUCT
input (context parameter). This is commonly used in PromotionManager and RebateManager. It is rendered as a product group picker widget.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Product entry builder.
- See Also:
PublicGroovyAPI.product(String)
,InputType.PRODUCT
,ProductInputBuilder
-
createProductGroupEntry
public PCGroupInputBuilder createProductGroupEntry()
Creates newProductGroupEntry
InputType.PRODUCTGROUP
input (context parameter). This is an empty product group entry object. Must be filled with input parameters by calling createParameter on the object.- Returns:
- Product group entry builder.
- See Also:
PublicGroovyAPI.productGroupEntry(String...)
,PublicGroovyAPI.productGroupEntry(String, String, Object)
,InputType.PRODUCTGROUP
,PCGroupInputBuilder
-
createProductGroupEntry
public PCGroupInputBuilder createProductGroupEntry(String paramName)
Creates newProductGroupEntry
InputType.PRODUCTGROUP
input (context parameter). Creates an input parameter that lets the user select a group of products. This is commonly used in PromotionManager and RebateManager. It is rendered as a product group picker widget.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Product group entry builder.
The input parameter returns the user selection as a Map:
[ "productFieldName" : "attribute3", "productFieldLabel" : "Business Unit", "productFieldValue" : "MeatBall" ]
- See Also:
PublicGroovyAPI.productGroupEntry(String...)
,PublicGroovyAPI.productGroupEntry(String, String, Object)
,InputType.PRODUCTGROUP
,PCGroupInputBuilder
-
createCustomerEntry
public CustomerInputBuilder createCustomerEntry()
Creates newCustomerEntry
InputType.CUSTOMER
input (context parameter). This is an empty customer entry object. Must be filled with input parameters by calling createParameter on the object.- Returns:
- Customer entry builder.
- See Also:
PublicGroovyAPI.customer(String)
,InputType.CUSTOMER
,CustomerInputBuilder
-
createCustomerEntry
public CustomerInputBuilder createCustomerEntry(String paramName)
Creates newCustomerEntry
InputType.CUSTOMER
input (context parameter). This is commonly used in PromotionManager and RebateManager. It is rendered as a customer picker widget.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Customer entry builder.
- See Also:
PublicGroovyAPI.customer(String, String)
,PublicGroovyAPI.customer(String, String, boolean, String, Object)
,InputType.CUSTOMER
,CustomerInputBuilder
-
createCustomerGroupEntry
public PCGroupInputBuilder createCustomerGroupEntry()
Creates newCustomerGroupEntry
InputType.CUSTOMERGROUP
input (context parameter). This is an empty customer group entry object. Must be filled with input parameters by calling createParameter on the object.- Returns:
- Customer group entry builder.
- See Also:
PublicGroovyAPI.customerGroupEntry(String...)
,InputType.CUSTOMERGROUP
,PCGroupInputBuilder
-
createCustomerGroupEntry
public PCGroupInputBuilder createCustomerGroupEntry(String paramName)
Creates newCustomerGroupEntry
InputType.CUSTOMERGROUP
input (context parameter). This input parameter lets the user select a group of customers and returns the selection as a Map. This is commonly used in PromotionManager and RebateManager. It is rendered as a customer group picker widget.- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Customer group input builder.
[ "customerFieldName" : "attribute3", "customerFieldLabel" : "Customer Type", "customerFieldValue" : "Restaurant" ]
- See Also:
PublicGroovyAPI.customerGroupEntry(String, String, Object)
,InputType.CUSTOMERGROUP
,PCGroupInputBuilder
-
createOptionEntry
public OptionInputBuilder createOptionEntry(String paramName)
Creates newOptionEntry
InputType.OPTION
input (context parameter). The input returns a value selected by the user from a list displayed in drop-down input parameter.Side effect: During the Syntax Check mode, this function triggers creation of a drop-down input parameter with the given list of options.
Example:
api.inputBuilderFactory .createOptionEntry("entryName") .setLabel("Entry Label") .addOption("name1") .addOption("name2") .setLabels(["name1": "Label1", "name2": "Label2"]) .buildContextParameter()
- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Option input builder.
- See Also:
PublicGroovyAPI.option(String, Object...)
,PublicGroovyAPI.option(String, List, Map)
,OptionInputBuilder
-
createOptionsEntry
public OptionInputBuilder createOptionsEntry(String paramName)
Creates newOptionsEntry
InputType.OPTIONS
input (context parameter). The input parameter lets the user select multiple values from predefined options. It is rendered as a drop-down list of possible options. Each selected value appears at the top.Example:
api.inputBuilderFactory .createOptionsEntry("entryName") .setLabel("Entry Label") .addOption("name1") .addOption("name2") .setLabels(["name1": "Label1", "name2": "Label2"]) .buildContextParameter()
- Parameters:
paramName
- Name of the user entry parameter.- Returns:
- Option input builder.
- See Also:
PublicGroovyAPI.options(String, Object...)
,PublicGroovyAPI.options(String, List, Map)
,OptionInputBuilder
-
createInputMatrix
public InputMatrixInputBuilder createInputMatrix(String paramName)
Creates newInputMatrix
InputType.INPUTMATRIX
input (context parameter). This input parameter that lets the user select a matrix of values. It renders as a grid-style input widget with the specified columns. The result will be a list (= rows) of maps (= row's columns). The map attribute names are the column names.Make sure the column names are valid JSON identifiers (spaces are ok but try to avoid special chars).
- Parameters:
paramName
- Name of the parameter.- Returns:
- Input matrix input builder.
- See Also:
PublicGroovyAPI.inputMatrix(String, String...)
,PublicGroovyAPI.inputMatrix(String, Map, String...)
,InputMatrixInputBuilder
-
createFilterBuilder
public FilterBuilderInputBuilder createFilterBuilder(String paramName, String typeCode)
Creates newFilterBuilderUserEntry
InputType.FILTERBUILDER
input (context parameter). This input parameter lets the user build a filter for a table of objects of the type defined by thetypeCode
parameter.It is rendered as a filter builder widget allowing to construct a filter (e.g. to define filter for Products, set the
typeCode
toP
).The filter object can be used in other functions, like
PublicGroovyAPI.find(String, Filter...)
,PublicGroovyAPI.stream(String, String, Filter...)
,PublicGroovyAPI.count(String, Filter...)
etc.- Parameters:
paramName
- Name of the user entry parameter.typeCode
- Type code string of the type of the object for which the filter is set. Currently, the supported type codes are "P" (Product data) and "C" (Customer data).- Returns:
- Filter input builder.
- See Also:
PublicGroovyAPI.filterBuilderUserEntry(String, String)
,FilterBuilderInputBuilder
-
createConfiguratorInputBuilder
public ConfiguratorInputBuilder createConfiguratorInputBuilder(String paramName, String formulaName, boolean isInline)
Creates newConfiguratorEntry
- Parameters:
formulaName
- formula name of configuratorisInline
- if it is an inline configurator or notparamName
- name of input- Returns:
ConfiguratorInputBuilder
to set additional options- See Also:
PublicGroovyAPI.createConfiguratorEntry()
,PublicGroovyAPI.createConfiguratorEntry(InputType, String, Date)
,ConfiguratorInputBuilder
-
createDmFilter
public DmFilterBuilder createDmFilter(String paramName, String fcTypedId, String field)
Creates newDataMartFilterBuilderUserEntry
InputType.DMFILTERBUILDER
input (context parameter). This input parameter lets the user build a filter for a given Datamart.The filter can be used in
DatamartContext.Query.where(Filter...)
of thePublicGroovyAPI.datamartQuery(Object...)
.It will render a FilterBuilder widget entry allowing to construct a filter object filtering on the specified Data Source.
Example:
def filter1 = datamartFilterBuilderUserEntry("ProductGroup", "Transactions_DM") def dimFilterList = ["CustomerId", "ProductId"] def filter2 = datamartFilterBuilderUserEntry("ProductGroup", "Transactions_DM", dimFilterList) def dimFilterMap = ["CustomerId" : "CD-00155", "ProductId" : "MB-0005"] def filter3 = datamartFilterBuilderUserEntry("ProductGroup", "Transactions_DM", dimFilterMap, Filter.equal("Country", "DE"))
- Parameters:
paramName
- Name of the user entry parameter.fcTypedId
- Name of the source for which the filter is set. The resolution of the source is as follows:- any Datamart - by typedId, sourceName, uniqueName or label (uniqueName and label for backwards compatibility)
- any FieldCollection - by typedId or sourceName
field
- field name- Returns:
- Datamart filter builder.
- See Also:
PublicGroovyAPI.datamartFilterBuilderUserEntry(String, String, Object...)
,DmFilterBuilder
-
createMultiTierEntryInputBuilder
public MultiTierInputBuilder createMultiTierEntryInputBuilder(String paramName)
Creates a newMultiTierInputBuilder
- Parameters:
paramName
- Name of the parameter.- Returns:
- Multi Tier entry build
-
-