Search in sources :

Example 21 with PropagationReporter

use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.

the class DefaultRealmPushResultHandler method provision.

private void provision(final Realm realm, final ProvisioningReport result) {
    List<String> noPropResources = new ArrayList<>(realm.getResourceKeys());
    noPropResources.remove(profile.getTask().getResource().getKey());
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
    PropagationReporter reporter = taskExecutor.execute(propagationManager.createTasks(realm, propByRes, noPropResources), false);
    reportPropagation(result, reporter);
}
Also used : ArrayList(java.util.ArrayList) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)

Example 22 with PropagationReporter

use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.

the class DefaultUserPushResultHandler method provision.

@Override
protected void provision(final Any<?> any, final Boolean enabled, final ProvisioningReport result) {
    AnyTO before = getAnyTO(any.getKey());
    List<String> noPropResources = new ArrayList<>(before.getResources());
    noPropResources.remove(profile.getTask().getResource().getKey());
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
    PropagationReporter reporter = taskExecutor.execute(propagationManager.getUserCreateTasks(before.getKey(), null, enabled, propByRes, before.getVirAttrs(), noPropResources), false);
    reportPropagation(result, reporter);
}
Also used : AnyTO(org.apache.syncope.common.lib.to.AnyTO) ArrayList(java.util.ArrayList) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)

Example 23 with PropagationReporter

use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.

the class DefaultAnyObjectProvisioningManager method update.

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public Pair<AnyObjectPatch, List<PropagationStatus>> update(final AnyObjectPatch anyObjectPatch, final Set<String> excludedResources, final boolean nullPriorityAsync) {
    WorkflowResult<AnyObjectPatch> updated = awfAdapter.update(anyObjectPatch);
    List<PropagationTaskTO> tasks = propagationManager.getUpdateTasks(AnyTypeKind.ANY_OBJECT, updated.getResult().getKey(), false, null, updated.getPropByRes(), anyObjectPatch.getVirAttrs(), excludedResources);
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    return Pair.of(updated.getResult(), propagationReporter.getStatuses());
}
Also used : PropagationTaskTO(org.apache.syncope.common.lib.to.PropagationTaskTO) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter) AnyObjectPatch(org.apache.syncope.common.lib.patch.AnyObjectPatch) Transactional(org.springframework.transaction.annotation.Transactional)

Example 24 with PropagationReporter

use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.

the class DefaultAnyObjectProvisioningManager method delete.

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public List<PropagationStatus> delete(final String key, final Set<String> excludedResources, final boolean nullPriorityAsync) {
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.set(ResourceOperation.DELETE, anyObjectDAO.findAllResourceKeys(key));
    // Note here that we can only notify about "delete", not any other
    // task defined in workflow process definition: this because this
    // information could only be available after awfAdapter.delete(), which
    // will also effectively remove user from db, thus making virtually
    // impossible by NotificationManager to fetch required user information
    List<PropagationTaskTO> tasks = propagationManager.getDeleteTasks(AnyTypeKind.ANY_OBJECT, key, propByRes, excludedResources);
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    try {
        awfAdapter.delete(key);
    } catch (PropagationException e) {
        throw e;
    }
    return propagationReporter.getStatuses();
}
Also used : PropagationException(org.apache.syncope.core.provisioning.api.propagation.PropagationException) PropagationTaskTO(org.apache.syncope.common.lib.to.PropagationTaskTO) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter) Transactional(org.springframework.transaction.annotation.Transactional)

Example 25 with PropagationReporter

use of org.apache.syncope.core.provisioning.api.propagation.PropagationReporter in project syncope by apache.

the class DefaultAnyObjectProvisioningManager method create.

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public Pair<String, List<PropagationStatus>> create(final AnyObjectTO anyObjectTO, final Set<String> excludedResources, final boolean nullPriorityAsync) {
    WorkflowResult<String> created = awfAdapter.create(anyObjectTO);
    List<PropagationTaskTO> tasks = propagationManager.getCreateTasks(AnyTypeKind.ANY_OBJECT, created.getResult(), created.getPropByRes(), anyObjectTO.getVirAttrs(), excludedResources);
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    return Pair.of(created.getResult(), propagationReporter.getStatuses());
}
Also used : PropagationTaskTO(org.apache.syncope.common.lib.to.PropagationTaskTO) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PropagationReporter (org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)36 PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)28 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)23 Transactional (org.springframework.transaction.annotation.Transactional)10 ArrayList (java.util.ArrayList)8 Pair (org.apache.commons.lang3.tuple.Pair)7 List (java.util.List)6 WorkflowResult (org.apache.syncope.core.provisioning.api.WorkflowResult)6 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)5 PropagationException (org.apache.syncope.core.provisioning.api.propagation.PropagationException)5 Map (java.util.Map)4 UserPatch (org.apache.syncope.common.lib.patch.UserPatch)4 AnyTO (org.apache.syncope.common.lib.to.AnyTO)4 Realm (org.apache.syncope.core.persistence.api.entity.Realm)4 Collectors (java.util.stream.Collectors)3 ProvisioningResult (org.apache.syncope.common.lib.to.ProvisioningResult)3 RealmTO (org.apache.syncope.common.lib.to.RealmTO)3 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)3 User (org.apache.syncope.core.persistence.api.entity.user.User)3 PreAuthorize (org.springframework.security.access.prepost.PreAuthorize)3