final points

This commit is contained in:
leif stawnyczy 2023-08-22 08:51:20 -04:00
parent 7b968397fe
commit b0f6d61c92
3 changed files with 16 additions and 14 deletions

View File

@ -64,15 +64,15 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Nonnull;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nonnull;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
public class PersistedJpaBundleProvider implements IBundleProvider {
@ -258,8 +258,8 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
// we request 1 more resource than we need
// this is so we can be sure of when we hit the last page
// (when doing offset searches)
final List<JpaPid> pidsSubList =
mySearchCoordinatorSvc.getResources(myUuid, theFromIndex, theToIndex + 1, myRequest, requestPartitionId);
final List<JpaPid> pidsSubList = mySearchCoordinatorSvc.getResources(
myUuid, theFromIndex, theToIndex + 1, myRequest, requestPartitionId);
int maxSize = Math.min(theToIndex, pidsSubList.size());
theResponsePageBuilder.setTotalRequestedResourcesFetched(pidsSubList.size());
List<IBaseResource> resources = myTxService

View File

@ -26,12 +26,12 @@ import org.apache.commons.lang3.Validate;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface IBundleProvider {

View File

@ -148,7 +148,7 @@ public class ResponsePage {
// (sometimes it's 0, even if it's not a currentpageoffset search)
// so we have to make sure either next or prev links are not null
return (StringUtils.isNotBlank(myBundleProvider.getNextPageId())
|| StringUtils.isNotBlank(myBundleProvider.getPreviousPageId()));
|| StringUtils.isNotBlank(myBundleProvider.getPreviousPageId()));
}
}
@ -172,8 +172,9 @@ public class ResponsePage {
} else {
myPagingStyle = PagingStyle.NONE;
// only end up here if no paging is desired
ourLog.debug("No accurate paging will be generated." +
" If accurate paging is desired, ResponsePageBuilder must be provided with additioanl information.");
ourLog.debug(
"No accurate paging will be generated."
+ " If accurate paging is desired, ResponsePageBuilder must be provided with additioanl information.");
}
}
@ -260,9 +261,10 @@ public class ResponsePage {
// resourceList.size - included resources + omitted resources == pagesize
// -> we (most likely) have more resources
if (myPageSize == myResourceList.size() - myIncludedResourceCount + myOmittedResourceCount) {
ourLog.warn("Returning a next page based on calculated resource count."
+ " This could be inaccurate if the exact number of resources were fetched is equal to the pagesize requested. "
+ " Consider setting ResponseBundleBuilder.setTotalResourcesFetchedRequest after fetching resources.");
ourLog.warn(
"Returning a next page based on calculated resource count."
+ " This could be inaccurate if the exact number of resources were fetched is equal to the pagesize requested. "
+ " Consider setting ResponseBundleBuilder.setTotalResourcesFetchedRequest after fetching resources.");
return true;
}
}
@ -457,7 +459,7 @@ public class ResponsePage {
myOmittedResourceCount, // omitted resources
myTotalRequestedResourcesFetched, // total count of requested resources
myBundleProvider // the bundle provider
);
);
}
}