Search in sources :

Example 1 with ExternalTaskQuery

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

the class ExternalTaskRestServiceImpl method updateRetries.

protected UpdateExternalTaskRetriesBuilder updateRetries(SetRetriesForExternalTasksDto retriesDto) {
    ExternalTaskService externalTaskService = getProcessEngine().getExternalTaskService();
    List<String> externalTaskIds = retriesDto.getExternalTaskIds();
    List<String> processInstanceIds = retriesDto.getProcessInstanceIds();
    ExternalTaskQuery externalTaskQuery = null;
    ProcessInstanceQuery processInstanceQuery = null;
    HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
    ExternalTaskQueryDto externalTaskQueryDto = retriesDto.getExternalTaskQuery();
    if (externalTaskQueryDto != null) {
        externalTaskQuery = externalTaskQueryDto.toQuery(getProcessEngine());
    }
    ProcessInstanceQueryDto processInstanceQueryDto = retriesDto.getProcessInstanceQuery();
    if (processInstanceQueryDto != null) {
        processInstanceQuery = processInstanceQueryDto.toQuery(getProcessEngine());
    }
    HistoricProcessInstanceQueryDto historicProcessInstanceQueryDto = retriesDto.getHistoricProcessInstanceQuery();
    if (historicProcessInstanceQueryDto != null) {
        historicProcessInstanceQuery = historicProcessInstanceQueryDto.toQuery(getProcessEngine());
    }
    return externalTaskService.updateRetries().externalTaskIds(externalTaskIds).processInstanceIds(processInstanceIds).externalTaskQuery(externalTaskQuery).processInstanceQuery(processInstanceQuery).historicProcessInstanceQuery(historicProcessInstanceQuery);
}
Also used : HistoricProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto) HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ProcessInstanceQuery(org.camunda.bpm.engine.runtime.ProcessInstanceQuery) ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) ExternalTaskQueryDto(org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto) ExternalTaskService(org.camunda.bpm.engine.ExternalTaskService) ProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.runtime.ProcessInstanceQueryDto) HistoricProcessInstanceQueryDto(org.camunda.bpm.engine.rest.dto.history.HistoricProcessInstanceQueryDto)

Example 2 with ExternalTaskQuery

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

the class ExternalTaskRestServiceImpl method queryExternalTasksCount.

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

Example 3 with ExternalTaskQuery

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

the class ProcessEngineRestServiceTest method createExternalTaskMock.

private void createExternalTaskMock() {
    ExternalTaskQuery query = mock(ExternalTaskQuery.class);
    List<ExternalTask> tasks = MockProvider.createMockExternalTasks();
    when(query.list()).thenReturn(tasks);
    when(mockExternalTaskService.createExternalTaskQuery()).thenReturn(query);
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask)

Example 4 with ExternalTaskQuery

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

the class ExternalTaskQueryTest method testQueryByNonExistingProcessInstanceId.

public void testQueryByNonExistingProcessInstanceId() {
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery().processInstanceIdIn("nonExisting");
    assertEquals(0, query.count());
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery)

Example 5 with ExternalTaskQuery

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

the class ExternalTaskServiceTest method testUpdateRetriesByExternalTaskQuery.

@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testUpdateRetriesByExternalTaskQuery() {
    // given
    startProcessInstance("oneExternalTaskProcess", 5);
    ExternalTaskQuery query = externalTaskService.createExternalTaskQuery();
    // when
    externalTaskService.updateRetries().externalTaskQuery(query).set(5);
    // then
    List<ExternalTask> tasks = query.list();
    assertEquals(5, tasks.size());
    for (ExternalTask task : tasks) {
        assertEquals(5, (int) task.getRetries());
    }
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) LockedExternalTask(org.camunda.bpm.engine.externaltask.LockedExternalTask) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

ExternalTaskQuery (org.camunda.bpm.engine.externaltask.ExternalTaskQuery)35 Test (org.junit.Test)13 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)10 Batch (org.camunda.bpm.engine.batch.Batch)6 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)6 ArrayList (java.util.ArrayList)3 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)3 HistoricProcessInstanceQuery (org.camunda.bpm.engine.history.HistoricProcessInstanceQuery)3 ExternalTaskQueryDto (org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskQueryDto)3 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 HashMap (java.util.HashMap)2 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 ExternalTaskQueryImpl (org.camunda.bpm.engine.impl.ExternalTaskQueryImpl)2 Deployment (org.camunda.bpm.engine.test.Deployment)2 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 Matchers.anyString (org.mockito.Matchers.anyString)2 ExternalTaskService (org.camunda.bpm.engine.ExternalTaskService)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1