OIM API - to Set Process Form Data

  1. package com.oimacademy.provision;
  2. import java.util.HashMap;
  3. import com.oimacademy.connection.Platform;
  4. import oracle.iam.provisioning.exception.GenericProvisioningException;
  5. import Thor.API.tcResultSet;
  6. import Thor.API.Exceptions.tcAPIException;
  7. import Thor.API.Exceptions.tcColumnNotFoundException;
  8. import Thor.API.Exceptions.tcFormNotFoundException;
  9. import Thor.API.Exceptions.tcInvalidValueException;
  10. import Thor.API.Exceptions.tcNotAtomicProcessException;
  11. import Thor.API.Exceptions.tcObjectNotFoundException;
  12. import Thor.API.Exceptions.tcOrganizationNotFoundException;
  13. import Thor.API.Exceptions.tcProcessNotFoundException;
  14. import Thor.API.Exceptions.tcProvisioningNotAllowedException;
  15. import Thor.API.Exceptions.tcRequiredDataMissingException;
  16. import Thor.API.Operations.tcFormInstanceOperationsIntf;
  17. import Thor.API.Operations.tcOrganizationOperationsIntf;
  18. public class SetProcessFormData {
  19. public static void main(String[] args) throws tcAPIException, tcInvalidValueException, tcNotAtomicProcessException,
  20. tcFormNotFoundException, tcRequiredDataMissingException, tcProcessNotFoundException,
  21. tcObjectNotFoundException, tcProvisioningNotAllowedException, tcOrganizationNotFoundException, GenericProvisioningException,
  22. tcColumnNotFoundException {
  23. Long actKey=1L;//actKey - You can get it from ACT table.
  24. Long objKey=1L;// objKey - You can get it from OBJ table.
  25. tcOrganizationOperationsIntf tcOrgOp = Platform.getService(tcOrganizationOperationsIntf.class);
  26. long objInsKey = tcOrgOp.provisionObject(actKey, objKey);
  27. tcResultSet rsetAccounts = tcOrgOp.getObjects(actKey);
  28. long processInstanceKey = -1;
  29. for(int i=0; i<rsetAccounts.getRowCount(); i++) {
  30. rsetAccounts.goToRow(i);
  31. if (rsetAccounts.getLongValue("Object Instance.Key") == objInsKey) {
  32. processInstanceKey = rsetAccounts.getLongValue("Process Instance.Key");
  33. if(processInstanceKey == 0 || rsetAccounts.getStringValue("Objects.Object Status.Status").equals("Waiting")){
  34. throw new GenericProvisioningException("Resource in Waiting status");
  35. }
  36. break;
  37. }
  38. }
  39. tcFormInstanceOperationsIntf tcFrmInsOp = Platform.getService(tcFormInstanceOperationsIntf.class);
  40. HashMap<String, String> data = new HashMap<String, String>();
  41. // Resource Form data, All the values in String format.
  42. data.put("UD_OID_OU_SERVER", "5");
  43. data.put("UD_OID_OU_NAME", "actName");
  44. data.put("UD_OID_OU_ORGNAME", "5~ou=sales,cn=Users,dc=us,dc=oracle,dc=com");
  45. tcFrmInsOp.setProcessFormData(processInstanceKey, data);
  46. }
  47. }

No comments:

Post a Comment