use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class CaseServiceImpl method getCaseComments.
/*
* Case comments methods
*/
@Override
public Collection<CommentInstance> getCaseComments(String caseId, QueryContext queryContext) throws CaseNotFoundException {
authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.MODIFY_COMMENT);
ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
CaseFileInstance caseFile = internalGetCaseFileInstance(caseId, pi.getDeploymentId());
List<CommentInstance> caseComments = new ArrayList<>(((CaseFileInstanceImpl) caseFile).getComments());
// apply authorization
caseComments = authorizationManager.filterByCommentAuthorization(caseId, caseFile, caseComments);
int caseCommentsSize = caseComments.size();
int offset = queryContext.getOffset();
int pageSize = queryContext.getCount();
int pageIndex = (caseCommentsSize + pageSize - 1) / pageSize;
if (caseCommentsSize < pageSize) {
return caseComments;
} else if (pageIndex == (offset / pageSize) + 1) {
return caseComments.subList(offset, caseCommentsSize);
} else {
return caseComments.subList(offset, offset + pageSize);
}
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class CaseServiceImpl method removeFromCaseRole.
@Override
public void removeFromCaseRole(String caseId, String role, OrganizationalEntity entity) throws CaseNotFoundException {
authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.MODIFY_ROLE_ASSIGNMENT);
ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new ModifyRoleAssignmentCommand(identityProvider, role, entity, false));
}
use of org.jbpm.services.api.model.ProcessInstanceDesc 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));
}
use of org.jbpm.services.api.model.ProcessInstanceDesc 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));
}
use of org.jbpm.services.api.model.ProcessInstanceDesc in project jbpm by kiegroup.
the class CaseServiceImpl method removeCaseComment.
@Override
public void removeCaseComment(String caseId, String commentId) throws CaseNotFoundException {
authorizationManager.checkOperationAuthorization(caseId, ProtectedOperation.MODIFY_COMMENT);
ProcessInstanceDesc pi = verifyCaseIdExists(caseId);
processService.execute(pi.getDeploymentId(), ProcessInstanceIdContext.get(pi.getId()), new CaseCommentCommand(identityProvider, commentId, authorizationManager));
}
Aggregations