当前位置: 首页>>代码示例>>Java>>正文


Java RuntimeService.deleteProcessInstance方法代码示例

本文整理汇总了Java中org.activiti.engine.RuntimeService.deleteProcessInstance方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeService.deleteProcessInstance方法的具体用法?Java RuntimeService.deleteProcessInstance怎么用?Java RuntimeService.deleteProcessInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.activiti.engine.RuntimeService的用法示例。


在下文中一共展示了RuntimeService.deleteProcessInstance方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteProcessInstance

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
/**
 * Delete process instance by passing instance ID
 *
 * @param instanceId
 * @throws BPSFault
 */
public void deleteProcessInstance(String instanceId) throws BPSFault {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    RuntimeService runtimeService = BPMNServerHolder.getInstance().getEngine().getRuntimeService();
    List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery()
            .processInstanceTenantId(tenantId.toString()).processInstanceId(instanceId).list();
    if (processInstances.isEmpty()) {
        HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
        List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery()
                .processInstanceTenantId(tenantId.toString()).processInstanceId(instanceId).list();
        if (historicProcessInstances.isEmpty()) {
            String msg = "No process instances with the ID: " + instanceId;
            log.error(msg);
            throw new BPSFault(msg);
        }
        historyService.deleteHistoricProcessInstance(instanceId);
        return;
    }
    runtimeService.deleteProcessInstance(instanceId, "Deleted by user: " + tenantId);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:26,代码来源:BPMNInstanceService.java

示例2: stopProcessInstance

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
public void stopProcessInstance(String instanceId, String username, OperationResult parentResult) {
    OperationResult result = parentResult.createSubresult(OPERATION_STOP_PROCESS_INSTANCE);
    result.addParam("instanceId", instanceId);

    RuntimeService rs = activitiEngine.getRuntimeService();
    try {
        LOGGER.trace("Stopping process instance {} on the request of {}", instanceId, username);
        String deletionMessage = "Process instance stopped on the request of " + username;
        rs.setVariable(instanceId, CommonProcessVariableNames.VARIABLE_PROCESS_INSTANCE_IS_STOPPING, Boolean.TRUE);
        rs.deleteProcessInstance(instanceId, deletionMessage);
    } catch (RuntimeException e) {
        result.recordFatalError("Process instance couldn't be stopped: " + e.getMessage(), e);
        throw e;
    } finally {
        result.computeStatusIfUnknown();
    }
}
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:18,代码来源:ProcessInstanceManager.java

示例3: testDeploy

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
public void testDeploy() throws Exception
    {
        ProcessEngine engine = buildProcessEngine();

        RepositoryService repoService = engine.getRepositoryService();

        Deployment deployment = deployDefinition(repoService);

        assertNotNull(deployment);

        RuntimeService runtimeService = engine.getRuntimeService();
        try
        {
            ProcessInstance instance = runtimeService.startProcessInstanceByKey("testTask");
            assertNotNull(instance);
            
            String instanceId = instance.getId();
            ProcessInstance instanceInDb = findProcessInstance(runtimeService, instanceId);
            assertNotNull(instanceInDb);
            runtimeService.deleteProcessInstance(instanceId, "");
        }
        finally
        {
            
//            List<Deployment> deployments = repoService.createDeploymentQuery().list();
//            for (Deployment deployment2 : deployments)
//            {
//                repoService.deleteDeployment(deployment2.getId());
//            }
            
            repoService.deleteDeployment(deployment.getId());
        }
    }
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:ActivitiSmokeTest.java

示例4: teardown

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
@After
public void teardown() {
	RuntimeService runtimeService = processEngine.getRuntimeService();
	List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().list();
	for (ProcessInstance processInstance : processInstances) {
		runtimeService.deleteProcessInstance(processInstance.getId(), "");
	}

	TaskService taskService = processEngine.getTaskService();
	List<Task> tasks = taskService.createTaskQuery().list();
	for (Task task : tasks) {
		taskService.deleteTask(task.getId());
	}
}
 
开发者ID:crnk-project,项目名称:crnk-framework,代码行数:15,代码来源:ActivitiTestBase.java

示例5: removeProcessInstance

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
/**
 * 删除流程实例.
 */
@RequestMapping("console-removeProcessInstance")
public String removeProcessInstance(
        @RequestParam("processInstanceId") String processInstanceId,
        @RequestParam("deleteReason") String deleteReason) {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    runtimeService.deleteProcessInstance(processInstanceId, deleteReason);

    return "redirect:/bpm/console-listProcessInstances.do";
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:13,代码来源:ConsoleController.java

示例6: deleteProcessInstance

import org.activiti.engine.RuntimeService; //导入方法依赖的package包/类
@DELETE
@Path("/{processInstanceId}")
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response deleteProcessInstance(@PathParam("processInstanceId") String processInstanceId) {

    RuntimeService runtimeService = BPMNOSGIService.getRuntimeService();
    String deleteReason = uriInfo.getQueryParameters().getFirst("deleteReason");
    if (deleteReason == null) {
        deleteReason = "";
    }
    ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);

    runtimeService.deleteProcessInstance(processInstance.getId(), deleteReason);
    return Response.ok().status(Response.Status.NO_CONTENT).build();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:16,代码来源:ProcessInstanceService.java


注:本文中的org.activiti.engine.RuntimeService.deleteProcessInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。