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);
}
}
}
}