Package org.opencms.workplace.tools
Class CmsToolMacroResolver
java.lang.Object
org.opencms.workplace.tools.CmsToolMacroResolver
- All Implemented Interfaces:
I_CmsMacroResolver
Resolves special macros for the admin view.
Supported macros are:
- admin.userName|id
- admin.groupName|id
- admin.jobName|id
- admin.projectName|id
- admin.ouDescription|fqn
- admin.ouType|fqn
- admin.roleName|id
- Since:
- 6.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringIdentifier for admin parameter names.static final StringIdentifier for admin parameter names.static final StringIdentifier for admin parameter names.static final StringIdentifier for admin parameter names.static final StringIdentifier for admin parameter names.static final StringIdentifier for admin parameter names.static final StringIdentifier for admin parameter names.static final StringIdentifier for admin macros prefix.static final String[]Identified for admin parameter commands.The admin commands wrapped in a List.Fields inherited from interface org.opencms.util.I_CmsMacroResolver
MACRO_DELIMITER, MACRO_DELIMITER_OLD, MACRO_END, MACRO_END_OLD, MACRO_START, MACRO_START_OLD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetMacroValue(String macro) Resolves a single macro to the macro value, returnsnullif the macro could not be resolved.booleanReturnstrueif macros that could not be resolved are kept "as is" in the input String,falseif they are replaced by an empty String.resolveMacros(String input) Resolves the macros in the given input.static StringresolveMacros(String input, CmsWorkplace wp) Resolves the macros in the given input using the provided parameters.
-
Field Details
-
PREFIX_ADMIN
Identifier for admin macros prefix.- See Also:
-
KEY_USERNAME
Identifier for admin parameter names.- See Also:
-
KEY_GROUPNAME
Identifier for admin parameter names.- See Also:
-
KEY_JOBNAME
Identifier for admin parameter names.- See Also:
-
KEY_PROJECTNAME
Identifier for admin parameter names.- See Also:
-
KEY_OUDESCRIPTION
Identifier for admin parameter names.- See Also:
-
KEY_OUTYPE
Identifier for admin parameter names.- See Also:
-
KEY_ROLENAME
Identifier for admin parameter names.- See Also:
-
VALUE_NAME_ARRAY
Identified for admin parameter commands. -
VALUE_NAMES
The admin commands wrapped in a List.
-
-
Constructor Details
-
CmsToolMacroResolver
Default private constructor.- Parameters:
wp- the workplace instance
-
-
Method Details
-
resolveMacros
Resolves the macros in the given input using the provided parameters.A macro in the form
${key}in the content is replaced with it's assigned value returned by themethod of the givenI_CmsMacroResolver.getMacroValue(String)instance.I_CmsMacroResolverIf a macro is found that can not be mapped to a value by the given macro resolver, it is left untouched in the input.
- Parameters:
input- the input in which to resolve the macroswp- the workplace class for falling back- Returns:
- the input with the macros resolved
-
getMacroValue
Description copied from interface:I_CmsMacroResolverResolves a single macro to the macro value, returnsnullif the macro could not be resolved.- Specified by:
getMacroValuein interfaceI_CmsMacroResolver- Parameters:
macro- the macro to resolve- Returns:
- the resolved macro or
nullif the macro could not be resolved - See Also:
-
resolveMacros
Resolves the macros in the given input.Calls
until no more macros can be resolved in the input. This way "nested" macros in the input are resolved as well.resolveMacros(String)- Specified by:
resolveMacrosin interfaceI_CmsMacroResolver- Parameters:
input- the input to resolve the macros in- Returns:
- the input with all macros resolved
- See Also:
-
isKeepEmptyMacros
Description copied from interface:I_CmsMacroResolverReturnstrueif macros that could not be resolved are kept "as is" in the input String,falseif they are replaced by an empty String.- Specified by:
isKeepEmptyMacrosin interfaceI_CmsMacroResolver- Returns:
trueif macros that could not be resolved are kept "as is" in the input String,falseif they are replaced by an empty String- See Also:
-