Class ConfiguratorEntry
- Object
-
- ConfiguratorEntry
-
- All Implemented Interfaces:
Serializable
,ComplexCalculationResult
public class ConfiguratorEntry extends Object implements ComplexCalculationResult
This class is used to transport a configurator entry. Example: def opts = ["Europe", "USA"] def configurationEntry = api.createConfiguratorEntry(InputType.OPTION, "Sales_Org_inline_01") def contextParameter = configurationEntry.getFirstInput() contextParameter.setValueOptions(opts)- Author:
- cat
- See Also:
PublicGroovyAPI.createConfiguratorEntry(InputType, String)
, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConfiguratorEntry()
Creates an empty configurator entry object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAdditionalConfigValue(String name, String value)
Sets an additional configuration pair Example: def invoicePriceBoundaries = api.createConfiguratorEntry() invoicePriceBoundaries.addAdditionalConfigValue("groupLabel", "Business Rules") invoicePriceBoundaries.addAdditionalConfigValue("showInSectionsPanel", "true")ConfiguratorEntry
addParameter(ContextParameter input)
Adds a parameter to the list of parameters of this object.ContextParameter
createParameter(InputType type, String name)
Creates a parameter and adds it to the list of inputs.ContextParameter
createParameter(InputType type, String name, Date targetDate)
Creates a parameter and adds it to the list of inputs.ConfiguratorEntry
createParameter(ContextParameter input)
Creates a parameter and adds it to the list of inputs.ConfiguratorEntry
createParameter(ContextParameter input, Closure defaultValue)
Creates a parameter and adds it to the list of inputs.Map<String,String>
getAdditionalConfig()
Gets the Map of additional configurationsContextParameter
getFirstInput()
Gets the first context parameter.List<InputButtonAction>
getHiddenActions()
List<ContextParameter>
getInputs()
Gets the list of context parameters parameters.String
getMessage()
Gets the messagePersistedObjectService
getObjectService()
String
getResultType()
The CalculationResultType for this class.void
setAdditionalConfig(Map<String,String> additionalConfig)
Sets all the additional configurations at oncevoid
setContext(FormulaEngineContext ctx)
Sets the FormulaEngineContext.void
setHiddenActions(InputButtonAction... hiddenActions)
void
setInputs(List<ContextParameter> inputs)
Sets the list of context parametersvoid
setMessage(String message)
Sets a message that will appear on top of the configuration entry.
-
-
-
Constructor Detail
-
ConfiguratorEntry
public ConfiguratorEntry()
Creates an empty configurator entry object. Must be filled with input parameters by calling createParameter on the object. Example: def cStartDate = api.input("CStartDate") def configurationEntry = api.createConfiguratorEntry().createParameter(startDate, {cStartDate})
-
-
Method Detail
-
getInputs
public List<ContextParameter> getInputs()
Gets the list of context parameters parameters.- Returns:
- the list of context parameters, or null if no context parameters were previously added
-
getFirstInput
public ContextParameter getFirstInput()
Gets the first context parameter. Example: api.logInfo("fist input value",configuratorEntry.getFirstInput().getValue())- Returns:
- the first context parameter, or null if no context parameter was previously added
-
setInputs
public void setInputs(List<ContextParameter> inputs)
Sets the list of context parameters- Parameters:
inputs
- a list of context parameters. Can be null.- See Also:
ContextParameter
-
getMessage
public String getMessage()
Gets the message- Returns:
- the message, or null if it was not set
-
setMessage
public void setMessage(String message)
Sets a message that will appear on top of the configuration entry. You may use HTML markup. Example: entry.setMessage("Competitor Price Information ")- Parameters:
message
- the text to display as message
-
setHiddenActions
public void setHiddenActions(InputButtonAction... hiddenActions)
-
getHiddenActions
public List<InputButtonAction> getHiddenActions()
-
createParameter
public ContextParameter createParameter(InputType type, String name)
Creates a parameter and adds it to the list of inputs. The parameter will be created without target date. If the FormulaEngineContext is set, it will be used to set the value of the context parameter by retrieving a parameter from the context with the specified name. Example: Date targetDate = context == null? new Date() : context.getTargetDate(); ContextParameter param = ce.createParameter(InputType.OPTION, "Customer_inline_01");- Parameters:
type
- Input type of the parameter.name
- Name of the parameter.- Returns:
- the context parameter
-
createParameter
public ContextParameter createParameter(InputType type, String name, Date targetDate)
Creates a parameter and adds it to the list of inputs. If the FormulaEngineContext is set, it will be used to set the value of the context parameter by retrieving a parameter from the context with the specified name.- Parameters:
type
- Input type of the parameter.name
- Name of the parameter.targetDate
- Target date for the input parameter (not applicable to all input types).- Returns:
- the context parameter
- See Also:
Example: Date targetDate = context == null? new Date() : context.getTargetDate(); ContextParameter param = ce.createParameter(InputType.OPTION, "Customer_inline_01", targetDate);
-
createParameter
public ConfiguratorEntry createParameter(ContextParameter input, Closure defaultValue)
Creates a parameter and adds it to the list of inputs. If the FormulaEngineContext is set, it will be used to set the value of the context parameter by retrieving a parameter from the context with the specified name. If the FormulaEngineContext is not set, or no parameter that matches the name of the input is found in the context, then defaultValue from the closure will be used. Example: ContextParameter annualRebate = configuratorEntry.createParameter(InputType.INTEGERUSERENTRY, "AnnualRebate")- Parameters:
input
- the input element to adddefaultValue
- the value to be used if nothing is selected in the input- Returns:
- this ConfiguratorEntry object instance
-
createParameter
public ConfiguratorEntry createParameter(ContextParameter input)
Creates a parameter and adds it to the list of inputs. If the FormulaEngineContext is set, it will be used to set the value of the context parameter by retrieving a parameter from the context with the specified name. Example: def annualRebate = configuratorEntry.createParameter(InputType.INTEGERUSERENTRY)- Parameters:
input
- the input element to add- Returns:
- this ConfiguratorEntry object instance
-
addParameter
public ConfiguratorEntry addParameter(ContextParameter input)
Adds a parameter to the list of parameters of this object. Example: ContextParameter contextParameter = api.inputBuilderFactory() ... (other methods from the builder) .buildContextParameter() ConfiguratorEntry configuratorEntry = api.createConfiguratorEntry().addParameter(contextParameter)- Parameters:
input
- The ContextParameter to add (f.e an input)- Returns:
- this ConfiguratorEntry object instance
-
getAdditionalConfig
public Map<String,String> getAdditionalConfig()
Gets the Map of additional configurations- Returns:
- the additional config, or null, if nothing was set
-
setAdditionalConfig
public void setAdditionalConfig(Map<String,String> additionalConfig)
Sets all the additional configurations at once- Parameters:
additionalConfig
- a map of additional configuration- See Also:
addAdditionalConfigValue(String, String)
-
addAdditionalConfigValue
public void addAdditionalConfigValue(String name, String value)
Sets an additional configuration pair Example: def invoicePriceBoundaries = api.createConfiguratorEntry() invoicePriceBoundaries.addAdditionalConfigValue("groupLabel", "Business Rules") invoicePriceBoundaries.addAdditionalConfigValue("showInSectionsPanel", "true")- Parameters:
name
- the name of the configuration keyvalue
- the value of the configuration key
-
getResultType
public String getResultType()
The CalculationResultType for this class.- Specified by:
getResultType
in interfaceComplexCalculationResult
- Returns:
- CONFIGURATORENTRY
-
setContext
public void setContext(FormulaEngineContext ctx)
Sets the FormulaEngineContext. It is use for retrieving values when creating parameters- Parameters:
ctx
-
-
getObjectService
public PersistedObjectService getObjectService()
-
-