Sample: Extracting Commerce Composer pages
This sample demonstrates how to extract Commerce Composer pages and page content, such as SEO information, layouts, layout templates, and widgets. This sample uses the Data Extract utility to extract the Commerce Composer data for a specific store. You can then use the Data Load utility to load the extracted data into another WebSphere Commerce instance or store to quickly copy pages and page content between instances or stores.
In the Commerce Composer framework, a page is a specific URL on the storefront. Each page can include specific SEO information and be assigned one or more layouts for displaying widgets on the page. For more information about pages, see Pages and page creation.
Before you begin
- 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 page data to extract.
About this sample
When you run this sample, the Data Extract utility is configured to extract the pages and page-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.
The extracted page-related data includes any SEO information that is available for the extracted pages. This information includes SEO information that is available in multiple languages. The utility also extracts data for layout templates, layouts, and layout assignments for pages.
- WC_installdir/components/foundation/samples/DataExtract/CommerceComposer
- WC_installdir\components\foundation\samples\DataExtract\CommerceComposer
- WCDE_installdir\components\foundation\samples\DataExtract\CommerceComposer
Sample configuration 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 the utility to use for a store.
- Database environment settings, including the database type, name, and schema.
- wc-dataextract-page.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
- This file is used to configure the utility to extract layout template container registration data. The utility extracts this data from the following database tables:The utility generates the registerWidgetdef.csv output file to include the extracted data. This file can then be used to load data for registering a new layout template container within the Commerce Composer tool. For more information about the data that can be included in this file, see registerWidgetdef input file
- wc-extract-subscribeWidgetdef.xml
- Two wc-extract-registerWidgetdef.xml files are used in this sample to
configure the utility. One file is used to configure the utility to extract widget subscription
data. The other file is used to configure the utility to extract 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 layout directory includes widget subscription data.
- The subscribeWidgetdef.csv file in the template directory includes layout template container subscription data.
- 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-page.xml
- This file is used to configure the utility to extract basic page data for the Commerce Composer pages that exist for a store. The utility extracts this data from the following database tables: The utility generates the page.csv output file to include the extracted data. This file can then be used to load the data to create pages in a store. For more information about the data that can be in this file, see page input file.
- wc-extract-seopage.xml
- This file configures the utility to extract custom search engine optimization (SEO) property data for content pages. The utility extracts this data from the following database tables:The utility generates the seopage.xml output file to include the extracted data. This file can then be used to load the custom SEO property for the corresponding pages in another store or instance. For more information about the data that can be in this file, see seopage input file.
- wc-extract-seopagedesc.xml
- This file configures the utility to extract SEO descriptive information for content pages in the language that is specified in the environment configuration file business context. The utility extracts this data from the following database tables:The utility generates the seopagedesc.csv output file to include the extracted data. This file can then be used to load the SEO descriptive information in the same language for the corresponding pages in another store or instance. For more information about the data that can be in this file, see seopagedesc input file
- wc-extract-seopagedesc-MultiLanaguages.xml
- This file configures the utility to extract SEO descriptive information for content pages in multiple languages. The utility extracts this data from the following database tables:The utility generates the seopagedescWithMultiLanguages.csv output file to include the extracted data. This file can then be used to load the SEO descriptive information 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 SEO information is available. For more information about the data that can be in this file, see seopage input file.
- wc-extract-layoutAssignment.xml
- This file configures the Data Extract utility to extract data that assigns layouts to pages. The utility extracts this data from the following database tables:The utility generates the layoutAssignment.csv output file to include the extended data. This file can then be used to load the relationship to assign layouts to pages. For more information about the data that can be in this file, see layoutAssignment input file.
Procedure
- Copy the sample configuration files and directories to a local directory.
- 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.
- 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 data extract order configuration for extracting
the page data into CSV output files:
- ./dataextract.sh ../components/foundation/samples/DataExtract/CommerceComposer/wc-dataextract-page.xml
- dataextract.bat ..\components\foundation\samples\DataExtract\CommerceComposer\wc-dataextract-page.xml
- dataextract ..\components\foundation\samples\DataExtract\CommerceComposer\wc-dataextract-page.xml
- WC_installdir/components/foundation/samples/DataExtract/CommerceComposer/output
- WC_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
- WCDE_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
Verifying results
- Go to the directory that you configured as the output directory. If you did not configure an
output directory, go to the following directory:
- WC_installdir/components/foundation/samples/DataExtract/CommerceComposer/output
- WC_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
- WCDE_installdir\components\foundation\samples\DataExtract\CommerceComposer\output
- Verify that the following CSV output files are generated:
- template/registerWidgetdef.csv
- template/subscribeWidgetdef.csv
- widget/subscribeWidgetdef.csv
- template/template.csv
- template/slotDefinition.csv
- widget/layout.csv
- page/page.csv
- page/seopage.csv
- page/seopagedesc.csv
- page/layoutAssignment.csv
- page/MultiLanguages/seopagedescWithMultiLanguages.csv
- Open the output CSV files to review the file contents.
- Verify that the file contents match the data in the database for the pages 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 only page data, see Sample: Loading Commerce Composer pages. 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 SEO page descriptive information in multiple languages, load the SEO information for the default store language first. Then, load the SEO information for multiple languages. By loading the information in the default language first, you can reduce the risk of errors during the load operation. You can specify the default language in the environment configuration file business context. For a sample that demonstrates how to load SEO information in multiple languages, see Sample: Loading Commerce Composer page SEO information in multiple languages. When you follow the 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.
.