I am trying to implement an use case to cancel the current case flow. Simplified example can be described as:

There are two activities 'A' immediately followed by 'B'. 'B' Activity involves human interaction (an entry in todo list) and can be postponed. The challenge is to 'restart' 'A' activity and perform some steps to cancel already started 'B' activity.

With BPMN i would model 'B' activity with transactional subprocess and cancel event. Quick web searching for 'BPMN Cancel' leads to the usable examples.

AFAIK there are no direct counterparts neither for BPMN 2.0 Transactional Subporcess nor for cancel event in xIvy.Designer.

The questions are:

  1. Is it possible to model it in xPert.Ivy or there are show stoppers?
  2. There is an API to find and cancel case. Can I set the case to the defined state, say a task?
  3. Probably another solution for the problem?

Best regards,


asked 10.07.2014 at 10:45

mgalyutin's gravatar image

accept rate: 0%

edited 10.07.2014 at 10:54

I start with a short explanation of the default behavior in Ivy. On the process level everything what happens between two events is atomic. It means either the execution completes successfully or (if not) it is reset to the start (i.e. to the first event). So consider the following situation:

Task in ivy

This is what we call a task in Ivy. A sequence of activities (and gateways) between two events (this is in fact a simplification but explains the principle). Note, that a task in BPMN is semantically something else. Now, if during the execution something in A or B fails, then the whole task is reset automatically by Ivy to the Start event. In case of user interactions this is also true if the session timeout is reached. On the other hand, if everything is working properly then the case has reached the next step and will be proceeded from the End event.

2. There is an API to find and cancel case. Can I set the case to the defined state, say a task?

No, what you can do by API is reset a task. If you call this during the execution, then the task will be reset to its start (the Start event).

1. Is it possible to model it in Xpert.ivy or there are show stoppers?

What you do not have in Ivy is the notion of compensation. There is no such thing as a compensation activity that is triggered in case of a rollback (or reset in Ivy terms). If you need this, then you must workaround through this. For example, your activities could create some sort of commands that have a compensation mechanisms that are put in a queue. Then the queue is processed at the end of the Ivy task in Java with a transaction framework or something like that.


answered 15.07.2014 at 12:00

MichaelD%C3%A4nzer's gravatar image

MichaelDänzer ♦
accept rate: 86%

You are absolutely right. Tasks (or Activities) in BPMN semantically differ from the xIvy Tasks. Furthermore xIvy Activity B from your example is not semantically equivalent to the B Activity i meant, because the user can start and see the xIvy task in TODO only at Events (Start,Intermediate etc) or Task Gateway elements in process model.

If right understood, there is no possibility to reset a task after it has reached End Task Switch gateway (you wrote 'during task execution' in your answer). Is that true?

(15.07.2014 at 13:31) mgalyutin mgalyutin's gravatar image

Have you information about task life cycle?

The accessible documentation link text only enumerates possible states without the description of possible transitions.

(15.07.2014 at 13:35) mgalyutin mgalyutin's gravatar image

Possible other Workarounds:

  • You can destroy a Task per API ITask.destroy() (if there was only this task aktive the case is then finished).
  • You can destroy a whole case per API ICase.destroy() (also all tasks of this case are destoryed).
  • You can set another activator to the Task if in state suspended per API ITask.setActivator(...)
  • You can also set the "system user" as activator, then the task is automatically executed by the system ITask.setActivator(ivy.session.getSecurityContext().getSystemUser()).
  • You could check with an Alternative Process Element if you are executed with a "normal" user and do the happy path or by the system and then make your "compensation" path. See example screenshot process_with_system_compensation

answered 16.07.2014 at 16:04

Christian%20Strebel's gravatar image

Christian St... ♦
accept rate: 88%

edited 16.07.2014 at 16:06


To be able to set the activator i should be able to find a case and the actual task. The case can be found using business information (i.e OrderNumber) but how to figure the current task? Documentation states that ICase.getActiveTasks() returns task list in 'active' state. Could it be more then one active task at time? What states on your diagram considered to be 'active'?

There is also security consideration: ITask.setActivator() require TaskWriteActivator PERMISSION OR OWNS TaskWriteActivator@SYSTEM PERMISSION,but it applies AFIK to any task in the system. Can it be somehow limited?

(17.07.2014 at 11:40) mgalyutin mgalyutin's gravatar image

Active Tasks are all states except DESTROYED, DONE and ZOMBIE.

A Task Switch Gateway allows multiple out arcs, and every one generates a own task, this means you can have multiple/parallel tasks per case. You have to use again a Task Switch Gateway to join multiple tasks (multiple input arcs).

(17.07.2014 at 13:55) Christian St... ♦ Christian%20Strebel's gravatar image

Your "Cancel task" process could be execute the ITask.setActivator() code as system (user), then you have this permission anyway and you do not have to give this permission directly to anybody. So your process has to check if this step is allowed or not.

(17.07.2014 at 14:07) Christian St... ♦ Christian%20Strebel's gravatar image

The following diagram shows the wrofklow task states and the possible state changes of a workflow task in an overview. TaskStateOverview The next diagram shows the state SUSPENDED and all possible state changes from or to this state: SuspendedTaskStates The next diagram shows the state RESUMED and all possible state changes from or to this state: ResumedTaskStates

This answer is marked "community wiki".

answered 16.07.2014 at 15:18

Christian%20Strebel's gravatar image

Christian St... ♦
accept rate: 88%

edited 14.04.2015 at 09:30

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: 10.07.2014 at 10:45

Seen: 3,060 times

Last updated: 14.04.2015 at 09:30