IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Defining and transforming data > Transforming data > Transforming data using a business object map > Mapping with XSD wildcards > The <any> element > Create custom maps using <any> elements
Mapping multiple <any> elements
In this map the business objects have more than one <any> element in the schema definition.
To map each of these <any> elements you would need to write custom code. Automated transformations involving more than one <any> are not supported because <any> elements do not have a name associated with them and it is not possible to determine within the current mapping framework which <any> element the data belongs to.
When setting more than one <any> element, you must do it in relation to the occurrence of the <any> to some other identifying element. For retrieving the <any> element data, the data object sequence will have to be used to determine which <any> tag the data originated from in relation to some other identifying element or attribute.
Considering the following map:
You would use the following custom code for moving multiple <any> elements from source to target in relation to the occurrence of the <any>:
// Variable AnyElemAny is represented as AnyElemAny_1 ServiceManager serviceManager = new ServiceManager(); Bofactory bofactory = (BOFactory)serviceManager.locateService("com/ibm/websphere/bo/BOFactory"); OXSDHelper xsdHelper = (BOXSDHelper)serviceManager.locateService("com/ibm/websphere/bo" ); // retrieve the data from the source - Source BO has already been set with the properties // that are retrieved below Property marker1Prop = AnyElemAny.getType().getProperty("marker1"); Property firstAnyProp = (Property) AnyElemAny.getInstanceProperties().get(1); Property secondAnyProp = (Property) nyElemAny.getInstanceProperties().get(2); // Another way of getting the data in addition to the above is as follows : firstAnyProp = AnyElemAny.getInstanceProperty("globalElement1"); Object firstAnyData = AnyElemAny.get(firstAnyProp); secondAnyProp = AnyElemAny.getInstanceProperty("globalElement2"); Object secondAnyData = AnyElemAny.get(secondAnyProp); Object markerData = AnyElemAny.get(marker1Prop); // Set the data on the target BO, // retrieve the global property fields on the target and set using the data from the source Property prop1 = xsdHelper.getGlobalProperty("http://GlobalElems", "globalElement1", true); Property prop2 = xsdHelper.getGlobalProperty("http://GlobalElems", "globalElement2", true); AnyElemAny_1.set(prop1,firstAnyData); AnyElemAny_1.set("marker1",markerData); AnyElemAny_1.set(prop2,secondAnyData);