All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.camunda.consulting.simulator.jobhandler.CompleteUserTaskJobHandler Maven / Gradle / Ivy

Go to download

A Plugin for [Camunda BPM](http://docs.camunda.org) that simulates process execution.

There is a newer version: 1.6.0
Show newest version
package com.camunda.consulting.simulator.jobhandler;

import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.jobexecutor.JobHandler;
import org.camunda.bpm.engine.impl.jobexecutor.JobHandlerConfiguration;
import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity;
import org.camunda.bpm.engine.impl.persistence.entity.JobEntity;

public class CompleteUserTaskJobHandler implements JobHandler {

  public static final String TYPE = "simulateCompleteUserTask";

  @Override
  public String getType() {
    return TYPE;
  }

  @Override
  public void execute(CompleteUserTaskJobHandlerConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
    String taskId = configuration.getTaskId();
    execution.getProcessEngineServices().getTaskService().complete(taskId);
  }

  @Override
  public CompleteUserTaskJobHandlerConfiguration newConfiguration(String canonicalString) {
    return new CompleteUserTaskJobHandlerConfiguration(canonicalString);
  }

  @Override
  public void onDelete(CompleteUserTaskJobHandlerConfiguration configuration, JobEntity jobEntity) {
    // do nothing
  }

  public static class CompleteUserTaskJobHandlerConfiguration implements JobHandlerConfiguration {

    private final String taskId;

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

    String getTaskId() {
      return taskId;
    }

    @Override
    public String toCanonicalString() {
      return taskId;
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy