Fix failing test with new filter logic
This commit is contained in:
parent
ea1f17762e
commit
8284734a07
|
@ -1,5 +1,24 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.model.api.IQueryParameterAnd;
|
||||||
|
import ca.uhn.fhir.model.api.IQueryParameterOr;
|
||||||
|
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||||
|
import ca.uhn.fhir.model.api.Include;
|
||||||
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
import ca.uhn.fhir.rest.api.SortOrderEnum;
|
||||||
|
import ca.uhn.fhir.rest.api.SortSpec;
|
||||||
|
import ca.uhn.fhir.rest.param.DateParam;
|
||||||
|
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||||
|
import ca.uhn.fhir.util.ObjectUtil;
|
||||||
|
import ca.uhn.fhir.util.UrlUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.Validate;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -21,20 +40,6 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.apache.commons.lang3.Validate;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.api.*;
|
|
||||||
import ca.uhn.fhir.rest.api.*;
|
|
||||||
import ca.uhn.fhir.rest.param.DateParam;
|
|
||||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
|
||||||
import ca.uhn.fhir.util.ObjectUtil;
|
|
||||||
import ca.uhn.fhir.util.UrlUtil;
|
|
||||||
|
|
||||||
public class SearchParameterMap extends LinkedHashMap<String, List<List<? extends IQueryParameterType>>> {
|
public class SearchParameterMap extends LinkedHashMap<String, List<List<? extends IQueryParameterType>>> {
|
||||||
|
|
||||||
|
@ -158,10 +163,18 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return myCount;
|
return myCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCount(Integer theCount) {
|
||||||
|
myCount = theCount;
|
||||||
|
}
|
||||||
|
|
||||||
public EverythingModeEnum getEverythingMode() {
|
public EverythingModeEnum getEverythingMode() {
|
||||||
return myEverythingMode;
|
return myEverythingMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setEverythingMode(EverythingModeEnum theConsolidateMatches) {
|
||||||
|
myEverythingMode = theConsolidateMatches;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<Include> getIncludes() {
|
public Set<Include> getIncludes() {
|
||||||
if (myIncludes == null) {
|
if (myIncludes == null) {
|
||||||
myIncludes = new HashSet<Include>();
|
myIncludes = new HashSet<Include>();
|
||||||
|
@ -169,6 +182,10 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return myIncludes;
|
return myIncludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setIncludes(Set<Include> theIncludes) {
|
||||||
|
myIncludes = theIncludes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns null if there is no last updated value
|
* Returns null if there is no last updated value
|
||||||
*/
|
*/
|
||||||
|
@ -181,6 +198,10 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return myLastUpdated;
|
return myLastUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setLastUpdated(DateRangeParam theLastUpdated) {
|
||||||
|
myLastUpdated = theLastUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns null if there is no last updated value, and removes the lastupdated
|
* Returns null if there is no last updated value, and removes the lastupdated
|
||||||
* value from this map
|
* value from this map
|
||||||
|
@ -199,6 +220,19 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return myLoadSynchronousUpTo;
|
return myLoadSynchronousUpTo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set, tells the server to load these results synchronously, and not to load
|
||||||
|
* more than X results. Note that setting this to a value will also set
|
||||||
|
* {@link #setLoadSynchronous(boolean)} to true
|
||||||
|
*/
|
||||||
|
public SearchParameterMap setLoadSynchronousUpTo(Integer theLoadSynchronousUpTo) {
|
||||||
|
myLoadSynchronousUpTo = theLoadSynchronousUpTo;
|
||||||
|
if (myLoadSynchronousUpTo != null) {
|
||||||
|
setLoadSynchronous(true);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Set<Include> getRevIncludes() {
|
public Set<Include> getRevIncludes() {
|
||||||
if (myRevIncludes == null) {
|
if (myRevIncludes == null) {
|
||||||
myRevIncludes = new HashSet<>();
|
myRevIncludes = new HashSet<>();
|
||||||
|
@ -206,10 +240,18 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return myRevIncludes;
|
return myRevIncludes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRevIncludes(Set<Include> theRevIncludes) {
|
||||||
|
myRevIncludes = theRevIncludes;
|
||||||
|
}
|
||||||
|
|
||||||
public SortSpec getSort() {
|
public SortSpec getSort() {
|
||||||
return mySort;
|
return mySort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSort(SortSpec theSort) {
|
||||||
|
mySort = theSort;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This will only return true if all parameters have no modifier of any kind
|
* This will only return true if all parameters have no modifier of any kind
|
||||||
*/
|
*/
|
||||||
|
@ -234,22 +276,6 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return myLoadSynchronous;
|
return myLoadSynchronous;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCount(Integer theCount) {
|
|
||||||
myCount = theCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEverythingMode(EverythingModeEnum theConsolidateMatches) {
|
|
||||||
myEverythingMode = theConsolidateMatches;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIncludes(Set<Include> theIncludes) {
|
|
||||||
myIncludes = theIncludes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastUpdated(DateRangeParam theLastUpdated) {
|
|
||||||
myLastUpdated = theLastUpdated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set, tells the server to load these results synchronously, and not to load
|
* If set, tells the server to load these results synchronously, and not to load
|
||||||
* more than X results
|
* more than X results
|
||||||
|
@ -259,27 +285,6 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If set, tells the server to load these results synchronously, and not to load
|
|
||||||
* more than X results. Note that setting this to a value will also set
|
|
||||||
* {@link #setLoadSynchronous(boolean)} to true
|
|
||||||
*/
|
|
||||||
public SearchParameterMap setLoadSynchronousUpTo(Integer theLoadSynchronousUpTo) {
|
|
||||||
myLoadSynchronousUpTo = theLoadSynchronousUpTo;
|
|
||||||
if (myLoadSynchronousUpTo != null) {
|
|
||||||
setLoadSynchronous(true);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRevIncludes(Set<Include> theRevIncludes) {
|
|
||||||
myRevIncludes = theRevIncludes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSort(SortSpec theSort) {
|
|
||||||
mySort = theSort;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String toNormalizedQueryString(FhirContext theCtx) {
|
public String toNormalizedQueryString(FhirContext theCtx) {
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
|
|
||||||
|
@ -439,7 +444,10 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
/*
|
/*
|
||||||
* Don't reorder! We rely on the ordinals
|
* Don't reorder! We rely on the ordinals
|
||||||
*/
|
*/
|
||||||
ENCOUNTER_INSTANCE(false, true, true), ENCOUNTER_TYPE(false, true, false), PATIENT_INSTANCE(true, false, true), PATIENT_TYPE(true, false, false);
|
ENCOUNTER_INSTANCE(false, true, true),
|
||||||
|
ENCOUNTER_TYPE(false, true, false),
|
||||||
|
PATIENT_INSTANCE(true, false, true),
|
||||||
|
PATIENT_TYPE(true, false, false);
|
||||||
|
|
||||||
private final boolean myEncounter;
|
private final boolean myEncounter;
|
||||||
|
|
||||||
|
@ -447,7 +455,7 @@ public class SearchParameterMap extends LinkedHashMap<String, List<List<? extend
|
||||||
|
|
||||||
private final boolean myPatient;
|
private final boolean myPatient;
|
||||||
|
|
||||||
private EverythingModeEnum(boolean thePatient, boolean theEncounter, boolean theInstance) {
|
EverythingModeEnum(boolean thePatient, boolean theEncounter, boolean theInstance) {
|
||||||
assert thePatient ^ theEncounter;
|
assert thePatient ^ theEncounter;
|
||||||
myPatient = thePatient;
|
myPatient = thePatient;
|
||||||
myEncounter = theEncounter;
|
myEncounter = theEncounter;
|
||||||
|
|
|
@ -1503,7 +1503,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
ourLog.info(output);
|
ourLog.info(output);
|
||||||
List<IIdType> ids = toUnqualifiedVersionlessIds(myFhirCtx.newXmlParser().parseResource(Bundle.class, output));
|
List<IIdType> ids = toUnqualifiedVersionlessIds(myFhirCtx.newXmlParser().parseResource(Bundle.class, output));
|
||||||
ourLog.info(ids.toString());
|
ourLog.info(ids.toString());
|
||||||
assertThat(ids, containsInAnyOrder(pId, cId));
|
assertThat(ids, containsInAnyOrder(pId, cId, oId));
|
||||||
} finally {
|
} finally {
|
||||||
response.close();
|
response.close();
|
||||||
}
|
}
|
||||||
|
@ -1518,7 +1518,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
|
||||||
ourLog.info(output);
|
ourLog.info(output);
|
||||||
List<IIdType> ids = toUnqualifiedVersionlessIds(myFhirCtx.newXmlParser().parseResource(Bundle.class, output));
|
List<IIdType> ids = toUnqualifiedVersionlessIds(myFhirCtx.newXmlParser().parseResource(Bundle.class, output));
|
||||||
ourLog.info(ids.toString());
|
ourLog.info(ids.toString());
|
||||||
assertThat(ids, containsInAnyOrder(pId, cId));
|
assertThat(ids, containsInAnyOrder(pId, cId, oId));
|
||||||
} finally {
|
} finally {
|
||||||
response.close();
|
response.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue