OIM Custom Pre Processor Add Email Plugin API


  1. package com.oimacademy.PluginAPIs;
  2. import java.io.Serializable;
  3. import java.util.HashMap;
  4. import oracle.iam.platform.kernel.spi.PreProcessHandler;
  5. import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration;
  6. import oracle.iam.platform.kernel.vo.BulkEventResult;
  7. import oracle.iam.platform.kernel.vo.BulkOrchestration;
  8. import oracle.iam.platform.kernel.vo.EventResult;
  9. import oracle.iam.platform.kernel.vo.Orchestration;
  10. public class CustomPreprocessorAddEmail implements PreProcessHandler {
  11.     public EventResult execute(long processId, long eventId, Orchestration orchestration) {
  12.         HashMap < String, Serializable > orchParameters = orchestration.getParameters();
  13.         System.out.println("Orchestration Process Id  : " + processId);
  14.         System.out.println("Orchestration Event Id : " + eventId);
  15.         String operation = orchestration.getOperation();
  16.         System.out.println("Orchestration Operation : " + operation);
  17.         System.out.println("Orchestration Parameters : " + orchestration.toString());
  18.         String userKey = orchestration.getTarget().getEntityId();
  19.         System.out.println(" user user key will be: " + userKey);
  20.         String email = (String) orchParameters.get("Email");
  21.         String firstName = (String) orchParameters.get("Firstname");
  22.         String lastName = (String) orchParameters.get("Lastname");
  23.         EventResult eResult = new EventResult();
  24.         if ((email == null) || (email.isEmpty())) {
  25.             System.out.println("Email found as Empty.");
  26.             System.out.println("Setting Email to FirstName.LastName");
  27.             orchestration.addParameter("Email", firstName + "." + lastName + "@abc.com");
  28.         }
  29.         return eResult;
  30.     }
  31.     public BulkEventResult execute(long l, long l1, BulkOrchestration bo) {
  32.         throw new UnsupportedOperationException("Not supported yet.");
  33.         }
  34.     public boolean cancel(long l, long l1, AbstractGenericOrchestration ago) {
  35.         return false;
  36.     }
  37.     public void initialize(HashMap < String, String > hm) {}
  38.     public void compensate(long l, long l1, AbstractGenericOrchestration ago) {}
  39. }

No comments:

Post a Comment