Search in sources :

Example 1 with AddDynamicProcessToStageCommand

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

the class CaseServiceImpl method addDynamicSubprocessToStage.

@Override
public Long addDynamicSubprocessToStage(String caseId, String stageId, String processId, Map<String, Object> parameters) throws CaseNotFoundException {
    authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.ADD_PROCESS_TO_CASE);
    ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
    return processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new AddDynamicProcessToStageCommand(identityProvider, caseId, pi.getId(), stageId, processId, parameters));
}
Also used : AddDynamicProcessToStageCommand(org.jbpm.casemgmt.impl.command.AddDynamicProcessToStageCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc)

Example 2 with AddDynamicProcessToStageCommand

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

the class CaseServiceImpl method addDynamicSubprocessToStage.

@Override
public Long addDynamicSubprocessToStage(Long processInstanceId, String stageId, String processId, Map<String, Object> parameters) throws CaseNotFoundException {
    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_PROCESS_TO_CASE);
    return processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(processInstanceId), new AddDynamicProcessToStageCommand(identityProvider, caseId, pi.getId(), stageId, processId, parameters));
}
Also used : AddDynamicProcessToStageCommand(org.jbpm.casemgmt.impl.command.AddDynamicProcessToStageCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException)

Aggregations

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