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 interface
PlaceholderReplacer.IEntityContextFactory
-
Field Summary
Fields Modifier and Type Field Description static String
PARAMS_SPLITCHAR
-
Constructor Summary
Constructors Constructor Description PlaceholderReplacer()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static String
cleanUp(String text)
static boolean
containsPlaceholder(String text)
Checks whether the given text contains any placeholder.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_ALL
in given text.static List<Pattern>
getPatternList()
static boolean
matchPlaceholder(String text)
Checks whether the given text is a placeholder, such as[%tf1%]
.static String
parse(IEntityContext ec, String text, Vorgang formRecord, boolean encodeForHTML)
Deprecated.static String
parse(IEntityContext ec, String text, IFormDataAdapter fda, Mandant client, FormVersion formVersion, boolean encodeForHTML)
Deprecated.static String
parse(IEntityContext ec, String text, IFormDataAdapter fda, Mandant client, Vorgang formRecord, boolean encodeForHTML)
Deprecated.static String
parse(IEntityContext ec, String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)
Deprecated.static String
parse(IEntityContext ec, String text, IReplacerParams parameters)
Deprecated.static String
parse(String text, Vorgang formRecord, boolean encodeForHTML)
static String
parse(String text, IExtendedFormRequestContext requestCtx, boolean encodeForHTML)
Replaces as much as it can with the given information of the request Ctxstatic String
parse(String text, IFormDataAdapter fda, Mandant client, FormVersion formVersion, boolean encodeForHTML)
This method applies all available placeholder replacers on the given text.static String
parse(String text, IFormDataAdapter fda, Mandant client, Vorgang formRecord, boolean encodeForHTML)
This method applies all available placeholder replacers on the given text.static String
parse(String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)
Deprecated.static String
parse(String text, IReplacerParams parameters)
static String
parse(String text, IWorkflowProcessingContext wpc)
Deprecated.static String
parse(String text, IWorkflowProcessingContext wpc, boolean encodeUserInput)
Deprecated.static String
parseForContextValues(IEntityContext ec, String text, IContextReplacerParams parameters)
Deprecated.static String
parseForContextValues(String text, IContextReplacerParams parameters)
static String
parseForFormValues(IEntityContext ec, String text, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.static String
parseForFormValues(IEntityContext ec, String text, IFormReplacerParams parameters)
Deprecated.static String
parseForFormValues(String text, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.static String
parseForFormValues(String text, IFormReplacerParams parameters)
static String
parseForI18nValues(String text, II18nValueReplacerParams parameters)
Diese Methode dient dazu, Formularelementplatzhalter durch Formularwerte zu ersetzten.static String
parseForSessionValues(IEntityContext ec, String text, Vorgang process, String baseUrl, String sessionId)
Deprecated.static String
parseForSessionValues(IEntityContext ec, String text, ISessionReplacerParams parameters)
Deprecated.static String
parseForSessionValues(String text, Vorgang process, String baseUrl, String sessionId)
Deprecated.static String
parseForSessionValues(String text, ISessionReplacerParams parameters)
static String
parseForSystemAttributes(IEntityContext ec, String text, Vorgang process, IWorkflowProcessingContext wfpctx)
Deprecated.static String
parseForSystemAttributes(IEntityContext ec, String text, ISystemReplacerParams parameters)
Deprecated.static String
parseForSystemAttributes(String text, Vorgang process, IWorkflowProcessingContext wfpctx)
Deprecated.static String
parseForSystemAttributes(String text, ISystemReplacerParams parameters)
static String
parseForTemplates(IEntityContext ec, String text, Mandant client)
Deprecated.static String
parseForTemplates(IEntityContext ec, String text, ITemplateReplacerParams parameters)
Deprecated.static String
parseForTemplates(String text, Mandant client)
Deprecated.static String
parseForTemplates(String text, ITemplateReplacerParams parameters)
static IParsedPlaceholder
parsePlaceholderRepresentation(String representation)
Parses theIParsedPlaceholder.getRepresentation()
of a placeholder into a placeholder instance with details about the placeholder.static String
replaceFormValue(IEntityContext ec, String placeholder, String placeholderContent, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.static String
replaceFormValue(String placeholder, String placeholderContent, IFormDataAdapter formData, FormVersion formVersion, boolean encodeForHTML)
Deprecated.static String
replaceI18nValue(String placeholder, String placeholderContent, II18nValueReplacerParams parameters)
static String
replaceSessionValues(IEntityContext ec, String placeholder, String placeholderContent, Vorgang process, String sessionId, String baseUrl)
Deprecated.static String
replaceSessionValues(IEntityContext ec, String placeholder, String placeholderContent, IContextReplacerParams parameters, String contextPath)
Deprecated.static String
replaceSessionValues(String placeholder, String placeholderContent, Vorgang process, String sessionId, String baseUrl)
Deprecated.static String
replaceSessionValues(String placeholder, String placeholderContent, IContextReplacerParams parameters, String contextPath)
Deprecated.static String
replaceSystemValue(IEntityContext ec, String placeholder, String placeholderContent, IWorkflowProcessingContext wfpctx)
Deprecated.static String
replaceSystemValue(String placeholder, String placeholderContent, IWorkflowProcessingContext wfpctx)
Deprecated.static String
replaceTemplateValue(IEntityContext ec, String placeholder, String placeholderContent, Mandant client)
Deprecated.static String
replaceTemplateValue(String placeholder, String placeholderContent, Mandant client)
Deprecated.static void
setDefaultFormValueReplacer(IFormValueReplacer formReplacer)
static void
setDefaultI18nValueReplacer(II18nValueReplacer i18nReplacer)
static void
setDefaultSessionValueReplacer(ISessionValueReplacer sessionReplacer)
static void
setDefaultSystemValueReplcaer(ISystemValueReplacer systemReplacer)
static void
setDefaultTemplateValueReplacer(ITemplateValueReplacer templateReplacer)
static void
setECFactory(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
null
when not a valid placeholder.
-
parse
public static String parse(String text, IReplacerParams parameters)
-
parse
@Deprecated public static String parse(String text, IFormDataAdapter fda, IWorkflowProcessingContext wpc, Vorgang vorgang, Mandant mandant, boolean encodeForHTML)
Deprecated.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 (null
umreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean)
zu überspringen)wpc
- Parsen des Texts mitIWorkflowProcessingContext
-Inhalten (null
umparseForSystemAttributes(IEntityContext, String, Vorgang, de.xima.fc.interfaces.processing.IWorkflowProcessingContext)
zu überspringen)vorgang
- Parsen des Texts mit Systemattributen (null
umparseForSystemAttributes(IEntityContext, String, Vorgang, de.xima.fc.interfaces.processing.IWorkflowProcessingContext)
zu überspringen)mandant
-Mandant
auf 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. Passnull
for 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. Passnull
to skipreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean)
.formRecord
- Required form form value placeholders. Passnull
to 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
-String
text to parse for placeholdersrequestCtx
-IExtendedFormRequestContext
holding 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. Passnull
for 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. Passnull
to skipreplaceFormValue(IEntityContext, String, String, IFormDataAdapter, FormVersion, boolean)
.formVersion
- Required form form value placeholders. Passnull
to 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
@Deprecated public static String parse(String text, IWorkflowProcessingContext wpc)
Deprecated.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
@Deprecated public static String parse(String text, IWorkflowProcessingContext wpc, boolean encodeUserInput)
Deprecated.
-
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_ALL
in 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
Pair
with 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)
Checks whether the given text is a placeholder, such as[%tf1%]
. Checks for an exact match, usecontainsPlaceholder(String)
if you want to check for placeholders anywhere within a piece of text.- Parameters:
text
- The text to check.- Returns:
true
if the text is a placeholder of any type,false
otherwise.
-
containsPlaceholder
public static boolean containsPlaceholder(String text)
Checks whether the given text contains any placeholder.- Parameters:
text
- The text to check.- Returns:
true
if the text contains any placeholder of any type,false
otherwise.
-
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.
-
-