Juan,
You're pretty close to the actual solution ;)
The only problem is that you can't just map values to new work item
parameters and expect them to show up in the task somehow. There is one
parameter called "Content" that can be used to put in data that might be
needed / relevant during task execution. If you for example have only
one variable, you could map that to the Content parameter and access
that from inside the form. In case you have multiple values, we
recommend you use a Map to put the different values in (you can create
that in a simple action node or on-entry action and store it in an
additional variable) and then map that to the Content parameter. Note
that we've tried to make your life easier by making sure that each of
the entries in the map are known as a variable in your form so you
should be able to use your forms as you defined them already.
Now, I know we could also extend our implementation to generate a Map
for all unknown work item parameters and then put that as the Content
(or merge with the Content), would people prefer this approach? But
then again, it's probably only 5 minutes work to create your own version
of the WSHumanTaskHandler and tweak it so it does as I described above,
and then use that as your integration code instead of our default one ;)
Kris
Juan Ignacio Barisich wrote:
Hi.
I'm using the gwt-console and trying to set a parameter mapping to
send some variables from the process to a task.
First, the variables are setted in the process like:
<header>
<variables>
<variable name="myVariableA" >
<type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="String" />
</variable>
<variable name="myVariableB" >
<type
name="org.drools.process.core.datatype.impl.type.ObjectDataType"
className="String" />
</variable>
</variables>
</header>
The parameter mapping is:
<humanTask id="3" name="Revisar Solicitud" x="119"
y="143" width="162"
height="48" >
<work name="Human Task" >
...
</work>
<mapping type="in" from="myVariableA"
to="myVariableA" />
<mapping type="in" from="myVariableB"
to="myVariableB" />
</humanTask>
Then I have a ftl file for the task form like:
<html>
...
<body>
A value: ${myVariableA}</br>
Another value: ${myVariableB}</br>
...
</body>
</html>
With this code, when I select a task and click "View", I get the
following exception:
---------------------------------------------------------------------------------------------------------------------------------------------------------
org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException:
Failed to process form template
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:319)
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:230)
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:206)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:360)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
causa raíz
java.lang.RuntimeException: Failed to process form template
org.drools.integration.console.forms.AbstractFormDispatcher.processTemplate(AbstractFormDispatcher.java:104)
org.drools.integration.console.forms.TaskFormDispatcher.provideForm(TaskFormDispatcher.java:111)
org.drools.integration.console.forms.FormDispatcherComposite.provideForm(FormDispatcherComposite.java:50)
org.jboss.bpm.console.server.FormProcessingFacade.provideForm(FormProcessingFacade.java:203)
org.jboss.bpm.console.server.FormProcessingFacade.renderTaskUI(FormProcessingFacade.java:125)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
causa raíz
freemarker.core.InvalidReferenceException: Expression myVariableA is
undefined on line 5, column 39 in Evaluacion.
freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
freemarker.core.Expression.getStringValue(Expression.java:118)
freemarker.core.Expression.getStringValue(Expression.java:93)
freemarker.core.DollarVariable.accept(DollarVariable.java:76)
freemarker.core.Environment.visit(Environment.java:209)
freemarker.core.MixedContent.accept(MixedContent.java:92)
freemarker.core.Environment.visit(Environment.java:209)
freemarker.core.Environment.process(Environment.java:189)
freemarker.template.Template.process(Template.java:237)
org.drools.integration.console.forms.AbstractFormDispatcher.processTemplate(AbstractFormDispatcher.java:87)
org.drools.integration.console.forms.TaskFormDispatcher.provideForm(TaskFormDispatcher.java:111)
org.drools.integration.console.forms.FormDispatcherComposite.provideForm(FormDispatcherComposite.java:50)
org.jboss.bpm.console.server.FormProcessingFacade.provideForm(FormProcessingFacade.java:203)
org.jboss.bpm.console.server.FormProcessingFacade.renderTaskUI(FormProcessingFacade.java:125)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:117)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:260)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:232)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:166)
org.jboss.resteasy.core.DispatcherUtilities.getJaxrsResponse(DispatcherUtilities.java:142)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:173)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:93)
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:68)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.bpm.console.server.util.GWTJsonFilter.doFilter(GWTJsonFilter.java:59)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
---------------------------------------------------------------------------------------------------------------------------------------------------------
Is this a bug? or I'm doing something wrong?
Thanks in advance
--
*Juan Ignacio Barisich*
juan.barisich(a)fluxit.com.ar <mailto:juan.barisich@fluxit.com.ar>
www.fluxit.com.ar <
http://www.fluxit.com.ar/>
53 n366, piso 9
La Plata / Buenos Aires / Argentina
(54)-221-427-5781 int:308
------------------------------------------------------------------------
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users