Description: Shows how to use the Oracle Identity Manager API to create reconciliation events. Below are screen shots of the end results of running the sample code given in this post on DBAT 11.1.1.5.0 connector.
![]() |
Reconciliation Event Created by OIM API |
![]() |
Reconciliation Data |
![]() |
Resource History of Reconciled Account |
![]() |
Reconciliation Field Names to use in API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blogspot.oraclestack.utilities; | |
import Thor.API.Exceptions.tcAPIException; | |
import java.util.Date; | |
import java.util.HashMap; | |
import oracle.core.ojdl.logging.ODLLevel; | |
import oracle.core.ojdl.logging.ODLLogger; | |
import oracle.iam.platform.OIMClient; | |
import oracle.iam.reconciliation.api.ChangeType; | |
import oracle.iam.reconciliation.api.EventAttributes; | |
import oracle.iam.reconciliation.api.ReconOperationsService; | |
/** | |
* Utilities to create reconciliation events in OIM. | |
* @author rayedchan | |
*/ | |
public class ReconciliationEvents | |
{ | |
// Logger | |
private ODLLogger logger = ODLLogger.getODLLogger(ReconciliationEvents.class.getName()); | |
// OIM Services | |
private final ReconOperationsService reconOps; | |
/** | |
* Constructor | |
* @param oimClient OIM Client | |
*/ | |
public ReconciliationEvents(OIMClient oimClient) | |
{ | |
this.reconOps = oimClient.getService(ReconOperationsService.class); | |
} | |
/** | |
* Creates a reconciliation event and processes the event. | |
* This method only handles parent data on the reconciliation event. | |
* @param resourceObjName Name of the Resource Object | |
* @param reconFieldData Map of the reconciliation field data | |
* @throws tcAPIException | |
*/ | |
public void makeReconciliationEvent(String resourceObjName, HashMap<String,Object> reconFieldData) throws tcAPIException | |
{ | |
logger.log(ODLLevel.NOTIFICATION, "Enter makeReconciliationEvent() with parameters: Resource Object Name = [{0}], Reconciliation Data = [{1}]", new Object[]{resourceObjName, reconFieldData}); | |
// Setup Event Attributes | |
EventAttributes evtAttrs = new EventAttributes(); | |
evtAttrs.setEventFinished(true); // Child is not going to be provided; Event will be in "Data Recieved" state | |
evtAttrs.setActionDate(new Date()); // Use current date | |
evtAttrs.setActionDate(null); // Processing is done instantly; no defering date | |
evtAttrs.setChangeType(ChangeType.REGULAR); // For create and modify operations | |
// Call OIM API to create reconciliation event | |
long reconEventKey = this.reconOps.createReconciliationEvent(resourceObjName, reconFieldData, evtAttrs); | |
logger.log(ODLLevel.NOTIFICATION, "Reconciliation Event Key = [{0}]", new Object[]{reconEventKey}); | |
// Call OIM API to process reconciliation event (apply action and matching rules, and link to appropriate user, org, or process instance) | |
this.reconOps.processReconciliationEvent(reconEventKey); | |
logger.log(ODLLevel.NOTIFICATION, "Processed Recon Event."); | |
// Close Event | |
// this.reconOps.closeReconciliationEvent(reconEventKey); | |
// logger.log(ODLLevel.NOTIFICATION, "Closed event."); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.blogspot.oraclestack.testdriver; | |
import com.blogspot.oraclestack.utilities.ReconciliationEvents; | |
import java.util.HashMap; | |
import java.util.Hashtable; | |
import oracle.iam.platform.OIMClient; | |
/** | |
* Test driver for ReconciliationEvents class. | |
* @author rayedchan | |
*/ | |
public class ReconciliationEventsTestDriver | |
{ | |
// Adjust constant variables according to you OIM environment | |
public static final String OIM_HOSTNAME = "localhost"; | |
public static final String OIM_PORT = "14000"; // For SSL, use 14001; For non-SSL, use 14000 | |
public static final String OIM_PROVIDER_URL = "t3://"+ OIM_HOSTNAME + ":" + OIM_PORT; // For SSL, use t3s protocol; For non-SSL, use t3 protocol | |
public static final String AUTHWL_PATH = "lib/config/authwl.conf"; | |
public static final String APPSERVER_TYPE = "wls"; | |
public static final String FACTORY_INITIAL_TYPE = "weblogic.jndi.WLInitialContextFactory"; | |
public static final String OIM_ADMIN_USERNAME = "xelsysadm"; | |
public static final String OIM_ADMIN_PASSWORD = "Password1"; | |
// Adjust input | |
public static final String INPUT_RESOURCE_OBJECT = "DBAT User"; | |
public static final String INPUT_IT_RESOURCE = "DBAT"; | |
public static void main(String[] args) throws Exception | |
{ | |
OIMClient oimClient = null; | |
try | |
{ | |
// Set system properties required for OIMClient | |
System.setProperty("java.security.auth.login.config", AUTHWL_PATH); | |
System.setProperty("APPSERVER_TYPE", APPSERVER_TYPE); | |
// Create an instance of OIMClient with OIM environment information | |
Hashtable<String, String> env = new Hashtable<String, String>(); | |
env.put(OIMClient.JAVA_NAMING_FACTORY_INITIAL, FACTORY_INITIAL_TYPE); | |
env.put(OIMClient.JAVA_NAMING_PROVIDER_URL, OIM_PROVIDER_URL); | |
// Establish an OIM Client | |
oimClient = new OIMClient(env); | |
// Login to OIM with System Administrator Credentials | |
oimClient.login(OIM_ADMIN_USERNAME, OIM_ADMIN_PASSWORD.toCharArray()); | |
// Test reconciliation event utility | |
ReconciliationEvents reconEvtUtil = new ReconciliationEvents(oimClient); | |
// Stage reconciliation data; maps to reconciliation field on resource object | |
HashMap<String,Object> reconData = new HashMap<String,Object>(); // Key = Recon Field Name, Value = data | |
reconData.put("Unique Id", "DDUMA"); // __UID__ attribute | |
reconData.put("User Id", "DDUMA"); // __NAME__ attribute | |
reconData.put("Status", "Enabled"); // __ENABLE__ | |
reconData.put("IT Resource Name", INPUT_IT_RESOURCE); | |
reconData.put("Middle Name", "D"); | |
// Create a reconciliation event and process it | |
reconEvtUtil.makeReconciliationEvent(INPUT_RESOURCE_OBJECT, reconData); | |
} | |
finally | |
{ | |
if( oimClient != null) | |
{ | |
oimClient.logout(); | |
} | |
} | |
} | |
} |
No comments:
Post a Comment