This feature is not available out-of-the-box
Event Handler runs on Modify operation for single event as well as a bulk event like trusted reconciliation.
1 package com.dubey.deepak.iam.oim.event.handler; 2 3 import java.io.Serializable; 4 5 import java.util.HashMap; 6 7 import java.util.Map; 8 9 import java.util.Set; 10 11 import oracle.iam.platform.Platform; 12 13 import oracle.iam.platform.context.ContextAware; 14 15 import oracle.iam.platform.kernel.spi.PostProcessHandler; 16 17 import oracle.iam.platform.kernel.vo.AbstractGenericOrchestration; 18 19 import oracle.iam.platform.kernel.vo.BulkEventResult; 20 21 import oracle.iam.platform.kernel.vo.BulkOrchestration; 22 23 import oracle.iam.platform.kernel.vo.EventResult; 24 25 import oracle.iam.platform.kernel.vo.Orchestration; 26 27 import Thor.API.tcResultSet; 28 29 import Thor.API.Exceptions.tcAPIException; 30 31 import Thor.API.Operations.tcUserOperationsIntf; 32 33 public class ChangeDisplayName implements PostProcessHandler { 34 35 public EventResult execute(long processId, long eventId, 36 37 Orchestration orchestration) { 38 39 System.out 40 41 .println("Entering EventResult of ChangeDisplayName"); 42 43 System.out.println("orchestration.getOperation() ->" 44 45 + orchestration.getOperation()); 46 47 String userKey = orchestration.getTarget().getEntityId(); 48 49 System.out.println("userKey ->" + userKey); 50 51 HashMap<String, Serializable> orchParams = orchestration 52 53 .getParameters(); 54 55 Set<String> paramSet = orchParams.keySet(); 56 57 String firstName = null; 58 59 String lastName = null; 60 61 for (String key : paramSet) { 62 63 Serializable serializable = orchParams.get(key); 64 65 if (key.equalsIgnoreCase("First Name")) { 66 67 firstName = serializable.toString(); 68 69 System.out.println("fname ->" + firstName); 70 71 changeDisplayName(userKey, firstName, lastName); 72 73 } 74 75 if (key.equalsIgnoreCase("Last Name")) { 76 77 lastName = serializable.toString(); 78 79 System.out.println("lname ->" + lastName); 80 81 changeDisplayName(userKey, firstName, lastName); 82 83 } 84 85 } 86 87 System.out 88 89 .println("Exiting EventResult of ChangeDisplayName"); 90 91 return new EventResult(); 92 93 } 94 95 private String changeDisplayName(String userKey, String firstName, 96 97 String lastName) { 98 99 String response = null; 100 101 Map<String, String> phAttributeList = new HashMap<String, String>(); 102 103 phAttributeList.put("Users.Key", userKey); 104 105 tcResultSet resultSet = null; 106 107 try { 108 109 tcUserOperationsIntf tcUserOp = ((tcUserOperationsIntf) Platform 110 111 .getService(tcUserOperationsIntf.class)); 112 113 resultSet = tcUserOp.findUsers(phAttributeList); 114 115 int count = 0; 116 117 count = resultSet.getRowCount(); 118 119 System.out.println("count ->" + count); 120 121 122 123 for (int i = 0; i < count; i++) { 124 125 resultSet.goToRow(i); 126 127 if (firstName == null) { 128 129 firstName = resultSet.getStringValue("Users.First Name"); 130 131 } 132 133 if (lastName == null) { 134 135 lastName = resultSet.getStringValue("Users.Last Name"); 136 137 } 138 139 String displayName = firstName + " " + lastName; 140 141 Map<String, String> updateUser = new HashMap<String, String>(); 142 143 updateUser.put("Users.Display Name", displayName); 144 145 tcUserOp.updateUser(resultSet, updateUser); 146 147 } 148 149 tcUserOp.close(); 150 151 } catch (tcAPIException e) { 152 153 e.printStackTrace(); 154 155 } catch (Exception e) { 156 157 e.printStackTrace(); 158 159 } 160 161 return response; 162 163 } 164 165 public BulkEventResult execute(long l, long l1, 166 167 BulkOrchestration bulkOrchestration) { 168 169 System.out 170 171 .println("Entering BulkEventResult of ChangeDisplayName"); 172 173 System.out.println("bulkOrchestration.getOperation()--->" 174 175 + bulkOrchestration.getOperation()); 176 177 String userKey = bulkOrchestration.getTarget().getEntityId(); 178 179 System.out.println("userKey ->" + userKey); 180 181 if (bulkOrchestration.getOperation().equalsIgnoreCase("MODIFY")) { 182 183 System.out.println("Operation is MODIFY"); 184 185 HashMap<String, Serializable>[] bulkParams = bulkOrchestration 186 187 .getBulkParameters(); 188 189 for (HashMap<String, Serializable> bulkParam : bulkParams) { 190 191 Set<String> bulkKeySet = bulkParam.keySet(); 192 193 String firstName = null; 194 195 String lastName = null; 196 197 for (String key : bulkKeySet) { 198 199 Serializable serializable = bulkParam.get(key); 200 201 if (key.equalsIgnoreCase("First Name")) { 202 203 firstName = serializable.toString(); 204 205 System.out.println("fname ->" + firstName); 206 207 } 208 209 if (key.equalsIgnoreCase("Last Name")) { 210 211 lastName = serializable.toString(); 212 213 System.out.println("lname ->" + lastName); 214 215 } 216 217 } 218 219 String response = changeDisplayName(userKey, firstName, 220 221 lastName); 222 223 System.out.println("response ->" + response); 224 225 } 226 227 } 228 229 System.out 230 231 .println("Exiting BulkEventResult of ChangeDisplayName "); 232 233 return new BulkEventResult(); 234 235 } 236 237 public void compensate(long l, long l1, 238 239 AbstractGenericOrchestration abstractGenericOrchestration) { 240 241 } 242 243 public boolean cancel(long l, long l1, 244 245 AbstractGenericOrchestration abstractGenericOrchestration) { 246 247 return false; 248 249 } 250 251 public void initialize(HashMap<String, String> hashMap) { 252 253 } 254 255 private String getParameterValue(HashMap<String, Serializable> parameters, 256 257 String key) { 258 259 String value = (parameters.get(key) instanceof ContextAware) ? (String) ((ContextAware) parameters 260 261 .get(key)).getObjectValue() 262 263 : (String) parameters.get(key); 264 265 return value; 266 267 } 268 269 private boolean isNullOrEmpty(String str) { 270 271 return str == null || str.isEmpty(); 272 273 } 274 275 } 276 277 |
Plugin.xml
<?xml version="1.0" encoding="UTF-8"?>
<oimplugins>
<plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
<plugin pluginclass=
"com.dubey.deepak.iam.oim.event.handler.ChangeDisplayName"
version="1.0"
name="ChangeDisplayName">
</plugin>
<oimplugins>
<plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
<plugin pluginclass=
"com.dubey.deepak.iam.oim.event.handler.ChangeDisplayName"
version="1.0"
name="ChangeDisplayName">
</plugin>
</plugins>
</oimplugins>
</oimplugins>
Go to OIM_HOME/plugin_utility/ to register the plugin
ant -f pluginregistration.xml register
Package the plugin in a zip file for it to be registered correctly.