Search in sources :

Example 6 with WorkflowResult

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

the class DefaultAnyObjectWorkflowAdapter method doUpdate.

@Override
protected WorkflowResult<AnyObjectPatch> doUpdate(final AnyObject anyObject, final AnyObjectPatch anyObjectPatch) {
    AnyObjectTO original = dataBinder.getAnyObjectTO(anyObject, true);
    PropagationByResource propByRes = dataBinder.update(anyObject, anyObjectPatch);
    Set<AttrTO> virAttrs = anyObjectPatch.getVirAttrs();
    AnyObjectTO updated = dataBinder.getAnyObjectTO(anyObjectDAO.save(anyObject), true);
    AnyObjectPatch effectivePatch = AnyOperations.diff(updated, original, false);
    effectivePatch.getVirAttrs().clear();
    effectivePatch.getVirAttrs().addAll(virAttrs);
    return new WorkflowResult<>(effectivePatch, propByRes, "update");
}
Also used : AnyObjectTO(org.apache.syncope.common.lib.to.AnyObjectTO) WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) AttrTO(org.apache.syncope.common.lib.to.AttrTO) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) AnyObjectPatch(org.apache.syncope.common.lib.patch.AnyObjectPatch)

Example 7 with WorkflowResult

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

the class DefaultGroupWorkflowAdapter method doUpdate.

@Override
protected WorkflowResult<GroupPatch> doUpdate(final Group group, final GroupPatch groupPatch) {
    GroupTO original = dataBinder.getGroupTO(group, true);
    PropagationByResource propByRes = dataBinder.update(group, groupPatch);
    Set<AttrTO> virAttrs = groupPatch.getVirAttrs();
    GroupTO updated = dataBinder.getGroupTO(groupDAO.save(group), true);
    GroupPatch effectivePatch = AnyOperations.diff(updated, original, false);
    effectivePatch.getVirAttrs().clear();
    effectivePatch.getVirAttrs().addAll(virAttrs);
    return new WorkflowResult<>(effectivePatch, propByRes, "update");
}
Also used : WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) AttrTO(org.apache.syncope.common.lib.to.AttrTO) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) GroupPatch(org.apache.syncope.common.lib.patch.GroupPatch) GroupTO(org.apache.syncope.common.lib.to.GroupTO)

Example 8 with WorkflowResult

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

the class DefaultGroupWorkflowAdapter method doCreate.

@Override
protected WorkflowResult<String> doCreate(final GroupTO groupTO) {
    Group group = entityFactory.newEntity(Group.class);
    dataBinder.create(group, groupTO);
    group = groupDAO.save(group);
    PropagationByResource propByRes = new PropagationByResource();
    propByRes.set(ResourceOperation.CREATE, groupDAO.findAllResourceKeys(group.getKey()));
    return new WorkflowResult<>(group.getKey(), propByRes, "create");
}
Also used : Group(org.apache.syncope.core.persistence.api.entity.group.Group) WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource)

Example 9 with WorkflowResult

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

the class DefaultUserWorkflowAdapter method doUpdate.

@Override
protected WorkflowResult<Pair<UserPatch, Boolean>> doUpdate(final User user, final UserPatch userPatch) {
    UserTO original = dataBinder.getUserTO(user, true);
    PropagationByResource propByRes = dataBinder.update(user, userPatch);
    PasswordPatch password = userPatch.getPassword();
    Set<AttrTO> virAttrs = userPatch.getVirAttrs();
    UserTO updated = dataBinder.getUserTO(userDAO.save(user), true);
    UserPatch effectivePatch = AnyOperations.diff(updated, original, false);
    effectivePatch.setPassword(password);
    effectivePatch.getVirAttrs().clear();
    effectivePatch.getVirAttrs().addAll(virAttrs);
    return new WorkflowResult<>(Pair.of(effectivePatch, !user.isSuspended()), propByRes, "update");
}
Also used : WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) PasswordPatch(org.apache.syncope.common.lib.patch.PasswordPatch) UserTO(org.apache.syncope.common.lib.to.UserTO) AttrTO(org.apache.syncope.common.lib.to.AttrTO) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) UserPatch(org.apache.syncope.common.lib.patch.UserPatch)

Example 10 with WorkflowResult

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

the class DefaultUserWorkflowAdapter method doReactivate.

@Override
protected WorkflowResult<String> doReactivate(final User user) {
    user.setStatus("active");
    User updated = userDAO.save(user);
    return new WorkflowResult<>(updated.getKey(), null, "reactivate");
}
Also used : WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) User(org.apache.syncope.core.persistence.api.entity.user.User)

Aggregations

WorkflowResult (org.apache.syncope.core.provisioning.api.WorkflowResult)32 PropagationByResource (org.apache.syncope.core.provisioning.api.PropagationByResource)18 User (org.apache.syncope.core.persistence.api.entity.user.User)14 UserPatch (org.apache.syncope.common.lib.patch.UserPatch)11 Pair (org.apache.commons.lang3.tuple.Pair)8 PropagationTaskTO (org.apache.syncope.common.lib.to.PropagationTaskTO)8 HashMap (java.util.HashMap)7 PropagationReporter (org.apache.syncope.core.provisioning.api.propagation.PropagationReporter)6 Exchange (org.apache.camel.Exchange)4 PollingConsumer (org.apache.camel.PollingConsumer)4 List (java.util.List)3 ImmutablePair (org.apache.commons.lang3.tuple.ImmutablePair)3 PasswordPatch (org.apache.syncope.common.lib.patch.PasswordPatch)3 AttrTO (org.apache.syncope.common.lib.to.AttrTO)3 AnyObjectPatch (org.apache.syncope.common.lib.patch.AnyObjectPatch)2 AnyObjectTO (org.apache.syncope.common.lib.to.AnyObjectTO)2 GroupTO (org.apache.syncope.common.lib.to.GroupTO)2 UserTO (org.apache.syncope.common.lib.to.UserTO)2 WorkflowException (org.apache.syncope.core.workflow.api.WorkflowException)2 FlowableException (org.flowable.engine.common.api.FlowableException)2