Tutorial: Creating a BOD service module
The Project BOD service module stores and retrieves data, and provides logic to perform operations on a business object or logical model, referred to as a noun. The noun that you define in this tutorial is called the Project noun.
This tutorial provides one example, however you can use the methods described to implement any business logic.
Previous versions of HCL Commerce relied upon the Specification and Description Language (SDL) for creating service modules. Since Version 9 uses the Java Persistence API, this tutorial shows how to use BOD to call the JPA in HCL Commerce. In order to reduce complexity and emphasize how JPA operations work in Version 9, the tutorial will define a single table and noun.
Name
(represented by a
string type) and StoreIdentifier
(represented as a
_wcf:StoreIdentifierType). _wcf:StoreIdentifierType is a
predefined complex type construct that can be shared among all of the nouns. It is defined in the
IdentifierTypes.xsd file. HCL Commerce provides some predefined
complex type constructs, which are shared among all of the nouns. To use the common predefined type
constructs, you need to import the file in the Project.xsd file. The following
code sample shows how to import these type
constructs.<import namespace="http://www.ibm.com/xmlns/prod/commerce/9/foundation"
schemaLocation="../../../../IBM/Commerce/Resources/Components/IdentifierTypes.xsd" />
The service module that you create in this tutorial contains one noun: Project
.
For this tutorial, these Project
nouns are predefined for you. The
Project.xsd file, which defines the nouns, is provided as part of the
ProjectServices.zip sample file.
For this tutorial, the definitions of the noun contain information that is listed in the table for each noun. The tables list the access profiles that include the information. Data included in the Summary profile are shown in the summary view, and data included in the Details profile are shown in the details view.
Project noun
- Get services
- You can use the Get service to retrieve Project 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')]]
- Change services
- The Change service updates project information for a Project noun. The Change service can update the projectName(you can wrote add and delete service by yourself).
Learning objectives
- The HCL Commerce BOD command framework
- Extension and customization tasks.
- Logical model definitions.
- The Java Emitter Template.
- Service Data Objects.
- Eclipse Modeling Framework.
- The JPA Framework
- 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.
- 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 two 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 HCL Commerce developers who are responsible for creating and customizing HCL 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
- HCL Commerce services
- JPA Framework
- 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 dependencies for the service module. For more information, see Generating the Project service module projects.