use of org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogQuerySortingTest method testQuerySortingByTaskIdAsc.
@Test
public void testQuerySortingByTaskIdAsc() {
// given
int taskCount = 10;
startProcesses(taskCount);
// when
HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();
query.orderByExternalTaskId().asc();
// then
verifyQueryWithOrdering(query, taskCount, historicExternalTaskLogByExternalTaskId());
}
use of org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogQuerySortingTest method testQuerySortingByTimestampDsc.
@Test
public void testQuerySortingByTimestampDsc() {
// given
int taskCount = 10;
startProcesses(taskCount);
// when
HistoricExternalTaskLogQuery query = historyService.createHistoricExternalTaskLogQuery();
query.orderByTimestamp().desc();
// then
verifyQueryWithOrdering(query, taskCount, inverted(historicExternalTaskByTimestamp()));
}
use of org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogRestServiceInteractionTest method testHistoricExternalTaskLogGetIdDoesntExist.
@Test
public void testHistoricExternalTaskLogGetIdDoesntExist() {
String id = "nonExistingId";
HistoricExternalTaskLogQuery invalidQueryNonExistingHistoricExternalTaskLog = mock(HistoricExternalTaskLogQuery.class);
when(mockHistoryService.createHistoricExternalTaskLogQuery().logId(id)).thenReturn(invalidQueryNonExistingHistoricExternalTaskLog);
when(invalidQueryNonExistingHistoricExternalTaskLog.singleResult()).thenReturn(null);
given().pathParam("id", id).then().expect().statusCode(Status.NOT_FOUND.getStatusCode()).contentType(ContentType.JSON).body("type", equalTo(InvalidRequestException.class.getSimpleName())).body("message", equalTo("Historic external task log with id " + id + " does not exist")).when().get(SINGLE_HISTORIC_EXTERNAL_TASK_LOG_RESOURCE_URL);
}
use of org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogRestServiceImpl method queryHistoricExternalTaskLogsCount.
@Override
public CountResultDto queryHistoricExternalTaskLogsCount(HistoricExternalTaskLogQueryDto queryDto) {
queryDto.setObjectMapper(objectMapper);
HistoricExternalTaskLogQuery query = queryDto.toQuery(processEngine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.history.HistoricExternalTaskLogQuery in project camunda-bpm-platform by camunda.
the class HistoricExternalTaskLogRestServiceImpl method queryHistoricExternalTaskLogs.
@Override
public List<HistoricExternalTaskLogDto> queryHistoricExternalTaskLogs(HistoricExternalTaskLogQueryDto queryDto, Integer firstResult, Integer maxResults) {
queryDto.setObjectMapper(objectMapper);
HistoricExternalTaskLogQuery query = queryDto.toQuery(processEngine);
List<HistoricExternalTaskLog> matchingHistoricExternalTaskLogs;
if (firstResult != null || maxResults != null) {
matchingHistoricExternalTaskLogs = executePaginatedQuery(query, firstResult, maxResults);
} else {
matchingHistoricExternalTaskLogs = query.list();
}
List<HistoricExternalTaskLogDto> results = new ArrayList<HistoricExternalTaskLogDto>();
for (HistoricExternalTaskLog historicExternalTaskLog : matchingHistoricExternalTaskLogs) {
HistoricExternalTaskLogDto result = HistoricExternalTaskLogDto.fromHistoricExternalTaskLog(historicExternalTaskLog);
results.add(result);
}
return results;
}
Aggregations