How to retrieve information from jBPM (Different VM)
fwshk Feb 15, 2006 5:03 AMHi all,
My configuration:
jbpm-starters-kit-3.1
Windows XP
How to retrieve information from jBPM (Different VM)
Would you like to tell me if there is any available API?
Also, I would like to know if I used MySQL as jBPM's database, will the jBPM fail of some features?
Last question, what is the reason of the below code always return same output?
public static final String CONFIG_FILE = "jbpm.cfg.xml";
public static final String ACTOR_ID = "ernie";
public static final String PAR_RESOURCE = "simple.par";
public static void main(String[] args) {
// Configure jBPM by passing configure file's resource path
JbpmConfiguration lJbpmConfiguration = JbpmConfiguration.getInstance(CONFIG_FILE);
// Create database schema into database
// Comment the create schema will throw exception >.<
lJbpmConfiguration.createSchema();
// Start jBPM server
JbpmContext lJbpmContext = lJbpmConfiguration.createJbpmContext();
try {
// Deploy process
lJbpmContext.deployProcessDefinition(ProcessDefinition.parseParResource(PAR_RESOURCE));
// Login user
lJbpmContext.setActorId(ACTOR_ID);
// Retrieve task list
List lTaskList = lJbpmContext.getTaskList();
System.out.println("Task: " + lTaskList.size());
for (int i = 0; i < lTaskList.size(); i++) {
Task lTask = (Task) lTaskList.get(i);
System.out.println("- " + lTask.getName());
}
// Retrieve process list
List lProcessList = lJbpmContext.getGraphSession().findAllProcessDefinitions();
System.out.println("Process: " + lProcessList.size());
for (int i = 0; i < lProcessList.size(); i++) {
ProcessDefinition lProcessDefinition = (ProcessDefinition) lProcessList.get(i);
System.out.println("- " + lProcessDefinition.getName());
// Retrieve process version list
List lVersionList = lJbpmContext.getGraphSession().findAllProcessDefinitionVersions(
lProcessDefinition.getName());
System.out.println("> Version: " + lVersionList.size());
for (int j = 0; j < lVersionList.size(); j++) {
System.out.println("-- " + lVersionList.get(j));
}
}
} finally {
lJbpmContext.close();
}
}
The output
Task: 0 Process: 1 - simple > Version: 1 -- ProcessDefinition(simple)
Any reply are welcome and thank you very much.
Roy