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:lab07 [2019/12/15 19:23]
kkluza [Extending model]
pl:dydaktyka:dss:lab07 [2020/12/07 13:28] (aktualna)
kkluza
Linia 1: Linia 1:
-====== ​Basics of BPM systems ​======+====== ​Process execution in a BPM system ​======
  
 ===== Activiti BPM Platform ===== ===== Activiti BPM Platform =====
Linia 7: Linia 7:
   * [[http://​www.manning.com/​rademakers2/​|Activiti in Action]] ​   * [[http://​www.manning.com/​rademakers2/​|Activiti in Action]] ​
  
-During ​the lab, we will use Activiti 5.22. It can be installed ​from [[https://​www.activiti.org/​get-started]]  +This instruction is for labs **30.11.2020** and **07.12.2020**. 
-or used online on the temporary server: [[http://167.172.110.65:​8080/​activiti-explorer/​]].+During ​these labs, we will use Activiti 5.22.  
 +You can install it from [[https://​www.activiti.org/​get-started]]  
 +or use the online ​version ​on the temporary server: [[http://134.209.241.80:​8080/​activiti-explorer/​]]. 
 + 
 +**But please remember to save your working models in files between classes, as the temporary server will not store the data between the classes. Do not change the password for the admin account, otherwise, the restart of the server will be needed and you will lose your models.**
  
 Log in to an admin account: Log in to an admin account:
Linia 20: Linia 24:
   * //Manage// -- other resources, e.g. users, groups, database management or process implementation.   * //Manage// -- other resources, e.g. users, groups, database management or process implementation.
  
-==== Accounts ====+Using the //Groups// tab (//Manage menu//), check the existing user groups.  
 +As an administrator user, **create your own admin account**. 
 +Remember to assign a unique identifier (e.g. with the initials of the people of your group), 
 +so we would not have to use the same kermit user.  
 +You will also need some users who are not administrators,​ 
 +so create new regular user accounts for each person in your group (remember about unique ids).   
  
-On the Groups tab (Manage menu), check the existing user groups. ​ 
-As an administrator user, we will use the kermit user for the time being, ​ 
-but we will also need some users who are not administrators. 
  
-Create your new user. Remember to assign a unique identifier. ​ 
  
 ==== A new process model ==== ==== A new process model ====
  
-In order to get acquainted with the application, ​we will prepare a very simplified model of gathering offers.+In order to get acquainted with the application, ​as an administrator,​ you will prepare a very simplified model of gathering offers.
  
 Select the **Processes** tab from the menu. You should see 3 tabs: Select the **Processes** tab from the menu. You should see 3 tabs:
Linia 37: Linia 43:
   - //Model workspace// -- to create new models and to implement or edit existing process models.   - //Model workspace// -- to create new models and to implement or edit existing process models.
  
-In the opened **Activiti Modeler** application window, set the process attributes ​(on the right side of the window).+In the opened **Alfresco ​Activiti Modeler** application window, set the process attributes.
 The essential elements are the process identifier (//Process identifier//​) and the process name (//Name//), The essential elements are the process identifier (//Process identifier//​) and the process name (//Name//),
 which will allow you to distinguish your process from other processes or other users' processes. ​ which will allow you to distinguish your process from other processes or other users' processes. ​
 Complete also the process author field (//Process author//). Complete also the process author field (//Process author//).
 +
 +{{  :​pl:​dydaktyka:​dss:​lab:​activiti-process-id.png?​500 ​ |}}
  
 ==== Simple process modelling ==== ==== Simple process modelling ====
Linia 48: Linia 56:
 {{  :​pl:​dydaktyka:​bim:​lab1:​proces1-diagram.png ​ |}} {{  :​pl:​dydaktyka:​bim:​lab1:​proces1-diagram.png ​ |}}
  
-As in the case of the process, for the BPMN elements, ​we can set the attributes ​on the right side.+As in the case of the process, for the BPMN elements, ​you can set the selected ​attributes:
    
-  * For //Start event//:+  * for //Start event//:
     * //​Documentation//:​ Start proceeding with an offer.     * //​Documentation//:​ Start proceeding with an offer.
     * //​Initiator//:​ initiator (the user who initiated the process will be stored in this variable)     * //​Initiator//:​ initiator (the user who initiated the process will be stored in this variable)
     * //Name//: Offer received     * //Name//: Offer received
-    * //Form properties//​ - click on ... and in the new window set the properties according to the following screenshot:​\\ +    * //Form properties// ​-- click on ... and in the new window set the properties according to the following screenshot:​\\
-{{  :​pl:​dydaktyka:​bim:​lab1::​form-properties.png ​ |}}+
  
-  ​For //Specify offer// task:+{{  :​pl:​dydaktyka:​dss:​lab:​form-properties-alfresco.png?​400 ​ |}} 
 + 
 +  ​for //Specify offer// task:
     * //​Documentation//:​ Please add available specification for an offer as attachments.     * //​Documentation//:​ Please add available specification for an offer as attachments.
-    * //​Assignments//: ​we have three possibilities\\+    * //​Assignments//: ​there are three possibilities\\
       * ''​assignee''​ -- assign a task to a specific user,       * ''​assignee''​ -- assign a task to a specific user,
       * ''​candidateUsers''​ -- assign a task so that any of several users can perform it,       * ''​candidateUsers''​ -- assign a task so that any of several users can perform it,
Linia 66: Linia 75:
 In our case, set only the variable ''​assignee''​ to ''​${initiator}''​ -- this means that as a task executor, we indicate the person who started the process. In our case, set only the variable ''​assignee''​ to ''​${initiator}''​ -- this means that as a task executor, we indicate the person who started the process.
  
-In addition, for this task we also set //Form properties//:​+In addition, for this taskwe also set //Form properties//:​
    * //​Specifications details// (id: ''​specDetails''​) -- level of detail of the specification of the contract offer (for now we set it as a ''​boolean''​),​ in the next part, we will transform this variable into an enum type (accurate, sufficient, insufficient).    * //​Specifications details// (id: ''​specDetails''​) -- level of detail of the specification of the contract offer (for now we set it as a ''​boolean''​),​ in the next part, we will transform this variable into an enum type (accurate, sufficient, insufficient).
    * //Person responsible//​ (id: ''​responsible''​) -- a person assigned to the formal analysis of the application (responsible for carrying out the analysis); such a person will be assigned to a variable.    * //Person responsible//​ (id: ''​responsible''​) -- a person assigned to the formal analysis of the application (responsible for carrying out the analysis); such a person will be assigned to a variable.
Linia 75: Linia 84:
 ==== Executing a simple process model ==== ==== Executing a simple process model ====
  
-Save a model and exit **Activiti Modeler**.+Save a model and exit **Alfresco ​Activiti Modeler**.
 Go back to **Activiti Explorer**. Go back to **Activiti Explorer**.
 In //Model workspace//,​ select your process from the menu In //Model workspace//,​ select your process from the menu
Linia 95: Linia 104:
  
 Historic data of the process are saved in the database, which is available in the //​Database//​ tab (in the **Manage** tab). Find the table ''​ACT_HI_PROCINST''​ and find your process there.  ​ Historic data of the process are saved in the database, which is available in the //​Database//​ tab (in the **Manage** tab). Find the table ''​ACT_HI_PROCINST''​ and find your process there.  ​
-Because for this laboratory, Activiti installation with Activiti Modeler does not save models permanently,​ save your model on the hard disk. To do this from the menu //​Deployments//​ select //Show all// and search for your process. Save your process file (file with extension **.bpmn20.xml**) and view its syntax. Note some process tag attributes, as well as the additional attributes of other process elements used by Activiti.+Because for this laboratory, Activiti installation with Alfresco ​Activiti Modeler does not save models permanently,​ save your model on the hard disk. To do this from the menu //​Deployments//​ select //Show all// and search for your process. Save your process file (file with extension **.bpmn20.xml**) and view its syntax. Note some process tag attributes, as well as the additional attributes of other process elements used by Activiti.
  
  
Linia 111: Linia 120:
  
  
-===== Dalsza rozbudowa modelu ​=====+===== Further model extensions ​=====
  
 === Timer Boundary Event === === Timer Boundary Event ===
  
-Nasz podproces składa się z dwóch zadań, polegających na tym, że kontaktujemy się z klientem mailowo oraz dodatkowo dzwonimy do niego, by poinformować o przesłanym mailuW bardzo szczegółowej wersji powinniśmy jeszcze mieć odpowiednie zadanie z oczekiwaniem na odpowiedź od klienta ​-- dla uproszczenia przyjmijmyże gdy klient uszczegółowił wystarczająco przez telefon informacje, to użytkownik kończy zadanie ​"Call customer", ​w innym wypadku nie kończy tego zadania ​do czasu, aż nie uzyska wystarczających informacji.+Your subprocess consists of two taskscontacting the customer ​by e-mail and phone (call to inform about the e-mail sent to the customer)In a very detailed version, we should additionally have an appropriate task waiting for a response from the customer ​-- but for simplicity let's assume that when the customer has provided detailed information by phonethe user ends the task "Call customer", ​otherwise they do not finish this task until they receive sufficient information.
  
-W standardowym przypadkugdy minie deadline ​na składanie ofertpodproces powinien automatycznie zakończyć się i zakończyć cały procesW tym celu rozbudujemy proces przy użyciu ​''​Timer Boundary Event'':​+In the standard casewhen the deadline ​for submitting offers has passedthe subprocess should automatically end and finish the whole processFor this purpose, expand the process using the ''​Timer Boundary Event'':​
  
 {{  :​pl:​dydaktyka:​bim:​lab1:​process5-eclipse-example.png?​800 ​ |}} {{  :​pl:​dydaktyka:​bim:​lab1:​process5-eclipse-example.png?​800 ​ |}}
  
-Element ​''​Timer Boundary Event'' ​ma następujące atrybuty+''​Timer Boundary Event'' ​has the following attributes
-  * ''​cancelActiviti''​ -- w naszym przypadku należy ustawić ​**''​true''​**, by podproces został przerwany w momnecie wywołania zdarzenia+  * ''​cancelActiviti''​ -- in our case, set **''​true'''​** ​to interrupt the subprocess at the moment when the event is triggered
-  * ''​timeDate''​ -- ustawia konkretną datę (w formacie ​[[wp>ISO 8601]]), ​kiedy odpalić zdarzenienp.+  * ''​timeDate''​ -- sets a specific date (in the format ​[[wp>ISO 8601]]]), when to trigger an evente.g.:
 <code xml> <code xml>
 <​timerEventDefinition>​ <​timerEventDefinition>​
Linia 129: Linia 138:
 </​timerEventDefinition>​ </​timerEventDefinition>​
 </​code>​ </​code>​
-  *  ''​timeDuration''​ -- ustawia okres czasuktóry musi minąć aż zdarzenie zostanie wyzwolone, npdla dni+  *  ''​timeDuration''​ -- sets the period of time that must elapse before an event is triggerede.gfor days
 <code xml> <code xml>
 <​timerEventDefinition>​ <​timerEventDefinition>​
Linia 135: Linia 144:
 </​timerEventDefinition>​ </​timerEventDefinition>​
 </​code>​ </​code>​
-  * ''​timeCycle''​ -- ustawia powtarzające się interwały czasuby wyzwalać zdarzenie periodycznie,​ np. 5 powtórzeńz których każde trwa godzinę:+  * ''​timeCycle''​ -- sets time intervals to trigger an event periodically (repeat it)e.g. 5 repetitionseach for an hour:
 <code xml> <code xml>
 <​timerEventDefinition>​ <​timerEventDefinition>​
Linia 142: Linia 151:
 </​code>​ </​code>​
  
-Aby móc przetestować proces i nie czekać zbyt długo na efekty proponuję ustawić ​''​timeDuration'' ​na minuty.+In order to be able to test the process and not wait too long for the effects, just set the ''​timeDuration'' ​to minutes.
  
-Proszę przetestować działanie swojego modeluobejrzeć ​diagram ​instancji procesu w czasie oczekiwania ​(powinien wyglądać podobnie do modelu widocznego na poniższym diagramie):+Test your modelcheck the diagram ​of the process instance while waiting ​(it should look similar to the model shown in the diagram below):
 {{  :​pl:​dydaktyka:​bim:​lab1:​process5-run-example.png?​800 ​ |}} {{  :​pl:​dydaktyka:​bim:​lab1:​process5-run-example.png?​800 ​ |}}
  
-W tym momencie w zakładce ​**Manage** -> **Jobs** ​powinien pojawić się nowy ''​Timer job''​W razie potrzeby istnieje tu możliwość ręcznego wyzwolenia zdarzenia przyciskiem ​**Execute**:​+At this point, a new "Timer job" should appear in the tab **Manage** -> **Jobs**. ​ 
 +If necessary, the event can be triggered manually by pressing the **Execute** ​button:
  ​{{ ​ :​pl:​dydaktyka:​bim:​lab1:​timer-job.png ​ |}}  ​{{ ​ :​pl:​dydaktyka:​bim:​lab1:​timer-job.png ​ |}}
  
 === Mail task === === Mail task ===
  
-Jedno z zadań w podprocesie powinno wysyłać ​mail do klienta. \\ +One of the tasks in the subprocess should send an e-mail to the client. \\ 
-W pełnym procesie wcześniej należałoby pobrać dodatkowe dane do przesłania maila \\ +In the full process, it would be necessary to download additional data to send an e-mail beforehand. 
-np. jakich szczegółów chcielibyśmy się dowiedzieć,\\ +e.g., what kind of details we'd like to know about. 
-natomiast u nas na razie zamarkujemy działanie tego zadania.+If you use your Activiti installation,​ you can mock the operation of this task. 
 + 
 +If you do not have a configured mail server, you can address the mail to a local address, e.g: "​student@AML-Lab-316.geist.agh.edu.pl"​.\\  
 +After sending the e-mailyou can check the e-mail in the terminal with the "​mail"​ command, if you received the message to the mailbox. 
 + 
 +Please include in the body of the e-mail data held in a variable of the process instance. 
 + 
 +=== Script task === 
 + 
 +Some of the extensions below may require to use an Activiti Designer extension to an Eclipse platform. 
 + 
 +Extend the model to the form as shown in the diagram below:\\ 
 + 
 +{{  :​pl:​dydaktyka:​bim:​lab3:​process8-eclipse-example.png ​ |}} 
 + 
 +For the given properties prepare a form in //Set formal conditions//​ task (boolean type): 
 +  * ''​formalCertificates''​ -- The company has the required certificates 
 +  * ''​formalExperience''​ -- The company has sufficient experience 
 +  * ''​formalConflicts''​ -- Offer causes conflict with other orders 
 + 
 +Depending on your needs, you can set the default values in the appropriate fields using the ''​default''​ attribute. 
 + 
 +In the //Check formal conditions//​ task, select the language ''​groovy'',​ then set the appropriate value (''​negative''​ or ''​positive''​) of the ''​resOffer''​ variable. To define a variable in the groove and then export it to your process, use the following syntax: 
 +<code groovy>​ 
 +def resOffer = "​negative" ​  
 +/* TODO: check the conditions and if necessary,  
 +convert resOffer to positive 
 +*/ 
 +execution.setVariable("​result",​ resOffer) 
 +</​code>​ 
 + 
 +The variable can also be displayed within some //​UserTask//​ by adding a tag in XML: 
 +<code xml><​documentation>​Formal condition check result is: ${result}</​documentation></​code>​ 
 + 
 +The elements of the [[wp>​Groovy (programming language)]] are supported according to its syntax. For checking the syntax, you  can try [[http://​groovyconsole.appspot.com/​|online console]]. 
 + 
 +{{:​pl:​dydaktyka:​bim:​lab3:​eclipse2-designer-gateway.png?​200 ​ |}} 
 + 
 +** Completion of the process with a negative result ** 
 + 
 +If the result of the formal fulfillment of the conditions is negative, the process should end. 
 +Add a gateway that will control the flow depending on the result, in order to finish the process accordingly.
  
-Nie mamy skonfigurowanego serwera poczty, ale możemy zaadresować maila na adres lokalny, \\ np.: ''​student@AML-Lab-316.geist.agh.edu.pl''​.\\  +=== Multi instance task ===
-Po przesłaniu maila możemy sprawdzić w terminalu poleceniem ''​mail'',​ czy mamy go na skrzynce.+
  
-Proszę w treści maila umieścić dane trzymane w jakiejś zmiennej instancji procesu.+** Approval of the offer by the members of the Management Board **
  
 +In order to complete the process, we will model the approval of the offer by the members of the Management Board.
  
 +{{  :​pl:​dydaktyka:​bim:​lab3:​explorer2-execution-multiinstance.png|}}
 +For this purpose, the "​Approve offer" task should be defined as multi-instance task. \\
 +The following parameters are available in the ''​Multi instance''​ tab in the Activiti eclipse environment: ​
 +  * **Sequential** -- sequential (''​true''​) or parallel (''​false''​) execution,
 +  * **Loop cardinality** -- number of instances (checked only once, when creating a task), ​
 +  * **Collection** -- collection variable (a list of users who are to perform the task),
 +  * **Element variable** -- a variable that stores individual users in order to assign them to a task,
 +  * **Completion condition** -- the condition for completing the task.
  
 +In [[https://​www.activiti.org/​5.x/​userguide/​|Activiti User Guide]], check how to define the appropriate condition for completing a task.
 +Let's assume that the Company considers a board decision to have been made if it was made by at least two of the three board members. Since we have not yet defined the board variable, please add the board variable, which is a list of board members (consisting of existing Activiti users). ​
  
 +Then, start the process and test it for different scenarios.
pl/dydaktyka/dss/lab07.1576434238.txt.gz · ostatnio zmienione: 2019/12/15 19:23 przez kkluza
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