use of org.activiti.engine.HistoryService in project Activiti by Activiti.
the class ArchivedPage method createDetailComponent.
@Override
protected Component createDetailComponent(String id) {
HistoryService historyService = ProcessEngines.getDefaultProcessEngine().getHistoryService();
HistoricTaskInstance historicTaskInstance = historyService.createHistoricTaskInstanceQuery().taskId(id).singleResult();
taskEventPanel.setTaskId(historicTaskInstance.getId());
return new HistoricTaskDetailPanel(historicTaskInstance, this);
}
use of org.activiti.engine.HistoryService in project midpoint by Evolveum.
the class ProcessInstanceManager method deleteProcessInstance.
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();
}
}
use of org.activiti.engine.HistoryService in project bamboobsc by billchen198318.
the class TestBPMN001 method queryHistory.
@Test
public void queryHistory() throws Exception {
HistoryService historyService = (HistoryService) AppContext.getBean("historyService");
List<HistoricTaskInstance> taskInstances = historyService.createHistoricTaskInstanceQuery().finished().list();
for (HistoricTaskInstance taskInst : taskInstances) {
System.out.println(taskInst.getId() + " , " + taskInst.getName() + " , " + taskInst.getFormKey() + " , " + taskInst.getAssignee());
}
}
use of org.activiti.engine.HistoryService in project carbon-business-process by wso2.
the class HistoricDetailService method getVariableFromRequest.
public RestVariable getVariableFromRequest(boolean includeBinary, String detailId) {
Object value = null;
HistoricVariableUpdate variableUpdate = null;
HistoryService historyService = BPMNOSGIService.getHistoryService();
HistoricDetail detailObject = historyService.createHistoricDetailQuery().id(detailId).singleResult();
if (detailObject instanceof HistoricVariableUpdate) {
variableUpdate = (HistoricVariableUpdate) detailObject;
value = variableUpdate.getValue();
}
if (value == null) {
throw new ActivitiObjectNotFoundException("Historic detail '" + detailId + "' doesn't have a variable value.", VariableInstanceEntity.class);
} else {
return new RestResponseFactory().createRestVariable(variableUpdate.getVariableName(), value, null, detailId, RestResponseFactory.VARIABLE_HISTORY_DETAIL, includeBinary, uriInfo.getBaseUri().toString());
}
}
use of org.activiti.engine.HistoryService in project carbon-business-process by wso2.
the class HistoricTaskInstanceService method getVariableFromRequest.
protected RestVariable getVariableFromRequest(boolean includeBinary, String taskId, String variableName, String scope) {
HistoryService historyService = BPMNOSGIService.getHistoryService();
RestVariable.RestVariableScope variableScope = RestVariable.getScopeFromString(scope);
HistoricTaskInstanceQuery taskQuery = historyService.createHistoricTaskInstanceQuery().taskId(taskId);
if (variableScope != null) {
if (variableScope == RestVariable.RestVariableScope.GLOBAL) {
taskQuery.includeProcessVariables();
} else {
taskQuery.includeTaskLocalVariables();
}
} else {
taskQuery.includeTaskLocalVariables().includeProcessVariables();
}
HistoricTaskInstance taskObject = taskQuery.singleResult();
if (taskObject == null) {
throw new ActivitiObjectNotFoundException("Historic task instance '" + taskId + "' couldn't be found.", HistoricTaskInstanceEntity.class);
}
Object value = null;
if (variableScope != null) {
if (variableScope == RestVariable.RestVariableScope.GLOBAL) {
value = taskObject.getProcessVariables().get(variableName);
} else {
value = taskObject.getTaskLocalVariables().get(variableName);
}
} else {
// look for local task restVariables first
if (taskObject.getTaskLocalVariables().containsKey(variableName)) {
value = taskObject.getTaskLocalVariables().get(variableName);
} else {
value = taskObject.getProcessVariables().get(variableName);
}
}
if (value == null) {
throw new ActivitiObjectNotFoundException("Historic task instance '" + taskId + "' variable value for " + variableName + " couldn't be found.", VariableInstanceEntity.class);
} else {
return new RestResponseFactory().createRestVariable(variableName, value, null, taskId, RestResponseFactory.VARIABLE_HISTORY_TASK, includeBinary, uriInfo.getBaseUri().toString());
}
}
Aggregations