diff --git a/source/java/org/alfresco/repo/workflow/activiti/ActivitiConstants.java b/source/java/org/alfresco/repo/workflow/activiti/ActivitiConstants.java
index c12a40b2a1..bf5178dd2e 100644
--- a/source/java/org/alfresco/repo/workflow/activiti/ActivitiConstants.java
+++ b/source/java/org/alfresco/repo/workflow/activiti/ActivitiConstants.java
@@ -1,28 +1,28 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.workflow.activiti;
@@ -44,6 +44,8 @@ public interface ActivitiConstants
public static final String DEFAULT_TRANSITION_DESCRIPTION = "Default Transition";
public static final String USER_TASK_NODE_TYPE = "userTask";
+ public static final String SUB_PROCESS_NODE_TYPE = "subProcess";
+ public static final String PROP_INITIAL_ACTIVITY = "initial";
public static final String PROP_TASK_FORM_KEY = "taskFormKey";
public static final String PROP_POOLED_ACTORS_HISTORY = "pooledActorsHistory";
public static final String DELETE_REASON_DELETED = "deleted";
diff --git a/source/java/org/alfresco/repo/workflow/activiti/ActivitiTypeConverter.java b/source/java/org/alfresco/repo/workflow/activiti/ActivitiTypeConverter.java
index e8d3fc1b9b..751fd976f2 100644
--- a/source/java/org/alfresco/repo/workflow/activiti/ActivitiTypeConverter.java
+++ b/source/java/org/alfresco/repo/workflow/activiti/ActivitiTypeConverter.java
@@ -1,28 +1,28 @@
-/*
- * #%L
- * Alfresco Repository
- * %%
- * Copyright (C) 2005 - 2016 Alfresco Software Limited
- * %%
- * This file is part of the Alfresco software.
- * If the software was purchased under a paid Alfresco license, the terms of
- * the paid license agreement will prevail. Otherwise, the software is
- * provided under the following open source license terms:
- *
- * Alfresco is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * Alfresco is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with Alfresco. If not, see .
- * #L%
- */
+/*
+ * #%L
+ * Alfresco Repository
+ * %%
+ * Copyright (C) 2005 - 2016 Alfresco Software Limited
+ * %%
+ * This file is part of the Alfresco software.
+ * If the software was purchased under a paid Alfresco license, the terms of
+ * the paid license agreement will prevail. Otherwise, the software is
+ * provided under the following open source license terms:
+ *
+ * Alfresco is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Alfresco is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with Alfresco. If not, see .
+ * #L%
+ */
package org.alfresco.repo.workflow.activiti;
@@ -852,6 +852,13 @@ public class ActivitiTypeConverter
}
}
}
+
+ if (isSubProcess(currentActivity))
+ {
+ Map properties = ((ActivityImpl)currentActivity).getProperties();
+ PvmActivity startEvent = (PvmActivity) properties.get(ActivitiConstants.PROP_INITIAL_ACTIVITY);
+ findUserTasks(startEvent, userTasks, processedActivities);
+ }
}
}
@@ -866,6 +873,16 @@ public class ActivitiTypeConverter
return false;
}
+ private boolean isSubProcess(PvmActivity currentActivity)
+ {
+ String type = (String) currentActivity.getProperty(ActivitiConstants.NODE_TYPE);
+ if(type != null && type.equals(ActivitiConstants.SUB_PROCESS_NODE_TYPE))
+ {
+ return true;
+ }
+ return false;
+ }
+
public WorkflowInstance convert(HistoricProcessInstance historicProcessInstance)
{
return convertToInstanceAndSetVariables(historicProcessInstance, null);
diff --git a/source/test-java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java b/source/test-java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java
index 8d740a40d0..46221495b3 100644
--- a/source/test-java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java
+++ b/source/test-java/org/alfresco/repo/workflow/activiti/ActivitiWorkflowServiceIntegrationTest.java
@@ -37,7 +37,6 @@ import java.util.Map;
import org.activiti.engine.history.HistoricProcessInstance;
import org.alfresco.model.ContentModel;
-import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.permissions.AccessDeniedException;
import org.alfresco.repo.workflow.AbstractWorkflowServiceIntegrationTest;
@@ -49,7 +48,6 @@ import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
-import org.alfresco.service.cmr.repository.StoreRef;
import org.alfresco.service.cmr.workflow.WorkflowDefinition;
import org.alfresco.service.cmr.workflow.WorkflowDeployment;
import org.alfresco.service.cmr.workflow.WorkflowException;
@@ -76,6 +74,7 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
public static final String ALFRESCO_WORKFLOW_REVIEW_POOLED_BPMN20_XML = "alfresco/workflow/review-pooled.bpmn20.xml";
public static final String ALFRESCO_WORKFLOW_PARALLEL_REVIEW_BPMN20_XML = "alfresco/workflow/parallel-review.bpmn20.xml";
public static final String ACTIVITI_TEST_TIMER_BPMN20_XML = "activiti/testTimer.bpmn20.xml";
+ public static final String ACTIVITI_TEST_WITH_SUB_PROCESS_XML = "activiti/testWorkflowWithSubprocess.xml";
public void testOutcome() throws Exception
{
@@ -219,7 +218,18 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
WorkflowTaskDefinition taskDef = taskDefs.get(1);
assertEquals("wf:activitiReviewTask", taskDef.getId());
}
-
+
+ // Added after MNT-17601. Failed to find any completed tasks when the workflow had a sub process.
+ public void testCompletedTaskInWorkflowWithSubProcess()
+ {
+ WorkflowDefinition definition = deployDefinition(ACTIVITI_TEST_WITH_SUB_PROCESS_XML);
+ String workflowDefId = definition.getId();
+ List taskDefs = workflowService.getTaskDefinitions(workflowDefId);
+ assertEquals(2, taskDefs.size()); // Prior to the fix for MNT-17601 this list only contained "Alfresco start".
+ assertEquals("Alfresco start", taskDefs.get(0).getNode().getTitle());
+ assertEquals("Alfresco User Task", taskDefs.get(1).getNode().getTitle());
+ }
+
public void testAccessStartTaskAsAssigneeFromTaskPartOfProcess()
{
// Test added to validate fix for CLOUD-1929 - start-task can be accesses by assignee of a task
diff --git a/source/test-resources/activiti/testWorkflowWithSubprocess.xml b/source/test-resources/activiti/testWorkflowWithSubprocess.xml
new file mode 100644
index 0000000000..edfe84c3ec
--- /dev/null
+++ b/source/test-resources/activiti/testWorkflowWithSubprocess.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file