Search in sources :

Example 6 with SchemaException

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

the class ScriptExecutionHandlerDto method getScript.

public String getScript() {
    ExecuteScriptType script = taskDto.getExtensionPropertyRealValue(SchemaConstants.SE_EXECUTE_SCRIPT, ExecuteScriptType.class);
    if (script == null) {
        return null;
    }
    PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
    try {
        return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(script, SchemaConstants.SE_EXECUTE_SCRIPT));
    } catch (SchemaException e) {
        throw new SystemException("Couldn't serialize script: " + e.getMessage(), e);
    }
}
Also used : MidPointApplication(com.evolveum.midpoint.web.security.MidPointApplication) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExecuteScriptType(com.evolveum.midpoint.xml.ns._public.model.scripting_3.ExecuteScriptType) SystemException(com.evolveum.midpoint.util.exception.SystemException) PrismContext(com.evolveum.midpoint.prism.PrismContext)

Example 7 with SchemaException

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

the class DefaultGuiProgressListener method getResourceName.

private String getResourceName(@NotNull String oid) {
    String name = nameCache.get(oid);
    if (name != null) {
        return name;
    }
    Task task = parentPage.createSimpleTask("getResourceName");
    OperationResult result = new OperationResult("getResourceName");
    // todo what about security?
    Collection<SelectorOptions<GetOperationOptions>> raw = SelectorOptions.createCollection(GetOperationOptions.createRaw());
    try {
        PrismObject<ResourceType> object = parentPage.getModelService().getObject(ResourceType.class, oid, raw, task, result);
        name = PolyString.getOrig(object.asObjectable().getName());
    } catch (ObjectNotFoundException | SchemaException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't determine the name of resource {}", e, oid);
        name = "(" + oid + ")";
    }
    nameCache.put(oid, name);
    return name;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceOperationResult(com.evolveum.midpoint.web.component.progress.ProgressReportActivityDto.ResourceOperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 8 with SchemaException

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

the class ExecuteChangesHandlerDto method getObjectDeltaXml.

public String getObjectDeltaXml() {
    ObjectDeltaType objectDeltaType = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA, ObjectDeltaType.class);
    if (objectDeltaType == null) {
        return null;
    }
    PrismContext prismContext = MidPointApplication.get().getPrismContext();
    try {
        return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(objectDeltaType, SchemaConstants.MODEL_EXTENSION_OBJECT_DELTA));
    } catch (SchemaException e) {
        throw new SystemException("Couldn't serialize object delta: " + e.getMessage(), e);
    }
}
Also used : ObjectDeltaType(com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SystemException(com.evolveum.midpoint.util.exception.SystemException) PrismContext(com.evolveum.midpoint.prism.PrismContext)

Example 9 with SchemaException

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

the class QueryBasedHandlerDto method getObjectQuery.

public String getObjectQuery() {
    QueryType query = taskDto.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY, QueryType.class);
    if (query == null) {
        return null;
    }
    PrismContext prismContext = ((MidPointApplication) Application.get()).getPrismContext();
    try {
        return WebXmlUtil.stripNamespaceDeclarations(prismContext.xmlSerializer().serializeAnyData(query, SchemaConstants.MODEL_EXTENSION_OBJECT_QUERY));
    } catch (SchemaException e) {
        throw new SystemException("Couldn't serialize query: " + e.getMessage(), e);
    }
}
Also used : MidPointApplication(com.evolveum.midpoint.web.security.MidPointApplication) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SystemException(com.evolveum.midpoint.util.exception.SystemException) PrismContext(com.evolveum.midpoint.prism.PrismContext) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType)

Example 10 with SchemaException

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

the class TaskCurrentStateDtoModel method refresh.

public void refresh(PageBase page) {
    object = null;
    if (taskModel == null || taskModel.getObject() == null) {
        LOGGER.warn("Null or empty taskModel");
        return;
    }
    TaskManager taskManager = page.getTaskManager();
    OperationResult result = new OperationResult("refresh");
    Task operationTask = taskManager.createTaskInstance("refresh");
    String oid = taskModel.getObject().getOid();
    try {
        LOGGER.debug("Refreshing task {}", taskModel.getObject());
        Collection<SelectorOptions<GetOperationOptions>> options = GetOperationOptions.createRetrieveAttributesOptions(TaskType.F_SUBTASK, TaskType.F_NODE_AS_OBSERVED);
        PrismObject<TaskType> task = page.getModelService().getObject(TaskType.class, oid, options, operationTask, result);
        TaskDto taskDto = new TaskDto(task.asObjectable(), page.getModelService(), page.getTaskService(), page.getModelInteractionService(), taskManager, page.getWorkflowManager(), TaskDtoProviderOptions.fullOptions(), operationTask, result, page);
        taskModel.setObject(taskDto);
    } catch (CommunicationException | ObjectNotFoundException | SchemaException | SecurityViolationException | ConfigurationException | ExpressionEvaluationException | RuntimeException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't refresh task {}", e, taskModel.getObject());
    }
}
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) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) TaskManager(com.evolveum.midpoint.task.api.TaskManager) SelectorOptions(com.evolveum.midpoint.schema.SelectorOptions) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

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