Class ContextParameter
- Object
-
- ContextParameter
-
- All Implemented Interfaces:
Serializable
,InjectablePOS
public class ContextParameter extends Object implements InjectablePOS, Serializable
This class represents the input parameter, the input field. So you can use it to set its label, default value, if required, etc.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ContextParameter()
ContextParameter(String name, DMFieldCollection fc, String field, String defaultValue)
ContextParameter(InputType type, String name, Date targetDate, PersistedObjectService objService)
ContextParameter(LookupTable lt, Date targetDate)
ContextParameter(LookupTable lt, Date targetDate, String defaultValue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameterConfigEntry(String key, Object value)
void
applyType(InputType inputType)
ContextParameter
clearConfigParameter(String paramName)
ContextParameter
copyWithoutValue()
boolean
equals(Object obj)
Boolean
getAddUnknownValues()
Boolean
getAlwaysEditable()
Map<String,Object>
getFilter()
InputType
getInputType()
String
getLabel()
String
getLabelTranslations()
String
getLookupTableId()
String
getName()
PersistedObjectService
getObjectService()
Map<String,Object>
getParameterConfig()
String
getParameterGroup()
Boolean
getReadOnly()
String
getType()
String
getTypedId()
String
getURL()
Object
getValue()
String
getValueHint()
String[]
getValueOptions()
int
hashCode()
boolean
isCustomerParam()
boolean
isHiddenParam()
boolean
isLookupType()
boolean
isMatrixParam()
boolean
isOptionParam()
boolean
isOptionsParam()
boolean
isProductGroupParam()
boolean
isProductParam()
Boolean
isRequired()
void
setAddUnknownValues(Boolean addUnknownValues)
void
setAlwaysEditable(Boolean alwaysEditable)
ContextParameter
setConfigParameter(String paramName, Object value)
Adds additional configuration parameter/option to the input.void
setFilter(Map<String,Object> filter)
void
setFilters(Filter... filters)
void
setLabel(String label)
Sets the label of the input parameter to the given text.void
setLabelTranslations(String labelTranslations)
void
setParameterConfig(Map<String,Object> parameterConfig)
void
setParameterGroup(String parameterGroup)
void
setReadOnly(Boolean readOnly)
void
setRequired(Boolean required)
Sets, if it's mandatory for the input parameter to have a value.void
setTypedId(String typedId)
void
setURL(String url)
void
setValue(Object value)
Set initial/default value of the input parameter.void
setValueHint(String hint)
void
setValueOptions(String[] valueOptions)
Sets list of options used in the dropdown input field.void
setValueOptions(List<String> valueOptions)
String
toString()
void
update(ContextParameter cp)
void
updateFromFormulaInputDescriptor(FormulaInputDescriptor fid)
void
updateWithLookupTable(LookupTable lt)
This is a convenience method to update a ContextParameter with a new version of the same lookup table This can happen e.g.
-
-
-
Method Detail
-
updateFromFormulaInputDescriptor
public void updateFromFormulaInputDescriptor(FormulaInputDescriptor fid)
-
updateWithLookupTable
public void updateWithLookupTable(LookupTable lt)
This is a convenience method to update a ContextParameter with a new version of the same lookup table This can happen e.g. if a quote is worked on a while and passes a validity date border or an old quote is copied- Parameters:
lt
-
-
isLookupType
public boolean isLookupType()
-
isCustomerParam
public final boolean isCustomerParam()
-
isProductParam
public final boolean isProductParam()
-
isProductGroupParam
public final boolean isProductGroupParam()
-
isMatrixParam
public final boolean isMatrixParam()
-
isOptionParam
public final boolean isOptionParam()
-
isOptionsParam
public final boolean isOptionsParam()
-
isHiddenParam
public final boolean isHiddenParam()
-
isRequired
public Boolean isRequired()
-
setRequired
public void setRequired(Boolean required)
Sets, if it's mandatory for the input parameter to have a value. The value can be either entered by user or a default value. If the input value is required, but not provided, then it's usually somehow expressed on the screen (usually exclamation mark).In case of Quote, all required fields must be populated, otherwise you cannot submit the Quote for approval.
- Parameters:
required
- If the input value will be required or not.
-
getName
public String getName()
-
getLabel
public String getLabel()
-
setLabel
public void setLabel(String label)
Sets the label of the input parameter to the given text.- Parameters:
label
- The text to be displayed as label of the input field.
-
getLabelTranslations
public String getLabelTranslations()
-
setLabelTranslations
public void setLabelTranslations(String labelTranslations)
-
setFilters
public void setFilters(Filter... filters)
-
getParameterGroup
public String getParameterGroup()
-
setParameterGroup
public void setParameterGroup(String parameterGroup)
-
getURL
public String getURL()
-
setURL
public void setURL(String url)
-
getType
public String getType()
-
getInputType
public InputType getInputType()
-
applyType
public void applyType(InputType inputType)
-
getValueHint
public String getValueHint()
-
setValueHint
public void setValueHint(String hint)
-
getValueOptions
public String[] getValueOptions()
-
setValueOptions
public void setValueOptions(String[] valueOptions)
Sets list of options used in the dropdown input field. This works only for input parameters created viaapi.option()
andapi.options()
Example:
api.option("Country") // ... api.getParameter("Country").setValueOptions(["USA", "DE"])
- Parameters:
valueOptions
-
-
getLookupTableId
public String getLookupTableId()
-
getValue
public Object getValue()
-
setValue
public void setValue(Object value)
Set initial/default value of the input parameter.Important: this makes sense only during the SyntaxCheck execution mode. You cannot set the initial value of input field later during regular execution.
- Parameters:
value
-
-
getReadOnly
public Boolean getReadOnly()
-
setReadOnly
public void setReadOnly(Boolean readOnly)
-
setConfigParameter
public ContextParameter setConfigParameter(String paramName, Object value)
Adds additional configuration parameter/option to the input. These options modifies, how the input field behaves.You can use following
paramName
and their values- inputType - e.g. "range", ...
- formatType - e.g. "PERCENT" (the input will be formatted with % sign and the value returned will be 0..1 instead of 0..100), ...
- from - the minimum value of the allowed value range. Works only for inputType "range".
- to - the maximum value of the allowed value range. Works only for inputType "range".
- labels - labels to be used for the options, e.g. ["USA":"United States of America, "DE":"Germany]
- Parameters:
paramName
-value
-- Returns:
- See Also:
addParameterConfigEntry(String, Object)
-
clearConfigParameter
public ContextParameter clearConfigParameter(String paramName)
-
getAddUnknownValues
public Boolean getAddUnknownValues()
-
setAddUnknownValues
public void setAddUnknownValues(Boolean addUnknownValues)
-
getTypedId
public String getTypedId()
-
setTypedId
public void setTypedId(String typedId)
-
getAlwaysEditable
public Boolean getAlwaysEditable()
-
setAlwaysEditable
public void setAlwaysEditable(Boolean alwaysEditable)
-
copyWithoutValue
public ContextParameter copyWithoutValue()
-
update
public void update(ContextParameter cp)
-
getObjectService
public PersistedObjectService getObjectService()
- Specified by:
getObjectService
in interfaceInjectablePOS
-
-