sion

Oracle Fusion Middleware : Oracle Identity and Access Management Suite 10g/11gR1/11gR2PS1,PS2,PS3 : OIM | OAM,OAAM,OIF | OID, OVD, DIP | OUD/ ODSEE | Microsft AD | OpenLDAP | ADF | EBS R12 | OECMCCR4 | Business Intelleigence - Bi Publisher | Banking | Demo Applications | Core Java | SQL | PLSQL | Web services | Weblogic | Tomcat | JBoss | OHS | WebGate | WebCenter | In any Queries please Contact Me : info@oratechsoft.com

Search This Blog

Monday, 20 March 2017

Sample OIM EventHandler



Test1.java

package com.ots.oracle.eventhandlers;

import java.util.HashMap;
import oracle.core.ojdl.logging.ODLLogger;
import oracle.core.ojdl.logging.ODLLevel;
import oracle.iam.platform.kernel.spi.PostProcessHandler;
import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration;
import oracle.iam.platform.kernel.vo.BulkEventResult;
import oracle.iam.platform.kernel.vo.BulkOrchestration;
import oracle.iam.platform.kernel.vo.EventResult;
import oracle.iam.platform.kernel.vo.Orchestration;

public class Test1 implements PostProcessHandler{
   
    private static ODLLogger logger = ODLLogger.getODLLogger(Test1.class.getName());

    public Test1() {
        super();
    }
   
    private void enter(String method) {
        logger.log(ODLLevel.FINE, "Entering  " + method + " of class " + Test1.class.getName());
    }

    private void exit(String method) {
        logger.log(ODLLevel.FINE, "Exiting  " + method + " of class " + Test1.class.getName());
    }


    public EventResult execute(long processId, long eventId, Orchestration orchestration) {
        String method = Thread.currentThread().getStackTrace()[1].getMethodName();
        enter(method);
       
        String sOperation = orchestration.getOperation();
        logger.log(ODLLevel.FINE, "sOperation --> " + sOperation);
       
        HashMap hmParameters = orchestration.getParameters();
        logger.log(ODLLevel.FINE, "hmParameters --> " + hmParameters);
       
        HashMap hmInterParameters = orchestration.getInterEventData();
        logger.log(ODLLevel.FINE, "hmInterParameters --> " + hmInterParameters);
       
        exit(method);
        return new EventResult();
    }

    public BulkEventResult execute(long processId, long eventId, BulkOrchestration bulkOrchestration) {
        String method = Thread.currentThread().getStackTrace()[1].getMethodName();
        enter(method);
       
        String sOperation = bulkOrchestration.getOperation();
        logger.log(ODLLevel.FINE, "sOperation --> " + sOperation);
       
        HashMap[] hmBulkParameters = bulkOrchestration.getBulkParameters();
        for (HashMap hmBulkParameter : hmBulkParameters) {
            logger.log(ODLLevel.FINE, "hmBulkParameter --> " + hmBulkParameter);
        }
       
        HashMap hmInterParameters = bulkOrchestration.getInterEventData();
        logger.log(ODLLevel.FINE, "hmInterParameters --> " + hmInterParameters);
       
        exit(method);
        return new BulkEventResult();
    }

    public void compensate(long processId, long eventId, AbstractGenericOrchestration abstractGenericOrchestration) {
        String method = Thread.currentThread().getStackTrace()[1].getMethodName();
        enter(method);
       
        String sOperation = abstractGenericOrchestration.getOperation();
        logger.log(ODLLevel.FINE, "sOperation --> " + sOperation);
       
        HashMap hmParameters = abstractGenericOrchestration.getParameters();
        logger.log(ODLLevel.FINE, "hmParameters --> " + hmParameters);
       
        exit(method);
    }

    public boolean cancel(long processId, long eventId, AbstractGenericOrchestration abstractGenericOrchestration) {
        String method = Thread.currentThread().getStackTrace()[1].getMethodName();
        enter(method);
       
        String sOperation = abstractGenericOrchestration.getOperation();
        logger.log(ODLLevel.FINE, "sOperation --> " + sOperation);
       
        HashMap hmParameters = abstractGenericOrchestration.getParameters();
        logger.log(ODLLevel.FINE, "hmParameters --> " + hmParameters);
       
        exit(method);
        return false;
    }

    public void initialize(HashMap<String, String> hashMap) {
        String method = Thread.currentThread().getStackTrace()[1].getMethodName();
        enter(method);
       
        logger.log(ODLLevel.FINE, "hashMap --> " + hashMap);
       
        exit(method);
    }
}



EventHandler.xml 

<?xml version="1.0" encoding="UTF-8" ?>
<eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
<action-handler class="com.ots.oracle.eventhandlers.Test1"
    entity-type="User" operation="CREATE"
    name="Test1"
    stage="postprocess"
    order="9999999"
    sync="TRUE" />
</eventhandlers>



plugin.xml


<?xml version="1.0" encoding="UTF-8" ?>
<oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
 <plugin pluginclass="com.ots.oracle.eventhandlers.Test1" version="1.0" name="Test1">
 </plugin>
</plugins>
</oimplugins>



Thanks & Regards
Lakshmi Prasad Reddy N

No comments:

Post a Comment