Wednesday 10 April 2019

OIM Certification - Modify Composite to have all the Closed Loop Remediation(CLR) Requests to be Auto-Approved.


Login to SOA Composer(http://<HOST_NAME>:8001/soa/composer) using weblogic credential.


Click on “Open Rules” as shown in below screenshot.


Open “DefaultRequestApproval” composite.


Click on “Edit”.


Expand “Ruleset1” and change “stageType” (challenge to auto) as shown in below screen shot.





Now expand “Ruleset2” and change “stageType” (challenge to auto)







Commit changes.




Happy Learning!!!

Thursday 4 April 2019

OIM - How to Add User Defined Field(UDF) in Certification Line Item Page?


Login to the Identity Console through sysadmin user and then click on “Sandboxes”.


Click on “Create Sandbox”.


Provide sandbox name and then click  “Save and Close”.



Click on “Certification” tile.


Open certification and click on Customize.


Go to Structure Tab.


Select User Login.


Select table as highlighted in below screen shot.


Click on add component icon.


Go to Data Component - Certification as shown in below.


Open “UserCertificatiionUserVO1”.


Scroll down and find JobCode and then add that attribute as ADF Table Column.


Select JobCode and click on cut icon.


Scroll right and select last column then click on “Paste After” as highlighted in below screen shot.


Close this window.


Export Sandbox and then publish it.

Added Successfully. 


Saturday 30 March 2019

OIM - Unable to Load Lookup Data in Design Console Due to Large Record.

Open xlclient.cmd and add below line.

-Dweblogic.MaxMessageSize=50000000 ^
 

OIM API - Get Comma Separated Member's UserLogin for Given Role in Java Embedding.


java.sql.PreparedStatement ps = null;
java.sql.ResultSet rs = null;
java.sql.Connection connection = null;                                                                                                                              
javax.sql.DataSource datasource = null;                
String dataSourceName = "jdbc/operationsDB";
String roleName = "TestRole";

String sqlQuery = "select RTRIM(XMLAGG(XMLELEMENT(E,usr.usr_login,'|').EXTRACT('//text()') ORDER BY usr.usr_login).GetClobVal(),'|') AS MEMBERS from UGP,USG,USR where USG.UGP_KEY = UGP.UGP_KEY AND USG.USR_KEY = USR.USR_KEY AND UGP_NAME = '" + roleName + "'";   

try{   
    addAuditTrailEntry( "****** Get comma separated member's user login for role *******"); 
 
    javax.naming.InitialContext initialcontext = new javax.naming.InitialContext();     
    datasource = (javax.sql.DataSource) initialcontext.lookup(dataSourceName);     
                
    if(null != datasource){     
        connection = datasource.getConnection(); 
 
        ps = connection.prepareStatement(sqlQuery);    
        rs = ps.executeQuery();   

        while(rs.next()){   
            System.out.println("Role Members : " + rs.getString("MEMBERS")); 
            addAuditTrailEntry("Role Members : " + rs.getString("MEMBERS"));  
        }    
    }else{ 
        System.out.println("Error while getting datasource from JNDI"); 
    }    
}catch(Exception e){    
    System.out.println("********Error******"); 
    System.out.println("Exception : " + e.getMessage());    
    addAuditTrailEntry("Exception : " + e.getMessage());
}finally{ 
    if (rs != null) { 
            try { 
                    rs.close(); 
                    rs = null; 
            } catch (java.sql.SQLException e) { 
                    System.out.println("Exception while closing ResultSet : " + e.getMessage()); 
            } 
    } 

    if (ps != null) { 
            try { 
                    ps.close(); 
                    ps = null; 
            } catch (java.sql.SQLException e) { 
                    System.out.println("Exception while closing PreparedStatement : " + e.getMessage()); 
            } 
    } 

    if (connection != null) { 
            try { 
                    connection.close(); 
                    connection = null; 
            } catch (java.sql.SQLException e) { 
                    System.out.println("Exception while closing Connection : " + e.getMessage()); 
            } 
    } 
}



SOA - Custom Solution for Escalating Request to Group after Specified duration.

Open ApprovalProcess.bpel file and do below configuration.



Set expiry for existing human task.



Add one more switch condition for EXPIRED outcome in existing human task.




Add new human task for group.




Configure assignment to group for newly created human task.



In value set role name.



Happy Learning!!!

Thursday 14 March 2019

OIM API - How to Remove Data From Child Form?

public void removeDataFromChildForm(long processInstanceKey) throws Exception {
String childTableName = "UD_LDAP_ROL";//child table name 
String columnName = "UD_LDAP_ROL_ROLE_NAME";//column name 
String columnValue = "TestRole";//role name which you want to delete
String childTablePrimaryKey = childTableName + "_KEY";

tcFormInstanceOperationsIntf formInstanceOperationsIntf = Platform.getService(Thor.API.Operations.tcFormInstanceOperationsIntf.class);

long processFormDefinitionKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processInstanceKey);
int processParentFormVersion = formInstanceOperationsIntf.getProcessFormVersion(processInstanceKey);
tcResultSet childFormDef = formInstanceOperationsIntf.getChildFormDefinition(processFormDefinitionKey,processParentFormVersion);

for(int k = 0; k < childFormDef.getRowCount(); k++){
childFormDef.goToRow(k);
String childFrmName = childFormDef.getStringValue("Structure Utility.Table Name");
if(childFrmName.equalsIgnoreCase(childTableName)){
long childKey = childFormDef.getLongValue("Structure Utility.Child Tables.Child Key");
tcResultSet childData = formInstanceOperationsIntf.getProcessFormChildData(childKey, processInstanceKey);

for (int i = 0; i < childData.getRowCount(); i++) {
childData.goToRow(i);
String roleName = childData.getStringValue(columnName);

if (roleName.equals(columnValue)) {
long rowKey = childData.getLongValue(childTablePrimaryKey);
formInstanceOperationsIntf.removeProcessFormChildData(childKey, rowKey);
System.out.println("Removed successfully!!!");
}
}
}
}
 }

Monday 11 March 2019

OIM API - How to Add Data in Child Form?

public void addDataInChildForm(long processInstanceKey) throws Exception {
    String childTableName = "UD_LDAP_ROL"; //child table name 
    String columnName = "UD_LDAP_ROL_ROLE_NAME"; //column name
    String columnValue = "TestRole"; //column value 
    
    tcFormInstanceOperationsIntf formInstanceOperationsIntf = Platform.getService(Thor.API.Operations.tcFormInstanceOperationsIntf.class);
    
  long processFormDefinitionKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processInstanceKey);
int processParentFormVersion = formInstanceOperationsIntf.getProcessFormVersion(processInstanceKey);

tcResultSet childFormDefinition = formInstanceOperationsIntf.getChildFormDefinition(processFormDefinitionKey,processParentFormVersion);

for(int i = 0; i < childFormDefinition.getRowCount(); i++){
childFormDefinition.goToRow(i);
String childFrmName = childFormDefinition.getStringValue("Structure Utility.Table Name");

if(childFrmName.equalsIgnoreCase(childTableName)){
long childKey = childFormDefinition.getLongValue("Structure Utility.Child Tables.Child Key");

HashMap addAttr = new HashMap();
addAttr.put(columnName, columnValue);

formInstanceOperationsIntf.addProcessFormChildData(childKey, processInstanceKey, addAttr);
System.out.println("Added successfully!!!");
}
}
 }

OIM API - How to Read Child Form Data?

public void readChildFormData(long processInstanceKey) throws Exception{
String childTableName = "UD_LDAP_ROL"; //child table name
String childTableColumnName = "UD_LDAP_ROL_ROLE_NAME";//column name

tcFormInstanceOperationsIntf formInstanceOperationsIntf = Platform.getService(Thor.API.Operations.tcFormInstanceOperationsIntf.class);
 
long processFormDefinitionKey = formInstanceOperationsIntf.getProcessFormDefinitionKey(processInstanceKey);
int processParentFormVersion = formInstanceOperationsIntf.getActiveVersion(processFormDefinitionKey);
 
tcResultSet resultGetChildFormDefinition = formInstanceOperationsIntf.getChildFormDefinition(processFormDefinitionKey, processParentFormVersion);

for(int j = 0; j < resultGetChildFormDefinition.getRowCount(); j++){
resultGetChildFormDefinition.goToRow(j);
 
long childFormKey = resultGetChildFormDefinition.getLongValue("Structure Utility.Child Tables.Child Key");
int version = resultGetChildFormDefinition.getIntValue("Structure Utility.Child Tables.Child Version");
String childFrmName = resultGetChildFormDefinition.getStringValue("Structure Utility.Table Name");
 
System.out.println("**********************************");
System.out.println("Child Form Key :: " + childFormKey);
System.out.println("Child Form Name :: " + childFrmName);
System.out.println("Active Form Version :: " + version);
System.out.println("**********************************");
 
if(childFrmName.equalsIgnoreCase(childTableName)){
tcResultSet childData = formInstanceOperationsIntf.getProcessFormChildData(childFormKey, processInstanceKey);
 
for(int k = 0; k < childData.getRowCount(); k++){
childData.goToRow(k);
String value = childData.getStringValue(childTableColumnName);
System.out.println(value);
}
}
}
}

Monday 18 February 2019

OIM API - How to Update Account Process Form Data using ProvisioningService API?

public void modifyAccountProcessFormData() throws Exception {
String userKey = "117507"; //Replace User Key
String resObjName = "LDAP User"; //Replace Resource Object Name
Account userActiveAccount = null;

ProvisioningService provisioningService = Platform.getService(ProvisioningService.class);

SearchCriteria criteria =  new SearchCriteria(ProvisioningConstants.AccountSearchAttribute.OBJ_NAME.getId(), resObjName, SearchCriteria.Operator.EQUAL);
    List<Account> accounts = provisioningService.getAccountsProvisionedToUser(userKey, criteria, null, true);
     
    for(Account account : accounts) {
        String accountStatus = account.getAccountStatus();
         
        if(ProvisioningConstants.ObjectStatus.PROVISIONED.getId().equals(accountStatus) || 
        ProvisioningConstants.ObjectStatus.ENABLED.getId().equals(accountStatus) || 
        ProvisioningConstants.ObjectStatus.DISABLED.getId().equals(accountStatus)){
        userActiveAccount = account;
        break;
        }
    }
    
    if(null != userActiveAccount){
    //Add attributes which need to be modified
        HashMap<String, Object> modParentFrmDataMap = new HashMap<String, Object>();
        modParentFrmDataMap.put("UD_LDAP_USR_FIRST_NAME", "Anand");
        modParentFrmDataMap.put("UD_LDAP_USR_LAST_NAME", "Badal");
   
    String accountId  = userActiveAccount.getAccountID();
        String processFormInstanceKey = userActiveAccount.getProcessInstanceKey();
        Account modAccount = new Account(accountId, processFormInstanceKey, userKey);

        String parentFormKey = userActiveAccount.getAccountData().getFormKey();
        String udTablePrimaryKey = userActiveAccount.getAccountData().getUdTablePrimaryKey();
        AccountData accountData = new AccountData(parentFormKey, udTablePrimaryKey , modParentFrmDataMap);
         
        modAccount.setAccountData(accountData);
        modAccount.setAppInstance(userActiveAccount.getAppInstance());

        provisioningService.modify(modAccount);
        System.out.println("Process form data successfully updated!!!");
    }
}

Wednesday 13 February 2019

OIM API - How to get Database Connection through Data Source Name in Standalone Code?

public Connection getDBConnection(){
    Connection conn = null;
    javax.sql.DataSource ds = null;
    Hashtable env = new Hashtable();

    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, "t3://<REPLACE_HOST_NAME>:14000");

    try {
          Context context = new InitialContext(env);
          ds = (javax.sql.DataSource) context.lookup("jdbc/operationsDB");
          System.out.println("Successfully looked up OIM datasource");

          if(null != ds) {
              conn = ds.getConnection();
              System.out.println("Successfully obtained OIM database connection");
          }
}catch (Exception e) {
System.out.println("Exception is : " + e.getMessage());
}
return conn;
}


Monday 21 January 2019

OIM - How to Create Prepopulate Adapter for Generating Full Name(Concatenating two Strings) through Utility Task?


Login to design console and open adapter factory.

Provide required details as highlighted in below screenshot.


Create two adapter variables - "firstName and lastName" 





Create new adapter task for concatenating first name and space .


Select Utility Task and continue.


Continue...


Select below details and then save it:

API Name - java.lang.String
Constructor - public java.lang.String(java.lang.String)
Method - public java.lang.String concat(java.lang.String)

Variable Mappings:
Constructor Input  => First Name
Method Input => " "
Method Output => Return Variable


Now first task has been created.

Select first utility task and then create new task for concatenating output of first task and last name.


Select Utility Task then continue.


Continue...


Select below details and then save it:

API Name - java.lang.String
Constructor - public java.lang.String(java.lang.String)
Method - public java.lang.String concat(java.lang.String)

Variable Mappings:
Constructor Input  => Output of first task
Method Input => Last Name
Method Output => Return Variable


Build adapter.


Now we can use this adapter for generating full name.


Happy Learning!!!

OIM API - Get RoleCategory Details through RoleCategory Name.


public RoleCategory getRoleCategoryDetails(String roleCategoryName) {
final String logp = CLASS_NAME + " #getRoleCategoryDetails - ";
LOGGER.info(logp + "START");
RoleCategory roleCategory = null;
try {
RoleCategoryManager roleCategoryManager = Platform.getService(RoleCategoryManager.class);

List<RoleCategory> list = roleCategoryManager.search(new SearchCriteria(RoleManagerConstants.RoleCategoryAttributeName.NAME.getId(), roleCategoryName, SearchCriteria.Operator.EQUAL),
null, null);

if (list.size() == 1) {
roleCategory = list.get(0);
LOGGER.info("Category Name :: " + roleCategory.getName());
LOGGER.info("Category Description :: " + roleCategory.getDescription());
}
} catch (AccessDeniedException e) {
e.printStackTrace();
} catch (RoleCategorySearchException e) {
e.printStackTrace();
}
LOGGER.info(logp + "END");
return roleCategory;
}

Thursday 10 January 2019

OIM - How to Clone OOTB Disconnected SOA Composite?

Login to OIM linux machine and go to below location:

$MW_HOME/Oracle_IDM1/server/workflows/composites




Download DisconnectedProvisioning.zip to your local machine.


Unzip it.





Open JDeveloper and Create new Application.


Provide Application Name.


Leave same project name and click on Finish.


Import OOTB Disconnected Composite as "SOA Archive into SOA Project". 

Follow below steps:

Select newly created Application.


Go to File and click on Import.


Select "SOA Archive Into SOA Project".


Provide Project Name. 


Browse and select OOTB Disconnected SOA Composite.



Change Composite Name "DisconnectedProvisioning" to some other name.


Click on Finish.


Delete "Project1" which was created with Application.




Open "Composite.xml".


Go to source.


Search for below tag and change serviceName from "DefaultManualProvADFService" to some other name and save it.

<binding.adf registryName="registryName" serviceName="DefaultManualProvADFService" />




Open "ManualProvisioningTask.task" and go to source.


Search for below tag and change "ManualProvisioningTask" to some other name and save it.

<taskDefinition targetNamespace="http://xmlns.oracle.com/DefaultProvisioningComposite/DisconnectedProvisioning/ManualProvisioningTask




We have done all configuration changes, now we can deploy newly created composite on server. 

Follow below steps for deployment:

Right click on Project and then click on deploy.


Select "Deploy to SAR"


Click Next.


Click Finish.


Jar will be created on location : <APPLICATION_NAME>/<PROJECT_NAME>/Deploy folder.


Login to EM Console(http://<HOST_NAME>:7001/em) with weblogic credential. 


Select composite jar.




Select Partition "default" and then click Next.


Click Deploy.


New Disconnected Composite is deployed successfully, now we can use it in process task.


Change Composite Name in Adapter Mapping for all below highlighted Process Task.





Happy Learning!!!