Search in sources :

Example 1 with AddDynamicProcessCommand

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

the class CaseServiceImpl method addDynamicSubprocess.

@Override
public Long addDynamicSubprocess(Long processInstanceId, 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 AddDynamicProcessCommand(identityProvider, caseId, pi.getId(), processId, parameters));
}
Also used : AddDynamicProcessCommand(org.jbpm.casemgmt.impl.command.AddDynamicProcessCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException)

Example 2 with AddDynamicProcessCommand

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

the class CaseServiceImpl method addDynamicSubprocess.

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

Aggregations

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