Feature Pack 8

Sample: Extracting Commerce Composer widgets

This sample demonstrates how to extract Commerce Composer widgets for a store with the Data Extract utility. You can then use the Data Load utility to load the extracted data into another WebSphere Commerce instance or store to quickly copy widgets between instances or stores.

A widget, also called a layout widget, is a frame that displays a specific type of store content, such as ads, product recommendations, or navigational links. For more information about widgets, see Widgets for Commerce Composer.

Before you begin

Ensure that you complete the following tasks:
  • Apply the interim fixes for APAR JR53438.fep and APAR JR53438.fp. You must apply these interim fixes to add support to the Data Extract utility for extracting Commerce Composer data.
  • Verify that the store that you want to extract data from includes Commerce Composer widget data to extract.
Note: If you plan to load the extracted data into another instance, the store that you want to load data into must have the Commerce Composer tool enabled. By default, the Aurora starter store that is included with Feature Pack 7 or later is already enabled to use the Commerce Composer tool. For a guide that demonstrates how to enable Commerce Composer support for a store that is based on the Madisons starter store, see Enabling Commerce Composer support for a Madisons starter store.

About this sample

When you run this sample, the Data Extract utility is configured to extract the widgets and widget-related data for only the store that you specify. You can specify the store in the environment configuration file or directly in the command line when you run the utility.

When you run this sample, the utility also extracts the layout template data and the relationship data for the widgets that are assigned to layouts for the specified store. The extracted data includes all of the information that you need to register and subscribe the widgets to a store in another WebSphere Commerce instance. This information includes any widget descriptive information that is available for the widgets. This information includes descriptive information that is available in multiple languages.

The sample configuration files that are used to configure the Data Extract utilityare in the following directory and subdirectories:
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataExtract/CommerceComposer
  • WindowsWC_installdir\components\foundation\samples\DataExtract\CommerceComposer
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataExtract\CommerceComposer

Sample configuration files

The following configuration files are used to configure the Data Extract utility to extract data into CSV output files.
wc-dataextract-env.xml
The environment configuration file. This file 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-dataextract-widget.xml
The data extract order configuration file. This file specifies the paths to the environment configuration file and to the business object configuration files for extracting the data for each type of object. The order configuration file also identifies the order that the Data Extract utility extracts data and identifies the output files that the utility generates to include the extracted data.
wc-extract-business-object.xml
The business object configuration file. This file defines how the utility identifies the data to extract and defines the business object mediator for the utility to use to transform the extracted data. In this sample, all of the business object configuration files configure the utility to use the following business object mediator:

com.ibm.commerce.foundation.dataload.businessobjectmediator.AssociationObjectMediator

The following business object configuration files are used to configure the Data Extract utility for this sample:
wc-extract-registerWidgetdef.xml
There are 2 wc-extract-registerWidgetdef.xml files that are used in this sample. These files are used to configure the utility to extract widget and layout template container registration data. The utility extracts the data for both types of objects from the following database tables:The utility generates 2 registerWidgetdef.csv files to include the extracted data. These files can then be used to load data for registering a new widget or template container within the Commerce Composer tool.
  • The registerWidgetdef.csv file in the widget directory includes widget subscription data.
  • The registerWidgetdef.csv file in the template directory includes layout template container subscription data.
For more information about the data that can be included in these files, see registerWidgetdef input file
wc-extract-subscribeWidgetdef.xml
There are 2 wc-extract-registerWidgetdef.xml files that are used in this sample. These files are used to configure the utility to extract widget and layout template container subscription data. The utility extracts the data for both types of objects from the following database table:The utility generates 2 subscribeWidgetdef.csv output files to include the extracted data. These files can then be used to load the data for subscribing widgets and layout template containers to a store.
  • The subscribeWidgetdef.csv file in the widget directory includes widget subscription data.
  • The subscribeWidgetdef.csv file in the template directory includes layout template container subscription data.
For more information about the data that can be included in these files, see subscribeWidgetdef input file.
wc-extract-template.xml
This file is used to configure the utility to extract basic layout template data. The utility extracts this data from the following database table:The utility generates the template.csv output file to include this extracted data. This file can then be used to load the data to create layout templates in the Commerce Composer tool. For more information about the data that can be included in this file, see template input file.
wc-extract-slotDefinition.xml
This file is used to configure the utility to extract the wireframe slot definitions for layout templates. Each wireframe slot is defined with X and Y coordinates and is used to organize widgets within a layout. The utility extracts this data from the following database table:The utility generates the slotdefinition.csv output file to include the extracted data. This file can then be used to load the data to assign the wireframe coordinates to a template. For more information about the data that can be in this file, see slotDefinition input file
wc-extract-pagelayout.xml
This file is used to configure the utility to extract basic layout data for the layouts that exist for a store. The utility extracts this data from the following database tables: The utility generates the layout.csv output file to include the extracted data. This file can then be used to load the data to create layouts in a store. For more information about the data that can be in this file, see layout input file.
wc-extract-registerWidgetdef-MultiLanaguages.xml
This file is used to configure the utility to extract widget registration data that is in multiple languages. The utility extracts this data from the following database tables:The utility generates the registerWidgetDefWithMultiLanguages.csv output file to include the extracted data. This file can then be used to load the registration data in multiple languages. This file includes information for the language that is specified in the environment configuration file business context and for any other language where registration data is available. For more information about the data that can be in this file, see registerWidgetdef input file.
wc-extract-widget.xml
This file is used to configure the utility to extract relationship data for assigning widgets and layout template containers to layouts. The utility extracts this data from the following database tables: The utility generates the layoutWidgetRelationship.csv file to include the extracted data. This file can then be used to assign widgets to layouts in another store or instance. For more information about the data that can be in this file, see layoutWidgetRelationship input file.

Procedure

  1. Copy the sample configuration files and directories to a local directory.
  2. Edit your copy of the sample environment configuration file to set the configuration variables for your environment. The sample configuration file that is used in this sample includes 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 your environment configuration file to match your environment. For more information about updating an environment configuration file, see Configuring the data load environment settings.
  3. Open a command-line utility and go to the appropriate directory:
    • SolarisLinuxAIXWC_installdir/bin
    • WindowsWC_installdir\bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  4. Enter the following command to run the sample data extract order configuration for extracting the widget data into CSV output files:
    • SolarisLinuxAIX./dataextract.sh ../components/foundation/samples/DataExtract/CommerceComposer/wc-dataextract-widget.xml
    • Windowsdataextract.bat ..\components\foundation\samples\DataExtract\CommerceComposer\wc-dataextract-widget.xml
    • WebSphere Commerce Developerdataextract ..\components\foundation\samples\DataExtract\CommerceComposer\wc-dataextract-widget.xml
When the utility completes the extraction process, the utility generates the CSV output files within the configured output directory and subdirectories. These files include data for all widgets that exist for the configured store ID. These files also include the data for layout templates and any relationship data for widgets that are assigned to layouts. By default, the files are generated in the following output directory and subdirectories:
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataExtract/CommerceComposer/output
  • WindowsWC_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataExtract\CommerceComposer\output

Verifying results

  1. Go to the directory that you configured as the output directory. If you did not configure an output directory, go to the following directory:
    • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataExtract/CommerceComposer/output
    • WindowsWC_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
    • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
  2. Verify that the following CSV output files are generated:
    • widget/registerWidgetdef.csv
    • widget/subscribeWidgetdef.csv
    • widget/layout.csv
    • widget/layoutWidgetRelationship.csv
    • widget/MultiLanguages/registerWidgetdefWithMultiLanguages.csv
    • template/registerWidgetdef.csv
    • template/subscribeWidgetdef.csv
    • template/template.csv
    • template/slotDefinition.csv
  3. Open the output CSV files to review the file contents.
  4. Verify that the file contents match the data in the database for the layouts that belong to the specified store.

What to do next

You can load your extracted data into another WebSphere Commerce instance with the Data Load utility. For a sample that demonstrates how to load widget data, see Sample: Loading Commerce Composer layouts. When you follow this sample, edit the load order configuration file to specify the CSV files that were generated by the Data Extract utility.

If you want to load widget descriptive information in multiple languages, load the information for the default store language first. Then, load the information for multiple languages. You can specify the default language in the environment configuration file business context. By loading the information in the configured default language first, you can reduce the risk of errors during the load operation. For a sample that demonstrates how to load widget descriptive information in multiple languages, see Sample: Loading Commerce Composer page SEO information in multiple languages. When you follow this sample, use the single file approach and edit the load order configuration file to specify the CSV file that was generated by the Data Extract utility.