public void cancelCaseInstance(String containerId, String caseId, boolean destroy) { verifyContainerId(containerId, caseId); if (destroy) { logger.debug("Destroying case with id {} inside container {}", caseId, containerId); caseService.destroyCase(caseId); } else { logger.debug("Canceling case with id {} inside container {}", caseId, containerId); caseService.cancelCase(caseId); } }
public void addDynamicSubprocess(String containerId, String caseId, String stageId, String processId, String payload, String marshallingType) { verifyContainerId(containerId, caseId); logger.debug("About to unmarshal process data from payload: '{}'", payload); Map<String, Object> subProcessParameters = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class, new ByCaseIdContainerLocator(caseId)); logger.debug("SubProcess data '{}'", subProcessParameters); if (stageId != null && !stageId.isEmpty()) { logger.debug("Adding dynamic subprocess to stage {} within case {}", stageId, caseId); caseService.addDynamicSubprocessToStage(caseId, stageId, processId, subProcessParameters); } else { logger.debug("Adding dynamic subprocess to case {}", caseId); caseService.addDynamicSubprocess(caseId, processId, subProcessParameters); } }
public void addDynamicTask(String containerId, String caseId, String stageId, String payload, String marshallingType) { verifyContainerId(containerId, caseId); logger.debug("About to unmarshal task specification content from payload: '{}'", payload); Map<String, Object> taskSpecificationMap = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class, new ByCaseIdContainerLocator(caseId)); TaskSpecification taskSpecification = null; if (taskSpecificationMap == null || taskSpecificationMap.isEmpty()) { throw new IllegalArgumentException("Task specification must be given"); } String nodeType = (String) taskSpecificationMap.get(CASE_DYNAMIC_NODE_TYPE_PROP); if (nodeType != null) { logger.debug("Creating dynamic task of typ {} within case {}", nodeType, caseId); taskSpecification = caseService.newTaskSpec(nodeType, (String) taskSpecificationMap.get(CASE_DYNAMIC_NAME_PROP), (Map<String, Object>) taskSpecificationMap.get(CASE_DYNAMIC_DATA_PROP)); } else { logger.debug("Creating dynamic user task for case {}", caseId); taskSpecification = caseService.newHumanTaskSpec((String) taskSpecificationMap.get(CASE_DYNAMIC_NAME_PROP), (String) taskSpecificationMap.get(CASE_DYNAMIC_DESC_PROP), (String) taskSpecificationMap.get(CASE_DYNAMIC_ACTORS_PROP), (String) taskSpecificationMap.get(CASE_DYNAMIC_GROUPS_PROP), (Map<String, Object>) taskSpecificationMap.get(CASE_DYNAMIC_DATA_PROP)); } logger.debug("Complete task specification is '{}'", taskSpecification); if (stageId != null && !stageId.isEmpty()) { logger.debug("Adding dynamic task to stage {} within case {}", stageId, caseId); caseService.addDynamicTaskToStage(caseId, stageId, taskSpecification); } else { logger.debug("Adding dynamic task to case {}", caseId); caseService.addDynamicTask(caseId, taskSpecification); } }
@After public void tearDown() { clearDocumentStorageProperty(); List<CaseStatus> caseStatuses = Collections.singletonList(CaseStatus.OPEN); caseRuntimeDataService.getCaseInstances(caseStatuses, new QueryContext(0, Integer.MAX_VALUE)) .forEach(caseInstance -> caseService.cancelCase(caseInstance.getCaseId())); cleanupSingletonSessionId(); identityProvider.reset(); if (deploymentUnit != null) { deploymentService.undeploy(deploymentUnit); deploymentUnit = null; } close(); ServiceRegistry.get().clear(); }
public void putCaseFileDataByName(String containerId, String caseId, String name, List<String> restrictions, String payload, String marshallingType) { verifyContainerId(containerId, caseId); logger.debug("About to unmarshal case file data from payload: '{}'", payload); Object caseFileData = marshallerHelper.unmarshal(containerId, payload, marshallingType, Object.class, new ByCaseIdContainerLocator(caseId)); logger.debug("Unmarshalled case file data {} for case with id '{}' will be stored under {} with restrictions", caseFileData, caseId, name, restrictions); caseService.addDataToCaseFile(caseId, name, caseFileData, restrictions.toArray(new String[restrictions.size()])); }
public void assignToRole(String containerId, String caseId, String roleName, String user, String group) { verifyContainerId(containerId, caseId); OrganizationalEntity entity = null; if (user != null && !user.isEmpty()) { entity = taskModelFactory.newUser(user); logger.debug("Assigning user {} to role {} in case {}", user, roleName, caseId); caseService.assignToCaseRole(caseId, roleName, entity); } if (group != null && !group.isEmpty()) { entity = taskModelFactory.newGroup(group); logger.debug("Assigning group {} to role {} in case {}", group, roleName, caseId); caseService.assignToCaseRole(caseId, roleName, entity); } }
public void closeCaseInstance(String containerId, String caseId, String payload, String marshallingType) { verifyContainerId(containerId, caseId); logger.debug("About to unmarshal task name from payload: '{}'", payload); String comment = marshallerHelper.unmarshal(containerId, payload, marshallingType, String.class); logger.debug("Closing case with id {} inside container {} with comment {}", caseId, containerId, comment); caseService.closeCase(caseId, comment); }
public String addCommentToCase(String containerId, String caseId, String author, List<String> restrictions, String comment, String marshallingType) { verifyContainerId(containerId, caseId); author = getUser(author); String actualComment = marshallerHelper.unmarshal(containerId, comment, marshallingType, String.class, new ByCaseIdContainerLocator(caseId)); logger.debug("Adding comment to case {} by {} with text '{}' with restrictions {}", caseId, author, actualComment, restrictions); String commentId = caseService.addCaseComment(caseId, author, actualComment, restrictions.toArray(new String[restrictions.size()])); return marshallerHelper.marshal(containerId, marshallingType, commentId); }
public void putCaseFileData(String containerId, String caseId, List<String> restrictions, String payload, String marshallingType) { verifyContainerId(containerId, caseId); logger.debug("About to unmarshal case file data from payload: '{}'", payload); Map<String, Object> caseFileData = marshallerHelper.unmarshal(containerId, payload, marshallingType, Map.class, new ByCaseIdContainerLocator(caseId)); logger.debug("Unmarshalled case file data {} for case with id '{}' with restrictions", caseFileData, caseId, restrictions); caseService.addDataToCaseFile(caseId, caseFileData, restrictions.toArray(new String[restrictions.size()])); }