Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
4 replies
Subscribers
5 subscribers
Views
1766 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
Hi, I'm creating a servlet that's using the following method to get the
nickw
over 9 years ago
Hi, I'm creating a servlet that's using the following method to get the first task ID from an array of task ids, where the task status is NOT accepted. For some reason, every time I activate the servlet, I'm seeing the same task ID being returned by the method. I'm including both the code and the logging info I have below. Does anyone have any idea why this may not be working?
Log:
19:08:05,574 INFO [stdout] (ajp-/0.0.0.0:8009-33) 2015-03-18 19:08:05,574 [ajp-/0.0.0.0:8009-33] ERROR com.snl.appian.servlets.rapidaccept.RapidAccept - Adding User Context to Task Report: nickw
19:08:05,747 INFO [stdout] (ajp-/0.0.0.0:8009-33) 2015-03-18 19:08:05,747 [ajp-/0.0.0.0:8009-33] ERROR com.snl.appian.servlets.rapidaccept.RapidAccept - Finding first unaccepted task with status 1...
19:08:05,752 INFO [stdout] (ajp-/0.0.0.0:8009-33) 2015-03-18 19:08:05,752 [ajp-/0.0.0.0:8009-33] ERROR com.snl.appian.servlets.rapidaccept.RapidAccept - Status {1} for task id:537139...
OriginalPostID-142017
OriginalPostID-142017
Discussion posts and replies are publicly visible
0
nickw
over 9 years ago
...629
19:08:05,752 INFO [stdout] (ajp-/0.0.0.0:8009-33) 2015-03-18 19:08:05,752 [ajp-/0.0.0.0:8009-33] ERROR com.snl.appian.servlets.rapidaccept.RapidAccept - Attempting to accept task id 537139629for user nickw
19:08:05,754 INFO [stdout] (ajp-/0.0.0.0:8009-33) 2015-03-18 19:08:05,754 [ajp-/0.0.0.0:8009-33] ERROR com.snl.appian.servlets.rapidaccept.RapidAccept - Task ID 537139629 accepted for user nickw
private Long GetFirstUnacceptedTask(ProcessExecutionService pes, Long[] taskIds) throws InvalidActivityException, PrivilegeException
{
debugLog("Finding first unaccepted task with status " + TaskSummary.TASK_STATUS_ACCEPTED + "...");
for (Long ID : taskIds)
{
TaskDetails details = pes.getTaskDetails(ID);
Integer status = details.getStatus();
debugLog("Status {" + status + "} for task id:" + ID);
// Check if the task has been accepted
if (status != TaskSummary.TASK_STATUS_ACCEPTED)
{
// If not, return this task id...
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
nickw
over 9 years ago
... so it can be accepted
return ID;
}
}
return null;
}
Thanks!
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Conor Cahill
Certified Lead Developer
over 9 years ago
Are you filtering out completed tasks from your ID list? Take a look at the taskID that keeps getting returned (is it completed? is it assigned? if assigned, then try accepting it and run the servlet again)
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
sayedh
over 9 years ago
Well, you return from the for loop as soon as you find a task that is not accepted. Apparently, the array that is sent to this method has the same task ID in it. Do you change the status after the call to this method?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel