Please disable Adblockers and enable JavaScript for domain CEWebS.cs.univie.ac.at! We have NO ADS, but they may interfere with some of our course material.

# Workflow Execution

Use the following workflow engine:

Make sure all software you write runs on:

• almighty.cs.univie.ac.at, abgabe.cs.univie.ac.at
• Protokoll: ssh/sftp
• Pass: Unet Passwort
Use one (or many) of the following technologies – your choice:

• JAVA, please create standlone microservices (no tomcat, jboss, …), e.g.
• jetty (JAR)
• use abgabe.cs.univie.ac.at:9000-10000
• PHP (subdirectory public_html on almighty.cs.univie.ac.at)
• Ruby (abgabe.cs.univie.ac.at:9000-10000)
• Javascript (nodejs) (abgabe.cs.univie.ac.at:9000-10000)
For UI’s, HTML/JS is obligatory (subdirectory public_html on almighty.cs.univie.ac.at).

## Assignment 4a - Modell (5 points)

Port your process to CPEE (including data flow) and use the predefined timeout servive as endpoint.

Include the data flow from Aristaflow 3a.

If scripttasks are necessary, use them:

• Access datatelements with
data.someValue = 12
data.anotherValue + 1
data.str = "aaaaa"

• Random number (directly assigned to instance variable randomStr)
data.randomBool = [true, false].sample
data.randomStr = ["red", "blue", "green", "yellow", "violet", "orange"].sample

• The script language is ruby, don't use "includes/requires" please.
Solution approach 1 (~ 2 minutes) - might not work but worth a try:

• modeltype to signavio
• If the import is not successful, proceed to solution approach 2.
• Wherever you use the endpoint timeout (tip everywhere) add the parameter timeout (value 2).
Solution approach 2 (~ 10 minutes):

• Modeling by hand
• Do step 4 of solution approach 1
Submit the following two files:

• Signavio Modell + screenshot of model in cockpit in a PDF (.pdf)
• Tested CPEE Template (a0xxxxxxx.xml)
WARNING:
• 0 points if Matnr (a0xxxxxxx format) is not included in Attribute info.
• 0 points if Dataflow is not ported from 3a.

## Assignment 4b - Runtime (10 points)

Write a set of REST web-services that replace the "timeout" services from a. REALLY. Replace EVERY occurrence of timeout with your own services.

• Every service should do something.
• Services for Signavio tasks with a human or a hand, should deliver random values.
• Services for Signavio tasks with a gear should do SOMETHING (decide something, return data read from FS, …, NO RANDOM)
• (Almost) all services should have INPUT PARAMETER. Otherwise, how should they know what to do? Services for User human tasks have at
least the following parameters:
• role (string)
• organisation (string)
• link to a static html form that collects the returned data (non functional, by mockup state) (string - http://…/xxx.html).
• ALMOST ALWAYS services should return something (depends on scenario).
• If the label says "send mail", send a mail.
p.s. it is still allowed to change the Signavio model (changing labels is NOT allowed, change manual/automatic is allowed within
the boundaries of reason).

Important:

• Tasks have Input (\$_REQUEST in PHP).
• Tasks have Output which can be used in finalize to fill data elements (e.g. for JSON data.x = result['y']).
• How often to run through loops is typically the result of data coming from process tasks.
• use rand() stuff from services, so that not all instances are the same.
Hand in three files:

• Signavio Modell as .pdf
• CPEE Template .xml
• Source Code .zip
WARNING 1:
• 0 points if Matnr (a0xxxxxxx format) is not included in Attribute info.
• 0 points if Dataflow is not ported from 3a.
• 0 points if it is not runnable (for at least until the end of semester) or any timeout's remain.
• 0 points if parameters for human task do not follow the required schema.

## Assignment 4c - Worklist (12 points)

A worklist is a program that allows process actors (i.e. humans) to interact with a process (the person that clicks execute in the CPEE Cockpit is not a process actor).

To realize a worklist, every human task (at least 4 tasks with a hand or a human in your Signavio model!) is REQUIRED to have EXACTLY the following additional parameters:

• organization, which represents the name of the organization (or organizational unit) to work on the task.
• role, that is intended to deliver the data that is bound to be returned by the task.
• form, that should be filled out by the user.
Of course there are MOST POSSIBLY additional input parameters. Each task should be realized as asynchronous task:

1. When the task is called, save all parameters and tell the CPEE that you will answer later.
2. Show the Task List for the users (assigned to the role). Each line in the list should contain the name of the task from the process, to be easily identified.
3. When a user takes the task (including its name), show him or her the form (with the additional parameters so that he/she has context information).
4. Gather the users input and send it back to the CPEE.
Write the following files (only these files):

• organisation.xml - contains all the units, roles and users (YOU HAVE TO USE THE FORMAT described below). The organisation.xml has to be READ an used in either receive.php and/or worklist.php and/or work.php, depending on your implementation.
• receive.php - called by the CPEE, saves Role, Form and Parameters.
• worklist.php - show all tasks for certain user (parameter user required).
• work.php - when the user clicks a task in the worklist.php, the form is to be shown. As the interessed reader of this assignment might have noticed, form is a parameter to the task. So work is intended to read (e.g. file_get_contents('http://netzwork_link_to_form')) and include its content. Proposed structure of work.php:

form open
submit button to final.php
form close

• final.php - when the user clicks SUBMIT in work.php, final.php (1) gets the data, (2) sends it via PUT to cpee, and (3) redirects ($header('location: ...')$) to worklist.php.
Alternatively, pure javascript implementations may combine worklist.php, work.php and final.php into worklist.html. The server side may be split up to multiple different files in this case (depending on framework usage). But please put the controller into a file called worklist.php so that we can find it.

• Tasks are always assigned within the role (and organisation).
• For each role you use in your XML, at least 3 users should be in the organisation.xml
• Everybody has to implement a give back functionality.
• All people whose matnrs end 4,5,6: round robin assign tasks to a user who has the role. Immediately Repeat when a task is given back.
• All people whose matnrs end 1,2,3: assign tasks to a user who has the least tasks. If more users have the same (minimal) amount of tasks random assign a task. Immediately repeat when a task is given back.
• All people whose matnrs end 7,8,9,0: show tasks to all users in the role. As soon as a user takes the task, the others no longer see it. Give back is to be implemented as well.
• Use the following XML format for describing your organization (example): «http://cpee.org/~demo/orgviz/organisation_studentmanagement.xml»
How to tell CPEE that you want to answer later?

<?
# save \$headers['CPEE-CALLBACK'], plus all \$_REQUEST parameters
exit;
?>

How to send data back to CPEE (by PUT'ing it to the url in \$headers['CPEE_CALLBACK'])?

<?
\$opts = array('http' =>
array(
'method'  => 'PUT',
'content' => JSON_DATA
)
);
\$context = stream_context_create(\$opts);
\$result = file_get_contents('http://...', false, \$context);
exit;
?>

Submit the following 4 files:

• Signavio model as PDF
• CPEE template as XML
• Source code as ZIP
• text file with url to the working example.
WARNING 1: 0 POINTS if matnr is not included in Attribute info.
WARNING 2: 0 POINTS if it is not runable (for at least until the end of semester).
WARNING 3: Assume that you need several days, including interaction with others (e.g. Forum) to do this.

## Assignment 4d - Logging (8 Points)

Write a logging facility, which saves all information as «XES 2.x.» file.
Add the follwing aspect to your testset file (just copy it in below handlerwrapper):

<handlers>
<handler url="http://wwwlab.cs.univie.ac.at/~XXXXXX/logging/logging.php">
<events topic='activity'>calling,failed,manipulating,done</events>
</handler>
</handlers>

http:// has to point to your logging service in your account (use EXACTLY the format given above, just change XXXXXX to your username).

Pro TIP: Save all incoming information as you did for the worklist (headers and \$_REQUEST) in a random file. Then you can check what data you get.

Tailor the list of <events> so that it suits your needs. Possible events can be found under «http://cpee.org:9298/1/notifications/topics»

Use your testset from Assignment 4c. The result should be a valid XES File.

Add event dispersing (hardcoded location) to the worklist so that it contributes to the events in the XES File. The worklist should send the following events:

• A task is assigned to a user.