Package de.xima.fc.placeholder
Class PlaceholderReplacer
- java.lang.Object
-
- de.xima.fc.placeholder.PlaceholderReplacer
-
public class PlaceholderReplacer extends Object
Class to replace placeholders
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePlaceholderReplacer.IEntityContextFactory
-
Field Summary
Fields Modifier and Type Field Description static StringPARAMS_SPLITCHAR
-
Constructor Summary
Constructors Constructor Description PlaceholderReplacer()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static StringcleanUp(String text)static org.apache.commons.lang3.tuple.Pair<String,List<String>>extractAndReplace(String text, String replacement, IReplacerParams params)Searches after all placeholders (with pattern:CmnConst.PH_PATTERN_ALLin given text.static List<Pattern>getPatternList()static booleanmatchPlaceholder(String text)static Stringparse(IEntityContext ec, String text, Vorgang formRecord, boolean encodeForHTML)Deprecated.static Stringparse(IEntityContext ec, String text, IFormDataAdapter fda, Mandant client, FormVersion formVersion, boolean encodeForHTML)Deprecated.static Stringparse(IEntityContext ec, String text, IFormDataAdapter fda, Mandant client, Vorgang formRecord, boolean encodeForHTML)Deprecated.static Stringparse(IEntityContext ec, String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)Deprecated.static Stringparse(IEntityContext ec, String text, IReplacerParams parameters)Deprecated.static Stringparse(String text, Vorgang formRecord, boolean encodeForHTML)static Stringparse(String text, IExtendedFormRequestContext requestCtx, boolean encodeForHTML)Replaces as much as it can with the given information of the request Ctxstatic Stringparse(String text, IFormDataAdapter fda, Mandant client, FormVersion formVersion, boolean encodeForHTML)This method applies all available placeholder replacers on the given text.static Stringparse(String text, IFormDataAdapter fda, Mandant client, Vorgang formRecord, boolean encodeForHTML)This method applies all available placeholder replacers on the given text.static Stringparse(String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)Diese Methode dient dazu, all verfügbaren Parser auf einen Text anzuwenden.static Stringparse(String text, IReplacerParams parameters)static Stringparse(String text, IWorkflowProcessingContext wpc)Diese Methode dient dazu, all verfügbaren Parser auf einen Text anzuwenden.static Stringparse(String text, IWorkflowProcessingContext wpc, boolean encodeUserInput)static StringparseForContextValues(IEntityContext ec, String text, IContextReplacerParams parameters)Deprecated.static StringparseForContextValues(String text, IContextReplacerParams parameters)static StringparseForFormValues(IEntityContext ec, String text, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)Deprecated.static StringparseForFormValues(IEntityContext ec, String text, IFormReplacerParams parameters)Deprecated.static StringparseForFormValues(String text, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)Deprecated.static StringparseForFormValues(String text, IFormReplacerParams parameters)static StringparseForI18nValues(String text, II18nValueReplacerParams parameters)Diese Methode dient dazu, Formularelementplatzhalter durch Formularwerte zu ersetzten.static StringparseForSessionValues(IEntityContext ec, String text, Vorgang process, String baseUrl, String sessionId)Deprecated.static StringparseForSessionValues(IEntityContext ec, String text, ISessionReplacerParams parameters)Deprecated.static StringparseForSessionValues(String text, Vorgang process, String baseUrl, String sessionId)Deprecated.static StringparseForSessionValues(String text, ISessionReplacerParams parameters)static StringparseForSystemAttributes(IEntityContext ec, String text, Vorgang process, IWorkflowProcessingContext wfpctx)Deprecated.static StringparseForSystemAttributes(IEntityContext ec, String text, ISystemReplacerParams parameters)Deprecated.static StringparseForSystemAttributes(String text, Vorgang process, IWorkflowProcessingContext wfpctx)Deprecated.static StringparseForSystemAttributes(String text, ISystemReplacerParams parameters)static StringparseForTemplates(IEntityContext ec, String text, Mandant client)Deprecated.static StringparseForTemplates(IEntityContext ec, String text, ITemplateReplacerParams parameters)Deprecated.static StringparseForTemplates(String text, Mandant client)Deprecated.static StringparseForTemplates(String text, ITemplateReplacerParams parameters)static IParsedPlaceholderparsePlaceholderRepresentation(String representation)Parses theIParsedPlaceholder.getRepresentation()of a placeholder into a placeholder instance with details about the placeholder.static StringreplaceFormValue(IEntityContext ec, String placeholder, String placeholderContent, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)Deprecated.static StringreplaceFormValue(String placeholder, String placeholderContent, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)Deprecated.static StringreplaceI18nValue(String placeholder, String placeholderContent, II18nValueReplacerParams parameters)static StringreplaceSessionValues(IEntityContext ec, String placeholder, String placeholderContent, Vorgang process, String sessionId, String baseUrl)Deprecated.static StringreplaceSessionValues(IEntityContext ec, String placeholder, String placeholderContent, IContextReplacerParams parameters, String contextPath)Deprecated.static StringreplaceSessionValues(String placeholder, String placeholderContent, Vorgang process, String sessionId, String baseUrl)Deprecated.static StringreplaceSessionValues(String placeholder, String placeholderContent, IContextReplacerParams parameters, String contextPath)Deprecated.static StringreplaceSystemValue(IEntityContext ec, String placeholder, String placeholderContent, IWorkflowProcessingContext wfpctx)Deprecated.static StringreplaceSystemValue(String placeholder, String placeholderContent, IWorkflowProcessingContext wfpctx)Deprecated.static StringreplaceTemplateValue(IEntityContext ec, String placeholder, String placeholderContent, Mandant client)Deprecated.static StringreplaceTemplateValue(String placeholder, String placeholderContent, Mandant client)Deprecated.static voidsetDefaultFormValueReplacer(IFormValueReplacer formReplacer)static voidsetDefaultI18nValueReplacer(II18nValueReplacer i18nReplacer)static voidsetDefaultSessionValueReplacer(ISessionValueReplacer sessionReplacer)static voidsetDefaultSystemValueReplcaer(ISystemValueReplacer systemReplacer)static voidsetDefaultTemplateValueReplacer(ITemplateValueReplacer templateReplacer)static voidsetECFactory(PlaceholderReplacer.IEntityContextFactory ecFactory)
-
-
-
Field Detail
-
PARAMS_SPLITCHAR
public static final String PARAMS_SPLITCHAR
- See Also:
- Constant Field Values
-
-
Method Detail
-
parsePlaceholderRepresentation
public static IParsedPlaceholder parsePlaceholderRepresentation(String representation)
Parses theIParsedPlaceholder.getRepresentation()of a placeholder into a placeholder instance with details about the placeholder.- Parameters:
representation- Representation of a placeholder to parse, e.g.[%$PROJECT_ID%]. Note that the entire string must be an entire placeholder, you may not pass a string that only contains placeholders.- Returns:
- The parsed placeholder, or
nullwhen not a valid placeholder.
-
parse
public static String parse(String text, IReplacerParams parameters)
-
parse
public static String parse(String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)
Diese Methode dient dazu, all verfügbaren Parser auf einen Text anzuwenden. Wir an entsprechender Stellenullübergeben, so kann ein Parser ausgelassen werden- Parameters:
text- Text der geparst werden sollfda- Parsen des Texts mit Formdateninhalten (nullumreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean)zu überspringen)wpc- Parsen des Texts mitIWorkflowProcessingContext-Inhalten (nullumparseForSystemAttributes(IEntityContext, String, Vorgang, IWorkflowProcessingContext)zu überspringen)vorgang- Parsen des Texts mit Systemattributen (nullumparseForSystemAttributes(IEntityContext, String, Vorgang, IWorkflowProcessingContext)zu überspringen)mandant-Mandantauf dessenTextbaustein-Instanzen zugegriffen werden soll- Returns:
- Zeichenkette mit den ersetzten Platzhaltern
-
parse
public static String parse(String text, IFormDataAdapter fda, Mandant client, Vorgang formRecord, boolean encodeForHTML)
This method applies all available placeholder replacers on the given text. Passnullfor one of the arguments to skip all placeholder replaces that require this argument.- Parameters:
text- The text to be processed.fda- Required for form element placeholders. Passnullto skipreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean).formRecord- Required form form value placeholders. Passnullto skipreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean).client- Client whose template resources are used. Required for template placeholders. Pass null to skipparseForTemplates(IEntityContext, String, Mandant).- Returns:
- The text with all applicable placeholders replaced with their value.
-
parse
public static String parse(String text, IExtendedFormRequestContext requestCtx, boolean encodeForHTML)
Replaces as much as it can with the given information of the request Ctx- Parameters:
text-Stringtext to parse for placeholdersrequestCtx-IExtendedFormRequestContextholding information for replacement- Returns:
- The text with all applicable placeholders replaced with their value.
-
parse
public static String parse(String text, IFormDataAdapter fda, Mandant client, FormVersion formVersion, boolean encodeForHTML)
This method applies all available placeholder replacers on the given text. Passnullfor one of the arguments to skip all placeholder replacements that require this argument.- Parameters:
text- The text to be processed.fda- Required for form element placeholders. Passnullto skipreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean).formVersion- Required form form value placeholders. Passnullto skipreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean).client- Client whose template resources are used. Required for template placeholders. Pass null to skipparseForTemplates(IEntityContext, String, Mandant).- Returns:
- The text with all applicable placeholders replaced with their value.
-
parse
public static String parse(String text, IWorkflowProcessingContext wpc)
Diese Methode dient dazu, all verfügbaren Parser auf einen Text anzuwenden.- Parameters:
text- Text der geparst werden sollwpc- Parsen des Texts mitIWorkflowProcessingContext-Inhalten- Returns:
- Zeichenkette mit den ersetzten Platzhaltern
-
parse
public static String parse(String text, IWorkflowProcessingContext wpc, boolean encodeUserInput)
-
parseForFormValues
public static String parseForFormValues(String text, IFormReplacerParams parameters)
-
parseForSessionValues
public static String parseForSessionValues(String text, ISessionReplacerParams parameters)
-
parseForContextValues
public static String parseForContextValues(String text, IContextReplacerParams parameters)
-
parseForSystemAttributes
public static String parseForSystemAttributes(String text, ISystemReplacerParams parameters)
-
parseForTemplates
public static String parseForTemplates(String text, ITemplateReplacerParams parameters)
-
parseForI18nValues
public static String parseForI18nValues(String text, II18nValueReplacerParams parameters)
Diese Methode dient dazu, Formularelementplatzhalter durch Formularwerte zu ersetzten.- Parameters:
text- - Zeichenkette in der zu ersetzende Platzhalter vorkommenparameters- - the map of i18n variables- Returns:
- geparste Zeichenkette
-
replaceI18nValue
public static String replaceI18nValue(String placeholder, String placeholderContent, II18nValueReplacerParams parameters)
-
cleanUp
public static String cleanUp(String text)
- Parameters:
text- Text to be cleaned from placeholders.- Returns:
- The given text, cleaned such that all placeholders are removed.
-
extractAndReplace
public static org.apache.commons.lang3.tuple.Pair<String,List<String>> extractAndReplace(String text, String replacement, IReplacerParams params)
Searches after all placeholders (with pattern:CmnConst.PH_PATTERN_ALLin given text. Extracts them into an list and replace it with the given replacement-string. All extracted placeholders in the list will be processed with placeholder-replacer.- Parameters:
text- a string with placeholders insidereplacement- a replacement for all placeholders in the given textparams- parameters for the placeholder-replacer- Returns:
- a
Pairwith changed text (on the left side) and a list of parsed placeholders (on the right side)
-
setDefaultSessionValueReplacer
public static void setDefaultSessionValueReplacer(ISessionValueReplacer sessionReplacer)
- Parameters:
sessionReplacer- the sessionReplacer to set
-
setDefaultSystemValueReplcaer
public static void setDefaultSystemValueReplcaer(ISystemValueReplacer systemReplacer)
- Parameters:
systemReplacer- the systemReplcaer to set
-
setDefaultTemplateValueReplacer
public static void setDefaultTemplateValueReplacer(ITemplateValueReplacer templateReplacer)
- Parameters:
templateReplacer- the templateReplacer to set
-
setDefaultFormValueReplacer
public static void setDefaultFormValueReplacer(IFormValueReplacer formReplacer)
- Parameters:
formReplacer- the formReplacer to set
-
setDefaultI18nValueReplacer
public static void setDefaultI18nValueReplacer(II18nValueReplacer i18nReplacer)
- Parameters:
i18nReplacer- the i18nReplacer to set
-
setECFactory
public static void setECFactory(PlaceholderReplacer.IEntityContextFactory ecFactory)
-
matchPlaceholder
public static boolean matchPlaceholder(String text)
-
replaceTemplateValue
@Deprecated public static String replaceTemplateValue(String placeholder, String placeholderContent, Mandant client)
Deprecated.
-
replaceSessionValues
@Deprecated public static String replaceSessionValues(String placeholder, String placeholderContent, Vorgang process, String sessionId, String baseUrl)
Deprecated.
-
replaceSessionValues
@Deprecated public static String replaceSessionValues(String placeholder, String placeholderContent, IContextReplacerParams parameters, String contextPath)
Deprecated.
-
replaceSystemValue
@Deprecated public static String replaceSystemValue(String placeholder, String placeholderContent, IWorkflowProcessingContext wfpctx)
Deprecated.
-
replaceFormValue
@Deprecated public static String replaceFormValue(String placeholder, String placeholderContent, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.
-
parseForTemplates
@Deprecated public static String parseForTemplates(String text, Mandant client)
Deprecated.
-
parseForSystemAttributes
@Deprecated public static String parseForSystemAttributes(String text, Vorgang process, IWorkflowProcessingContext wfpctx)
Deprecated.
-
parseForSessionValues
@Deprecated public static String parseForSessionValues(String text, Vorgang process, String baseUrl, String sessionId)
Deprecated.
-
parseForFormValues
@Deprecated public static String parseForFormValues(String text, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.
-
parse
@Deprecated public static String parse(IEntityContext ec, String text, IReplacerParams parameters)
Deprecated.
-
parse
@Deprecated public static String parse(IEntityContext ec, String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)
Deprecated.
-
parse
@Deprecated public static String parse(IEntityContext ec, String text, IFormDataAdapter fda, Mandant client, Vorgang formRecord, boolean encodeForHTML)
Deprecated.
-
parse
@Deprecated public static String parse(IEntityContext ec, String text, Vorgang formRecord, boolean encodeForHTML)
Deprecated.
-
parse
@Deprecated public static String parse(IEntityContext ec, String text, IFormDataAdapter fda, Mandant client, FormVersion formVersion, boolean encodeForHTML)
Deprecated.
-
parseForFormValues
@Deprecated public static String parseForFormValues(IEntityContext ec, String text, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.
-
parseForFormValues
@Deprecated public static String parseForFormValues(IEntityContext ec, String text, IFormReplacerParams parameters)
Deprecated.
-
parseForSessionValues
@Deprecated public static String parseForSessionValues(IEntityContext ec, String text, Vorgang process, String baseUrl, String sessionId)
Deprecated.
-
parseForSessionValues
@Deprecated public static String parseForSessionValues(IEntityContext ec, String text, ISessionReplacerParams parameters)
Deprecated.
-
parseForContextValues
@Deprecated public static String parseForContextValues(IEntityContext ec, String text, IContextReplacerParams parameters)
Deprecated.
-
parseForSystemAttributes
@Deprecated public static String parseForSystemAttributes(IEntityContext ec, String text, Vorgang process, IWorkflowProcessingContext wfpctx)
Deprecated.
-
parseForSystemAttributes
@Deprecated public static String parseForSystemAttributes(IEntityContext ec, String text, ISystemReplacerParams parameters)
Deprecated.
-
parseForTemplates
@Deprecated public static String parseForTemplates(IEntityContext ec, String text, Mandant client)
Deprecated.
-
parseForTemplates
@Deprecated public static String parseForTemplates(IEntityContext ec, String text, ITemplateReplacerParams parameters)
Deprecated.
-
replaceTemplateValue
@Deprecated public static String replaceTemplateValue(IEntityContext ec, String placeholder, String placeholderContent, Mandant client)
Deprecated.
-
replaceSessionValues
@Deprecated public static String replaceSessionValues(IEntityContext ec, String placeholder, String placeholderContent, Vorgang process, String sessionId, String baseUrl)
Deprecated.
-
replaceSessionValues
@Deprecated public static String replaceSessionValues(IEntityContext ec, String placeholder, String placeholderContent, IContextReplacerParams parameters, String contextPath)
Deprecated.
-
replaceSystemValue
@Deprecated public static String replaceSystemValue(IEntityContext ec, String placeholder, String placeholderContent, IWorkflowProcessingContext wfpctx)
Deprecated.
-
replaceFormValue
@Deprecated public static String replaceFormValue(IEntityContext ec, String placeholder, String placeholderContent, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.
-
-