Tutorials > Program model > Web services > Create a new WebSphere Commerce BOD service module

< Previous | Next >


Implement the business logic layer

This lesson provides a quick review of the Get, Change and Process design patterns, as you implement the business logic layer using the BOD command framework.

The business logic layer contains the Get, Change, and Process commands used in this tutorial.

To save time, you can import these commands directly from the provided tutorial code. The following description of the design patterns describes how the commands you are importing fit into the BOD command framework.

The design pattern for Get services is the basic design pattern to be used for retrieving and displaying information from Web services. This pattern uses the following requests and responses:

The Get Noun Controller extracts the search information from the request, performs an access control check on the request Access Profile, and delegates to two types of task commands:

The BOD Change processing pattern is used to create, update, or delete a business object. The Change processing pattern uses the following requests and responses:

The Change Noun Controller performs initial validation, for example whether the noun to change exists, an access control check, and then delegates to the following two types of task commands:

The BOD Process processing pattern is used to perform business logic and CUD operations on a business object. The Process pattern is a simplified version of the Change pattern and differs by acting upon an entire noun, where a Change action can affect only a section of a noun. The Process pattern uses the following request and response messages:

In this tutorial lesson, you implement two process commands, ProcessTutorialStoreOpenActionCmd and ProcessTutorialStoreCloseActionCmd.

The following diagram shows the business logic assets in the overall customization process:

To import the business logic layer commands:


Procedure

  1. Import the ChangeStoreDescription command to perform the change store description request.

    1. Right-click the BODTutorialStore-Server/ejbModule/com.mycompany.commerce.bodtutorialstore.facade.server.commands package.

    2. Select Import.

    3. Browse to the location where you unzipped TutorialStore.zip.

    4. Select ChangeTutorialStoreDescriptionCmdImpl.java

  2. Import the ProcessTutorialStoreCloseAction command to close a store:

    1. Right-click the BODTutorialStore-Server/ejbModule/com.mycompany.commerce.bodtutorialstore.facade.server.commands package.

    2. Select Import.

    3. Browse to the location where you unzipped TutorialStore.zip.

    4. Select ProcessTutorialStoreCloseActionCmdImpl.java.

  3. Import the ProcessTutorialStoreOpenAction command to open a store:

    1. Right-click the BODTutorialStore-Server/ejbModule/com.mycompany.commerce.bodtutorialstore.facade.server.commands package.

    2. Select Import.

    3. Browse to the location where you unzipped TutorialStore.zip.

    4. Select ProcessTutorialStoreOpenActionCmdImpl.java.

  4. Organize the imports for the BODTutorialStore-Server project:

    1. Open the Java perspective in WebSphere Commerce Developer.

    2. Right-click the BODTutorialStore-Server\EJBModule folder and select Source.

    3. Select Organize Imports.

    4. Save the file.

  5. Register the new commands in the CMDREG table by running the following SQL statements:

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0, 'com.mycompany.commerce.bodtutorialstore.facade.server.commands.FetchTutorialStoreCmd', 'com.mycompany.commerce.bodtutorialstore.facade.server.commands.FetchTutorialStoreCmdImpl', 'Local');

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0, 'com.mycompany.commerce.bodtutorialstore.facade.server.commands.GetTutorialStoreCmd', 'com.mycompany.commerce.bodtutorialstore.facade.server.commands.GetTutorialStoreCmdImpl', 'Local');

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0,'com.mycompany.commerce.bodtutorialstore.facade.server.commands.ChangeTutorialStoreCmd','com.mycompany.commerce.bodtutorialstore.facade.server.commands.ChangeTutorialStoreCmdImpl' , 'Local');

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0,'com.mycompany.commerce.bodtutorialstore.facade.server.commands.ChangeTutorialStorePartActionCmd+/TutorialStore[]/StoreDescription','com.mycompany.commerce.bodtutorialstore.facade.server.commands.ChangeTutorialStoreDescriptionCmdImpl' , 'Local');

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0,'com.mycompany.commerce.bodtutorialstore.facade.server.commands.ProcessTutorialStoreCmd','com.mycompany.commerce.bodtutorialstore.facade.server.commands.ProcessTutorialStoreCmdImpl' , 'Local');

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0,'com.mycompany.commerce.bodtutorialstore.facade.server.commands.ProcessTutorialStoreActionCmd+Open','com.mycompany.commerce.bodtutorialstore.facade.server.commands.ProcessTutorialStoreOpenActionCmdImpl' , 'Local');

    • insert into cmdreg (STOREENT_ID, INTERFACENAME, CLASSNAME,TARGET) VALUES (0,'com.mycompany.commerce.bodtutorialstore.facade.server.commands.ProcessTutorialStoreActionCmd+Close','com.mycompany.commerce.bodtutorialstore.facade.server.commands.ProcessTutorialStoreCloseActionCmdImpl' , 'Local');

    To run the SQL statements

    1. Start the WebSphere Commerce test server.

    2. Open the following URL: http://localhost/webapp/wcs/admin/servlet/db.jsp

< Previous | Next >


+

Search Tips   |   Advanced Search