Advertisement
Guest User

Untitled

a guest
Jul 5th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. dbUrl=”jdbc:postgresql://vra-01.vcloud.local:5432/vcac”;
  2. dbUsername=”vcac”;
  3. dbPassword=”VMware123!”;
  4.  
  5.  
  6. var connection = new JDBCConnection().getConnection(dbUrl, dbUsername, dbPassword);
  7.  
  8. var query = "Select * " +
  9. "FROM asd_workflowrunrequest rr " +
  10. "WHERE rr.catalogrequestid IN( Select drr.catalogrequestid " +
  11. " FROM asd_workflowrunrequest drr " +
  12. " GROUP BY drr.catalogrequestid " +
  13. " HAVING COUNT(*) > 1)";
  14.  
  15. var statement = connection.prepareStatement(query);
  16.  
  17. var result = statement.executeQuery();
  18.  
  19. duplicates = [];
  20. duplicatesInfo = "<p>id, executionstate, catalogrequestid</p>";
  21. duplicatesIds = [];
  22.  
  23. var finishedStates = ["canceled", "completed", "failed"];
  24.  
  25. while (result.next()) {
  26. var id = result.getString("id")
  27. var state = result.getString("executionstate");
  28. state = state ? state.toLowerCase() : null;
  29. var catalogrequestid = result.getString("catalogrequestid");
  30.  
  31. // Getting only the stalled ones
  32. if (state && finishedStates.indexOf(state) == -1) {
  33. duplicatesInfo += "<p>" + id + ", " + state + ", " + catalogrequestid + "</p>";
  34. duplicatesIds.push(id);
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement