Search in sources :

Example 26 with WorkflowResult

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

the class FlowableUserWorkflowAdapter method doActivate.

@Override
protected WorkflowResult<String> doActivate(final User user, final String token) {
    Set<String> tasks = doExecuteTask(user, "activate", Collections.singletonMap(TOKEN, (Object) token));
    updateStatus(user);
    User updated = userDAO.save(user);
    return new WorkflowResult<>(updated.getKey(), null, tasks);
}
Also used : WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) User(org.apache.syncope.core.persistence.api.entity.user.User)

Example 27 with WorkflowResult

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

the class FlowableUserWorkflowAdapter method requestCertify.

@Override
public WorkflowResult<String> requestCertify(final User user) {
    String authUser = AuthContextUtils.getUsername();
    engine.getRuntimeService().setVariable(user.getWorkflowId(), FORM_SUBMITTER, authUser);
    LOG.debug("Executing request-certify");
    Set<String> performedTasks = doExecuteTask(user, "request-certify", null);
    PropagationByResource propByRes = engine.getRuntimeService().getVariable(user.getWorkflowId(), PROP_BY_RESOURCE, PropagationByResource.class);
    saveForFormSubmit(user, null, propByRes);
    return new WorkflowResult<>(user.getKey(), null, performedTasks);
}
Also used : WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource)

Example 28 with WorkflowResult

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

the class FlowableUserWorkflowAdapter method doUpdate.

@Override
protected WorkflowResult<Pair<UserPatch, Boolean>> doUpdate(final User user, final UserPatch userPatch) {
    Set<String> tasks = doExecuteTask(user, "update", Collections.singletonMap(USER_PATCH, (Object) userPatch));
    updateStatus(user);
    User updated = userDAO.save(user);
    PropagationByResource propByRes = engine.getRuntimeService().getVariable(user.getWorkflowId(), PROP_BY_RESOURCE, PropagationByResource.class);
    UserPatch updatedPatch = engine.getRuntimeService().getVariable(user.getWorkflowId(), USER_PATCH, UserPatch.class);
    saveForFormSubmit(updated, updatedPatch.getPassword() == null ? null : updatedPatch.getPassword().getValue(), propByRes);
    Boolean propagateEnable = engine.getRuntimeService().getVariable(user.getWorkflowId(), PROPAGATE_ENABLE, Boolean.class);
    return new WorkflowResult<>(Pair.of(updatedPatch, propagateEnable), propByRes, tasks);
}
Also used : WorkflowResult(org.apache.syncope.core.provisioning.api.WorkflowResult) User(org.apache.syncope.core.persistence.api.entity.user.User) PropagationByResource(org.apache.syncope.core.provisioning.api.PropagationByResource) UserPatch(org.apache.syncope.common.lib.patch.UserPatch)

Example 29 with WorkflowResult

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

the class DefaultAnyObjectWorkflowAdapter method doCreate.

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

Example 30 with WorkflowResult

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

the class DefaultUserWorkflowAdapter method doSuspend.

@Override
protected WorkflowResult<String> doSuspend(final User user) {
    user.setStatus("suspended");
    User updated = userDAO.save(user);
    return new WorkflowResult<>(updated.getKey(), null, "suspend");
}
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