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");
}
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");
}
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");
}
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");
}
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");
}
Aggregations