More docs
This commit is contained in:
parent
883337a9f4
commit
d407501071
|
@ -2,13 +2,15 @@ package ca.uhn.fhir.mdm.api.paging;
|
|||
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Data clump class to keep the relevant paging URLs together for MDM.
|
||||
*/
|
||||
public class MdmPageLinkTuple {
|
||||
private String myPreviousLink = null;
|
||||
private String mySelfLink = null;
|
||||
private String myNextLink = null;
|
||||
|
||||
MdmPageLinkTuple() {
|
||||
}
|
||||
MdmPageLinkTuple() {}
|
||||
|
||||
public Optional<String> getPreviousLink() {
|
||||
return Optional.ofNullable(myPreviousLink);
|
||||
|
|
|
@ -7,6 +7,8 @@ import org.hl7.fhir.dstu3.model.UnsignedIntType;
|
|||
import org.slf4j.Logger;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static ca.uhn.fhir.rest.api.Constants.PARAM_COUNT;
|
||||
import static ca.uhn.fhir.rest.api.Constants.PARAM_OFFSET;
|
||||
import static org.slf4j.LoggerFactory.getLogger;
|
||||
|
@ -17,22 +19,17 @@ import static org.slf4j.LoggerFactory.getLogger;
|
|||
* but we are using `offset` and `count` which requires some minor translation.
|
||||
*/
|
||||
public class MdmPageRequest {
|
||||
private static final Logger ourLog = getLogger(MdmPageRequest.class);
|
||||
|
||||
private int myPage;
|
||||
private int myOffset;
|
||||
private int myCount;
|
||||
private IPagingProvider myPagingProvider;
|
||||
private final int myPage;
|
||||
private final int myOffset;
|
||||
private final int myCount;
|
||||
|
||||
public MdmPageRequest(UnsignedIntType theOffset, UnsignedIntType theCount, IPagingProvider thePagingProvider) {
|
||||
myPagingProvider = thePagingProvider;
|
||||
public MdmPageRequest(@Nullable UnsignedIntType theOffset, @Nullable UnsignedIntType theCount, IPagingProvider thePagingProvider) {
|
||||
myOffset = theOffset == null ? 0 : theOffset.getValue();
|
||||
myCount = theCount == null ? myPagingProvider.getDefaultPageSize() : theCount.getValue();
|
||||
myCount = theCount == null
|
||||
? thePagingProvider.getDefaultPageSize() : theCount.getValue() > thePagingProvider.getMaximumPageSize()
|
||||
? thePagingProvider.getMaximumPageSize() : theCount.getValue();
|
||||
|
||||
if (myCount > myPagingProvider.getMaximumPageSize()) {
|
||||
ourLog.debug("Reducing count {} to paging provider's maximum of {}", theCount, myPagingProvider.getMaximumPageSize());
|
||||
myCount = myPagingProvider.getMaximumPageSize();
|
||||
}
|
||||
validatePagingParameters(myOffset, myCount);
|
||||
|
||||
this.myPage = myOffset / myCount;
|
||||
|
|
|
@ -198,7 +198,6 @@ public class MdmProviderDstu3Plus extends BaseMdmProvider {
|
|||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@Operation(name = ProviderConstants.MDM_QUERY_LINKS, idempotent = true)
|
||||
public IBaseParameters queryLinks(@OperationParam(name = ProviderConstants.MDM_QUERY_LINKS_GOLDEN_RESOURCE_ID, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theGoldenResourceId,
|
||||
@OperationParam(name = ProviderConstants.MDM_QUERY_LINKS_RESOURCE_ID, min = 0, max = 1, typeName = "string") IPrimitiveType<String> theResourceId,
|
||||
|
|
|
@ -252,6 +252,9 @@ public class RestfulServerUtils {
|
|||
return createLinkSelfWithoutGivenParameters(theServerBase, theRequest, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will create a self link but omit any parameters passed in via the excludedParameterNames list.
|
||||
*/
|
||||
public static String createLinkSelfWithoutGivenParameters(String theServerBase, RequestDetails theRequest, List<String> excludedParameterNames) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(theServerBase);
|
||||
|
|
Loading…
Reference in New Issue