Java Code Examples for org.flowable.engine.runtime.ProcessInstance#isSuspended()

The following examples show how to use org.flowable.engine.runtime.ProcessInstance#isSuspended() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ProcessInstanceSuspendResource.java    From plumdo-work with Apache License 2.0 5 votes vote down vote up
@PutMapping(value = "/process-instances/{processInstanceId}/suspend", name = "流程实例挂起")
@ResponseStatus(value = HttpStatus.OK)
public void suspendProcessInstance(@PathVariable String processInstanceId) {
    ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);

    if (processInstance.isSuspended()) {
        exceptionFactory.throwConflict(ErrorConstant.INSTANCE_ALREADY_SUSPEND, processInstance.getId());
    }
    runtimeService.suspendProcessInstanceById(processInstance.getId());
}
 
Example 2
Source File: ProcessInstanceActivateResource.java    From plumdo-work with Apache License 2.0 5 votes vote down vote up
@PutMapping(value = "/process-instances/{processInstanceId}/activate", name = "流程实例激活")
@ResponseStatus(value = HttpStatus.OK)
public void activateProcessInstance(@PathVariable String processInstanceId) {

    ProcessInstance processInstance = getProcessInstanceFromRequest(processInstanceId);

    if (!processInstance.isSuspended()) {
        exceptionFactory.throwConflict(ErrorConstant.INSTANCE_ALREADY_ACTIVE, processInstance.getId());
    }

    runtimeService.activateProcessInstanceById(processInstance.getId());
}
 
Example 3
Source File: ProcessInstanceResource.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected ProcessInstanceResponse activateProcessInstance(ProcessInstance processInstance) {
    if (!processInstance.isSuspended()) {
        throw new FlowableConflictException("Process instance with id '" + processInstance.getId() + "' is already active.");
    }
    runtimeService.activateProcessInstanceById(processInstance.getId());

    ProcessInstanceResponse response = restResponseFactory.createProcessInstanceResponse(processInstance);

    // No need to re-fetch the instance, just alter the suspended state of the result-object
    response.setSuspended(false);
    return response;
}
 
Example 4
Source File: ProcessInstanceResource.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected ProcessInstanceResponse suspendProcessInstance(ProcessInstance processInstance) {
    if (processInstance.isSuspended()) {
        throw new FlowableConflictException("Process instance with id '" + processInstance.getId() + "' is already suspended.");
    }
    runtimeService.suspendProcessInstanceById(processInstance.getId());

    ProcessInstanceResponse response = restResponseFactory.createProcessInstanceResponse(processInstance);

    // No need to re-fetch the instance, just alter the suspended state of the result-object
    response.setSuspended(true);
    return response;
}
 
Example 5
Source File: DefaultProcessJobParentStateResolver.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Override
public boolean isSuspended(Job job) {
    if (StringUtils.isEmpty(job.getProcessInstanceId())) {
        throw new FlowableIllegalArgumentException("Job " + job.getId() + " parent is not process instance");
    }
    ProcessInstance processInstance = this.processEngineConfiguration.getRuntimeService().createProcessInstanceQuery().processInstanceId(job.getProcessInstanceId()).singleResult();
    return processInstance.isSuspended();
}
 
Example 6
Source File: FlowableFacade.java    From multiapps-controller with Apache License 2.0 4 votes vote down vote up
public boolean isProcessInstanceSuspended(String processInstanceId) {
    ProcessInstance processInstance = getProcessInstance(processInstanceId);
    return processInstance != null && processInstance.isSuspended();
}