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 <anyType> element
Mapping an integer value to an <anyType> element
You can map an integer value to an <anyType> element.
Given the map below, the input value in the <any> element is a string, and you may want to set the string to the target <anyType>. Before the target can be set, a wrapper object needs to be created to set the <anyType>. If the type to be set on the <anyType> was a complexType then no wrapper object would need to be created. The wrapper data object needs to be created on simple types so that they can be set on the target <anyType> as DataObject.
Use this custom code to create the wrapper class:
ServiceManager serviceManager = new ServiceManager(); Bofactory bofactory = (BOFactory)serviceManager.locateService("com/ibm/websphere/bo/BOFactory"); BOXSDHelper xsdHelper = (BOXSDHelper)serviceManager.locateService("com/ibm/websphere/bo" ); // Retrieve the values in the xsd:any[] on the source and populate the target Property anyProp = AnyElem.getInstanceProperty("globalElement1"); String anyStringData = (String)AnyElem.get(anyProp); // // Create the wrapper object from the input Data Type stringType = boType.getType("http://www.w3.org/2001/XMLSchema", "string"); DataObject wrappedStringDO = bofactory.createDataTypeWrapper(stringType, anyStringData);To create a wrapper class for different simple types, use this code:
Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "boolean"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "int"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "float"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "double"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "string"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "byte"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "long"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "short"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "hexBinary"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "datetime"); Type objectType = boType.getType("http://www.w3.org/2001/XMLSchema", "decimal");