本文整理汇总了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);
}
示例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();
}
}
示例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());
}
}
示例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());
}
}
示例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";
}
示例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();
}