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:
  • LinuxAIXWC_installdir/samples/DataExtract/Promotion
  • WindowsWC_installdir\samples\DataExtract\Promotion
  • WebSphere 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 WebSphere 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 IBM WebSphere 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. Open a command-line utility and go to the appropriate directory:
    • LinuxAIXWC_installdir/bin
    • WindowsWC_installdir\bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  2. Enter the following command to run the sample order configuration file and extract the promotion data:
    • LinuxAIX./dataextract.sh ../samples/DataExtract/Promotion/wc-dataextract.xml
    • Windowsdataextract.bat ..\samples\DataExtract\Promotion\wc-dataextract.xml
    • WebSphere 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. Go to the following directory:
    • LinuxAIXWC_installdir/samples/DataExtract/Promotion
    • WindowsWC_installdir\samples\DataExtract\Promotion
    • WebSphere Commerce DeveloperWCDE_installdir\samples\DataExtract\Promotion
  2. Open the Promotion.xml to review the file contents.
  3. Verify that the file contents match the data for the extracted promotions in your database.