Sample: Loading promotions data

This sample demonstrates how to load promotions with the Data Load utility. After you load the data, Management Center users can view and manage the promotions in the Promotions tool.


About this sample

We can load data for promotions only in XML formatted input files. The XML input file and Data Load utility configuration files for this sample are in the following directory:


Sample input and configuration files

The following table lists the input files that we use to load the sample data. The table also identifies the business object mediators and business object configuration files that the Data Load utility uses to load the sample data.

Sample XML input file Description
Promotion.xml

For more information about the type of promotion data that we can include in an input file, see Promotions XML input file

The Data Load utility uses this sample input file to load the data to create promotions in the Promotions tool.

The Data Load utility uses the following business object mediator to load the data in this input file into the PX_PROMOTION database table.

Business object mediator

com.ibm.commerce.promotion.dataload.mediator.PromotionDOMMediator

The sample directory also includes the following Data Load utility configuration files:

These configuration files include values for a default WebSphere Commerce Developer environment that uses an Apache Derby database. If the environment settings are different, we must change the configured values in these files to match the environment.


Procedure

  1. (Developer) On a command line, go to the WCDE_installdir\bin directory.

  2. (Linux) Open a command line in the Utility server Docker container. Change the directory to utilities_root/bin directory.
    For information about entering and leaving containers, see Running utilities from the Utility server Docker container.

  3. Enter the following command to run the sample data load order file and load the information that included in this sample:

    • (Linux) ./dataload.sh ../samples/DataLoad/Promotion/wc-dataload.xml

    • (Developer) dataload ..\samples\DataLoad\Promotion\wc-dataload.xml


Verifying results

To verify that the promotion data is loaded, complete the following tasks:


Removing the sample data from the WebSphere Commerce database

Edit the wc-dataload.xml load order configuration file to change the value of the dataLoadMode attribute from "Replace" to "Delete" to run the Data Load utility in delete mode. When you run the utility in delete mode, the utility deletes the data in the database that matches the rows in your XML file. You do not need to edit the value for Delete column in your input XML file.

Compare the data in the database with your input file to verify that the data no longer exists in the database.

In Management Center, verify that we can no longer view the promotions in the Promotions tool.