Thursday, 5 February 2015

Update JSP files in compressed war file

Here are the steps to update jsp file in compressed war.
  1. Extract war and update the file as per your need.
  2. Open original war file using 7-zip tool.
  3. Navigate to file location in war (in 7-zip explorer).
  4. Drag the modified file in 7-zip.

Sunday, 11 January 2015

Customizing DeploymentEventListener

To confgiure a customized DeploymentEventListener, Here are the steps.
  1. Define a listener service class that implements the interface DeploymentEventListener and implement the method deploymentEvent(DeploymentEvent pEvent).
  2. Configure an instance in Nucleus on the appropriate server and register it with the DeploymentServer or DeploymentAgent as appropriate.
  • Configure the listener on the asset management server (BCC) and register it with the /atg/epub/DeploymentServer, so it listens for deployment events fired when the deployment changes its state.
  • Configure the listener on the target (production/stagging) server and register it with the local /atg/epub/DeploymentAgent, so it listens for deployment events fired when an agent changes its state.
Here is sample code to print the assets changed/modified in BCC project. Along with configuration. You can customize code as per your need.

Note : Custom is the custom module created for this customization.

1.   Custom listener class.
Path : /Custom/src/com/test/service/CustomDeploymentEventListener.java
File Content : 


package com.test.service;

import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Set;

import javax.ejb.EJBException;
import javax.ejb.FinderException;

import atg.deployment.common.event.DeploymentEvent;
import atg.deployment.common.event.DeploymentEventListener;
import atg.epub.project.Project;
import atg.epub.project.ProjectConstants;
import atg.epub.project.ProjectHome;
import atg.nucleus.GenericService;
import atg.repository.RepositoryException;
import atg.repository.RepositoryItem;
import atg.versionmanager.AssetVersion;
import atg.versionmanager.exceptions.VersionException;

public class CustomDeploymentEventListener extends GenericService implements DeploymentEventListener {
/**
* boolean to denote whether to listen the event or ignore it
*/
private boolean enabled;
@SuppressWarnings("unchecked")
@Override
public void deploymentEvent(DeploymentEvent pDeploymentevent) {
vlogDebug("Enter deploymentEvent method of CustomDeploymentEventListener");
if (isEnabled() && pDeploymentevent != null &&
                 DeploymentEvent.DEPLOYMENT_COMPLETE == pDeploymentevent.getNewState()) {

 String[] projectIds = pDeploymentevent.getDeploymentProjectIDs();
 Project project = null;
 Set workSpaceAssets = null;
 Set<RepositoryItem> repositoryItemsUpdated = new LinkedHashSet<RepositoryItem>();
 Iterator<AssetVersion> workspaceAssetsIterator = null;
 RepositoryItem repositoryItem = null;
 try {
    if (projectIds != null && projectIds.length >= 1) {
   ProjectHome home = ProjectConstants.getPersistentHomes().getProjectHome();
   try {
project = home.findById(projectIds[0]);
   } catch (EJBException ejbException) {
if (isLoggingError()) {
logError("Cannot find project with Id " + projectIds[0], ejbException);
}
   } catch (FinderException finderException) {
if (isLoggingError()) {
       logError("Cannot find project with Id " 
                                                    + projectIds[0], finderException);
}
   }
}
if (project != null) {
workSpaceAssets = project.getAssets();
}
if (workSpaceAssets != null) {
 workspaceAssetsIterator = (Iterator<AssetVersion>) workSpaceAssets.iterator();
}
if (workspaceAssetsIterator != null) {
while (workspaceAssetsIterator.hasNext()) {
AssetVersion assetVersion = workspaceAssetsIterator.next();
try {
if (assetVersion != null) {
repositoryItem = assetVersion.getRepositoryItem();                        repositoryItemsUpdated.add(repositoryItem);
}
} catch (RepositoryException repoExc) {
      vlogError("Repository Exception while accessing item " 
                                                                   + repositoryItem, repoExc);
}
}
}

if (!repositoryItemsUpdated.isEmpty()) {
//print updated items
printUpdatedItems(repositoryItemsUpdated);
}
} catch (VersionException versionExc) {
vlogError("Version exception occured while processing deployed project"
                                                               , versionExc);
}
 }
vlogDebug("Exit deploymentEvent method of CustomDeploymentEventListener");
         }
/**
* Method to print updated repository items
* @param repositoryItems
*/
private void printUpdatedItems(Set<RepositoryItem> repositoryItems) {
vlogDebug("Start :: printUpdatedItems(Set<RepositoryItem>)");
for (RepositoryItem repositoryItem : repositoryItems) {
System.out.println("Updated item is "+repositoryItem);
}
vlogDebug("End :: printUpdatedItems(Set<RepositoryItem>)");
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}

2.   Custom listener component.
Path : /Custom/config/com/test/service/listener/CustomDeploymentEventListener.properties
File Content :
       $class=com.test.service.CustomDeploymentEventListener
       enabled=true

3.   Deployment agent configuration (For agent instances).
Path : /Custom/config/atg/epub/DeploymentAgent.properties
File Content :
      deploymentEventListeners+=/com/test/service/listener/CustomDeploymentEventListener

4.   Deployment server configuration (For BCC instance).
Path : /Custom/config/atg/epub/DeploymentServer.properties
File Content :
       deploymentEventListeners+=/com/test/service/listener/CustomDeploymentEventListener

Monday, 13 October 2014

Discountable/Non -Discountable SKUs in ATG 10.2


Today I came to know the interested attribute (discountable) of SKU added in ATG 10.2. Oracle introduced this boolean attribute at SKU and Product level. The attribute value true means it is discountable. The false value means non-discountable. By default SKUs and Products are discountable.

Non-discountable items do act as qualifiers for the promotion but they will not receive the discount.

Example : There is an Order Level Promotion say Spend 100$ get 20% Off.

Case 1 : If Order contains only non-discountable SKUs. In this case customer won't get any discount.
Case 2 : If Order contain non-discountable SKUs worth 60$.And discountable SKUs worth 40$.Here customer will get only 8$ discount (20% off 40). Both (discountable and non discountable) SKUs will contribute the amount required to trigger the promotion.

Thursday, 2 October 2014

Indexing As Part of a Deployment

You can configure your environment so that when you run a deployment in Content Administration, indexing is automatically started after the deployment is finished. To make this automatic triggering occur, add the following three components and their configuration to the localconfig layer for your Content Administration server.

  1. /atg/commerce/endeca/index/CategoryToDimensionOutputConfig
      Specify the following property for this component.

      targetName=Production

     2.  /atg/commerce/search/ProductCatalogOutputConfig

      Specify the following property for this component.

      targetName=Production

   3.   /atg/search/SynchronizationInvoker

      Specify the following properties for this component.

      host=atg-production-server-host
      rmi=8860

Saturday, 6 September 2014

Indexing hanged/stucked at CLEANING

After completion of catalog data import into BCC. I triggered the baseline indexing from dyn/admin (/atg/commerce/endeca/index/ProductCatalogSimpleIndexingAdmin). 

After initial steps it hanged at CLEANING step.

The solution to this issue is execute below query on production schema.

truncate table srch_update_queue

Sunday, 31 August 2014

Associating a site with Catalog in ATG

Today while importing the catalog data in BCC. I faced one issue.After completion of data load into BCC I realized that site information is missing from catalog items (category,product and SKUs).

Here is the list of steps I followed from ATG documentation to resolve this issue.


Note : Before following these steps.Run a full deployment fololwoed by Catalog Update Service (This will also create project in BCC.You need to deploy the project). 

Steps to register/create a site and associate it with a catalog.
  1. In the Business Control Center, expand Site Administration, then click Manage Site Assets.
  2. Enter a name and optional description for the project and click Continue.
  3. Create a new site and assign the existing application’s catalog as the default catalog for the new site. During this step, the site ID for the new site is assigned to the existing catalog. The same ID is also assigned to any of the catalog’s categories and sub-catalogs.
  4. At this point, existing catalog folders will appear in Merchandising as unsited items. If you want to keep them, these folders also need a site ID. Follow the steps below to assign a site ID to your catalog folders:
    • In the Business Control Center, expand Merchandising, then click Manage Commerce Assets.
    • Enter a name and optional description for the project and click Continue.
    • Navigate to Site Catalogs, then to Unsited Items.
    • Click the split screen icon at the bottom left of the window.
      BCC Split Screen Icon
      BCC Split Screen Icon
    • In the bottom portion of the split screen, navigate to Site Catalogs.
    • Drag a catalog folder from the top pane to the site you want it affiliated with in the bottom pane. The catalog folder is now affiliated with the site and has that site’s ID assigned to it.
  5. Deploy the project. During deployment, the site ID you assigned to the catalog is propagated from the catalog down to its constituent products and SKUs (by the CatalogMaintenanceService, which runs automatically on deployment).

Saturday, 23 August 2014

Configure Users and Groups in Endeca Workbench

Here are the steps to configure Users and Groups for Endeca Workbench.
  1. Login into to Endeca Workbench as admin user.
  2. On first drop down menu (application selection menu), select Administrative Tools.
  3. Go to User Management section.
  4. Here you will see two tabs.
                 1.  Users
                 2.  Group.

1. User Configuration.

To create user click on Add User link on Users tab.

Workbench Users Tab
Workbench Users Tab
Create User pop up will display.

Create User Pop Up
Create User Pop Up
Enter the user details, here you can associate user with existing group.Then click on permissions tab select the permissions for user.

2. Group Configuration.

To create a group click on click on Group Tab on User Management page.

Now click on Add Groups button on this tab.

Workbench Group Tab
Workbench Group Tab

Create Group pop up will display.Enter the group details,click on permission tab to enter the permissions.Click on membership tab to select a sub group or user.

Group Detail Pop Up
Group Detail Pop Up