Feature Pack 8

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:
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataExtract/Promotion
  • WindowsWC_installdir\components\foundation\samples\DataExtract\Promotion
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\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. The sample directory also includes the following Data Load utility configuration files:
wc-dataextract.xml
The load 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 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:
    • SolarisLinuxAIXWC_installdir/bin
    • WindowsWC_installdir\bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  2. Enter the following command to run the sample data load order file and load the information that included in this sample:
    • SolarisLinuxAIX./dataextract.sh ../components/foundation/samples/DataExtract/Promotion/wc-dataextract.xml
    • Windowsdataextract.bat ..\components\foundation\samples\DataExtract\Promotion\wc-dataextract.xml
    • WebSphere Commerce Developerdataextract ..\components\foundation\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:
    • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataExtract/Promotion
    • WindowsWC_installdir\components\foundation\samples\DataExtract\Promotion
    • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\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.