use of org.apache.cayenne.util.ListResponse in project cayenne by apache.
the class DataContextQueryAction method interceptPaginatedQuery.
@Override
protected boolean interceptPaginatedQuery() {
if (metadata.getPageSize() > 0) {
Integer maxIdQualifierSize = actingDataContext.getParentDataDomain().getMaxIdQualifierSize();
List<?> paginatedList;
List<Object> rsMapping = metadata.getResultSetMapping();
boolean mixedResults = false;
if (rsMapping != null) {
if (rsMapping.size() > 1) {
mixedResults = true;
} else if (rsMapping.size() == 1) {
mixedResults = !(rsMapping.get(0) instanceof EntityResultSegment) || !metadata.isSingleResultSetMapping();
}
}
if (mixedResults) {
paginatedList = new MixedResultIncrementalFaultList<>(actingDataContext, query, maxIdQualifierSize);
} else {
DbEntity dbEntity = metadata.getDbEntity();
if (dbEntity != null && dbEntity.getPrimaryKeys().size() == 1) {
paginatedList = new SimpleIdIncrementalFaultList<>(actingDataContext, query, maxIdQualifierSize);
} else {
paginatedList = new IncrementalFaultList<>(actingDataContext, query, maxIdQualifierSize);
}
}
response = new ListResponse(paginatedList);
return DONE;
}
return !DONE;
}
Aggregations