[jboss-user] [jBPM] - Re: My jBPM5.2 doesn't work! Like this......
渊 李
do-not-reply at jboss.com
Thu Mar 22 05:53:24 EDT 2012
渊 李 [https://community.jboss.org/people/c1269355458] created the discussion
"Re: My jBPM5.2 doesn't work! Like this......"
To view the discussion, visit: https://community.jboss.org/message/725538#725538
--------------------------------------------------------------
*servlet listener:*
|
|
|
| EntityManagerFactory emfTask = Persistence.createEntityManagerFactory("org.jbpm.task"); |
|
|
|
| // (EntityManagerFactory) Constants.ctx |
|
|
|
| // .getBean("entityManagerFactory"); |
|
|
|
| TaskService taskService = new TaskService(emfTask, SystemEventListenerFactory.getSystemEventListener()); |
|
|
|
| /* |
|
|
|
| * Add the required users |
|
|
|
| */ |
|
|
|
| TaskServiceSession taskSession = taskService.createSession(); |
|
|
|
| taskSession.addUser(new User("Administrator")); |
|
|
|
| taskSession.addGroup(new Group("Stuff")); |
|
|
|
| taskSession.addUser(new User("kvsi")); |
|
|
|
| taskSession.addGroup(new Group("Manager")); |
|
|
|
| taskSession.addUser(new User("john")); |
|
|
|
| taskSession.addUser(new User("krisv")); |
|
|
|
| /* Start Mina server for HT */ |
|
|
|
| MinaTaskServer server = new MinaTaskServer(taskService); |
|
|
|
| Thread thread = new Thread(server); |
|
|
|
| thread.start(); |
|
|
|
| System.out.println("Server started ..."); |
*struts Action*
StatefulKnowledgeSession session = null;
try {
session = JbpmAPIUtil.createKnowledgeSession("bpmn/apply-leave.bpmn");
session.getWorkItemManager().registerWorkItemHandler("Human Task", new WSHumanTaskHandler());
} catch (Exception e) {
e.printStackTrace();
}
Map<String, Object> params = new HashMap<String, Object>();
params.put("manager", "john");
session.insert(params);
ProcessInstance instance = session.startProcess("bpmn.applyLeave",params);
System.out.println(" \n\n process start : " + instance);
*the other action:*
List<TaskSummary> tasks = JbpmAPIUtil.getTasksAssignedAsPotentialOwner("john");
System.out.println(" size of tasks " + tasks.size());
for (TaskSummary ts : tasks) {
System.out.println("\n\n ts : " + ts);
}
*bpmn:*
actorId : #{manager}
thanks very much!
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/725538#725538]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120322/51677763/attachment-0001.html
More information about the jboss-user
mailing list