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);
}
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());
}
}
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;
}
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;
}
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;
}
Aggregations