SHARE
TWEET

Untitled

a guest Oct 22nd, 2019 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sailpoint.object.Filter;
  2.   import sailpoint.object.Filter.MatchMode;
  3.   import sailpoint.object.WorkflowCase;
  4.   import sailpoint.object.Workflow;
  5.   import sailpoint.object.Attributes;
  6.   import sailpoint.object.QueryOptions;
  7.   import sailpoint.object.TaskResult;
  8.   import org.apache.log4j.Logger;
  9.  
  10.   Logger log =Logger.getLogger("gca.framework");
  11.  
  12.   log.debug("------ Entering : Find Workflows with Missing TaskResults ------");
  13.  
  14.   boolean readOnly = false;
  15.   List savedTaskResults = new ArrayList();
  16.  
  17.   QueryOptions qo = new QueryOptions();
  18.   Iterator it = context.search(WorkflowCase.class, qo);
  19.  
  20.   int counter = 0;
  21.   int counterAll = 0;
  22.   while (it.hasNext()) {
  23.     WorkflowCase wfCase = (WorkflowCase) it.next();
  24.     Workflow wf = wfCase.getWorkflow();
  25.  
  26.     if(wf != null && wf.getVariables() != null) {
  27.       counterAll++;
  28.       Attributes attrs = wf.getVariables();
  29.       String taskResultID = attrs.getString("taskResultId");              
  30.  
  31.       if(taskResultID == null || context.getObjectById(TaskResult.class, taskResultID) == null) {
  32.         counter++;
  33.         log.debug("[" + counter + "] wfCase missing taskResult: " + wfCase.getId() + " || " + wfCase.getName());
  34.        
  35.       }
  36.     }
  37.   }
  38.     log.debug(counter + " workflowCases found without TaskResults out of " + counterAll + " workflowCases");
  39.   log.debug("----- Exiting : Find Workflows with Missing TaskResults -----");
  40.   return "success";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top