mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
Merged 5.1.N (5.1.2) to 5.2.N (5.2.1)
127262 arebegea: Merged 5.0.N (5.0.4) to 5.1.N (5.1.2) 127234 cpopa: MNT-16063 : Activiti workflows without userTask does not work - Prevent tasks retrieval from finished executions git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@127287 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -100,7 +100,9 @@ public class WorkflowBuilder
|
||||
NodeRef packageRef = packageMgr.create(packageNode);
|
||||
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
|
||||
WorkflowPath path = workflowService.startWorkflow(definition.getId(), params);
|
||||
if (path.isActive()){
|
||||
signalStartTask(path);
|
||||
}
|
||||
return path.getInstance();
|
||||
}
|
||||
|
||||
|
@@ -35,6 +35,7 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.alfresco.error.AlfrescoRuntimeException;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
@@ -97,6 +98,7 @@ public abstract class AbstractWorkflowServiceIntegrationTest extends BaseSpringT
|
||||
protected ServiceRegistry serviceRegistry;
|
||||
protected WorkflowTestHelper wfTestHelper;
|
||||
protected TransactionServiceImpl transactionService;
|
||||
protected HistoryService historyService;
|
||||
|
||||
public void testDeployWorkflowDefinition()
|
||||
{
|
||||
@@ -1341,6 +1343,7 @@ public abstract class AbstractWorkflowServiceIntegrationTest extends BaseSpringT
|
||||
this.workflowService = serviceRegistry.getWorkflowService();
|
||||
this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
|
||||
this.nodeService = serviceRegistry.getNodeService();
|
||||
this.historyService = (HistoryService) applicationContext.getBean("activitiHistoryService");
|
||||
Repository repositoryHelper = (Repository) applicationContext.getBean("repositoryHelper");
|
||||
this.companyHome = repositoryHelper.getCompanyHome();
|
||||
try
|
||||
|
@@ -35,11 +35,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
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;
|
||||
import org.alfresco.repo.workflow.WorkflowBuilder;
|
||||
import org.alfresco.repo.workflow.WorkflowModel;
|
||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||
@@ -638,6 +640,26 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
|
||||
assertNotNull(completed);
|
||||
}
|
||||
|
||||
public void testBuildWorkflowWithNoUserTasks() throws Exception
|
||||
{
|
||||
// Deploy a definition containing only a service task
|
||||
WorkflowDefinition testDefinition = deployDefinition("activiti/testWorkflowNoUserTasks.bpmn20.xml");
|
||||
WorkflowBuilder builder = new WorkflowBuilder(testDefinition, workflowService, nodeService, null);
|
||||
// Build a workflow
|
||||
WorkflowInstance builtInstance = builder.build();
|
||||
assertNotNull(builtInstance);
|
||||
|
||||
// Check that there is no active workflow for the deployed definition(it should have finished already due to absence of user tasks)
|
||||
List<WorkflowInstance> activeInstances = workflowService.getActiveWorkflows(testDefinition.getId());
|
||||
assertNotNull(activeInstances);
|
||||
assertEquals(0, activeInstances.size());
|
||||
|
||||
// Check that there's a historic record of our 'only service task' workflow being run.
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.finishedAfter(builtInstance.getStartDate())
|
||||
.singleResult();
|
||||
assertNotNull(historicProcessInstance);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getEngine()
|
||||
|
@@ -0,0 +1,16 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<definitions xmlns='http://www.omg.org/spec/BPMN/20100524/MODEL' targetNamespace='http://www.bpmnwithactiviti.org' xmlns:activiti='http://activiti.org/bpmn'>
|
||||
<process id='sampleWorkflowServiceTask' name="Sample Workflow only Service Task" isExecutable="true">
|
||||
<startEvent id='theStart'/>
|
||||
<sequenceFlow id='flow1' sourceRef='theStart' targetRef='SampleServiceTask' />
|
||||
<serviceTask id='SampleServiceTask' name='Execution Check' activiti:class='org.alfresco.repo.workflow.activiti.script.AlfrescoScriptDelegate'>
|
||||
<extensionElements>
|
||||
<activiti:field name="script">
|
||||
<activiti:string>logger.log("Hello World");</activiti:string>
|
||||
</activiti:field>
|
||||
</extensionElements>
|
||||
</serviceTask>
|
||||
<sequenceFlow id='flow2' sourceRef='SampleServiceTask' targetRef='theEnd' />
|
||||
<endEvent id='theEnd' />
|
||||
</process>
|
||||
</definitions>
|
Reference in New Issue
Block a user