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:
- WC_installdir/samples/DataExtract/Promotion
- WC_installdir\samples\DataExtract\Promotion
- WCDE_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
Procedure
- Open a command-line utility and go to the appropriate directory:
- WC_installdir/bin
- WC_installdir\bin
- WCDE_installdir\bin
- Enter the following command to run the sample order configuration file and extract the promotion data:
- ./dataextract.sh ../samples/DataExtract/Promotion/wc-dataextract.xml
- dataextract.bat ..\samples\DataExtract\Promotion\wc-dataextract.xml
- dataextract ..\samples\DataExtract\Promotion\wc-dataextract.xml
Verifying results
- Go to the following directory:
- WC_installdir/samples/DataExtract/Promotion
- WC_installdir\samples\DataExtract\Promotion
- WCDE_installdir\samples\DataExtract\Promotion
- Open the Promotion.xml to review the file contents.
- Verify that the file contents match the data for the extracted promotions in your database.