WebSphere Message Broker, Version 8.0.0.7
Operating Systems: AIX, HP-Itanium, Linux, Solaris, Windows, z/OS
See information about the latest product version
See information about the latest product version
Using Java API classes for Custom Java mapping transforms
You can use the Java™ MbElement class for mapping inputs and outputs that are not simple types with a Custom Java transform.
When you map a single non-repeating element input to a single non-repeating element output, use a Java method with the following signature:
public static MbElement mbElMove(MbElement inEl) {
For example a Java method that simply copies a sub tree:
public static MbElement mbElMove(MbElement inEl) {
MbElement outEl = null;
try {
outEl = inEl.copy();
outEl.copyElementTree(inEl);
} catch (MbException e) {
throw (new RuntimeException(e));
}
return outEl;
}
When you map a single repeating element input to an output repeating element, use a Java method with the following signature:
public static List<MbElement>; customCompleTypeMove(List<MbElement>; inEls)
For example:
public static List<MbElement> customCompleTypeMove(List<MbElement> inEls)
{
List<MbElement> outEls = new ArrayList<MbElement>();
try {
Iterator<MbElement> i = inEls.iterator();
while (i.hasNext()) {
MbElement inEl = i.next();
MbElement outEl = inEl.copy();
// Do some processing of outEl
outEls.add(outEl);
}
} catch (MbException e) {
throw (new RuntimeException(e));
}
return outEls;
}