websphere-commerce

Databean to fetch CATENTDESCOVR


I need to fetch data of CATENTDESCOVR using Databean.

Is there any databean provided by IBM to get the data?

I am using IBM WebSphere Commerce V7.0 Feature Pack 8


Solution

  • this is good question and here below is the explanation how CATENTDESCOVR works , this answer is based on WCS 7.0 , FEP 7 . but I believe fep 8 have same api , i don't think IBM enhanced this in fep8!

    if you look at how these data are indexed and stored in solr in schema.xml you will find following line

       <!--
       Catentry's description override: map to table CATENTDESCOVR
       -->
       <field name="nameOverride" type="wc_text" indexed="true" stored="true"  multiValued="true"/>
       <field name="shortDescriptionOverride" type="wc_text" indexed="true" stored="true"  multiValued="true"/>
       <field name="keywordOverride" type="wc_text" indexed="true" stored="true"  multiValued="true"/>
    

    please note here the multiValued="true" , this means that if you have multible stores belongs to same Esite , the solr index the nameOvr , descOvr as multivalued for that catentryId , but solr have no idea which overridden name belongs to which store , that bean said , IBM solr index the master catalog data not store specific data .

    this brings the question how the overridden name is shown per store in store front?

    the answer is by utilizing WC-Search post-processor:

    com.ibm.commerce.foundation.server.services.rest.search.postprocessor.solr.SolrRESTSearchCatalogEntryViewDescriptionQueryPostprocessor
    

    if you look at the implementation of this postprocessor you will find the following high level steps :

    1- get the catOvrGrpId by:

    catOvrGrpId = CatalogOverrideHelper.getOverrideGroupIdForStore(this.iStoreId)
    

    2- get the required overridden data by calling the DSL service:

    JDBCQueryService service = new JDBCQueryService("com.ibm.commerce.catalog");
    
    queryParameters.put("language", langIds);
    queryParameters.put("UniqueID", catEntryUniqueIDs);
    queryParameters.put("catOverrideGroupID", groupIds);
    
    service.executeQuery("IBM_Get_CatentryDescOverride_By_LangId_And_CatentryId_And_GroupId", 
              queryParameters);
    

    3- convert the array list returned to JSON compatible result:

    populateOverrideCatalogEntries((List)listOfPhysicalObjects, catalogEntryViews);
    

    you can reused the codes above and try to de-compile SolrRESTSearchCatalogEntryViewDescriptionQueryPostprocessor to understand how you can read these information from database.

    the query for IBM_Get_CatentryDescOverride_By_LangId_And_CatentryId_And_GroupId is exist under Search/xml/config/com.ibm.commerce.catalog/wc-query-utilities.tpl

    Hope this will be informative for you.

    Thanks Abed