use of org.wso2.carbon.humantask.core.engine.commands.Suspend in project carbon-business-process by wso2.
the class BPMNInstanceService method suspendProcessInstance.
/**
* Suspend process instance by instance ID
*
* @param instanceId
* @throws BPSFault
*/
public void suspendProcessInstance(String instanceId) throws BPSFault {
Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
RuntimeService runtimeService = BPMNServerHolder.getInstance().getEngine().getRuntimeService();
List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery().processInstanceTenantId(tenantId.toString()).processInstanceId(instanceId).list();
if (processInstances.isEmpty()) {
String msg = "No process instances with the ID: " + instanceId;
log.error(msg);
throw new BPSFault(msg);
}
runtimeService.suspendProcessInstanceById(instanceId);
}
use of org.wso2.carbon.humantask.core.engine.commands.Suspend in project carbon-business-process by wso2.
the class InstanceManagementServiceSkeleton method suspendInstance.
/**
* Suspend an instance
*
* @param iid Instance Id
* @throws InstanceManagementException If the instance cannot be suspended due to the
* unavailability of Debugger support
*/
public void suspendInstance(long iid) throws InstanceManagementException {
try {
isOperationIsValidForTheCurrentTenant(iid);
} catch (IllegalAccessException ex) {
handleError(ex);
}
DebuggerSupport debugSupport = getDebugger(iid);
if (debugSupport == null) {
String errMsg = "Cannot suspend the instance " + iid + ", Debugger support not available";
log.error(errMsg);
throw new InstanceManagementException(errMsg);
}
debugSupport.suspend(iid);
}
use of org.wso2.carbon.humantask.core.engine.commands.Suspend in project carbon-business-process by wso2.
the class TaskOperationsImpl method suspend.
/**
* Suspend the task.
*
* @param taskId : task identifier
* @throws IllegalStateFault
* @throws IllegalOperationFault
* @throws IllegalArgumentFault
* @throws IllegalAccessFault
*/
public void suspend(final URI taskId) throws IllegalStateFault, IllegalOperationFault, IllegalArgumentFault, IllegalAccessFault {
try {
validateTaskId(taskId);
HumanTaskServiceComponent.getHumanTaskServer().getTaskEngine().getScheduler().execTransaction(new Callable<Object>() {
public Object call() throws Exception {
HumanTaskCommand suspendCommand = new Suspend(getCaller(), new Long(taskId.toString()));
suspendCommand.execute();
return null;
}
});
} catch (Exception ex) {
handleException(ex);
}
}
Aggregations