public void checkDeleteTask(TaskEntity task) { String taskId = task.getId(); // Note: Calling TaskService#deleteTask() to // delete a task which exists in context of // a process instance or case instance cannot // be deleted. In such a case TaskService#deleteTask() // throws an exception before invoking the // authorization check. String executionId = task.getExecutionId(); String caseExecutionId = task.getCaseExecutionId(); if (executionId == null && caseExecutionId == null) { getAuthorizationManager().checkAuthorization(DELETE, TASK, taskId); } }
public void checkDeleteTask(TaskEntity task) { String taskId = task.getId(); // Note: Calling TaskService#deleteTask() to // delete a task which exists in context of // a process instance or case instance cannot // be deleted. In such a case TaskService#deleteTask() // throws an exception before invoking the // authorization check. String executionId = task.getExecutionId(); String caseExecutionId = task.getCaseExecutionId(); if (executionId == null && caseExecutionId == null) { getAuthorizationManager().checkAuthorization(DELETE, TASK, taskId); } }
protected void deleteTask(String taskId, CommandContext commandContext) { TaskManager taskManager = commandContext.getTaskManager(); TaskEntity task = taskManager.findTaskById(taskId); if (task != null) { if(task.getExecutionId() != null) { throw new ProcessEngineException("The task cannot be deleted because is part of a running process"); } else if (task.getCaseExecutionId() != null) { throw new ProcessEngineException("The task cannot be deleted because is part of a running case instance"); } checkDeleteTask(task, commandContext); String reason = (deleteReason == null || deleteReason.length() == 0) ? TaskEntity.DELETE_REASON_DELETED : deleteReason; task.delete(reason, cascade); } else if (cascade) { Context .getCommandContext() .getHistoricTaskInstanceManager() .deleteHistoricTaskInstanceById(taskId); } }
protected void deleteTask(String taskId, CommandContext commandContext) { TaskManager taskManager = commandContext.getTaskManager(); TaskEntity task = taskManager.findTaskById(taskId); if (task != null) { if(task.getExecutionId() != null) { throw new ProcessEngineException("The task cannot be deleted because is part of a running process"); } else if (task.getCaseExecutionId() != null) { throw new ProcessEngineException("The task cannot be deleted because is part of a running case instance"); } checkDeleteTask(task, commandContext); String reason = (deleteReason == null || deleteReason.length() == 0) ? TaskEntity.DELETE_REASON_DELETED : deleteReason; task.delete(reason, cascade); } else if (cascade) { Context .getCommandContext() .getHistoricTaskInstanceManager() .deleteHistoricTaskInstanceById(taskId); } }
public UserOperationLogContextEntryBuilder inContextOf(TaskEntity task, List<PropertyChange> propertyChanges) { if (propertyChanges == null || propertyChanges.isEmpty()) { if (OPERATION_TYPE_CREATE.equals(entry.getOperationType())) { propertyChanges = Arrays.asList(PropertyChange.EMPTY_CHANGE); } } entry.setPropertyChanges(propertyChanges); ResourceDefinitionEntity definition = task.getProcessDefinition(); if (definition != null) { entry.setProcessDefinitionKey(definition.getKey()); entry.setDeploymentId(definition.getDeploymentId()); } else if (task.getCaseDefinitionId() != null) { definition = task.getCaseDefinition(); entry.setDeploymentId(definition.getDeploymentId()); } entry.setProcessDefinitionId(task.getProcessDefinitionId()); entry.setProcessInstanceId(task.getProcessInstanceId()); entry.setExecutionId(task.getExecutionId()); entry.setCaseDefinitionId(task.getCaseDefinitionId()); entry.setCaseInstanceId(task.getCaseInstanceId()); entry.setCaseExecutionId(task.getCaseExecutionId()); entry.setTaskId(task.getId()); ExecutionEntity execution = task.getExecution(); if (execution != null) { entry.setRootProcessInstanceId(execution.getRootProcessInstanceId()); } return this; }
public UserOperationLogContextEntryBuilder inContextOf(TaskEntity task, List<PropertyChange> propertyChanges) { if (propertyChanges == null || propertyChanges.isEmpty()) { if (OPERATION_TYPE_CREATE.equals(entry.getOperationType())) { propertyChanges = Arrays.asList(PropertyChange.EMPTY_CHANGE); } } entry.setPropertyChanges(propertyChanges); ResourceDefinitionEntity definition = task.getProcessDefinition(); if (definition != null) { entry.setProcessDefinitionKey(definition.getKey()); entry.setDeploymentId(definition.getDeploymentId()); } else if (task.getCaseDefinitionId() != null) { definition = task.getCaseDefinition(); entry.setDeploymentId(definition.getDeploymentId()); } entry.setProcessDefinitionId(task.getProcessDefinitionId()); entry.setProcessInstanceId(task.getProcessInstanceId()); entry.setExecutionId(task.getExecutionId()); entry.setCaseDefinitionId(task.getCaseDefinitionId()); entry.setCaseInstanceId(task.getCaseInstanceId()); entry.setCaseExecutionId(task.getCaseExecutionId()); entry.setTaskId(task.getId()); ExecutionEntity execution = task.getExecution(); if (execution != null) { entry.setRootProcessInstanceId(execution.getRootProcessInstanceId()); } return this; }
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) {
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) {
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) { getAuthorizationManager().checkAuthorization(READ, TASK, taskId);
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) { getAuthorizationManager().checkAuthorization(READ, TASK, taskId);
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) {
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) {
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) {
String caseExecutionId = task.getCaseExecutionId(); if (caseExecutionId == null) {
assertNull(task.getCaseExecutionId());
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneProcessTaskCase.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testCallProcessAsConstant() { // given String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); // then // there exists a process instance ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance(); assertNotNull(processInstance); // the case instance id is set on called process instance assertEquals(caseInstanceId, processInstance.getCaseInstanceId()); // the super case execution id is equals the processTaskId assertEquals(processTaskId, processInstance.getSuperCaseExecutionId()); TaskEntity task = (TaskEntity) queryTask(); // the case instance id has been also set on the task assertEquals(caseInstanceId, task.getCaseInstanceId()); // the case execution id should be null assertNull(task.getCaseExecutionId()); // complete //////////////////////////////////////////////////////// taskService.complete(task.getId()); assertProcessEnded(processInstance.getId()); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessAsExpressionStartsWithDollar.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testCallProcessAsExpressionStartsWithDollar() { // given // a deployed case definition String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, Variables.createVariables().putValue("process", "oneTaskProcess")).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); // then // there exists a process instance ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance(); assertNotNull(processInstance); // the case instance id is set on called process instance assertEquals(caseInstanceId, processInstance.getCaseInstanceId()); // the super case execution id is equals the processTaskId assertEquals(processTaskId, processInstance.getSuperCaseExecutionId()); TaskEntity task = (TaskEntity) queryTask(); // the case instance id has been also set on the task assertEquals(caseInstanceId, task.getCaseInstanceId()); // the case execution id should be null assertNull(task.getCaseExecutionId()); // complete //////////////////////////////////////////////////////// taskService.complete(task.getId()); assertProcessEnded(processInstance.getId()); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessAsExpressionStartsWithHash.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testCallProcessAsExpressionStartsWithHash() { // given // a deployed case definition String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, Variables.createVariables().putValue("process", "oneTaskProcess")).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); // then // there exists a process instance ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance(); assertNotNull(processInstance); // the case instance id is set on called process instance assertEquals(caseInstanceId, processInstance.getCaseInstanceId()); // the super case execution id is equals the processTaskId assertEquals(processTaskId, processInstance.getSuperCaseExecutionId()); TaskEntity task = (TaskEntity) queryTask(); // the case instance id has been also set on the task assertEquals(caseInstanceId, task.getCaseInstanceId()); // the case execution id should be null assertNull(task.getCaseExecutionId()); // complete //////////////////////////////////////////////////////// taskService.complete(task.getId()); assertProcessEnded(processInstance.getId()); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testInputBusinessKey.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" }) public void testInputBusinessKey() { // given String businessKey = "myBusinessKey"; String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, businessKey).getId(); String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId(); // then // there exists a process instance ExecutionEntity processInstance = (ExecutionEntity) queryProcessInstance(); assertNotNull(processInstance); // the case instance id is set on called process instance assertEquals(caseInstanceId, processInstance.getCaseInstanceId()); // the super case execution id is equals the processTaskId assertEquals(processTaskId, processInstance.getSuperCaseExecutionId()); // the business key has been set assertEquals(businessKey, processInstance.getBusinessKey()); TaskEntity task = (TaskEntity) queryTask(); // the case instance id has been also set on the task assertEquals(caseInstanceId, task.getCaseInstanceId()); // the case execution id should be null assertNull(task.getCaseExecutionId()); // complete //////////////////////////////////////////////////////// taskService.complete(task.getId()); assertProcessEnded(processInstance.getId()); close(caseInstanceId); assertCaseEnded(caseInstanceId); }
assertNull(task.getCaseExecutionId());