Search This Blog

Thursday, February 20, 2014

OIM 11gR2 - When to use Platform.getServiceForEventHandlers

Just a quick reminder when creating Event Handlers (not for Scheduled Tasks)

UserManager usrMgr=Platform.getService (UserManager.class);

is used when you need to query for user parameters, such as when an orchestration might change one field, and you need to fill in other fields from the USR table in order to provide some kind of an update.  An example is Display Name, which, if only the Last Name is changed, you will want to retrieve the First and Middle Name fields in order to properly construct the Display Name.

Platform.getServiceForEventHandlers is used when you want to perform any kind of updates within an Event Handler.  Example:

ProvisioningService provSvcUP = Platform.getServiceForEventHandlers(ProvisioningService.class,
    null, "ADMIN","XXXHandler", null);


2 comments:

  1. Hi Ken thanks for sharing information. I have one query my we have passed ADMIN as third parameter which ia contextType as per OIM documentation. And is the same for all other service which we are going to initialize in event handler?

    ReplyDelete
  2. ContextType values are SELF, ADMIN, RECON, POLICY, REQUEST, BULKLOAD, and CERTIFICATION

    I think it might be a good idea to control the context of every service you pull, but I haven't had time to experiment. For now I only use the getServiceForEventHandlers with ADMIN context. I do that only for calls that are updates. Not for reads. For example, you would not use this service for a UserManager.search() call. You need to know which calls are reads and which are updates, that comes with experience.

    ReplyDelete