1 2 Previous Next 26 Replies Latest reply: May 15, 2013 9:06 AM by 965440 RSS

    Post Process event handler not executed.

    965440
      Hi,
      I have written a post process event handler on Create operation. but it is not getting executed. OIM Version: 11.1.1.5
      My objective is to fetch company code field from user form after creation, check for company name field in lookup and set company name field for the newly created user.

      below is my code in execute method:
      HashMap<String, Object> atrrMap= new HashMap<String, Object>();
                try {
                     String CompanyNamefromLookup =null;
                     String userKey = getUserKey(processId, bulkOrch);
                     Hashtable<String, Object> mhSearchCriteria2 = new Hashtable<String, Object>();
                     mhSearchCriteria2.put("Users.Key", userKey);
                     tcUserOperationsIntf userOperationsintf = (tcUserOperationsIntf)Platform.getService(tcUserOperationsIntf.class);
                     tcResultSet result = userOperationsintf.findUsers(mhSearchCriteria2);
                     printtcResultset(result);
                     String userType = result.getStringValue("Role");
                     String operation = bulkOrch.getOperation();
                     String companyCode = result.getStringValue("USR_UDF_COMPANY_CODE");
                     if (operation.equals(Operations.CREATE.toString())){
                          if (!(companyCode.isEmpty())) {
                                    CompanyNamefromLookup = getDecodeValueFromLookup(companyCode,"Lookup.ExternalUser.Company");
                                    if(!(CompanyNamefromLookup.isEmpty())){
                                         atrrMap.put("Company Name", CompanyNamefromLookup);
                                         userOperationsintf.updateUser(result, atrrMap);
                               }
                          }
                     }
                }
                catch(Exception e)
                {

                }

                return new EventResult();
           }

      here is EventHandler.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <eventhandlers xmlns="http://www.oracle.com/schema/oim/platform/kernel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.oracle.com/schema/oim/platform/kernel orchestration-handlers.xsd">
      <!-- Custom pOSTprocess event handlers -->
      <action-handler
      class="com.oim.eventhandler.ExternalUserPostProcessEventHandler"
      entity-type="User"
      operation="CREATE"
      name="ExternalUserPostProcessEventHandler"
      stage="postprocess"
      order="1000"
      sync="TRUE"/>
      </eventhandlers>

      It is not working at all..Also added logger to check whether this method is executed or not but no success.
      Please help me out.
        • 1. Re: Post Process event handler not executed.
          deepikas
          Do you have any other post process event handler running at the same order? If yes try changing the order of execution.
          • 2. Re: Post Process event handler not executed.
            965440
            Hi Deepika,

            No we do not have any other post process event handler running with this order.
            • 3. Re: Post Process event handler not executed.
              BikashBagaria
              1. How about the plugin registration? Did it register successfully? Check the PLUGINS table and verify that your event handler is listed there.
              2. Paste the plugin.xml contents.
              3. How are you testing? If you implemented the execute method then test by creating through UI and if you have implemented the bulk execute method then check by trusted recon.

              -Bikash
              • 4. Re: Post Process event handler not executed.
                965440
                Hi Bikash, Thanks for your reply.

                1. The plugin is registered successfully. It is listed in PLUGINS table.
                Also I hv written few SOP in initialize method. They are executed when oim server starts.

                2. Here is plugin.xml

                <?xml version="1.0" encoding="UTF-8"?>
                <oimplugins xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
                <plugins pluginpoint="oracle.iam.platform.kernel.spi.EventHandler">
                <plugin pluginclass= "com.oim.eventhandler.ExternalUserPostProcessEventHandler"
                version="1.0"
                name="ExternalUserPostProcessEventHandler">
                </plugin>
                </plugins>
                </oimplugins>

                3. I have implemented EventResult execute() method. I tested through UI. After user creattion, event handler doesnt execute. There is no single entry in log.

                Regards.
                • 5. Re: Post Process event handler not executed.
                  965440
                  Please help.
                  • 6. Re: Post Process event handler not executed.
                    Kevin Pinsky
                    You aren't outputting any error message in your catch statement. Try some debug statements right below the execute method or even in the constructor to say something like 'STARTING EVENTHANDLER...."

                    At this this will tell you if it's running and you can watch the oim_server1.out log file to see the System.out.println messages.

                    Update-----------

                    You really need to be using the 11g apis, and i couldn't stand seeing how you were doing it. Use this code and tell me how it works:

                    {quote}
                    private final static Logger LOGGER = Logger.getLogger(Test.class.getName().toUpperCase());
                    public EventResult execute(long l, long l2, Orchestration orchestration) {
                    String operation = orchestration.getOperation().trim().toString();
                    HashMap<String, Serializable> parameters = orchestration.getParameters();
                    String entityId = orchestration.getTarget().getEntityId();
                    HashMap eventDataHashMap = orchestration.getInterEventData();
                    Identity currentUserState = (Identity) eventDataHashMap.get("CURRENT_USER");

                    LOGGER.log(Level.INFO,"Starting Operation[" + operation + "] Entity[" + orchestration.getTarget().getEntityId() + "] Paramters[" + parameters.toString() + "] EventResult");

                    try{
                    UserManager userMgr = Platform.getService(UserManager.class);
                    Thor.API.Operations.tcLookupOperationsIntf lookupIntf = Platform.getService(Thor.API.Operations.tcLookupOperationsIntf.class);

                    User user = userMgr.getDetails(entityId, null, false);
                    String userType = currentUserState.getAttributes().get(UserManagerConstants.AttributeName.EMPTYPE.getId()).toString();
                    String companyCode = currentUserState.getAttributes().get("Company Code").toString();

                    if (operation.equals("CREATE")){
                    if (!(companyCode.isEmpty())) {
                    String companyNamefromLookup = lookupIntf.getDecodedValueForEncodedValue(companyCode,"Lookup.ExternalUser.Company");
                    User updateUser = new User(entityId);
                    updateUser.setAttribute("Company Name", companyNamefromLookup);
                    userMgr.modify(updateUser);
                    }
                    }

                    }catch(Exception e){
                    LOGGER.log(Level.WARNING,"ERROR Processing Post Create| ------> " + e.getMessage(), e);
                    }

                    LOGGER.log(Level.INFO, "Ending Operation[" + operation + "] EventResult");

                    return new EventResult();
                    }
                    {quote}

                    -Kevin
                    • 7. Re: Post Process event handler not executed.
                      A Dhiman
                      Please check if the plugin is properly registered in MDS.
                      note OIM accepts the following folders for the event handlers in MDS
                      /db
                      /metadata and few more.

                      register the eventhandler into one of these folders in MDS
                      • 8. Re: Post Process event handler not executed.
                        965440
                        Hi Kevin,

                        Thanks for your reply.
                        Actually I am new to OIM, so I am facing such issues.

                        I entered few SOPs in constructor of class. They are not displayed in log file when we create a user.

                        And about the code that u hv given, it can only be checked if this method get executed.

                        Thanks & Regards,
                        Aparna
                        • 9. Re: Post Process event handler not executed.
                          965440
                          Hi Dhiman,

                          Following happens
                          Plugin registration is successful.I can see the initialize() being called during OIM start. SOP in initialize gets printed

                          Following fails
                          The event handler doesn't get triggered as the SOP messages during the execute() are not getting printed.
                          "" <Warning> <oracle.iam.callbacks.common> <IAM-2030146> <[CALLBACKMSG] Are applicable policies present for this async eventhandler ? : false>
                          "" This is all what I see in logs.

                          Is there any problem in EvenetHandler xml file or plugin xml??

                          Thanks & Regards,
                          Aparna
                          • 10. Re: Post Process event handler not executed.
                            965440
                            Hi Kevin,

                            I was just checking out the entry of event handlers in database.. came across a table evt which defines event handlers by providing a process and class name. In addition the scheduling time of when the event handler can execute is set to pre (insert, update, delete) or post (insert, update, delete) is also mentioned.

                            When i run that command it doesn't show this event handler. Instead, all other event handlers are listed there.
                            I think the problem lies with Eventhandler xml file. Checked its namespace also but didn't find anything..

                            Please help.
                            Thanks & Regards,
                            Aparna
                            • 11. Re: Post Process event handler not executed.
                              Kevin Pinsky
                              You can put a SOP in the Constructor and if the plugin is registered, it will output there.

                              public UserPostProcessor() {
                              super();
                              System.out.println("PLUGIN IS RUNNING");
                              }

                              -Kevin
                              • 12. Re: Post Process event handler not executed.
                                A Dhiman
                                The files look good
                                also, can you please let us know to which location have you imported this metadata.xml using the weblogicImportMetadata.sh

                                i have encountered the issue when i imported the xml into /custom/xml.xml location

                                after putting this in /metadata.xml.xml or /db/xml.xml it started working

                                Edited by: A Dhiman on May 3, 2013 7:50 AM
                                • 13. Re: Post Process event handler not executed.
                                  Kevin Pinsky
                                  To add to Alok's with the custom folder, i agree. Don't create a new top level folder. I like to do something liek this:

                                  /db/<CLIENT>/EventHandlers/EventHandler.xml
                                  /db/<CLIENT>/RequestTemplates/Provision...xml

                                  I create a custom folder within DB with the client name and then have my own structure of files. This way i never have to mess with the existing for any of my custom work.

                                  -Kevin
                                  • 14. Re: Post Process event handler not executed.
                                    965440
                                    Hi Kevin/Alok,

                                    The plugin is registered successfully, I can see SOPs of constructor displayed as output. but no SOPs from execute() method.

                                    I have placed EventHandler xml in db/ folder.

                                    Complete path : /iam/ml_home/OIM/MDS/postprocess/ExternalUserPostProcessEventHandler/eventhandler/db/ExternalUserPostProcessEventHandler.xml

                                    Following is weblogic.properties:


                                    wls_servername=oim_server1

                                    application_name=OIMMetadata

                                    metadata_from_loc=/iam/ml_home/OIM/MDS/postprocess/ExternalUserPostProcessEventHandler/eventhandler

                                    metadata_to_loc=/iam/ml_home/OIM/MDS/postprocess/

                                    metadata_files=/db/ExternalUserPostProcessEventHandler.xml


                                    Also, I want to ask one thing: Is it mandatory to keep post process event handler asynchronous??

                                    Thanks & Regards,
                                    Aparna
                                    1 2 Previous Next