5 Replies Latest reply: Apr 20, 2013 11:55 PM by kavatam RSS

    Pre-poluate AD Groups child form during provisioning OIM 11.1.2

    kavatam
      Hi All,

      In my case when a user is created, AD User role is being assigned which will provision AD resource.

      In AD process form am able to auto-populate "Organization" field using pre-populate adapter.

      Now I wanted to auto-populate AD groups child form as well.

      How to do achieve this?
      Method 1: Using Entity Adapater
           or
      Method 2: Create a process task adapter, attach it to a new process task and trigger this process task on success completion of 'Create User' process task.

      Also, I came to know that we shud use "tcFormInstanceOperationsIntf". Could give a sample code, showing sequence of steps to populate child form data.

      Thanks in Advance.
        • 1. Re: Pre-poluate AD Groups child form during provisioning OIM 11.1.2
          Kevin Pinsky
          You cannot pre-populate, but you can use the option you listed of triggering a task after Create User which will add these entries into the child table. Here is some code I have in place that adds an entry to the child table:

          >
          public String addChildTableEntry(long processInstanceKey, String childTable, String field, String value){
          System.out.println("addChildTableEntry Parameters:processInstanceKey[" + processInstanceKey + "]childTable[" + childTable + "]field[" + field + "]value[" + value + "]");
          String response = "VALUE_NOT_ADDED";
          tcResultSet set = null;
          try {
          int formActiveVersion = 0;
          long formDefKey = 0;

          formDefKey = formIntf.getProcessFormDefinitionKey(processInstanceKey);
          System.out.println("formDefKey[" + formDefKey + "]");

          formActiveVersion = formIntf.getActiveVersion(formDefKey);
          System.out.println("formActiveVersion[" + formActiveVersion + "]");

          tcResultSet childSet = formIntf.getChildFormDefinition(formDefKey, formActiveVersion);
          long childFormDefKey = 0;
          CHILDTABLES: for (int i=0;i<childSet.getTotalRowCount();i++){
          childSet.goToRow(i);
          if (childSet.getStringValue("Structure Utility.Table Name").equalsIgnoreCase(childTable)) {
          childFormDefKey = childSet.getLongValue("Structure Utility.Child Tables.Child Key");
          System.out.println("childFormDefKey[" + childFormDefKey + "]");
          break CHILDTABLES;
          }
          }

          if (childFormDefKey!=0){
          Map<String, String> map = new HashMap<String, String>();
          map.put(field, value);
          System.out.println("map[" + map + "]");
          long newKey = formIntf.addProcessFormChildData(childFormDefKey, processInstanceKey, map);
          System.out.println(newKey);
          response = "VALUE_ADDED";
          }else{
          System.out.println( "No child tables found for instance");
          response = "CHILD_TABLE_NOT_FOUND";
          }

          } catch (tcProcessNotFoundException e) {
          System.out.println("Error adding child table entry:tcProcessNotFoundException:" + e.getMessage());
          } catch (tcFormNotFoundException e) {
          System.out.println("Error adding child table entry:tcFormNotFoundException:" + e.getMessage());
          } catch (tcRequiredDataMissingException e) {
          System.out.println("Error adding child table entry:tcRequiredDataMissingException:" + e.getMessage());
          } catch (tcInvalidValueException e) {
          System.out.println("Error adding child table entry:tcInvalidValueException:" + e.getMessage());
          } catch (tcNotAtomicProcessException e) {
          System.out.println("Error adding child table entry:tcNotAtomicProcessException:" + e.getMessage());
          } catch (tcAPIException e) {
          System.out.println("Error adding child table entry:tcAPIException:" + e.getMessage());
          if (e.getMessage().toString().equalsIgnoreCase("The entered form data already exists."))
          response = "ENTRY_ALREADY_EXISTS";
          } catch (tcColumnNotFoundException e) {
          System.out.println("Error adding child table entry:tcColumnNotFoundException:" + e.getMessage());
          } catch (tcVersionNotDefinedException e) {
          System.out.println("Error adding child table entry:tcVersionNotDefinedException:" + e.getMessage());
          }

          System.out.println("addChildTableEntry response[" + response + "]");
          return response;
          }
          >

          -Kevin
          • 2. Re: Pre-poluate AD Groups child form during provisioning OIM 11.1.2
            kavatam
            Hi Kevin,

            I created process task adapter as addChildTableEntry(long processInstanceKey, String childTable). So, there will two input parameters to be mapped when we add task from Adapter Task.

            So I created two varibles in variable List tab.
            1) "String varchildTable" and mapped it as input variable in Java Task.
            2) "Long processID" . The problem is am not able map it input variable in Java Task.


            Even though it is not mapped, it is compiled and Adapter status is OK.

            After that created a process task 'populate AD group'. Added the adapter created in the integration tab. I got 3 variables to be mapped
            1. Adapter return variable - mapped to Response code
            2. childTable - mapped to a literal (for time being)
            3. processID -
            which value it shud be mapped?? a) process data -> process Instance or b)process data -> AD Group child table -> process Instance


            Please help me in configuring this process task.

            Thanks in advance.
            • 3. Re: Pre-poluate AD Groups child form during provisioning OIM 11.1.2
              Rajiv Dewan
              I didn't look at your previous post.

              I'll suggest you to go through basic stuff (OIM Documentation) before you start implementation.

              So I created two varibles in variable List tab.
              1) "String varchildTable" and mapped it as input variable in Java Task.
              2) "Long processID" . The problem is am not able map it input variable in Java Task.

              Even though it is not mapped, it is compiled and Adapter status is OK.


              NO Worry about that. Consider a scenario that you have a Java Method with three variables but in your code you don't use 1 variable. There won't be any problem in your code. It will get compiled properly.





              After that created a process task 'populate AD group'. Added the adapter created in the integration tab. I got 3 variables to be mapped
              1. Adapter return variable - mapped to Response code
              2. childTable - mapped to a literal (for time being)
              3. processID -
              which value it shud be mapped?? a) process data -> process Instance or b)process data -> AD Group child table -> process Instance
              • 4. Re: Pre-poluate AD Groups child form during provisioning OIM 11.1.2
                kavatam
                Hi,

                Thanks for the replies......

                I have mapped all the variables properly in integration tab of Process task.

                Here is sample code which takes process instance key and a string childTableName to which am passing UD_ADUSRC.
                I am not adding any childform data, but wanted to display all childform details. so, written a for loop to display the same and added logger statements. I am not able to c the logger statements in logs.


                Below is my exact code
                ----------------------

                public class populateADGroupsChildTable
                {

                public String ADaddChildTableEntry(Long processID,String childTableName)
                {
                ODLLogger logger = ODLLogger.getODLLogger("postEventHandler");
                logger.info("Inside populateADGroupsChildTable:ADaddChildTableEntry()");
                logger.info("" + processID);

                String response="NOT_FOUND";

                try
                {
                tcFormInstanceOperationsIntf ADformInstance = Platform.getService(tcFormInstanceOperationsIntf.class);

                Long ProcessFormDefKey = ADformInstance.getProcessFormDefinitionKey(processID);
                int ProcessFormVersion = ADformInstance.getProcessFormVersion(processID);

                tcResultSet ChildFormDef = ADformInstance.getChildFormDefinition(ProcessFormDefKey,ProcessFormVersion);

                int childFormCount = ChildFormDef.getTotalRowCount();
                int testchildFormCount = ChildFormDef.getRowCount();
                logger.info("getTotalRowcount() - Row count Child Form = "+ childFormCount);
                logger.info("getRowCount() - Row count Child Form = "+ testchildFormCount);

                Long childFormDefKey;
                Long childFormVersion;

                for(int i=0;i<childFormCount;i++)
                {
                String Tablename = childFormDef.getStringValue("Structure Utility.Table Name");
                childFormDefKey = childFormDef.getLongValue("Structure Utility.Child Tables.Child Key");
                     //childFormVersion = childFormDef.getLongValue("Structure Utility.Child Tables.Version");
                logger.info("Child Table Name = " + Tablename);
                logger.info("Child Key = " + childFormDefKey);

                response="FOUND";
                }
                Catch() //HANDLED ALL EXCEPTIONS, IN POST NOT MENTIONED
                {
                }

                return response;

                }


                }




                Found in logs [Confirmed that my Adapter code is being invoked...]
                -------------------
                [SRC_METHOD: debug] Class/Method: tcAdpEvent/updateSchItem - Data: event - Value: adpPOPULATEADGROUPS
                [2013-04-19T17:03:04.430+05:30] [oim_server1] [TRACE] [] [XELLERATE.ADAPTERS] [tid: [ACTIVE].ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 0000JsTicb4EgKWFLzUKOA1HS0vu000002,0] [SRC_CLASS: com.thortech.util.logging.Logger] [APP: oim#11.1.2.0.0] [SRC_METHOD: debug] Class/Method: tcAdpEvent/updateSchItem - Data: New Status - Value: R
                [2013-04-19T17:03:04.431+05:30] [oim_server1] [TRACE] [] [XELLERATE.ADAPTERS] [tid: [ACTIVE].ExecuteThread: '7' for queue: 'weblogic.kernel.Default (self-tuning)'] [userId: oiminternal] [ecid: 0000JsTicb4EgKWFLzUKOA1HS0vu000002,0] [SRC_CLASS: com.thortech.util.logging.Logger] [APP: oim#11.1.2.0.0] [SRC_METHOD: debug] Class/Method: tcAdpEvent/updateSchItem - Data: SchData - Value: wrong number of arguments


                What could be the reason for "SchData - Value: wrong number of arguments"..

                I have added multiple logger statements, but none is getting displayed in logs. Could you tell me how to display the custom logger statements from a custom adapter.

                I would sincerely appreciate the solutions...

                Edited by: kavatam on Apr 19, 2013 7:20 AM
                • 5. Re: Pre-poluate AD Groups child form during provisioning OIM 11.1.2
                  kavatam
                  Hi experts.... please provide solution...