Search in sources :

Example 1 with Synchronizer

use of com.evolveum.midpoint.model.impl.sync.tasks.Synchronizer 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)

Aggregations

NullSynchronizationObjectFilterImpl (com.evolveum.midpoint.model.impl.sync.tasks.NullSynchronizationObjectFilterImpl)1 ResourceObjectClass (com.evolveum.midpoint.model.impl.sync.tasks.ResourceObjectClass)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