Object: Rename
An important concept for |Automic| environments is the naming of objects. Naming objects is the base for an authorization concept. The rules for the naming for objects may change over time for different reasons. This module provides the functionality to rename objects based on rules defined in a mapping file.
Designation
- Name
- mc.Rename
- Aliases
- Rename, ObjectRename, UserRename, mc.UserRename
Configuration
- Optionen
- Test mode (
test-mode
) - Activates a simulation mode
- Mapping file (
mapping
) - File containing a mapping of old object name pattern to new names
- Renamed objects (
renamed-objects
) - If given the file will contain a list of all mapped object names.
- only rename objects (
rename-only
) - just renames the objects without replacing any references
Description
The renaming rules are defined in the mapping file. Two values must be entered per line, separated by semicolons. The first value is a regular expression for the old object name. The second value defines the replacement for the new name. Parts of the old name can be adopted by using groups in the regular expression.
In the following example, all selected objects are checked to see whether #MANUAL# appears anywhere in the name. If this is the case, these objects are renamed so that the part before and after the keyword remains and the keyword itself is replaced by #BEST4AUTOMIC#.
"(.*)#MANUAL#(.*)";"$1#BEST4AUTOMIC#$2"
It is also possible to define several rules. The first rule that applies is used. In the next example, the object type designations in the objects must also be adapted. This applies to variables, connections and jobs.
"(.*)#MANUAL#\.VARA\.(.*)";"$1#BEST4AUTOMIC#.VA.$2"
"(.*)#MANUAL#\.CONN\.(.*)";"$1#BEST4AUTOMIC#.CN.$2"
"(.*)#MANUAL#\.JOBS\.(.*)";"$1#BEST4AUTOMIC#.JB.$2"
"(.*)\$\$\$AEPROD(.*)";"$1\$\$\$AE_PROD$2"
If the object type is not available in the old object names but should be included in the new ones, it can be inserted with the attribute object_type in the form of a b4A expression.
"(.*)#MANUAL#\.(.*)";"$1#BEST4AUTOMIC#.%(object_type).$2"