Class DefaultReplacerParameters
- All Implemented Interfaces:
ILanguageTagProviding, IContextReplacerParams, IFormReplacerParams, II18nValueReplacerParams, IPlaceholderValueParams, IReplacerParams, ISessionReplacerParams, ISystemReplacerParams, ITemplateReplacerParams, Serializable
- Author:
- XIMA MEDIA GmbH
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface IContextReplacerParams
IContextReplacerParams.IContextValueReplacer, IContextReplacerParams.IValueReplacer -
Constructor Summary
ConstructorsConstructorDescriptionDefaultReplacerParameters(Mandant client) DefaultReplacerParameters(Vorgang process) DefaultReplacerParameters(Vorgang process, String sessionId, String baseUrl) DefaultReplacerParameters(Vorgang process, String sessionId, String baseUrl, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) DefaultReplacerParameters(IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML) DefaultReplacerParameters(IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML, boolean encodeFormValuesForPlaceholder) DefaultReplacerParameters(IFormDataAdapter formData, Vorgang process) Deprecated.DefaultReplacerParameters(IWorkflowProcessingContext wfpctx, Vorgang formRecord) DefaultReplacerParameters(IBaseWorkflowExecutionContext wfpctx, Vorgang formRecord) DefaultReplacerParameters(Map<String, Map<String, String>> contextPlaceholderMap, Map<String, IContextReplacerParams.IValueReplacer> contextReplacerMap) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddFormValuePostProcessor(IFormValuePostProcessor formValuePostProcessor) Adds a post processor that can be used to modify the form values after they have been resolved, but before they are converted to the result of the placeholder replacement operation.getClock()Gets the replacer for context placeholders such as[%params.user.name%].com.alibaba.fastjson.JSONObjectcom.alibaba.fastjson.JSONObjectThe placeholder escaper, which should applied for the replaced placeholder values before they returned to the documentWhen a form element placeholder is replaced and the form element is repeated, all repeated values are joined with a comma by default and used as the replacement value.Gets the optional list of post processors that can be used to modify the form values after they have been resolved, but before they are converted to the result of the placeholder replacement operation.Gets the form version from the current context where the placeholder is used, if available.Gets the map of available contextual data for each context, used to replace context placeholders such as[%params.user.name%].Deprecated.Gets the map of replacers for specific context placeholders, used to replace context placeholders such as[%params.user.name%].javax.servlet.http.HttpServletRequestjavax.servlet.http.HttpServletResponsecom.alibaba.fastjson.JSONObjectDeprecated.getXForm()Gets the descriptor of the form (as configured in the form designer), if a form context is available.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanvoidsetBaseUrl(String baseUrl) voidvoidvoidsetContextPath(String contextPath) voidsetContextReplacer(IContextReplacerParams.IContextValueReplacer contextReplacer) Sets the replacer for context placeholders such as[%params.user.name%], i.e. the value that will be returned bygetContextReplacer().voidsetCreatorDataJSON(com.alibaba.fastjson.JSONObject creatorData) voidsetEditorDataJSON(com.alibaba.fastjson.JSONObject editorData) voidsetEncodeForHTML(boolean encodeForHTML) voidsetEncodeFormValuesForPlaceholder(boolean encodeFormValuesForPlaceholder) voidsetEscaper(IPlaceholderEscaper escaper) voidsetFieldRepetitions(Map<String, Integer> fieldRepetitions) voidsetFormData(IFormDataAdapter formData) voidsetFormValuePostProcessors(List<IFormValuePostProcessor> formValuePostProcessors) Sets the list of post processors that can be used to modify the form values after they have been resolved, but before they are converted to the result of the placeholder replacement operation.voidsetFormVersion(FormVersion formVersion) voidsetLanguageTag(String languageTag) voidsetProcess(Vorgang process) voidsetProject(Projekt project) voidsetRepetitionContainer(IRepetitionContainer repetitionContainer) Deprecated.voidsetRepetitionContainer(String repeatedContainer, int ordinalIndex) voidsetReplaceContextPlaceholders(boolean replaceContextPlaceholders) voidsetReplaceFormPlaceholders(boolean replaceFormPlaceholders) voidsetReplaceI18nPlaceholders(boolean replaceI18nPlaceholders) voidsetReplaceSessionPlaceholders(boolean replaceSessionPlaceholders) voidsetReplaceSystemPlaceholders(boolean replaceSystemPlaceholders) voidsetReplaceTemplatePlaceholders(boolean replaceTemplatePlaceholders) voidsetRequest(javax.servlet.http.HttpServletRequest request) voidsetResponse(javax.servlet.http.HttpServletResponse response) voidsetSessionId(String sessionId) voidsetUserDataJSON(com.alibaba.fastjson.JSONObject userData) voidvoidSets the form descriptor explicitly.
-
Constructor Details
-
DefaultReplacerParameters
public DefaultReplacerParameters() -
DefaultReplacerParameters
-
DefaultReplacerParameters
-
DefaultReplacerParameters
-
DefaultReplacerParameters
public DefaultReplacerParameters(IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML) -
DefaultReplacerParameters
public DefaultReplacerParameters(IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML, boolean encodeFormValuesForPlaceholder) -
DefaultReplacerParameters
-
DefaultReplacerParameters
-
DefaultReplacerParameters
-
DefaultReplacerParameters
- Parameters:
wfpctx- A workflow processing context.formRecord- A form record to use, instead of the form record of the given processing context.
-
DefaultReplacerParameters
-
DefaultReplacerParameters
Deprecated.- Parameters:
wfpctx- A workflow processing context.
-
DefaultReplacerParameters
-
DefaultReplacerParameters
-
-
Method Details
-
getFormValuePostProcessors
Description copied from interface:IFormReplacerParamsGets the optional list of post processors that can be used to modify the form values after they have been resolved, but before they are converted to the result of the placeholder replacement operation. Could be used, for example, to parse strings as numbers and convert them to the default number format.- Specified by:
getFormValuePostProcessorsin interfaceIFormReplacerParams- Returns:
- The list of post processors or
nullif none.
-
setFormValuePostProcessors
Sets the list of post processors that can be used to modify the form values after they have been resolved, but before they are converted to the result of the placeholder replacement operation. Could be used, for example, to parse strings as numbers and convert them to the default number format.- Parameters:
formValuePostProcessors- The new list of post processors.
-
addFormValuePostProcessor
Adds a post processor that can be used to modify the form values after they have been resolved, but before they are converted to the result of the placeholder replacement operation. Could be used, for example, to parse strings as numbers and convert them to the default number format.- Parameters:
formValuePostProcessor- The post processor to add.
-
isEncodeFormValuesForPlaceholder
public boolean isEncodeFormValuesForPlaceholder()- Specified by:
isEncodeFormValuesForPlaceholderin interfaceIFormReplacerParams- Specified by:
isEncodeFormValuesForPlaceholderin interfaceIReplacerParams
-
setEncodeFormValuesForPlaceholder
public void setEncodeFormValuesForPlaceholder(boolean encodeFormValuesForPlaceholder) -
getWorkflowProcessing
Deprecated.- Specified by:
getWorkflowProcessingin interfaceISystemReplacerParams- Returns:
- The current workflow processing context, or
nullif none is available.
-
getWorkflowExecutionContext
- Specified by:
getWorkflowExecutionContextin interfaceISystemReplacerParams
-
setWorkflowProcessing
-
getClient
- Specified by:
getClientin interfaceIFormReplacerParams- Specified by:
getClientin interfaceII18nValueReplacerParams- Specified by:
getClientin interfaceISystemReplacerParams- Specified by:
getClientin interfaceITemplateReplacerParams- Returns:
- The current
clientscope.
-
setClient
-
getProcess
- Specified by:
getProcessin interfaceIFormReplacerParams- Specified by:
getProcessin interfaceISessionReplacerParams- Specified by:
getProcessin interfaceISystemReplacerParams- Returns:
- The
form recordcontext, if any, for which the placeholder replacement is performed.
-
getClock
- Specified by:
getClockin interfaceIPlaceholderValueParams- Specified by:
getClockin interfaceISessionReplacerParams- Specified by:
getClockin interfaceISystemReplacerParams- Returns:
- The clock to use for obtaining the current time.
-
setClock
- Parameters:
clock- The clock to use for obtaining the current time.
-
setProcess
-
getProject
- Specified by:
getProjectin interfaceISystemReplacerParams
-
setProject
-
getSessionId
- Specified by:
getSessionIdin interfaceISessionReplacerParams
-
setSessionId
-
getRequest
public javax.servlet.http.HttpServletRequest getRequest()- Specified by:
getRequestin interfaceISessionReplacerParams
-
setRequest
public void setRequest(javax.servlet.http.HttpServletRequest request) -
getResponse
public javax.servlet.http.HttpServletResponse getResponse()- Specified by:
getResponsein interfaceISessionReplacerParams
-
setResponse
public void setResponse(javax.servlet.http.HttpServletResponse response) -
getFormData
- Specified by:
getFormDatain interfaceIFormReplacerParams- Specified by:
getFormDatain interfaceISystemReplacerParams- Returns:
- The
form data adapterwith the data from the curren form record context, if any, for which the placeholder replacement is performed.
-
setFormData
- Specified by:
setFormDatain interfaceIFormReplacerParams- Specified by:
setFormDatain interfaceISystemReplacerParams- Parameters:
formData- New form data to use.
-
getFormVersion
Description copied from interface:ISystemReplacerParamsGets the form version from the current context where the placeholder is used, if available.- Specified by:
getFormVersionin interfaceIFormReplacerParams- Specified by:
getFormVersionin interfaceIPlaceholderValueParams- Specified by:
getFormVersionin interfaceISystemReplacerParams- Returns:
- The
form versioncontext, if any, for which the placeholder replacement is performed.
-
setFormVersion
-
getXForm
Description copied from interface:IFormReplacerParamsGets the descriptor of the form (as configured in the form designer), if a form context is available.- Specified by:
getXFormin interfaceIFormReplacerParams- Returns:
- The form description.
-
setXForm
Sets the form descriptor explicitly.- Parameters:
xForm- The form descriptor to use.
-
getContextPath
- Specified by:
getContextPathin interfaceISessionReplacerParams- Specified by:
getContextPathin interfaceISystemReplacerParams
-
setContextPath
-
getRepetitionContainer
Deprecated.Description copied from interface:IFormReplacerParamsSeeIFormReplacerParams.getFieldRepetitions()for more details.- Specified by:
getRepetitionContainerin interfaceIFormReplacerParams- Returns:
- The repetition context where the replacement is made. May be
null.
-
setRepetitionContainer
Deprecated. -
setRepetitionContainer
-
getFieldRepetitions
Description copied from interface:IFormReplacerParamsWhen a form element placeholder is replaced and the form element is repeated, all repeated values are joined with a comma by default and used as the replacement value. When a repetition container is given as the context for the replacement and the form element is inside the same repetition container, only the value at the given index gets used.For example, let's say we have a form with the following elements:
- ed1
- fs1 (repeated field set with the following elements)
- tf1
- tf2
- fs2 (repeated field set with the following elements)
- upl1
- upl2
valTf1_1,valTf1_2,valTf2_1,valTf1_2,valUpl1_1,valUpl1_2,valUpl2_1,valUpl2_2.Now when we have the placeholder
[%ed1%] [%tf1%] [%upl2%], it is replaced byvalEd1_valTf1_1,valTf1_2 valUpl2_1,valUpl2_2by default.But if we are making the replacement within the context of
upl2, e.g. when that placeholder is used to compute the file name forupl2, we want to use only the value of the current repetition forupl2, not a values joined with a comma.To do this, we can set the field repetitions to
(name="upl2", index=0). Then the placeholder evaluates tovalEd1_valTf1_1,valTf1_2 valUpl2_1. If we set the repetitions to(name="upl1", index=1)instead, the placeholder evaluates tovalEd1_valTf1_1,valTf1_2 valUpl2_2.When this logic should be applied to all items in a repeated container, this method may return just that container. If this logic should be applied only to some items of a repeated container, those items must be returned individually. When multiple of the returned containers match, the first is used. Note however, that if you return a container within a repeated container, the children of the inner (non-repeated) container are not resolved automatically.
- Specified by:
getFieldRepetitionsin interfaceIFormReplacerParams- Returns:
- The repetition context where the replacement is made. A mapping between the name of a form element and the repetition index for that form element or container.
-
setFieldRepetitions
-
getBaseUrl
- Specified by:
getBaseUrlin interfaceISessionReplacerParams
-
setBaseUrl
-
getLanguageTag
- Specified by:
getLanguageTagin interfaceIFormReplacerParams- Specified by:
getLanguageTagin interfaceILanguageTagProviding- Returns:
- The language tag (
Locale.toLanguageTag()) provided by this object.
-
setLanguageTag
-
isEncodeForHTML
public boolean isEncodeForHTML()- Specified by:
isEncodeForHTMLin interfaceIFormReplacerParams- Specified by:
isEncodeForHTMLin interfaceII18nValueReplacerParams- Returns:
- Use
IFormReplacerParams.getEscaper().
-
setEncodeForHTML
public void setEncodeForHTML(boolean encodeForHTML) -
getEscaper
Description copied from interface:IPlaceholderValueParamsThe placeholder escaper, which should applied for the replaced placeholder values before they returned to the document- Specified by:
getEscaperin interfaceIFormReplacerParams- Specified by:
getEscaperin interfaceIPlaceholderValueParams- Specified by:
getEscaperin interfaceIReplacerParams- Returns:
- an instance of
IPlaceholderEscaper
-
setEscaper
-
getReplacerMap
Description copied from interface:IContextReplacerParamsGets the map of replacers for specific context placeholders, used to replace context placeholders such as[%params.user.name%]. The key is the context name, e.g. "params".To replace context placeholders, you can set either use this replacer function, a static map with fixed data via
IContextReplacerParams.getPlaceholderMap(), or a map of replacers viaIContextReplacerParams.getReplacerMap(). If multiple are set, the order of precedence is:IContextReplacerParams.getPlaceholderMap()IContextReplacerParams.getReplacerMap()IContextReplacerParams.getContextReplacer().
IContextReplacerParams.getPlaceholderMap()is preferred if it contains a value for the given context and placeholder. If it does not, then the data fromIContextReplacerParams.getReplacerMap()is used, if any is available. If neither of those provide a value, thenIContextReplacerParams.getContextReplacer()is used.- Specified by:
getReplacerMapin interfaceIContextReplacerParams- Returns:
- The map of replacers, or an empty map if no replacers are available.
- See Also:
-
getContextReplacer
Description copied from interface:IContextReplacerParamsGets the replacer for context placeholders such as[%params.user.name%].To replace context placeholders, you can set either this map of static data, a map of replacers via
IContextReplacerParams.getReplacerMap(), or a custom replacer viaIContextReplacerParams.getContextReplacer(). If multiple are set, the order of precedence is:IContextReplacerParams.getPlaceholderMap()IContextReplacerParams.getReplacerMap()IContextReplacerParams.getContextReplacer().
IContextReplacerParams.getPlaceholderMap()is preferred if it contains a value for the given context and placeholder. If it does not, then the data fromIContextReplacerParams.getReplacerMap()is used, if any is available. If neither of those provide a value, thenIContextReplacerParams.getContextReplacer()is used.- Specified by:
getContextReplacerin interfaceIContextReplacerParams- Returns:
- The replacer, or
nullif no replacer is available. - See Also:
-
setContextReplacer
Sets the replacer for context placeholders such as[%params.user.name%], i.e. the value that will be returned bygetContextReplacer().- Parameters:
contextReplacer- The replacer to set, or null to clear the replacer.
-
getPlaceholderMap
Description copied from interface:IContextReplacerParamsGets the map of available contextual data for each context, used to replace context placeholders such as[%params.user.name%]. The key out the outer map is the context name, e.g. "params". The key of the inner is the placeholder name, e.g. "user.name"; and its value is the replacement value.To replace context placeholders, you can set either this map of static data, a map of replacers via
IContextReplacerParams.getReplacerMap(), or a custom replacer viaIContextReplacerParams.getContextReplacer(). If multiple are set, the order of precedence is:IContextReplacerParams.getPlaceholderMap()IContextReplacerParams.getReplacerMap()IContextReplacerParams.getContextReplacer().
IContextReplacerParams.getPlaceholderMap()is preferred if it contains a value for the given context and placeholder. If it does not, then the data fromIContextReplacerParams.getReplacerMap()is used, if any is available. If neither of those provide a value, thenIContextReplacerParams.getContextReplacer()is used.- Specified by:
getPlaceholderMapin interfaceIContextReplacerParams- Returns:
- The map of context placeholders, or an empty map if no context placeholders are available.
- See Also:
-
getCreatorDataJSON
public com.alibaba.fastjson.JSONObject getCreatorDataJSON()- Specified by:
getCreatorDataJSONin interfaceISystemReplacerParams
-
setCreatorDataJSON
public void setCreatorDataJSON(com.alibaba.fastjson.JSONObject creatorData) -
getEditorDataJSON
public com.alibaba.fastjson.JSONObject getEditorDataJSON()- Specified by:
getEditorDataJSONin interfaceISystemReplacerParams
-
setEditorDataJSON
public void setEditorDataJSON(com.alibaba.fastjson.JSONObject editorData) -
getUserDataJSON
public com.alibaba.fastjson.JSONObject getUserDataJSON()- Specified by:
getUserDataJSONin interfaceISystemReplacerParams
-
setUserDataJSON
public void setUserDataJSON(com.alibaba.fastjson.JSONObject userData) -
isReplaceContextPlaceholders
public boolean isReplaceContextPlaceholders()- Specified by:
isReplaceContextPlaceholdersin interfaceIContextReplacerParams- Returns:
- When
false, context placeholders are not replaced.
-
setReplaceContextPlaceholders
public void setReplaceContextPlaceholders(boolean replaceContextPlaceholders) -
isReplaceSystemPlaceholders
public boolean isReplaceSystemPlaceholders()- Specified by:
isReplaceSystemPlaceholdersin interfaceISystemReplacerParams- Returns:
- When
false, system placeholders are not replaced.
-
setReplaceSystemPlaceholders
public void setReplaceSystemPlaceholders(boolean replaceSystemPlaceholders) -
isReplaceFormPlaceholders
public boolean isReplaceFormPlaceholders()- Specified by:
isReplaceFormPlaceholdersin interfaceIFormReplacerParams- Returns:
- When
false, form placeholders must not be processed at all.
-
setReplaceFormPlaceholders
public void setReplaceFormPlaceholders(boolean replaceFormPlaceholders) -
isReplaceTemplatePlaceholders
public boolean isReplaceTemplatePlaceholders()- Specified by:
isReplaceTemplatePlaceholdersin interfaceITemplateReplacerParams- Returns:
- When
false, template placeholders are not replaced.
-
setReplaceTemplatePlaceholders
public void setReplaceTemplatePlaceholders(boolean replaceTemplatePlaceholders) -
isReplaceI18nPlaceholders
public boolean isReplaceI18nPlaceholders()- Specified by:
isReplaceI18nPlaceholdersin interfaceII18nValueReplacerParams- Returns:
- When
false, i18n placeholders are not replaced.
-
setReplaceI18nPlaceholders
public void setReplaceI18nPlaceholders(boolean replaceI18nPlaceholders) -
isReplaceSessionPlaceholders
public boolean isReplaceSessionPlaceholders()- Specified by:
isReplaceSessionPlaceholdersin interfaceISessionReplacerParams
-
setReplaceSessionPlaceholders
public void setReplaceSessionPlaceholders(boolean replaceSessionPlaceholders)
-
DefaultReplacerParameters(IBaseWorkflowExecutionContext)