use of org.camunda.bpm.engine.impl.AbstractQuery in project camunda-bpm-platform by camunda.
the class AbstractExecuteFilterCmd method getFilter.
protected Filter getFilter(CommandContext commandContext) {
ensureNotNull("No filter id given to execute", "filterId", filterId);
FilterEntity filter = commandContext.getFilterManager().findFilterById(filterId);
ensureNotNull("No filter found for id '" + filterId + "'", "filter", filter);
if (extendingQuery != null) {
((AbstractQuery<?, ?>) extendingQuery).validate();
filter = (FilterEntity) filter.extend(extendingQuery);
}
return filter;
}
use of org.camunda.bpm.engine.impl.AbstractQuery in project camunda-bpm-platform by camunda.
the class HistoricCaseActivityInstanceTest method assertQuerySorting.
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void assertQuerySorting(String property, Query<?, ?> query, Comparable... items) {
AbstractQuery<?, ?> queryImpl = (AbstractQuery<?, ?>) query;
// save order properties to later reverse ordering
List<QueryOrderingProperty> orderProperties = queryImpl.getOrderingProperties();
List<? extends Comparable> sortedList = Arrays.asList(items);
Collections.sort(sortedList);
List<Matcher<Object>> matchers = new ArrayList<Matcher<Object>>();
for (Comparable comparable : sortedList) {
matchers.add(hasProperty(property, equalTo(comparable)));
}
List<?> instances = query.asc().list();
assertEquals(sortedList.size(), instances.size());
assertThat(instances, contains(matchers.toArray(new Matcher[matchers.size()])));
// reverse ordering
for (QueryOrderingProperty orderingProperty : orderProperties) {
orderingProperty.setDirection(Direction.DESCENDING);
}
// reverse matchers
Collections.reverse(matchers);
instances = query.list();
assertEquals(sortedList.size(), instances.size());
assertThat(instances, contains(matchers.toArray(new Matcher[matchers.size()])));
}
Aggregations