Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

Both sides previous revision Poprzednia wersja
Nowa wersja
Poprzednia wersja
Nowa wersja Both sides next revision
pl:dydaktyka:dss:lab2 [2017/10/16 16:02]
kkluza [Testing the model]
pl:dydaktyka:dss:lab2 [2017/10/16 16:11]
kkluza [Executing the process]
Linia 84: Linia 84:
 For more information check [[http://​activiti.org/​javadocs/​|Activiti API]]. For more information check [[http://​activiti.org/​javadocs/​|Activiti API]].
  
 +===== Executing the process =====
  
 +Based on the code used in the unit tests, we can also write a simple application that will launch the process engine for a specific process.
 +
 +In a standalone application,​ you can create a process engine using:
 +<code java> ProcessEngine processEngine = pc.buildProcessEngine(); ​ </​code>​
 +and then, as before, have access to the appropriate services that provide interfaces to the various functionalities:​
 +
 +
 +<code java OfferProcessingExecution.java>​
 +import java.util.*;​
 +import org.activiti.engine.*;​
 +import org.activiti.engine.runtime.ProcessInstance;​
 +
 +public class OfferProcessingExecution {
 +
 + public static void main(String [] args)
 + {
 + ProcessEngineConfiguration pc = ProcessEngineConfiguration
 + .createStandaloneInMemProcessEngineConfiguration();​
 +
 + ProcessEngine processEngine = pc.buildProcessEngine(); ​
 + RepositoryService repositoryService = processEngine.getRepositoryService();​
 + RuntimeService runtimeService = processEngine.getRuntimeService();​
 + IdentityService identityService = processEngine.getIdentityService();​
 + repositoryService.createDeployment()
 + .addClasspathResource("​diagrams/​name.bpmn20.xml"​) ​ /* file name */
 + .deploy();​
 +
 + Map<​String,​ Object> variableMap = new HashMap<​String,​ Object>​();​
 + variableMap.put("​descriptionType",​ "​short"​);​
 + ...
 + identityService.setAuthenticatedUserId("​kermit"​); ​    
 + ProcessInstance processInstance =                     /* provide process id (from the diagram) */
 +                                      runtimeService.startProcessInstanceByKey("​process-id",​ variableMap);​  ​     ​
 + System.out.println("​process instance id: " + processInstance.getId());​
 + }
 +}
 +</​code>​
 +
 +Check the [[http://​activiti.org/​javadocs/​|Activiti Engine API]] and extend your process management application.
 +
 +One possibility of the extension is to start your process with the parameters set in the same way as in the jUnit test. But, at the appropriate time, the application should ask a user for the ''​Specifications details''​ and set this value as a process variable (to set the value you can use [[http://​activiti.org/​javadocs/​org/​activiti/​engine/​RuntimeService.html#​setVariable%28java.lang.String,​%20java.lang.String,​%20java.lang.Object%29|RuntimeService.setVariable]].
 +
 +An example screenshot of such application:​
 +
 +{{:​pl:​dydaktyka:​bim:​lab2:​eclipse-execution-example.png|}}
  
pl/dydaktyka/dss/lab2.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0