Feature Pack 7 or later

Sample: Loading Commerce Composer pages

This sample demonstrates how to load Commerce Composer pages for use in the Commerce Composer tool and on the storefront.

Before you begin

This sample requires a published store that is based on the Aurora starter store that is provided with WebSphere Commerce Feature Pack 7 and the Commerce Composer tool. Ensure that the following tasks are complete:If your published store is not based on the Aurora starter store that is provided with WebSphere Commerce Feature Pack 7, you can enable your store to use the Commerce Composer tool. For more information, see Task flow: Enabling Commerce Composer support for a starter store.

About this sample

To create a Commerce Composer page, you must use the Data Load utility to load information about the page and register the page within the WebSphere Commerce database. With the Data Load utility, you can also load information that associates a page with a page group. You must associate a page with a page group before a Management Center user can manage the page with the Commerce Composer tool.

The following sample loads information about two Commerce Composer pages and associates a page with a page group. The sample loads a sample help page and home page, SEO information for both pages, and associates the home page with a page group. The sample also loads information to assign a specific layout to the sample home page.

You can load this sample information in both CSV or XML formatted input files. The following procedure, however, loads only the CSV input files. If you prefer to work with the data within the XML formatted files, you can edit the sample configuration files to use the XML files. The sample input files are located within the following directory:
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/page
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\page
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\page
Feature Pack 8If you are using this sample to help you create Commerce Composer pages that exist in another instance, you can use the Data Extract utility to generate the input files for loading your page data. You can use the Data Extract utility to extract the existing page data. Then, you can edit configuration files for this sample to load the files that are generated by the Data Extract utility. For a sample that demonstrates how to use the Data Extract utility to extract page data, see Sample: Extracting Commerce Composer pages.
Note: You must apply the interim fixes for APAR JR53438.fep and APAR JR53438.fp to add support to the Data Extract utility for extracting Commerce Composer data.
The following table lists the sample input files that are use to load the data in this sample. The table also identifies the business object mediators and business object configuration files that the Data Load utility uses to load the sample data.
Sample input file Description
CSV
  • page.csv
XML
  • page.xml

For more information about the type of data within the input file, see page input file

This sample input file loads page information that creates sample content pages. Management Center users can manage the pages with the Commerce Composer tool.

The Data Load utility loads the information in the input file into the PLPAGE database table. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file:

Business object mediator

com.ibm.commerce.pagelayout.dataload.mediator.PageMediator

Business object configuration file
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/wc-loader-page.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-page.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-page.xml
CSV
  • layoutAssignment.csv
XML
  • layoutAssignment.xml

For more information about the type of data within the input file, see layoutAssignment input file

The Data Load utility uses this sample input file to load information that assigns layouts to one or more pages.

The Data Load utility loads the information in the input file into the EMSPOT, DMACTIVITY, DMELEMENT, DMELEMENTNVP, DMTRIGLSTN, and PLLOCATION database tables. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file:

Business object mediator

com.ibm.commerce.pagelayout.dataload.mediator.LayoutAssignmentMediator

Business object configuration file
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/wc-loader-layoutAssignment.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-layoutAssignment.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-layoutAssignment.xml
CSV
  • seopage.csv
XML
  • seopage.xml

For more information about the type of data within the input file, see seopage input file

This sample input file loads custom search engine optimization (SEO) properties for a content page.

The Data Load utility loads the information in the input file into the SEOURL, SEOURLKEYWORD, SEOPAGEDEF, SEOPAGEDEFDESC, SEOPAGEDEFOVR, SEOREDIRECT database tables. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file:

Business object mediator

com.ibm.commerce.pagelayout.dataload.mediator.SeoPageMediator

Business object configuration file
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/wc-loader-seopage.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-seopage.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-seopage.xml

This sample loads SEO information for a page in a single language. For more information about loading sample SEO information in multiple languages, see Sample: Loading Commerce Composer page SEO information in multiple languages.

CSV
  • seopagedesc.csv
XML
  • seopagedesc.xml

For more information about the type of data within the input file, see seopage input file

This sample input file loads custom search engine optimization (SEO) descriptive information for a content page.

The Data Load utility loads the information in the input file into the SEOURL, SEOURLKEYWORD, SEOPAGEDEF, SEOPAGEDEFDESC, SEOPAGEDEFOVR, SEOREDIRECT database tables. The Data Load utility uses the following business object mediator and business object configuration file to load the data within this input file:

Business object mediator

com.ibm.commerce.pagelayout.dataload.mediator.SeoPageDescMediator

Business object configuration file
  • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/wc-loader-seopagedesc.xml
  • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-seopagedesc.xml
  • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\wc-loader-seopagedesc.xml
For more information about business object configuration files, see Configuring the business object configuration file.

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 for a Commerce Composer page and load the information for this sample:
    • SolarisLinuxAIX./dataload.sh ../components/foundation/samples/DataLoad/CommerceComposer/page/wc-dataload-page.xml
    • Windowsdataload.bat ..\components\foundation\samples\DataLoad\CommerceComposer\page\wc-dataload-page.xml
    • WebSphere Commerce Developerdataload ..\components\foundation\samples\DataLoad\CommerceComposer\page\wc-dataload-page.xml
    The load order configuration file identifies the order that the Data Load utility loads the sample CSV files. The load order file also identifies the appropriate business object configuration file to use to load each input file. For more information about load order configuration files, Configuring the data load order.

    For more information about configuring and running the Data Load utility, see Configuring and running the Data Load utility.

Verifying results

Verify that the Commerce Composer tool page information is loaded by reviewing the data load summary report. For more information about the location and contents of this summary report, see Verifying the results of the data load.

You can also verify that the sample data is loaded by running the following SQL statements against your WebSphere Commerce database:
select * from PLPAGE where ADMINNAME like 'Sample%';
select * from EMSPOT where NAME = 'Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) AS VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHomePage');
select * from DMACTIVITY where DMACTIVITY_ID in (select DMACTIVITY_ID 
 from PLLOCATION where PAGELAYOUT_ID in ( select PAGELAYOUT_ID 
 from PAGELAYOUT where NAME like 'Sample%'));
select * from DMELEMENT where DMACTIVITY_ID IN (select DMACTIVITY_ID 
 from PLLOCATION where PAGELAYOUT_ID in ( select PAGELAYOUT_ID 
 from PAGELAYOUT where NAME like 'Sample%' ));
select * from DMELEMENTNVP where DMELEMENT_ID in (select DMELEMENT_ID 
 from DMELEMENT where DMACTIVITY_ID IN (select DMACTIVITY_ID 
 from PLLOCATION where PAGELAYOUT_ID in ( select PAGELAYOUT_ID 
 from PAGELAYOUT where NAME like 'Sample%' )));
select * from PLLOCATION where PAGELAYOUT_ID in ( select PAGELAYOUT_ID 
 from pagelayout where NAME like 'Sample%' ) order by DMACTIVITY_ID;
select * from DMTRIGLSTN where DMELEMENT_ID in (select DMELEMENT_ID 
 from DMELEMENT where DMACTIVITY_ID IN (select DMACTIVITY_ID 
 from PLLOCATION where PAGELAYOUT_ID in ( select PAGELAYOUT_ID 
 from PAGELAYOUT where NAME like 'Sample%' )));
select * from SEOPAGEDEF where PAGENAME in ('Content_' || (select CAST (CAST(plpage_id AS CHAR(50)) AS 
VARCHAR(50)) 
 from plpage where adminname = 'SampleHomePage'), 'Content_' || (select CAST (CAST(plpage_id AS CHAR(50)) 
AS VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHelpPage'));
select * from SEOPAGEDEFDESC where SEOPAGEDEF_ID in ( select SEOPAGEDEF_ID 
 from SEOPAGEDEF where PAGENAME in ('Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) AS VARCHAR(50)) 
 from plpage where adminname = 'SampleHomePage'), 'Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) AS 
VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHelpPage')));
select * from SEOPAGEDEFOVR where SEOPAGEDEF_ID in ( select SEOPAGEDEF_ID 
 from SEOPAGEDEF where PAGENAME in ('Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) AS VARCHAR(50)) 
 from plpage where adminname = 'SampleHomePage'), 'Content_' || (select CAST (CAST(PLPAGE_ID AS CHAR(50)) 
AS VARCHAR(50)) 
 from PLPAGE where ADMINNAME = 'SampleHelpPage')));
select * from SEOREDIRECT;
select * from SEOURL where TOKENNAME='StaticPagesToken' and TOKENVALUE in ( select CAST(PLPAGE_ID AS CHAR(50)) 
 from PLPAGE where ADMINNAME like 'Sample%');
select * from SEOURLKEYWORD where SEOURL_ID in ( select SEOURL_ID 
 from SEOURL where TOKENNAME='StaticPagesToken' and TOKENVALUE in ( select CAST(PLPAGE_ID AS CHAR(50)) 
 from PLPAGE where ADMINNAME like 'Sample%') );
Ensure that the data within the sample input files exists within the appropriate database tables.
In Management Center, verify that users can see the pages in the Commerce Composer tool by viewing the list of available layouts. Ensure that the layout assignment and search term assignment you loaded are in the Layouts - Layout List grid. The following image shows the new assignments.
Layout List that contains sample layout assignments

Removing the sample data from the WebSphere Commerce database

To remove the sample data from your database, run the sample again but with the value for the delete column for all entries within the files set to 1. By setting the value for this column to 1, the Data Load utility deletes the data that is identified in the CSV file from your database.

Alternatively, you can run an SQL file to remove the data for this sample.
  1. Go to the following directory
    • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/CommerceComposer/page
    • WindowsWC_installdir\components\foundation\samples\DataLoad\CommerceComposer\page
    • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\CommerceComposer\page
  2. Open the Cleanup.sql for editing. Replace the contents of this file with the following SQL.
    delete from seourl where SEOURL_ID in (select SEOURL_ID from SEOURLKEYWORD where URLKEYWORD = 'sampleHelp');
    
    delete from seopagedef where pagename = 'Content_' || (select CAST(plpage_id AS VARCHAR(50)) 
    from plpage where adminname = 'SampleHelpPage');
    delete from seopagedef where pagename = 'Content_' || (select CAST(plpage_id AS VARCHAR(50)) 
    from plpage where adminname = 'SampleHomePage');
    
    delete from plpage where adminName in ('SampleHelpPage', 'SampleHomePage'); 
  3. Save and close the file.
  4. From a command prompt, connect to the database with your user ID and password. Run the following command to remove the data from your database
    Apache Derby
    • ij -f ..\components\foundation\samples\DataLoad\CommerceComposer\page\Cleanup.sql
    DB2
    • SolarisLinuxAIXdb2 -tvf ../components/foundation/samples/DataLoad/CommerceComposer/page/Cleanup.sql
    • Windowsdb2 -tvf ..\components\foundation\samples\DataLoad\CommerceComposer\page\Cleanup.sql
    Oracle
    • SolarisLinuxAIXsqlplus user_name/password@ database_name@ ../components/foundation/samples/DataLoad/CommerceComposer/page/Cleanup.sql
    • Windowssqlplus user_name/password@ database_name@ ..\components\foundation\samples\DataLoad\CommerceComposer\page\Cleanup.sql