use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testInputBusinessKey.
@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);
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class ProcessTaskTest method testCallProcessByVersionAsExpressionStartsWithHash.
@Deployment(resources = { "org/camunda/bpm/engine/test/cmmn/processtask/ProcessTaskTest.testCallProcessByVersionAsExpressionStartsWithHash.cmmn", "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testCallProcessByVersionAsExpressionStartsWithHash() {
// given
String bpmnResourceName = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml";
String secondDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
String thirdDeploymentId = repositoryService.createDeployment().addClasspathResource(bpmnResourceName).deploy().getId();
assertEquals(3, repositoryService.createProcessDefinitionQuery().count());
String caseInstanceId = createCaseInstanceByKey(ONE_PROCESS_TASK_CASE, Variables.createVariables().putValue("myVersion", 2)).getId();
String processTaskId = queryCaseExecutionByActivityId(PROCESS_TASK).getId();
// latest process definition
String processDefinitionIdInSecondDeployment = repositoryService.createProcessDefinitionQuery().deploymentId(secondDeploymentId).singleResult().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());
// it is associated with the correct process definition
assertEquals(processDefinitionIdInSecondDeployment, processInstance.getProcessDefinitionId());
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);
repositoryService.deleteDeployment(secondDeploymentId, true);
repositoryService.deleteDeployment(thirdDeploymentId, true);
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class DeleteAttachmentCmd method execute.
public Object execute(CommandContext commandContext) {
AttachmentEntity attachment = commandContext.getDbEntityManager().selectById(AttachmentEntity.class, attachmentId);
commandContext.getDbEntityManager().delete(attachment);
if (attachment.getContentId() != null) {
commandContext.getByteArrayManager().deleteByteArrayById(attachment.getContentId());
}
if (attachment.getTaskId() != null) {
TaskEntity task = commandContext.getTaskManager().findTaskById(attachment.getTaskId());
PropertyChange propertyChange = new PropertyChange("name", null, attachment.getName());
commandContext.getOperationLogManager().logAttachmentOperation(UserOperationLogEntry.OPERATION_TYPE_DELETE_ATTACHMENT, task, propertyChange);
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class GetIdentityLinksForTaskCmd method execute.
@SuppressWarnings({ "unchecked", "rawtypes" })
public List<IdentityLink> execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
TaskManager taskManager = commandContext.getTaskManager();
TaskEntity task = taskManager.findTaskById(taskId);
ensureNotNull("Cannot find task with id " + taskId, "task", task);
checkGetIdentityLink(task, commandContext);
List<IdentityLink> identityLinks = (List) task.getIdentityLinks();
// and of course this leads to exception while trying to delete a non-existing identityLink
if (task.getAssignee() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getAssignee());
identityLink.setTask(task);
identityLink.setType(IdentityLinkType.ASSIGNEE);
identityLinks.add(identityLink);
}
if (task.getOwner() != null) {
IdentityLinkEntity identityLink = new IdentityLinkEntity();
identityLink.setUserId(task.getOwner());
identityLink.setTask(task);
identityLink.setType(IdentityLinkType.OWNER);
identityLinks.add(identityLink);
}
return (List) task.getIdentityLinks();
}
use of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity in project camunda-bpm-platform by camunda.
the class GetTaskVariableCmdTyped method execute.
public TypedValue execute(CommandContext commandContext) {
ensureNotNull("taskId", taskId);
ensureNotNull("variableName", variableName);
TaskEntity task = Context.getCommandContext().getTaskManager().findTaskById(taskId);
ensureNotNull("task " + taskId + " doesn't exist", "task", task);
checkGetTaskVariableTyped(task, commandContext);
TypedValue value;
if (isLocal) {
value = task.getVariableLocalTyped(variableName, deserializeValue);
} else {
value = task.getVariableTyped(variableName, deserializeValue);
}
return value;
}
Aggregations