<?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 process instances must not be created from suspended process definitions via signals in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/process-instances-must-not-be-created-from-suspended-process/m-p/213709#M166839</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Activiti does allow process instance creation from suspended process definition when the process instance is created via a signal. However, using message or Runtime services this does not happen. In fact, this a bug. When handling a signal leading to the creation of process instance, the process definition is not checked for suspension as is &amp;nbsp;the case with message and runtime process instance creation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using activiti.5.21.1.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue is in &lt;SPAN&gt;org.activiti.engine.impl.event.&lt;/SPAN&gt;&lt;SPAN&gt;SignalEventHandler, it does not check for process definition suspension.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My fix is below. I hope you can add that to the base code so that we can have it in next release.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Licensed under the Apache License, Version 2.0 (the "License");&lt;BR /&gt; * you may not use this file except in compliance with the License.&lt;BR /&gt; * You may obtain a copy of the License at&lt;BR /&gt; * &lt;BR /&gt;&lt;SPAN&gt; * &lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.apache.org/licenses/LICENSE-2.0" rel="nofollow noopener noreferrer" target="_blank"&gt;http://www.apache.org/licenses/LICENSE-2.0&lt;/A&gt;&lt;BR /&gt; * &lt;BR /&gt; * Unless required by applicable law or agreed to in writing, software&lt;BR /&gt; * distributed under the License is distributed on an "AS IS" BASIS,&lt;BR /&gt; * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.&lt;BR /&gt; * See the License for the specific language governing permissions and&lt;BR /&gt; * limitations under the License.&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;package org.activiti.engine.impl.event;&lt;/P&gt;&lt;P&gt;import java.util.Map;&lt;/P&gt;&lt;P&gt;import org.activiti.engine.ActivitiException;&lt;BR /&gt;import org.activiti.engine.ActivitiObjectNotFoundException;&lt;BR /&gt;import org.activiti.engine.impl.context.Context;&lt;BR /&gt;import org.activiti.engine.impl.interceptor.CommandContext;&lt;BR /&gt;import org.activiti.engine.impl.persistence.deploy.DeploymentManager;&lt;BR /&gt;import org.activiti.engine.impl.persistence.entity.EventSubscriptionEntity;&lt;BR /&gt;import org.activiti.engine.impl.persistence.entity.ExecutionEntity;&lt;BR /&gt;import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;&lt;BR /&gt;import org.activiti.engine.impl.pvm.process.ActivityImpl;&lt;BR /&gt;import org.activiti.engine.repository.ProcessDefinition;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/**&lt;BR /&gt; * @author Daniel Meyer&lt;BR /&gt; * @author Joram Barrez&lt;BR /&gt; */&lt;BR /&gt;public class SignalEventHandler extends AbstractEventHandler {&lt;BR /&gt; &lt;BR /&gt; public static final String EVENT_HANDLER_TYPE = "signal";&lt;/P&gt;&lt;P&gt;public String getEventHandlerType() {&lt;BR /&gt; return EVENT_HANDLER_TYPE;&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; @Override&lt;BR /&gt; public void handleEvent(EventSubscriptionEntity eventSubscription, Object payload, CommandContext commandContext) {&lt;BR /&gt; if (eventSubscription.getExecutionId() != null) {&lt;BR /&gt; super.handleEvent(eventSubscription, payload, commandContext);&lt;BR /&gt; } else if (eventSubscription.getProcessDefinitionId() != null) {&lt;BR /&gt; // Start event&lt;BR /&gt; String processDefinitionId = eventSubscription.getProcessDefinitionId();&lt;BR /&gt; DeploymentManager deploymentCache = Context&lt;BR /&gt; .getProcessEngineConfiguration()&lt;BR /&gt; .getDeploymentManager();&lt;BR /&gt; &lt;BR /&gt; ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);&lt;BR /&gt; if (processDefinition == null) {&lt;BR /&gt; throw new ActivitiObjectNotFoundException("No process definition found for id '" + processDefinitionId + "'", ProcessDefinition.class);&lt;BR /&gt; }&lt;BR /&gt; if (processDefinition.isSuspended()) {&lt;BR /&gt; throw new ActivitiException("Could not handle signal: process definition with id: " + processDefinitionId + " is suspended");&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; ActivityImpl startActivity = processDefinition.findActivity(eventSubscription.getActivityId());&lt;BR /&gt; if (startActivity == null) {&lt;BR /&gt; throw new ActivitiException("Could no handle signal: no start activity found with id " + eventSubscription.getActivityId());&lt;BR /&gt; }&lt;BR /&gt; ExecutionEntity processInstance = processDefinition.createProcessInstance(null, startActivity);&lt;BR /&gt; if (processInstance == null) {&lt;BR /&gt; throw new ActivitiException("Could not handle signal: no process instance started");&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; if (payload != null) {&lt;BR /&gt; if (payload instanceof Map) {&lt;BR /&gt; Map&amp;lt;String, Object&amp;gt; variables = (Map&amp;lt;String, Object&amp;gt;) payload;&lt;BR /&gt; processInstance.setVariables(variables);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; processInstance.start();&lt;BR /&gt; } else {&lt;BR /&gt; throw new ActivitiException("Invalid signal handling: no execution nor process definition set");&lt;BR /&gt; }&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 Dec 2016 21:21:53 GMT</pubDate>
    <dc:creator>dan_</dc:creator>
    <dc:date>2016-12-14T21:21:53Z</dc:date>
    <item>
      <title>process instances must not be created from suspended process definitions via signals</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/process-instances-must-not-be-created-from-suspended-process/m-p/213709#M166839</link>
      <description>Activiti does allow process instance creation from suspended process definition when the process instance is created via a signal. However, using message or Runtime services this does not happen. In fact, this a bug. When handling a signal leading to the creation of process instance, the process def</description>
      <pubDate>Wed, 14 Dec 2016 21:21:53 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/process-instances-must-not-be-created-from-suspended-process/m-p/213709#M166839</guid>
      <dc:creator>dan_</dc:creator>
      <dc:date>2016-12-14T21:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: process instances must not be created from suspended process definitions via signals</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/process-instances-must-not-be-created-from-suspended-process/m-p/213710#M166840</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here is a pull request: &lt;A class="link-titled" href="https://github.com/Activiti/Activiti/pull/1085" title="https://github.com/Activiti/Activiti/pull/1085" rel="nofollow noopener noreferrer"&gt;Fix for process instance created via signal from a suspended process … by HamdanMsheik · Pull Request #1085 · Activiti/A…&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 04:25:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/process-instances-must-not-be-created-from-suspended-process/m-p/213710#M166840</guid>
      <dc:creator>dan_</dc:creator>
      <dc:date>2016-12-15T04:25:55Z</dc:date>
    </item>
  </channel>
</rss>

