Search in sources :

Example 1 with AddDynamicTaskToStageCommand

use of org.jbpm.casemgmt.impl.command.AddDynamicTaskToStageCommand in project jbpm by kiegroup.

the class CaseServiceImpl method addDynamicTaskToStage.

@Override
public void addDynamicTaskToStage(String caseId, String stageId, TaskSpecification taskSpecification) throws CaseNotFoundException, StageNotFoundException {
    authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.ADD_TASK_TO_CASE);
    ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
    if (pi == null || !pi.getState().equals(ProcessInstance.STATE_ACTIVE)) {
        throw new ProcessInstanceNotFoundException("No process instance found with id " + pi.getId() + " or it's not active anymore");
    }
    processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new AddDynamicTaskToStageCommand(identityProvider, caseId, taskSpecification.getNodeType(), pi.getId(), stageId, taskSpecification.getParameters()));
}
Also used : AddDynamicTaskToStageCommand(org.jbpm.casemgmt.impl.command.AddDynamicTaskToStageCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException)

Example 2 with AddDynamicTaskToStageCommand

use of org.jbpm.casemgmt.impl.command.AddDynamicTaskToStageCommand in project jbpm by kiegroup.

the class CaseServiceImpl method addDynamicTaskToStage.

@Override
public void addDynamicTaskToStage(Long processInstanceId, String stageId, TaskSpecification taskSpecification) throws CaseNotFoundException, StageNotFoundException {
    ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceById(processInstanceId);
    if (pi == null || !pi.getState().equals(ProcessInstance.STATE_ACTIVE)) {
        throw new ProcessInstanceNotFoundException("No process instance found with id " + processInstanceId + " or it's not active anymore");
    }
    String caseId = pi.getCorrelationKey();
    authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.ADD_TASK_TO_CASE);
    processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(processInstanceId), new AddDynamicTaskToStageCommand(identityProvider, caseId, taskSpecification.getNodeType(), pi.getId(), stageId, taskSpecification.getParameters()));
}
Also used : AddDynamicTaskToStageCommand(org.jbpm.casemgmt.impl.command.AddDynamicTaskToStageCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException)

Aggregations

AddDynamicTaskToStageCommand (org.jbpm.casemgmt.impl.command.AddDynamicTaskToStageCommand)2 ProcessInstanceNotFoundException (org.jbpm.services.api.ProcessInstanceNotFoundException)2 ProcessInstanceDesc (org.jbpm.services.api.model.ProcessInstanceDesc)2