Merge pull request #1588 from anthonys123/master
Changes/fixes and associated unit tests for following _filter operators for strings...
This commit is contained in:
commit
25aa076902
|
@ -547,16 +547,20 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
List<ResourcePersistentId> targetPids = myIdHelperService.translateForcedIdToPids(targetIds, theRequest);
|
List<ResourcePersistentId> targetPids = myIdHelperService.translateForcedIdToPids(targetIds, theRequest);
|
||||||
if (!targetPids.isEmpty()) {
|
if (!targetPids.isEmpty()) {
|
||||||
ourLog.debug("Searching for resource link with target PIDs: {}", targetPids);
|
ourLog.debug("Searching for resource link with target PIDs: {}", targetPids);
|
||||||
Predicate pathPredicate = createResourceLinkPathPredicate(theResourceName, theParamName, join);
|
Predicate pathPredicate = ((operation == null) || (operation == SearchFilterParser.CompareOperation.eq)) ? createResourceLinkPathPredicate(theResourceName, theParamName, join)
|
||||||
Predicate pidPredicate = join.get("myTargetResourcePid").in(ResourcePersistentId.toLongList(targetPids));
|
: createResourceLinkPathPredicate(theResourceName, theParamName, join).not();
|
||||||
|
Predicate pidPredicate = ((operation == null) || (operation == SearchFilterParser.CompareOperation.eq)) ? join.get("myTargetResourcePid").in(targetPids)
|
||||||
|
: join.get("myTargetResourcePid").in(targetPids).not();
|
||||||
codePredicates.add(myBuilder.and(pathPredicate, pidPredicate));
|
codePredicates.add(myBuilder.and(pathPredicate, pidPredicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resources by fully qualified URL
|
// Resources by fully qualified URL
|
||||||
if (!targetQualifiedUrls.isEmpty()) {
|
if (!targetQualifiedUrls.isEmpty()) {
|
||||||
ourLog.debug("Searching for resource link with target URLs: {}", targetQualifiedUrls);
|
ourLog.debug("Searching for resource link with target URLs: {}", targetQualifiedUrls);
|
||||||
Predicate pathPredicate = createResourceLinkPathPredicate(theResourceName, theParamName, join);
|
Predicate pathPredicate = ((operation == null) || (operation == SearchFilterParser.CompareOperation.eq)) ? createResourceLinkPathPredicate(theResourceName, theParamName, join)
|
||||||
Predicate pidPredicate = join.get("myTargetResourceUrl").in(targetQualifiedUrls);
|
: createResourceLinkPathPredicate(theResourceName, theParamName, join).not();
|
||||||
|
Predicate pidPredicate = ((operation == null) || (operation == SearchFilterParser.CompareOperation.eq)) ? join.get("myTargetResourceUrl").in(targetQualifiedUrls)
|
||||||
|
: join.get("myTargetResourceUrl").in(targetQualifiedUrls).not();
|
||||||
codePredicates.add(myBuilder.and(pathPredicate, pidPredicate));
|
codePredicates.add(myBuilder.and(pathPredicate, pidPredicate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1466,29 +1470,9 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
BigDecimal theValue,
|
BigDecimal theValue,
|
||||||
final Expression<BigDecimal> thePath,
|
final Expression<BigDecimal> thePath,
|
||||||
String invalidMessageName) {
|
String invalidMessageName) {
|
||||||
return createPredicateNumeric(theResourceName,
|
|
||||||
theParamName,
|
|
||||||
theFrom,
|
|
||||||
builder,
|
|
||||||
theParam,
|
|
||||||
thePrefix,
|
|
||||||
theValue,
|
|
||||||
thePath,
|
|
||||||
invalidMessageName,
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Predicate createPredicateNumeric(String theResourceName,
|
|
||||||
String theParamName,
|
|
||||||
From<?, ? extends BaseResourceIndexedSearchParam> theFrom,
|
|
||||||
CriteriaBuilder builder,
|
|
||||||
IQueryParameterType theParam,
|
|
||||||
ParamPrefixEnum thePrefix,
|
|
||||||
BigDecimal theValue,
|
|
||||||
final Expression<BigDecimal> thePath,
|
|
||||||
String invalidMessageName,
|
|
||||||
SearchFilterParser.CompareOperation operation) {
|
|
||||||
Predicate num;
|
Predicate num;
|
||||||
|
// Per discussions with Grahame Grieve and James Agnew on 11/13/19, modified logic for EQUAL and NOT_EQUAL operators below so as to
|
||||||
|
// use exact value matching. The "fuzz amount" matching is still used with the APPROXIMATE operator.
|
||||||
switch (thePrefix) {
|
switch (thePrefix) {
|
||||||
case GREATERTHAN:
|
case GREATERTHAN:
|
||||||
num = builder.gt(thePath, theValue);
|
num = builder.gt(thePath, theValue);
|
||||||
|
@ -1502,25 +1486,22 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
case LESSTHAN_OR_EQUALS:
|
case LESSTHAN_OR_EQUALS:
|
||||||
num = builder.le(thePath, theValue);
|
num = builder.le(thePath, theValue);
|
||||||
break;
|
break;
|
||||||
case APPROXIMATE:
|
|
||||||
case EQUAL:
|
case EQUAL:
|
||||||
|
num = builder.equal(thePath, theValue);
|
||||||
|
break;
|
||||||
case NOT_EQUAL:
|
case NOT_EQUAL:
|
||||||
|
num = builder.notEqual(thePath, theValue);
|
||||||
|
break;
|
||||||
|
case APPROXIMATE:
|
||||||
BigDecimal mul = calculateFuzzAmount(thePrefix, theValue);
|
BigDecimal mul = calculateFuzzAmount(thePrefix, theValue);
|
||||||
BigDecimal low = theValue.subtract(mul, MathContext.DECIMAL64);
|
BigDecimal low = theValue.subtract(mul, MathContext.DECIMAL64);
|
||||||
BigDecimal high = theValue.add(mul, MathContext.DECIMAL64);
|
BigDecimal high = theValue.add(mul, MathContext.DECIMAL64);
|
||||||
Predicate lowPred;
|
Predicate lowPred;
|
||||||
Predicate highPred;
|
Predicate highPred;
|
||||||
if (thePrefix != ParamPrefixEnum.NOT_EQUAL) {
|
|
||||||
lowPred = builder.ge(thePath.as(BigDecimal.class), low);
|
lowPred = builder.ge(thePath.as(BigDecimal.class), low);
|
||||||
highPred = builder.le(thePath.as(BigDecimal.class), high);
|
highPred = builder.le(thePath.as(BigDecimal.class), high);
|
||||||
num = builder.and(lowPred, highPred);
|
num = builder.and(lowPred, highPred);
|
||||||
ourLog.trace("Searching for {} <= val <= {}", low, high);
|
ourLog.trace("Searching for {} <= val <= {}", low, high);
|
||||||
} else {
|
|
||||||
// Prefix was "ne", so reverse it!
|
|
||||||
lowPred = builder.lt(thePath.as(BigDecimal.class), low);
|
|
||||||
highPred = builder.gt(thePath.as(BigDecimal.class), high);
|
|
||||||
num = builder.or(lowPred, highPred);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case ENDS_BEFORE:
|
case ENDS_BEFORE:
|
||||||
case STARTS_AFTER:
|
case STARTS_AFTER:
|
||||||
|
@ -1720,35 +1701,39 @@ public class SearchBuilder implements ISearchBuilder {
|
||||||
|
|
||||||
boolean exactMatch = theParameter instanceof StringParam && ((StringParam) theParameter).isExact();
|
boolean exactMatch = theParameter instanceof StringParam && ((StringParam) theParameter).isExact();
|
||||||
if (exactMatch) {
|
if (exactMatch) {
|
||||||
|
|
||||||
// Exact match
|
// Exact match
|
||||||
|
|
||||||
Long hash = ResourceIndexedSearchParamString.calculateHashExact(theResourceName, theParamName, rawSearchTerm);
|
Long hash = ResourceIndexedSearchParamString.calculateHashExact(theResourceName, theParamName, rawSearchTerm);
|
||||||
return theBuilder.equal(theFrom.get("myHashExact").as(Long.class), hash);
|
return theBuilder.equal(theFrom.get("myHashExact").as(Long.class), hash);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// Normalized Match
|
// Normalized Match
|
||||||
|
|
||||||
String normalizedString = StringNormalizer.normalizeString(rawSearchTerm);
|
String normalizedString = StringNormalizer.normalizeString(rawSearchTerm);
|
||||||
String likeExpression;
|
String likeExpression;
|
||||||
if (theParameter instanceof StringParam &&
|
if ((theParameter instanceof StringParam) &&
|
||||||
((StringParam) theParameter).isContains() &&
|
(((((StringParam) theParameter).isContains()) &&
|
||||||
myDaoConfig.isAllowContainsSearches()) {
|
(myCallingDao.getConfig().isAllowContainsSearches())) ||
|
||||||
|
(operation == SearchFilterParser.CompareOperation.co))) {
|
||||||
likeExpression = createLeftAndRightMatchLikeExpression(normalizedString);
|
likeExpression = createLeftAndRightMatchLikeExpression(normalizedString);
|
||||||
|
} else if ((operation != SearchFilterParser.CompareOperation.ne) &&
|
||||||
|
(operation != SearchFilterParser.CompareOperation.gt) &&
|
||||||
|
(operation != SearchFilterParser.CompareOperation.lt) &&
|
||||||
|
(operation != SearchFilterParser.CompareOperation.ge) &&
|
||||||
|
(operation != SearchFilterParser.CompareOperation.le)) {
|
||||||
|
if (operation == SearchFilterParser.CompareOperation.ew) {
|
||||||
|
likeExpression = createRightMatchLikeExpression(normalizedString);
|
||||||
} else {
|
} else {
|
||||||
likeExpression = createLeftMatchLikeExpression(normalizedString);
|
likeExpression = createLeftMatchLikeExpression(normalizedString);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
likeExpression = normalizedString;
|
||||||
|
}
|
||||||
|
|
||||||
Predicate predicate;
|
Predicate predicate;
|
||||||
if ((operation == null) ||
|
if ((operation == null) ||
|
||||||
(operation == SearchFilterParser.CompareOperation.sw) ||
|
(operation == SearchFilterParser.CompareOperation.sw) ||
|
||||||
(operation == SearchFilterParser.CompareOperation.ew)) {
|
(operation == SearchFilterParser.CompareOperation.ew) ||
|
||||||
|
(operation == SearchFilterParser.CompareOperation.co)) {
|
||||||
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
|
||||||
Predicate hashCode = theBuilder.equal(theFrom.get("myHashNormalizedPrefix").as(Long.class), hash);
|
|
||||||
Predicate singleCode = theBuilder.like(theFrom.get("myValueNormalized").as(String.class), likeExpression);
|
Predicate singleCode = theBuilder.like(theFrom.get("myValueNormalized").as(String.class), likeExpression);
|
||||||
predicate = theBuilder.and(hashCode, singleCode);
|
predicate = combineParamIndexPredicateWithParamNamePredicate(theResourceName, theParamName, theFrom, singleCode);
|
||||||
} else if (operation == SearchFilterParser.CompareOperation.eq) {
|
} else if (operation == SearchFilterParser.CompareOperation.eq) {
|
||||||
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
Long hash = ResourceIndexedSearchParamString.calculateHashNormalized(myDaoConfig.getModelConfig(), theResourceName, theParamName, normalizedString);
|
||||||
Predicate hashCode = theBuilder.equal(theFrom.get("myHashNormalizedPrefix").as(Long.class), hash);
|
Predicate hashCode = theBuilder.equal(theFrom.get("myHashNormalizedPrefix").as(Long.class), hash);
|
||||||
|
|
|
@ -361,12 +361,12 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder(id3));
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.0", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.0", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder(id3));
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.01", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.01", "foo", "bar")).setLoadSynchronous(true));
|
||||||
|
@ -381,12 +381,12 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.02", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.02", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder());
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.001", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.001", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder());
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,20 +4,25 @@ import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
import ca.uhn.fhir.jpa.util.TestUtil;
|
import ca.uhn.fhir.jpa.util.TestUtil;
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
import ca.uhn.fhir.rest.api.server.IBundleProvider;
|
||||||
import ca.uhn.fhir.rest.param.StringParam;
|
import ca.uhn.fhir.rest.param.StringParam;
|
||||||
|
import ca.uhn.fhir.rest.param.UriParam;
|
||||||
|
import ca.uhn.fhir.rest.param.UriParamQualifierEnum;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import org.hamcrest.Matchers;
|
import org.hamcrest.Matchers;
|
||||||
import org.hl7.fhir.instance.model.api.IIdType;
|
import org.hl7.fhir.instance.model.api.IIdType;
|
||||||
import org.hl7.fhir.r4.model.CarePlan;
|
import org.hl7.fhir.r4.model.*;
|
||||||
import org.hl7.fhir.r4.model.Patient;
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
|
import static org.hamcrest.Matchers.empty;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
@SuppressWarnings({"Duplicates"})
|
@SuppressWarnings({"Duplicates"})
|
||||||
|
@ -204,6 +209,966 @@ public class FhirResourceDaoR4FilterTest extends BaseJpaR4Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorNe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family ne smith"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
assertThat(found, containsInAnyOrder(Matchers.not(id1)));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family ne jones"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
assertThat(found, containsInAnyOrder(Matchers.not(id2)));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given ne john"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
assertThat(found, containsInAnyOrder(Matchers.not(id1)));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given ne frank"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
assertThat(found, containsInAnyOrder(Matchers.not(id2)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReferenceComparatorNe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
IIdType ptId = myPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John2");
|
||||||
|
p.setActive(true);
|
||||||
|
IIdType ptId2 = myPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
CarePlan cp = new CarePlan();
|
||||||
|
cp.getSubject().setReference(ptId.getValue());
|
||||||
|
String cpId = myCarePlanDao.create(cp).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
cp = new CarePlan();
|
||||||
|
cp.addActivity().getDetail().addPerformer().setReference(ptId2.getValue());
|
||||||
|
String cpId2 = myCarePlanDao.create(cp).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("subject ne " + ptId.getValue()));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myCarePlanDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(cpId2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("subject ne " + ptId.getIdPart()));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myCarePlanDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(cpId2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("(subject ne " + ptId.getIdPart() + ") and (performer ne " + ptId2.getValue() + ")"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myCarePlanDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorCo() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("name co smi"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("name co smith"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given co frank"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family co jones"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorSw() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("name sw smi"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("name sw mi"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given sw fr"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorEw() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family ew ith"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("name ew it"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given ew nk"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorGt() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family gt jones"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family gt arthur"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1, id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given gt john"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorLt() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family lt smith"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family lt walker"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1, id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given lt frank"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorGe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family ge jones"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1, id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family ge justin"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family ge arthur"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1, id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("given ge jon"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testStringComparatorLe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
p = new Patient();
|
||||||
|
p.addName().setFamily("Jones").addGiven("Frank");
|
||||||
|
p.setActive(false);
|
||||||
|
String id2 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family le smith"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1, id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family le jones"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("family le jackson"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDateComparatorEq() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setBirthDateElement(new DateType("1955-01-01"));
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate eq 1955-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDateComparatorNe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setBirthDateElement(new DateType("1955-01-01"));
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate ne 1955-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate ne 1995-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDateComparatorGt() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setBirthDateElement(new DateType("1955-01-01"));
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate gt 1954-12-31"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate gt 1955-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDateComparatorLt() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setBirthDateElement(new DateType("1955-01-01"));
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate lt 1955-01-02"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate lt 1955-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDateComparatorGe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setBirthDateElement(new DateType("1955-01-01"));
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate ge 1955-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate ge 1954-12-31"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate ge 1955-01-02"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDateComparatorLe() {
|
||||||
|
|
||||||
|
Patient p = new Patient();
|
||||||
|
p.addName().setFamily("Smith").addGiven("John");
|
||||||
|
p.setBirthDateElement(new DateType("1955-01-01"));
|
||||||
|
p.setActive(true);
|
||||||
|
String id1 = myPatientDao.create(p).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate le 1955-01-01"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate le 1954-12-31"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("birthdate le 1955-01-02"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myPatientDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(id1));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumericComparatorEq() {
|
||||||
|
|
||||||
|
RiskAssessment ra1 = new RiskAssessment();
|
||||||
|
RiskAssessment ra2 = new RiskAssessment();
|
||||||
|
|
||||||
|
RiskAssessment.RiskAssessmentPredictionComponent component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
DecimalType doseNumber = new DecimalType(0.25);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra1.addPrediction(component);
|
||||||
|
String raId1 = myRiskAssessmentDao.create(ra1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
doseNumber = new DecimalType(0.3);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra2.addPrediction(component);
|
||||||
|
String raId2 = myRiskAssessmentDao.create(ra2).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability eq 0.25"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability eq 0.3"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability eq 0.1"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumericComparatorNe() {
|
||||||
|
|
||||||
|
RiskAssessment ra1 = new RiskAssessment();
|
||||||
|
RiskAssessment ra2 = new RiskAssessment();
|
||||||
|
|
||||||
|
RiskAssessment.RiskAssessmentPredictionComponent component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
DecimalType doseNumber = new DecimalType(0.25);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra1.addPrediction(component);
|
||||||
|
String raId1 = myRiskAssessmentDao.create(ra1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
doseNumber = new DecimalType(0.3);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra2.addPrediction(component);
|
||||||
|
String raId2 = myRiskAssessmentDao.create(ra2).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability ne 0.25"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability ne 0.3"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability ne 0.1"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1, raId2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumericComparatorGt() {
|
||||||
|
|
||||||
|
RiskAssessment ra1 = new RiskAssessment();
|
||||||
|
RiskAssessment ra2 = new RiskAssessment();
|
||||||
|
|
||||||
|
RiskAssessment.RiskAssessmentPredictionComponent component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
DecimalType doseNumber = new DecimalType(0.25);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra1.addPrediction(component);
|
||||||
|
String raId1 = myRiskAssessmentDao.create(ra1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
doseNumber = new DecimalType(0.3);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra2.addPrediction(component);
|
||||||
|
String raId2 = myRiskAssessmentDao.create(ra2).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability gt 0.25"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability gt 0.3"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumericComparatorLt() {
|
||||||
|
|
||||||
|
RiskAssessment ra1 = new RiskAssessment();
|
||||||
|
RiskAssessment ra2 = new RiskAssessment();
|
||||||
|
|
||||||
|
RiskAssessment.RiskAssessmentPredictionComponent component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
DecimalType doseNumber = new DecimalType(0.25);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra1.addPrediction(component);
|
||||||
|
String raId1 = myRiskAssessmentDao.create(ra1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
doseNumber = new DecimalType(0.3);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra2.addPrediction(component);
|
||||||
|
String raId2 = myRiskAssessmentDao.create(ra2).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability lt 0.3"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability lt 0.25"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumericComparatorGe() {
|
||||||
|
|
||||||
|
RiskAssessment ra1 = new RiskAssessment();
|
||||||
|
RiskAssessment ra2 = new RiskAssessment();
|
||||||
|
|
||||||
|
RiskAssessment.RiskAssessmentPredictionComponent component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
DecimalType doseNumber = new DecimalType(0.25);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra1.addPrediction(component);
|
||||||
|
String raId1 = myRiskAssessmentDao.create(ra1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
doseNumber = new DecimalType(0.3);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra2.addPrediction(component);
|
||||||
|
String raId2 = myRiskAssessmentDao.create(ra2).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability ge 0.25"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1, raId2));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability ge 0.3"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testNumericComparatorLe() {
|
||||||
|
|
||||||
|
RiskAssessment ra1 = new RiskAssessment();
|
||||||
|
RiskAssessment ra2 = new RiskAssessment();
|
||||||
|
|
||||||
|
RiskAssessment.RiskAssessmentPredictionComponent component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
DecimalType doseNumber = new DecimalType(0.25);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra1.addPrediction(component);
|
||||||
|
String raId1 = myRiskAssessmentDao.create(ra1).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
component = new RiskAssessment.RiskAssessmentPredictionComponent();
|
||||||
|
doseNumber = new DecimalType(0.3);
|
||||||
|
component.setProbability(doseNumber);
|
||||||
|
ra2.addPrediction(component);
|
||||||
|
String raId2 = myRiskAssessmentDao.create(ra2).getId().toUnqualifiedVersionless().getValue();
|
||||||
|
|
||||||
|
SearchParameterMap map;
|
||||||
|
List<String> found;
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability le 0.25"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1));
|
||||||
|
|
||||||
|
map = new SearchParameterMap();
|
||||||
|
map.setLoadSynchronous(true);
|
||||||
|
map.add(Constants.PARAM_FILTER, new StringParam("probability le 0.3"));
|
||||||
|
found = toUnqualifiedVersionlessIdValues(myRiskAssessmentDao.search(map));
|
||||||
|
assertThat(found, containsInAnyOrder(raId1, raId2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriEq() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url eq http://hl7.org/foo/baz")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url eq http://hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url eq http://hl7.org/foo/bar/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriNe() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ne http://hl7.org/foo/baz")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ne http://hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ne http://hl7.org/foo/baz and url ne http://hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriCo() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url co http://hl7.org/foo")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1, vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url co baz")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url co http://hl7.org/foo/bat")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriGt() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url gt http://hl7.org/foo")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1, vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url gt http://hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url gt http://hl7.org/foo/baza")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriLt() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url lt http://hl7.org/foo")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url lt http://hl7.org/foo/baz")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url lt http://hl7.org/foo/bara")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriGe() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ge http://hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1, vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ge http://hl7.org/foo/baza")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriLe() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url le http://hl7.org/foo/baz")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1, vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url le http://hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url lt http://hl7.org/foo/baza")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1, vsId2));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriSw() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url sw http://hl7.org")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1, vsId2));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url sw hl7.org/foo/bar")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSearchUriEw() throws Exception {
|
||||||
|
|
||||||
|
ValueSet vs1 = new ValueSet();
|
||||||
|
vs1.setUrl("http://hl7.org/foo/baz");
|
||||||
|
IIdType vsId1 = myValueSetDao.create(vs1, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
ValueSet vs2 = new ValueSet();
|
||||||
|
vs2.setUrl("http://hl7.org/foo/bar");
|
||||||
|
IIdType vsId2 = myValueSetDao.create(vs2, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
IBundleProvider result;
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ew baz")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), containsInAnyOrder(vsId1));
|
||||||
|
|
||||||
|
result = myValueSetDao.search(new SearchParameterMap().setLoadSynchronous(true).add(Constants.PARAM_FILTER,
|
||||||
|
new StringParam("url ew ba")));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(result), Matchers.empty());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void afterClassClearContext() {
|
public static void afterClassClearContext() {
|
||||||
TestUtil.clearAllStaticFieldsForUnitTest();
|
TestUtil.clearAllStaticFieldsForUnitTest();
|
||||||
|
|
|
@ -463,12 +463,12 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder(id3));
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.0", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.0", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder(id3));
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.01", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.01", "foo", "bar")).setLoadSynchronous(true));
|
||||||
|
@ -483,12 +483,12 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.02", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.02", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder());
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.001", "foo", "bar")).setLoadSynchronous(true));
|
IBundleProvider found = myObservationDao.search(new SearchParameterMap(Observation.SP_VALUE_QUANTITY, new QuantityParam("123.001", "foo", "bar")).setLoadSynchronous(true));
|
||||||
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
List<IIdType> list = toUnqualifiedVersionlessIds(found);
|
||||||
assertThat(list, containsInAnyOrder());
|
assertThat(list, Matchers.empty());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue