Thursday, 22 January 2015

CSV Dataload for Attachment Usage: loader file

Here is the loader file for loading new attachment usages for the Assets.

<?xml version="1.0" encoding="UTF-8"?>
<_config:DataloadBusinessObjectConfiguration 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.ibm.com/xmlns/prod/commerce/foundation/config ../../../../xml/config/xsd/wc-dataload-businessobject.xsd" 
xmlns:_config="http://www.ibm.com/xmlns/prod/commerce/foundation/config">

  <_config:DataLoader className="com.ibm.commerce.foundation.dataload.BusinessObjectLoader" >
    <_config:DataReader className="com.ibm.commerce.foundation.dataload.datareader.CSVReader" firstLineIsHeader="true" useHeaderAsColumnName="true" >
    </_config:DataReader>
<_config:BusinessObjectBuilder className="com.ibm.commerce.foundation.dataload.businessobjectbuilder.TableObjectBuilder" >
<_config:Table name="ATCHRLUS" deleteKey="Delete" deleteValue="1">
<_config:Column name="ATCHRLUS_ID" value="ATCHRLUS_ID" valueFrom="IDResolve">
<_config:IDResolve tableName="ATCHRLUS" generateNewKey="true" >
<_config:UniqueIndexColumn name="IDENTIFIER" value="Usage" />
</_config:IDResolve>
</_config:Column>
<_config:Column name="Identifier" value="Usage" />
</_config:Table>
<_config:Table name="ATCHRLUSDS" deleteKey="Delete" deleteValue="1">
<_config:Column name="ATCHRLUSDS_ID" value="ATCHRLUSDS_ID" valueFrom="IDResolve">
<_config:IDResolve tableName="ATCHRLUSDS" generateNewKey="true">
<_config:UniqueIndexColumn name="ATCHRLUS_ID" value="ATCHRLUS_ID" valueFrom="IDResolve" />
<_config:UniqueIndexColumn name="LANGUAGE_ID" value="langId" valueFrom="BusinessContext" />
</_config:IDResolve>
</_config:Column>
<_config:Column name="ATCHRLUS_ID" value="ATCHRLUS_ID" valueFrom="IDResolve" />
<_config:Column name="Name" value="Name" />
<_config:Column name="Language_Id" value="langId" valueFrom="BusinessContext" />
<_config:Column name="ShortDescription" value="ShortDescription" />
<_config:Column name="LongDescription" value="LongDescription" />
</_config:Table>
      <_config:BusinessObjectMediator className="com.ibm.commerce.foundation.dataload.businessobjectmediator.TableObjectMediator" >
      </_config:BusinessObjectMediator>
  </_config:BusinessObjectBuilder>
  </_config:DataLoader>

</_config:DataloadBusinessObjectConfiguration>


Sample CSV :

NewAttachmentUsage,,,,,
Usage,Name,langId,ShortDescription,LongDescription,Delete
ANGLE_IMAGE,Angle image,-1,Angle image,Angle image,0

If you don't want the first line of csv (NewAttachmentUsage,,,,,)  to be a header you can remove firstLineIsHeader="true" in the loader file and start with the column names in the csv.
This will load the new attachment usages into ATCHRLUS and ATCHRLUSDS table.






Friday, 9 January 2015

Change the SEO URL Pattern of the URLs generated by the SiteMapGenerate Scheduler

To change the SEO URL Pattern of the URLs generated by the SiteMapGenerate Scheduler

SiteMapGenerate Scheduler ->
         SiteMapGenerateCmdImpl -> performExecute ->

         createSiteMapForStore() -> 
         createRawSitemapForSEO() -> 
         createSiteMapForCatalog() -> 
         CatalogTreeSiteMapGenerateCmd -> CatalogTreeSiteMapGenerateCmdImpl 

CatalogTreeSiteMapGenerateCmdImpl has methods getSEOURLPatternNameForCatalogEntry(), getSEOURLPatternNameForCategory(). These have SEOURLPattern hardcoded.

For CatalogEntry, it is "ProductURLWithCategory" pattern.

To change this you need to create a new class and extend CatalogTreeSiteMapGenerateCmdImpl and overwrite the needed methods.

Don't forget to change the classname in the CMDREG table for CatalogTreeSiteMapGenerateCmd interface.