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. 

Monday, 7 October 2013

Difference between the @include directive and the jsp:include action.

Came across this when I was doing some research on cachespec.xml .

There are two JSP include mechanisms: the @include directive and the jsp:include
action


@include directive :

  • static
  • it is interpreted at compile time. 
  • It includes text from the referenced HTML or JSP file before the including JSP is
  • compiled. 
  • Once the including JSP has been compiled, subsequent changes to the
  • included file have no effect on the output produced by the including JSP, until it is
  • recompiled.


eg: <%@include file="../../Common/JSTLEnvironmentSetup.jspf" %>


 jsp:include

  • dynamic. 
  • The referenced JSP is re-executed each time the including JSP is execute. 
  • The resulting dynamically generated text (referred to as a "JSP fragment") is included in the output of the
  • including JSP.


eg:  <jsp:include page="../AddressbookSubsection/AccountForm.jsp" flush="true">
<jsp:param name="addressId" value="${final.contactInfoIdentifier.uniqueID}" />
<jsp:param name="firstName" value="${final.contactName.firstName}"/>
<jsp:param name="lastName" value="${final.contactName.lastName}"/>
.
                                        .
                                        ....
</jsp:include>

When the WebSphere Application Server dynamic cache caches the output of a JSP,
it also caches the JSP fragments produced by executing its jsp:include actions.
Subsequent requests for the including JSP are served from the cache as long as all its
included fragments can also be served from the cache. If any of its fragments are no
longer in the cache (a "cache miss") the including JSP is re-executed. However, any
fragments still in the cache are included, thus avoiding re-execution of the
jsp:include actions that produced them.

Configuring gmail settings in websphere commerce

Step 1: Go to Administration Console : https://<hostname> : <port>/webapp/wcs/admin/servlet/ToolsLogon?XMLFile=adminconsole.AdminConsoleLogon

for local : https://localhost:8002/webapp/wcs/admin/servlet/ToolsLogon?XMLFile=adminconsole.AdminConsoleLogon



Step 2: Go to Site Level.
 i). Click Configuration -> Transports -> Email



ii).  hostname : smtp.gmail.com
      port : 465
      username : your gmail id
      password : your gmail password


Step 3: Do the same for store level.
           Go back to the first page of Admin Console and select your store and click OK.
           Do the  i) and ii) of Step 2.

Step 4: Again go to Configuration. Select Message Types.
           Select the email you to configure.

           I selected Message for Notifying the Merchant of an Order.
                    i). Accept default and press Next.

                    ii). Enter the same details here.



Step 5: Now go to WAS Admin Console.
          i). Right click server form RAD and go to Administration -> Run administrative console.

          ii). Go to Security -> SSL Certificate and Key Management.
          iii). Key Strokes and Certificates on the right side.

          iv). Select NodeDefaultKeyStore.

          v). Select Signer Certificates on the right side.

          vi). Click Retrieve from Port .

          vii). Give host as smtp.gmail.com , port : 465 and Alias : Gmail. And Click Retrieve Signer Information.

          viii). Click Apply. And don't forget to Save.
          ix). Now go back to the (iii). And select NodeDefaultTrustStore and repeat the steps (v) to (viii).


Step 6 : Restart the server.