<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: BPMN Tansactional Subprocess modelled with Xpert.Ivy</title><link>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy</link><description>&lt;p&gt;I am trying to implement an use case to cancel the current case flow. Simplified example can be described as: &lt;/p&gt;
&lt;p&gt;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. &lt;/p&gt;
&lt;p&gt;With BPMN i would model 'B' activity with transactional subprocess and cancel event. Quick web searching for 'BPMN Cancel' leads to the usable examples. &lt;/p&gt;
&lt;p&gt;AFAIK there are no direct counterparts neither for BPMN 2.0 Transactional Subporcess nor for cancel event in xIvy.Designer. &lt;/p&gt;
&lt;p&gt;The questions are: &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Is it possible to model it in xPert.Ivy or there are show stoppers? &lt;/li&gt;
&lt;li&gt;There is an API to find and cancel case. Can I set the case to the defined state, say a task? &lt;/li&gt;
&lt;li&gt;Probably another solution for the problem?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Best regards, &lt;/p&gt;
&lt;p&gt;Mikhail.&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 16 Jul 2014 16:04:11 -0400</lastBuildDate><item><title>Answer by Christian Strebel</title><link>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy/862</link><description>&lt;p&gt;Possible other Workarounds:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;You can destroy a Task per API &lt;code&gt;ITask.destroy()&lt;/code&gt; (if there was only this task aktive the case is then finished).&lt;/li&gt;
&lt;li&gt;You can destroy a whole case per API &lt;code&gt;ICase.destroy()&lt;/code&gt; (also all tasks of this case are destoryed).&lt;/li&gt;
&lt;li&gt;You can set another activator to the Task if in state suspended per API &lt;code&gt;ITask.setActivator(...)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;You can also set the "system user" as activator, then the task is automatically executed by the system &lt;code&gt;ITask.setActivator(ivy.session.getSecurityContext().getSystemUser())&lt;/code&gt;. &lt;/li&gt;
&lt;li&gt;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 &lt;img alt="process_with_system_compensation" src="/upfiles/process_with_system_compensation_1.png"&gt;&lt;/li&gt;
&lt;/ul&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Strebel</dc:creator><pubDate>Wed, 16 Jul 2014 16:04:11 -0400</pubDate><guid>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy/862</guid></item><item><title>Answer by Christian Strebel</title><link>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy/861</link><description>&lt;p&gt;The following diagram shows the wrofklow task states and the possible state changes of a workflow task in an overview. 
&lt;img alt="TaskStateOverview" src="/upfiles/TaskStateOverview.png"&gt;
The next diagram shows the state SUSPENDED and all possible state changes from or to this state:
&lt;img alt="SuspendedTaskStates" src="/upfiles/SuspendedTaskStates.png"&gt;
The next diagram shows the state RESUMED and all possible state changes from or to this state:
&lt;img alt="ResumedTaskStates" src="/upfiles/ResumedTaskStates.png"&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Christian Strebel</dc:creator><pubDate>Wed, 16 Jul 2014 15:18:57 -0400</pubDate><guid>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy/861</guid></item><item><title>Answer by MichaelDänzer</title><link>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy/851</link><description>&lt;p&gt;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: &lt;/p&gt;
&lt;p&gt;&lt;img alt="Task in ivy" src="/upfiles/task_1.png"&gt; &lt;/p&gt;
&lt;p&gt;This is what we call a &lt;strong&gt;task&lt;/strong&gt; 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 &lt;em&gt;Start&lt;/em&gt; 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 &lt;em&gt;End&lt;/em&gt; event. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;2. There is an API to find and cancel case. Can I set the case to the defined state, say a task?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;No, what you can do by API is &lt;a href="http://www.xpertivy.ch/releases/Xpert.ivy/5.0.12/documents/publicApi/ch/ivyteam/ivy/workflow/ITask.html#reset()"&gt;reset a task&lt;/a&gt;. If you call this during the execution, then the task will be reset to its start (the &lt;em&gt;Start&lt;/em&gt; event).&lt;/p&gt;
&lt;p&gt;&lt;em&gt;1. Is it possible to model it in Xpert.ivy or there are show stoppers?&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;What you do not have in Ivy is the notion of compensation. There is no such thing as a &lt;em&gt;compensation activity&lt;/em&gt; 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.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">MichaelDänzer</dc:creator><pubDate>Tue, 15 Jul 2014 12:00:47 -0400</pubDate><guid>https://answers.axonivy.com/questions/845/bpmn-tansactional-subprocess-modelled-with-xpert-ivy/851</guid></item></channel></rss>