Search in sources :

Example 1 with WorkflowService

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);
}
Also used : WorkflowService(com.evolveum.midpoint.model.api.WorkflowService) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 2 with WorkflowService

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());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) WorkflowService(com.evolveum.midpoint.model.api.WorkflowService) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 3 with WorkflowService

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());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ProcessInstanceDto(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ProcessInstanceDtoProvider(com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDtoProvider) Selectable(com.evolveum.midpoint.web.component.util.Selectable) WorkflowService(com.evolveum.midpoint.model.api.WorkflowService) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) MidPointPrincipal(com.evolveum.midpoint.security.api.MidPointPrincipal)

Example 4 with WorkflowService

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);
}
Also used : WorkflowService(com.evolveum.midpoint.model.api.WorkflowService) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 5 with WorkflowService

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);
}
Also used : SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) WorkflowService(com.evolveum.midpoint.model.api.WorkflowService) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) WorkItemDto(com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

WorkflowService (com.evolveum.midpoint.model.api.WorkflowService)7 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)5 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)4 WorkItemDto (com.evolveum.midpoint.web.page.admin.workflow.dto.WorkItemDto)3 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 MidPointPrincipal (com.evolveum.midpoint.security.api.MidPointPrincipal)1 Selectable (com.evolveum.midpoint.web.component.util.Selectable)1 ProcessInstanceDto (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDto)1 ProcessInstanceDtoProvider (com.evolveum.midpoint.web.page.admin.workflow.dto.ProcessInstanceDtoProvider)1 ArrayList (java.util.ArrayList)1