Search This Blog

Showing posts with label Adapter. Show all posts
Showing posts with label Adapter. Show all posts

Wednesday, 17 February 2016

Custom Prepopulate Adapter to pre-populate fields on Process Form in OIM 11gR2 PS3

Prepopulate adapters are used to populate the fields on a resource or Process form in Oracle Identity Manager. By having the resource form fields populated by prepopulate adapters, the provisioning process of a resource account to a user can be handled with ease rather than having someone manually enter values for the resource form fields. In Oracle Identity Manager, prepopulate adapters are triggered on the initial assignment of the resource account to a user.


Custom Java Code for PrePopulate Adapters

In the below code we consider and example where we want to Concatenate below 4 fields from User Profile:

1. Postal Address
2. Postal Code
3. Street
4. State

to populate the field Street in Process Form.

package com.prepopulate.custom;

import java.util.logging.Logger;

public class fieldPrePopulate{

        private static final Logger logger = Logger.getLogger("com.prepopulate.custom");
String Space = " ";
        
        public static String StreetAddressGenerator(String PostalAddress, String Street, String PostalCode, String State){
            String StreetAddress = PostalAddress.concat(Space.concat(PostalCode.concat(Space.concat(Street.concat(State)))));
            logger.info("Concatenatedd Street Address: "+StreetAddress);
            return StreetAddress;
        }
}

Similarly you can write your own code to populate certain field on Process Form as per your requirement.

After writing Java methods for your prepopulate adapters, you have to create a JAR file of your Java code, and upload it to OIM as a JavaTasks JAR type (Place the JAR file in $MW_HOME/Oracle_IDM1/server/JavaTasks directory or upload to OIM database using UploadJars.sh script located in $MW_HOME/Oracle_IDM1/server/bin directory. The latter approach is recommended in a production environment).


Creating Adapter


1. Log in to design console. Design console can be started by executing $MW_HOME/Oracle_IDM1/designconsole/xlclient.sh script.


2. On the left panel, expand Development Tools, and select Adapter Factory.



3. Specify Adapter Name, Adapter Type, Description. Then save.



4. On the Variable List sub-tab, add the variables for your adapter as shown in the below screenshots. Typically, these variables are the input to your Java method.


                              Click Add



5. On the Adapter Tasks sub-tab, create a task that calls your Java method.


Click Add




Click Continue

Provide the details like Task Name, API Source and Methods as per screenshot

Map the Input Parameters to the variables created in Variables tab above

Map Output Parameter to Return Variable as shown in Screenshot and then click Save and close the pop-up

Java Task attached to adapter

6. Click Build to compile the adapter. Then save.

Attaching PrePopulate Adapter to Form Field

1. On the left panel of design console, expand Development Tools, and select Form Designer.



2. Select your process form that you will attach the prepopulate adapter to, and create a new version.



Ensure "Latest Version" and "Current Version" are using the version you created.

3. On the Pre-Populate sub-tab, attach your prepopulate adapter to a form field.
Click on Add to Add the PrePopulate Adapter by selecting the Adapter from the list 


 Map the fields in Adapter to User Definition Fields as shown in screenshot


4. Make version active.

Validate PrePopulate Adapter


Assign resource account to a user. After submitting the resource process form instance, the prepopulate adapters should kick in and populate the form fields.

Monday, 27 July 2015

Create a Custom Resource Object in OIM 11gR2

Steps involved in creating a custom Resource Object are as below:

1. Create a Resource Object
2. Create a Process Definition
3. Create a Process Form
4. Create Adapter
5. Create Provision Task
6. Create Revoke Task

Below are the details of the steps to provide an easier understanding of how to proceed with the creation of Resource Object:


1. Create Resource Object
   In Design Console go to Resource Object under Resource Management



   Now fill in the details like Name: Test Resource, Order For User, Type: Application




   Click the save button to create the Resource Object.



2. Create Process Definition

   In Design Console go to Process Definition under Process Management:



       Provide details like Name: Test Resource, Type: Provisioning, Object Name: Test Resource(Created in 1st Step), Table Name: UD_TEMP and click save to create a Process Definition for Resource Object.




   Now if you check in OIM, the resource is available for Provisioning but it will be stucked in Provisioning and then it cannot be revoked as there is no Provisioning or Revoked task present for the Resource.



3. Create Process Form

   In Design Console go to Form Designer under Development Tools:



       Provide the Table Name: UD_TEMP and click search to open the related form and then click on Create New Version, Add the fields that you wish to add and then click Save and then click Make Version Active:


   Process Form is successfully created and activated.

4. Create Adapter
   We will create a simple adapter that will take input and output an output.

   Go to Adapter Factory under Development Tools:


   Provide a name for the Adapter, CopyData in this case, select the Adapter Type as Process Task, provide some description and click Save.



   Now create a Input variable by clicking on Variable List tab and then press add button, provide the required details in the popup as below and then click Save:



   Now go to Adapter Tasks tab and click on CopyData and then press the Add button. Provide the details as below and click Save and close the popup.



   Save the Adapter and click on Build to Compile the Adapter. The compile Status should get updated with OK to mark the successful compilation of the Adapter.

5. Create Provision Task
       Go back to Process Definition under Process Management, open the Test Resource Process Definition created in Step 2. We will create a Provision Task now with name Provision It. In Task tab, click create to create the Task:


   Please make sure that Required for Completion, Allow Cancellation while Pending and Allow Multiple Instances are checked and Conditional is unchecked(very Important). Now click on the Integration tab and Add the adpCopyData Adpater created in the previous step.


   Two variables will popup as below with mapped status as N.


   Map Adapter Return Variable to Response Code and Input to Literal String with Literal Value of OK. Click Save, mapping status for both the variables should get updated as Y:


   Now add a response by going on Responses tab, add a response by clicking Add. Provide Response as OK, since we have mapped the Input to Literal String OK in this case and then select the status C.


   Go to Task to Object Status Mapping tab and search for status C(Completed) and select the Object Status for that as Provisioned:


   Now the resource is ready to be provisioned in OIM with the status being updated to OIM after successful provisioning.

6. Create Revoke Task
   Let's create a Revoke Task now called Revoke It to Revoke the Resource Object. Procedure for creating Revoke task is similar to Provision task, except for the 2 exceptions which we will mention going forward.


   First exception will be to check Conditional here(Very Crucial as the Resource will be Revoked soon after being Provisioned if Revoked is not marked as Conditional: Refer the above Screenshot)

   Save the task and now map C to Revoked in Task to Object Status Mapping as below:


   Now the object can successfully be revoked in OIM.