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. |
The service module contains two nouns: Project and ProjectCollection. For this tutorial, the definitions of the two nouns contain information that is listed in the following tables. The tables list the access profiles that include the information. Data included in the summary profile show in the summary view, and data included in the Details profile show in the details view.
For the 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 |
For the ProjectCollection noun:
Data | Description | Applicable Access Profiles |
---|---|---|
ProjectCollectionIdentifier | The ProjectCollection identification information. | Details |
Description | The ProjectCollection description. | Details |
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
- 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>
The 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
To complete this tutorial, the following resources are used. Ensure that you download and extracted any compressed files that contain required code samples to a temporary directory, such as C:\Temp before you begin this tutorial: