Search in sources :

Example 1 with ProcessInstanceIdentifier

use of org.ow2.petals.components.flowable.generic._1.SuspendProcessInstancesResponse.ProcessInstanceIdentifier in project petals-se-flowable by petalslink.

the class SuspendProcessInstancesOperation method doExecute.

@Override
public SuspendProcessInstancesResponse doExecute(final SuspendProcessInstances incomingObject) throws Exception {
    final SuspendProcessInstancesResponse response = new SuspendProcessInstancesResponse();
    final List<ProcessInstanceIdentifier> results = response.getProcessInstanceIdentifier();
    for (final String processInstanceId : incomingObject.getProcessInstanceIdentifier()) {
        this.log.fine(String.format("Suspends process instance #%s.", processInstanceId));
        final ProcessInstanceIdentifier result = new ProcessInstanceIdentifier();
        result.setValue(processInstanceId);
        results.add(result);
        try {
            this.runtimeService.suspendProcessInstanceById(processInstanceId);
            result.setResult(AdjournmentResult.SUSPENDED);
        } catch (@SuppressWarnings("squid:S1166") final FlowableObjectNotFoundException e) {
            result.setResult(AdjournmentResult.NOT_FOUND);
        } catch (@SuppressWarnings("squid:S1166") final FlowableException e) {
            result.setResult(AdjournmentResult.ALREADY_SUSPENDED);
        }
    }
    return response;
}
Also used : FlowableObjectNotFoundException(org.flowable.common.engine.api.FlowableObjectNotFoundException) FlowableException(org.flowable.common.engine.api.FlowableException) SuspendProcessInstancesResponse(org.ow2.petals.components.flowable.generic._1.SuspendProcessInstancesResponse) ProcessInstanceIdentifier(org.ow2.petals.components.flowable.generic._1.SuspendProcessInstancesResponse.ProcessInstanceIdentifier)

Example 2 with ProcessInstanceIdentifier

use of org.ow2.petals.components.flowable.generic._1.SuspendProcessInstancesResponse.ProcessInstanceIdentifier in project petals-se-flowable by petalslink.

the class ActivateProcessInstancesOperation method doExecute.

@Override
public ActivateProcessInstancesResponse doExecute(final ActivateProcessInstances incomingObject) throws Exception {
    final ActivateProcessInstancesResponse response = new ActivateProcessInstancesResponse();
    final List<ProcessInstanceIdentifier> results = response.getProcessInstanceIdentifier();
    for (final String processInstanceId : incomingObject.getProcessInstanceIdentifier()) {
        this.log.fine(String.format("Activates process instance #%s.", processInstanceId));
        final ProcessInstanceIdentifier result = new ProcessInstanceIdentifier();
        result.setValue(processInstanceId);
        results.add(result);
        try {
            this.runtimeService.activateProcessInstanceById(processInstanceId);
            result.setResult(ActivationResult.ACTIVATED);
        } catch (@SuppressWarnings("squid:S1166") final FlowableObjectNotFoundException e) {
            result.setResult(ActivationResult.NOT_FOUND);
        } catch (@SuppressWarnings("squid:S1166") final FlowableException e) {
            result.setResult(ActivationResult.ALREADY_ACTIVATED);
        }
    }
    return response;
}
Also used : FlowableObjectNotFoundException(org.flowable.common.engine.api.FlowableObjectNotFoundException) FlowableException(org.flowable.common.engine.api.FlowableException) ActivateProcessInstancesResponse(org.ow2.petals.components.flowable.generic._1.ActivateProcessInstancesResponse) ProcessInstanceIdentifier(org.ow2.petals.components.flowable.generic._1.ActivateProcessInstancesResponse.ProcessInstanceIdentifier)

Aggregations

FlowableException (org.flowable.common.engine.api.FlowableException)2 FlowableObjectNotFoundException (org.flowable.common.engine.api.FlowableObjectNotFoundException)2 ActivateProcessInstancesResponse (org.ow2.petals.components.flowable.generic._1.ActivateProcessInstancesResponse)1 ProcessInstanceIdentifier (org.ow2.petals.components.flowable.generic._1.ActivateProcessInstancesResponse.ProcessInstanceIdentifier)1 SuspendProcessInstancesResponse (org.ow2.petals.components.flowable.generic._1.SuspendProcessInstancesResponse)1 ProcessInstanceIdentifier (org.ow2.petals.components.flowable.generic._1.SuspendProcessInstancesResponse.ProcessInstanceIdentifier)1