Search in sources :

Example 16 with PropagationByResource

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

the class AbstractPushResultHandler method update.

protected void update(final Any<?> any, final ProvisioningReport result) {
    boolean changepwd;
    Collection<String> resourceKeys;
    if (any instanceof User) {
        changepwd = true;
        resourceKeys = userDAO.findAllResourceKeys(any.getKey());
    } else if (any instanceof AnyObject) {
        changepwd = false;
        resourceKeys = anyObjectDAO.findAllResourceKeys(any.getKey());
    } else {
        changepwd = false;
        resourceKeys = groupDAO.findAllResourceKeys(any.getKey());
    }
    List<String> noPropResources = new ArrayList<>(resourceKeys);
    noPropResources.remove(profile.getTask().getResource().getKey());
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
    PropagationReporter reporter = taskExecutor.execute(propagationManager.getUpdateTasks(any.getType().getKind(), any.getKey(), changepwd, null, propByRes, null, noPropResources), false);
    reportPropagation(result, reporter);
}
Also used : AnyObject(org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject) User(org.apache.syncope.core.persistence.api.entity.user.User) ArrayList(java.util.ArrayList) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)

Example 17 with PropagationByResource

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

the class AbstractPushResultHandler method provision.

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.getCreateTasks(any.getType().getKind(), any.getKey(), 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 18 with PropagationByResource

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

the class DefaultRealmPushResultHandler method deprovision.

private void deprovision(final Realm realm, final ProvisioningReport result) {
    List<String> noPropResources = new ArrayList<>(realm.getResourceKeys());
    noPropResources.remove(profile.getTask().getResource().getKey());
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.addAll(ResourceOperation.DELETE, realm.getResourceKeys());
    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 19 with PropagationByResource

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

the class DefaultAnyObjectProvisioningManager method deprovision.

@Override
public List<PropagationStatus> deprovision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.addAll(ResourceOperation.DELETE, resources);
    List<PropagationTaskTO> tasks = propagationManager.getDeleteTasks(AnyTypeKind.ANY_OBJECT, key, propByRes, anyObjectDAO.findAllResourceKeys(key).stream().filter(resource -> !resources.contains(resource)).collect(Collectors.toList()));
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    return propagationReporter.getStatuses();
}
Also used : 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)

Example 20 with PropagationByResource

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

the class DefaultAnyObjectProvisioningManager method provision.

@Override
public List<PropagationStatus> provision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.addAll(ResourceOperation.UPDATE, resources);
    List<PropagationTaskTO> tasks = propagationManager.getUpdateTasks(AnyTypeKind.ANY_OBJECT, key, false, null, propByRes, null, null);
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    return propagationReporter.getStatuses();
}
Also used : 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)

Aggregations

PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)56 PropagationReporter (org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)23 PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)21 WorkflowResult (org.apache.syncope.core.provisioning.api.WorkflowResult)19 Realm (org.apache.syncope.core.persistence.api.entity.Realm)13 ArrayList (java.util.ArrayList)12 UserPatch (org.apache.syncope.common.lib.patch.UserPatch)12 User (org.apache.syncope.core.persistence.api.entity.user.User)12 HashMap (java.util.HashMap)11 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)11 Transactional (org.springframework.transaction.annotation.Transactional)10 PropagationException (org.apache.syncope.core.provisioning.api.propagation.PropagationException)9 Pair (org.apache.commons.lang3.tuple.Pair)8 List (java.util.List)7 RealmTO (org.apache.syncope.common.lib.to.RealmTO)7 NotFoundException (org.apache.syncope.core.persistence.api.dao.NotFoundException)7 Map (java.util.Map)6 Collectors (java.util.stream.Collectors)6 PasswordPatch (org.apache.syncope.common.lib.patch.PasswordPatch)6 AttrTO (org.apache.syncope.common.lib.to.AttrTO)6