Introduced in Feature Pack 2

Customizing web feed integration: Populate a URL or its contents in a custom table

Without customization, the mediators that are provided with the web feed integration feature load data into only specific database tables. To load content into other tables, you must use the com.ibm.commerce.foundation.dataload.businessobjectmediator.TableObjectMediator mediator during the load process.

Without customization, the mediators that are provided with the web feed integration feature load data into the ATCHAST, ATCHTGT, ATCHREL, and CMFILE tables. The URL content, the content source, content title, or name from the feed map can be passed to the TableObjectMediator mediator.

Before you begin

Ensure that you configure the Data Load utility environment configuration file. For more information, see configuring the data load environment settings.

About this task

This task shows you how to configure a business object configuration file that can be used to populate a custom table. In the business object configuration file, you must configure the settings for the business object builder to identify the table columns that are to be populated with data during the load process. You must also ensure that any required IDResolve is configured.

Procedure

  1. Create a Web-feed-config.xml file.
    1. Go to the following directory:
      • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/Content/WebFeed
      • WindowsWC_installdir\components\foundation\samples\DataLoad\Content\WebFeed
      • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\Content\WebFeed
    2. Copy the sample sample-Web-Feed-config.xml file. Rename the file copy.
      For example, you can rename the file to be Web-Feed-config.xml.
      Note: You can paste your copied file into another directory. For this task, the path for the location of the copied file remains the WebFeed directory. If you do paste the copied file in a different directory, update the filepaths in following steps to use the path to your copied configuration file.
    3. Open the file for editing. Update the file to meet your requirements.
      Use the content:URLAttachment in the config:content element. Ensure that the following element is specified within the file with the generate element set to "false":
      <config:dataLoadConfigFile generate="false" envFileLocation="envFile_Path">configFile_Path</config:dataLoadConfigFile>
      Where
      envFile_Path
      The path to the Data Load utility environment configuration file.
      configFile_Path
      The path to the data load configuration file that is to be used with the web feed utility.
    4. Save and close the file.

      For more information about updating the sample file to create your own web feed utility configuration file, see Configuring the web feed utility.

  2. In a command-line utility, go to the following directory:
    • SolarisLinuxAIXWC_installdir/bin
    • WindowsWC_installdir\bin
    • WebSphere Commerce DeveloperWCDE_installdir\bin
  3. Run the webFeedLoad utility with the GenerateDataLoadConfigOnly option:
    • SolarisLinuxAIX./webFeedLoad.sh ../components/foundation/samples/DataLoad/Content/Web-feed-config.xml -DGenerateDataLoadConfigOnly=true -Dwaspath=WC_ear -DlogFileWithTimestamp=true
    • WindowswebFeedLoad.cmd ..\components\foundation\samples\DataLoad\Content\Web-feed-config.xml -DGenerateDataLoadConfigOnly=true -Dwaspath=WC_ear -DlogFileWithTimestamp=true
    • WebSphere Commerce DeveloperwebFeedLoad.bat ..\components\foundation\samples\DataLoad\Content\Web-feed-config.xml -DGenerateDataLoadConfigOnly=true -DlogFileWithTimestamp=true
    A wc-loader-URLAttachment.xml file is generated within the directory that is specified in the Web-feed-config.xml for the Data Load order configuration file. For example, if the Web-feed-config.xml file specifies a temp directory, the wc-loader-URLAttachment.xml file can be generated in the following directory:
    • SolarisLinuxAIXWC_installdir/components/foundation/samples/DataLoad/Content/WebFeed/temp/wc-loader-URLAttachment.xml
    • WindowsWC_installdir\components\foundation\samples\DataLoad\Content\WebFeed\temp\wc-loader-URLAttachment.xml
    • WebSphere Commerce DeveloperWCDE_installdir\components\foundation\samples\DataLoad\Content\WebFeed\temp\wc-loader-URLAttachment.xml
  4. Open the generated wc-loader-URLAttachment.xml business object configuration file for editing. Add a BusinessObjectBuilder for the custom tables that you want to load data into with the TableObjectMediator.
    For example, If you wanted to load data into the COLLDESC, ATCHREL, and COLLATERAL database tables, the business object builder configuration can resemble the following code snippet. You can use a similar approach to load data to other tables.
    <_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.TableObjectBuilder">
    <!-- 
    Table:   COLLATERAL
    Columns: COLLATERAL_ID,COLLTYPE_ID,STOREENT_ID,NAME
    -->
    <_config:Table name="COLLATERAL" >
     <_config:Column name="COLLATERAL_ID" value="CollateralId" valueFrom="IDResolve">
      <_config:IDResolve tableName="COLLATERAL" generateNewKey="true">
      </_config:IDResolve>
     </_config:Column>
     <_config:Column name="COLLTYPE_ID" value="1" valueFrom="fixed">
     </_config:Column>
     <_config:Column name="NAME" value="Name">
     </_config:Column>
     <_config:Column name="STOREENT_ID" value="storeId" valueFrom="BusinessContext"/>
    </_config:Table>
    
    <!-- 
    Table:   COLLDESC
    Columns: COLLATERAL_ID,LANGUAGE_ID
    -->
    <_config:Table name="COLLDESC" >
     <_config:Column name="COLLATERAL_ID" value="CollateralId" valueFrom="IDResolve">
      <_config:IDResolve tableName="COLLATERAL" primaryKeyColumnName="COLLATERAL_ID" >
       <_config:UniqueIndexColumn name="NAME" value="Name"/>
       <_config:UniqueIndexColumn name="STOREENT_ID" value="storeId" valueFrom="BusinessContext"/>
      </_config:IDResolve>
     </_config:Column>
     <_config:Column name="LANGUAGE_ID" value="langId" valueFrom="BusinessContext">
     </_config:Column>
    </_config:Table>
    
    <!--
    Table: ATCHREL
    Columns: OBJECT_ID, ATCHOBJTYP_ID, ATCHRLUS_ID, ATCHTGT_ID 
    -->
    <_config:Table name="ATCHREL" >
     <_config:Column name="ATCHREL_ID" value="AtchRelId" valueFrom="IDResolve">
      <_config:IDResolve tableName="ATCHREL" generateNewKey="true">
      </_config:IDResolve>
     </_config:Column>
     <_config:Column name="ATCHOBJTYP_ID" value="4" valueFrom="fixed">
     </_config:Column>
     <_config:Column name="ATCHRLUS_ID" value="0" valueFrom="fixed">
     </_config:Column>
     <_config:Column name="OBJECT_ID" value="CollateralId2" valueFrom="IDResolve">
      <_config:IDResolve tableName="COLLATERAL" primaryKeyColumnName="COLLATERAL_ID" >
       <_config:UniqueIndexColumn name="NAME" value="Name"/>
       <_config:UniqueIndexColumn name="STOREENT_ID" value="storeId" valueFrom="BusinessContext"/> 
      </_config:IDResolve>
     </_config:Column>
     <_config:Column name="ATCHTGT_ID" value="AttachmentId" valueFrom="IDResolve">
      <_config:IDResolve tableName="ATCHTGT" primaryKeyColumnName="ATCHTGT_ID" >
       <_config:UniqueIndexColumn name="IDENTIFIER" value="Category"/>
       <_config:UniqueIndexColumn name="STOREENT_ID" value="storeId" valueFrom="BusinessContext"/> 
       <_config:UniqueIndexColumn name="MEMBER_ID" value="storeOwnerId" valueFrom="BusinessContext"/> 
      </_config:IDResolve>
     </_config:Column>
    </_config:Table>
    
    <_config:BusinessObjectMediator className="com.ibm.commerce.foundation.dataload.businessobjectmediator.TableObjectMediator"/>
    </_config:BusinessObjectBuilder>
  5. Run the webFeedLoad utility without the GenerateDataLoadConfigOnly option specified.
    • SolarisLinuxAIX./webFeedLoad.sh ../components/foundation/samples/DataLoad/Content/Web-feed-config.xml -Dwaspath=WC_ear -DlogFileWithTimestamp=true
    • WindowswebFeedLoad.cmd ..\components\foundation\samples\DataLoad\Content\Web-feed-config.xml -Dwaspath=WC_ear -DlogFileWithTimestamp=true
    • WebSphere Commerce DeveloperwebFeedLoad.bat ..\components\foundation\samples\DataLoad\Content\Web-feed-config.xml -DlogFileWithTimestamp=true

Results

The database tables that are specified in the business object configuration file are populated with the data that you loaded. In particular, the COLLATERAL, and COLLDESC tables are populated with HTML content. Any other table that you specified is populated with the appropriate data.