use of com.evolveum.midpoint.model.api.WorkflowService in project midpoint by Evolveum.
the class PageWorkItem method claimPerformed.
private void claimPerformed(AjaxRequestTarget target) {
OperationResult result = new OperationResult(OPERATION_CLAIM_WORK_ITEM);
WorkflowService workflowService = getWorkflowService();
try {
workflowService.claimWorkItem(workItemDtoModel.getObject().getWorkItemId(), result);
} catch (SecurityViolationException | ObjectNotFoundException | RuntimeException e) {
result.recordFatalError("Couldn't claim work item due to an unexpected exception.", e);
}
processResult(target, result, true);
}
use of com.evolveum.midpoint.model.api.WorkflowService in project midpoint by Evolveum.
the class PageAbout method cleanupActivitiProcessesPerformed.
private void cleanupActivitiProcessesPerformed(AjaxRequestTarget target) {
OperationResult result = new OperationResult(OPERATION_CLEANUP_ACTIVITI_PROCESSES);
try {
WorkflowService workflowService = getWorkflowService();
workflowService.cleanupActivitiProcesses(result);
} catch (SecurityViolationException | SchemaException | RuntimeException e) {
result.recordFatalError(e);
} finally {
result.computeStatusIfUnknown();
}
showResult(result);
target.add(getFeedbackPanel());
}
use of com.evolveum.midpoint.model.api.WorkflowService in project midpoint by Evolveum.
the class PageProcessInstances method stopProcessInstancesPerformed.
private void stopProcessInstancesPerformed(AjaxRequestTarget target) {
MidPointPrincipal user = SecurityUtils.getPrincipalUser();
List<ProcessInstanceDto> selectedStoppableInstances = new ArrayList<>();
for (Selectable row : WebComponentUtil.getSelectedData(getTable())) {
ProcessInstanceDto instance = (ProcessInstanceDto) row;
if (instance.getEndTimestamp() == null) {
selectedStoppableInstances.add(instance);
}
}
if (!isSomeItemSelected(selectedStoppableInstances, true, target)) {
return;
}
OperationResult result = new OperationResult(OPERATION_STOP_PROCESS_INSTANCES);
WorkflowService workflowService = getWorkflowService();
for (ProcessInstanceDto instance : selectedStoppableInstances) {
try {
workflowService.stopProcessInstance(instance.getProcessInstanceId(), WebComponentUtil.getOrigStringFromPoly(user.getName()), result);
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException | RuntimeException ex) {
result.createSubresult(OPERATION_STOP_PROCESS_INSTANCE).recordPartialError("Couldn't stop process instance " + instance.getName(), ex);
}
}
if (result.isUnknown()) {
result.recomputeStatus();
}
if (result.isSuccess()) {
result.recordStatus(OperationResultStatus.SUCCESS, "Selected process instance(s) have been successfully stopped.");
}
showResult(result);
ProcessInstanceDtoProvider provider = (ProcessInstanceDtoProvider) getTable().getDataTable().getDataProvider();
provider.clearCache();
//refresh feedback and table
target.add(getFeedbackPanel());
target.add(getTable());
}
use of com.evolveum.midpoint.model.api.WorkflowService in project midpoint by Evolveum.
the class PageWorkItem method releasePerformed.
private void releasePerformed(AjaxRequestTarget target) {
OperationResult result = new OperationResult(OPERATION_RELEASE_WORK_ITEM);
WorkflowService workflowService = getWorkflowService();
try {
workflowService.releaseWorkItem(workItemDtoModel.getObject().getWorkItem().getExternalId(), result);
} catch (SecurityViolationException | ObjectNotFoundException | RuntimeException e) {
result.recordFatalError("Couldn't release work item due to an unexpected exception.", e);
}
processResult(target, result, true);
}
use of com.evolveum.midpoint.model.api.WorkflowService in project midpoint by Evolveum.
the class PageWorkItems method releaseWorkItemsPerformed.
private void releaseWorkItemsPerformed(AjaxRequestTarget target) {
List<WorkItemDto> workItemDtoList = getWorkItemsPanel().getSelectedWorkItems();
if (!isSomeItemSelected(workItemDtoList, target)) {
return;
}
OperationResult mainResult = new OperationResult(OPERATION_RELEASE_ITEMS);
WorkflowService workflowService = getWorkflowService();
for (WorkItemDto workItemDto : workItemDtoList) {
OperationResult result = mainResult.createSubresult(OPERATION_RELEASE_ITEM);
try {
workflowService.releaseWorkItem(workItemDto.getWorkItemId(), result);
result.computeStatusIfUnknown();
} catch (ObjectNotFoundException | SecurityViolationException | RuntimeException e) {
result.recordPartialError("Couldn't release work item due to an unexpected exception.", e);
}
}
if (mainResult.isUnknown()) {
mainResult.recomputeStatus();
}
if (mainResult.isSuccess()) {
mainResult.recordStatus(OperationResultStatus.SUCCESS, "The work item(s) have been successfully released.");
}
showResult(mainResult);
resetWorkItemCountModel();
target.add(this);
}
Aggregations