Tutorial: Creating a BOD service module
The Project BOD service module stores and retrieves data, and performs business logic for a Recipe tool in the Management Center. A recipe is an object that describes how to use several products a retailer sells. A recipe is made up of a set of ingredients, tools, and instructions that show how to use the ingredients and make the product.
Service modules provide business logic to support operations on a business object or noun. The noun that you define in this tutorial is called the Project noun. Although the tool that is created in this scenario is called the Recipe tool, it can be applied to other retail segments. A recipe is a food preparation project, but you can also have projects apply to home renovation or a recreational hobby.
Term that is used in user interface | Term that is used in logical schema | Description |
---|---|---|
Recipe | Project | The primary object that represents the recipe. For example, making coffee. |
Recipe description | ProjectDescription | The description for the recipe. |
Ingredients | ProjectMaterial | The materials that are used to make the final product. For example, coffee beans, water, and sugar. |
DescriptionOfIngredient | ProjectMaterialDesc | The description for the materials. |
RecipeInstruction | ProjInstr | The steps to make the final product. For example, boil the water; grind the coffee bean. |
RecipeInstructionDescription | ProjInstrDesc | The description for the steps. |
RecipeCollection | ProjectCollection | The tags to categorize the recipes, for example, food and drink. |
RecipeCollectionDescription | ProjectCollectionDesc | The description for the collection. |
Usage association | Usage association | The tools to be used to make the final product. For example, a pot, and a coffee maker. |
<import namespace="http://www.ibm.com/xmlns/prod/commerce/9/foundation"
schemaLocation="../../../../IBM/Commerce/Resources/Components/IdentifierTypes.xsd" />
- Project.xsd
- ProjectCollection.xsd
- Project noun:
Data Description Applicable access profiles ProjectIdentifier Project identification information. Summary, Details Tool The tools that are used in the project. All tools must come from existing catalog entries. Details TimeToComplete The time, which is specified in minutes, that is required to complete the Project Summary, Details Difficulty The degree of difficulty of the project: easy, normal, or difficult. Summary, Details Material The materials for the project. Details Instruction The instructions to complete the project. Details Description The Project noun description. Summary, Details Collection The relationship between the Project noun and the ProjectCollection noun. A ProjectCollection can have multiple Projects. Details The Project noun represents the logical data model of the new service module that you create. The definition of this logical model is a key development step as this model is exposed to any client that uses the Project service. The model is also extensively used in the BOD programming model for the business logic layer of WebSphere Commerce. The following diagram shows the schema definition for the Project noun:
The following diagrams show the structure for Project noun:
- ProjectCollection noun:
Data Description Applicable Access Profiles ProjectCollectionIdentifier The ProjectCollection identification information. Details Description The ProjectCollection description. Details The following diagrams show the structure for the ProjectCollection noun:
- Get services
You can use the Get service to retrieve Project and ProjectCollection noun information
that is based on an XPath search expression. This tutorial demonstrates how to support the following
XPath expressions:
- Find Project by Project UniqueID:
- /Project[ProjectIdentifier[(UniqueID='10001')]]
- Find Projects by ProjectCollection UniqueID:
- /Project[ProjectCollection[ProjectCollectionIdentifier[(UniqueID='10001')]]]
- Find Projects by Materials-related catentry UniqueID:
- /Project[Material[CatalogEntry[CatalogEntryIdentifier[(UniqueID='10001')]]]]
- Find Projects by Tools-related catentry UniqueID:
- /Project[Tool[CatalogEntry[CatalogEntryIdentifier[(UniqueID='10001')]]]]
- Find Projects by search expression:
- /Project[search(contains(ProjectIdentifier/ExternalIdentifier/Name,'MyProjectName'))]
- Retrieve all ProjectCollections:
- /ProjectCollection
- Change services The Change service updates project
information for a Project noun. The Change service can add, update, or delete information. The
Project noun is divided into the following distinct noun parts:
- Material
- Tool
- Instruction
- Description
- Collection
- Update a project description:
<oa:ActionExpression actionCode="Update" expressionLanguage="_wcf:XPath">/Project[1]/Description[1] </oa:ActionExpression>
- Add project material:
<oa:ActionExpression actionCode="Add" expressionLanguage="_wcf:XPath">/Project[1]/Material[1] </oa:ActionExpression>
- Update project material:
<oa:ActionExpression actionCode="Update" expressionLanguage="_wcf:XPath">/Project[1]/Material[1] </oa:ActionExpression>
- Delete project material:
<oa:ActionExpression actionCode="Delete" expressionLanguage="_wcf:XPath">/Project[1]/Material[1] </oa:ActionExpression>
- Process servicesThe Process service creates and deletes
the Project noun and Project Collection noun. In this tutorial, the following process actions are
implemented:
- Create a project:
<oa:ActionExpression actionCode="Create" expressionLanguage="_wcf:XPath">/Project[1]</oa:ActionExpression>
- Delete a project:
<oa:ActionExpression actionCode="Delete" expressionLanguage="_wcf:XPath">/Project[1]</oa:ActionExpression>
- Create a project collection:
<oa:ActionExpression actionCode="Create" expressionLanguage="_wcf:XPath">/ProjectCollection[1] </oa:ActionExpression>
- Delete a project collection:
<oa:ActionExpression actionCode="Delete" expressionLanguage="_wcf:XPath">/ProjectCollection[1] </oa:ActionExpression>
Learning objectives
- The WebSphere Commerce BOD command framework
- Extension and customization tasks.
- Logical model definitions.
- The Java Emitter Template.
- Service Data Objects.
- Eclipse Modeling Framework.
- The Data Service Layer wizard.
- The Business Object Mediator.
- Create an extended sites store with a custom catalog.
- Review the Project noun.
- Customize the physical layer.
- Generate the base code for your Project service module.
- Generate Service Data Objects and object-relational metadata.
- Add language-specific exception messages to the properties files.
- Import mediators.
- Configure the data service layer for the Project service module.
Time required
Expect this tutorial to take four hours to complete. The tutorial takes longer if you explore concepts that are related to this tutorial.Skill level
This tutorial is intended for advanced WebSphere Commerce developers who are responsible for creating and customizing WebSphere Commerce services. To complete this tutorial, ensure that you are familiar with the following terms and concepts:- Java programming language
- XPath
- XSD
- Web services
- XML
- WebSphere Commerce services
- WebSphere Commerce data service layer
- Nouns
- Relational databases
- SQL
System requirements
Before you begin this tutorial, ensure that you completed the following tasks:
Tutorial resources
If you do import these projects, you must still complete the step to update the build dependecies for the service module. For more information, see Generating the Project service module projects.