Search in sources :

Example 1 with AddDynamicTaskCommand

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

the class CaseServiceImpl method addDynamicTask.

/*
     * Dynamic operations on a case
     */
@Override
public void addDynamicTask(String caseId, TaskSpecification taskSpecification) throws CaseNotFoundException {
    authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.ADD_TASK_TO_CASE);
    ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
    processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new AddDynamicTaskCommand(identityProvider, caseId, taskSpecification.getNodeType(), pi.getId(), taskSpecification.getParameters()));
}
Also used : AddDynamicTaskCommand(org.jbpm.casemgmt.impl.command.AddDynamicTaskCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc)

Example 2 with AddDynamicTaskCommand

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

the class CaseServiceImpl method addDynamicTask.

@Override
public void addDynamicTask(Long processInstanceId, TaskSpecification taskSpecification) throws ProcessInstanceNotFoundException {
    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 AddDynamicTaskCommand(identityProvider, caseId, taskSpecification.getNodeType(), pi.getId(), taskSpecification.getParameters()));
}
Also used : AddDynamicTaskCommand(org.jbpm.casemgmt.impl.command.AddDynamicTaskCommand) ProcessInstanceDesc(org.jbpm.services.api.model.ProcessInstanceDesc) ProcessInstanceNotFoundException(org.jbpm.services.api.ProcessInstanceNotFoundException)

Aggregations

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