當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。