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


Java HistoryService.deleteHistoricProcessInstance方法代码示例

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


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

示例1: deleteProcessInstance

import org.activiti.engine.HistoryService; //导入方法依赖的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: cleanProcessDefinitionHistory

import org.activiti.engine.HistoryService; //导入方法依赖的package包/类
private void cleanProcessDefinitionHistory(HistoryService hs, String... definitions) {

        for (String definitionId : definitions) {
            List<HistoricProcessInstance> hpiList = hs.createHistoricProcessInstanceQuery()
                .processDefinitionId(definitionId)
                .orderByProcessDefinitionId().asc().list();
            if (hpiList == null || hpiList.size() == 0) {
                out().printf("No History found for process definition %s %n", definitionId);
                break;
            }
            for (HistoricProcessInstance hpi : hpiList) {
                String processId = hpi.getId();
                hs.deleteHistoricProcessInstance(hpi.getId());
                out().printf("History removed for process instance %s with definition %s%n", processId,
                    definitionId);
            }
        }
    }
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:19,代码来源:CleanHistoryActivitiCommand.java

示例3: deleteProcessInstance

import org.activiti.engine.HistoryService; //导入方法依赖的package包/类
private void deleteProcessInstance(String instanceId, OperationResult parentResult) {
      OperationResult result = parentResult.createSubresult(OPERATION_DELETE_PROCESS_INSTANCE);
      result.addParam("instanceId", instanceId);

      HistoryService hs = activitiEngine.getHistoryService();
      try {
          hs.deleteHistoricProcessInstance(instanceId);
      } catch (RuntimeException e) {
          result.recordFatalError("Process instance couldn't be deleted: " + e.getMessage(), e);
	throw e;
      } finally {
	result.computeStatusIfUnknown();
}
  }
 
开发者ID:Pardus-Engerek,项目名称:engerek,代码行数:15,代码来源:ProcessInstanceManager.java

示例4: deleteAllCompletedInstances

import org.activiti.engine.HistoryService; //导入方法依赖的package包/类
/**
 * Delete all completed instances
 */
public void deleteAllCompletedInstances(){
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
    HistoricProcessInstanceQuery query =
            historyService.createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString()).finished();
    for(HistoricProcessInstance instance: query.list()){
        historyService.deleteHistoricProcessInstance(instance.getId());
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:13,代码来源:BPMNInstanceService.java

示例5: cleanAllHistory

import org.activiti.engine.HistoryService; //导入方法依赖的package包/类
private void cleanAllHistory(HistoryService hs) {
    out().println("Cleaning History of All Process Instances...");
    List<HistoricProcessInstance> hpiList = hs.createHistoricProcessInstanceQuery()
        .orderByProcessDefinitionId().asc().list();
    if (hpiList == null || hpiList.size() == 0) {
        out().println("No Process History found! ");
        return;
    }
    for (HistoricProcessInstance hpi : hpiList) {
        String processId = hpi.getId();
        hs.deleteHistoricProcessInstance(hpi.getId());
        out().printf("History removed for process instance %s %n", processId);
    }
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:15,代码来源:CleanHistoryActivitiCommand.java

示例6: cleanProcessInstanceHistory

import org.activiti.engine.HistoryService; //导入方法依赖的package包/类
private void cleanProcessInstanceHistory(HistoryService hs, String... instances) {
    for (String instanceId : instances) {
        // query and if exists delete.
        HistoricProcessInstance hpi = hs.createHistoricProcessInstanceQuery()
            .processInstanceId(instanceId).singleResult();
        if (hpi != null) {
            hs.deleteHistoricProcessInstance(hpi.getId());
            out().printf("History removed for process instance %s %n", hpi.getId());
        } else {
            out().printf("No History found for process instance %s %n", instanceId);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:14,代码来源:CleanHistoryActivitiCommand.java

示例7: deleteHistoryInstance

import org.activiti.engine.HistoryService; //导入方法依赖的package包/类
/**
 * Delete history instance by instance ID
 * @param instanceId
 */
public void deleteHistoryInstance(String instanceId){
    HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
    historyService.deleteHistoricProcessInstance(instanceId);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:9,代码来源:BPMNInstanceService.java


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