Thursday, February 5, 2015

Oracle OIM - Retrieve Organization info

   From Oracle Developer-Works got some code sample to collect act_key using organization name. By playing with Eclipse Debugging Mode, I realized that we can send any partial info of Organization in search Hashtable and collect complete set of Organization info. 

 In my case, I need have to collect 'act_key' from 'Organization Name'. Here is altered sample code!

Hashtable<String, Object> orgHash = new Hashtable<String, Object>(); 
orgHash.put("Organizations.Organization Name", orgName); 
long orgKey = 0;
try {
  //Connection might be established with OIM at this point
  tcOrganizationOperationsIntf orgIntf = Platform.getService(tcOrganizationOperationsIntf.class);
  tcResultSet orgSet = orgIntf.findOrganizations(orgHash);
  orgKey = orgSet.getLongValue("Organizations.Key");
} catch (Exception e) {
  e.printStackTrace();
  logger.error("Caught Exception when collecting Organization key for " + orgName + ": " + e);
}

return orgKey;

No comments:

Post a Comment