Search in sources :

Example 1 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class H3Header method createFetchErrorVisibleBehaviour.

private VisibleEnableBehaviour createFetchErrorVisibleBehaviour() {
    return new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            OperationResult fetchResult = getModelObject().getFetchResult();
            if (fetchResult != null && !WebComponentUtil.isSuccessOrHandledError(fetchResult)) {
                return true;
            }
            OperationResult result = getModelObject().getResult();
            if (result != null && !WebComponentUtil.isSuccessOrHandledError(result)) {
                return true;
            }
            return false;
        }
    };
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 2 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class ObjectHistoryTabPanel method getReconstructedObject.

private PrismObject<F> getReconstructedObject(String oid, String eventIdentifier, Class type) {
    OperationResult result = new OperationResult(OPERATION_RESTRUCT_OBJECT);
    try {
        Task task = getPageBase().createSimpleTask(OPERATION_RESTRUCT_OBJECT);
        PrismObject<F> object = WebModelServiceUtils.reconstructObject(type, oid, eventIdentifier, task, result);
        return object;
    } catch (Exception ex) {
        result.recordFatalError("Couldn't restruct object.", ex);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't restruct object", ex);
    }
    return null;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 3 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class CheckTableHeader method createFetchErrorVisibleBehaviour.

private VisibleEnableBehaviour createFetchErrorVisibleBehaviour() {
    return new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            OperationResult fetchResult = getModelObject().getFetchResult();
            if (fetchResult != null && !WebComponentUtil.isSuccessOrHandledError(fetchResult)) {
                return true;
            }
            //TODO: do we need to check overall status????
            OperationResult result = getModelObject().getResult();
            result.computeStatusIfUnknown();
            if (result != null && !WebComponentUtil.isSuccessOrHandledError(result)) {
                return true;
            }
            return false;
        }
    };
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)

Example 4 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class ObjectWrapperFactory method createObjectWrapper.

public <O extends ObjectType> ObjectWrapper<O> createObjectWrapper(String displayName, String description, PrismObject<O> object, ContainerStatus status, boolean delayContainerCreation, AuthorizationPhaseType authorizationPhase, Task task) {
    if (authorizationPhase == null) {
        authorizationPhase = AuthorizationPhaseType.REQUEST;
    }
    try {
        //        	Task task = modelServiceLocator.createSimpleTask(CREATE_OBJECT_WRAPPER);
        OperationResult result = task.getResult();
        PrismObjectDefinition<O> objectDefinitionForEditing = modelServiceLocator.getModelInteractionService().getEditObjectDefinition(object, authorizationPhase, task, result);
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("Edit definition for {}:\n{}", object, objectDefinitionForEditing.debugDump(1));
        }
        RefinedObjectClassDefinition objectClassDefinitionForEditing = null;
        if (isShadow(object)) {
            PrismReference resourceRef = object.findReference(ShadowType.F_RESOURCE_REF);
            PrismObject<ResourceType> resource = resourceRef.getValue().getObject();
            Validate.notNull(resource, "No resource object in the resourceRef");
            objectClassDefinitionForEditing = modelServiceLocator.getModelInteractionService().getEditObjectClassDefinition((PrismObject<ShadowType>) object, resource, authorizationPhase);
        }
        return createObjectWrapper(displayName, description, object, objectDefinitionForEditing, objectClassDefinitionForEditing, status, delayContainerCreation, result);
    } catch (SchemaException | ConfigurationException | ObjectNotFoundException ex) {
        throw new SystemException(ex);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) RefinedObjectClassDefinition(com.evolveum.midpoint.common.refinery.RefinedObjectClassDefinition) SystemException(com.evolveum.midpoint.util.exception.SystemException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 5 with OperationResult

use of com.evolveum.midpoint.schema.result.OperationResult in project midpoint by Evolveum.

the class ObjectWrapperFactory method createObjectWrapper.

private <O extends ObjectType> ObjectWrapper<O> createObjectWrapper(String displayName, String description, PrismObject<O> object, PrismObjectDefinition<O> objectDefinitionForEditing, RefinedObjectClassDefinition objectClassDefinitionForEditing, ContainerStatus status, boolean delayContainerCreation, OperationResult result) {
    if (result == null) {
        this.result = new OperationResult(CREATE_OBJECT_WRAPPER);
    } else {
        this.result = result;
    }
    ObjectWrapper<O> objectWrapper = new ObjectWrapper<O>(displayName, description, object, objectDefinitionForEditing, objectClassDefinitionForEditing, status, delayContainerCreation);
    List<ContainerWrapper<? extends Containerable>> containerWrappers = createContainerWrappers(objectWrapper, object, objectDefinitionForEditing, status, this.result);
    objectWrapper.setContainers(containerWrappers);
    this.result.computeStatusIfUnknown();
    objectWrapper.setResult(this.result);
    if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Created object wrapper:\n{}", objectWrapper.debugDump());
    }
    return objectWrapper;
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

OperationResult (com.evolveum.midpoint.schema.result.OperationResult)3475 Test (org.testng.annotations.Test)2435 Task (com.evolveum.midpoint.task.api.Task)2390 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1059 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)725 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)637 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)414 PrismObject (com.evolveum.midpoint.prism.PrismObject)388 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)376 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)320 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)288 ArrayList (java.util.ArrayList)262 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)252 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)250 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)231 QName (javax.xml.namespace.QName)198 AbstractModelIntegrationTest (com.evolveum.midpoint.model.test.AbstractModelIntegrationTest)197 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)182 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)171 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)149