Search in sources :

Example 16 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.

the class TaskRestServiceImpl method getHalTasks.

public HalTaskList getHalTasks(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    TaskQueryDto queryDto = new TaskQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    ProcessEngine engine = getProcessEngine();
    TaskQuery query = queryDto.toQuery(engine);
    // get list of tasks
    List<Task> matchingTasks = executeTaskQuery(firstResult, maxResults, query);
    // get total count
    long count = query.count();
    return HalTaskList.generate(matchingTasks, count, engine);
}
Also used : Task(org.camunda.bpm.engine.task.Task) TaskQueryDto(org.camunda.bpm.engine.rest.dto.task.TaskQueryDto) TaskQuery(org.camunda.bpm.engine.task.TaskQuery) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 17 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.

the class TaskRestServiceImpl method createTask.

public void createTask(TaskDto taskDto) {
    ProcessEngine engine = getProcessEngine();
    TaskService taskService = engine.getTaskService();
    Task newTask = taskService.newTask(taskDto.getId());
    taskDto.updateTask(newTask);
    try {
        taskService.saveTask(newTask);
    } catch (NotValidException e) {
        throw new InvalidRequestException(Status.BAD_REQUEST, e, "Could not save task: " + e.getMessage());
    }
}
Also used : Task(org.camunda.bpm.engine.task.Task) NotValidException(org.camunda.bpm.engine.exception.NotValidException) TaskService(org.camunda.bpm.engine.TaskService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 18 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.

the class VariableInstanceRestServiceImpl method queryVariableInstancesCount.

@Override
public CountResultDto queryVariableInstancesCount(VariableInstanceQueryDto queryDto) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    VariableInstanceQuery query = queryDto.toQuery(engine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : VariableInstanceQuery(org.camunda.bpm.engine.runtime.VariableInstanceQuery) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 19 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.

the class JobRestServiceImpl method queryJobs.

@Override
public List<JobDto> queryJobs(JobQueryDto queryDto, Integer firstResult, Integer maxResults) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    JobQuery query = queryDto.toQuery(engine);
    List<Job> matchingJobs;
    if (firstResult != null || maxResults != null) {
        matchingJobs = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingJobs = query.list();
    }
    List<JobDto> jobResults = new ArrayList<JobDto>();
    for (Job job : matchingJobs) {
        JobDto resultJob = JobDto.fromJob(job);
        jobResults.add(resultJob);
    }
    return jobResults;
}
Also used : JobDto(org.camunda.bpm.engine.rest.dto.runtime.JobDto) ArrayList(java.util.ArrayList) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Job(org.camunda.bpm.engine.runtime.Job) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Example 20 with ProcessEngine

use of org.camunda.bpm.engine.ProcessEngine in project camunda-bpm-platform by camunda.

the class JobRestServiceImpl method queryJobsCount.

@Override
public CountResultDto queryJobsCount(JobQueryDto queryDto) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    JobQuery query = queryDto.toQuery(engine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)162 DescribesScenario (org.camunda.bpm.qa.upgrade.DescribesScenario)60 ScenarioSetup (org.camunda.bpm.qa.upgrade.ScenarioSetup)60 Task (org.camunda.bpm.engine.task.Task)52 Times (org.camunda.bpm.qa.upgrade.Times)52 Test (org.junit.Test)26 ExtendsScenario (org.camunda.bpm.qa.upgrade.ExtendsScenario)18 ProcessEngineConfigurationImpl (org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl)17 ArrayList (java.util.ArrayList)16 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)15 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)14 AbstractFoxPlatformIntegrationTest (org.camunda.bpm.integrationtest.util.AbstractFoxPlatformIntegrationTest)14 RepositoryService (org.camunda.bpm.engine.RepositoryService)13 PooledDataSource (org.apache.ibatis.datasource.pooled.PooledDataSource)7 StandaloneInMemProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)5 Job (org.camunda.bpm.engine.runtime.Job)5 Connection (java.sql.Connection)4 CaseService (org.camunda.bpm.engine.CaseService)4 StandaloneProcessEngineConfiguration (org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration)4