For data coming from an external Enterprise Information System
(EIS), you can create APIs that transform string data into the supported bidirectional
language format and that transform data sent from WebSphere® ESB to
an external EIS into the bidirectional format used by that specific EIS.
Before you begin
For more information about bidirectional language
support, see
Globalization. Use the table
in Globalization to determine the correct value for either the
input string or output string to use when transforming string data from one
format to another.
To create an API to transform the bidirectional language
format of string objects, perform the following steps.
Procedure
- Include all bidirectional classes that contain
the bidirectional engine implementation. For
example:
import com.ibm.bidiTools.bdlayout.*;
- Define the strings to contain the data object to transform, and
the input and output format values.
The input format is the
bidirectional format in which the string object is currently stored. The output
format is the bidirectional format in which you want to store the string object.
For example:String strIn = new String("Hello world");
String formatIn = "ILYNN";
String formatOut = "VLYNN";
- Call the BidiStringTransformation function. For
example:
String strOut = BiDiStringTransformation(strIn, formatIn, formatOut);
String BiDiStringTransformation(String strIn, String formatIn, String formatOut) {
- Test if the input string is null. For example:
if (strIn == null) return null;
- Perform the transformation. For example:
BidiFlagSet flagsIn;
BidiFlagSet flagsOut;
formatIn = formatIn.toUpperCase();
formatOut = formatOut.toUpperCase();
if (formatIn != null)
flagsIn = new BidiFlagSet(formatIn.toCharArray());
else
flagsIn = new BidiFlagSet();
if (formatOut != null)
flagsOut = new BidiFlagSet(formatOut.toCharArray());
else
flagsOut = new BidiFlagSet();
if (flagsIn.equals(flagsOut)) return strIn;
String strOut = BiDiStringTransformation(strIn, flagsIn, flagsOut);
return strOut;
}