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
pl:dydaktyka:dss:lab2 [2017/10/16 16:04]
kkluza [Extending the test]
pl:dydaktyka:dss:lab2 [2017/10/17 14:46]
kkluza [m2e plugin installation]
Linia 7: Linia 7:
 ===== m2e plugin installation ===== ===== m2e plugin installation =====
  
-If the m2e plugin is not installed in your eclipse environment,​ please install it from the address: [[http://​download.eclipse.org/​technology/​m2e/​releases/​Maven Integration for Eclipse]] version 1.4.1. \\+If the m2e plugin is not installed in your eclipse environment,​ please install it from the address: [[http://​download.eclipse.org/​technology/​m2e/​releases/​]] Maven Integration for Eclipse version 1.4.1. \\
 If slf4j plugin is missing as well, you can install them from another repository, e.g., http://​www.fuin.org/​p2-repository/​. \\ If slf4j plugin is missing as well, you can install them from another repository, e.g., http://​www.fuin.org/​p2-repository/​. \\
 After installation,​ remember to restart Eclipse. After installation,​ remember to restart Eclipse.
Linia 85: Linia 85:
  
 ===== Executing the process ===== ===== 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