Refactor JPA SearchBuilder
This commit is contained in:
parent
eba3ca8e59
commit
99a4b2c29e
|
@ -69,8 +69,10 @@ public interface IQueryParameterType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set to non-null value, indicates that this parameter has been populated with a "[name]:missing=true" or "[name]:missing=false" vale
|
* If set to non-null value, indicates that this parameter has been populated with a "[name]:missing=true" or "[name]:missing=false" vale
|
||||||
* instead of a normal value
|
* instead of a normal value
|
||||||
|
*
|
||||||
|
* @return Returns a reference to <code>this</code> for easier method chaining
|
||||||
*/
|
*/
|
||||||
void setMissing(Boolean theMissing);
|
IQueryParameterType setMissing(Boolean theMissing);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public abstract class BaseCodingDt extends BaseIdentifiableElement implements IC
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public IQueryParameterType setMissing(Boolean theMissing) {
|
||||||
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ public abstract class BaseIdentifierDt extends BaseIdentifiableElement implement
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public IQueryParameterType setMissing(Boolean theMissing) {
|
||||||
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,7 +231,7 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public IQueryParameterType setMissing(Boolean theMissing) {
|
||||||
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class StringDt extends BasePrimitive<String> implements IQueryParameterTy
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public IQueryParameterType setMissing(Boolean theMissing) {
|
||||||
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,11 +61,16 @@ abstract class BaseParam implements IQueryParameterType {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set to non-null value, indicates that this parameter has been populated with a "[name]:missing=true" or "[name]:missing=false" vale instead of a normal value
|
* If set to non-null value, indicates that this parameter has been populated
|
||||||
|
* with a "[name]:missing=true" or "[name]:missing=false" vale instead of a
|
||||||
|
* normal value
|
||||||
|
*
|
||||||
|
* @return Returns a reference to <code>this</code> for easier method chaining
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public BaseParam setMissing(Boolean theMissing) {
|
||||||
myMissing = theMissing;
|
myMissing = theMissing;
|
||||||
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -24,6 +24,7 @@ import java.util.List;
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||||
import ca.uhn.fhir.model.api.IElement;
|
import ca.uhn.fhir.model.api.IElement;
|
||||||
|
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||||
|
@ -297,7 +298,7 @@ public class InternalCodingDt extends BaseCodingDt implements ICompositeDatatype
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public IQueryParameterType setMissing(Boolean theMissing) {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -936,7 +936,6 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
* @param theTag
|
* @param theTag
|
||||||
* The tag
|
* The tag
|
||||||
* @return Returns <code>true</code> if the tag should be removed
|
* @return Returns <code>true</code> if the tag should be removed
|
||||||
* @see <a href="http://hl7.org/fhir/2015Sep/resource.html#1.11.3.7">Updates to Tags, Profiles, and Security Labels</a> for a description of the logic that the default behaviour folows.
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
protected void postPersist(ResourceTable theEntity, T theResource) {
|
protected void postPersist(ResourceTable theEntity, T theResource) {
|
||||||
|
@ -966,7 +965,7 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
}
|
}
|
||||||
|
|
||||||
IFhirResourceDao<R> dao = getDao(theResourceType);
|
IFhirResourceDao<R> dao = getDao(theResourceType);
|
||||||
Set<Long> ids = dao.searchForIdsWithAndOr(paramMap, new HashSet<Long>(), paramMap.getLastUpdated());
|
Set<Long> ids = dao.searchForIdsWithAndOr(paramMap, paramMap.getLastUpdated());
|
||||||
|
|
||||||
return ids;
|
return ids;
|
||||||
}
|
}
|
||||||
|
@ -1168,14 +1167,16 @@ public abstract class BaseHapiFhirDao<T extends IBaseResource> implements IDao {
|
||||||
* The default implementation removes any profile declarations, but leaves tags and security labels in place.
|
* The default implementation removes any profile declarations, but leaves tags and security labels in place.
|
||||||
* Subclasses may choose to override and change this behaviour.
|
* Subclasses may choose to override and change this behaviour.
|
||||||
* </p>
|
* </p>
|
||||||
|
* <p>
|
||||||
|
* See <a href="http://hl7.org/fhir/2015Sep/resource.html#1.11.3.7">Updates to Tags, Profiles, and Security
|
||||||
|
* Labels</a> for a description of the logic that the default behaviour folows.
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param theEntity
|
* @param theEntity
|
||||||
* The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
* The entity being updated (Do not modify the entity! Undefined behaviour will occur!)
|
||||||
* @param theTag
|
* @param theTag
|
||||||
* The tag
|
* The tag
|
||||||
* @return Retturns <code>true</code> if the tag should be removed
|
* @return Retturns <code>true</code> if the tag should be removed
|
||||||
* @see <a href="http://hl7.org/fhir/2015Sep/resource.html#1.11.3.7">Updates to Tags, Profiles, and Security
|
|
||||||
* Labels</a> for a description of the logic that the default behaviour folows.
|
|
||||||
*/
|
*/
|
||||||
protected boolean shouldDroppedTagBeRemovedOnUpdate(ResourceTable theEntity, ResourceTag theTag) {
|
protected boolean shouldDroppedTagBeRemovedOnUpdate(ResourceTable theEntity, ResourceTag theTag) {
|
||||||
if (theTag.getTag().getTagType() == TagTypeEnum.PROFILE) {
|
if (theTag.getTag().getTagType() == TagTypeEnum.PROFILE) {
|
||||||
|
|
|
@ -932,7 +932,7 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
for (Entry<String, IQueryParameterType> nextEntry : theParams.entrySet()) {
|
for (Entry<String, IQueryParameterType> nextEntry : theParams.entrySet()) {
|
||||||
map.add(nextEntry.getKey(), (nextEntry.getValue()));
|
map.add(nextEntry.getKey(), (nextEntry.getValue()));
|
||||||
}
|
}
|
||||||
return searchForIdsWithAndOr(map, null, null);
|
return searchForIdsWithAndOr(map, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -941,10 +941,11 @@ public abstract class BaseHapiFhirResourceDao<T extends IBaseResource> extends B
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<Long> searchForIdsWithAndOr(SearchParameterMap theParams, Collection<Long> theInitialPids, DateRangeParam theLastUpdated) {
|
public Set<Long> searchForIdsWithAndOr(SearchParameterMap theParams, DateRangeParam theLastUpdated) {
|
||||||
SearchBuilder builder = new SearchBuilder(getContext(), myEntityManager, myPlatformTransactionManager, mySearchDao, mySearchResultDao, this, myResourceIndexedSearchParamUriDao);
|
SearchBuilder builder = new SearchBuilder(getContext(), myEntityManager, myPlatformTransactionManager, mySearchDao, mySearchResultDao, this, myResourceIndexedSearchParamUriDao);
|
||||||
builder.setType(getResourceType(), getResourceName());
|
builder.setType(getResourceType(), getResourceName());
|
||||||
return builder.searchForIdsWithAndOr(theParams, theInitialPids, theLastUpdated);
|
builder.searchForIdsWithAndOr(theParams, theLastUpdated);
|
||||||
|
return builder.doGetPids();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* HAPI FHIR JPA Server
|
* HAPI FHIR JPA Server
|
||||||
|
@ -164,7 +162,7 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
|
||||||
|
|
||||||
Set<Long> searchForIds(String theParameterName, IQueryParameterType theValue);
|
Set<Long> searchForIds(String theParameterName, IQueryParameterType theValue);
|
||||||
|
|
||||||
Set<Long> searchForIdsWithAndOr(SearchParameterMap theParams, Collection<Long> theInitialPids, DateRangeParam theLastUpdated);
|
Set<Long> searchForIdsWithAndOr(SearchParameterMap theParams, DateRangeParam theLastUpdated);
|
||||||
|
|
||||||
DaoMethodOutcome update(T theResource, RequestDetails theRequestDetails);
|
DaoMethodOutcome update(T theResource, RequestDetails theRequestDetails);
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -53,13 +53,13 @@ public class Search implements Serializable {
|
||||||
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO, generator="SEQ_SEARCH")
|
@GeneratedValue(strategy = GenerationType.AUTO, generator="SEQ_SEARCH")
|
||||||
@SequenceGenerator(name="SEQ_SEARCH", sequenceName="SEQ_SEARCH")
|
@SequenceGenerator(name="SEQ_SEARCH", sequenceName="SEQ_SEARCH")
|
||||||
@Id
|
|
||||||
@Column(name = "PID")
|
@Column(name = "PID")
|
||||||
private Long myId;
|
private Long myId;
|
||||||
|
|
||||||
@Column(name="TOTAL_COUNT")
|
@Column(name="TOTAL_COUNT")
|
||||||
private int myTotalCount;
|
private int myTotalCount;
|
||||||
|
|
||||||
|
@Id
|
||||||
@Column(name="SEARCH_UUID", length=40, nullable=false)
|
@Column(name="SEARCH_UUID", length=40, nullable=false)
|
||||||
private String myUuid;
|
private String myUuid;
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,9 @@ import java.util.HashSet;
|
||||||
import java.util.IdentityHashMap;
|
import java.util.IdentityHashMap;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import javax.transaction.Transactional.TxType;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.ValidationUtils;
|
import org.springframework.validation.ValidationUtils;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
@ -44,7 +43,7 @@ public class TerminologySvcImpl implements ITerminologySvc {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(value=TxType.REQUIRED)
|
@Transactional(propagation=Propagation.REQUIRED)
|
||||||
public void storeNewCodeSystemVersion(String theSystemUri, TermCodeSystemVersion theCodeSystem) {
|
public void storeNewCodeSystemVersion(String theSystemUri, TermCodeSystemVersion theCodeSystem) {
|
||||||
ourLog.info("Storing code system");
|
ourLog.info("Storing code system");
|
||||||
|
|
||||||
|
@ -108,7 +107,7 @@ public class TerminologySvcImpl implements ITerminologySvc {
|
||||||
theConceptsStack.remove(theConcept);
|
theConceptsStack.remove(theConcept);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(value=TxType.REQUIRED)
|
@Transactional(propagation=Propagation.REQUIRED)
|
||||||
@Override
|
@Override
|
||||||
public Set<TermConcept> findCodesBelow(Long theCodeSystemResourcePid, Long theCodeSystemVersionPid, String theCode) {
|
public Set<TermConcept> findCodesBelow(Long theCodeSystemResourcePid, Long theCodeSystemVersionPid, String theCode) {
|
||||||
TermCodeSystemVersion codeSystem = myCodeSystemVersionDao.findByCodeSystemResourceAndVersion(theCodeSystemResourcePid, theCodeSystemVersionPid);
|
TermCodeSystemVersion codeSystem = myCodeSystemVersionDao.findByCodeSystemResourceAndVersion(theCodeSystemResourcePid, theCodeSystemVersionPid);
|
||||||
|
|
|
@ -395,6 +395,60 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Test
|
||||||
|
public void testSearchResourceReferenceMissing() {
|
||||||
|
IIdType oid1;
|
||||||
|
{
|
||||||
|
Organization org = new Organization();
|
||||||
|
org.setName("ORG1");
|
||||||
|
oid1 = myOrganizationDao.create(org, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
||||||
|
}
|
||||||
|
|
||||||
|
IIdType pid1;
|
||||||
|
{
|
||||||
|
Patient patient = new Patient();
|
||||||
|
patient.addName().addFamily("FAMILY1");
|
||||||
|
pid1 = myPatientDao.create(patient, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
||||||
|
}
|
||||||
|
IIdType pid2;
|
||||||
|
{
|
||||||
|
Patient patient = new Patient();
|
||||||
|
patient.addName().addFamily("FAMILY1");
|
||||||
|
patient.getManagingOrganization().setReference(oid1);
|
||||||
|
pid2 = myPatientDao.create(patient, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
||||||
|
}
|
||||||
|
IIdType pid3;
|
||||||
|
{
|
||||||
|
Patient patient = new Patient();
|
||||||
|
patient.addName().addFamily("FAMILY2");
|
||||||
|
pid3 = myPatientDao.create(patient, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
||||||
|
}
|
||||||
|
IIdType pid4;
|
||||||
|
{
|
||||||
|
Patient patient = new Patient();
|
||||||
|
patient.addName().addFamily("FAMILY2");
|
||||||
|
patient.getManagingOrganization().setReference(oid1);
|
||||||
|
pid4 = myPatientDao.create(patient, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchParameterMap params;
|
||||||
|
|
||||||
|
params = new SearchParameterMap();
|
||||||
|
params.add(Patient.SP_NAME, new StringParam("FAMILY1"));
|
||||||
|
params.add(Patient.SP_ORGANIZATION, new ReferenceParam().setMissing(true));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(pid1));
|
||||||
|
|
||||||
|
params = new SearchParameterMap();
|
||||||
|
params.add(Patient.SP_ORGANIZATION, new ReferenceParam().setMissing(true));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), containsInAnyOrder(pid1, pid3));
|
||||||
|
|
||||||
|
params = new SearchParameterMap();
|
||||||
|
params.add(Patient.SP_NAME, new StringParam("FAMILY9999"));
|
||||||
|
params.add(Patient.SP_ORGANIZATION, new ReferenceParam().setMissing(true));
|
||||||
|
assertThat(toUnqualifiedVersionlessIds(myPatientDao.search(params)), empty());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchByIdParamOr() {
|
public void testSearchByIdParamOr() {
|
||||||
IIdType id1;
|
IIdType id1;
|
||||||
|
@ -1290,6 +1344,23 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
patient.addName().addFamily("Tester").addGiven("testSearchTokenParam2");
|
patient.addName().addFamily("Tester").addGiven("testSearchTokenParam2");
|
||||||
myPatientDao.create(patient, new ServletRequestDetails());
|
myPatientDao.create(patient, new ServletRequestDetails());
|
||||||
|
|
||||||
|
{
|
||||||
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
|
map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamCode", true));
|
||||||
|
assertEquals(0, myPatientDao.search(map).size());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
|
map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamCode", true));
|
||||||
|
map.add(Patient.SP_IDENTIFIER, new IdentifierDt("urn:system", "testSearchTokenParam001"));
|
||||||
|
assertEquals(0, myPatientDao.search(map).size());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
|
map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamComText", true));
|
||||||
|
map.add(Patient.SP_IDENTIFIER, new IdentifierDt("urn:system", "testSearchTokenParam001"));
|
||||||
|
assertEquals(1, myPatientDao.search(map).size());
|
||||||
|
}
|
||||||
{
|
{
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
map.add(Patient.SP_IDENTIFIER, new IdentifierDt("urn:system", "testSearchTokenParam001"));
|
map.add(Patient.SP_IDENTIFIER, new IdentifierDt("urn:system", "testSearchTokenParam001"));
|
||||||
|
@ -1307,11 +1378,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
map.add(Patient.SP_LANGUAGE, new IdentifierDt("testSearchTokenParamSystem", "testSearchTokenParamCode"));
|
map.add(Patient.SP_LANGUAGE, new IdentifierDt("testSearchTokenParamSystem", "testSearchTokenParamCode"));
|
||||||
assertEquals(1, myPatientDao.search(map).size());
|
assertEquals(1, myPatientDao.search(map).size());
|
||||||
}
|
}
|
||||||
{
|
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
|
||||||
map.add(Patient.SP_LANGUAGE, new TokenParam(null, "testSearchTokenParamCode", true));
|
|
||||||
assertEquals(0, myPatientDao.search(map).size());
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
// Complete match
|
// Complete match
|
||||||
SearchParameterMap map = new SearchParameterMap();
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
|
@ -1896,15 +1962,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
notMissing = myPatientDao.create(patient, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
notMissing = myPatientDao.create(patient, new ServletRequestDetails()).getId().toUnqualifiedVersionless();
|
||||||
}
|
}
|
||||||
// String Param
|
// String Param
|
||||||
{
|
|
||||||
HashMap<String, IQueryParameterType> params = new HashMap<String, IQueryParameterType>();
|
|
||||||
StringParam param = new StringParam();
|
|
||||||
param.setMissing(false);
|
|
||||||
params.put(Patient.SP_FAMILY, param);
|
|
||||||
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
|
||||||
assertThat(patients, not(containsInRelativeOrder(missing)));
|
|
||||||
assertThat(patients, containsInRelativeOrder(notMissing));
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
Map<String, IQueryParameterType> params = new HashMap<String, IQueryParameterType>();
|
Map<String, IQueryParameterType> params = new HashMap<String, IQueryParameterType>();
|
||||||
StringParam param = new StringParam();
|
StringParam param = new StringParam();
|
||||||
|
@ -1914,8 +1971,47 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
|
||||||
assertThat(patients, containsInRelativeOrder(missing));
|
assertThat(patients, containsInRelativeOrder(missing));
|
||||||
assertThat(patients, not(containsInRelativeOrder(notMissing)));
|
assertThat(patients, not(containsInRelativeOrder(notMissing)));
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
HashMap<String, IQueryParameterType> params = new HashMap<String, IQueryParameterType>();
|
||||||
|
StringParam param = new StringParam();
|
||||||
|
param.setMissing(false);
|
||||||
|
params.put(Patient.SP_FAMILY, param);
|
||||||
|
List<IIdType> patients = toUnqualifiedVersionlessIds(myPatientDao.search(params));
|
||||||
|
assertThat(patients, not(containsInRelativeOrder(missing)));
|
||||||
|
assertThat(patients, containsInRelativeOrder(notMissing));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* See #310
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
@Ignore
|
||||||
|
public void testSearchMultiMatches() {
|
||||||
|
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
Practitioner p = new Practitioner();
|
||||||
|
p.addAddress().addLine("FOO");
|
||||||
|
IIdType pid = myPractitionerDao.create(p, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
Patient pt = new Patient();
|
||||||
|
pt.addCareProvider().setReference(pid);
|
||||||
|
IIdType ptid = myPatientDao.create(pt, mySrd).getId().toUnqualifiedVersionless();
|
||||||
|
|
||||||
|
Observation obs = new Observation();
|
||||||
|
obs.setSubject(new ResourceReferenceDt(ptid));
|
||||||
|
myObservationDao.create(obs, mySrd);
|
||||||
|
}
|
||||||
|
|
||||||
|
SearchParameterMap map = new SearchParameterMap();
|
||||||
|
map.addInclude(new Include("Patient:careprovider"));
|
||||||
|
map.addRevInclude(new Include("Observation:patient"));
|
||||||
|
|
||||||
|
myPatientDao.search(map);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSearchWithNoResults() {
|
public void testSearchWithNoResults() {
|
||||||
Device dev = new Device();
|
Device dev = new Device();
|
||||||
|
|
|
@ -2186,7 +2186,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
|
||||||
map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
|
map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
|
||||||
map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
|
map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
|
||||||
IBundleProvider resultsP = myOrganizationDao.search(map);
|
IBundleProvider resultsP = myOrganizationDao.search(map);
|
||||||
assertEquals(2, resultsP.size());
|
assertEquals(1, resultsP.size());
|
||||||
|
|
||||||
List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
|
List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
|
@ -2250,7 +2250,7 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
|
||||||
map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
|
map.add(Organization.SP_NAME, new StringParam("X" + methodName + "X"));
|
||||||
map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
|
map.setRevIncludes(Collections.singleton(Patient.INCLUDE_ORGANIZATION));
|
||||||
IBundleProvider resultsP = myOrganizationDao.search(map);
|
IBundleProvider resultsP = myOrganizationDao.search(map);
|
||||||
assertEquals(2, resultsP.size());
|
assertEquals(1, resultsP.size());
|
||||||
|
|
||||||
List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
|
List<IBaseResource> results = resultsP.getResources(0, resultsP.size());
|
||||||
assertEquals(2, results.size());
|
assertEquals(2, results.size());
|
||||||
|
|
|
@ -424,7 +424,7 @@ public class IdentifierDt
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Override
|
@Override
|
||||||
public void setMissing(Boolean theMissing) {
|
public IQueryParameterType setMissing(Boolean theMissing) {
|
||||||
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
throw new UnsupportedOperationException("get/setMissing is not supported in StringDt. Use {@link StringParam} instead if you need this functionality");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
9
pom.xml
9
pom.xml
|
@ -846,6 +846,10 @@
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-api</artifactId>
|
<artifactId>maven-scm-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
|
<artifactId>doxia-core</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.doxia</groupId>
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
<artifactId>doxia-module-markdown</artifactId>
|
<artifactId>doxia-module-markdown</artifactId>
|
||||||
|
@ -1263,6 +1267,11 @@
|
||||||
<artifactId>maven-scm-api</artifactId>
|
<artifactId>maven-scm-api</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>1.9.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
|
<artifactId>doxia-core</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven.doxia</groupId>
|
<groupId>org.apache.maven.doxia</groupId>
|
||||||
<artifactId>doxia-module-markdown</artifactId>
|
<artifactId>doxia-module-markdown</artifactId>
|
||||||
|
|
|
@ -32,14 +32,13 @@
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
<![CDATA[
|
||||||
<!-- Syntax Highlighter -->
|
<!-- Syntax Highlighter -->
|
||||||
<!--
|
<script type="text/javascript" src="syntaxhighlighter/shCore.js" />
|
||||||
-->
|
<script type="text/javascript" src="syntaxhighlighter/shBrushJScript.js" />
|
||||||
<script type="text/javascript" src="syntaxhighlighter/shCore.js"></script>
|
<script type="text/javascript" src="syntaxhighlighter/shBrushJava.js" />
|
||||||
<script type="text/javascript" src="syntaxhighlighter/shBrushJScript.js"></script>
|
<script type="text/javascript" src="syntaxhighlighter/shBrushBash.js" />
|
||||||
<script type="text/javascript" src="syntaxhighlighter/shBrushJava.js"></script>
|
<script type="text/javascript" src="syntaxhighlighter/shBrushXml.js" />
|
||||||
<script type="text/javascript" src="syntaxhighlighter/shBrushBash.js"></script>
|
|
||||||
<script type="text/javascript" src="syntaxhighlighter/shBrushXml.js"></script>
|
|
||||||
<link href="syntaxhighlighter/shCore.css" rel="stylesheet" type="text/css" />
|
<link href="syntaxhighlighter/shCore.css" rel="stylesheet" type="text/css" />
|
||||||
<link href="syntaxhighlighter/shThemeDefault.css" rel="stylesheet" type="text/css" />
|
<link href="syntaxhighlighter/shThemeDefault.css" rel="stylesheet" type="text/css" />
|
||||||
|
|
||||||
|
@ -47,12 +46,11 @@
|
||||||
HAPI stylesheet comes after because it overwrites the Syntax Highlighter
|
HAPI stylesheet comes after because it overwrites the Syntax Highlighter
|
||||||
font size
|
font size
|
||||||
-->
|
-->
|
||||||
<!--
|
|
||||||
-->
|
|
||||||
<link rel="shortcut icon" href="http://jamesagnew.github.io/hapi-fhir/images/favicon.png" />
|
<link rel="shortcut icon" href="http://jamesagnew.github.io/hapi-fhir/images/favicon.png" />
|
||||||
<link rel="stylesheet" type="text/css" href="hapi.css" />
|
<link rel="stylesheet" type="text/css" href="hapi.css" />
|
||||||
|
|
||||||
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
|
||||||
|
]]>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<breadcrumbs>
|
<breadcrumbs>
|
||||||
|
|
Loading…
Reference in New Issue