Data objects (either SDO objects or Transfer Objects) that
are used in the invocation layer are different from UI Objects in
the presentation layer. Data conversion is used to separate and mediate
the data between the invocation layer and the presentation layer.
Bidirectional converters are used to mediate the data from a specific
integration layer to the presentation layer. The following conversions
are in place:
- From UI wrapper objects to SDO objects and back again, implemented
through SDOConverter.java
- From UI wrapper objects to Web service Transfer Objects and back
again, implemented through TOConverter.java
Considerations related to converting data:
- Wrapper classes (derived form UIWrapper) are simple POJO classes
- A centralized registry (MDMServerRegistry.java) is used to identify
the necessary communication layer for every InfoSphere® MDM Server service
call
- A reference to the original integration layer object is preserved
in the wrapper class
- A cloning method is in place as a utility functionality
The UIWrapper classes are structurally a mirror of Web service
Transfer Objects. Very few modifications are applied, as shown in
the following table:
| UIWrapper |
Transfer Object |
| Long |
java.lang.Long |
| Long |
com.ibm.wcc.service.to.SurrogateKey |
| java.lang.Double |
java.math.BigDecimal |
| java.util.Date |
java.util.Calendar |
| java.util.Date |
java.lang.String |
There is a naming convention that allows you to associate the wrapper
classes with their corresponding business object:
- The wrapper class name is prefixed with UI
- The com.ibm.mdm.bobj package contains the current collection of
wrapper classes
- Every wrapper class associated with an InfoSphere MDM Server business
object is derived from the com.ibm.mdm.bobj.UIWrapper class
Metadata driven conversion is done to match the wrappers to corresponding
SDO objects and Transfer Objects in the following XML configuration
files:
- SDOConversions.xml
- TOConversions.xml
The following is an example of SDOConversions.xml content:
<TOConversionContexts>
<TOConversionContext mdmServiceName="addProductInstance" mdmServiceInvocationParamTO=
"com.ibm.mdm.product.service.to.Product" mdmServiceRetrievedTO=
"com.ibm.mdm.product.service.to.Product" mdmServiceRetrievedUIWrapper=
"com.ibm.mdm.bobj.product.UIProduct"/>
…….
</TOConversionContexts>
Unlike the tightly coupled structure of UIWrapper to Web service
transfer objects, there are additional sections required when dealing
with UIWrapper to SDO conversions.
The following is an example of TOConversions.xml content:
<SDOConversionContexts>
<SDOConversionContext
mdmServiceName="getAllProductTypes" mdmServiceInvocationParamTO="" mdmServiceRetrievedTO="com.dwl.admin.ProductTypeBObjType" mdmServiceRetrievedUIWrapper="com.ibm.mdm.bobj.product.UIProductType"/>
....
</SDOConversionContexts>
<AlternativeSDOFieldNames>
<AlternativeSDOFieldName
sdoClassName="com.dwl.admin.ProductTypeBObjType" sdoFieldName=
"ProductTypeName" uiWrapperClasName="com.ibm.mdm.bobj.product.UIProductType" uiWrapperFieldName="Name"/>
....
</AlternativeSDOFieldNames>
<EncapsulateSDOFields>
<MapSDOToUIWrapper
sdoClassName="com.dwl.admin.SpecFormatBObjType" uiWrapperClassName="com.ibm.mdm.bobj.UISpecFormat">
<EncapsulateSDOField
sdoFieldName="SpecFormatId" uiWrapperClassName=
"com.ibm.mdm.bobj.UISpecFormatTranslation" uiWrapperFieldName="SpecFormatId"/>
....
</MapSDOToUIWrapper>
....
</EncapsulateSDOFields>
As the SDOConversions.xml sample content shows, there are two additional
sections in the SDO .xml file that deals with structural differences
between SDO objects and Transfer Objects.
- AlternativeSDOFieldNames/AlternativeSDOFieldName—This metadata
is used when SDO objects and transfer objects have the same object
graph structure, but do not have the same class name and field name.
Its attributes are defined as follows:
- sdoClassName —Specifies the name of an SDO class/interface
- sdoFieldName —Specifies the name of an SDO class field
name
- uiWrapperClassName —Specifies the name of a UIWrapper class
- uiWrapperFieldName —Specifies the name of a UIWrapper class
field name
- EncapsulateSDOFields/MapSDOToUIWrapper—This metadata is
used when SDO objects and Transfer Objects have a different object
graph structure. The MapSDOToUIWrapper tag is used to identify the
UIWrapper class associated with the corresponding SDO class. It has
the following attributes and sub tag:
- sdoClassName —Specifies the name of an SDO class or interface
- uiWrapperClassName —Specifies the name of a UIWrapper class
- EncapsulateSDOField —Specifies the a sub tag and used to
associate a SDO class field name with the corresponding UIWrapper
field name (due to existing structural differences between SDO objects
and Transfer Objects we can run into such scenarios). It has following
attributes:
- sdoFieldName —Specifies the name of an SDO class or interface
- uiWrapperClassName —Specifies the name of a UIWrapper class
encapsulating the field name corresponding to the sdoFieldName
- uiWrapperFieldName —Specifies the name of a UIWrapper class
field name associated with the value of the sdoFieldName