Search in sources :

Example 61 with SecurityViolationException

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

the class PageTasks method startSchedulersPerformed.

private void startSchedulersPerformed(AjaxRequestTarget target, List<String> identifiers) {
    OperationResult result = new OperationResult(OPERATION_START_SCHEDULERS);
    try {
        getTaskService().startSchedulers(identifiers, result);
        result.computeStatus();
        if (result.isSuccess()) {
            result.recordStatus(OperationResultStatus.SUCCESS, "Selected node scheduler(s) have been successfully started.");
        }
    } catch (SecurityViolationException | ObjectNotFoundException | SchemaException | RuntimeException e) {
        result.recordFatalError("Couldn't start the scheduler(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)

Example 62 with SecurityViolationException

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

the class PageTasks method synchronizeWorkflowRequestsPerformed.

private void synchronizeWorkflowRequestsPerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_SYNCHRONIZE_WORKFLOW_REQUESTS);
    try {
        getTaskService().synchronizeWorkflowRequests(result);
        result.computeStatusIfUnknown();
        if (result.isSuccess()) {
            // brutal hack - the subresult's message contains statistics
            result.recordStatus(OperationResultStatus.SUCCESS, result.getLastSubresult().getMessage());
        }
    } catch (RuntimeException | SchemaException | SecurityViolationException e) {
        result.recordFatalError("Couldn't synchronize tasks", 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 63 with SecurityViolationException

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

the class PageTasks method suspendTasksPerformed.

private void suspendTasksPerformed(AjaxRequestTarget target, List<String> oidList) {
    OperationResult result = new OperationResult(OPERATION_SUSPEND_TASKS);
    try {
        boolean suspended = getTaskService().suspendTasks(oidList, WAIT_FOR_TASK_STOP, result);
        result.computeStatus();
        if (result.isSuccess()) {
            if (suspended) {
                result.recordStatus(OperationResultStatus.SUCCESS, "The task(s) have been successfully suspended.");
            } else {
                result.recordWarning("Task(s) suspension has been successfully requested; please check for its completion using task list.");
            }
        }
    } catch (ObjectNotFoundException | SchemaException | SecurityViolationException | RuntimeException e) {
        result.recordFatalError("Couldn't suspend 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)

Example 64 with SecurityViolationException

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

the class PageTasks method deactivateServiceThreadsPerformed.

//endregion
//region Diagnostics actions
private void deactivateServiceThreadsPerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_DEACTIVATE_SERVICE_THREADS);
    try {
        boolean stopped = getTaskService().deactivateServiceThreads(WAIT_FOR_TASK_STOP, result);
        result.computeStatus();
        if (result.isSuccess()) {
            if (stopped) {
                result.recordStatus(OperationResultStatus.SUCCESS, "Service threads on local node have been successfully deactivated.");
            } else {
                result.recordWarning("Deactivation of service threads on local node have been successfully requested; however, some of the tasks are still running. Please check their completion using task list.");
            }
        }
    } catch (RuntimeException | SchemaException | SecurityViolationException e) {
        result.recordFatalError("Couldn't deactivate service threads on this 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 65 with SecurityViolationException

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

the class ResourceContentPanel method updateResourceObjectStatusPerformed.

protected void updateResourceObjectStatusPerformed(ShadowType selected, AjaxRequestTarget target, boolean enabled) {
    List<ShadowType> selectedShadow = getSelectedShadowsList(selected);
    OperationResult result = new OperationResult(OPERATION_UPDATE_STATUS);
    Task task = pageBase.createSimpleTask(OPERATION_UPDATE_STATUS);
    if (selectedShadow == null || selectedShadow.isEmpty()) {
        result.recordWarning("Nothing selected to update status");
        getPageBase().showResult(result);
        target.add(getPageBase().getFeedbackPanel());
        return;
    }
    ModelExecuteOptions opts = createModelOptions();
    for (ShadowType shadow : selectedShadow) {
        ActivationStatusType status = enabled ? ActivationStatusType.ENABLED : ActivationStatusType.DISABLED;
        try {
            ObjectDelta<ShadowType> deleteDelta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, shadow.getOid(), SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS, getPageBase().getPrismContext(), status);
            getPageBase().getModelService().executeChanges(WebComponentUtil.createDeltaCollection(deleteDelta), opts, task, result);
        } catch (ObjectAlreadyExistsException | ObjectNotFoundException | SchemaException | ExpressionEvaluationException | CommunicationException | ConfigurationException | PolicyViolationException | SecurityViolationException e) {
            // TODO Auto-generated catch block
            result.recordPartialError("Could not update status (to " + status + ") for " + shadow, e);
            LOGGER.error("Could not update status (to {}) for {}, using option {}", status, shadow, opts, e);
            continue;
        }
    }
    result.computeStatusIfUnknown();
    getPageBase().showResult(result);
    getTable().refreshTable(null, target);
    target.add(getPageBase().getFeedbackPanel());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) ActivationStatusType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationStatusType) ModelExecuteOptions(com.evolveum.midpoint.model.api.ModelExecuteOptions) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) PolicyViolationException(com.evolveum.midpoint.util.exception.PolicyViolationException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)

Aggregations

SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)131 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)109 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)93 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)84 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)66 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)64 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)57 Task (com.evolveum.midpoint.task.api.Task)53 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)35 SystemException (com.evolveum.midpoint.util.exception.SystemException)29 PrismObject (com.evolveum.midpoint.prism.PrismObject)24 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)24 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)19 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)17 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)17 ArrayList (java.util.ArrayList)17 GenericFrameworkException (com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException)15 QName (javax.xml.namespace.QName)13 Test (org.testng.annotations.Test)12 ResultHandler (com.evolveum.midpoint.schema.ResultHandler)11