OIM Custom Pre Processor Add Email Plugin API


package PluginAPIs;

import java.io.Serializable;
import java.util.HashMap;

import oracle.iam.platform.kernel.spi.PreProcessHandler;
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 CustomPreprocessorAddEmail implements PreProcessHandler {
    public EventResult execute(long processId, long eventId, Orchestration orchestration) {
        HashMap < String, Serializable > orchParameters = orchestration.getParameters();
        System.out.println("Orchestration Process Id  : " + processId);
        System.out.println("Orchestration Event Id : " + eventId);
        String operation = orchestration.getOperation();
        System.out.println("Orchestration Operation : " + operation);
        System.out.println("Orchestration Parameters : " + orchestration.toString());
        String userKey = orchestration.getTarget().getEntityId();
        System.out.println(" user user key will be: " + userKey);
        String email = (String) orchParameters.get("Email");
        String firstName = (String) orchParameters.get("Firstname");
        String lastName = (String) orchParameters.get("Lastname");
        EventResult eResult = new EventResult();
        if ((email == null) || (email.isEmpty())) {
            System.out.println("Email found as Empty.");
            System.out.println("Setting Email to FirstName.LastName");
            orchestration.addParameter("Email", firstName + "." + lastName + "@abc.com");

        }
        return eResult;
    }

    public BulkEventResult execute(long l, long l1, BulkOrchestration bo) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public boolean cancel(long l, long l1, AbstractGenericOrchestration ago) {
        return false;
    }

    public void initialize(HashMap < String, String > hm) {}

    public void compensate(long l, long l1, AbstractGenericOrchestration ago) {}
}

No comments:

Post a Comment

About OIM

Oracle Identity Management enables organizations to effectively manage the end - to - end life - cycle of user ide...

Popular Posts