Search in sources :

Example 1 with Suspend

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);
}
Also used : RuntimeService(org.activiti.engine.RuntimeService) BPSFault(org.wso2.carbon.bpmn.core.BPSFault) HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) ProcessInstance(org.activiti.engine.runtime.ProcessInstance)

Example 2 with Suspend

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);
}
Also used : InstanceManagementException(org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException) DebuggerSupport(org.apache.ode.bpel.engine.DebuggerSupport)

Example 3 with Suspend

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);
    }
}
Also used : HumanTaskCommand(org.wso2.carbon.humantask.core.engine.HumanTaskCommand) Suspend(org.wso2.carbon.humantask.core.engine.commands.Suspend) HumanTaskIllegalArgumentException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException) HumanTaskIllegalStateException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException) HumanTaskIllegalOperationException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException) UserStoreException(org.wso2.carbon.user.core.UserStoreException) HumanTaskException(org.wso2.carbon.humantask.core.engine.HumanTaskException) HumanTaskIllegalAccessException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException) HumanTaskRuntimeException(org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)

Aggregations

RuntimeService (org.activiti.engine.RuntimeService)1 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)1 DebuggerSupport (org.apache.ode.bpel.engine.DebuggerSupport)1 InstanceManagementException (org.wso2.carbon.bpel.skeleton.ode.integration.mgt.services.InstanceManagementException)1 BPSFault (org.wso2.carbon.bpmn.core.BPSFault)1 HumanTaskCommand (org.wso2.carbon.humantask.core.engine.HumanTaskCommand)1 HumanTaskException (org.wso2.carbon.humantask.core.engine.HumanTaskException)1 Suspend (org.wso2.carbon.humantask.core.engine.commands.Suspend)1 HumanTaskIllegalAccessException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalAccessException)1 HumanTaskIllegalArgumentException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalArgumentException)1 HumanTaskIllegalOperationException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalOperationException)1 HumanTaskIllegalStateException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskIllegalStateException)1 HumanTaskRuntimeException (org.wso2.carbon.humantask.core.engine.runtime.api.HumanTaskRuntimeException)1 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)1 UserStoreException (org.wso2.carbon.user.core.UserStoreException)1