Thursday, April 19, 2018

Form Handlers

ATG Form Handler is a java class which extends class atg.droplet.GenericFormHandlerFormHandler needs to define at least one handleXXX() method e.g. handleAddCustomer(), handleUpdateCustomer(). Along with this, component with $class=<yourclass_withpackage> needs to be defined. On frontend part, this handle method is triggered when corresponding handler submit button is clicked or form is submitted.

To get value from input boxes or anyother input option, we can define members with same name given in <dsp:input> tag in the formhandler having getters and setters.

Our handler method handleXXX() will contain the logic for validating data and processing. If any validation errors are present, same can be added to formExceptions vector which gets inherited from GenericFormHandler Based on result of processing, we can redirect to appropriate success URL or error URL.

Below is example of form handler class:

class TestFormHandler extends atg.droplet.GenericFormHandler{
    private String name;
    public void setName(String name){ this.name=name; }
    public String getName(){ return this.name; }

    public boolean handleAddData(DynamoHttpServletRequest request, DynamoHttpServletResponse response)
    {
        /*Logic for validation and processing*/
        response.sendLocalRedirect(“successURL”, pRequest);
        return true;
    }
}






Thursday, July 23, 2015

Oracle ATG Controller Framework


  •  Introduction to Servlet Pipeline

            Oracle ATG Controller Framework is used to handle how HTTP requests are processed. Basically, It performs tasks like session tracking, page compilation etc. Controller includes series of separable servlets which has its own individual task, so called as Servlet Pipeline.
    This series of steps is dependent very much on sequence in which servlets are placed because of the information flow of request. Each servlet processes the request and may have input to next servlet.
    • Request Processing by Servlet Pipeline

    While processing a request in ATG, every step or task is a Nucleus component which implements Servlet interface. It is organized in linked list kind of data structure and is called a request-handling pipeline.
    Whenever request comes to the pipeline it is handled by the pipeline in a component oriented manner i.e. by having servlets as independent elements.
    ATG Provides Out of the Box pipeline to handle request which is used to process each request to application. It is started by a Page filter and requests which are coming to Nucleus are dispatched to PageFilter or DynamoProxyServlet. And it then follows the order of servlets in series.
    Here, each of these servlets perform their function on the request. Also, servlet is configured with a reference to the next servlet in pipeline. So, when a first servlet is processed on the request, it will pass the request to the next servlet and so on.
    ATG also provides flexibility of customizing the pipeline through components. These components are configurable and use Out of the Box provisions to execute in sequential manner.

    Below is the example of ATG Out of the Box Pipeline.

    • Example with Out of the Box Pipeline
      Dynamo Servlet Pipeline
    • How to customize Servlet Pipeline
    Every servlet in pipeline implement atg.servlet.pipeline.PipelineableServlet interface. 
    When we implement PipelineableServlet, it inherits a nextServlet property. This property is used to point to the next servlet component to invoke. 
    The pipeline components created should be scoped as global. Also, they need to be configured into pipeline.
    PipelineableServlet interface has two subinterfaces.  These two types provide additional features for determining the next component to invoke.
    1. InsertableServlet 

    This interface has a property called insertAfterServlet to enable the servlet to insert itself in a specific position in the pipeline. This mechanism is useful when you donot want to change or modify existing pipeline configurations and insert silently.
    Example: MyApp.java

    package com.myapp;

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import atg.servlet.*;
    import atg.servlet.pipeline.*;
    public class MyServllet extends InsertableServletImpl {

    public MyServlet () {}

    public void service (DynamoHttpServletRequest request,DynamoHttpServletResponse response)throws IOException, ServletException {
    System.out.println ("Inside MyServlet with request " +request.getRequestURI ());
    passRequest (request, response);
    }
    }

    MyServlet.properties
    $class=com.myapp.MyServlet
    insertAfterServlet=/atg/dynamo/servlet/pipeline/DynamoServlet

    Here, MyServlet will be inserted after DynamoServlet


    2. DispatcherPipelineableServlet 

    This interface provide a mechanism to create branches of servlets using some condition.
    It is possible with dispatcherServiceMap property of this class, which is a map of servlets based on condition.
    Out of the box MimeTypeDispatcher servlet is used to determine which servlet needs to be invoked based on the MIME type of the request.

    Tuesday, July 14, 2015

    BCC 11.1 Customization: Adding New item descriptor

    Whenever you create a new item descriptor or a repository which can be modified by Merchandiser, it should be present in BCC in order to add, modify and delete items.

    As part of ATG 11.1 version, Oracle has provided simple steps to view newly created item-descriptor in BCC Flex UI.

    Let us assume, we have created new item descriptor called contentItem in /atg/commerce/catalog/ProductCatalog repository.
    (Modified /config/atg/commerce/catalog/custom/customCatalog.xml).

    To add a new content item in BCC 11.1 follow below steps :

    1. Adding to Content Browse Hierarchy

    Location:    <your_module>\config\atg\remote\content\browse\ContentBrowseHierarchy.xml

    This will be used to view your item in content browser.

    Add below code for contentItem

    <?xml version="1.0" encoding="ISO-8859-1" ?>

    <browse-hierarchy xml-combine="append">

      <browse-item id="home" xml-combine="append">

        <browse-item reference-id="contentItemDetails"/>
      </browse-item>

    <browse-item id="contentItemDetails" label-resource="node.styles.label.contentItem"  is-root="true" >
        <list-definition id="contentItemDetailsId" retriever="query" child-type="/atg/commerce/catalog/ProductCatalog:contentItem">
    <retriever-parameter name="query"  value="ALL" />
        </list-definition>
      </browse-item>

    </browse-hierarchy>

    Here, node.styles.label.contentItem is an property for Label to display in BCC.

    You need to create new properties file in your source directory say, com.yourapp.web.resources.RepositoryTemplateResources.properties

    To Configure this properties file as resource bundle referred by BCC, create a file below with same name and path:
    <your_module>\config\atg\remote\assetmanager\MultiBundleFormatter.properties

    and provide contents as:

    bundlePaths+=\
         com.yourapp.web.resources.RepositoryTemplateResources

    You may add any number of resource bundle values in this property file. But, it is best practice to create separate file for each repository, so that it can be managed separately.

    2. Adding to Content Find Configuration

    Location: <your_module>\config\atg\remote\content\find\ContentFindConfiguration.xml

    This will be used to display newly create item-descriptor in find tab.

    Add below contents in xml file for find configuration;

    <?xml version="1.0" encoding="UTF-8"?>

    <find-configuration site-filtering="true" xml-combine="append">

    <asset-family id="contentItem" site-filtering="false">
        <display-name>Content Item</display-name>
        <enable-default-query>true</enable-default-query>
        <enable-filter-as-you-type>true</enable-filter-as-you-type>
        <result-list page-size="500"/>
        <default-asset-type>contentItem</default-asset-type>
        <asset-type  id="finish" site-filtering="false">
          <enable-default-query>true</enable-default-query>
          <enable-filter-as-you-type>true</enable-filter-as-you-type>
          <repository-path>/atg/commerce/catalog/ProductCatalog</repository-path>
          <repository-item-type>contentItem</repository-item-type>
        </asset-type>
    </asset-family>

     </find-configuration>

    3. Add to Content Tool bar

    Location: <your_module>\config\atg\remote\content\toolbar\ContentToolbar.xml

    This will be used to display control buttons in toolbar while you are navigating through browse item.
    Buttons like add, edit, delete, move, duplicate etc. can be controlled through this xml.

    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <toolbar xml-combine="append">

    <operation-menu id="contentItemMenu">
    <toolbar-scope asset-area="contentItem" pane-id="browse"/>
    <operation-menu-item id="edit" />
    <operation-menu-item id="move"/>
    <operation-menu-item divider="true" />
    <operation-menu-item id="duplicate" />
    <operation-menu-item id="delete" />
    <operation-menu-item divider="true" />
    <operation-menu-item id="addToProject" />
    <operation-menu-item id="export" />
    </operation-menu>

    </toolbar>



    ATG 11.0 Installation with Cim, MySql, Jboss and Endeca

    Prerequisites:
    1. ATG11.0 and Endeca Installed on system
    2. MySQL service is running with default Databases created
    3. JBoss6.1 is downloaded and extracted

    Click on below link to get the doc:

    https://drive.google.com/file/d/0BxgfTUo4XwVBWXhpbG51UnUxX28/view?usp=sharing

    Sunday, April 5, 2015

    Oracle ATG Commerce Overview

    Oracle ATG Commerce Overview 

    Oracle ATG Commerce provides the platform to build and manage the B2C and B2B websites.

    • Oracle ATG B2C Commerce
      • Product Catalog 
        • Catalog contains hierarchical structure for maintaining Products/SKUs in navigable manner. The Root node is Catalog Folder. Catalog Folder can have child elements, called Catalog. From ATG 10 version onwards ATG has added Site Based catalogs. A catalog may belong to one or more Sites and these sites may point to a single catalog. This structure provides easier way to implement multisite functionality.
        • Further, Catalog may have root categories, categories and subcategories which are of type category item descriptor in terms of product catalog repository. These categories are associated with each other just like a tree or graph like data structure. The relationship between these categories is populated whenever deployment happens on product catalog. This can also be invoked through Oracle ATG Dynamo Administration Console a.k.a. Dyn/Admin. This will populate ancestor categories, parent catalog etc. properties for a category, as well as sub-elements like Product, SKU. 
        • Category or subcategory can have Products. Products are entities which are the units to be displayed on site. Product may contain multiple SKUs (Stock Keeping Units). Customer buys SKUs which have specific properties of Product, like Color, Size, Quantity etc.
      • Profile 
        • Oracle ATG commerce provides OTB profile management module. Profile is required to maintain user data. Profile is associated with user session. User information like Name, Login Information, Shipping and Billing Addresses, Payment Methods, Order Information, Active as well as used Discount or Promotion Information, Purchase History etc.
        • Profile is also used while processing order as well as fulfillment process. 
      • Shopping Cart and Checkout 
        • Shopping Cart is an Order in incomplete state. It contains SKU items which are added by user to bag or cart. It also holds orders for multiple sites in multisite environment. Shopping cart feature allows user to manage items he wants to purchase, like view/change quantity, see/apply discounts or promotions information, in stock/ out of stock information, item information of SKU.
        • In checkout process, Order undergoes few changes like shipping information, billing information, payment information, confirmation. This process is controlled by different formhandlers and commerce pipeline which provides full control of customization of checkout process to developers. Once order is placed it goes to fulfillment system for further processing.

    • Oracle ATG Business Commerce (B2B)
      • B2B Payment methods
        • These are B2B features to provide functionality specific to Business like purchase orders, requisitions.
      • Account-specific product catalogs
        • In B2B there is a need to maintain product catalog at Business Account level i.e. a company may provide customized catalog items to its dealers or distributors. It gives more flexibility in B2B model. 
      • Multiple shipping and billing address
        • B2B features also provide user to have multiple shipping and billing addresses. This information can be maintained by multiple user accounts belonging to same dealer. Profile here is maintained in organized manner, like Organization, Role etc.
     

    Thursday, May 29, 2014

    Oracle ATG Core Components

    Oracle ATG Core Components

      Oracle ATG has the following core components as part of OTB(Out Of The Box) framework. Detailed description about these components follows.
    • DAF Dynamo Application Framework - which consists of following main ingredients.
      • Nucleus
        • Nucleus is the central registry for all java components ATG requires. It is a servlet which loads on server startup and responsible for initializing java objects based on supported properties files. It keeps track of these objects using path of directory from /config. Example. If we have MySampleService.properties file located at com/myapp/ location in config directory, it will be represented by /com/myapp/MySampleService component. This component will be initialized by nucleus using properties specified in file MySampleService.properties.
        • Whenever nucleus gets a reference to an component, it searches for that .properties file in registry, it then finds class name mentioned in the properties file with $class   property and reads all properties which needs to be initialized. It then creates instance of that class and tags it with the path name. 
        • Components can be of different type, they exist in nucleus for that point of time. Example. Global components live till object is not destroyed by nucleus, i.e. till server is not shut down. Similarly, session scoped components are alive till session expired, they are tagged with unique session identification number. GenericSessionManager component holds all session references.
      • Repositories
        • Repository in ATG is data anywhere architecture. It lets you define the structure of data at logical level, i.e. independent of underlying database. It provides wide range of API to deal with different types of data. Also, it has very good caching mechanism OTB and provided APIs for integrating third party caching mechanisms like Oracle Coherence.
        • Repository data in ATG is mainly distinguished in versioned and non-versioned data. Catalog, pricing, promotions is an example of versioned and Order, Profile of non-versioned. Versioned repositories are maintained in BCC and business users are required to change data accordingly.
        • Also, if required, you can add your custom repositories and its easy to configure according to needs.
      • Tag Libraries
        • ATG supports JSP and contains two tag libraries JSTL and DSP. JSTL is well known in J2EE world. However, DSP tag library is designed  to access all data types in ATG’s Nucleus framework.
        • One of the enhancements DSP tags has is its support for the passing of object parameters between pages. It is advised that use DSP tags wherever ATG related operations are and otherwise use JSTL for normal web page operations.
    • DPS ATG Personalization Module
      • ATG Provides personalization as part of its framework. It has very good personalization engine which targets content to specific set of users as basic requirement in personalization. It provides Targeters, Content Groups, Profile or User segments, Scenarios, Slots. All in together give users personalized experience.
      • Content groups have content which we want to show. It may contain, repository item, media item, or file asset etc.
      • Profile or User segments have the set of users defined by a condition. For example, all users between age 25 to 35.
      • Targeter does the job of targeting or joining content group and user segments. In targeter different rules can be specified to show different contents to different users. 
      • Note that, Content Groups, User Segments and Targeters are managed through BCC by business users.
    • DSS ATG Scenarios Module
      • Scenarios and slots are an extension to targeting capabilities of the Personalization framework. Scenarios can be used to manage advanced conditions based on events and actions.
      • We can think of scenario as a set of chained operations performed in manner of event followed by specific actions.
      • Example, if we want an user to send promotional emails after used visits the site and doesn't come back in certain time.
    These basic components may provide a platform for an ecommerce application with ATG framework..Keep watching this space.

    Monday, May 19, 2014

    This blog is about my understanding and study of ATG. I will be writing my observations about various topics such as Commerce, Profile Management, Content Administration, Checkout, Search etc.

    Your suggestions / comments are welcome and will help improve my knowledge.

    -Ashish Kulkarni.