Search in sources :

Example 36 with PropagationTaskTO

use of org.apache.syncope.common.lib.to.PropagationTaskTO 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)

Example 37 with PropagationTaskTO

use of org.apache.syncope.common.lib.to.PropagationTaskTO in project syncope by apache.

the class DefaultUserProvisioningManager method create.

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public Pair<String, List<PropagationStatus>> create(final UserTO userTO, final boolean storePassword, final boolean disablePwdPolicyCheck, final Boolean enabled, final Set<String> excludedResources, final boolean nullPriorityAsync) {
    WorkflowResult<Pair<String, Boolean>> created = uwfAdapter.create(userTO, disablePwdPolicyCheck, enabled, storePassword);
    List<PropagationTaskTO> tasks = propagationManager.getUserCreateTasks(created.getResult().getLeft(), userTO.getPassword(), created.getResult().getRight(), created.getPropByRes(), userTO.getVirAttrs(), excludedResources);
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    return Pair.of(created.getResult().getLeft(), propagationReporter.getStatuses());
}
Also used : PropagationTaskTO(org.apache.syncope.common.lib.to.PropagationTaskTO) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter) Pair(org.apache.commons.lang3.tuple.Pair) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Transactional(org.springframework.transaction.annotation.Transactional)

Example 38 with PropagationTaskTO

use of org.apache.syncope.common.lib.to.PropagationTaskTO in project syncope by apache.

the class DefaultUserProvisioningManager method update.

@Override
public Pair<UserPatch, List<PropagationStatus>> update(final UserPatch userPatch, final boolean nullPriorityAsync) {
    WorkflowResult<Pair<UserPatch, Boolean>> updated = uwfAdapter.update(userPatch);
    List<PropagationTaskTO> tasks = propagationManager.getUserUpdateTasks(updated);
    PropagationReporter propagationReporter = taskExecutor.execute(tasks, nullPriorityAsync);
    return Pair.of(updated.getResult().getLeft(), propagationReporter.getStatuses());
}
Also used : PropagationTaskTO(org.apache.syncope.common.lib.to.PropagationTaskTO) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter) Pair(org.apache.commons.lang3.tuple.Pair) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair)

Example 39 with PropagationTaskTO

use of org.apache.syncope.common.lib.to.PropagationTaskTO in project syncope by apache.

the class DefaultUserProvisioningManager method deprovision.

@Override
public List<PropagationStatus> deprovision(final String key, final Collection<String> resources, final boolean nullPriorityAsync) {
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.set(ResourceOperation.DELETE, resources);
    List<PropagationTaskTO> tasks = propagationManager.getDeleteTasks(AnyTypeKind.USER, key, propByRes, userDAO.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 40 with PropagationTaskTO

use of org.apache.syncope.common.lib.to.PropagationTaskTO in project syncope by apache.

the class DefaultGroupProvisioningManager method create.

@Transactional(propagation = Propagation.REQUIRES_NEW)
@Override
public Pair<String, List<PropagationStatus>> create(final GroupTO groupTO, final Map<String, String> groupOwnerMap, final Set<String> excludedResources, final boolean nullPriorityAsync) {
    WorkflowResult<String> created = gwfAdapter.create(groupTO);
    // see ConnObjectUtils#getAnyTOFromConnObject for GroupOwnerSchema
    Optional<AttrTO> groupOwner = groupTO.getPlainAttr(StringUtils.EMPTY);
    if (groupOwner.isPresent()) {
        groupOwnerMap.put(created.getResult(), groupOwner.get().getValues().iterator().next());
    }
    List<PropagationTaskTO> tasks = propagationManager.getCreateTasks(AnyTypeKind.GROUP, created.getResult(), created.getPropByRes(), groupTO.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) AttrTO(org.apache.syncope.common.lib.to.AttrTO) PropagationReporter(org.apache.syncope.core.provisioning.api.propagation.PropagationReporter) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)48 PropagationReporter (org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)29 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)21 Transactional (org.springframework.transaction.annotation.Transactional)11 Pair (org.apache.commons.lang3.tuple.Pair)10 ArrayList (java.util.ArrayList)9 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)9 UserPatch (org.apache.syncope.common.lib.patch.UserPatch)9 WorkflowResult (org.apache.syncope.core.provisioning.api.WorkflowResult)9 List (java.util.List)8 PropagationException (org.apache.syncope.core.provisioning.api.propagation.PropagationException)8 Map (java.util.Map)7 Test (org.junit.jupiter.api.Test)7 RealmTO (org.apache.syncope.common.lib.to.RealmTO)6 Realm (org.apache.syncope.core.persistence.api.entity.Realm)6 HashSet (java.util.HashSet)5 Collectors (java.util.stream.Collectors)5 UserTO (org.apache.syncope.common.lib.to.UserTO)5 TaskQuery (org.apache.syncope.common.rest.api.beans.TaskQuery)5 ExternalResource (org.apache.syncope.core.persistence.api.entity.resource.ExternalResource)5