StringReplacer overview

StringReplacer is a java utility class used in an EC mapping to apply one or more "replacements" on a string. This class allows you 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". The class can be used 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

For version 11.4.3.x, you upload definitions through the PA tool. See Uploading StringReplacer definitions.

In earlier EC versions, you upload your StringReplacer definitions relative to the String.Replacer application property.

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
=============================================================
-->