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

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


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

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

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

    task.setPriority(priority);

    task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_SET_PRIORITY);

    return null;
  }
View Full Code Here


    when(filterServiceMock.newTaskFilter()).thenReturn(filterMock);
    when(filterServiceMock.saveFilter(eq(filterMock))).thenReturn(filterMock);
    when(filterServiceMock.getFilter(eq(EXAMPLE_FILTER_ID))).thenReturn(filterMock);
    when(filterServiceMock.getFilter(eq(MockProvider.NON_EXISTING_ID))).thenReturn(null);

    List mockTasks = Collections.singletonList(new TaskEntity());

    when(filterServiceMock.singleResult(eq(EXAMPLE_FILTER_ID)))
      .thenReturn(mockTasks.get(0));
    when(filterServiceMock.singleResult(eq(EXAMPLE_FILTER_ID), any(Query.class)))
      .thenReturn(mockTasks.get(0));
View Full Code Here

  }

  protected PersistentVariableScope getPersistentVariableScope(CommandContext commandContext) {
    ensureNotNull("taskId", scopeId);

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

    ensureNotNull("task " + scopeId + " doesn't exist", "task", task);
View Full Code Here

  }

  public Map<String, Object> execute(CommandContext commandContext) {
    ensureNotNull("taskId", taskId);

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

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

    Map<String, Object> taskVariables;
    if (isLocal) {
      taskVariables = task.getVariablesLocal();
    } else {
      taskVariables = task.getVariables();
    }

    if (variableNames == null) {
      variableNames = taskVariables.keySet();
    }

    // this copy is made to avoid lazy initialization outside a command context
    Map<String, Object> variables = new HashMap<String, Object>();
    for (String variableName : variableNames) {
      variables.put(variableName, task.getVariable(variableName));
    }

    return variables;
  }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  public Map<String, VariableInstance> execute(CommandContext commandContext) {

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

    if(task == null) {
      throw new BadUserRequestException("Cannot find task with id '"+resourceId+"'.");
    }

    Map<String, PersistentVariableInstance> result = new HashMap<String, PersistentVariableInstance>();

    // first, evaluate form fields
    TaskFormData taskFormData = task.getTaskDefinition().getTaskFormHandler().createTaskForm(task);
    for (FormField formField : taskFormData.getFormFields()) {
      if(formVariableNames == null || formVariableNames.contains(formField.getId())) {
        result.put(formField.getId(), createVariable(formField));
      }
    }

    // collect remaining variables from task scope and parent scopes
    task.collectVariableInstances(result, formVariableNames);

    // ensure serialized values are fetched
    for (PersistentVariableInstance variableInstance : result.values()) {

      if(variableInstance.storesCustomObjects()) {
View Full Code Here

  }

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

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

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

    final ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration();

    int historyLevel = processEngineConfiguration.getHistoryLevel();
    ExecutionEntity execution = task.getExecution();
    if (historyLevel >= ProcessEngineConfigurationImpl.HISTORYLEVEL_AUDIT && execution != null) {

      final HistoryEventProducer eventProducer = processEngineConfiguration.getHistoryEventProducer();
      final HistoryEventHandler eventHandler = processEngineConfiguration.getHistoryEventHandler();

      for (String propertyId : properties.keySet()) {
        Object propertyValue = properties.get(propertyId);

        HistoryEvent evt = eventProducer.createFormPropertyUpdateEvt(execution, propertyId, propertyValue, taskId);
        eventHandler.handleEvent(evt);

      }
    }

    TaskFormHandler taskFormHandler = task.getTaskDefinition().getTaskFormHandler();
    taskFormHandler.submitFormProperties(properties, task.getExecution());

    // complete or resolve the task
    if (DelegationState.PENDING.equals(task.getDelegationState())) {
      task.resolve();
      task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_RESOLVE);
    } else {
      task.complete();
      task.createHistoricTaskDetails(UserOperationLogEntry.OPERATION_TYPE_COMPLETE);
    }

    return null;
  }
View Full Code Here

  public Task newTask() {
    return newTask(null);
  }

  public Task newTask(String taskId) {
    TaskEntity task = TaskEntity.create();
    task.setId(taskId);
    return task;
  }
View Full Code Here

public class HumanTaskActivityBehavior extends TaskActivityBehavior {

  protected TaskDecorator taskDecorator;

  protected void performStart(CmmnActivityExecution execution) {
    TaskEntity task = TaskEntity.createAndInsert(execution);
    task.setCaseExecution(execution);

    taskDecorator.decorate(task, execution);

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

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

  }
View Full Code Here

    task.fireEvent(TaskListener.EVENTNAME_CREATE);

  }

  protected void terminating(CmmnActivityExecution execution) {
    TaskEntity task = getTask(execution);
    // it can happen that a there does not exist
    // a task, because the given execution was never
    // active.
    if (task != null) {
      task.delete("terminated", false);
    }
  }
View Full Code Here

      task.delete("terminated", false);
    }
  }

  protected void completing(CmmnActivityExecution execution) {
    TaskEntity task = getTask(execution);
    if (task != null) {
      task.caseExecutionCompleted();
    }
  }
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.