Thursday, 31 May 2012

Code to get the processInstanceKey of a resource provisioned to a user

private long getProcessInstKeyOfRes(String res_Name,long userkey) {
long longProcessInstanceKey = 0;
try{
tcResultSet resultGetObjects = moUserUtility.getObjects(userkey);
int countResultGetObjects = resultGetObjects.getRowCount();
for(int i = 0; i < countResultGetObjects; i++) {
resultGetObjects.goToRow(i);
String objetcName = resultGetObjects.getStringValue("Objects.Name");
System.out.println("---------Object name"+objetcName);
if(res_Name.equalsIgnoreCase(objetcName)) {
String status = resultGetObjects.getStringValue("Objects.Object Status.Status");
status = status.toLowerCase();
System.out.println(status);
longProcessInstanceKey = resultGetObjects.getLongValue("Process Instance.Key");
System.out.println("Process Instance Key"+ longProcessInstanceKey);
}
}

}catch (Exception e) {
}
return longProcessInstanceKey;
}

No comments:

Post a Comment