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
public void testCreateWithClientAssignedIdDisallowed() {
myDaoConfig.setResourceClientIdStrategy(DaoConfig.ClientIdStrategyEnum.NOT_ALLOWED);

View File

@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.searchparam.extractor;
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.searchparam.registry.ISearchParamRegistry;
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
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 {
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
private org.hl7.fhir.r4.hapi.ctx.IValidationSupport myValidationSupport;
@ -378,7 +396,7 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements
Range nextValue = (Range) nextObject;
addQuantity(theEntity, retVal, resourceName, nextValue.getLow());
addQuantity(theEntity, retVal, resourceName, nextValue.getHigh());
} else if (nextObject instanceof LocationPositionComponent) {
} else if (ourIgnoredForSearchDatatypes.contains(nextObject.getClass())) {
continue;
} else {
if (!multiType) {

View File

@ -238,7 +238,7 @@ public class Dstu3BundleFactory implements IVersionSpecificBundleFactory {
break;
}
}
// Populate Bundle.entry.search
String searchMode = ResourceMetadataKeyEnum.ENTRY_SEARCH_MODE.get(nextAsResource);
if (searchMode != null) {

View File

@ -127,6 +127,11 @@
should not be populated. This has been corrected. Thanks to GitHub user
@gitrust for reporting!
</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 version="3.8.0" date="2019-05-30" description="Hippo">
<action type="fix">