Plugin requires first task to be a user-task

112 views
Skip to first unread message

DaveWoodbury

unread,
Jul 7, 2011, 8:09:35 PM7/7/11
to Grails Activiti Plugin Discussion Forum
Hello:

During my evaluation of the plugin, which is fantastic, I noticed that
it expects the business process to have a single user-task as a
starting point. If there are multiple tasks, or if the initial task
is not a user-task, an exception will be raised.

I also noticed that user-tasks must be associated with a form. What
about non-form based tasks that a person should complete? Ideally, a
user would click a "Complete" button in his or her task list rather
than wait for a page load with a complete button on it. Is that
possible?

Thank you.

David Woodbury

Chee Kin Lim

unread,
Jul 7, 2011, 8:22:35 PM7/7/11
to grails-acti...@googlegroups.com
Hi David,

In your scenario, you may use the manual task, please refer to http://www.activiti.org/userguide/index.html#bpmnManualTask

Best regards,
Chee Kin

DaveWoodbury

unread,
Jul 8, 2011, 1:23:31 PM7/8/11
to Grails Activiti Plugin Discussion Forum
Hi Chee Kin:

I tried that, but the manual task is just a pass-thru. If the first
task in a process is a manual task, followed by a parallel gateway
followed by 5 user-tasks, Grails exception states:

Error 500: Executing action [start] of controller
[my.project.SdrTaskController] caused exception: Query return 5
results instead of max 1

I checked the plugin code, and this error is due to an assumption in
the plugin that all processes will start with a single user-task.

I propose that the plugin be updated to check on the nature of the
first task(s)... if there's one, and it is a user-task, then jump to
the form.

Also, why does a user-task require a formKey to be specified?
Sometimes, you just need a person to acknowledge that the did a task.

Thanks!

David

On Jul 7, 5:22 pm, Chee Kin Lim <limchee...@vobject.com> wrote:
> Hi David,
>
> In your scenario, you may use the manual task, please refer tohttp://www.activiti.org/userguide/index.html#bpmnManualTask
>
> Best regards,
> Chee Kin

Ned Wolpert

unread,
Jul 8, 2011, 3:42:12 PM7/8/11
to grails-acti...@googlegroups.com
Can you post the full stack trace? I'm assuming your using the latest version of the plugins, right?
--
Virtually, Ned Wolpert
http://codehead.tumblr.com/
http://codeheadsystems.wordpress.com/

"Settle thy studies, Faustus, and begin..."   --Marlowe

Ned Wolpert

unread,
Jul 8, 2011, 3:43:58 PM7/8/11
to grails-acti...@googlegroups.com
Also, are you rolling the xml by hand, using the activiti deisgner or activiti modler? (I use activiti designer myself)

DaveWoodbury

unread,
Jul 8, 2011, 7:20:03 PM7/8/11
to Grails Activiti Plugin Discussion Forum
Hi Ned:

I'm using 5.6 Activiti and 5.6 plugin, and I'm using the Eclipse based
Activiti designer... I copy and paste the BPMN XML into STS where I do
Grails development,

Here's the stack trace:

org.activiti.engine.ActivitiException: Query return 5 results instead
of max 1
at
org.activiti.engine.impl.AbstractQuery.executeSingleResult(AbstractQuery.java:
158)
at org.activiti.engine.impl.AbstractQuery.execute(AbstractQuery.java:
137)
at
org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:
24)
at
org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:
42)
at org.activiti.spring.SpringTransactionInterceptor
$1.doInTransaction(SpringTransactionInterceptor.java:42)
at
org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:
40)
at
org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:
33)
at
org.activiti.engine.impl.AbstractQuery.singleResult(AbstractQuery.java:
100)
at org.activiti.engine.query.Query$singleResult.call(Unknown Source)
at org.grails.activiti.ActivitiService.getTask(ActivitiService.groovy:
139)
at org.grails.activiti.ActivitiService.this
$2$getTask(ActivitiService.groovy)
at org.grails.activiti.ActivitiService$this
$2$getTask.callCurrent(Unknown Source)
at
org.grails.activiti.ActivitiService.getUnassignedTask(ActivitiService.groovy:
135)
at ActivitiGrailsPlugin
$_addActivitiMethods_closure7_closure29.doCall(ActivitiGrailsPlugin.groovy:
129)
at ActivitiGrailsPlugin
$_addActivitiMethods_closure7.doCall(ActivitiGrailsPlugin.groovy:126)
at my.project.SdrTaskController
$_closure2.doCall(SdrTaskController.groovy:22)
at my.project.SdrTaskController
$_closure2.doCall(SdrTaskController.groovy)
at java.lang.Thread.run(Thread.java:619)


Dave

On Jul 8, 12:43 pm, Ned Wolpert <ned.wolp...@gmail.com> wrote:
> Also, are you rolling the xml by hand, using the activiti deisgner or
> activiti modler? (I use activiti designer myself)
>
>
>
> On Fri, Jul 8, 2011 at 12:42 PM, Ned Wolpert <ned.wolp...@gmail.com> wrote:
> > Can you post the full stack trace? I'm assuming your using the latest
> > version of the plugins, right?
>
> Virtually, Ned Wolperthttp://codehead.tumblr.com/http://codeheadsystems.wordpress.com/

DaveWoodbury

unread,
Jul 8, 2011, 7:25:05 PM7/8/11
to Grails Activiti Plugin Discussion Forum
Hi Ned:

Here's the code in ActivitGrailsPlugin.groovy that implements the
behavior I describe:

def addActivitiMethods(controllerClass) {
controllerClass.metaClass.start = { Map params ->
activitiService.with {
params[sessionUsernameKey] =
session[sessionUsernameKey]
ProcessInstance pi = startProcess(params)
Task task =
getUnassignedTask(session[sessionUsernameKey], pi.id)
claimTask(task.id, session[sessionUsernameKey])
redirect uri:getTaskFormUri(task.id, useFormKey)
}
}

I'm thinking that the call to "getUnassignedTask" assumes that there
will be one unassigned task to start any business process.

David

On Jul 8, 12:43 pm, Ned Wolpert <ned.wolp...@gmail.com> wrote:
> Also, are you rolling the xml by hand, using the activiti deisgner or
> activiti modler? (I use activiti designer myself)
>
>
>
> On Fri, Jul 8, 2011 at 12:42 PM, Ned Wolpert <ned.wolp...@gmail.com> wrote:
> > Can you post the full stack trace? I'm assuming your using the latest
> > version of the plugins, right?
>
> Virtually, Ned Wolperthttp://codehead.tumblr.com/http://codeheadsystems.wordpress.com/

Ned Wolpert

unread,
Jul 8, 2011, 7:33:04 PM7/8/11
to grails-acti...@googlegroups.com
Yeah, I think your right. Though I'm curious if the first task isn't a passthru, but requires manual completion before the parallel gateway, would you still get the same error after completing that task? Or does that work fine? In otherwords, is this the only time the multiplicity causes issues?

I assume your taken the XML and imported it to activiti-probe without any issues. 

DaveWoodbury

unread,
Jul 11, 2011, 11:53:45 AM7/11/11
to Grails Activiti Plugin Discussion Forum
No, the issue only pertains to the first task(s) in a process.
In fact, the 'working' version of the process has a manual task as you
describe.

I haven't imported the BPMN XML into activiti-probe, but it is taken
directly from the Eclipse designer. The activiti engine doesn't
complain about it after it is loaded.
> > > Virtually, Ned Wolperthttp://
Reply all
Reply to author
Forward
0 new messages