Search in sources :

Example 16 with CommonException

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

the class ClassicCollectionReportExportActivityRun method iterateOverItemsInBucket.

@Override
public void iterateOverItemsInBucket(OperationResult result) throws CommonException {
    // Issue the search to audit or model/repository
    // And use the following handler to handle the results
    AtomicInteger sequence = new AtomicInteger(0);
    Handler<Containerable> handler = record -> {
        ItemProcessingRequest<Containerable> request = ContainerableProcessingRequest.create(sequence.getAndIncrement(), record, this);
        coordinator.submit(request, result);
        return true;
    };
    searchSpecificationHolder.run(handler, result);
}
Also used : ItemProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest) ActivityRunException(com.evolveum.midpoint.repo.common.activity.run.ActivityRunException) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) com.evolveum.midpoint.repo.common.activity.run(com.evolveum.midpoint.repo.common.activity.run) RunningTask(com.evolveum.midpoint.task.api.RunningTask) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) com.evolveum.midpoint.report.impl.controller(com.evolveum.midpoint.report.impl.controller) ReportServiceImpl(com.evolveum.midpoint.report.impl.ReportServiceImpl) CommonException(com.evolveum.midpoint.util.exception.CommonException) Nullable(org.jetbrains.annotations.Nullable) Handler(com.evolveum.midpoint.util.Handler) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ContainerableProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ContainerableProcessingRequest) NotNull(org.jetbrains.annotations.NotNull) Containerable(com.evolveum.midpoint.prism.Containerable) ReportUtils(com.evolveum.midpoint.report.impl.ReportUtils) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ItemProcessingRequest(com.evolveum.midpoint.repo.common.activity.run.processing.ItemProcessingRequest) Containerable(com.evolveum.midpoint.prism.Containerable)

Example 17 with CommonException

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

the class ResourceDependencyEditor method createResourceList.

private List<ObjectReferenceType> createResourceList() {
    resourceMap.clear();
    OperationResult result = new OperationResult(OPERATION_LOAD_RESOURCES);
    Task task = getPageBase().createSimpleTask(OPERATION_LOAD_RESOURCES);
    List<PrismObject<ResourceType>> resources = null;
    List<ObjectReferenceType> references = new ArrayList<>();
    try {
        resources = getPageBase().getModelService().searchObjects(ResourceType.class, null, null, task, result);
        result.recomputeStatus();
    } catch (CommonException | RuntimeException e) {
        result.recordFatalError(getString("ResourceDependencyEditor.message.createResourceList.fatalError"), e);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get resource list.", e);
    }
    if (resources != null) {
        ObjectReferenceType ref;
        for (PrismObject<ResourceType> r : resources) {
            resourceMap.put(r.getOid(), WebComponentUtil.getName(r));
            ref = new ObjectReferenceType();
            ref.setType(ResourceType.COMPLEX_TYPE);
            ref.setOid(r.getOid());
            references.add(ref);
        }
    }
    return references;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException)

Example 18 with CommonException

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

the class ExpressionVariableEditorDialog method createObjectReferenceListDeprecated.

private List<ObjectReferenceType> createObjectReferenceListDeprecated() {
    objectMap.clear();
    OperationResult result = new OperationResult(OPERATION_LOAD_REPOSITORY_OBJECTS);
    Task task = getPageBase().createSimpleTask(OPERATION_LOAD_REPOSITORY_OBJECTS);
    List<PrismObject<ObjectType>> objects = null;
    List<ObjectReferenceType> references = new ArrayList<>();
    try {
        objects = getPageBase().getModelService().searchObjects(ObjectType.class, null, null, task, result);
        result.recomputeStatus();
    } catch (CommonException | RuntimeException e) {
        result.recordFatalError("ExpressionVariableEditorDialog.message.createObjectReferenceListDeprecated.fatalError", e);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load objects from repository", e);
    }
    if (objects != null) {
        ObjectReferenceType ref;
        for (PrismObject<ObjectType> obj : objects) {
            objectMap.put(obj.getOid(), WebComponentUtil.getName(obj));
            ref = new ObjectReferenceType();
            ref.setOid(obj.getOid());
            references.add(ref);
        }
    }
    return references;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) Task(com.evolveum.midpoint.task.api.Task) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException)

Example 19 with CommonException

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

the class MappingEditorDialog method createPasswordPolicyList.

private List<ObjectReferenceType> createPasswordPolicyList() {
    policyMap.clear();
    OperationResult result = new OperationResult(OPERATION_LOAD_PASSWORD_POLICIES);
    Task task = getPageBase().createSimpleTask(OPERATION_LOAD_PASSWORD_POLICIES);
    List<PrismObject<ValuePolicyType>> policies = null;
    List<ObjectReferenceType> references = new ArrayList<>();
    try {
        policies = getPageBase().getModelService().searchObjects(ValuePolicyType.class, null, null, task, result);
        result.recomputeStatus();
    } catch (CommonException | RuntimeException e) {
        result.recordFatalError(getString("MappingEditorDialog.message.createPasswordPolicyList.fatalError"), e);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load password policies", e);
    }
    if (policies != null) {
        ObjectReferenceType ref;
        for (PrismObject<ValuePolicyType> policy : policies) {
            policyMap.put(policy.getOid(), WebComponentUtil.getName(policy));
            ref = new ObjectReferenceType();
            ref.setType(ValuePolicyType.COMPLEX_TYPE);
            ref.setOid(policy.getOid());
            references.add(ref);
        }
    }
    return references;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) ValuePolicyType(com.evolveum.midpoint.xml.ns._public.common.common_3.ValuePolicyType) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException)

Example 20 with CommonException

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

the class SynchronizationReactionEditor method createObjectTemplateList.

private List<ObjectReferenceType> createObjectTemplateList() {
    objectTemplateMap.clear();
    OperationResult result = new OperationResult(OPERATION_LOAD_OBJECT_TEMPLATES);
    Task task = getPageBase().createSimpleTask(OPERATION_LOAD_OBJECT_TEMPLATES);
    List<PrismObject<ObjectTemplateType>> templates = null;
    List<ObjectReferenceType> references = new ArrayList<>();
    try {
        templates = getPageBase().getModelService().searchObjects(ObjectTemplateType.class, null, null, task, result);
        result.recomputeStatus();
    } catch (CommonException | RuntimeException e) {
        result.recordFatalError(getString("SynchronizationReactionEditor.message.createObjectTemplateList.fatalError"), e);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't load object templates from repository", e);
    }
    if (templates != null) {
        ObjectReferenceType ref;
        for (PrismObject<ObjectTemplateType> template : templates) {
            objectTemplateMap.put(template.getOid(), WebComponentUtil.getName(template));
            ref = new ObjectReferenceType();
            ref.setType(ObjectTemplateType.COMPLEX_TYPE);
            ref.setOid(template.getOid());
            references.add(ref);
        }
    }
    return references;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) Task(com.evolveum.midpoint.task.api.Task) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CommonException(com.evolveum.midpoint.util.exception.CommonException)

Aggregations

CommonException (com.evolveum.midpoint.util.exception.CommonException)71 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)44 Task (com.evolveum.midpoint.task.api.Task)33 PrismObject (com.evolveum.midpoint.prism.PrismObject)14 SystemException (com.evolveum.midpoint.util.exception.SystemException)14 ArrayList (java.util.ArrayList)12 ModelService (com.evolveum.midpoint.model.api.ModelService)11 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)8 NotNull (org.jetbrains.annotations.NotNull)7 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)6 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)5 ActivityRunException (com.evolveum.midpoint.repo.common.activity.run.ActivityRunException)5 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)5 RestartResponseException (org.apache.wicket.RestartResponseException)5 ModelInteractionService (com.evolveum.midpoint.model.api.ModelInteractionService)4 ModelContext (com.evolveum.midpoint.model.api.context.ModelContext)4 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)4 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)4 MidPointApplication (com.evolveum.midpoint.web.security.MidPointApplication)4 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)4