Relations

From RunaWFE
Revision as of 14:16, 19 May 2014 by doc>Natkinnat
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Using relations

RunaWFE Free Workflow System (BPMS) Version 4.5.0

© 2003 - 2015, Consulting Group Runa

© 2015 - 2024, "Process Technologies" Ltd, this document is available under GNU FDL license. RunaWFE Free is an open source system distributed under a LGPL license (http://www.gnu.org/licenses/lgpl.html).


# Relation description

Relation can be viewed as an extension to a notion of function.

Definition. Binary relation between sets A and B is any subset of the Cartesian product R of A to the set B. Often, to denote membership of the ordered pair (a, b) to a binary relation R instead of writing (a, b) [[Image: BelongTo.png] ] R the notation R (a, b) or aRb is used. Thus say that a is in relation R to b.

Note. For the sets A and B, that consist of finite number of elements, any relation can be defined by defining a set of ordered pairs (a,b) of this relation.

Note. Some (but not any) binary relations correspond to functions. That means that some binary relations are functions. It's possible to define function as such binary relation R in which to every b value of aRb corresponds one and only one value a (but not vice versа). In this case a = f(b), where f is function that corresponds to relation R.

# Relations in RunaWFE web interface

The relations concept is implemented in RunaWFE in the following way:

1. In the system main menu an item “Relations” is added.


R23 en.png


Here you can view/add/remove a relation, open a relation and edit the set of pairs that constitutes the relation

2. For each executor in his/her properties 2 sections are added:

  • Relations in which the executor is in the left side
  • Relations in which the executor is in the right side


R24 en.png


Each relation can be opened and the set of the executors in the both sides of the relation can be edited.


R25 en.png


For all the operations on relations such as viewing, editing, changing permissions etc the permissions can be set (similar to the permissions that can be set for executors or business processes).


Rpic4 en.png

# Using relations

Relations are used:

  • for swimlane initialization
  • on forms in Freemarker tags
  • in escalation
  • for multisubprocess
  • for multitask (planned)
  • in handlers


# Using relations in swimlane initialization

Swimlanes and their initialization

Business process task executor can be an employee, a group, an information system, a specialized device.

In the business process definition the swimlanes are defined and mapped to the business process nodes. A swimlane is initialized by a specific executor only in business process instance during its execution. In order to assign an executor to a swimlane relations can be used as well as organization structure functions.

Applying a relation to swimlane initialization

So RunaWFE allows to initialize swimlanes not only via function on task executors, but also with the help of relations.

Firstly, it allows to initialize a swimlane with a set of potential executors. (Often a business process task is sent not to a single, but to multiple executors. The first executor who takes the task for execution performs the task)

Secondly, via relation it becomes very easy to assign potential executors for the task. It can be done right in the RunaWFE interface.

Here are some examples of relations over a set of enterprise employees:

  1. Employee’s immediate supervisor
  2. Secretaries of the department to which employee belongs
  3. The employee department’s head of the department deputies

The first relation is a function while the rest 2 are not, because they put more than one element into correspondence with the employee.

The simplicity of creating a relation is in the fact that in order to do it you can specify a set of pairs (executor1, executor2), without checking any restrictions (which you have to check for function for example, verifying that it returns not more than one value for each employee).

Using groups of users when setting up a relations

When there are a lot of pairs that constitute a relation, it’s inconvenient to enumerate them all. In order to simplify it groups of users can be used.

User groups are generally used to unite users with some common feature(s), so that later operations with all users possessing that feature(s) can be easily done. Groups can contain other groups. In RunaWFE a group inherits the features of all groups that it is a part of.

A swimlane is initialized in the following way:

  1. From variable that is specified in the swimlane initializer the value is taken. This value is a code of a user. (It is possibly to use role name as variable name in swimlane initializer). This value will correspond to the right part of the relation.
  2. A set of all the left parts of the relation that correspond to the right part is being built. In order to do it for the executor from the right part all the groups that he is a member of (or a member of at least one subgroup) are found. Next all the pairs defined in the system for this relation are found that have in their right part the executor or one of the groups found previously. Then the set that contains the left parts of all the selected pairs is considered.

If there are no pairs, then the swimline is not initialized. If the set contains only one user then the swimlane is initialized by it. In the rest cases the swimlane is initialized by the set of all the users that are present in the left parts of the pairs or belong to the any of the groups present in left part, or to any of it(their) subgroups.

For instance, a relation “An immediate supervisor” can be set via relation pairs as follows:

(employee1, employee2)

….

(employee1, employeeN)

This relation definition corresponds to employee1 being a supervisor of employee2, …, employeeN.

The same relation can be defined by one pair:

(employee1, group1)

In this case the definition corresponds to employee1 being a supervisor of any employee that is a member of group1 or of any of group1’s subgroups.


Note. Besides there's such notion as inversed relation. In inversed relation left side of the pair is parameter of relation. To every left side there is a set of values for the right side of the pairs.

Using relation in swimlane initializer

It's possible to use relation as swimlane initializer. It can be done on "Swimlane as relation" tab. Use "Connection configuration" to set the connection parameters and checking connection with WFE Server, then click on "Synchronize" to get relations list from the WFE Server.

Rpic5.png


Next you can set what relation corresponds to the swimlane.

Choose relation name in the form and as a parameter a variable of type User, Executor, Group or swimlane can be set.

Rpic6 1.png


It's also possible to use a "Inversed relation" by setting the correspondent option to "Yes". In this case the relation parameter will be in the left part of the relation.


# Relations in Freemarker tags

# Tags list

To choose executor/actor with the help of relation you can use one of the following Freemarker tags:

  • ChooseExecutorFromRelationTag
  • ChooseExecutorByRelationTag
  • ChooseActorByRelationTag

These tags are described in Using task forms ( ChooseExecutorFromRelationTag, ChooseExecutorByRelationTag, ChooseActorByRelationTag)


# Example. Using relation with ChooseActorByRelation

Add “ChooseActorByRelation” tag to form.

Ftlrel en1 2.png


Set the following parameters:

  • "User". Variable of type User or swimlane. This variable stores the selection result;
  • "Relation name". You can set a business process variable name (with relation name as its value) or explicitly type in the name of the relation (constant string value);
  • "Parameter". This parameter will be used to filter pairs by right side (in inversed relation by left side). It can be set by choosing a variable of Executor type or by typing in constant string value (name of executor).
  • "Inversed relation". Can be "Yes"/"No". If "Yes" is chosen then left part of the relation is used as pairs filter parameter

The result of applying relation to the parameter variable is a list of users that is displayed in the form for user selection.

The user chosen from this list during business process execution can be used to initialize a swimlane, for example.


Let's consider several examples of ftl ChooseActorByRelation tag usage.


# Relation “Boss” (chiefs of the group)

Let's create a relation "Boss" of the following type:

Ftlrel en2.png

We have pairs ivanov-rabs, sidorov-rabs where rabs is a group

Let's create a business process with a form where one of the chiefs of rabs group can be selected.

Here's the configuration (source view) of the ChooseActorByRelation tag on the form:

 ${ChooseActorByRelation("Swimlane2", "Boss", group, "false")}


To save selection result Swimlane2 is used, relation name is a string value "Boss", parameter is variable "group" (with value rabs) of Group type, "inversed relation" is set to "No".

The result of the described tag will be a list with all actors who are chiefs of group rabs (ivanov, sidorov). Swimlane2 will be initialized with the value selected from this list by a user.

Ftlrel en3.png

# Relation “Boss2” (A group of managers for another group)

The source code of ftl tag:

 ${ChooseActorByRelation("Swimlane2", "Boss2", group, "false")}

where "Swimlane2" is initialized with the help of relation tag;

"Boss2" is the relation name;

"group" - group (value rabs).

There is a pair group-group (manager-rabs) in Boss2 relation:

Ftlrel en4 1.png


The result of this tag usage will be a list with the users that are members of "manager" group and are bosses for "rabs" group.

Ftlrel en5 1.png

# Relation “Boss3” (Chief of the group and all its subgroups)

Let's create rabs group that includes a subgroup podrabs.

Let's create "Boss3" relation:

Ftlrel en6.png

User Fedorov is a chief of group rabs and all its subgroups.

Let's create a business process with form and ChooseActorByRelation tag with the following configuration (source view):

 ${ChooseActorByRelation("Swimlane2", "Boss3", "podrabs", "false")}


In this case parameter is a string value "podrabs".


Where podrabs is a subgroup of rabs group.

As a result there will be a list with only one actor Fedorov who is a chief of the rabs group and all of its subgroups.

Ftlrel en7.png

# Using relations in escalation

Since 4.1.1 it's possible to use relation to define escalation ladder.

Example of it see in Escalation configuration in Developer Studio


# Using relations in multisubprocess and multitask

For creating multisubprocess using relation see Multi subprocess by relation


# Using relations in handlers

Relations can be used in the following handlers:


  • Assign swimlane(as swimlane initializer)
  • Executor by relation
  • Executors list by relation