<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: processInstance.isEnded never gives correct status in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56640#M34284</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;perhaps you're getting correct results for a process status while calling other processInstance methods e.g. isActive etc. but as i said when one uses isEnded the result is always wrong (completed process doesn't change its processInstance status isEnded to true). The code/flow i've been testing for this is as below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;definitions id="definitions"&lt;BR /&gt; xmlns="&lt;A href="http://www.omg.org/spec/BPMN/20100524/MODEL" rel="nofollow noopener noreferrer"&gt;http://www.omg.org/spec/BPMN/20100524/MODEL&lt;/A&gt;" xmlns:activiti="&lt;A href="http://activiti.org/bpmn" rel="nofollow noopener noreferrer"&gt;http://activiti.org/bpmn&lt;/A&gt;"&lt;BR /&gt; targetNamespace="Examples"&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;process id="helloProcess"&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;startEvent id="start" /&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;sequenceFlow id="flow1" sourceRef="start" targetRef="collect1" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;userTask id="collect1"&amp;gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;lt;/userTask&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;sequenceFlow id="flow2" sourceRef="collect1" targetRef="end" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;endEvent id="end" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;/process&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/definitions&amp;gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;and the java code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;ProcessInstance pi = runtimeService.startProcessInstanceByKey("helloProcess");&lt;BR /&gt;&lt;BR /&gt;String taskId = taskService.createTaskQuery().singleResult().getId()&lt;BR /&gt;taskService.complete(taskId);&lt;BR /&gt;&lt;BR /&gt;pi.isEnded()&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;for the code as above &lt;/SPAN&gt;&lt;EM&gt;pi.isEnded()&lt;/EM&gt;&lt;SPAN&gt; call returns FALSE even though the whole process has been completed as there was only one userTask&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 May 2011 10:48:34 GMT</pubDate>
    <dc:creator>gs76pl</dc:creator>
    <dc:date>2011-05-06T10:48:34Z</dc:date>
    <item>
      <title>processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56638#M34282</link>
      <description>hi,this seems like a basic question but it looks like any call to processInstance.isEnded never returns TRUE even when the actual process has been completed. I suspect that in in order to get actual process status one should execute a process query like below ProcessInstanceQuery pq = runtimeService</description>
      <pubDate>Thu, 05 May 2011 17:22:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56638#M34282</guid>
      <dc:creator>gs76pl</dc:creator>
      <dc:date>2011-05-05T17:22:51Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56639#M34283</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;when the processinstance is active you ALWAYS get the CORRECT result &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; But for the real use I have no idea…&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 May 2011 22:29:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56639#M34283</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-05-05T22:29:48Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56640#M34284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;perhaps you're getting correct results for a process status while calling other processInstance methods e.g. isActive etc. but as i said when one uses isEnded the result is always wrong (completed process doesn't change its processInstance status isEnded to true). The code/flow i've been testing for this is as below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;&amp;lt;definitions id="definitions"&lt;BR /&gt; xmlns="&lt;A href="http://www.omg.org/spec/BPMN/20100524/MODEL" rel="nofollow noopener noreferrer"&gt;http://www.omg.org/spec/BPMN/20100524/MODEL&lt;/A&gt;" xmlns:activiti="&lt;A href="http://activiti.org/bpmn" rel="nofollow noopener noreferrer"&gt;http://activiti.org/bpmn&lt;/A&gt;"&lt;BR /&gt; targetNamespace="Examples"&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;process id="helloProcess"&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;startEvent id="start" /&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;sequenceFlow id="flow1" sourceRef="start" targetRef="collect1" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;userTask id="collect1"&amp;gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;lt;/userTask&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;sequenceFlow id="flow2" sourceRef="collect1" targetRef="end" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;endEvent id="end" /&amp;gt;&lt;BR /&gt;&lt;BR /&gt; &amp;lt;/process&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&amp;lt;/definitions&amp;gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;and the java code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;ProcessInstance pi = runtimeService.startProcessInstanceByKey("helloProcess");&lt;BR /&gt;&lt;BR /&gt;String taskId = taskService.createTaskQuery().singleResult().getId()&lt;BR /&gt;taskService.complete(taskId);&lt;BR /&gt;&lt;BR /&gt;pi.isEnded()&lt;BR /&gt;&lt;/CODE&gt;&lt;BR /&gt;&lt;SPAN&gt;for the code as above &lt;/SPAN&gt;&lt;EM&gt;pi.isEnded()&lt;/EM&gt;&lt;SPAN&gt; call returns FALSE even though the whole process has been completed as there was only one userTask&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 10:48:34 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56640#M34284</guid>
      <dc:creator>gs76pl</dc:creator>
      <dc:date>2011-05-06T10:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56641#M34285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I never mentioned isActive() and I was only making a joke… sorry that that was not clear…&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What you mis here is that the pi you use is a 'disconnected' representation of the instance state. The only updates take place in the database. So you have to refresh the pi and then pi will be null since it is not active anymore. It will be in the history tables though where you can see the state. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is one of the less obvious things of activiti, but once you know this, it works.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 11:01:22 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56641#M34285</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-05-06T11:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56642#M34286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;thanks for the clarification. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;i've suspected something like that is going on (the same way drools flow works) but unless i miss something more &lt;/SPAN&gt;&lt;EM&gt;isEnded&lt;/EM&gt;&lt;SPAN&gt; method doesn't make sense in my opinion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;As you said once the process has been completed its history is available through history service ie.&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;HistoricProcessInstance hpi = historyService.createHistoricProcessInstanceQuery().processInstanceId(pid).finished().singleResult()&lt;BR /&gt;&lt;/CODE&gt;&lt;SPAN&gt;above works fine with my code and i can see that my process has been ended.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem i have with the ProcessInstance is that if it's disconnected and one need to refresh it (i assume below code is the only way to refresh a process instance)&lt;/SPAN&gt;&lt;BR /&gt;&lt;CODE&gt;&lt;BR /&gt;ProcessInstanceQuery pi = runtimeService.createProcessInstanceQuery().processInstanceId(pid).singleResult();&lt;BR /&gt;&lt;/CODE&gt;&lt;SPAN&gt;once the process has been ended runtimeService will never find it and as a result &lt;/SPAN&gt;&lt;EM&gt;pi&lt;/EM&gt;&lt;SPAN&gt; will always be null. As a consequence &lt;/SPAN&gt;&lt;EM&gt;isEnded&lt;/EM&gt;&lt;SPAN&gt; method doesn't make sense because:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1. if the process is active than above query will return NOT NULL (no need to call isEnded)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. if the process has ended than above query will return NULL (no need and more importantly no way to call isEnded)&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 11:23:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56642#M34286</guid>
      <dc:creator>gs76pl</dc:creator>
      <dc:date>2011-05-06T11:23:00Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56643#M34287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Correct, that is why I said&lt;/SPAN&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;But for the real use I have no idea…&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 May 2011 13:20:58 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56643#M34287</guid>
      <dc:creator>ronald_van_kuij</dc:creator>
      <dc:date>2011-05-06T13:20:58Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56644#M34288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;One reason I use it for is for unit tests with processes that have all automatic steps … but it's obviously not a 'real' use case&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 09:28:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56644#M34288</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2011-05-09T09:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56645#M34289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'd like to follow up on gs76pl's question as it doesn't make sense to me either. Why does isEnded() exist on ProcessInstance if its behavior is so counter intuitive.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;jbarrez:if your process has all automatic steps, how do you use isEnded()? When all of the steps have executed, does isEnded() return true or false?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jul 2015 17:21:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56645#M34289</guid>
      <dc:creator>louis44</dc:creator>
      <dc:date>2015-07-05T17:21:47Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56646#M34290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sorry, I just searched more and found this: &lt;/SPAN&gt;&lt;A href="http://forums.activiti.org/content/processinstanceisended-returns-false" rel="nofollow noopener noreferrer"&gt;http://forums.activiti.org/content/processinstanceisended-returns-false&lt;/A&gt;&lt;SPAN&gt;. In this thread, jbarrez indicates that if the process has all automatic steps, isEnded() will return true.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 05 Jul 2015 17:25:11 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56646#M34290</guid>
      <dc:creator>louis44</dc:creator>
      <dc:date>2015-07-05T17:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: processInstance.isEnded never gives correct status</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56647#M34291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Correct. Always remember Activiti API's return a 'snapshot' of the data, not necessarily the 'current' state.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Jul 2015 11:48:08 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/processinstance-isended-never-gives-correct-status/m-p/56647#M34291</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2015-07-07T11:48:08Z</dc:date>
    </item>
  </channel>
</rss>

