Wednesday 5 November 2014

Pipeline Customization in ATG


Pipeline is a collection of processors which executes sequentially.

 Step 1 : Updated commercepipeline.xml to add new processor class

 Step 2 : Here we are injecting the new processor class as the sepcond processor in the updateOrder chain.
 Step 3 :we have to Register the new processor as a nucleus component.



 Step 4 :we have to create Custom Processor class that should be an implementation of PipelineProcessor
 Step 5 :Restart your ATG  Server.

Explanation :
OOTB : \config\atg\commerce\commercepipeline.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <pipelinemanager>
       <pipelinechain name="updateOrder" transaction="TX_REQUIRED" headlink="updateOrderObject">
        <pipelinelink name="updateOrderObject" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveOrderObject"/>
            <transition returnvalue="1" link="updateCommerceItemObjects"/>
        </pipelinelink>

        <pipelinelink name="updateCommerceItemObjects" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveCommerceItemObjects"/>
            <transition returnvalue="1" link="updateShippingGroupObjects"/>
        </pipelinelink>
..........
   </pipelinemanager>
 
 
Step 1 and Step2 :Customization/Configuration:
   <pipelinemanager>
       <pipelinechain name="updateOrder" transaction="TX_REQUIRED" headlink="updateOrderObject">
        <pipelinelink name="updateOrderObject" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveOrderObject"/>
            <transition returnvalue="1" link="checkInventoryObject"/>
        </pipelinelink>

<pipelinelink name="checkInventoryObject" transaction="TX_MANDATORY">
            <processor jndi="/inventory/processor/ProcCheckInventory"/>
            <transition returnvalue="1" link="updateCommerceItemObjects"/>
       </pipelinelink>

        <pipelinelink name="updateCommerceItemObjects" transaction="TX_MANDATORY">
            <processor jndi="/atg/commerce/order/processor/SaveCommerceItemObjects"/>
            <transition returnvalue="1" link="updateShippingGroupObjects"/>
        </pipelinelink>
...........
   </pipelinemanager>
 
Step3 : ProcCheckInventory.properties(/inventory/processor/ProcCheckInventory)
        $class=/info/atgblog/inventory/processor/ProcCheckInventory

Step4 :ProcCheckInventory.java

        public class ProcCheckInventory extends ApplicationLoggingImpl implements PipelineProcessor {

          public int[] getRetCodes() {
       return new int{1,2};
        }
  public int runProcess(final Object pParam, final PipelineResult pResult)
throws Exception {
// check inventory and return the status accordingly
return 1;
   }
       }




No comments:

Post a Comment