public Integer getMaxSize() { if (paging == null) { return null; } // if (paging.getCookie() != null) { // throw new UnsupportedOperationException("Paging cookie is not supported here."); // } return paging.getMaxSize(); }
public static void validatePaging(ObjectPaging paging) { if (paging == null) { return; } if (paging.getMaxSize() != null && paging.getMaxSize().longValue() < 0) { throw new IllegalArgumentException("Paging max size must be more than 0."); } if (paging.getOffset() != null && paging.getOffset().longValue() < 0) { throw new IllegalArgumentException("Paging offset index must be more than 0."); } }
private boolean isCustomPagingOkWithFetchAllIteration(ObjectQuery query) { return query != null && query.getPaging() != null && query.getPaging().getMaxSize() != null && query.getPaging().getMaxSize() <= getConfiguration().getMaxObjectsForImplicitFetchAllIterationMethod(); }
private void updatePagingAndSortingByOid(RootHibernateQuery hibernateQuery, ObjectPaging paging) { String rootAlias = hibernateQuery.getPrimaryEntityAlias(); if (paging.getOrderBy() != null || paging.getDirection() != null || paging.getOffset() != null) { throw new IllegalArgumentException("orderBy, direction nor offset is allowed on ObjectPaging with cookie"); } if (repoConfiguration.isUsingOracle()) { hibernateQuery.addOrdering("NLSSORT(" + rootAlias + ".oid, 'NLS_SORT=BINARY_AI')", OrderDirection.ASCENDING); } else { hibernateQuery.addOrdering(rootAlias + ".oid", OrderDirection.ASCENDING); } if (paging.getMaxSize() != null) { hibernateQuery.setMaxResults(paging.getMaxSize()); } }
int end = paging.getMaxSize() != null ? Math.min(start + paging.getMaxSize(), allObjects.size()) : allObjects.size(); if (start == 0 && end == allObjects.size()) { return allObjects;
private void updatePagingAndSorting(InterpretationContext context, ObjectPaging paging) throws QueryException { if (paging == null) { return; } RootHibernateQuery hibernateQuery = context.getHibernateQuery(); if (paging.getOffset() != null) { hibernateQuery.setFirstResult(paging.getOffset()); } if (paging.getMaxSize() != null) { hibernateQuery.setMaxResults(paging.getMaxSize()); } if (paging.hasOrdering()) { for (ObjectOrdering ordering : paging.getOrderingInstructions()) { addOrdering(context, ordering); } } if (paging.hasGrouping()) { for (ObjectGrouping grouping : paging.getGroupingInstructions()) { addGrouping(context, grouping); } } }
public <T extends ObjectType> void updateLoadedLookupTable(PrismObject<T> object, Collection<SelectorOptions<GetOperationOptions>> options, Session session) throws SchemaException { if (!SelectorOptions.hasToLoadPath(LookupTableType.F_ROW, options)) { return; } LOGGER.debug("Loading lookup table data."); GetOperationOptions getOption = findLookupTableGetOption(options); RelationalValueSearchQuery queryDef = getOption == null ? null : getOption.getRelationalValueSearchQuery(); Query query = setupLookupTableRowsQuery(session, queryDef, object.getOid()); if (queryDef != null && queryDef.getPaging() != null) { ObjectPaging paging = queryDef.getPaging(); if (paging.getOffset() != null) { query.setFirstResult(paging.getOffset()); } if (paging.getMaxSize() != null) { query.setMaxResults(paging.getMaxSize()); } } List<RLookupTableRow> rows = query.list(); if (rows == null || rows.isEmpty()) { return; } LookupTableType lookup = (LookupTableType) object.asObjectable(); List<LookupTableRowType> jaxbRows = lookup.getRow(); for (RLookupTableRow row : rows) { LookupTableRowType jaxbRow = row.toJAXB(); jaxbRows.add(jaxbRow); } }
LOGGER.trace( "Listing resource objects {} from resource, oid {}, from {} to {} ordered {} by {}.", objectClass, resourceOid, paging.getOffset(), paging.getMaxSize(), paging.getOrderBy(), paging.getDirection());
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()); } }
} else { offset = paging.getOffset() != null ? paging.getOffset() : 0; remaining = paging.getMaxSize() != null ? paging.getMaxSize() : repositoryService.countObjects(type, query, options, result) - offset;
&& query.getPaging().getMaxSize() != null) { if (count < query.getPaging().getOffset()) { recordResume(); if (count == (query.getPaging().getOffset() + query.getPaging().getMaxSize())) { recordResume(); return false;
ObjectQuery pagedQuery; if (query != null) { maxSize = query.getPaging() != null ? query.getPaging().getMaxSize() : null; pagedQuery = query.clone(); } else {
public static PagingType createPagingType(ObjectPaging paging){ if (paging == null){ return null; } PagingType pagingType = new PagingType(); pagingType .setOrderDirection(toOrderDirectionType(paging.getDirection())); pagingType.setMaxSize(paging.getMaxSize()); pagingType.setOffset(paging.getOffset()); if (paging.getOrderBy() != null) { pagingType.setOrderBy(new ItemPathType(paging.getOrderBy())); } if (paging.getGroupBy() != null) { pagingType.setGroupBy(new ItemPathType(paging.getGroupBy())); } return pagingType; }
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."); } }
(query.getPaging().getOffset() != null || query.getPaging().getMaxSize() != null)) { InternalMonitor.recordCount(InternalCounters.CONNECTOR_SIMULATED_PAGING_SEARCH_COUNT); optionsBuilder.setPagedResultsOffset(paging.getOffset() + 1); // ConnId API says the numbering starts at 1 if (paging.getMaxSize() != null) { optionsBuilder.setPageSize(paging.getMaxSize());