StringReplacer overview

StringReplacer is a java utility class used in an EC mapping to apply one or more replacements on a string. You can use this class to convert strings from one form to adapt to a restricted character set for a specific message format or the demands of a specific (external) partner. That is, to restrict characters in outbound messages to match the approved characters for the message or partner. For example, use StringReplacer to convert "Ä" to "AE" and "ß" to "ss". You can use the class for inbound messages and in other applications. For example, to convert "AA" to "a", and "AB" to "CD". However, StringReplacer is not agreement specific.

Replacement set

StringReplacer uses replacement sets. A replacement set has a unique ID and it contains one or more process steps similar to an agreement. You specify the replacements to use. You also specify the detections. Detections are the connections among map name, external partner ID, and the replacement set ID.

Repository

When adding a String Replacer definition on the Enterprise Collaborator Configuration page, the string replacer definition is automatically reloaded.

Example definition

Here is an example StringReplacer definition. This is a replacement set detection for which ID to use from the map name (primary) and the partner (secondary). A partner may be blank, or missing, for generic detection per map.
<?xml version="1.0" encoding="UTF-8"?>
<StringReplacer>
    <!-- Replacement set detection for which ID to use from the map name (primary) and the partner (secondary), partner may be blank (or missing) for generic detection per map -->
    <Detection>
        <MapName>mapping_20_StringReplacer</MapName>
        <Partner>ImportChildErrorProcess</Partner>
        <ID>ImportChildErrorProcess</ID>
    </Detection>
    <ReplacementSet>
        <ID>ImportChildErrorProcess</ID>
        <Process>
            <Step>
                <Name>Replace</Name>
            </Step>
        </Process>
        <Replacements>
            <ReplaceAll>
                <From>Å</From>
                <To>AA</To>
            </ReplaceAll>
        </Replacements>
    </ReplacementSet>
</StringReplacer>
<!--
Version Log
=============================================================
Version 1 - Initial version
=============================================================
-->