Wednesday, January 4, 2012

ATG CSC : Adding a New Panel to Commerce Service Center


The Service application maintains a list of valid UI components in atg/svc/ui/util/ServiceUIComponentDataStore. In order to add panels to the CSC UI, it's necessary to do extend that class. As well as being defined in the ServiceUIComponentDataStore, the panels must be added to the Service Repository. This can be accomplished by performing an xml combine with the existing svc_framework.xml file. The following steps provide a working example.



1) Create a new Nucleus Component which extends ServiceUIComponentDataStore
Place the component in your config layer at /atg/svc/ui/util/ServiceUIComponentDataStore.properties.

$class=com.example.MyServiceUIComponentDataStore
$scope=global

2) Create a new Class which extends ServiceUIComponentDataStore
The class will override the initializeService method to add the CSC panel.

package com.example;
public class MyServiceUIComponentDataStore extends ServiceUIComponentDataStore
{
@Override
public void initializeService() {

// Add additional CSC Panels
addServiceUIComponent ( new atg.svc.ui.util.ServiceUIComponent
("myAdditionalPanel1",  CSR_LICENSE, CSR_MODULE_NAME,  PANEL_TYPE) );

super.initializeService();
}
}

3) Update the Service Repository with definitions of the new CSC panel.
The Service application stores Panels, Panel Stacks and all other Framework type objects in a Repository. This is defined in the install/data/svc_framework.xml file. We must extend this repository to add the additional panels that were created in the CSCServiceUIComponentDataStore above.

NOTE: the example panel defintion below points to the shopping cart. The following properties will need to be changed: titleKey, resourceBundle, contentUrl and otherContext.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE gsa-template SYSTEM "dynamosystemresource:/atg/dtds/gsa/gsa_1.0.dtd">

<gsa-template>
<add-item item-descriptor="PanelDefinition" id="myAdditionalPanel1">
 <set-property name="appId" value="workspace"/>
 <set-property name="panelId" value="myAdditionalPanel1"/>
 <set-property name="accessRight" value="AdditionalPanel1"/>
 <set-property name="titleKey" value="cmcShoppingCartP"/>
 <set-property name="resourceBundle"
   value="atg.commerce.csr.FrameworkResources"/>
 <set-property name="contentUrl" value="/panels/order/cart.jsp"/>
 <set-property name="otherContext" value="yourwebapp"/>
 <set-property name="templateIds"
   value="panelTemplate=panelTemplate"/>
 <set-property name="tabHolderYn" value="true"/>
 <set-property name="allowContentToggleYn" value="true"/>
 <set-property name="allowTabbingYn" value="true"/>
</add-item>
</gsa-template>

The new panel can be added to any existing Panel Stack by updating its panelIds property. Similarly, the panels may be added to a new panel stack.

Now that the Repository definition has been extended and the panels added to the required panel stack, the Service database should be reloaded and the application restarted. Be sure to clear out the browser cache, before logging on to CSC. The new panels will then be visible.


No comments:

Popular Posts