-
1. How add a form to human task
melc May 19, 2011 6:52 AM (in response to stellina_rosa)Hello,
In order to have a form for a human task you can use three methods,
1. You can use the default ftl functionality from the console. As you have realised it is necessary to upload the ftl file to guvnor, if you are going to use the console, because the console gets the form from the gwt-server-console which renders the form based on the ftl found in guvnor.
2. You can use the default ftl functionality with your own application comunicating with gwt-console-server (as the console does) through the REST API of gwt-console-server. In this case you also need the ftl files in guvnor since the gwt-console-server will serve the rendered forms based on the ftl found in guvnor.
3. You can use only api without using the ftl functionality and managing task services by your own. So when you have a task you may display your own gui and call relevant api in order to complete the task etc. (see http://community.jboss.org/people/bpmn2user/blog/2011/04/03/jbpm5-human-task-api-usage-example )
In all cases there has to be a task service running.
Generally guvnor is a repository and manager of your resources and rules logic, so if you use only the jbpm5 api then not only you don't need to use ftl files but you can also ignore guvnor completely. However you can certainly use guvnor from your api as well, as great repository, to build your knowledge base and use it for managing resources, having versions, building extra rules etc.
I would appreciate any other ideas, comments etc thanks
-
2. How add a form to human task
stellina_rosa May 19, 2011 8:07 AM (in response to melc)Thank you very much for your answer!
It is important for me to know that guvnor is not necessary for adding form to my jbpm process! I'm going to try the example you linked me, so if I find any problem I can explain you!
THANK YOU!!
-
3. Re: How add a form to human task
stellina_rosa May 19, 2011 8:56 AM (in response to melc)I'm trying to run the example at http://community.jboss.org/people/bpmn2user/blog/2011/04/03/jbpm5-human-task-api-usage-example but when I run TaskServer.java I have this error:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Hibernate: select task0_.id as col_0_0_, deadline1_.id as col_1_0_, deadline1_.deadline_date as col_2_0_ from Task task0_, Deadline deadline1_ where (deadline1_.id in (select startdeadl2_.id from Deadline startdeadl2_ where task0_.id=startdeadl2_.Deadlines_StartDeadLine_Id) or deadline1_.id in (select enddeadlin3_.id from Deadline enddeadlin3_ where task0_.id=enddeadlin3_.Deadlines_EndDeadLine_Id)) and deadline1_.escalated=0 order by deadline1_.deadline_date
Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)
Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)
Hibernate: insert into OrganizationalEntity (DTYPE, id) values ('User', ?)
Server started ...
Exception in thread "Thread-4" java.lang.RuntimeException: Server Exception with class class org.jbpm.task.service.mina.MinaTaskServer using port 9123
at org.jbpm.task.service.mina.BaseMinaTaskServer.run(BaseMinaTaskServer.java:53)
at java.lang.Thread.run(Unknown Source)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind(Native Method)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:251)
at org.apache.mina.transport.socket.nio.NioSocketAcceptor.open(NioSocketAcceptor.java:48)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor.registerHandles(AbstractPollingIoAcceptor.java:523)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor.access$200(AbstractPollingIoAcceptor.java:65)
at org.apache.mina.core.polling.AbstractPollingIoAcceptor$Acceptor.run(AbstractPollingIoAcceptor.java:407)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more
I only understand that the port 9123 is already in use... but where??? Another doubt: where is the description of the gui in this example? I thought that if I don't use ftl file, I can define my gui with my favourite code (for example using swing or awt)... sorry but this example is not clear for me... if you have tried it, can you explain me the steps?
I'm confused...!! please help me!
-
4. How add a form to human task
melc May 19, 2011 9:29 AM (in response to stellina_rosa)Hello,
Indeed the port is in use try running netstat from console/command line to see the ports that are occupied etc. (Make sure that you are not running the task service via ant start.demo etc at the same time) . If you can't solve this just restart your machine
The idea of the example is that it shows how to see the available tasks through api and how to claim a task etc.... so once you have that you can create your ui with the api that claims a task and then shows a form with something, then that gui would have a button calling complete task if the task is completed and so on. If you would like to access the human task parameters i.e. content and actorid etc specified in eclipse then you can do that through the api. So imagine a case where you could do the following,
1. a web page with a table (or a swing table or whatever) that displayes all tasks as retrieved from api
2. a button to claim the task based on your credentials as retrieved by your web page
3. call your own web form/web screen based on the task name (this is your own custom implementation, the task name will be on your web page table as retrieved via the api when you retrieved the tasks for this user's credentials etc) and use parameters passed via the content parameter of the human task node in eclipse etc All this info is available to you via the jbpm5 api
4. have a button on your web form/web screen that completes the task by calling the api
Well that's the general idea.
-
5. Re: How add a form to human task
mdegan Oct 23, 2013 2:16 AM (in response to melc)Hi Chris,
I am following this structure that you have mentioned (using my own forms and application to manage form data). I am using API to fetch the human tasks and link my forms to it. However, I am trying to understand, how I can update process variables using my custom form data. The submit on my form calls my application action that saves the form data to database tables. Will I need to hard code something in my save action to identify node variable-process variable mapping for updating the value to the process variable. Any suggestions on this will be very helpful.
Regards,
Manny
-
6. Re: How add a form to human task
melc Nov 19, 2013 3:45 PM (in response to mdegan)Hello Manny,
Whenever it is required to update process variables, you need to pass data back to the process when you complete a human task. So, when you retrieve the human tasks and display your own forms, after executing the logic, i.e. saving in the database, you also need to complete the human tasks in order for the process to proceed with its execution. On the completion of human tasks you can pass data, which you handle from your process and map the data to process variables.
-
7. Re: How add a form to human task
mdegan Nov 19, 2013 11:18 PM (in response to melc)Hi Chris,
Thanks for the response. I did exactly that. I have written my own util that acts as the interface to transfer info from my application forms to the JBPM engine. As part of the util, I pass all the data from the form to the complete method for the task. That gets the data into the process engine and the variable are updated with the values. The only thing to keep in mind is to have the same field names in the forms as the process variables and it works.
Regards,
Manny