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 15:47]
kkluza [Project and model development]
pl:dydaktyka:dss:lab2 [2019/06/27 15:50] (aktualna)
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 33: Linia 33:
 <WRAP center round alert 60%> <WRAP center round alert 60%>
 If the test did not pass properly because e.g. not all libraries could be loaded, ​ If the test did not pass properly because e.g. not all libraries could be loaded, ​
-please adjust the version of Activiti on your computer. ​\\ +please adjust the version of Activiti on your computer. 
-To do this, we need to change the version of Actviti to 5.XX \\ (where XX is the correct version) in the '​pom.xml'​ file. \\+To do this, we need to change the version of Actviti to 5.XX (where XX is the correct version) in the '​pom.xml'​ file. 
 You can also check the configuration file ''​activiti.cfg.xml''​ describing the Activiti mode. It should be in the directory: ''​src/​main/​resources/''​. You can also check the configuration file ''​activiti.cfg.xml''​ describing the Activiti mode. It should be in the directory: ''​src/​main/​resources/''​.
 </​WRAP>​ </​WRAP>​
Linia 54: Linia 54:
 </​code>​ </​code>​
  
 +===== Extending the test =====
  
  
 +Using the interface available through ''​ TaskService ''​ and ''​ FormService '',​ test the model from the previous classes (as below, if not timed) for two scenarios (selecting each of the XOR gateways).
  
 +{{:​pl:​dydaktyka:​bim:​lab2:​process5-eclipse-example.png?​800|}}
  
 +Useful snippets of code:
 +
 +  * user authentication (in this case: kermit):
 +<code java>
 +identityService.setAuthenticatedUserId("​kermit"​);​
 +</​code> ​
 +  * interface for downloading a task list for a specific user:
 +<code java>
 +List<​Task>​ taskList = taskService.createTaskQuery().processInstanceId(arg0).taskAssignee(arg0).list()
 +</​code>​
 +  * if the task is successfully completed, we can call:
 +<​code>​
 +taskService.complete(arg0);​
 +</​code>​
 +  * interface for viewing the forms:
 +<code java>
 +FormService formService = processEngine.getFormService();​
 +TaskFormData taskFormData = formService.getTaskFormData(taskList.get(0).getId());​
 +List<​FormProperty>​ formList = taskFormData.getFormProperties();​
 +</​code>​
 +
 +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.1508161639.txt.gz · ostatnio zmienione: 2019/06/27 15:57 (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