[Design of JBoss jBPM] - Re: jbpm-api first draft
by thomas.diesler@jboss.com
This seems a bit long winded
| // Locate the ProcessEngine
| ProcessEngine engine = ProcessEngineLocator.locateProcessEngine();
|
| // Create a ProcessDefinition through the ProcessDefinitionManager
| ProcessDefinitionManager pdm = engine.getProcessDefinitionManager();
| ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
|
| // Create a ProcessInstance through the ProcessInstanceManager
| ProcessInstanceManager pim = engine.getProcessInstanceManager();
| ProcessInstance pi = pim.createProcessInstance(pd);
|
| // Create an Execution through the ExecutionManager
| ExecutionManager pem = engine.getExecutionManager();
| Execution ex = pem.createExecution(pi);
|
and could probably be done much shorter - like this
| // Create a ProcessDefinition through the ProcessDefinitionManager
| ProcessDefinitionManager pdm = ProcessDefinitionManager.locateProcessDefinitionManager();
| ProcessDefinition pd = pdm.createProcessDefinition(jpdl);
|
| // Create an Execution through the ProcessDefinition
| Execution ex = pd.createExecution(pi);
|
Note however, that this would only introduce convenience access and not change the first approach conceptually.
The API is designed such that objects can be navigated bi-directional. In other words, the ProcessDefinition can get the ProcessInstanceManager and the ExecutionManager and invoke createExecution that way.
I'd like to introduce convenience short cuts when it becomes clear what the most frequent use cases are.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4159442#4159442
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4159442