Search in sources :

Example 81 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageTaskEdit method refreshTaskModels.

public void refreshTaskModels() {
    TaskDto oldTaskDto = taskDtoModel.getObject();
    if (oldTaskDto == null) {
        LOGGER.warn("Null or empty taskModel");
        return;
    }
    TaskManager taskManager = getTaskManager();
    OperationResult result = new OperationResult("refresh");
    Task operationTask = taskManager.createTaskInstance("refresh");
    try {
        LOGGER.debug("Refreshing task {}", oldTaskDto);
        TaskType taskType = loadTaskType(oldTaskDto.getOid(), operationTask, result);
        TaskDto newTaskDto = prepareTaskDto(taskType, operationTask, result);
        final ObjectWrapper<TaskType> newWrapper = loadObjectWrapper(taskType.asPrismObject(), operationTask, result);
        previousTaskDto = currentTaskDto;
        currentTaskDto = newTaskDto;
        taskDtoModel.setObject(newTaskDto);
        objectWrapperModel.setObject(newWrapper);
    } catch (ObjectNotFoundException | SchemaException | ExpressionEvaluationException | RuntimeException | Error e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't refresh task {}", e, oldTaskDto);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) TaskManager(com.evolveum.midpoint.task.api.TaskManager) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TaskDto(com.evolveum.midpoint.web.page.admin.server.dto.TaskDto)

Example 82 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageTasks method deleteTaskConfirmedPerformed.

private void deleteTaskConfirmedPerformed(AjaxRequestTarget target, TaskDto task) {
    List<TaskDto> taskDtoList = new ArrayList<>();
    if (task != null) {
        taskDtoList.add(task);
    } else {
        taskDtoList.addAll(WebComponentUtil.getSelectedData(getTaskTable()));
    }
    if (!isSomeTaskSelected(taskDtoList, target)) {
        return;
    }
    OperationResult result = new OperationResult(OPERATION_DELETE_TASKS);
    try {
        getTaskService().suspendAndDeleteTasks(TaskDto.getOids(taskDtoList), WAIT_FOR_TASK_STOP, true, result);
        result.computeStatus();
        if (result.isSuccess()) {
            result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully deleted.");
        }
    } catch (ObjectNotFoundException | SchemaException | SecurityViolationException | RuntimeException e) {
        result.recordFatalError("Couldn't delete the task(s)", e);
    }
    showResult(result);
    TaskDtoProvider provider = (TaskDtoProvider) getTaskTable().getDataTable().getDataProvider();
    provider.clearCache();
    //refresh feedback and table
    refreshTables(target);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 83 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageTasks method stopSchedulersAndTasksPerformed.

private void stopSchedulersAndTasksPerformed(AjaxRequestTarget target, List<String> identifiers) {
    OperationResult result = new OperationResult(OPERATION_STOP_SCHEDULERS_AND_TASKS);
    try {
        boolean suspended = getTaskService().stopSchedulersAndTasks(identifiers, WAIT_FOR_TASK_STOP, result);
        result.computeStatus();
        if (result.isSuccess()) {
            if (suspended) {
                result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been " + "successfully stopped, including tasks that were running on them.");
            } else {
                result.recordWarning("Selected node scheduler(s) have been successfully paused; however, " + "some of the tasks they were executing are still running on them. Please check " + "their completion using task list.");
            }
        }
    } catch (SecurityViolationException | ObjectNotFoundException | SchemaException | RuntimeException e) {
        result.recordFatalError("Couldn't stop schedulers due", e);
    }
    showResult(result);
    //refresh feedback and table
    refreshTables(target);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 84 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageTasks method reactivateServiceThreadsPerformed.

private void reactivateServiceThreadsPerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_REACTIVATE_SERVICE_THREADS);
    try {
        getTaskService().reactivateServiceThreads(result);
        result.computeStatus();
        if (result.isSuccess()) {
            result.recordStatus(OperationResultStatus.SUCCESS, "Service threads on local node have been successfully reactivated.");
        }
    } catch (RuntimeException | SchemaException | SecurityViolationException e) {
        result.recordFatalError("Couldn't reactivate service threads on local node", e);
    }
    showResult(result);
    //refresh feedback and table
    refreshTables(target);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 85 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageTasks method scheduleTasksPerformed.

private void scheduleTasksPerformed(AjaxRequestTarget target, List<String> oids) {
    OperationResult result = new OperationResult(OPERATION_SCHEDULE_TASKS);
    try {
        getTaskService().scheduleTasksNow(oids, result);
        result.computeStatus();
        if (result.isSuccess()) {
            result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully scheduled.");
        }
    } catch (ObjectNotFoundException | SchemaException | SecurityViolationException | RuntimeException e) {
        result.recordFatalError("Couldn't schedule the task(s)", e);
    }
    showResult(result);
    //refresh feedback and table
    refreshTables(target);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

SchemaException (com.evolveum.midpoint.util.exception.SchemaException)576 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)235 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)214 QName (javax.xml.namespace.QName)132 SystemException (com.evolveum.midpoint.util.exception.SystemException)113 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)100 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)100 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)92 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)89 Task (com.evolveum.midpoint.task.api.Task)87 PrismObject (com.evolveum.midpoint.prism.PrismObject)86 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)69 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)68 ArrayList (java.util.ArrayList)67 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)59 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)49 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)47 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)46 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)34 Test (org.testng.annotations.Test)34