Sample: Extracting promotions with the Data Extract utility

This sample demonstrates how to extract promotion data from a store with the Data Extract utility. After you extract the data, you can use the Data Load utility to load the promotion data into a new store to quickly copy promotions between stores.

About this sample

When you run this sample with the Data Extract utility, the utility uses the Data Load utility framework to extract promotion data from the PX_PROMOTION database table into an XML file.

The XML configuration files for this sample are in the following directory:
  • Linuxutilities_root/samples/DataExtract/Promotion
  • HCL Commerce DeveloperWCDE_installdir\samples\DataExtract\Promotion

Sample configuration files

The Data Extract utility uses the following configuration files in this sample to extract promotion data from the database into an output XML file.
wc-dataextract.xml
The order configuration file. This file specifies the paths to the environment configuration file and to the business object configuration file.
wc-dataextract-env.xml
The environment configuration file. The environment configuration file, which includes the environment variables for your HCL Commerce instance. These variables include the following information:
  • Business context variables, including the store identifier, catalog identifier, and the default language and currency for your store.
  • Database environment settings, including the database type, name, and schema.
wc-extract-xml-promotion.xml
The business object configuration file. This file defines how the utility identifies the data to extract for a specific business object. The file also defines the business object mediator for transforming the extracted promotion data. This sample uses the following business object mediator:
  • com.ibm.commerce.promotion.dataload.mediator.PromotionToDomTransformMediator
These configuration files include values for a default HCL Commerce Developer environment that uses an Apache Derby database. If your environment settings are different, you must change the configured values in these files to match your environment. For more information, see Extracting promotion data with the Data Extract utility.

Procedure

  1. HCL Commerce DeveloperOn a command line, go to the WCDE_installdir\bin directory.
  2. LinuxOpen a command line in the . 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 order configuration file and extract the promotion data:
    • Linux./dataextract.sh ../samples/DataExtract/Promotion/wc-dataextract.xml
    • HCL Commerce Developerdataextract ..\samples\DataExtract\Promotion\wc-dataextract.xml
When the utility completes the extraction process, the utility generates the Promotion.xml output file in the Promotion directory. This file includes data for all promotions that exist for the configured store ID.

Verifying results

  1. HCL Commerce DeveloperOn a command line, go to the WCDE_installdir\bin directory.
  2. LinuxOpen a command line in the . 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. Go to the following directory:
    • Linuxutilities_root/samples/DataExtract/Promotion
    • HCL Commerce DeveloperWCDE_installdir\samples\DataExtract\Promotion
  4. Open the Promotion.xml to review the file contents.
  5. Verify that the file contents match the data for the extracted promotions in your database.