Fix #1352 - Don't fail to create observation with a value type of

SampledData
This commit is contained in:
jamesagnew 2019-06-22 16:43:25 -04:00
parent 3274693576
commit 0fbde2a4e5
4 changed files with 40 additions and 4 deletions

View File

@ -76,6 +76,19 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test {
} }
/**
* See #1352
*/
@Test
public void testCreateWithSampledDataInObservation() {
Observation o = new Observation();
o.setStatus(Observation.ObservationStatus.FINAL);
SampledData sampledData = new SampledData();
sampledData.setData("2 3 4 5 6");
o.setValue(sampledData);
assertTrue(myObservationDao.create(o).getCreated());
}
@Test @Test
public void testCreateWithClientAssignedIdDisallowed() { public void testCreateWithClientAssignedIdDisallowed() {
myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED); myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED);

View File

@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum; import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import com.google.common.annotations.VisibleForTesting; import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRException;
@ -58,6 +59,23 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements ISearchParamExtractor { public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements ISearchParamExtractor {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchParamExtractorR4.class); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchParamExtractorR4.class);
private static final Set<Class<?>> ourIgnoredForSearchDatatypes;
static {
//noinspection unchecked
ourIgnoredForSearchDatatypes = Collections.unmodifiableSet(Sets.newHashSet(
Age.class,
Annotation.class,
Attachment.class,
Count.class,
Distance.class,
Ratio.class,
SampledData.class,
Signature.class,
LocationPositionComponent.class
));
}
@Autowired @Autowired
private org.hl7.fhir.r4.hapi.ctx.IValidationSupport myValidationSupport; private org.hl7.fhir.r4.hapi.ctx.IValidationSupport myValidationSupport;
@ -378,7 +396,7 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
Range nextValue = (Range) nextObject; Range nextValue = (Range) nextObject;
addQuantity(theEntity, retVal, resourceName, nextValue.getLow()); addQuantity(theEntity, retVal, resourceName, nextValue.getLow());
addQuantity(theEntity, retVal, resourceName, nextValue.getHigh()); addQuantity(theEntity, retVal, resourceName, nextValue.getHigh());
} else if (nextObject instanceof LocationPositionComponent) { } else if (ourIgnoredForSearchDatatypes.contains(nextObject.getClass())) {
continue; continue;
} else { } else {
if (!multiType) { if (!multiType) {

View File

@ -127,6 +127,11 @@
should not be populated. This has been corrected. Thanks to GitHub user should not be populated. This has been corrected. Thanks to GitHub user
@gitrust for reporting! @gitrust for reporting!
</action> </action>
<action type="fix" issue="1352">
Creating R4 Observation resources with a value type of SampledData failed in the
JPA server because of an indexing error. Thanks to Brian Reinhold for
reporting!
</action>
</release> </release>
<release version="3.8.0" date="2019-05-30" description="Hippo"> <release version="3.8.0" date="2019-05-30" description="Hippo">
<action type="fix"> <action type="fix">