Tutorials > Management Center | Next >


Tutorial: Adding new properties to a WCS service using the data service layer

In this tutorial you customize the Catalog service to support warranty information and care instructions for Catalog Entries. This customization includes...

  1. Updating the WebSphere Commerce schema to store the new information
  2. Customizing the Catalog service to include the new information as user data in the CatalogEntry noun.

The WCS BOD programming model separates processing into the business logic layer and the persistence layer. The business logic layer works with logical service data objects (SDOs), which are the Java representation of nouns. The persistence layer creates, reads, updates, or deletes business objects in the WCS database. This separation allows adding new data to impact only the persistence layer.

The CatalogEntry noun uses the UserData element as a data extension point to add new data without changing the logical model. In this tutorial, warranty information is added to the CatalogEntry noun UserData element to demonstrate the addition of language dependent properties. For this tutorial, a warranty applies to a specific catalog entry and consists of a term or number of days the warranty applies and a type, either limited or comprehensive.

The Catalog description noun part supports the attributes element as a data extension point. Attributes provides the same functions as the UserData element. Product care instructions is added to the CatalogEntryDescription noun part attributes element to show the addition of language independent properties. In this tutorial, a care instruction applies to a specific catalog entry and language and consists of a text description of the instruction.

The following example CatalogEntry noun shows the customization of the CatalogEntry UserData element and CatalogEntryDescription attributes element:

<_cat:CatalogEntry catalogEntryTypeCode="ProductBean">
    <_cat:CatalogEntryIdentifier>
        <_wcf:UniqueID>10251</_wcf:UniqueID>
        <_wcf:ExternalIdentifier ownerID="7000000000000000101">
        <_wcf:PartNumber>FULO-01</_wcf:PartNumber>
        </_wcf:ExternalIdentifier>
    </_cat:CatalogEntryIdentifier>
    <_cat:Description language="-1">
        <_cat:Name>White Fabric Roll Arm Chaise</_cat:Name>
        <_cat:Thumbnail>images/catalog/FULO_01_sm.jpg</_cat:Thumbnail>
        <_cat:FullImage>images/catalog/FULO_01.jpg</_cat:FullImage>
        <_cat:ShortDescription>Plumply padded for the ultimate comfort.</_cat:ShortDescription> 
        <_cat:Attributes name="catentryId">10251</_cat:Attributes>
        <_cat:Attributes name="languageId">-1</_cat:Attributes>
        <_cat:Attributes name="careinstruction">Warranty description for the chaise.</_cat:Attributes>
    </_cat:Description>
    <_wcf:UserData>
        <_wcf:UserDataField name="warterm">30</_wcf:UserDataField>
        <_wcf:UserDataField name="wartype">LIMITED</_wcf:UserDataField>
    </_wcf:UserData>
</_cat:CatalogEntry>

The persistence layer is customized according touch points identified and numbered in the following diagram:

The numbered boxes in the diagram correspond to the following tasks:

  1. Update the WCS database with new tables and relationships.

  2. Generate custom object-relational metadata that describes the new tables and relationships. In this tutorial, the custom metadata describes the new tables added to store warranty and care instruction information.

  3. Generate static service data objects (SDO) that provide a Java representation of the newly added tables. The term static SDOs and physical data objects are used interchangeably.

  4. Configure the logical data object to physical data object mapping. In this tutorial we will configure the business object mediator to populate warranty information as UserData in the CatalogEntry noun and care instruction information as attributes to the CatalogDescription noun part.

  5. Create a custom query template file to map an XPath expression and access profile to SQL. This template file:

    1. Defines a SQL template statement that fetches data from the new tables.

    2. Associates a new access profile to the new SQL template statement.

    3. Associates a XPath expression to the new SQL template statement.


Audience

This tutorial is intended for WCS developers responsible for creating and customizing WCS BOD services.


System requirements

Before beginning this tutorial ensure that you have fulfilled the following prerequisites:

Workspaces are not supported when completing this tutorial.


Prerequisites

To complete this tutorial you should be familiar with the following terms and concepts:

You must also publish the consumer direct sample store.


Lessons in this tutorial

Next >


+

Search Tips   |   Advanced Search