Source Code Cross Referenced for ExecutionHistoryApis.java in  » Workflow-Engines » bonita-v3.1 » client » Java_client » 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 » client.Java_client 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package client.Java_client;
002:
003:        import javax.security.auth.login.LoginContext;
004:        import hero.client.test.SimpleCallbackHandler;
005:
006:        import hero.historic.NodeHistoric;
007:        import hero.historic.ProjectHistoric;
008:        import hero.historic.PropertyHistoric;
009:        import hero.interfaces.*;
010:
011:        import java.util.*;
012:
013:        public class ExecutionHistoryApis {
014:
015:            static public void main(String[] args) throws Exception {
016:
017:                char[] password = { 'b', 's', 'o', 'a' };
018:                SimpleCallbackHandler handler = new SimpleCallbackHandler(
019:                        "bsoa", password);
020:                LoginContext lc = new LoginContext("TestClient", handler);
021:                lc.login();
022:
023:                ProjectSessionHome projectSessionh = ProjectSessionUtil
024:                        .getHome();
025:                ProjectSession pss = projectSessionh.create();
026:
027:                // Creates an instance of this process
028:                pss.instantiateProject("Approval_workflow");
029:
030:                UserSessionHome userSessionh = UserSessionUtil.getHome();
031:                UserSession uss = userSessionh.create();
032:
033:                // Get Todo list for this user for all running instances
034:                Collection activites = uss.getToDoListAllInstances();
035:
036:                Iterator acts = activites.iterator();
037:                while (acts.hasNext()) {
038:                    BnNodeValue activity = (BnNodeValue) acts.next();
039:                    pss.initProject(activity.getBnProject().getName());
040:                    pss.setNodeProperty("Approval", "decision", "grant");
041:                    uss.startActivity(activity.getBnProject().getName(),
042:                            activity.getName());
043:                    uss.terminateActivity(activity.getBnProject().getName(),
044:                            activity.getName());
045:
046:                    activites = uss.getToDoListAllInstances();
047:                    acts = activites.iterator();
048:                }
049:
050:                // At this point the workflow instance is finished (all activities are done)
051:                // and so the instance related data is saved in a separate repository.
052:                // The HistoryAPI allows to retrieve data from finished instances.
053:
054:                HistorySessionHome hsh = HistorySessionUtil.getHome();
055:                HistorySession hs = hsh.create();
056:
057:                Collection pl = hs.getHistoryProjectList();
058:                Iterator projects = pl.iterator();
059:                while (projects.hasNext()) {
060:                    // Getting process names having finished instances
061:
062:                    String projectName = (String) projects.next();
063:                    System.out.println("Process Name = " + projectName);
064:
065:                    // Getting finished instances for this process			
066:                    Collection instances = hs
067:                            .getHistoryInstancesList(projectName);
068:                    Iterator insts = instances.iterator();
069:                    while (insts.hasNext()) {
070:                        String instName = (String) insts.next();
071:
072:                        int index = instName.indexOf(".xml");
073:                        instName = instName.substring(0, index);
074:
075:                        System.out.println("Instance Name = " + instName);
076:                        ProjectHistoric ph = (ProjectHistoric) hs
077:                                .getHistoryInstance(instName);
078:                        System.out.println("Name = " + ph.getName());
079:                        System.out.println("Version = " + ph.getVersion());
080:                        System.out.println("Creation Date = "
081:                                + ph.getCreationDate());
082:                        System.out.println("End Date = " + ph.getEndDate());
083:                        System.out.println("Initiator = " + ph.getInitiator()
084:                                + "\n");
085:
086:                        // Getting instance properties
087:                        Collection properties = ph.getProperties();
088:
089:                        Iterator props = properties.iterator();
090:                        while (props.hasNext()) {
091:                            PropertyHistoric propH = (PropertyHistoric) props
092:                                    .next();
093:                            System.out.println("Property Key = "
094:                                    + propH.getKey());
095:                            System.out.println("Property Value = "
096:                                    + propH.getValue() + "\n");
097:                        }
098:
099:                        // Getting instances activities
100:                        Collection nodes = ph.getNodes();
101:
102:                        Iterator nds = nodes.iterator();
103:                        while (nds.hasNext()) {
104:                            NodeHistoric nodeH = (NodeHistoric) nds.next();
105:                            System.out
106:                                    .println("Node name = " + nodeH.getName());
107:                            System.out.println("Node Description = "
108:                                    + nodeH.getDescription());
109:                            System.out.println("Node End date = "
110:                                    + nodeH.getEndDate());
111:                            System.out.println("Node Start date = "
112:                                    + nodeH.getStartDate() + "\n");
113:                        }
114:                    }
115:
116:                }
117:                pss.remove();
118:            }
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.