private void interpretPagingAndSorting(InterpretationContext context, ObjectQuery query, boolean countingObjects) throws QueryException { RootHibernateQuery hibernateQuery = context.getHibernateQuery(); String rootAlias = hibernateQuery.getPrimaryEntityAlias(); //noinspection StringEquality if (query != null && query.getPaging() != null && query.getPaging().hasCookie() && query.getPaging().getCookie() != ObjectRetriever.NULL_OID_MARKER) { ObjectPaging paging = query.getPaging(); Condition c = hibernateQuery.createSimpleComparisonCondition(rootAlias + ".oid", paging.getCookie(), ">"); hibernateQuery.addCondition(c); } if (!countingObjects && query != null && query.getPaging() != null) { if (query.getPaging().hasCookie()) { updatePagingAndSortingByOid(hibernateQuery, query.getPaging()); // very special case - ascending ordering by OID (nothing more) } else { updatePagingAndSorting(context, query.getPaging()); } } }
protected void logQuery(ObjectQuery query) { if (!LOGGER.isTraceEnabled()) { return; } if (query != null) { if (query.getPaging() == null) { LOGGER.trace("Searching objects with null paging. Processed query:\n{}", query.debugDump(1)); } else { LOGGER.trace("Searching objects from {} to {} ordered {} by {}. Processed query:\n{}", query.getPaging().getOffset(), query.getPaging().getMaxSize(), query.getPaging().getDirection(), query.getPaging().getOrderBy(), query.debugDump(1)); } } else { LOGGER.trace("Searching objects with null paging and null (processed) query."); } }
if (!useConnectorPaging) { if (query != null && query.getPaging() != null && query.getPaging().getOffset() != null && query.getPaging().getMaxSize() != null) { if (count < query.getPaging().getOffset()) { recordResume(); return true; if (count == (query.getPaging().getOffset() + query.getPaging().getMaxSize())) { recordResume(); return false;
private <T> List<T> doPaging(ObjectQuery query, List<T> allObjects, Function<T, PrismContainerValue> pcvExtractor) throws SchemaException { ObjectPaging paging = query.getPaging(); if (paging == null) { return allObjects;
public QueryType createQueryType(ObjectQuery query) throws SchemaException { ObjectFilter filter = query.getFilter(); QueryType queryType = new QueryType(); if (filter != null) { queryType.setFilter(createSearchFilterType(filter)); } queryType.setPaging(PagingConvertor.createPagingType(query.getPaging())); return queryType; }
private <T> void logSearchInputParameters(Class<T> type, ObjectQuery query, boolean iterative, Boolean strictlySequential) { ObjectPaging paging = query != null ? query.getPaging() : null; LOGGER.debug("Searching objects of type '{}', query (on trace level), offset {}, count {}, iterative {}, strictlySequential {}.", type.getSimpleName(), (paging != null ? paging.getOffset() : "undefined"), (paging != null ? paging.getMaxSize() : "undefined"), iterative, strictlySequential); if (!LOGGER.isTraceEnabled()) { return; } LOGGER.trace("Full query\n{}", query == null ? "undefined" : query.debugDump()); if (iterative) { LOGGER.trace("Iterative search by paging defined by the configuration: {}, batch size {}", getConfiguration().isIterativeSearchByPaging(), getConfiguration().getIterativeSearchByPagingBatchSize()); } }
Validate.notNull(parentResult, "Result type must not be null."); if (query != null) { ModelImplUtils.validatePaging(query.getPaging());
LOGGER.debug("Iterative search by paging was defined in the repository configuration, and strict sequentiality " + "was requested. However, a custom paging precludes its application. Therefore switching to " + "'fetch all' iteration method. Paging requested: " + query.getPaging()); iterationMethod = IterationMethodType.FETCH_ALL; } else { + "was requested. However, a custom paging precludes its application and maxSize is either " + "undefined or too large (over " + getConfiguration().getMaxObjectsForImplicitFetchAllIterationMethod() + "). Therefore switching to simple paging iteration method. Paging requested: " + query.getPaging()); iterationMethod = IterationMethodType.SIMPLE_PAGING;
final int batchSize = getConfiguration().getIterativeSearchByPagingBatchSize(); ObjectPaging paging = pagedQuery.getPaging();
Validate.notNull(parentResult, "Result type must not be null."); if (query != null) { ModelImplUtils.validatePaging(query.getPaging());
Validate.notNull(parentResult, "Operation result must not be null."); if (query != null) { ModelImplUtils.validatePaging(query.getPaging());
if (!useConnectorPaging && query != null && query.getPaging() != null && (query.getPaging().getOffset() != null || query.getPaging().getMaxSize() != null)) { InternalMonitor.recordCount(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT); if (useConnectorPaging && query != null && query.getPaging() != null) { ObjectPaging paging = query.getPaging(); if (paging.getOffset() != null) { optionsBuilder.setPagedResultsOffset(paging.getOffset() + 1); // ConnId API says the numbering starts at 1