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