Search in sources :

Example 1 with ExpressionEvaluationException

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

the class SampleFormFocusTabPanel method initLayout.

private void initLayout(final LoadableModel<ObjectWrapper<F>> focusModel, LoadableModel<List<AssignmentEditorDto>> assignmentsModel, PageBase pageBase) {
    add(new Label(ID_HEADER, "Object details"));
    WebMarkupContainer body = new WebMarkupContainer("body");
    add(body);
    addPrismPropertyPanel(body, ID_PROP_NAME, FocusType.F_NAME);
    addPrismPropertyPanel(body, ID_PROP_FULL_NAME, UserType.F_FULL_NAME);
    // TODO: create proxy for these operations
    Task task = pageBase.createSimpleTask(OPERATION_SEARCH_ROLES);
    List<PrismObject<RoleType>> availableRoles;
    try {
        availableRoles = pageBase.getModelService().searchObjects(RoleType.class, null, null, task, task.getResult());
    } catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
        task.getResult().recordFatalError(e);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load roles", e);
        availableRoles = new ArrayList<>();
    // TODO: better errror reporting
    }
    add(new SimpleRoleSelector<F, RoleType>(ID_ROLES, assignmentsModel, availableRoles));
}
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) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) Label(org.apache.wicket.markup.html.basic.Label) ArrayList(java.util.ArrayList) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) PrismObject(com.evolveum.midpoint.prism.PrismObject) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 2 with ExpressionEvaluationException

use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException 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 3 with ExpressionEvaluationException

use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException 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)

Example 4 with ExpressionEvaluationException

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

the class AccCertUpdateHelper method addObject.

//endregion
//region ================================ Model and repository operations ================================
void addObject(ObjectType objectType, Task task, OperationResult result) throws ObjectAlreadyExistsException, SchemaException, ObjectNotFoundException {
    ObjectDelta<? extends ObjectType> objectDelta = ObjectDelta.createAddDelta(objectType.asPrismObject());
    Collection<ObjectDeltaOperation<? extends ObjectType>> ops;
    try {
        ops = modelService.executeChanges(Collections.singleton(objectDelta), ModelExecuteOptions.createRaw().setPreAuthorized(), task, result);
    } catch (ExpressionEvaluationException | CommunicationException | ConfigurationException | PolicyViolationException | SecurityViolationException e) {
        throw new SystemException("Unexpected exception when adding object: " + e.getMessage(), e);
    }
    ObjectDeltaOperation odo = ops.iterator().next();
    objectType.setOid(odo.getObjectDelta().getOid());
/* ALTERNATIVELY, we can go directly into the repository. (No audit there.)
        String oid = repositoryService.addObject(objectType.asPrismObject(), null, result);
        objectType.setOid(oid);
         */
}
Also used : ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) ObjectDeltaOperation(com.evolveum.midpoint.schema.ObjectDeltaOperation) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) SystemException(com.evolveum.midpoint.util.exception.SystemException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) PolicyViolationException(com.evolveum.midpoint.util.exception.PolicyViolationException)

Example 5 with ExpressionEvaluationException

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

the class AssignmentProcessor method processAssignmentsProjections.

/**
     * Processing all the assignments to determine which projections should be added, deleted or kept as they are.
     * Generic method for all projection types (theoretically). 
     */
@SuppressWarnings("unchecked")
public <O extends ObjectType> void processAssignmentsProjections(LensContext<O> context, XMLGregorianCalendar now, Task task, OperationResult parentResult) throws SchemaException, ObjectNotFoundException, ExpressionEvaluationException, PolicyViolationException, CommunicationException, ConfigurationException, SecurityViolationException {
    LensFocusContext<O> focusContext = context.getFocusContext();
    if (focusContext == null) {
        return;
    }
    if (!FocusType.class.isAssignableFrom(focusContext.getObjectTypeClass())) {
        // We can do this only for FocusType.
        return;
    }
    //    	if (ModelExecuteOptions.isLimitPropagation(context.getOptions()) && SchemaConstants.CHANGE_CHANNEL_DISCOVERY.equals(QNameUtil.uriToQName(context.getChannel()))){
    //    		//do not execute assignment if the execution was triggered by compensation mechanism and limitPropagation is set
    //    		return;
    //    	}
    OperationResult result = parentResult.createSubresult(AssignmentProcessor.class.getName() + ".processAssignmentsProjections");
    try {
        processAssignmentsProjectionsWithFocus((LensContext<? extends FocusType>) context, now, task, result);
    } catch (SchemaException | ObjectNotFoundException | ExpressionEvaluationException | PolicyViolationException | CommunicationException | ConfigurationException | SecurityViolationException | RuntimeException | Error e) {
        result.recordFatalError(e);
        throw e;
    }
    OperationResultStatus finalStatus = OperationResultStatus.SUCCESS;
    String message = null;
    int errors = 0;
    for (OperationResult subresult : result.getSubresults()) {
        if (subresult.isError()) {
            errors++;
            if (message == null) {
                message = subresult.getMessage();
            } else {
                message = errors + " errors";
            }
            finalStatus = OperationResultStatus.PARTIAL_ERROR;
        }
    }
    result.setStatus(finalStatus);
    result.setMessage(message);
    result.cleanupResult();
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) 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) OperationResultStatus(com.evolveum.midpoint.schema.result.OperationResultStatus) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) PolicyViolationException(com.evolveum.midpoint.util.exception.PolicyViolationException)

Aggregations

ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)120 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)93 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)92 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)71 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)71 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)69 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)59 Task (com.evolveum.midpoint.task.api.Task)35 SystemException (com.evolveum.midpoint.util.exception.SystemException)32 PrismObject (com.evolveum.midpoint.prism.PrismObject)29 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)28 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)26 QName (javax.xml.namespace.QName)23 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)21 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)21 ArrayList (java.util.ArrayList)19 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)17 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)13 Collection (java.util.Collection)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)12