Forums Questions & Help Tags custom service Hi i building a custom service and i need help how can i count the number of allocated and started tasks of user and convert the result to int Count queued work items Like this: public int getItemCount(String userid) { String rsURI = "http://localhost:8080/resourceService/workqueuegateway"; WorkQueueGatewayClientAdapter adapter = new WorkQueueGatewayClientAdapter(rsURI); try { String handle = adapter.connect("admin", "YAWL"); Participant p = adapter.getParticipantFromUserID(userid, handle); if (p != null) { Set<WorkItemRecord> allocatedSet = adapter.getQueuedWorkItems(p.getID(), WorkQueue.ALLOCATED, handle); Set<WorkItemRecord> startedSet = adapter.getQueuedWorkItems(p.getID(), WorkQueue.STARTED, handle); if (! (allocatedSet == null || startedSet == null)) { return allocatedSet.size() + startedSet.size(); } } } catch (Exception e) { e.printStackTrace(); } return -1; // to indicate error } Log in or register to post comments count for each resource how i count allocated and started for each user and fill the data table like attached file? Log in or register to post comments Image What about the previous answer? Hi, could you please give some feedback wrt the answer of your first question before asking the next one? Log in or register to post comments Log in or register to post comments
Count queued work items Like this: public int getItemCount(String userid) { String rsURI = "http://localhost:8080/resourceService/workqueuegateway"; WorkQueueGatewayClientAdapter adapter = new WorkQueueGatewayClientAdapter(rsURI); try { String handle = adapter.connect("admin", "YAWL"); Participant p = adapter.getParticipantFromUserID(userid, handle); if (p != null) { Set<WorkItemRecord> allocatedSet = adapter.getQueuedWorkItems(p.getID(), WorkQueue.ALLOCATED, handle); Set<WorkItemRecord> startedSet = adapter.getQueuedWorkItems(p.getID(), WorkQueue.STARTED, handle); if (! (allocatedSet == null || startedSet == null)) { return allocatedSet.size() + startedSet.size(); } } } catch (Exception e) { e.printStackTrace(); } return -1; // to indicate error } Log in or register to post comments
count for each resource how i count allocated and started for each user and fill the data table like attached file? Log in or register to post comments Image
What about the previous answer? Hi, could you please give some feedback wrt the answer of your first question before asking the next one? Log in or register to post comments
Count queued work items
Like this:
public int getItemCount(String userid) {
String rsURI = "http://localhost:8080/resourceService/workqueuegateway";
WorkQueueGatewayClientAdapter adapter = new WorkQueueGatewayClientAdapter(rsURI);
try {
String handle = adapter.connect("admin", "YAWL");
Participant p = adapter.getParticipantFromUserID(userid, handle);
if (p != null) {
Set<WorkItemRecord> allocatedSet =
adapter.getQueuedWorkItems(p.getID(), WorkQueue.ALLOCATED, handle);
Set<WorkItemRecord> startedSet =
adapter.getQueuedWorkItems(p.getID(), WorkQueue.STARTED, handle);
if (! (allocatedSet == null || startedSet == null)) {
return allocatedSet.size() + startedSet.size();
}
}
}
catch (Exception e) {
e.printStackTrace();
}
return -1; // to indicate error
}
count for each resource
how i count allocated and started for each user and fill the data table like attached file?
What about the previous answer?
Hi,
could you please give some feedback wrt the answer of your first question before asking the next one?