Package org.camunda.bpm.engine.impl.persistence.entity

Examples of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity


  public void setTask(Task task) {
    this.task = (TaskEntity) task;
  }

  public TaskEntity createTask(TaskDecorator taskDecorator) {
    TaskEntity task = TaskEntity.createAndInsert(this);

    task.setCaseExecution(this);
    setTask(task);

    taskDecorator.decorate(task, this);

    Context.getCommandContext()
      .getHistoricTaskInstanceManager()
      .createHistoricTask(task);

    // All properties set, now firing 'create' event
    task.fireEvent(TaskListener.EVENTNAME_CREATE);

    return task;
  }
View Full Code Here


  }
 
  public Object execute(CommandContext commandContext) {
    ensureNotNull("taskId", taskId);

    TaskEntity task = commandContext
      .getTaskManager()
      .findTaskById(taskId);

    ensureNotNull("Cannot find task with id " + taskId, "task", task);

    if (isLocal) {
      task.setVariablesLocal(variables);
    } else {
      task.setVariables(variables);
    }

    return null;
  }
View Full Code Here

* @author Danny Gräf
*/
public class OperationLogTaskServiceAndBeanTest extends PluggableProcessEngineTestCase {

  public void testBeanPropertyChanges() {
    TaskEntity entity = new TaskEntity();

    // assign and validate changes
    entity.setAssignee("icke");
    Map<String, PropertyChange> changes = entity.getPropertyChanges();
    assertEquals(1, changes.size());
    assertNull(changes.get(ASSIGNEE).getOrgValue());
    assertEquals("icke", changes.get(ASSIGNEE).getNewValue());

    // assign it again
    entity.setAssignee("er");
    changes = entity.getPropertyChanges();
    assertEquals(1, changes.size());

    // original value is still null because the task was not saved
    assertNull(changes.get(ASSIGNEE).getOrgValue());
    assertEquals("er", changes.get(ASSIGNEE).getNewValue());

    // set a due date
    entity.setDueDate(new Date());
    changes = entity.getPropertyChanges();
    assertEquals(2, changes.size());
  }
View Full Code Here

    changes = entity.getPropertyChanges();
    assertEquals(2, changes.size());
  }

  public void testNotTrackChangeToTheSameValue() {
    TaskEntity entity = new TaskEntity();

    // get and set a properties
    entity.setPriority(entity.getPriority());
    entity.setOwner(entity.getOwner());
    entity.setFollowUpDate(entity.getFollowUpDate());

    // should not track this change
    assertTrue(entity.getPropertyChanges().isEmpty());
  }
View Full Code Here

    // should not track this change
    assertTrue(entity.getPropertyChanges().isEmpty());
  }

  public void testRemoveChangeWhenSetBackToTheOrgValue() {
    TaskEntity entity = new TaskEntity();

    // set an owner (default is null)
    entity.setOwner("icke");

    // should track this change
    assertFalse(entity.getPropertyChanges().isEmpty());

    // reset the owner
    entity.setOwner(null);

    // the change is removed
    assertTrue(entity.getPropertyChanges().isEmpty());
  }
View Full Code Here

  public void testAllTrackedProperties() {
    Date yesterday = new Date(new Date().getTime() - 86400000);
    Date tomorrow = new Date(new Date().getTime() + 86400000);

    TaskEntity entity = new TaskEntity();

    // call all tracked setter methods
    entity.setAssignee("er");
    entity.setDelegationState(DelegationState.PENDING);
    entity.setDeleted(true);
    entity.setDescription("a description");
    entity.setDueDate(tomorrow);
    entity.setFollowUpDate(yesterday);
    entity.setName("to do");
    entity.setOwner("icke");
    entity.setParentTaskId("parent");
    entity.setPriority(73);

    // and validate the change list
    Map<String, PropertyChange> changes = entity.getPropertyChanges();
    assertEquals("er", changes.get(ASSIGNEE).getNewValue());
    assertSame(DelegationState.PENDING, changes.get(DELEGATION).getNewValue());
    assertTrue((Boolean) changes.get(DELETE).getNewValue());
    assertEquals("a description", changes.get(DESCRIPTION).getNewValue());
    assertEquals(tomorrow, changes.get(DUE_DATE).getNewValue());
View Full Code Here

    // 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);
View Full Code Here

  public Object execute(CommandContext commandContext) {
    ensureNotNull("taskId", taskId);
    ensureNotNull("variableName", variableName);

    TaskEntity task = Context
      .getCommandContext()
      .getTaskManager()
      .findTaskById(taskId);

    ensureNotNull("task " + taskId + " doesn't exist", "task", task);

    Object value;

    if (isLocal) {
      value = task.getVariableLocal(variableName);
    } else {
      value = task.getVariable(variableName);
    }

    return value;
  }
View Full Code Here

    assertEquals(processTaskId, processInstance.getSuperCaseExecutionId());
    // the business key has been set
    assertEquals("myOwnBusinessKey", processInstance.getBusinessKey());
    assertFalse(businessKey.equals(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);
View Full Code Here

  public GetTaskFormCmd(String taskId) {
    this.taskId = taskId;
  }

  public TaskFormData execute(CommandContext commandContext) {
    TaskEntity task = Context
      .getCommandContext()
      .getTaskManager()
      .findTaskById(taskId);
    ensureNotNull("No task found for taskId '" + taskId + "'", "task", task);

    if (task.getTaskDefinition() != null) {
      TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
      ensureNotNull("No taskFormHandler specified for task '" + taskId + "'", "taskFormHandler", taskFormHandler);

      return taskFormHandler.createTaskForm(task);
    } else {
      // Standalone task, no TaskFormData available
View Full Code Here

TOP

Related Classes of org.camunda.bpm.engine.impl.persistence.entity.TaskEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.