Source Code Cross Referenced for Sample1CreateSubProcessModel.java in  » Workflow-Engines » bonita-v3.1 » hero » client » samples » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Workflow Engines » bonita v3.1 » hero.client.samples 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         *
003:         * Bonita
004:         * Copyright (C) 1999 Bull S.A.
005:         * Bull 68 route de versailles  78434 Louveciennes Cedex France
006:         * Further information: bonita@objectweb.org
007:         *
008:         * This library is free software; you can redistribute it and/or
009:         * modify it under the terms of the GNU Lesser General Public
010:         * License as published by the Free Software Foundation; either
011:         * version 2.1 of the License, or any later version.
012:         *
013:         * This library is distributed in the hope that it will be useful,
014:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
015:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:         * Lesser General Public License for more details.
017:         *
018:         * You should have received a copy of the GNU Lesser General Public
019:         * License along with this library; if not, write to the Free Software
020:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
021:         * USA
022:         *
023:         *
024:        --------------------------------------------------------------------------
025:         * $Id: Sample1CreateSubProcessModel.java,v 1.3 2004/11/10 17:10:50 mvaldes Exp $
026:         *
027:        --------------------------------------------------------------------------
028:         */package hero.client.samples;
029:
030:        import javax.security.auth.login.LoginContext;
031:        import hero.client.test.SimpleCallbackHandler;
032:
033:        import hero.interfaces.ProjectSession;
034:        import hero.interfaces.ProjectSessionHome;
035:        import hero.interfaces.ProjectSessionUtil;
036:
037:        import hero.interfaces.Constants;
038:
039:        public class Sample1CreateSubProcessModel {
040:
041:            static public void main(String[] args) throws Exception {
042:                // User Admin login
043:                char[] password = { 't', 'o', 't', 'o' };
044:                SimpleCallbackHandler handler = new SimpleCallbackHandler(
045:                        "admin", password);
046:                LoginContext lc = new LoginContext("TestClient", handler);
047:                lc.login();
048:
049:                // Creation of Bonita Project "Customer Service " 
050:                // It will be used as Sub Process in our complete Order Processing Project
051:
052:                // Collaboration Project Session Bean Creation using Remote Interface
053:                ProjectSessionHome prjHome = (ProjectSessionHome) ProjectSessionUtil
054:                        .getHome();
055:                ProjectSession prjSession = prjHome.create();
056:
057:                // Customer Service project creation
058:                prjSession.initModel("Customer Service");
059:
060:                //Process Model creation by user admin	  
061:                // Activities creation : non anticipative : traditional execution mode)
062:                // Two activities are created : "Ask Customer" and "Notify Sales"
063:                prjSession.addNode("Ask Customer", Constants.Nd.AND_JOIN_NODE);
064:                prjSession.setNodeTraditional("Ask Customer");
065:
066:                prjSession.addNode("Notify Sales", Constants.Nd.AND_JOIN_NODE);
067:                prjSession.setNodeTraditional("Notify Sales");
068:
069:                // Activities connection : Set edges between nodes
070:                prjSession.addEdge("Ask Customer", "Notify Sales");
071:
072:                // Set node hook
073:                // First hook is in charge of printing information
074:                String scriptHook1 = "import hero.interfaces.*;\n"
075:                        + "import hero.interfaces.BnNodeLocal;\n"
076:                        + "afterStart (Object b,Object n) {\n\n\n"
077:                        + "System.out.println(\"customer name: \"+ customer_name);"
078:                        + "System.out.println(\"product name: \"+ product_name);"
079:                        + "System.out.println(\"items : \"+ items );" + "}";
080:                prjSession.addNodeInterHook("Ask Customer", "order data",
081:                        Constants.Nd.AFTERSTART, Constants.Hook.BSINTERACTIVE,
082:                        scriptHook1);
083:                // second hook is in charge of creating a new property containing the user order confirmation choice : 
084:                // partial_sales_status
085:                String scriptHook2 = " import hero.interfaces.* ;"
086:                        + "import hero.interfaces.BnNodeLocal;\n"
087:                        + "afterTerminate (Object b,Object n) {\n\n\n"
088:                        + "System.out.println(\"partial_sales_status = OK\"); \n"
089:                        + "hero.interfaces.ProjectSessionLocalHome pHome = (hero.interfaces.ProjectSessionLocalHome) hero.interfaces.ProjectSessionUtil.getLocalHome(); \n"
090:                        + "hero.interfaces.ProjectSessionLocal subProcess = pHome.create(); \n"
091:                        + "subProcess.initModel(n.getBnProject().getName()); \n"
092:                        + "subProcess.setProperty(\"partial_sales_status\",\"ok\"); \n"
093:                        + "}";
094:                prjSession.addNodeInterHook("Notify Sales", "Set property",
095:                        Constants.Nd.AFTERTERMINATE,
096:                        Constants.Hook.BSINTERACTIVE, scriptHook2);
097:
098:                // Add roles to this process
099:                prjSession.addRole("agent", "Customer Service agent");
100:                prjSession.addRole("customer", "Sales order customer");
101:
102:                // specify role for each node
103:                prjSession.setNodeRole("Ask Customer", "customer");
104:                prjSession.setNodeRole("Notify Sales", "agent");
105:
106:                // Use Mappers for the role resolution
107:                prjSession.addRoleMapper("agent",
108:                        "hero.mapper.Sample1CustomAgentGroupMembers",
109:                        Constants.Mapper.CUSTOM);
110:                prjSession.addRoleMapper("customer",
111:                        "hero.mapper.Sample1CustomCustomerGroupMembers",
112:                        Constants.Mapper.CUSTOM);
113:            }
114:
115:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.