Tutorials > Management Center > Create the Project BOD service module

< Previous | Next >


Configure the data service layer for the Project service module

In this lesson we will configure the data service layer for the Project service module, using XML to provide the necessary mappings.

The next steps for the customization of the new service module are:

For more information, see Service module configuration.

In this tutorial we have provided all the query template files and configuration files in codes package. You can import the files directly.

The wc-query-Project-get.tpl file defines the query templates used to retrieve the physical data objects. This template file defines the following symbols:

<!-- XPROJECT table -->
COLS:XPROJECT=XPROJECT:*
COLS:XPROJECT_ID=XPROJECT:XPROJECT_ID
<!-- XPRJDES table -->
COLS:XPRJDES=XPRJDES:*
<!-- XPRJMTR table -->
COLS:XPRJMTR=XPRJMTR:*
<!-- XPRJMTRDES table -->
COLS:XPRJMTRDES=XPRJMTRDES:*
<!-- XPRJMTRCATREL table -->
COLS:XPRJMTRCATREL=XPRJMTRCATREL:*
<!-- XPRJINS table -->
COLS:XPRJINS=XPRJINS:*
<!-- XPRJINSDES table -->
COLS:XPRJINSDES=XPRJINSDES:*
<!-- XPRJPRJCOLREL table -->
COLS:XPRJPRJCOLREL=XPRJPRJCOLREL:*
<!-- XPRJCOL table -->
COLS:XPRJCOL=XPRJCOL:*
<!-- XPRJCOLDES table -->
COLS:XPRJCOLDES=XPRJCOLDES:*
<!-- XPRJCATREL table -->
COLS:XPRJCATREL=XPRJCATREL:*

The following example query:

<!-- ============================================================= -->
<!-- This SQL template will return the elements of the Project -->
<!-- noun(s) given project identifier(s) -->
<!-- The access profiles that apply to this SQL are: -->
<!-- MyCompany_Summary project profiles -->
<!-- @param UniqueID - The project identifier(s) . -->
<!-- ============================================================= -->
BEGIN_XPATH_TO_SQL_STATEMENT
name=/Project[ProjectIdentifier[(UniqueID=)]]+MyCompany_Admin_Summary 
base_table=XPROJECT
sql= 
SELECT 
XPROJECT.$COLS:XPROJECT$, XPRJDES.$COLS:XPRJDES$

FROM
XPROJECT
LEFT OUTER JOIN XPRJDES ON (XPROJECT.XPROJECT_ID = XPRJDES.XPROJECT_ID AND XPRJDES.LANGUAGE_ID IN ($CONTROL:LANGUAGES$) )
WHERE
XPROJECT.XPROJECT_ID IN (?UniqueID?) 

END_XPATH_TO_SQL_STATEMENT

Next, we will define the logical to physical mapping in the wc-business-object-mediator.xml file. This files relates a logical type (noun) to the physical type (physical SDO) that contains its unique ID. For example, the following code relates the Project noun to the XPROJECT table physical SDO:

<object
logicalType="com.mycompany.commerce.Project.facade.datatypes.ProjectType"
physicalType="com.mycompany.commerce.Project.facade.server.entity.datatypes.Xproject">

The following code samples will show you how to configure the read and change mediators. The read mediator is shown in the following sample:

<_config:mediator
    interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectMediator"
    className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ReadProjectMediator">
    <_config:part-mediator
        interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ReadBusinessObjectPartMediator">
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ReadProjectDescriptionPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ReadProjectMaterialPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ReadProjectInstructionPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ReadProjectCollectionRelPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ReadProjectToolPartMediator" />
    </_config:part-mediator>
</_config:mediator>

The configuration of the change mediator is shown in the following sample code:

<_config:mediator
    interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeBusinessObjectMediator"
    className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectMediator">
    <_config:part-mediator
        interfaceName="com.ibm.commerce.foundation.server.services.dataaccess.bom.mediator.ChangeBusinessObjectPartMediator">
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectBasePartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectDescriptionPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectMaterialPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectInstructionPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectToolPartMediator" />
        <_config:part-mediator-implementation
            className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectCollectionRelPartMediator" />
    
<_config:part-mediator-implementation 
       className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectMaterialDescriptionPartMediator" />
    
<_config:part-mediator-implementation
       className="com.mycompany.commerce.project.facade.server.services.dataaccess.bom.mediator.ChangeProjectInstructionDescriptionPartMediator" />
    </_config:part-mediator>
</_config:mediator>

The configuration in the wc-component.xml file is shown in the following sample, which uses DSL value-mapping to map between the database and external logical values:

<_config:dataservice dataMediatorType="JDBC"
    metadataClass="com.mycompany.commerce.project.facade.server.metadata.ProjectMetadata">


    <!-- Mapping for search -->
    <_config:mapping>
        <_config:key name="Project" />
        <_config:basetable name="XPROJECT" useAllColumns="true">
            <_config:columns name="PRJNAME"
                propertyName="ProjectIdentifier/ExternalIdentifier/Name" />

        </_config:basetable>
    </_config:mapping>

    <_config:mapping>
        <_config:key name="ProjectCollection" />
        <_config:basetable name="XPRJCOL" useAllColumns="true">
            <_config:columns name="PRJCOLNAME"
                propertyName="ProjectCollectionIdentifier/ExternalIdentifier/Name" />

        </_config:basetable>
    </_config:mapping>
    <_config:store-relationship key="recipe"
        value="com.mycompany.commerce.recipe" />

</_config:dataservice> 

Import the configuration files:


Procedure

  1. In the Enterprise Explorer view, expand WC > xml > config and right-click the com.mycompany.commerce.project folder.

  2. Click Import. Expand General and select File System, then click Next.

  3. Browse to the temporary location where you decompressed the RecipeServices.zip file.

  4. Browse to the config\com.mycompany.commerce.project folder.

  5. Select all files.

  6. Click Finish. Click Yes to All to overwrite any existing files.

< Previous | Next >


+

Search Tips   |   Advanced Search