001package ca.uhn.fhir.rest.server; 002 003import ca.uhn.fhir.rest.api.server.IBundleProvider; 004import ca.uhn.fhir.rest.api.server.RequestDetails; 005 006import javax.annotation.Nonnull; 007import javax.annotation.Nullable; 008 009/* 010 * #%L 011 * HAPI FHIR - Server Framework 012 * %% 013 * Copyright (C) 2014 - 2022 Smile CDR, Inc. 014 * %% 015 * Licensed under the Apache License, Version 2.0 (the "License"); 016 * you may not use this file except in compliance with the License. 017 * You may obtain a copy of the License at 018 * 019 * http://www.apache.org/licenses/LICENSE-2.0 020 * 021 * Unless required by applicable law or agreed to in writing, software 022 * distributed under the License is distributed on an "AS IS" BASIS, 023 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 024 * See the License for the specific language governing permissions and 025 * limitations under the License. 026 * #L% 027 */ 028 029public interface IPagingProvider { 030 031 /** 032 * if no _count parameter is provided, use this for the page size 033 */ 034 int getDefaultPageSize(); 035 036 /** 037 * if the _count parameter is larger than this value, reduce it to this value 038 */ 039 int getMaximumPageSize(); 040 041 /** 042 * @return true if the paging provider is able to store search results. 043 */ 044 default boolean canStoreSearchResults() { 045 return true; 046 } 047 048 /** 049 * Retrieve a result list by Search ID 050 * 051 * @since 4.0.0 - Note that the <code>theRequest</code> parameter was added to this 052 * method in HAPI FHIR 4.0.0. Existing implementations may choose to 053 * add this parameter and not use it if needed. 054 */ 055 IBundleProvider retrieveResultList(@Nullable RequestDetails theRequestDetails, @Nonnull String theSearchId); 056 057 /** 058 * Retrieve a result list by Search ID and Page ID 059 * 060 * @since 4.0.0 - Note that the <code>theRequest</code> parameter was added to this 061 * method in HAPI FHIR 4.0.0. Existing implementations may choose to 062 * add this parameter and not use it if needed. 063 */ 064 default IBundleProvider retrieveResultList(@Nullable RequestDetails theRequestDetails, @Nonnull String theSearchId, String thePageId) { 065 return null; 066 } 067 068 /** 069 * Stores a result list and returns an ID with which that list can be returned 070 * 071 * @param theRequestDetails The server request being made (may be null) 072 */ 073 String storeResultList(@Nullable RequestDetails theRequestDetails, IBundleProvider theList); 074 075}