Fix #139 - ContactPointDt fields don't index in JPA module
This commit is contained in:
parent
1ec742350a
commit
1f51c69126
|
@ -53,6 +53,12 @@ public class PagingPatientProvider implements IResourceProvider {
|
|||
public InstantDt getPublished() {
|
||||
return searchTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer preferredPageSize() {
|
||||
// Typically this method just returns null
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -432,6 +432,13 @@ class SearchParamExtractorDstu2 extends BaseSearchParamExtractor implements ISea
|
|||
}
|
||||
systems.add(nextValue.getSystemElement().getValueAsString());
|
||||
codes.add(nextValue.getValueElement().getValue());
|
||||
} else if (nextObject instanceof ContactPointDt) {
|
||||
ContactPointDt nextValue = (ContactPointDt) nextObject;
|
||||
if (nextValue.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
systems.add(nextValue.getSystemElement().getValueAsString());
|
||||
codes.add(nextValue.getValueElement().getValue());
|
||||
} else if (nextObject instanceof IPrimitiveDatatype<?>) {
|
||||
IPrimitiveDatatype<?> nextValue = (IPrimitiveDatatype<?>) nextObject;
|
||||
if (nextValue.isEmpty()) {
|
||||
|
|
|
@ -715,6 +715,21 @@ public class FhirResourceDaoDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPersistContactPoint() {
|
||||
List<IResource> found = toList(ourPatientDao.search(Patient.SP_TELECOM, new TokenParam(null, "555-123-4567")));
|
||||
int initialSize2000 = found.size();
|
||||
|
||||
Patient patient = new Patient();
|
||||
patient.addIdentifier().setSystem("urn:system").setValue("testPersistContactPoint");
|
||||
patient.addTelecom().setValue("555-123-4567");
|
||||
ourPatientDao.create(patient);
|
||||
|
||||
found = toList(ourPatientDao.search(Patient.SP_TELECOM, new TokenParam(null, "555-123-4567")));
|
||||
assertEquals(1 + initialSize2000, found.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPersistSearchParamDate() {
|
||||
List<Patient> found = toList(ourPatientDao.search(Patient.SP_BIRTHDATE, new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
|
||||
|
|
|
@ -1,11 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.provider;
|
||||
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -15,7 +10,6 @@ import java.util.Date;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -37,13 +31,11 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import ch.qos.logback.core.util.FileUtil;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.BundleEntry;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.dstu.resource.Device;
|
||||
|
@ -66,7 +58,7 @@ import ca.uhn.fhir.model.dstu2.valueset.EncounterClassEnum;
|
|||
import ca.uhn.fhir.model.dstu2.valueset.EncounterStateEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.UnsignedIntDt;
|
||||
import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
||||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
||||
|
@ -392,10 +384,8 @@ public class ResourceProviderDstu2Test {
|
|||
|
||||
assertFalse(ids.toString(), dupes);
|
||||
|
||||
/*
|
||||
* Condition/11 is the 11th resource and the default page size is 10 so we don't show the 11th.
|
||||
*/
|
||||
assertThat(ids.toString(), not(containsString("Condition")));
|
||||
// Default size
|
||||
assertEquals(10, ids.size());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -403,7 +393,7 @@ public class ResourceProviderDstu2Test {
|
|||
*/
|
||||
{
|
||||
Parameters input = new Parameters();
|
||||
input.addParameter().setName(Constants.PARAM_COUNT).setValue(new IntegerDt(100));
|
||||
input.addParameter().setName(Constants.PARAM_COUNT).setValue(new UnsignedIntDt(100));
|
||||
Parameters output = ourClient.operation().onInstance(patientId).named("everything").withParameters(input).execute();
|
||||
b = (ca.uhn.fhir.model.dstu2.resource.Bundle) output.getParameterFirstRep().getResource();
|
||||
|
||||
|
@ -418,7 +408,7 @@ public class ResourceProviderDstu2Test {
|
|||
|
||||
assertFalse(ids.toString(), dupes);
|
||||
assertThat(ids.toString(), containsString("Condition"));
|
||||
|
||||
assertThat(ids.size(), greaterThan(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -122,11 +122,19 @@ public class ${className}ResourceProvider extends JpaResourceProvider${versionCa
|
|||
@Operation(name="everything", idempotent=true)
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(
|
||||
javax.servlet.http.HttpServletRequest theServletRequest,
|
||||
@IdParam ca.uhn.fhir.model.primitive.IdDt theId) {
|
||||
@IdParam ca.uhn.fhir.model.primitive.IdDt theId,
|
||||
|
||||
@Description(formalDefinition="Results from this method are returned across multiple pages. This parameter controls the size of those pages.")
|
||||
@OperationParam(name="_count") ca.uhn.fhir.model.primitive.UnsignedIntDt theCount
|
||||
){
|
||||
|
||||
startRequest(theServletRequest);
|
||||
try {
|
||||
SearchParameterMap paramMap = new SearchParameterMap();
|
||||
if (theCount != null) {
|
||||
paramMap.setCount(theCount.getValue());
|
||||
}
|
||||
|
||||
paramMap.setRevIncludes(Collections.singleton(new Include("*")));
|
||||
paramMap.setIncludes(Collections.singleton(new Include("*")));
|
||||
paramMap.add("_id", new StringParam(theId.getIdPart()));
|
||||
|
|
|
@ -126,6 +126,10 @@
|
|||
<action type="add" issue="148">
|
||||
JPA Server $everything operation now allows a _count parameter
|
||||
</action>
|
||||
<action type="fix" issue="139">
|
||||
JPA server failed to index resources containing ContactPointDt elements with
|
||||
populated values (e.g. Patient.telecom). Thanks to Mohammad Jafari for reporting!
|
||||
</action>
|
||||
</release>
|
||||
<release version="0.9" date="2015-Mar-14">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue