Code Types
Code type business objects have two parts: 1) The metadata business object which defines the database table and columns, which consist of the code type. 2) The business object (BOBJ) which represents a value (row) of a code type.
Before OSGi
Code type business objects and their corresponding metadata object were defined in properties files like the following:####################################
# Code types metadata #
####################################
codetype.metadata.cdaddrusagetp.classname = com.ibm.mdm.domains.codetype.obj.AddressUsageTypeMetadataBObj
codetype.metadata.cdalertcat.classname = com.ibm.mdm.domains.codetype.obj.AlertCategoryTypeMetadataBObj
####################################
# Code types bobj #
####################################
AddressUsageTypeBObj=com.ibm.mdm.domains.codetype.obj
AlertCategoryTypeBObj=com.ibm.mdm.domains.codetype.obj
The code type framework used these properties to instantiate and load the corresponding code type from the table.
With OSGi
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
<service id="CodeTypeMetadataFactoryService" interface="com.ibm.mdm.common.codetype.interfaces.CodeTypeMetadataFactoryService">
<service-properties>
<entry key="code.type.name">
<list>
<value>cdaddrusagetp</value>
<value>cdalertcat</value>
<value>...</value>
</list>
</entry>
</service-properties>
<bean class="com.ibm.mdm.common.codetype.component.CodeTypeMetadataFactoryServiceImpl">
<argument>
<map key-type="java.lang.String" value-type="java.lang.Class">
<entry key="cdaddrusagetp" value="com.ibm.mdm.domains.codetype.obj.AddressUsageTypeMetadataBObj"/>
<entry key="cdalertcat" value="com.ibm.mdm.domains.codetype.obj.AlertCategoryTypeMetadataBObj"/>
<entry key="..." value="my.CustomCodeTypeMetadataBObj"/>
</map>
</argument>
<argument ref="blueprintBundle"/>
</bean>
</service>
</blueprint>
The service has a property called code.type.name that lists the table names of the code types found in the bundle. Like most OSGi services, this service consists of a service interface and a service implementation. The interface is com.ibm.mdm.common.codetype.interfaces.CodeTypeMetadataFactoryService and the implementation is com.ibm.mdm.common.codetype.component.CodeTypeMetadataFactoryServiceImpl. A technique used in blueprints known as injection is used to load a java.util.Map type object with the metadata business objects contained in this bundle into the factory service implementation.
For every metadata business object in
the bundle, an entry such as <entry key="codetype" value="com.org.MyMetadataBObj"/>
is
included in the map. This map is passed as a Java constructor <argument>
to
the service implementation by the blueprint container.