Wednesday, 13 February 2013

Getting OIM Form Details

public void getFormDetails(String userID, String resName) {
  HashMap map = new HashMap();
  System.out.println("Getting Proc Inst Key");
  long processInstKey = 0;
  ArrayList getlist = getProcessInstKeyOfResources(resName,
    getUserKey(userID));
  try {
   Iterator<Long> procinstKey = getlist.iterator();
   while (procinstKey.hasNext()) {
    long prockey = procinstKey.next();
    System.out.println("Keys--->" + prockey);
    tcResultSet resultset = moform.getProcessFormData(prockey);
    String[] values = resultset.getColumnNames();
    for (String name : values) {
     for (int i = 0; i < resultset.getRowCount(); i++) {
      resultset.goToRow(i);
      String value = resultset.getStringValue(name);
      map.put(name, value);
      map.remove("UD_OID_P_NOTE");
      map.remove("UD_ACC_PROV_NOTE");
      map.remove("UD_WAT_NOTE");
      map.remove("UD_STRM_NOTE");
      map.remove("UD_SBL_P_NOTE");
      map.remove("UD_ADUSER_NOTE");
      map.remove("UD_APR_NOTE");
     }
    }
    System.out.println(map.toString());
   }
  } catch (tcAPIException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (tcNotAtomicProcessException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (tcFormNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (tcProcessNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (tcColumnNotFoundException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  }
 }

private ArrayList getProcessInstKeyOfResources(String res_Name, long userkey) {
  long longProcessInstanceKey = 0;
  ArrayList list = new ArrayList();
  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");
    String status = resultGetObjects
      .getStringValue("Objects.Object Status.Status");
    longProcessInstanceKey = resultGetObjects
      .getLongValue("Process Instance.Key");
    System.out.println("OBJ-->" + objetcName + "---->" + status
      + "---->" + longProcessInstanceKey);
    list.add(longProcessInstanceKey);
   }
   System.out.println(list);
  } catch (Exception e) {
  }
  return list;
 }

No comments:

Post a Comment