JBoss jBPM 3.1 プログラミング入門

Similar documents
Microsoft PowerPoint - JBoss-jBPM.ppt

サーブレット (Servlet) とは Web サーバ側で動作する Java プログラム 通常はapache 等のバックグラウンドで動作する Servletコンテナ上にアプリケーションを配置 代表的な Servlet コンテナ Apache Tomcat WebLogic WebSphere Gla

java_servlet2_見本

B2-Servlet-0112.PDF

Microsoft Word - jpluginmanual.doc

Oracle SOA Suite 11gコンポジットに対するSOASchedulerの構成

Web Servlet/JSP JSP

JEE 上の Adobe Experience Manager forms のインストールおよびデプロイ(WebLogic 版)

Web JavaScript Java Applet Flash ActionScript CGI (C, perl, ruby ) PHP Servlet, JSP (JavaServer Pages) ASP 7-2

Servlet JSP JSP Servlet/JSP における 日 本 語 の 処 理 - 1

HTML Java Tips dp8t-asm/java/tips/ Apache Tomcat Java if else f

10/ / /30 3. ( ) 11/ 6 4. UNIX + C socket 11/13 5. ( ) C 11/20 6. http, CGI Perl 11/27 7. ( ) Perl 12/ 4 8. Windows Winsock 12/11 9. JAV

Web 1 p.2 1 Servlet Servlet Web Web Web Apache Web Servlet JSP Web Apache Tomcat Jetty Apache Tomcat, Jetty Java JDK, Eclipse

HTML Java Tips dp8t-asm/java/tips/ Apache Tomcat Java if else f

Microsoft PowerPoint - Lecture_3

: : : TSTank 2



. IDE JIVE[1][] Eclipse Java ( 1) Java Platform Debugger Architecture [5] 3. Eclipse GUI JIVE 3.1 Eclipse ( ) 1 JIVE Java [3] IDE c 016 Information Pr

Java Platform Debugger Architecture Apache JServ Oracle JVM JPDA JVM Tomcat Oracle JVM... 7

Part1 159 a a

untitled

Microsoft PowerPoint - 4-MySQL50_JDBC_failover.ppt

II 1 p.1 1 Servlet 1.1 Web Web WWW HTML CGI Common Gateway Interface Web HTML Web Web CGI CGI CGI Perl, PHP C JavaScript Web CGI HTML 1.2 Servlet Java

Microsoft PowerPoint - Lecture_2

Introduction Purpose This training course demonstrates the use of the High-performance Embedded Workshop (HEW), a key tool for developing software for

Cisco ASA Firepower ASA Firepower

Java EE 7 アプリケーション設計ガイド - JSF(JavaServer Faces) 2.2 入門編

untitled

untitled

2 Java 35 Java Java HTML/CSS/JavaScript Java Java JSP MySQL Java 9:00 17:30 12:00 13: 項目 日数 時間 習得目標スキル Java 2 15 Web Java Java J

Quickstart Guide 3rd Edition

Oracle9i JDeveloper R9.0.3 チュートリアル

Microsoft PowerPoint - Tutorial_2_upd.ppt

アプリケーションサーバ JBoss超入門

ストラドプロシージャの呼び出し方

HTML/JSP/Servlet... 7 JSP... 7 Servlet Struts Struts Struts FormBean LoginForm

ユニット・テストの概要

MySQLにおけるシステム運用時のポイント

JC オンライン投稿の操作方法について(mac) 2011_9 FINAL

メディプロ1 Javaサーブレット補足資料.ppt

新・明解Java入門

<4D F736F F D20566F F6E658C6791D FE382C582CC4A D834F E F8F4390B394C52E646F63>

PowerPoint プレゼンテーション

オブジェクト脳のつくり方

1: 3 CAS[3] uportal[4] (Web ) 3.1 CAS CAS[3] Yale JA-SIG [5] CAS 1. 2(1) CAS Web (2)CAS ID LDAP 2. 2(3) CAS Web CAS Ticket (4)Web Ticket 3. Ticket Web

_‚Ofl¼


Eclipse 操作方法 (Servlet/JSP 入門補助テキスト)

Local variable x y i paint public class Sample extends Applet { public void paint( Graphics gc ) { int x, y;... int i=10 ; while ( i < 100 ) {... i +=

Windows Web Windows Windows WinSock

3 Java 3.1 Hello World! Hello World public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World");

Web Tomcat MapDataManager i

BC4J...4 BC4J Association JSP BC4J JSP OC4J

FileMaker ODBC and JDBC Guide

Plan of Talk CAS CAS 2 CAS Single Sign On CAS CAS 2 CAS Aug. 19, 2005 NII p. 2/32

Oracle Application Server 10g (9.0.4): Manually Managed Cluster

Java (9) 1 Lesson Java System.out.println() 1 Java API 1 Java Java 1

10 (1) s 10.2 rails c Rails 7 > item = PlanItem.new => #<PlanItem id nil, name nil,...> > item.name = "" => "" > item.valid? => true valid? true false

TOPLON PRIO操作手順

Oracle Forms Services R6i

JavaScript の使い方

CAS Yale Open Source software Authentication Authorization (nu-cas) Backend Database Authentication Authorization Powered by A

[1]...1 [2]...1 [3] Java Web...3 [4] Java Web...18 [

untitled

Client client = ClientBuilder.newClient(); WebTarget webtarget = client.target(" " "); Invo

untitled

TopLink È... 3 TopLink...5 TopLink åø... 6 TopLink å Workbench O/R ~... 8 Workbench À ~... 8 Foundation Library å... 8 TopL

Adobe LiveCycle Workbench 11 のインストール

Cleaner XL 1.5 クイックインストールガイド

Systemwalker IT Service Management Systemwalker IT Service Management V11.0L10 IT Service Management - Centric Manager Windows

Java演習(4) -- 変数と型 --

Transcription:

JBoss jbpm 3.1 2007 4 24 2007 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice

Hello World Hello World web web GPD web 2 19 4 25

HelloWorld

HelloWorld JBoss jbpm API (JPDL) DB(DB) (state ) 4 19 4 25

HelloWorld <process-definition name="helloworld"> <start-state name="start"> <transition to="s" /> </start-state> <state name="s"> <transition to="end" /> </state> <end-state name="end" /> </process-definition> 5 19 4 25

HelloWorld public void testhelloworldprocess() { // / ProcessDefinition processdefinition = ProcessDefinition.parseXmlString( "<process-definition>" + "<start-state name='start'>" + "<transition to='s' />" + "</startstate>" + "<state name='s'>" + "<transition to='end' />" + "</state>" + "<end-state name='end' />" +"</process-definition> ); // ProcessInstance processinstance = new ProcessInstance(processDefinition); // Token token = processinstance.getroottoken(); assertsame(processdefinition.getstartstate(), token.getnode()); // token.signal(); assertsame(processdefinition.getnode("s"), token.getnode()); } token.signal(); assertsame(processdefinition.getnode("end"), token.getnode()); 6 19 4 25

HelloWorld ()

HelloWorld DB Hello World DB HSQLDB JBoss jbpm API (JPDL) DB DB (state ) DB DB 8 19 4 25

HelloWorld DB <process-definition name="helloworld"> <start-state name="start"> <transition to="s" /> </start-state> <state name="s"> <transition to="end" /> </state> <end-state name="end" /> </process-definition> 9 19 4 25

HelloWorld DB (1/5) JbpmConfiguration : public class HelloWorldDbTest extends TestCase { static JbpmConfiguration jbpmconfiguration = null; static { jbpmconfiguration = JbpmConfiguration.parseXmlString( "<jbpm-configuration>" + " <jbpm-context>" + " <service name='persistence' " + " factory='org.jbpm.persistence.db.dbpersistenceservicefactory' />" + " </jbpm-context>" + " <string name='resource.hibernate.cfg.xml' " + " value='hibernate.cfg.xml' />" + " <string name='resource.business.calendar' " + " value='org/jbpm/calendar/jbpm.business.calendar.properties' />" + " <string name='resource.default.modules' " + " value='org/jbpm/graph/def/jbpm.default.modules.properties' />" + " <string name='resource.converter' " + " value='org/jbpm/db/hibernate/jbpm.converter.properties' />" + " <string name='resource.action.types' " + " value='org/jbpm/graph/action/action.types.xml' />" + " <string name='resource.node.types' " + " value='org/jbpm/graph/node/node.types.xml' />" + " <string name='resource.varmapping' " + " value='org/jbpm/context/exe/jbpm.varmapping.xml' />" + "</jbpm-configuration>" ); } public void setup() { jbpmconfiguration.createschema(); 10} 19 4 25 JbpmConfiguration JBoss jbpm ( ) jbpm.cfg.xml JbpmConfiguration JbpmConfiguration jbpmconfiguration = JbpmConfiguration.getInstance();

HelloWorld DB (2/5) public void testsimplepersistence() { // 1helloworld // helloworld deployprocessdefinition(); // helloworld // "s" processinstanceiscreatedwhenusersubmitswebappform(); } // helloworld theprocessinstancecontinueswhenanasyncmessageisreceived(); 11 19 4 25

HelloWorld DB (3/5) } public void deployprocessdefinition() { ProcessDefinition processdefinition = ProcessDefinition.parseXmlString( "<process-definition name='helloworld'>" + " <start-state name='start'>" + "<transition to='s' />" + "</startstate>" + " <state name='s'>" + "<transition to='end' />" + "</state>" + " <end-state name='end' />" + "</process-definition>" ); JbpmContext jbpmcontext = jbpmconfiguration.createjbpmcontext(); try { // helloworld jbpmcontext.deployprocessdefinition(processdefinition); } finally { } jbpmcontext.close(); JbpmContext JbpmConfiguration#createJb pmcontext() Hibernate try-finally close() 12 19 4 25

HelloWorld DB (4/5) / public void processinstanceiscreatedwhenusersubmitswebappform() { JbpmContext jbpmcontext = jbpmconfiguration.createjbpmcontext(); try { GraphSession graphsession = jbpmcontext.getgraphsession(); // ProcessDefinition processdefinition = graphsession.findlatestprocessdefinition("helloworld"); ProcessInstance processinstance = new ProcessInstance(processDefinition); // Token token = processinstance.getroottoken(); assertequals("start", token.getnode().getname()); // token.signal(); assertequals("s", token.getnode().getname()); // ( ) jbpmcontext.save(processinstance); } } finally { jbpmcontext.close(); } 13 19 4 25

HelloWorld DB (5/5) / } public void theprocessinstancecontinueswhenanasyncmessageisreceived() { JbpmContext jbpmcontext = jbpmconfiguration.createjbpmcontext(); try { GraphSession graphsession = jbpmcontext.getgraphsession(); ProcessDefinition processdefinition = graphsession.findlatestprocessdefinition("helloworld"); // helloworld List processinstances = graphsession.findprocessinstances(processdefinition.getid()); // 11 ProcessInstance processinstance = (ProcessInstance) processinstances.get(0); // processinstance.signal(); // ( ) asserttrue(processinstance.hasended()); } finally { } jbpmcontext.close(); 14 19 4 25

web Web

JBoss jbpm Web JBoss jbpm Web JBoss jbpm websale JBoss jbpm URL http://sourceforge.net/project/showfiles.php?group_id=70542 jbpm-starters-kit-3.1.4.zip $JBPM_KIT_HOME/jbpm $JBPM_KIT_HOME/jbpm-server Web JBossAS(4.0.3SP1 ) 16 19 4 25

JBoss jbpm JDK 5.0 Update 11 : jdk-1_5_0_11-windows-i586-p.exe : http://java.sun.com/javase/downloads/ind ex_jdk5.jsp JBoss jbpm 3.1.4 : jbpm-starters-kit-3.1.4.zip : http://sourceforge.net/project/showfiles.ph p?group_id=70542 JDK JBossAS > cd C: jboss jbpm-starters-kit-3.1.4 > cd jbpm-server > start.bat JBossAS Web URL http://localhost:8080/jbpm/ > cd C: > mkdir jboss > cd jboss > jar xvf C: jboss_archive jbpm-starters-kit-3.1.4.zip 17 19 4 25

Web : 18 19 4 25

Web : web.xml JbpmContextFilter JSP Managed Bean item price user_name isurgentapprovalmgr_name Start-state token End-state user1 ActionHandler faces-config.xml JSF (Myfaces) Tomcat JBoss jbpm Hibernate JBoss AS JbpmConfiguration 19 19 4 25 jbpm.sar

JbpmContextFilter jbpmcontext JBoss jbpm Servlet Filter HTTP JbpmContext JbpmContext (ThreaLocal) HTTP JbpmContext web.xml... <filter> <filter-name>jbpmcontextfilter</filter-name> <filter-class>org.jbpm.web.jbpmcontextfilter </filter-class> </filter> <filter-mapping> <filter-name>jbpmcontextfilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>... JbpmContextFilter.java public class JbpmContextFilter implements Filter, Serializable {... public void dofilter(servletrequest servletrequest, ServletResponse servletresponse, FilterChain filterchain) throws IOException, ServletException { JbpmContext jbpmcontext = getjbpmconfiguration().createjbpmcontext(jbpmcontextname); try { if (isauthenticationenabled) { jbpmcontext.setactorid(actorid); } filterchain.dofilter(servletrequest, servletresponse); } finally { jbpmcontext.close(); } } 20 19 4 25

jbpm.sar JBoss Application Server JbpmConfiguration jbpm JBoss jbpm jar DB (hiberante.cfg.xml) jbpmcontext JBoss JNDI 21 19 4 25

Web : action="#{hogebean.ametho d}" HTTP HTTP jbpmcontext JbpmContextFilter JSP Managed Bean HogeBean#aMethod( ) item price user_name isurgentapproval mgr_name Start-state user1 token End-state ActionHandler jbpmcontext facesconfig.xml JSF (Myfaces) Tomcat HttpSession HttpReque st JBoss jbpm Hibernate JBoss AS JbpmConfiguration 22 19 4 25

Web

Web JBossAS > set JAVA_HOME=c: java 15011 > cd C: jboss jbpm-starters-kit-3.1.3 > cd jbpm-server > start.bat JBossAS Web URL http://localhost:8080/jbpm/ 24 19 4 25

Cookie monster 25 19 4 25

web Web sale order 26 19 4 25

web Web sale order[save and Close Task] 27 19 4 25

Orderernie ernie 28 19 4 25

Ernie ernie order 29 19 4 25

Order ernie [more info needed] 30 19 4 25

web GPD

GPD JBoss jbpm (GDP) JBoss jbpm Web JBoss AS Web 32 19 4 25

: HelloWorld "cookie monster" (msg) "ernie" (msg) JBoss jbpm "ernie" 33 19 4 25

1. JDK 2. Eclipse SDK 3. JBoss jbpm 4. JBoss jbpm (GPD) 5. JBoss jbpm (GPD) 34 19 4 25

: JDK jdk-1_5_0_11-windows-i586-p.exe http://java.sun.com/javase/downloads/index_jdk5.jsp Eclipse SDK eclipse-sdk-3.2.2-win32.zip http://www.eclipse.org/downloads/ JBoss jbpm jbpm-starters-kit-3.1.4.zip http://sourceforge.net/project/showfiles.php?group_id=70542 JBoss jbpm (GPD) jbpm-jpdl-designer-3.0.13.zip http://sourceforge.net/project/showfiles.php?group_id=70542 35 19 4 25

: 1/3 1. JDK JAVA_HOME 2. Eclipse SDK ECLIPSE_HOME 3. JBoss jbpm > cd C: > mkdir jboss > cd jboss > jar xvf C: jboss_archive jbpm-starters-kit-3.1.4.zip 4. JBoss jbpm > cd %ECLIPSE_HOME% > jar xvf C: jboss_archive jbpm-jpdl-designer-3.0.13.zip eclipse 36 19 4 25

: 2/3 6. JBoss jbpm (GPD) (1) Eclipse Window Preferences (2) Add Name (JBoss jbpm3.1.4) Location C: jboss jbpm-starters-kit-3.1.4 jbpm OK (3) JBoss jbpm (1) (3) (2) 37 19 4 25

: 3/3 7. JBoss AS JBossAS > cd C: jboss jbpm-starters-kit-3.1.4 > cd jbpm-server > start.bat JBossAS Web URL http://localhost:8080/jbpm/ [ ] JBoss AS TRACE INFO jbpm-server server jbpm conf log4j.xml ( ) <param name="threshold" value="trace"/> ( ) <param name="threshold" value= INFO"/> 38 19 4 25

: (1) Process Project Eclipse File New Other JBoss jbpm Process Project Next Project Name HelloWorldProcess Finish 39 19 4 25

: (2) Process Definition(JPDL) Java Perspective Package Explorer HelloWorldProcess src/main/jpdl New Other JBoss jbpm Process Definition Process Name HelloWorld Finish 40 19 4 25

: (3) HelloWorldProcess src/main/jpdl/helloworld processdefinition.xml Open With jbpm Graphical Process Designer Start1 Task Node End1 Transition 41 19 4 25

: (4) StartTask Start Add Task Outline View task Properties Controller OK Add Name : msg Read : Write : Required : 42 19 4 25

: (5) Taks Node Task Task Node Add Task Outline View task1 Properties Controller Add Name : msg Read : Write/Required : Assignment type : Expression expression : user(ernie) OK File Save 43 19 4 25

: (6) Deployment Server Deployer ( ) /jbpm-console/upload ( ) /jbpm/upload Test Connection Deploy Process Archive 44 19 4 25

: (7) 1/8 http://localhost:8080/jbpm/ "cookie monster" 45 19 4 25

: (7) 2/8 HelloWorld 46 19 4 25

: (7) 3/8 msg (msg ) "Hello jbpm " "Save and Close Task" 47 19 4 25

: (7) 4/8 Home "Login as another user" 48 19 4 25

: (7) 5/8 "ernie" 49 19 4 25

: (7) 6/8 "Tasklist" "task1" "task1" 50 19 4 25

: (7) 7/8 msg "cookie monster" "Save and Close Task" 51 19 4 25

: (7) 8/8 Home 52 19 4 25

: (8) 1 Monitoring 53 19 4 25

: (8) 2 54 19 4 25

Web

56 19 4 25

< > Step1 : Step2 : Step3 : Step4 : Step5 : ID Step6 : < > Step1 : Step2 : Step3 : Step4 : < > Step1 : Step2 : Step3 : ID D(ID) Step4 : ( ) 57 19 4 25

58 19 4 25

59 19 4 25 jbpmconfiguration JVM DB / user_name mgr_name isurgent approval Start-state End-state <task-node> <task-node> <task-node> item price SelectMgr ActionHandler SendMail ActionHandler SendMail ActionHandler UserAssignment Handler UserAssignment Handler MgrAssignment Handler user1 user1 manager1 jbpm DB EIS jbpmcontext

Step1 : Step2 : Step3 : Step4 : Step5 : ID Step6 : "user1" jbpmcontext user_name user1 jbpmcontext jbpmcontext user1 jbpmcontext jbpmcontext user1 jbpmcontext jbpmcontext jbpmconfiguration DB / isurgent item approval Start-state <task-node> <task-node> <task-node> price user1 user1 manager1 user_name mgr_name "user_name" UserAssignment Handler SelectMgr ActionHandler UserAssignment Handler SendMail ActionHandler MgrAssignment Handler SendMail ActionHandler jbpm DB "mgr_name" "manager1" "manager1" EIS mgr_name JVM End-state 60 19 4 25

Web HTTP / Step1 : 61 19 4 25 HttpSession user_name Step2 : Step3 : Step4 : Step5 : Step6 : jbpmcontext user_name user1 jbpmcontext jbpmcontext user1 jbpmcontext jbpmcontext Servlet Filter user1 jbpmcontext jbpmcontext HttpSession user_name Tomcat item isurgent ServletContext jbpmconfiguration approval Start-state <task-node> <task-node> <task-node> price End-state user1 mgr_name UserAssignment Handler SelectMgr ActionHandler user1 UserAssignment Handler manager1 SendMail ActionHandler MgrAssignment Handler SendMail ActionHandler jbpm DB HttpSession EIS user_name"

Web: JBoss AS Seasar2 app.dicon web.xml HTML Action Logic JbpmContextFilter S2ContainerFilter Tomcat Step3 : S2JSF JSF Myfaces faces-config.xml S2Container item price user_name isurgentapprovalmgr_name Start-state user1 token End-state JBoss jbpm ActionHandler Hibernate JBoss AS JbpmConfiguration 62 19 4 25

Step3 : HTTP / Step1 : 63 19 4 25 Step2 : Step3 : Step4 : Step5 : Step6 : jbpmcontext user_name user1 jbpmcontext jbpmcontext user1 jbpmcontext jbpmcontext Servlet Filter user1 jbpmcontext jbpmcontext HttpSession user_name item isurgent jbpmconfiguration Tomcat/JBossAS ServletContext approval Start-state <task-node> <task-node> <task-node> price End-state user1 user1 manager1 mgr_name UserAssignment Handler SelectMgr ActionHandler UserAssignment Handler SendMail ActionHandler MgrAssignment Handler SendMail ActionHandler jbpm DB EIS

Step3 : HTTP user_input.html HTTP user_confirm.html jbpmcontext 64 19 4 25 JbpmContextFilter S2ContainerFilter Tomcat DTO HTML Step3 : JSF Myfaces S2JSF user_confirm UserAction#input() Action user_confirm jbpmcontext S2Container JBoss AS BpmLogic#input() Logic item price user_name isurgentapprovalmgr_name Start-state token End-state user1 JBoss jbpm ActionHandler JbpmConfiguration Hibernate

JBoss jbpm http://www.jbpm.org/index.html JBoss jbpm http://www.jbpm.org/docs.html JBoss jbpm http://sourceforge.net/forum/forum.php?forum_id=240085 JBoss jbpm Wiki http://wiki.jboss.org/wiki/wiki.jsp?page=jbpmwiki JBoss jbpm getting started guide http://wiki.jboss.org/wiki/wiki.jsp?page=jbpmgettingstarted JBoss jbpm API(Javadoc) http://docs.jboss.com/jbpm/v3/javadoc/ 66 19 4 25

JBoss/URL JBoss http://www.hp.com/jp/jboss/ Open Source & Linux http://www.hp.com/jp/linux/ 67 19 4 25

Web

Web : http://localhost:8080/jb pm/ "cookie monster" "Log In" home.jsp home.jsp <h4>start New Process Execution</h4> <h:datatable value="#{homebean.latestprocessdefinitions}" var="processdefinition"...> <f:facet name="header"> <h:outputtext value="start Process Link" /> </f:facet> <h:commandlink action="#{homebean.startprocessinstance}"> <f:param name="processdefinitionid" value="#{processdefinition.id}"/> <h:outputtext value="#{processdefinition.taskmgmtdefinition.starttask.name}" /> </h:commandlink> </h:column>... <h:outputtext value="#{processdefinition.name}" />... <h:outputtext value="#{processdefinition.version}" /> 69 19 4 25

Web : (HomeBean) HomeBean.java public class HomeBean {... JbpmContext jbpmcontext; GraphSession graphsession; TaskMgmtSession taskmgmtsession; public HomeBean() { this.jbpmcontext = JbpmContext.getCurrentJbpmContext(); this.graphsession = jbpmcontext.getgraphsession(); this.taskmgmtsession = jbpmcontext.gettaskmgmtsession(); }... public List getlatestprocessdefinitions() { return graphsession.findlatestprocessdefinitions(); }... 70 19 4 25

Web : "create new web sale order" task.jsp home.jsp <h4>start New Process Execution</h4> <h:datatable value="#{homebean.latestprocessdefinitions}" var="processdefinition"...> <f:facet name="header"> <h:outputtext value="start Process Link" /> </f:facet> <h:commandlink action="#{homebean.startprocessinstance}"> <f:param name="processdefinitionid" value="#{processdefinition.id}"/> <h:outputtext value="#{processdefinition.taskmgmtdefinition.starttask.name}" /> </h:commandlink> </h:column> 71 19 4 25

Web : (HomeBean) HomeBean.java public String startprocessinstance() { // Get the task instance id from request parameter long processdefinitionid = JsfHelper.getId("processDefinitionId"); ProcessDefinition processdefinition = graphsession.loadprocessdefinition(processdefinitionid); // create a new process instance to run ProcessInstance processinstance = new ProcessInstance(processDefinition); // create a new taskinstance for the start task TaskInstance taskinstance = processinstance.gettaskmgmtinstance().createstarttaskinstance(); // Save the process instance along with the task instance jbpmcontext.save(processinstance); // Fill the task backing bean with useful information taskbean.initialize(taskinstance); return "task"; } 72 19 4 25

Web : item : book quantity : 1 "Save and Close Task" task.jsp <h:form id="taskform"> <h:inputhidden id="taskinstanceid" value="#{taskbean.taskinstanceid}" /> <h2><h:outputtext value="#{taskbean.taskinstance.name}" /></h2><hr /> <h:datatable value="#{taskbean.taskformparameters}" var="formparameter"> <h:column> <h:outputtext value="#{formparameter.label}" />... <h:outputtext value="#{formparameter.description}" />... <h:inputtext value="#{formparameter.value}" readonly="#{formparameter.readonly}" />... </h:datatable> <hr />... <h:commandbutton id="transitionbutton" action="#{taskbean.saveandclose}" value="save and Close Task"/>... 73 19 4 25

Web : (TaskBean) TaskBean.java public List gettaskformparameters() { return taskformparameters; } public void initialize(taskinstance taskinstance) { this.taskinstance = taskinstance; this.taskinstanceid = taskinstance.getid(); // set the parameters this.taskformparameters = new ArrayList(); TaskController taskcontroller = taskinstance.gettask().gettaskcontroller(); if (taskcontroller!=null) { List variableaccesses = taskcontroller.getvariableaccesses(); Iterator iter = variableaccesses.iterator(); while (iter.hasnext()) { VariableAccess variableaccess = (VariableAccess) iter.next(); String mappedname = variableaccess.getmappedname(); Object value = taskinstance.getvariable(mappedname); TaskFormParameter tfp = new TaskFormParameter(variableAccess, value); taskformparameters.add(tfp); } // store the parameters in the session JsfHelper.setSessionAttribute("taskFormParameters", taskformparameters); } 74 19 4 25

Web : (TaskBean) TaskBean.java public String saveandclose() { // save save(); // close the task instance String transitionbutton = JsfHelper.getParameter("taskform:transitionButton"); TaskInstance taskinstance = taskmgmtsession.loadtaskinstance(taskinstanceid); if ("Save and Close Task".equals(transitionButton)) { taskinstance.end();... }... jbpmcontext.save(taskinstance); return "home"; } 75 19 4 25 public String save() {... // submit the parameters in the jbpm task controller TaskInstance taskinstance = taskmgmtsession.loadtaskinstance(taskinstanceid); // collect the parameter values from the values that were updated in // the parameters by jsf. Iterator iter = taskformparameters.iterator(); while (iter.hasnext()) { TaskFormParameter taskformparameter = (TaskFormParameter) iter.next(); if ((taskformparameter.iswritable()) && (taskformparameter.getvalue()!= null)) { taskinstance.setvariable(taskformparameter.getlabel(), taskformparameter.getvalue());... } } // save the process instance and hence the updated // task instance variables jbpmcontext.save(taskinstance); // remove the parameters from the session JsfHelper.removeSessionAttribute("taskFormParameters"); return "home"; }

Web : http://localhost:8080/jbp m/ "ernie" "Log In" home.jsp home.jsp <h4>tasklist</h4> <h:datatable value="#{homebean.taskinstances}" var="taskinstance"...> <h:column > <f:facet name="header"> <h:outputtext value="task Form Link" /> </f:facet> <h:commandlink action="#{homebean.selecttaskinstance}"> <f:param name="taskinstanceid" value="#{taskinstance.id}"/> <h:outputtext value="#{taskinstance.name}" /> </h:commandlink> </h:column>... <h:outputtext value="#{taskinstance.taskmgmtinstance.taskmgmtdefinition.processdefinition.name}" />... <h:outputtext value="#{taskinstance.taskmgmtinstance.taskmgmtdefinition.processdefinition.version}" /> 76 19 4 25

Web : (HomeBean) HomeBean.java public class HomeBean {... JbpmContext jbpmcontext; GraphSession graphsession; TaskMgmtSession taskmgmtsession; public HomeBean() { this.jbpmcontext = JbpmContext.getCurrentJbpmContext(); this.graphsession = jbpmcontext.getgraphsession(); this.taskmgmtsession = jbpmcontext.gettaskmgmtsession(); }... public List gettaskinstances() { return taskmgmtsession.findtaskinstances(userbean.getusername()); }... 77 19 4 25

78 19 4 25