bpmn2user [
http://community.jboss.org/people/bpmn2user] created the discussion
"Re: Eclipse -jBPM5/CR1 - Human Task View"
To view the discussion, visit:
http://community.jboss.org/message/579407#579407
--------------------------------------------------------------
Thanks! Snapshot plug-in is good .
Here is an example I used.
public class TestJBPMHumanTask {
@SuppressWarnings("unchecked")
public static void main(String[] args) throws Exception {
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("org.jbpm.task");
TaskService taskService = new TaskService(emf,
SystemEventListenerFactory.getSystemEventListener());
TaskServiceSession taskSession = taskService.createSession();
taskSession.addUser(new User("Administrator"));
taskSession.addUser(new User("bob"));
// start server
MinaTaskServer server = new MinaTaskServer(taskService);
Thread thread = new Thread(server);
thread.start();
System.out.println("Server started ...");
KnowledgeBase kbase = readKnowledgeBase();
StatefulKnowledgeSession ksession = createSession(kbase);
KnowledgeRuntimeLogger logger =
KnowledgeRuntimeLoggerFactory.newThreadedFileLogger(ksession, "testlog", 1000);
ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new
WSHumanTaskHandler());
ksession.startProcess("com.sample.bpmn.humantask");
logger.close();
}
private static KnowledgeBase readKnowledgeBase() throws Exception {
ProcessBuilderFactory.setProcessBuilderFactoryService(new
ProcessBuilderFactoryServiceImpl());
ProcessMarshallerFactory.setProcessMarshallerFactoryService(new
ProcessMarshallerFactoryServiceImpl());
ProcessRuntimeFactory.setProcessRuntimeFactoryService(new
ProcessRuntimeFactoryServiceImpl());
BPMN2ProcessFactory.setBPMN2ProcessProvider(new BPMN2ProcessProviderImpl());
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(ResourceFactory.newClassPathResource("SampleHumanTask.bpmn2"),
ResourceType.BPMN2);
return kbuilder.newKnowledgeBase();
}
private static StatefulKnowledgeSession createSession(KnowledgeBase kbase) {
Properties properties = new Properties();
properties.put("drools.processInstanceManagerFactory",
"org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
properties.put("drools.processSignalManagerFactory",
"org.jbpm.process.instance.event.DefaultSignalManagerFactory");
KnowledgeSessionConfiguration config =
KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
return kbase.newStatefulKnowledgeSession(config,
EnvironmentFactory.newEnvironment());
}
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/579407#579407]
Start a new discussion in jBPM at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]