Tutorials > Program model > Extend the object model and modifying an existing task command
Load the completed tutorial code
This section explains how to load the completed code into WebSphere Commerce Developer instead of completing each tutorial step. You can load the completed code into WebSphere Commerce Developer instead of completing each tutorial step.
You must have created a store based on the consumer direct sample store in your WebSphere Commerce development environment.
The completed tutorial code is in the objectmodel_completedsource.zip file, provided with the tutorial sample code in the WCSample.zip file.
Procedure
- Start the test environment.
- Open a browser and type the following URL: http://localhost/webapp/wcs/admin/servlet/db.jsp
- In the input box, enter the following SQL statement:
insert into CMDREG (STOREENT_ID, INTERFACENAME, DESCRIPTION, CLASSNAME, TARGET) values (CD_storeent_ID, 'com.ibm.commerce.order.commands.ExtOrderProcessCmd', 'This is a new task command for the extending an entity bean tutorial.', 'com.ibm.commerce.sample.commands.MyExtOrderProcessCmdImpl', 'local');Where: CD_storeent_ID is the store's unique identifier.
- Click Submit Query to run the SQL statement.
- In this step, you create the XORDGIFT table that stores the gift order information. Follow the steps in Create and populating the XORDGIFT table.
- Import the files required to display the new Gift Order function:
- In the Enterprise Explorer view, navigate to Stores > WebContent > ConsumerDirect_name > ShoppingArea > CheckoutSection > StandardCheckoutSubsection
- Create a backup copy of OrderConfirmationDisplay.jsp called OrderConfirmationDisplay.bak.jsp.
- Navigate to Stores > WebContent > ConsumerDirect_name > Snippets > EDP > PaymentMethods
- Create a backup copy of PaymentMethodsDisplay.jsp called PaymentMethodsDisplay.bak.jsp.
- From the ConsumerDirect_name folder's pop-up menu, select Import.
- Select General > Archive File and click Next.
- In the From archive file text box, enter or browse to the objmodel_completedsource.zip file.
- Deselect ordergift.properties, WebSphereCommerceServerExtensionsData.jar, and WebSphereCommerceServerExtensionsLogic.jar
- Click Finish.
- The following files are introduced into the workspace:
- ConsumerDirect_name\include\OrderSummaryDisplayInclude.jsp
- ConsumerDirect_name\include\OrderDetailDisplayInclude.jsp
- ConsumerDirect_name\ShoppingArea\CheckoutSection\StandardCheckoutSubsection\OrderConfirmationDisplay.jsp
- ConsumerDirect_name\Snippets\EDP\PaymentMethods\PaymentMethodsDisplay.jsp
- In the Enterprise Explorer view, navigate to Stores > Java Resources: src > ConsumerDirect_name
- From the ConsumerDirect_name directory's pop-up menu, select Import.
- Select General > Archive File and click Next.
- In the From Archive File field, browse to the objmodel_completedsource.zip file.
- Click Deselect All.
- Select ordergift.properties.
- Click Finish.
- Update the command and data bean JAR file on the target WebSphere Commerce Server
In this section you update the target WebSphere Commerce Server to use the new command and data bean JAR file,...
- From the objmodel_completedsource.zip file, extract WebSphereCommerceServerExtensionsLogic.jar file to a temporary directory.
- In the Enterprise Explorer view, navigate to the WebSphereCommerceServerExtensionsLogic project.
- From the src folder's pop-up menu, select Import.
- Select General > Archive File and click Next.
- In the From Archive File field, browse to or enter the full path of the WebSphereCommerceServerExtensionsLogic.jar file. Click Open.
- Click Deselect All in the right pane, and select the com folder.
- Click Finish.
- Update the EJB JAR file on the target WebSphere Commerce Server
From the objmodel_completedsource.zip file, extract WebSphereCommerceServerExtensionsData.jar file to a temporary directory.
- In the Enterprise Explorer view, navigate to the WebSphereCommerceServerExtensionsData project.
- From the ejbModule folder's pop-up menu, select Import .
- Select General > Archive File and click Next.
- In the From archive file field, browse to or enter the fully qualified path of the WebSphereCommerceServerExtensionsData.jar file.
- Select Overwrite existing resources without warning.
- Click Finish.
- Generate Test deployment code:
- From the WebSphereCommerceServerExtensionsData project's pop-up menu, select Java EE > Prepare for Deployment.
- Ensure no errors display in the console view.
- Verify the gift message functionality by following the instructions in Test the new gift message functionality.