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.
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
- Create a Web-feed-config.xml file.
- Go to the following directory:
- WC_installdir/components/foundation/samples/DataLoad/Content/WebFeed
- WC_installdir\components\foundation\samples\DataLoad\Content\WebFeed
- WCDE_installdir\components\foundation\samples\DataLoad\Content\WebFeed
- 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.
- 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.
- Save and close the file.
- In a command-line utility, go to the following directory:
- WC_installdir/bin
- WC_installdir\bin
- WCDE_installdir\bin
- Run the
webFeedLoad
utility
with the GenerateDataLoadConfigOnly
option:
- ./webFeedLoad.sh ../components/foundation/samples/DataLoad/Content/Web-feed-config.xml
-DGenerateDataLoadConfigOnly=true -Dwaspath=WC_ear -DlogFileWithTimestamp=true
- webFeedLoad.cmd ..\components\foundation\samples\DataLoad\Content\Web-feed-config.xml
-DGenerateDataLoadConfigOnly=true -Dwaspath=WC_ear -DlogFileWithTimestamp=true
- webFeedLoad.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:
- WC_installdir/components/foundation/samples/DataLoad/Content/WebFeed/temp/wc-loader-URLAttachment.xml
- WC_installdir\components\foundation\samples\DataLoad\Content\WebFeed\temp\wc-loader-URLAttachment.xml
- WCDE_installdir\components\foundation\samples\DataLoad\Content\WebFeed\temp\wc-loader-URLAttachment.xml
- 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>
- Run the
webFeedLoad
utility
without the GenerateDataLoadConfigOnly
option specified.
- ./webFeedLoad.sh ../components/foundation/samples/DataLoad/Content/Web-feed-config.xml
-Dwaspath=WC_ear -DlogFileWithTimestamp=true
- webFeedLoad.cmd ..\components\foundation\samples\DataLoad\Content\Web-feed-config.xml
-Dwaspath=WC_ear -DlogFileWithTimestamp=true
- webFeedLoad.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.