use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class CaseRuntimeDataServiceImpl method getAdHocFragmentsForCase.
@Override
public Collection<AdHocFragment> getAdHocFragmentsForCase(String caseId) {
ProcessInstanceDesc pi = runtimeDataService.getProcessInstanceByCorrelationKey(correlationKeyFactory.newCorrelationKey(caseId));
if (pi == null || !pi.getState().equals(ProcessInstance.STATE_ACTIVE)) {
throw new CaseNotFoundException("No case instance found with id " + caseId + " or it's not active anymore");
}
CaseDefinition caseDef = getCase(pi.getDeploymentId(), pi.getProcessId());
List<AdHocFragment> adHocFragments = new ArrayList<>();
adHocFragments.addAll(caseDef.getAdHocFragments());
Collection<CaseStageInstance> activeStages = internalGetCaseStages(caseDef, caseId, true, new QueryContext(0, 100));
activeStages.forEach(stage -> adHocFragments.addAll(stage.getAdHocFragments()));
return adHocFragments;
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class CaseServiceImpl method removeDataFromCaseFile.
@Override
public void removeDataFromCaseFile(String caseId, List<String> variableNames) throws CaseNotFoundException {
authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.REMOVE_DATA);
ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new RemoveDataCaseFileInstanceCommand(identityProvider, variableNames, authorizationManager));
}
use of org.jbpm.services.api.model.ProcessInstanceDesc 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));
}
use of org.jbpm.services.api.model.ProcessInstanceDesc 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()));
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class CaseServiceImpl method addDataToCaseFile.
/*
* Case file data methods
*/
@Override
public void addDataToCaseFile(String caseId, String name, Object value, String... restrictedTo) throws CaseNotFoundException {
authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.ADD_DATA);
ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
List<String> accessRestriction = null;
if (restrictedTo != null) {
accessRestriction = Arrays.asList(restrictedTo);
}
Map<String, Object> parameters = new HashMap<>();
parameters.put(name, value);
processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new AddDataCaseFileInstanceCommand(identityProvider, parameters, accessRestriction, authorizationManager));
}
Aggregations