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);
|
NodeRef packageRef = packageMgr.create(packageNode);
|
||||||
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
|
params.put(WorkflowModel.ASSOC_PACKAGE, packageRef);
|
||||||
WorkflowPath path = workflowService.startWorkflow(definition.getId(), params);
|
WorkflowPath path = workflowService.startWorkflow(definition.getId(), params);
|
||||||
signalStartTask(path);
|
if (path.isActive()){
|
||||||
|
signalStartTask(path);
|
||||||
|
}
|
||||||
return path.getInstance();
|
return path.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -35,6 +35,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.activiti.engine.HistoryService;
|
||||||
import org.alfresco.error.AlfrescoRuntimeException;
|
import org.alfresco.error.AlfrescoRuntimeException;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
@@ -97,6 +98,7 @@ public abstract class AbstractWorkflowServiceIntegrationTest extends BaseSpringT
|
|||||||
protected ServiceRegistry serviceRegistry;
|
protected ServiceRegistry serviceRegistry;
|
||||||
protected WorkflowTestHelper wfTestHelper;
|
protected WorkflowTestHelper wfTestHelper;
|
||||||
protected TransactionServiceImpl transactionService;
|
protected TransactionServiceImpl transactionService;
|
||||||
|
protected HistoryService historyService;
|
||||||
|
|
||||||
public void testDeployWorkflowDefinition()
|
public void testDeployWorkflowDefinition()
|
||||||
{
|
{
|
||||||
@@ -1341,6 +1343,7 @@ public abstract class AbstractWorkflowServiceIntegrationTest extends BaseSpringT
|
|||||||
this.workflowService = serviceRegistry.getWorkflowService();
|
this.workflowService = serviceRegistry.getWorkflowService();
|
||||||
this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
|
this.authenticationComponent = (AuthenticationComponent) applicationContext.getBean("authenticationComponent");
|
||||||
this.nodeService = serviceRegistry.getNodeService();
|
this.nodeService = serviceRegistry.getNodeService();
|
||||||
|
this.historyService = (HistoryService) applicationContext.getBean("activitiHistoryService");
|
||||||
Repository repositoryHelper = (Repository) applicationContext.getBean("repositoryHelper");
|
Repository repositoryHelper = (Repository) applicationContext.getBean("repositoryHelper");
|
||||||
this.companyHome = repositoryHelper.getCompanyHome();
|
this.companyHome = repositoryHelper.getCompanyHome();
|
||||||
try
|
try
|
||||||
|
@@ -1,28 +1,28 @@
|
|||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
* the paid license agreement will prevail. Otherwise, the software is
|
* the paid license agreement will prevail. Otherwise, the software is
|
||||||
* provided under the following open source license terms:
|
* provided under the following open source license terms:
|
||||||
*
|
*
|
||||||
* Alfresco is free software: you can redistribute it and/or modify
|
* 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
|
* 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
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
*
|
*
|
||||||
* Alfresco is distributed in the hope that it will be useful,
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Lesser General Public License for more details.
|
* GNU Lesser General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.repo.workflow.activiti;
|
package org.alfresco.repo.workflow.activiti;
|
||||||
|
|
||||||
@@ -35,11 +35,13 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.activiti.engine.history.HistoricProcessInstance;
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.content.MimetypeMap;
|
import org.alfresco.repo.content.MimetypeMap;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.repo.workflow.AbstractWorkflowServiceIntegrationTest;
|
import org.alfresco.repo.workflow.AbstractWorkflowServiceIntegrationTest;
|
||||||
|
import org.alfresco.repo.workflow.WorkflowBuilder;
|
||||||
import org.alfresco.repo.workflow.WorkflowModel;
|
import org.alfresco.repo.workflow.WorkflowModel;
|
||||||
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
|
||||||
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
import org.alfresco.service.cmr.dictionary.TypeDefinition;
|
||||||
@@ -638,6 +640,26 @@ public class ActivitiWorkflowServiceIntegrationTest extends AbstractWorkflowServ
|
|||||||
assertNotNull(completed);
|
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
|
@Override
|
||||||
protected String getEngine()
|
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