mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-15 15:02:20 +00:00
MNT-17601 "My completed tasks" error with embedded sub process
- The reason that no tasks were found was that the ActivitiTypeConverter.findUserTasks(...) method simply did not take sup processes into account. Transitions in a sub process were not being walked, so no user tasks inside the sub process were found. A test was added that ensures that the task inside the sub process of the sample workflow is now found. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@136799 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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";
|
||||
|
@@ -852,6 +852,13 @@ public class ActivitiTypeConverter
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isSubProcess(currentActivity))
|
||||
{
|
||||
Map<String, Object> 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);
|
||||
|
@@ -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
|
||||
{
|
||||
@@ -220,6 +219,17 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
|
||||
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<WorkflowTaskDefinition> 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
|
||||
|
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
|
||||
<process id="support_demo_process" name="Test with subprocess" isExecutable="true">
|
||||
<startEvent id="alfrescoStartevent1" name="Alfresco start" activiti:formKey="wf:submitAdhocTask"></startEvent>
|
||||
<subProcess id="subprocess1" name="Sub Process">
|
||||
<userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${initiator.exists() ? initiator.properties.userName : 'admin'}" activiti:formKey="wf:adhocTask"></userTask>
|
||||
<startEvent id="startevent1" name="Start"></startEvent>
|
||||
<endEvent id="endevent1" name="End"></endEvent>
|
||||
<sequenceFlow id="flow2" sourceRef="startevent1" targetRef="alfrescoUsertask1"></sequenceFlow>
|
||||
<sequenceFlow id="flow3" sourceRef="alfrescoUsertask1" targetRef="endevent1"></sequenceFlow>
|
||||
</subProcess>
|
||||
<sequenceFlow id="flow1" sourceRef="alfrescoStartevent1" targetRef="subprocess1"></sequenceFlow>
|
||||
<endEvent id="endevent2" name="End"></endEvent>
|
||||
<sequenceFlow id="flow4" sourceRef="subprocess1" targetRef="endevent2"></sequenceFlow>
|
||||
</process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_support_demo_process">
|
||||
<bpmndi:BPMNPlane bpmnElement="support_demo_process" id="BPMNPlane_support_demo_process">
|
||||
<bpmndi:BPMNShape bpmnElement="alfrescoStartevent1" id="BPMNShape_alfrescoStartevent1">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="120.0" y="140.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="subprocess1" id="BPMNShape_subprocess1">
|
||||
<omgdc:Bounds height="205.0" width="351.0" x="270.0" y="56.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="alfrescoUsertask1" id="BPMNShape_alfrescoUsertask1">
|
||||
<omgdc:Bounds height="55.0" width="105.0" x="400.0" y="130.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="290.0" y="140.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="560.0" y="140.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2">
|
||||
<omgdc:Bounds height="35.0" width="35.0" x="770.0" y="141.0"></omgdc:Bounds>
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
|
||||
<omgdi:waypoint x="325.0" y="157.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="400.0" y="157.0"></omgdi:waypoint>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow3" id="BPMNEdge_flow3">
|
||||
<omgdi:waypoint x="505.0" y="157.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="560.0" y="157.0"></omgdi:waypoint>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
|
||||
<omgdi:waypoint x="155.0" y="157.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="270.0" y="158.0"></omgdi:waypoint>
|
||||
</bpmndi:BPMNEdge>
|
||||
<bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
|
||||
<omgdi:waypoint x="621.0" y="158.0"></omgdi:waypoint>
|
||||
<omgdi:waypoint x="770.0" y="158.0"></omgdi:waypoint>
|
||||
</bpmndi:BPMNEdge>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</definitions>
|
Reference in New Issue
Block a user