Search in sources :

Example 1 with ResourceObjectClass

use of com.evolveum.midpoint.model.impl.sync.tasks.ResourceObjectClass in project midpoint by Evolveum.

the class ImportFromResourceLauncher method importSingleShadow.

public boolean importSingleShadow(String shadowOid, Task task, OperationResult parentResult) throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
    OperationResult result = parentResult.createSubresult(OP_IMPORT_SINGLE_SHADOW);
    try {
        ShadowType shadow = provisioningService.getObject(ShadowType.class, shadowOid, createReadOnlyCollection(), task, result).asObjectable();
        ResourceObjectClass spec = syncTaskHelper.createObjectClassForShadow(shadow, task, result);
        Synchronizer synchronizer = new Synchronizer(spec.getResource(), spec.getResourceObjectDefinitionRequired(), new NullSynchronizationObjectFilterImpl(), eventDispatcher, SchemaConstants.CHANNEL_IMPORT, false, true);
        synchronizer.synchronize(shadow.asPrismObject(), null, task, result);
        result.computeStatusIfUnknown();
        return !result.isError();
    } catch (ActivityRunException t) {
        result.recordStatus(t.getOpResultStatus(), t.getMessage(), t);
        // FIXME unwrap the exception
        throw new SystemException(t);
    } catch (Throwable t) {
        result.recordFatalError(t);
        throw t;
    } finally {
        // just for sure
        result.computeStatusIfUnknown();
    }
}
Also used : Synchronizer(com.evolveum.midpoint.model.impl.sync.tasks.Synchronizer) ActivityRunException(com.evolveum.midpoint.repo.common.activity.run.ActivityRunException) NullSynchronizationObjectFilterImpl(com.evolveum.midpoint.model.impl.sync.tasks.NullSynchronizationObjectFilterImpl) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceObjectClass(com.evolveum.midpoint.model.impl.sync.tasks.ResourceObjectClass)

Example 2 with ResourceObjectClass

use of com.evolveum.midpoint.model.impl.sync.tasks.ResourceObjectClass in project midpoint by Evolveum.

the class ReconciliationResult method fromActivityRun.

static ReconciliationResult fromActivityRun(@NotNull ReconciliationActivityRun execution, @NotNull ActivityRunResult executionResult) {
    ReconciliationResult result = new ReconciliationResult();
    result.runResult = executionResult.createTaskRunResult();
    ResourceObjectClass resourceObjectClass = findResourceObjectClass(execution);
    if (resourceObjectClass != null) {
        result.resource = resourceObjectClass.resource.asPrismObject();
        result.resourceObjectDefinition = resourceObjectClass.getResourceObjectDefinition();
    }
    OperationCompletionActivityRun operationCompletionExecution = execution.getOperationCompletionExecution();
    if (operationCompletionExecution != null) {
        result.unOpsCount = operationCompletionExecution.getUnOpsCount();
    }
    ResourceObjectsReconciliationActivityRun resourceReconciliationExecution = execution.getResourceReconciliationExecution();
    if (resourceReconciliationExecution != null) {
        result.resourceReconCount = resourceReconciliationExecution.getResourceReconCount();
        result.resourceReconErrors = resourceReconciliationExecution.getResourceReconErrors();
    }
    RemainingShadowsActivityRun remainingShadowsExecution = execution.getRemainingShadowsExecution();
    if (remainingShadowsExecution != null) {
        result.shadowReconCount = remainingShadowsExecution.getShadowReconCount();
    }
    return result;
}
Also used : ResourceObjectClass(com.evolveum.midpoint.model.impl.sync.tasks.ResourceObjectClass)

Aggregations

ResourceObjectClass (com.evolveum.midpoint.model.impl.sync.tasks.ResourceObjectClass)2 NullSynchronizationObjectFilterImpl (com.evolveum.midpoint.model.impl.sync.tasks.NullSynchronizationObjectFilterImpl)1 Synchronizer (com.evolveum.midpoint.model.impl.sync.tasks.Synchronizer)1 ActivityRunException (com.evolveum.midpoint.repo.common.activity.run.ActivityRunException)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1