From e8e49f3ffabd7d1889e1a0f1c2a83b63ff70bba4 Mon Sep 17 00:00:00 2001 From: Michael Buckley Date: Wed, 4 Aug 2021 16:34:48 -0400 Subject: [PATCH 01/49] Pick d85a4e5ec24a27646b86487414e20ea4d36641f4 for release branch --- .../uhn/fhir/jpa/search/builder/SearchBuilder.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java index 7fde597b8e3..10ea71cc4d5 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/builder/SearchBuilder.java @@ -1056,7 +1056,13 @@ public class SearchBuilder implements ISearchBuilder { for (String nextParamName : comboParamNames) { List> nextValues = theParams.get(nextParamName); - nextParamName = UrlUtil.escapeUrlParam(nextParamName); + // TODO Hack to fix weird IOOB on the next stanza until James comes back and makes sense of this. + if (nextValues.isEmpty()) { + ourLog.error("query parameter {} is unexpectedly empty. Encountered while considering {} index for {}", nextParamName, comboParam.getName(), theRequest.getCompleteUrl()); + sb = null; + break; + } + if (nextValues.get(0).size() != 1) { sb = null; break; @@ -1083,14 +1089,15 @@ public class SearchBuilder implements ISearchBuilder { } } - nextOrValue = UrlUtil.escapeUrlParam(nextOrValue); - if (first) { first = false; } else { sb.append('&'); } + nextParamName = UrlUtil.escapeUrlParam(nextParamName); + nextOrValue = UrlUtil.escapeUrlParam(nextOrValue); + sb.append(nextParamName).append('=').append(nextOrValue); } From 0a303a0e11b09e78734abd4d65fff5b2c77c9f50 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Fri, 6 Aug 2021 13:22:08 -0400 Subject: [PATCH 02/49] Add MDM expansion by golden pid --- .../java/ca/uhn/fhir/util/VersionEnum.java | 1 + .../5_5_0/2871-enhance-mdm-expansion.yaml | 5 +++ .../ca/uhn/fhir/jpa/dao/data/IMdmLinkDao.java | 3 ++ .../fhir/jpa/dao/mdm/MdmLinkExpandSvc.java | 44 ++++++++++++++++--- .../MdmSearchExpandingInterceptor.java | 10 ++++- .../MdmSearchExpandingInterceptorIT.java | 19 ++++++++ 6 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2871-enhance-mdm-expansion.yaml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionEnum.java index 8a730a842e8..207b072cc96 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/VersionEnum.java @@ -75,6 +75,7 @@ public enum VersionEnum { V5_4_1, V5_4_2, V5_5_0, + ; public static VersionEnum latestVersion() { diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2871-enhance-mdm-expansion.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2871-enhance-mdm-expansion.yaml new file mode 100644 index 00000000000..f0f427f2b01 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2871-enhance-mdm-expansion.yaml @@ -0,0 +1,5 @@ +--- +type: add +issue: 2871 +title: "Modified the behaviour of the `:mdm` param qualifier. Previously, it used to only resolve IDs if the resource ID was a source resource. +Now, MDM expansion will work if you pass it the ID of a golden resource instead." diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IMdmLinkDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IMdmLinkDao.java index 16834facbe2..969ea3926ca 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IMdmLinkDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/data/IMdmLinkDao.java @@ -67,4 +67,7 @@ public interface IMdmLinkDao extends JpaRepository { "AND ml.myMatchResult=:matchResult") List expandPidsBySourcePidAndMatchResult(@Param("sourcePid") Long theSourcePid, @Param("matchResult") MdmMatchResultEnum theMdmMatchResultEnum); + @Query("SELECT ml.myGoldenResourcePid as goldenPid, ml.mySourcePid as sourcePid FROM MdmLink ml WHERE ml.myGoldenResourcePid = :goldenPid and ml.myMatchResult = :matchResult") + List expandPidsByGoldenResourcePidAndMatchResult(@Param("goldenPid") Long theSourcePid, @Param("matchResult") MdmMatchResultEnum theMdmMatchResultEnum); + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkExpandSvc.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkExpandSvc.java index 66af7f5a706..4a28be40c5a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkExpandSvc.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/mdm/MdmLinkExpandSvc.java @@ -25,15 +25,13 @@ import ca.uhn.fhir.jpa.dao.index.IdHelperService; import ca.uhn.fhir.mdm.api.MdmMatchResultEnum; import ca.uhn.fhir.mdm.log.Logs; import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.ArrayList; +import javax.annotation.Nonnull; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -82,14 +80,50 @@ public class MdmLinkExpandSvc { public Set expandMdmBySourceResourcePid(Long theSourceResourcePid) { ourLog.debug("About to expand source resource with PID {}", theSourceResourcePid); List goldenPidSourcePidTuples = myMdmLinkDao.expandPidsBySourcePidAndMatchResult(theSourceResourcePid, MdmMatchResultEnum.MATCH); + return flattenPidTuplesToSet(theSourceResourcePid, goldenPidSourcePidTuples); + } + + /** + * Given a PID of a golden resource, perform MDM expansion and return all the resource IDs of all resources that are + * MDM-Matched to this golden resource. + * + * @param theGoldenResourcePid The PID of the golden resource to MDM-Expand. + * @return A set of strings representing the FHIR ids of the expanded resources. + */ + public Set expandMdmByGoldenResourceId(Long theGoldenResourcePid) { + ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid); + List goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH); + return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples); + } + + + /** + * Given a resource ID of a golden resource, perform MDM expansion and return all the resource IDs of all resources that are + * MDM-Matched to this golden resource. + * + * @param theGoldenResourcePid The resource ID of the golden resource to MDM-Expand. + * @return A set of strings representing the FHIR ids of the expanded resources. + */ + public Set expandMdmByGoldenResourcePid(Long theGoldenResourcePid) { + ourLog.debug("About to expand golden resource with PID {}", theGoldenResourcePid); + List goldenPidSourcePidTuples = myMdmLinkDao.expandPidsByGoldenResourcePidAndMatchResult(theGoldenResourcePid, MdmMatchResultEnum.MATCH); + return flattenPidTuplesToSet(theGoldenResourcePid, goldenPidSourcePidTuples); + } + public Set expandMdmByGoldenResourceId(IdDt theId) { + ourLog.debug("About to expand golden resource with golden resource id {}", theId); + Long pidOrThrowException = myIdHelperService.getPidOrThrowException(theId); + return expandMdmByGoldenResourcePid(pidOrThrowException); + } + + @Nonnull + private Set flattenPidTuplesToSet(Long initialPid, List goldenPidSourcePidTuples) { Set flattenedPids = new HashSet<>(); goldenPidSourcePidTuples.forEach(tuple -> { flattenedPids.add(tuple.getSourcePid()); flattenedPids.add(tuple.getGoldenPid()); }); Set resourceIds = myIdHelperService.translatePidsToFhirResourceIds(flattenedPids); - ourLog.debug("Pid {} has been expanded to [{}]", theSourceResourcePid, String.join(",", resourceIds)); + ourLog.debug("Pid {} has been expanded to [{}]", initialPid, String.join(",", resourceIds)); return resourceIds; } - } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/interceptor/MdmSearchExpandingInterceptor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/interceptor/MdmSearchExpandingInterceptor.java index 4516e342a14..1ec7b3593c9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/interceptor/MdmSearchExpandingInterceptor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/interceptor/MdmSearchExpandingInterceptor.java @@ -76,8 +76,16 @@ public class MdmSearchExpandingInterceptor { if (iQueryParameterType instanceof ReferenceParam) { ReferenceParam refParam = (ReferenceParam) iQueryParameterType; if (refParam.isMdmExpand()) { - ourLog.debug("Found a reference parameter to expand: {}", refParam.toString()); + ourLog.debug("Found a reference parameter to expand: {}", refParam); + //First, attempt to expand as a source resource. Set expandedResourceIds = myMdmLinkExpandSvc.expandMdmBySourceResourceId(new IdDt(refParam.getValue())); + + // If we failed, attempt to expand as a golden resource + if (expandedResourceIds.isEmpty()) { + expandedResourceIds = myMdmLinkExpandSvc.expandMdmByGoldenResourceId(new IdDt(refParam.getValue())); + } + + //Rebuild the search param list. if (!expandedResourceIds.isEmpty()) { ourLog.debug("Parameter has been expanded to: {}", String.join(", ", expandedResourceIds)); toRemove.add(refParam); diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java index 58d3abf4afa..2c1d2a40bad 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/interceptor/MdmSearchExpandingInterceptorIT.java @@ -2,14 +2,18 @@ package ca.uhn.fhir.jpa.mdm.interceptor; import ca.uhn.fhir.jpa.api.config.DaoConfig; import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; +import ca.uhn.fhir.jpa.entity.MdmLink; import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test; import ca.uhn.fhir.jpa.mdm.helper.MdmHelperConfig; import ca.uhn.fhir.jpa.mdm.helper.MdmHelperR4; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.mdm.api.MdmConstants; import ca.uhn.fhir.rest.api.server.IBundleProvider; +import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.param.ReferenceOrListParam; import ca.uhn.fhir.rest.param.ReferenceParam; +import org.elasticsearch.common.collect.Set; +import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r4.model.CodeableConcept; import org.hl7.fhir.r4.model.Observation; import org.hl7.fhir.r4.model.Patient; @@ -21,6 +25,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; +import java.util.List; + import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; @@ -73,6 +79,19 @@ public class MdmSearchExpandingInterceptorIT extends BaseMdmR4Test { myDaoConfig.setAllowMdmExpansion(true); search = myObservationDao.search(searchParameterMap); assertThat(search.size(), is(equalTo(4))); + List all = myMdmLinkDao.findAll(); + Long goldenPid = all.get(0).getGoldenResourcePid(); + IIdType goldenId = myIdHelperService.translatePidIdToForcedId(myFhirContext, "Patient", new ResourcePersistentId(goldenPid)); + //Verify that expansion by the golden resource id resolves down to everything its links have. + + SearchParameterMap goldenSpMap = new SearchParameterMap(); + goldenSpMap.setLoadSynchronous(true); + ReferenceOrListParam goldenReferenceOrListParam = new ReferenceOrListParam(); + goldenReferenceOrListParam.addOr(new ReferenceParam(goldenId).setMdmExpand(true)); + goldenSpMap.add(Observation.SP_SUBJECT, goldenReferenceOrListParam); + + search = myObservationDao.search(goldenSpMap); + assertThat(search.size(), is(equalTo(4))); } @Test From 966e451587ed7dd2a027501bcb4a675da8255a49 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 9 Aug 2021 16:19:38 -0400 Subject: [PATCH 03/49] Backport fix --- .../5_5_0/2876-resource-util-npe.yaml | 6 +++++ .../ca/uhn/fhir/mdm/util/MdmResourceUtil.java | 12 +++++----- .../fhir/mdm/util/MdmResourceUtilTest.java | 23 +++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml create mode 100644 hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/util/MdmResourceUtilTest.java diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml new file mode 100644 index 00000000000..f3f70459e0c --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml @@ -0,0 +1,6 @@ +--- +type: fix +issue: 2876 +jira: SMILE-1006 +backport: 5.5.0 +title: "Fixed a bug wherein an NPE could be thrown by the MDM module interceptor if an incoming resourcee had a tag with no system." diff --git a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/util/MdmResourceUtil.java b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/util/MdmResourceUtil.java index 8b8717e1bee..b2866f46370 100644 --- a/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/util/MdmResourceUtil.java +++ b/hapi-fhir-server-mdm/src/main/java/ca/uhn/fhir/mdm/util/MdmResourceUtil.java @@ -76,19 +76,19 @@ public final class MdmResourceUtil { return theBaseResource.getMeta().getTag(theSystem, theCode) != null; } - private static boolean resourceHasTagWithSystem(IBaseResource theBaseResource, String theSystem) { + private static boolean resourceHasTagWithSystem(IBaseResource theBaseResource, @Nonnull String theSystem) { if (theBaseResource == null) { return false; } - return theBaseResource.getMeta().getTag().stream().anyMatch(tag -> tag.getSystem().equalsIgnoreCase(theSystem)); + return theBaseResource.getMeta().getTag().stream().anyMatch(tag -> theSystem.equalsIgnoreCase(tag.getSystem())); } - private static Optional getTagWithSystem(IBaseResource theResource, String theSystem) { - return theResource.getMeta().getTag().stream().filter(tag -> tag.getSystem().equalsIgnoreCase(theSystem)).findFirst(); + private static Optional getTagWithSystem(IBaseResource theResource, @Nonnull String theSystem) { + return theResource.getMeta().getTag().stream().filter(tag -> theSystem.equalsIgnoreCase(tag.getSystem())).findFirst(); } - public static void removeTagWithSystem(IBaseResource theResource, String theSystem) { - theResource.getMeta().getTag().removeIf(tag -> tag.getSystem().equalsIgnoreCase(theSystem)); + public static void removeTagWithSystem(IBaseResource theResource, @Nonnull String theSystem) { + theResource.getMeta().getTag().removeIf(tag -> theSystem.equalsIgnoreCase(tag.getSystem())); } /** diff --git a/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/util/MdmResourceUtilTest.java b/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/util/MdmResourceUtilTest.java new file mode 100644 index 00000000000..8b128896f1d --- /dev/null +++ b/hapi-fhir-server-mdm/src/test/java/ca/uhn/fhir/mdm/util/MdmResourceUtilTest.java @@ -0,0 +1,23 @@ +package ca.uhn.fhir.mdm.util; + +import org.hl7.fhir.r4.model.Organization; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; + +class MdmResourceUtilTest { + + //See https://github.com/hapifhir/hapi-fhir/issues/2876 + @Test + public void testNoNpeOnTagWithNoSystem() { + //Given + Organization organization = new Organization(); + organization.getMeta().addTag(null, "Some Code", "Some Display"); + + boolean hasGoldenRecordTag = MdmResourceUtil.hasGoldenRecordSystemTag(organization); + + assertThat(hasGoldenRecordTag, is(equalTo(false))); + } +} From 2d203302daeb99db0bdcd1184c0d44889c7635c8 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 9 Aug 2021 16:20:46 -0400 Subject: [PATCH 04/49] Remove changelog as it will eventually create a duplicate --- .../hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml deleted file mode 100644 index f3f70459e0c..00000000000 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2876-resource-util-npe.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -type: fix -issue: 2876 -jira: SMILE-1006 -backport: 5.5.0 -title: "Fixed a bug wherein an NPE could be thrown by the MDM module interceptor if an incoming resourcee had a tag with no system." From 4c154951e2b9768f559dab824ed464aaa3c5de26 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 5 Aug 2021 11:52:17 -0400 Subject: [PATCH 05/49] Fully fleshed test, partial refactor --- .../jpa/dao/BaseTransactionProcessor.java | 1 + .../fhir/jpa/dao/TransactionProcessor.java | 94 ++++++++++++------- .../src/test/resources/logback-test.xml | 2 +- 3 files changed, 64 insertions(+), 33 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index 29c993d2109..4a961a979a8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -1125,6 +1125,7 @@ public abstract class BaseTransactionProcessor { IIdType targetId = resourceReference.getResource().getIdElement(); if (targetId.getValue() == null || targetId.getValue().startsWith("#")) { // This means it's a contained resource + ourLog.error("THIS THING ISN'T CONTAINED! WHY IS IT CONTAINED!!! "); continue; } else if (theIdSubstitutions.containsValue(targetId)) { newId = targetId; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java index 45c04b47be7..95a9f9d78b8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java @@ -41,11 +41,13 @@ import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.util.StopWatch; import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.Validate; +import org.apache.jena.ext.com.google.common.base.Optional; import org.hibernate.internal.SessionImpl; import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; +import org.jetbrains.annotations.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -61,6 +63,7 @@ import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.List; @@ -218,18 +221,10 @@ public class TransactionProcessor extends BaseTransactionProcessor { IQueryParameterType param = andList.get(0).get(0); if (param instanceof TokenParam) { - TokenParam tokenParam = (TokenParam) param; - Predicate hashPredicate = null; - if (isNotBlank(tokenParam.getValue()) && isNotBlank(tokenParam.getSystem())) { - next.myHashSystemAndValue = ResourceIndexedSearchParamToken.calculateHashSystemAndValue(myPartitionSettings, requestPartitionId, next.myResourceDefinition.getName(), next.myMatchUrlSearchMap.keySet().iterator().next(), tokenParam.getSystem(), tokenParam.getValue()); - hashPredicate = cb.equal(from.get("myHashSystemAndValue").as(Long.class), next.myHashSystemAndValue); - } else if (isNotBlank(tokenParam.getValue())) { - next.myHashValue = ResourceIndexedSearchParamToken.calculateHashValue(myPartitionSettings, requestPartitionId, next.myResourceDefinition.getName(), next.myMatchUrlSearchMap.keySet().iterator().next(), tokenParam.getValue()); - hashPredicate = cb.equal(from.get("myHashValue").as(Long.class), next.myHashValue); - } + Predicate hashPredicate = buildHashPredicateFromTokenParam((TokenParam)param, requestPartitionId, cb, from, next); + //Some partition witchcraft if (hashPredicate != null) { - if (myPartitionSettings.isPartitioningEnabled() && !myPartitionSettings.isIncludePartitionInSearchHashes()) { if (requestPartitionId.isDefaultPartition()) { Predicate partitionIdCriteria = cb.isNull(from.get("myPartitionIdValue").as(Integer.class)); @@ -250,35 +245,28 @@ public class TransactionProcessor extends BaseTransactionProcessor { if (orPredicates.size() > 1) { cq.where(cb.or(orPredicates.toArray(EMPTY_PREDICATE_ARRAY))); + Map hashToSearchMap = buildHashToSearchMap(searchParameterMapsToResolve); + TypedQuery query = myEntityManager.createQuery(cq); List results = query.getResultList(); + for (ResourceIndexedSearchParamToken nextResult : results) { + Optional matchedSearch = Optional + .fromNullable(hashToSearchMap.get(nextResult.getHashSystemAndValue())) + .or(Optional.fromNullable(hashToSearchMap.get(nextResult.getHashValue()))); - for (MatchUrlToResolve nextSearchParameterMap : searchParameterMapsToResolve) { - if (nextSearchParameterMap.myHashSystemAndValue != null && nextSearchParameterMap.myHashSystemAndValue.equals(nextResult.getHashSystemAndValue())) { - idsToPreFetch.add(nextResult.getResourcePid()); - myMatchResourceUrlService.matchUrlResolved(theTransactionDetails, nextSearchParameterMap.myResourceDefinition.getName(), nextSearchParameterMap.myRequestUrl, new ResourcePersistentId(nextResult.getResourcePid())); - theTransactionDetails.addResolvedMatchUrl(nextSearchParameterMap.myRequestUrl, new ResourcePersistentId(nextResult.getResourcePid())); - nextSearchParameterMap.myResolved = true; - } - if (nextSearchParameterMap.myHashValue != null && nextSearchParameterMap.myHashValue.equals(nextResult.getHashValue())) { - idsToPreFetch.add(nextResult.getResourcePid()); - myMatchResourceUrlService.matchUrlResolved(theTransactionDetails, nextSearchParameterMap.myResourceDefinition.getName(), nextSearchParameterMap.myRequestUrl, new ResourcePersistentId(nextResult.getResourcePid())); - theTransactionDetails.addResolvedMatchUrl(nextSearchParameterMap.myRequestUrl, new ResourcePersistentId(nextResult.getResourcePid())); - nextSearchParameterMap.myResolved = true; - } - + if (matchedSearch.isPresent()) { + setSearchToResolvedAndPrefetchFoundResourcePid(theTransactionDetails, idsToPreFetch, nextResult, matchedSearch.get()); } - } - - for (MatchUrlToResolve nextSearchParameterMap : searchParameterMapsToResolve) { + //For each SP Map which did not return a result, tag it as not found. + searchParameterMapsToResolve.stream() // No matches - if (!nextSearchParameterMap.myResolved) { - theTransactionDetails.addResolvedMatchUrl(nextSearchParameterMap.myRequestUrl, TransactionDetails.NOT_FOUND); - } - } - + .filter(match -> !match.myResolved) + .forEach(match -> { + ourLog.warn("Was unable to match url {} from database", match.myRequestUrl); + theTransactionDetails.addResolvedMatchUrl(match.myRequestUrl, TransactionDetails.NOT_FOUND); + }); } } @@ -320,6 +308,45 @@ public class TransactionProcessor extends BaseTransactionProcessor { return super.doTransactionWriteOperations(theRequest, theActionName, theTransactionDetails, theAllIds, theIdSubstitutions, theIdToPersistedOutcome, theResponse, theOriginalRequestOrder, theEntries, theTransactionStopWatch); } + /** + * Given a token parameter, build the query predicate based on its hash. Uses system and value if both are available, otherwise just value. + * If neither are available, it returns null. + */ + @Nullable + private Predicate buildHashPredicateFromTokenParam(TokenParam theTokenParam, RequestPartitionId theRequestPartitionId, CriteriaBuilder cb, Root from, MatchUrlToResolve theMatchUrl) { + Predicate hashPredicate = null; + if (isNotBlank(theTokenParam.getValue()) && isNotBlank(theTokenParam.getSystem())) { + theMatchUrl.myHashSystemAndValue = ResourceIndexedSearchParamToken.calculateHashSystemAndValue(myPartitionSettings, theRequestPartitionId, theMatchUrl.myResourceDefinition.getName(), theMatchUrl.myMatchUrlSearchMap.keySet().iterator().next(), theTokenParam.getSystem(), theTokenParam.getValue()); + hashPredicate = cb.equal(from.get("myHashSystemAndValue").as(Long.class), theMatchUrl.myHashSystemAndValue); + } else if (isNotBlank(theTokenParam.getValue())) { + theMatchUrl.myHashValue = ResourceIndexedSearchParamToken.calculateHashValue(myPartitionSettings, theRequestPartitionId, theMatchUrl.myResourceDefinition.getName(), theMatchUrl.myMatchUrlSearchMap.keySet().iterator().next(), theTokenParam.getValue()); + hashPredicate = cb.equal(from.get("myHashValue").as(Long.class), theMatchUrl.myHashValue); + } + return hashPredicate; + } + + private Map buildHashToSearchMap(List searchParameterMapsToResolve) { + Map hashToSearch = new HashMap<>(); + //Build a lookup map so we don't have to iterate over the searches repeatedly. + for (MatchUrlToResolve nextSearchParameterMap : searchParameterMapsToResolve) { + if (nextSearchParameterMap.myHashSystemAndValue != null) { + hashToSearch.put(nextSearchParameterMap.myHashSystemAndValue, nextSearchParameterMap); + } + if (nextSearchParameterMap.myHashValue!= null) { + hashToSearch.put(nextSearchParameterMap.myHashValue, nextSearchParameterMap); + } + } + return hashToSearch; + } + + private void setSearchToResolvedAndPrefetchFoundResourcePid(TransactionDetails theTransactionDetails, List idsToPreFetch, ResourceIndexedSearchParamToken nextResult, MatchUrlToResolve nextSearchParameterMap) { + ourLog.warn("Matched url {} from database", nextSearchParameterMap.myRequestUrl); + idsToPreFetch.add(nextResult.getResourcePid()); + myMatchResourceUrlService.matchUrlResolved(theTransactionDetails, nextSearchParameterMap.myResourceDefinition.getName(), nextSearchParameterMap.myRequestUrl, new ResourcePersistentId(nextResult.getResourcePid())); + theTransactionDetails.addResolvedMatchUrl(nextSearchParameterMap.myRequestUrl, new ResourcePersistentId(nextResult.getResourcePid())); + nextSearchParameterMap.setResolved(true); + } + private List preFetchIndexes(List ids, String typeDesc, String fieldName) { TypedQuery query = myEntityManager.createQuery("FROM ResourceTable r LEFT JOIN FETCH r." + fieldName + " WHERE r.myId IN ( :IDS )", ResourceTable.class); query.setParameter("IDS", ids); @@ -379,5 +406,8 @@ public class TransactionProcessor extends BaseTransactionProcessor { myMatchUrlSearchMap = theMatchUrlSearchMap; myResourceDefinition = theResourceDefinition; } + public void setResolved(boolean theResolved) { + myResolved = theResolved; + } } } diff --git a/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml b/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml index ac75e0d04be..36a83af6599 100644 --- a/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml +++ b/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml @@ -42,7 +42,7 @@ - + From 35afa8bbfaaa27a6d8fc316c12b5110daf207952 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 5 Aug 2021 14:46:18 -0400 Subject: [PATCH 06/49] tidy --- .../ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index 4a961a979a8..7668b1ffae3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -1010,13 +1010,9 @@ public abstract class BaseTransactionProcessor { for (IIdType next : theAllIds) { IIdType replacement = theIdSubstitutions.get(next); - if (replacement == null) { - continue; + if (replacement != null && replacement.equals(next)) { + ourLog.debug("Placeholder resource ID \"{}\" was replaced with permanent ID \"{}\"", next, replacement); } - if (replacement.equals(next)) { - continue; - } - ourLog.debug("Placeholder resource ID \"{}\" was replaced with permanent ID \"{}\"", next, replacement); } ListMultimap deferredBroadcastEvents = theTransactionDetails.endAcceptingDeferredInterceptorBroadcasts(); From 8f200c181969ed37a6b90d7323662931a61d6b0c Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 5 Aug 2021 19:01:12 -0400 Subject: [PATCH 07/49] Add a failing test --- .../jpa/dao/BaseTransactionProcessor.java | 3 +- .../fhir/jpa/dao/r4/FhirSystemDaoR4Test.java | 34 ++++++++++--- .../r4/transaction-no-contained-2.json | 49 +++++++++++++++++++ .../r4/transaction-no-contained.json | 4 +- 4 files changed, 80 insertions(+), 10 deletions(-) create mode 100644 hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained-2.json diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index 7668b1ffae3..36551277b6d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -89,6 +89,7 @@ import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; +import org.hl7.fhir.r4.model.Task; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -864,6 +865,7 @@ public abstract class BaseTransactionProcessor { matchUrl = parts.getResourceType(); } matchUrl = performIdSubstitutionsInMatchUrl(theIdSubstitutions, matchUrl); + //TODO FIXME GGG This update call comes back with a contained resource. outcome = resourceDao.update(res, matchUrl, false, false, theRequest, theTransactionDetails); if (Boolean.TRUE.equals(outcome.getCreated())) { conditionalRequestUrls.put(matchUrl, res.getClass()); @@ -1095,7 +1097,6 @@ public abstract class BaseTransactionProcessor { } deferredIndexesForAutoVersioning.put(nextOutcome, referencesToAutoVersion); } - } // If we have any resources we'll be auto-versioning, index these next diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java index 7c753d06320..5be6e35474a 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java @@ -1,6 +1,7 @@ package ca.uhn.fhir.jpa.dao.r4; import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; import ca.uhn.fhir.jpa.dao.BaseHapiFhirDao; import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; import ca.uhn.fhir.jpa.model.entity.ResourceEncodingEnum; @@ -63,6 +64,7 @@ import org.hl7.fhir.r4.model.Practitioner; import org.hl7.fhir.r4.model.Quantity; import org.hl7.fhir.r4.model.Reference; import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.Task; import org.hl7.fhir.r4.model.ValueSet; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -1002,23 +1004,41 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { } + @Test + public void testTransactionNoContainedRedux() throws IOException { + //Pre-create the patient, which will cause the ifNoneExist to prevent a new creation during bundle transaction + Patient patient = loadResourceFromClasspath(Patient.class, "/r4/preexisting-patient.json"); + myPatientDao.create(patient); + + //Post the Bundle containing a conditional POST with an identical patient from the above resource. + Bundle request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained-2.json"); + Bundle outcome = mySystemDao.transaction(mySrd, request); + IdType taskId = new IdType(outcome.getEntry().get(0).getResponse().getLocation()); + Task task = myTaskDao.read(taskId, mySrd); + + assertThat(task.getBasedOn().get(0).getReference(), matchesPattern("Patient/[0-9]+")); + } + @Test public void testTransactionNoContained() throws IOException { // Run once (should create the patient) Bundle request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained.json"); - mySystemDao.transaction(mySrd, request); - - // Run a second time (no conditional update) - request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained.json"); Bundle outcome = mySystemDao.transaction(mySrd, request); - - ourLog.info("Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome)); - IdType communicationId = new IdType(outcome.getEntry().get(1).getResponse().getLocation()); Communication communication = myCommunicationDao.read(communicationId, mySrd); assertThat(communication.getSubject().getReference(), matchesPattern("Patient/[0-9]+")); + // Run a second time (no conditional update) + request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained.json"); + outcome = mySystemDao.transaction(mySrd, request); + + ourLog.info("Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome)); + +// IdType communicationId = new IdType(outcome.getEntry().get(1).getResponse().getLocation()); +// Communication communication = myCommunicationDao.read(communicationId, mySrd); +// assertThat(communication.getSubject().getReference(), matchesPattern("Patient/[0-9]+")); + ourLog.info("Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(communication)); } diff --git a/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained-2.json b/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained-2.json new file mode 100644 index 00000000000..675ff990be5 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained-2.json @@ -0,0 +1,49 @@ +{ + "resourceType": "Bundle", + "type": "transaction", + "entry": [ + { + "fullUrl": "urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb", + "resource": { + "resourceType": "Task", + "language": "en-US", + "identifier": [ + { + "system": "https://example.org/fhir/taskidentifier", + "value": "101019" + } + ], + "basedOn": [ + { + "reference": "urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced" + } + ] + }, + "request": { + "method": "PUT", + "url": "/Task?identifier\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019" + } + }, + { + "fullUrl": "urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced", + "resource": { + "resourceType": "Patient", + "identifier": [ + { + "system": "https://example.org/fhir/memberidentifier", + "value": "12345670" + }, + { + "system": "https://example.org/fhir/memberuniqueidentifier", + "value": "12345670TT" + } + ] + }, + "request": { + "method": "POST", + "url": "/Patient", + "ifNoneExist": "Patient?identifier\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT" + } + } + ] +} diff --git a/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json b/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json index 263cca4691e..880327e4cdc 100644 --- a/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json +++ b/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json @@ -250,8 +250,8 @@ ] }, "request": { - "method": "POST", - "url": "Communication" + "method": "PUT", + "url": "Communication?identifier=https://example.com|zoop" } } ] From e402804049d4aa735da29496a6b09c1155859ea6 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 5 Aug 2021 19:01:22 -0400 Subject: [PATCH 08/49] Add test json files --- .../src/test/resources/r4/preexisting-patient.json | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 hapi-fhir-jpaserver-base/src/test/resources/r4/preexisting-patient.json diff --git a/hapi-fhir-jpaserver-base/src/test/resources/r4/preexisting-patient.json b/hapi-fhir-jpaserver-base/src/test/resources/r4/preexisting-patient.json new file mode 100644 index 00000000000..1e8c519707c --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/resources/r4/preexisting-patient.json @@ -0,0 +1,13 @@ +{ + "resourceType": "Patient", + "identifier": [ + { + "system": "https://example.org/fhir/memberidentifier", + "value": "12345670" + }, + { + "system": "https://example.org/fhir/memberuniqueidentifier", + "value": "12345670TT" + } + ] +} From 2f42391ba818fa3be9815f50159178e9b5eafa5d Mon Sep 17 00:00:00 2001 From: Tadgh Date: Fri, 6 Aug 2021 11:30:44 -0400 Subject: [PATCH 09/49] wip --- .../main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java | 1 + 1 file changed, 1 insertion(+) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 1efdf533534..4c9754c74df 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -262,6 +262,7 @@ public abstract class BaseHapiFhirResourceDao extends B entity.setCreatedByMatchUrl(theIfNoneExist); entity.setVersion(1); + //FIXME GGG is this possibly where we are fetching the thing? if (isNotBlank(theIfNoneExist)) { Set match = myMatchResourceUrlService.processMatchUrl(theIfNoneExist, myResourceType, theTransactionDetails, theRequest); if (match.size() > 1) { From 1cb6f490d66114318a2d37db7bde4e8695050ad0 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Fri, 6 Aug 2021 14:24:45 -0400 Subject: [PATCH 10/49] Add dummy test. NOTE, remove before merge --- .../ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java | 206 ++++++++++++++++++ .../fhir/jpa/dao/r4/FhirSystemDaoR4Test.java | 2 + 2 files changed, 208 insertions(+) create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java new file mode 100644 index 00000000000..34424d84b12 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java @@ -0,0 +1,206 @@ +package ca.uhn.fhir.jpa.dao.r4; + +import ca.uhn.fhir.jpa.api.config.DaoConfig; +import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; +import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; +import ca.uhn.fhir.jpa.partition.SystemRequestDetails; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.IdType; +import org.hl7.fhir.r4.model.Patient; +import org.hl7.fhir.r4.model.Task; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.startsWith; + +@SuppressWarnings({"unchecked", "deprecation", "Duplicates"}) +public class FhirDummyTest extends BaseJpaR4Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirDummyTest.class); + + @AfterEach + public final void after() { + myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); + myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); + myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); + myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes()); + myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); + myDaoConfig.setInternalSynchronousSearchSize(new DaoConfig().getInternalSynchronousSearchSize()); + myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); + myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); + } + + @BeforeEach + public void before() { + myInterceptorRegistry.registerInterceptor(myInterceptor); + } + + + @BeforeEach + public void beforeDisableResultReuse() { + myDaoConfig.setReuseCachedSearchResultsForMillis(null); + } + + @Test + public void testConditionalCreateDoesntMakeContainedResource() { + String patientString = "{\n" + + "\"resourceType\": \"Patient\",\n" + + "\"identifier\": [\n" + + "{\n" + + "\"system\": \"https://example.org/fhir/memberidentifier\",\n" + + "\"value\": \"12345670\"\n" + + "},\n" + + "{\n" + + "\"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + + "\"value\": \"12345670TT\"\n" + + "}\n" + + "]\n" + + "}"; + + Patient patient = myFhirCtx.newJsonParser().parseResource(Patient.class, patientString); + DaoMethodOutcome daoMethodOutcome = myPatientDao.create(patient); + String patientId = daoMethodOutcome.getResource().getIdElement().toVersionless().toString(); + + String bundleString = "{\n" + + " \"resourceType\": \"Bundle\",\n" + + " \"type\": \"transaction\",\n" + + " \"entry\": [\n" + + " {\n" + + " \"fullUrl\": \"urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb\",\n" + + " \"resource\": {\n" + + " \"resourceType\": \"Task\",\n" + + " \"language\": \"en-US\",\n" + + " \"identifier\": [\n" + + " {\n" + + " \"system\": \"https://example.org/fhir/taskidentifier\",\n" + + " \"value\": \"101019\"\n" + + " }\n" + + " ],\n" + + " \"basedOn\": [\n" + + " {\n" + + " \"reference\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"request\": {\n" + + " \"method\": \"PUT\",\n" + + " \"url\": \"/Task?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"fullUrl\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\",\n" + + " \"resource\": {\n" + + " \"resourceType\": \"Patient\",\n" + + " \"identifier\": [\n" + + " {\n" + + " \"system\": \"https://example.org/fhir/memberidentifier\",\n" + + " \"value\": \"12345670\"\n" + + " },\n" + + " {\n" + + " \"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + + " \"value\": \"12345670TT\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"request\": {\n" + + " \"method\": \"POST\",\n" + + " \"url\": \"Patient\",\n" + + " \"ifNoneExist\": \"identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; + Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, bundleString); + Bundle transaction2 = mySystemDao.transaction(new SystemRequestDetails(), bundle); + String taskId2 = transaction2.getEntry().stream() + .filter(entry -> entry.getResponse().getLocation().contains("Task")) + .map(entry -> entry.getResponse().getLocation()) + .findFirst().orElse(null); + + Task read2 = myTaskDao.read(new IdType(taskId2)); + assertThat(read2.getBasedOn().get(0).getReference(), is(equalTo(patientId))); + } + @Test + public void testConditionalUpdateDoesntMakeContainedResource() { + String patientString = "{\n" + + "\"resourceType\": \"Patient\",\n" + + "\"identifier\": [\n" + + "{\n" + + "\"system\": \"https://example.org/fhir/memberidentifier\",\n" + + "\"value\": \"12345670\"\n" + + "},\n" + + "{\n" + + "\"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + + "\"value\": \"12345670TT\"\n" + + "}\n" + + "]\n" + + "}"; + + Patient patient = myFhirCtx.newJsonParser().parseResource(Patient.class, patientString); + DaoMethodOutcome daoMethodOutcome = myPatientDao.create(patient); + String patientId = daoMethodOutcome.getResource().getIdElement().toVersionless().toString(); + + String bundleString = "{\n" + + " \"resourceType\": \"Bundle\",\n" + + " \"type\": \"transaction\",\n" + + " \"entry\": [\n" + + " {\n" + +// " \"fullUrl\": \"urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb\",\n" + + " \"resource\": {\n" + + " \"id\": \"abc123\",\n" + + " \"resourceType\": \"Task\",\n" + + " \"language\": \"en-US\",\n" + + " \"identifier\": [\n" + + " {\n" + + " \"system\": \"https://example.org/fhir/taskidentifier\",\n" + + " \"value\": \"101019\"\n" + + " }\n" + + " ],\n" + + " \"basedOn\": [\n" + + " {\n" + + " \"reference\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"request\": {\n" + + " \"method\": \"PUT\",\n" + + " \"url\": \"/Task?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019\"\n" + + " }\n" + + " },\n" + + " {\n" + + " \"fullUrl\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\",\n" + + " \"resource\": {\n" + + " \"resourceType\": \"Patient\",\n" + + " \"identifier\": [\n" + + " {\n" + + " \"system\": \"https://example.org/fhir/memberidentifier\",\n" + + " \"value\": \"12345670\"\n" + + " },\n" + + " {\n" + + " \"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + + " \"value\": \"12345670TT\"\n" + + " }\n" + + " ]\n" + + " },\n" + + " \"request\": {\n" + + " \"method\": \"PUT\",\n" + + " \"url\": \"/Patient?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT\"\n" + + " }\n" + + " }\n" + + " ]\n" + + "}"; + Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, bundleString); + Bundle transaction2 = mySystemDao.transaction(new SystemRequestDetails(), bundle); + String taskId2 = transaction2.getEntry().stream() + .filter(entry -> entry.getResponse().getLocation().contains("Task")) + .map(entry -> entry.getResponse().getLocation()) + .findFirst().orElse(null); + + Task read2 = myTaskDao.read(new IdType(taskId2)); + assertThat(read2.getBasedOn().get(0).getReference(), is(equalTo(patientId))); + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java index 5be6e35474a..c8eec80dae4 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java @@ -1012,7 +1012,9 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { //Post the Bundle containing a conditional POST with an identical patient from the above resource. Bundle request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained-2.json"); + Bundle outcome = mySystemDao.transaction(mySrd, request); + IdType taskId = new IdType(outcome.getEntry().get(0).getResponse().getLocation()); Task task = myTaskDao.read(taskId, mySrd); From 71ed25b77c3da3c8a9a2aa773f2d75fde7a54724 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Fri, 6 Aug 2021 14:34:40 -0400 Subject: [PATCH 11/49] Add commetn for juan --- .../main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 4c9754c74df..7d6ae8df653 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -1627,6 +1627,8 @@ public abstract class BaseHapiFhirResourceDao extends B entity = myEntityManager.find(ResourceTable.class, pid.getId()); resourceId = entity.getIdDt(); } else { + //FIXME JUAN: This is where the actual resource is replaced with a contained version in the create test. The update test correctly + //keeps this as a URN:UUID reference for now. DaoMethodOutcome outcome = create(resource, null, thePerformIndexing, theTransactionDetails, theRequest); // Pre-cache the match URL From fe98162616f8e0f99cece49f810ce3ef89f99ce2 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 14:49:31 -0400 Subject: [PATCH 12/49] Add changelog --- .../5_6_0/2868-bug-in-conditional-create.yaml | 6 +++++ .../ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 16 ++++++++--- .../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 3 +-- .../jpa/dao/BaseTransactionProcessor.java | 3 ++- ...rchParamWithInlineReferencesExtractor.java | 1 + .../extractor/BaseSearchParamExtractor.java | 27 ++++++++++++------- 6 files changed, 39 insertions(+), 17 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2868-bug-in-conditional-create.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2868-bug-in-conditional-create.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2868-bug-in-conditional-create.yaml new file mode 100644 index 00000000000..89214db0ec8 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2868-bug-in-conditional-create.yaml @@ -0,0 +1,6 @@ +--- +type: fix +issue: 2876 +jira: SMILE-1153 +title: "Fixed a bug in transaction bundle processing, specifically for bundles which contained both a conditional create, and a resource which relied on this conditional create as a reference. +This would cause the referring resource to generate a contained resource instead of appropriately referencing the existing patient." diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index bd2e964e523..387babd3eda 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -94,6 +94,7 @@ import com.google.common.collect.Sets; import com.google.common.hash.HashFunction; import com.google.common.hash.Hashing; import org.apache.commons.lang3.NotImplementedException; +import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBase; @@ -1162,10 +1163,8 @@ public abstract class BaseHapiFhirDao extends BaseStora validateResourceForStorage((T) theResource, entity); } } - String resourceType = myContext.getResourceType(theResource); - if (isNotBlank(entity.getResourceType()) && !entity.getResourceType().equals(resourceType)) { - throw new UnprocessableEntityException( - "Existing resource ID[" + entity.getIdDt().toUnqualifiedVersionless() + "] is of type[" + entity.getResourceType() + "] - Cannot update with [" + resourceType + "]"); + if (!StringUtils.isBlank(entity.getResourceType())) { + validateIncomingResourceTypeMatchesExisting(theResource, entity); } } @@ -1206,6 +1205,7 @@ public abstract class BaseHapiFhirDao extends BaseStora if (thePerformIndexing || ((ResourceTable) theEntity).getVersion() == 1) { newParams = new ResourceIndexedSearchParams(); + mySearchParamWithInlineReferencesExtractor.populateFromResource(newParams, theTransactionDetails, entity, theResource, existingParams, theRequest, thePerformIndexing); changed = populateResourceIntoEntity(theTransactionDetails, theRequest, theResource, entity, true); @@ -1415,6 +1415,14 @@ public abstract class BaseHapiFhirDao extends BaseStora return entity; } + private void validateIncomingResourceTypeMatchesExisting(IBaseResource theResource, ResourceTable entity) { + String resourceType = myContext.getResourceType(theResource); + if (!resourceType.equals(entity.getResourceType())) { + throw new UnprocessableEntityException( + "Existing resource ID[" + entity.getIdDt().toUnqualifiedVersionless() + "] is of type[" + entity.getResourceType() + "] - Cannot update with [" + resourceType + "]"); + } + } + @Override public ResourceTable updateInternal(RequestDetails theRequestDetails, T theResource, boolean thePerformIndexing, boolean theForceUpdateVersion, IBasePersistedResource theEntity, IIdType theResourceId, IBaseResource theOldResource, TransactionDetails theTransactionDetails) { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 7d6ae8df653..2c4c9497d5e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -262,7 +262,6 @@ public abstract class BaseHapiFhirResourceDao extends B entity.setCreatedByMatchUrl(theIfNoneExist); entity.setVersion(1); - //FIXME GGG is this possibly where we are fetching the thing? if (isNotBlank(theIfNoneExist)) { Set match = myMatchResourceUrlService.processMatchUrl(theIfNoneExist, myResourceType, theTransactionDetails, theRequest); if (match.size() > 1) { @@ -279,7 +278,7 @@ public abstract class BaseHapiFhirResourceDao extends B }; Supplier idSupplier = () -> { - return myTxTemplate.execute(tx -> { + myTxTemplate.execute(tx -> { IIdType retVal = myIdHelperService.translatePidIdToForcedId(myFhirContext, myResourceName, pid); if (!retVal.hasVersionIdPart()) { IIdType idWithVersion = myMemoryCacheService.getIfPresent(MemoryCacheService.CacheEnum.RESOURCE_CONDITIONAL_CREATE_VERSION, pid.getIdAsLong()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index 36551277b6d..905b10e0280 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -791,6 +791,8 @@ public abstract class BaseTransactionProcessor { String matchUrl = myVersionAdapter.getEntryRequestIfNoneExist(nextReqEntry); matchUrl = performIdSubstitutionsInMatchUrl(theIdSubstitutions, matchUrl); outcome = resourceDao.create(res, matchUrl, false, theTransactionDetails, theRequest); + // IS THIS THE MAGIC SAUCE? + res.setId(outcome.getId()); if (nextResourceId != null) { handleTransactionCreateOrUpdateOutcome(theIdSubstitutions, theIdToPersistedOutcome, nextResourceId, outcome, nextRespEntry, resourceType, res, theRequest); } @@ -865,7 +867,6 @@ public abstract class BaseTransactionProcessor { matchUrl = parts.getResourceType(); } matchUrl = performIdSubstitutionsInMatchUrl(theIdSubstitutions, matchUrl); - //TODO FIXME GGG This update call comes back with a contained resource. outcome = resourceDao.update(res, matchUrl, false, false, theRequest, theTransactionDetails); if (Boolean.TRUE.equals(outcome.getCreated())) { conditionalRequestUrls.put(matchUrl, res.getClass()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java index d057fb4c7cf..6feb25c47e2 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java @@ -129,6 +129,7 @@ public class SearchParamWithInlineReferencesExtractor { partitionId = RequestPartitionId.allPartitions(); } + //THIS IS THE NEW SPOT mySearchParamExtractorService.extractFromResource(partitionId, theRequest, theParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference); Set> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet(); diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java index 0a1283f8027..886b8aaaeba 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java @@ -78,6 +78,7 @@ import java.util.Collections; import java.util.Date; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.TreeSet; @@ -964,6 +965,17 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor return retVal; } + + /** + * Helper function to determine if a set of SPs for a resource uses a resolve as part of its fhir path. + */ + private boolean anySearchParameterUsesResolve(Collection searchParams, RestSearchParameterTypeEnum theSearchParamType) { + return searchParams.stream() + .filter(param -> param.getParamType() != theSearchParamType) + .filter(Objects::nonNull) + .anyMatch(param -> param.getPath().contains("resolve")); + } + /** * HAPI FHIR Reference objects (e.g. {@link org.hl7.fhir.r4.model.Reference}) can hold references either by text * (e.g. "#3") or by resource (e.g. "new Reference(patientInstance)"). The FHIRPath evaluator only understands the @@ -974,17 +986,12 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor * if we think there's actually a chance */ private void cleanUpContainedResourceReferences(IBaseResource theResource, RestSearchParameterTypeEnum theSearchParamType, Collection searchParams) { - boolean havePathWithResolveExpression = myModelConfig.isIndexOnContainedResources(); - for (RuntimeSearchParam nextSpDef : searchParams) { - if (nextSpDef.getParamType() != theSearchParamType) { - continue; - } - if (defaultString(nextSpDef.getPath()).contains("resolve")) { - havePathWithResolveExpression = true; - break; - } - } + boolean havePathWithResolveExpression = + myModelConfig.isIndexOnContainedResources() + || anySearchParameterUsesResolve(searchParams, theSearchParamType); + if (havePathWithResolveExpression) { + //FIXME GGG/JA: At this point, if the Task.basedOn.reference.resource does _not_ have an ID, we will attempt to contain it internally. myContext.newTerser().containResources(theResource, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS); } } From 6a46a68e82f1ce100db02f14f74b63fdacb7a46c Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 16:18:03 -0400 Subject: [PATCH 13/49] Move file --- .../{5_6_0 => 5_5_0}/2868-bug-in-conditional-create.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/{5_6_0 => 5_5_0}/2868-bug-in-conditional-create.yaml (100%) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2868-bug-in-conditional-create.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml similarity index 100% rename from hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2868-bug-in-conditional-create.yaml rename to hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml From 33fbffcff965a27d4d50ad7b5affa4d28ad208bf Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 16:18:40 -0400 Subject: [PATCH 14/49] Bump issue number --- .../fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml index 89214db0ec8..015dc2b73a0 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2868-bug-in-conditional-create.yaml @@ -1,6 +1,6 @@ --- type: fix -issue: 2876 +issue: 2868 jira: SMILE-1153 title: "Fixed a bug in transaction bundle processing, specifically for bundles which contained both a conditional create, and a resource which relied on this conditional create as a reference. This would cause the referring resource to generate a contained resource instead of appropriately referencing the existing patient." From daa3bc773eb7ee96dcff8f3370727f6677992d49 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 16:46:03 -0400 Subject: [PATCH 15/49] remove dummy test --- .../fhir/jpa/dao/BaseHapiFhirResourceDao.java | 4 +- .../jpa/dao/BaseTransactionProcessor.java | 4 +- .../fhir/jpa/dao/TransactionProcessor.java | 13 +- ...rchParamWithInlineReferencesExtractor.java | 1 - .../ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java | 206 ------------------ .../extractor/BaseSearchParamExtractor.java | 2 +- 6 files changed, 8 insertions(+), 222 deletions(-) delete mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java index 2c4c9497d5e..1efdf533534 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java @@ -278,7 +278,7 @@ public abstract class BaseHapiFhirResourceDao extends B }; Supplier idSupplier = () -> { - myTxTemplate.execute(tx -> { + return myTxTemplate.execute(tx -> { IIdType retVal = myIdHelperService.translatePidIdToForcedId(myFhirContext, myResourceName, pid); if (!retVal.hasVersionIdPart()) { IIdType idWithVersion = myMemoryCacheService.getIfPresent(MemoryCacheService.CacheEnum.RESOURCE_CONDITIONAL_CREATE_VERSION, pid.getIdAsLong()); @@ -1626,8 +1626,6 @@ public abstract class BaseHapiFhirResourceDao extends B entity = myEntityManager.find(ResourceTable.class, pid.getId()); resourceId = entity.getIdDt(); } else { - //FIXME JUAN: This is where the actual resource is replaced with a contained version in the create test. The update test correctly - //keeps this as a URN:UUID reference for now. DaoMethodOutcome outcome = create(resource, null, thePerformIndexing, theTransactionDetails, theRequest); // Pre-cache the match URL diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java index 905b10e0280..dd1c80c7b71 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseTransactionProcessor.java @@ -791,7 +791,6 @@ public abstract class BaseTransactionProcessor { String matchUrl = myVersionAdapter.getEntryRequestIfNoneExist(nextReqEntry); matchUrl = performIdSubstitutionsInMatchUrl(theIdSubstitutions, matchUrl); outcome = resourceDao.create(res, matchUrl, false, theTransactionDetails, theRequest); - // IS THIS THE MAGIC SAUCE? res.setId(outcome.getId()); if (nextResourceId != null) { handleTransactionCreateOrUpdateOutcome(theIdSubstitutions, theIdToPersistedOutcome, nextResourceId, outcome, nextRespEntry, resourceType, res, theRequest); @@ -1013,7 +1012,7 @@ public abstract class BaseTransactionProcessor { for (IIdType next : theAllIds) { IIdType replacement = theIdSubstitutions.get(next); - if (replacement != null && replacement.equals(next)) { + if (replacement != null && !replacement.equals(next)) { ourLog.debug("Placeholder resource ID \"{}\" was replaced with permanent ID \"{}\"", next, replacement); } } @@ -1123,7 +1122,6 @@ public abstract class BaseTransactionProcessor { IIdType targetId = resourceReference.getResource().getIdElement(); if (targetId.getValue() == null || targetId.getValue().startsWith("#")) { // This means it's a contained resource - ourLog.error("THIS THING ISN'T CONTAINED! WHY IS IT CONTAINED!!! "); continue; } else if (theIdSubstitutions.containsValue(targetId)) { newId = targetId; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java index 95a9f9d78b8..fa232f2bdc9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java @@ -41,7 +41,6 @@ import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.util.StopWatch; import com.google.common.annotations.VisibleForTesting; import org.apache.commons.lang3.Validate; -import org.apache.jena.ext.com.google.common.base.Optional; import org.hibernate.internal.SessionImpl; import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBaseBundle; @@ -68,6 +67,7 @@ import java.util.HashSet; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -223,7 +223,6 @@ public class TransactionProcessor extends BaseTransactionProcessor { if (param instanceof TokenParam) { Predicate hashPredicate = buildHashPredicateFromTokenParam((TokenParam)param, requestPartitionId, cb, from, next); - //Some partition witchcraft if (hashPredicate != null) { if (myPartitionSettings.isPartitioningEnabled() && !myPartitionSettings.isIncludePartitionInSearchHashes()) { if (requestPartitionId.isDefaultPartition()) { @@ -251,13 +250,11 @@ public class TransactionProcessor extends BaseTransactionProcessor { List results = query.getResultList(); for (ResourceIndexedSearchParamToken nextResult : results) { - Optional matchedSearch = Optional - .fromNullable(hashToSearchMap.get(nextResult.getHashSystemAndValue())) - .or(Optional.fromNullable(hashToSearchMap.get(nextResult.getHashValue()))); - - if (matchedSearch.isPresent()) { - setSearchToResolvedAndPrefetchFoundResourcePid(theTransactionDetails, idsToPreFetch, nextResult, matchedSearch.get()); + Optional matchedSearch = Optional.ofNullable(hashToSearchMap.get(nextResult.getHashSystemAndValue())); + if (!matchedSearch.isPresent()) { + matchedSearch = Optional.ofNullable(hashToSearchMap.get(nextResult.getHashValue())); } + matchedSearch.ifPresent(matchUrlToResolve -> setSearchToResolvedAndPrefetchFoundResourcePid(theTransactionDetails, idsToPreFetch, nextResult, matchUrlToResolve)); } //For each SP Map which did not return a result, tag it as not found. searchParameterMapsToResolve.stream() diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java index 6feb25c47e2..d057fb4c7cf 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java @@ -129,7 +129,6 @@ public class SearchParamWithInlineReferencesExtractor { partitionId = RequestPartitionId.allPartitions(); } - //THIS IS THE NEW SPOT mySearchParamExtractorService.extractFromResource(partitionId, theRequest, theParams, theEntity, theResource, theTransactionDetails, theFailOnInvalidReference); Set> activeSearchParams = mySearchParamRegistry.getActiveSearchParams(theEntity.getResourceType()).entrySet(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java deleted file mode 100644 index 34424d84b12..00000000000 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirDummyTest.java +++ /dev/null @@ -1,206 +0,0 @@ -package ca.uhn.fhir.jpa.dao.r4; - -import ca.uhn.fhir.jpa.api.config.DaoConfig; -import ca.uhn.fhir.jpa.api.model.DaoMethodOutcome; -import ca.uhn.fhir.jpa.model.entity.NormalizedQuantitySearchLevel; -import ca.uhn.fhir.jpa.partition.SystemRequestDetails; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.IdType; -import org.hl7.fhir.r4.model.Patient; -import org.hl7.fhir.r4.model.Task; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.equalTo; -import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.startsWith; - -@SuppressWarnings({"unchecked", "deprecation", "Duplicates"}) -public class FhirDummyTest extends BaseJpaR4Test { - - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirDummyTest.class); - - @AfterEach - public final void after() { - myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences()); - myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical()); - myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete()); - myDaoConfig.setEnforceReferenceTargetTypes(new DaoConfig().isEnforceReferenceTargetTypes()); - myDaoConfig.setIndexMissingFields(new DaoConfig().getIndexMissingFields()); - myDaoConfig.setInternalSynchronousSearchSize(new DaoConfig().getInternalSynchronousSearchSize()); - myModelConfig.setNormalizedQuantitySearchLevel(NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED); - myDaoConfig.setHistoryCountMode(DaoConfig.DEFAULT_HISTORY_COUNT_MODE); - } - - @BeforeEach - public void before() { - myInterceptorRegistry.registerInterceptor(myInterceptor); - } - - - @BeforeEach - public void beforeDisableResultReuse() { - myDaoConfig.setReuseCachedSearchResultsForMillis(null); - } - - @Test - public void testConditionalCreateDoesntMakeContainedResource() { - String patientString = "{\n" + - "\"resourceType\": \"Patient\",\n" + - "\"identifier\": [\n" + - "{\n" + - "\"system\": \"https://example.org/fhir/memberidentifier\",\n" + - "\"value\": \"12345670\"\n" + - "},\n" + - "{\n" + - "\"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + - "\"value\": \"12345670TT\"\n" + - "}\n" + - "]\n" + - "}"; - - Patient patient = myFhirCtx.newJsonParser().parseResource(Patient.class, patientString); - DaoMethodOutcome daoMethodOutcome = myPatientDao.create(patient); - String patientId = daoMethodOutcome.getResource().getIdElement().toVersionless().toString(); - - String bundleString = "{\n" + - " \"resourceType\": \"Bundle\",\n" + - " \"type\": \"transaction\",\n" + - " \"entry\": [\n" + - " {\n" + - " \"fullUrl\": \"urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb\",\n" + - " \"resource\": {\n" + - " \"resourceType\": \"Task\",\n" + - " \"language\": \"en-US\",\n" + - " \"identifier\": [\n" + - " {\n" + - " \"system\": \"https://example.org/fhir/taskidentifier\",\n" + - " \"value\": \"101019\"\n" + - " }\n" + - " ],\n" + - " \"basedOn\": [\n" + - " {\n" + - " \"reference\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"request\": {\n" + - " \"method\": \"PUT\",\n" + - " \"url\": \"/Task?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019\"\n" + - " }\n" + - " },\n" + - " {\n" + - " \"fullUrl\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\",\n" + - " \"resource\": {\n" + - " \"resourceType\": \"Patient\",\n" + - " \"identifier\": [\n" + - " {\n" + - " \"system\": \"https://example.org/fhir/memberidentifier\",\n" + - " \"value\": \"12345670\"\n" + - " },\n" + - " {\n" + - " \"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + - " \"value\": \"12345670TT\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"request\": {\n" + - " \"method\": \"POST\",\n" + - " \"url\": \"Patient\",\n" + - " \"ifNoneExist\": \"identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT\"\n" + - " }\n" + - " }\n" + - " ]\n" + - "}"; - Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, bundleString); - Bundle transaction2 = mySystemDao.transaction(new SystemRequestDetails(), bundle); - String taskId2 = transaction2.getEntry().stream() - .filter(entry -> entry.getResponse().getLocation().contains("Task")) - .map(entry -> entry.getResponse().getLocation()) - .findFirst().orElse(null); - - Task read2 = myTaskDao.read(new IdType(taskId2)); - assertThat(read2.getBasedOn().get(0).getReference(), is(equalTo(patientId))); - } - @Test - public void testConditionalUpdateDoesntMakeContainedResource() { - String patientString = "{\n" + - "\"resourceType\": \"Patient\",\n" + - "\"identifier\": [\n" + - "{\n" + - "\"system\": \"https://example.org/fhir/memberidentifier\",\n" + - "\"value\": \"12345670\"\n" + - "},\n" + - "{\n" + - "\"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + - "\"value\": \"12345670TT\"\n" + - "}\n" + - "]\n" + - "}"; - - Patient patient = myFhirCtx.newJsonParser().parseResource(Patient.class, patientString); - DaoMethodOutcome daoMethodOutcome = myPatientDao.create(patient); - String patientId = daoMethodOutcome.getResource().getIdElement().toVersionless().toString(); - - String bundleString = "{\n" + - " \"resourceType\": \"Bundle\",\n" + - " \"type\": \"transaction\",\n" + - " \"entry\": [\n" + - " {\n" + -// " \"fullUrl\": \"urn:uuid:1f3b9e25-fd45-4342-a82b-7ca5755923bb\",\n" + - " \"resource\": {\n" + - " \"id\": \"abc123\",\n" + - " \"resourceType\": \"Task\",\n" + - " \"language\": \"en-US\",\n" + - " \"identifier\": [\n" + - " {\n" + - " \"system\": \"https://example.org/fhir/taskidentifier\",\n" + - " \"value\": \"101019\"\n" + - " }\n" + - " ],\n" + - " \"basedOn\": [\n" + - " {\n" + - " \"reference\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"request\": {\n" + - " \"method\": \"PUT\",\n" + - " \"url\": \"/Task?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Ftaskidentifier|101019\"\n" + - " }\n" + - " },\n" + - " {\n" + - " \"fullUrl\": \"urn:uuid:47c6d106-3441-41c0-8a2c-054ad9897ced\",\n" + - " \"resource\": {\n" + - " \"resourceType\": \"Patient\",\n" + - " \"identifier\": [\n" + - " {\n" + - " \"system\": \"https://example.org/fhir/memberidentifier\",\n" + - " \"value\": \"12345670\"\n" + - " },\n" + - " {\n" + - " \"system\": \"https://example.org/fhir/memberuniqueidentifier\",\n" + - " \"value\": \"12345670TT\"\n" + - " }\n" + - " ]\n" + - " },\n" + - " \"request\": {\n" + - " \"method\": \"PUT\",\n" + - " \"url\": \"/Patient?identifier\\u003dhttps%3A%2F%2Fexample.org%2Ffhir%2Fmemberuniqueidentifier|12345670TT\"\n" + - " }\n" + - " }\n" + - " ]\n" + - "}"; - Bundle bundle = myFhirCtx.newJsonParser().parseResource(Bundle.class, bundleString); - Bundle transaction2 = mySystemDao.transaction(new SystemRequestDetails(), bundle); - String taskId2 = transaction2.getEntry().stream() - .filter(entry -> entry.getResponse().getLocation().contains("Task")) - .map(entry -> entry.getResponse().getLocation()) - .findFirst().orElse(null); - - Task read2 = myTaskDao.read(new IdType(taskId2)); - assertThat(read2.getBasedOn().get(0).getReference(), is(equalTo(patientId))); - } -} diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java index 886b8aaaeba..e109de415c7 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java @@ -991,7 +991,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor || anySearchParameterUsesResolve(searchParams, theSearchParamType); if (havePathWithResolveExpression) { - //FIXME GGG/JA: At this point, if the Task.basedOn.reference.resource does _not_ have an ID, we will attempt to contain it internally. + //TODO GGG/JA: At this point, if the Task.basedOn.reference.resource does _not_ have an ID, we will attempt to contain it internally. Wild myContext.newTerser().containResources(theResource, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS); } } From a5c850b119a177d48e72d8ad31a4047541828132 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 17:37:24 -0400 Subject: [PATCH 16/49] Pre-review cleaning --- .../uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java | 14 +++++--------- .../src/test/resources/logback-test.xml | 2 +- .../resources/r4/transaction-no-contained.json | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java index c8eec80dae4..5c9be671e65 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java @@ -1026,20 +1026,16 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { // Run once (should create the patient) Bundle request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained.json"); - Bundle outcome = mySystemDao.transaction(mySrd, request); - IdType communicationId = new IdType(outcome.getEntry().get(1).getResponse().getLocation()); - Communication communication = myCommunicationDao.read(communicationId, mySrd); - assertThat(communication.getSubject().getReference(), matchesPattern("Patient/[0-9]+")); + mySystemDao.transaction(mySrd, request); // Run a second time (no conditional update) - request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained.json"); - outcome = mySystemDao.transaction(mySrd, request); + Bundle outcome = mySystemDao.transaction(mySrd, request); ourLog.info("Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome)); -// IdType communicationId = new IdType(outcome.getEntry().get(1).getResponse().getLocation()); -// Communication communication = myCommunicationDao.read(communicationId, mySrd); -// assertThat(communication.getSubject().getReference(), matchesPattern("Patient/[0-9]+")); + IdType communicationId = new IdType(outcome.getEntry().get(0).getResponse().getLocation()); + Communication communication = myCommunicationDao.read(communicationId, mySrd); + assertThat(communication.getSubject().getReference(), matchesPattern("Patient/[0-9]+")); ourLog.info("Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(communication)); diff --git a/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml b/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml index 36a83af6599..ac75e0d04be 100644 --- a/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml +++ b/hapi-fhir-jpaserver-base/src/test/resources/logback-test.xml @@ -42,7 +42,7 @@ - + diff --git a/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json b/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json index 880327e4cdc..263cca4691e 100644 --- a/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json +++ b/hapi-fhir-jpaserver-base/src/test/resources/r4/transaction-no-contained.json @@ -250,8 +250,8 @@ ] }, "request": { - "method": "PUT", - "url": "Communication?identifier=https://example.com|zoop" + "method": "POST", + "url": "Communication" } } ] From e311835e8da98978810b8afb16aa95f9033aea2b Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 18:44:42 -0400 Subject: [PATCH 17/49] Revert test --- .../test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java index 5c9be671e65..a1b7bb0ae52 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java @@ -1029,11 +1029,12 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest { mySystemDao.transaction(mySrd, request); // Run a second time (no conditional update) + request = loadResourceFromClasspath(Bundle.class, "/r4/transaction-no-contained.json"); Bundle outcome = mySystemDao.transaction(mySrd, request); ourLog.info("Outcome: {}", myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome)); - IdType communicationId = new IdType(outcome.getEntry().get(0).getResponse().getLocation()); + IdType communicationId = new IdType(outcome.getEntry().get(1).getResponse().getLocation()); Communication communication = myCommunicationDao.read(communicationId, mySrd); assertThat(communication.getSubject().getReference(), matchesPattern("Patient/[0-9]+")); From 6f3006f2baa6c780eb0f10e925b5e5657ad97697 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 20:56:54 -0400 Subject: [PATCH 18/49] Fix NPE --- .../jpa/searchparam/extractor/BaseSearchParamExtractor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java index e109de415c7..3315670f03a 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/BaseSearchParamExtractor.java @@ -972,8 +972,9 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor private boolean anySearchParameterUsesResolve(Collection searchParams, RestSearchParameterTypeEnum theSearchParamType) { return searchParams.stream() .filter(param -> param.getParamType() != theSearchParamType) + .map(RuntimeSearchParam::getPath) .filter(Objects::nonNull) - .anyMatch(param -> param.getPath().contains("resolve")); + .anyMatch(path-> path.contains("resolve")); } /** From b34d56944309a2cba7c1d6cac4284e1b38764957 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 10 Aug 2021 22:22:57 -0400 Subject: [PATCH 19/49] Fix changelog test --- .../test/java/ca/uhn/hapi/fhir/docs/ChangelogFilesTest.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hapi-fhir-docs/src/test/java/ca/uhn/hapi/fhir/docs/ChangelogFilesTest.java b/hapi-fhir-docs/src/test/java/ca/uhn/hapi/fhir/docs/ChangelogFilesTest.java index 579982577ce..9c9c0f583bd 100644 --- a/hapi-fhir-docs/src/test/java/ca/uhn/hapi/fhir/docs/ChangelogFilesTest.java +++ b/hapi-fhir-docs/src/test/java/ca/uhn/hapi/fhir/docs/ChangelogFilesTest.java @@ -69,6 +69,9 @@ public class ChangelogFilesTest { // this one is optional fieldNames.remove("backport"); + // this one is optional + fieldNames.remove("jira"); + assertThat("Invalid element in " + next + ": " + fieldNames, fieldNames, empty()); if (haveIssue) { From 669cf05b308708784a7f300f4917ceaa5b4c10b8 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 12 Aug 2021 14:25:12 -0400 Subject: [PATCH 20/49] Modify SearchParameterMap toNormalizedQueryString to include value of _contained parameter --- .../rest/api/SearchContainedModeEnum.java | 2 +- ...tained-ignored-for-cache-key-purposes.yaml | 6 ++++++ .../dao/r4/SearchCoordinatorSvcImplTest.java | 10 ++++------ .../jpa/provider/SearchParameterMapTest.java | 20 +++++++++++++++++++ ...ResourceProviderR4SearchContainedTest.java | 6 +++++- .../jpa/searchparam/SearchParameterMap.java | 8 ++++++++ 6 files changed, 44 insertions(+), 8 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2887-contained-ignored-for-cache-key-purposes.yaml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/SearchContainedModeEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/SearchContainedModeEnum.java index e90b201b6e4..bc0f320ed5e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/SearchContainedModeEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/SearchContainedModeEnum.java @@ -51,7 +51,7 @@ public enum SearchContainedModeEnum { myCode = theCode; } - private String getCode() { + public String getCode() { return myCode; } diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2887-contained-ignored-for-cache-key-purposes.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2887-contained-ignored-for-cache-key-purposes.yaml new file mode 100644 index 00000000000..bf2b4b334ba --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_5_0/2887-contained-ignored-for-cache-key-purposes.yaml @@ -0,0 +1,6 @@ +--- +type: fix +issue: 2887 +jira: SMILE-2896 +title: "Fixed a bug where the search results cache was ignoring the value of `_contained` parameter when assigning a cache key. + This was causing queries run in a short period of time to return wrong cached results if one query used `_contained=true` and the other did not." diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchCoordinatorSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchCoordinatorSvcImplTest.java index 4eb8f636121..5f983a7ce1f 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchCoordinatorSvcImplTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/SearchCoordinatorSvcImplTest.java @@ -10,10 +10,8 @@ import ca.uhn.fhir.jpa.entity.SearchTypeEnum; import ca.uhn.fhir.jpa.model.search.SearchStatusEnum; import ca.uhn.fhir.jpa.search.cache.DatabaseSearchCacheSvcImpl; import ca.uhn.fhir.jpa.search.cache.ISearchCacheSvc; -import ca.uhn.fhir.util.TestUtil; import org.apache.commons.lang3.time.DateUtils; import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; @@ -40,7 +38,7 @@ public class SearchCoordinatorSvcImplTest extends BaseJpaR4Test { private ISearchCoordinatorSvc mySearchCoordinator; @Autowired - private ISearchCacheSvc myDataaseCacheSvc; + private ISearchCacheSvc myDatabaseCacheSvc; @AfterEach public void after() { @@ -92,7 +90,7 @@ public class SearchCoordinatorSvcImplTest extends BaseJpaR4Test { assertEquals(30, mySearchResultDao.count()); }); - myDataaseCacheSvc.pollForStaleSearchesAndDeleteThem(); + myDatabaseCacheSvc.pollForStaleSearchesAndDeleteThem(); runInTransaction(()->{ // We should delete up to 10, but 3 don't get deleted since they have too many results to delete in one pass assertEquals(13, mySearchDao.count()); @@ -101,7 +99,7 @@ public class SearchCoordinatorSvcImplTest extends BaseJpaR4Test { assertEquals(15, mySearchResultDao.count()); }); - myDataaseCacheSvc.pollForStaleSearchesAndDeleteThem(); + myDatabaseCacheSvc.pollForStaleSearchesAndDeleteThem(); runInTransaction(()->{ // Once again we attempt to delete 10, but the first 3 don't get deleted and still remain // (total is 6 because 3 weren't deleted, and they blocked another 3 that might have been) @@ -110,7 +108,7 @@ public class SearchCoordinatorSvcImplTest extends BaseJpaR4Test { assertEquals(0, mySearchResultDao.count()); }); - myDataaseCacheSvc.pollForStaleSearchesAndDeleteThem(); + myDatabaseCacheSvc.pollForStaleSearchesAndDeleteThem(); runInTransaction(()->{ assertEquals(0, mySearchDao.count()); assertEquals(0, mySearchDao.countDeleted()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SearchParameterMapTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SearchParameterMapTest.java index d5210186f4e..39f995742a4 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SearchParameterMapTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SearchParameterMapTest.java @@ -1,8 +1,10 @@ package ca.uhn.fhir.jpa.provider; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import ca.uhn.fhir.context.FhirVersionEnum; +import ca.uhn.fhir.rest.api.SearchContainedModeEnum; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Test; @@ -41,6 +43,24 @@ public class SearchParameterMapTest { assertEquals("?birthdate=ge2001&birthdate=lt2002&name=bouvier,simpson&name=homer,jay&name:exact=ZZZ?", UrlUtil.unescape(queryString)); } + @Test + public void testContainedParameterIsIncludedInNormalizedString() { + SearchParameterMap map = new SearchParameterMap(); + map.add("name", new StringParam("Smith")); + map.setSearchContainedMode(SearchContainedModeEnum.TRUE); + String containedQueryString = map.toNormalizedQueryString(ourCtx); + + SearchParameterMap uncontainedMap = new SearchParameterMap(); + uncontainedMap.add("name", new StringParam("Smith")); + uncontainedMap.setSearchContainedMode(SearchContainedModeEnum.FALSE); + String uncontainedQueryString = uncontainedMap.toNormalizedQueryString(ourCtx); + + ourLog.info(containedQueryString); + ourLog.info(uncontainedQueryString); + assertNotEquals(containedQueryString, uncontainedQueryString); + + } + @Test public void testToQueryStringEmpty() { SearchParameterMap map = new SearchParameterMap(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java index af91f8da02a..0c6d74eb7bc 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4SearchContainedTest.java @@ -284,7 +284,6 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR assertEquals(0L, oids.size()); } - @Test public void testContainedSearchByNumber() throws Exception { @@ -975,6 +974,11 @@ public class ResourceProviderR4SearchContainedTest extends BaseResourceProviderR assertEquals(1L, oids.size()); assertThat(oids, contains(oid1.getValue())); + } + + //See https://github.com/hapifhir/hapi-fhir/issues/2887 + @Test + public void testContainedResourceParameterIsUsedInCache() { } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java index 92c7d29a1aa..778df7b3882 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java @@ -511,6 +511,14 @@ public class SearchParameterMap implements Serializable { b.append(getSearchTotalMode().getCode()); } + //Contained mode + if (getSearchContainedMode() != null) { + addUrlParamSeparator(b); + b.append(Constants.PARAM_CONTAINED); + b.append("="); + b.append(getSearchContainedMode().getCode()); + } + if (b.length() == 0) { b.append('?'); } From 3fd5f7d6d4961b0bf0ca501666647a8174205611 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 12 Aug 2021 19:12:09 -0400 Subject: [PATCH 21/49] Omit if set to false --- .../java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java index 778df7b3882..4ad522cf3be 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/SearchParameterMap.java @@ -512,7 +512,8 @@ public class SearchParameterMap implements Serializable { } //Contained mode - if (getSearchContainedMode() != null) { + //For some reason, instead of null here, we default to false. That said, ommitting it is identical to setting it to false. + if (getSearchContainedMode() != SearchContainedModeEnum.FALSE) { addUrlParamSeparator(b); b.append(Constants.PARAM_CONTAINED); b.append("="); From cf917d0f8205f2c987e3b5a76641378111ab7870 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Sun, 15 Aug 2021 16:54:38 -0400 Subject: [PATCH 22/49] Version Bump --- hapi-deployable-pom/pom.xml | 2 +- hapi-fhir-android/pom.xml | 2 +- hapi-fhir-base/pom.xml | 2 +- hapi-fhir-bom/pom.xml | 4 ++-- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +- hapi-fhir-cli/pom.xml | 2 +- hapi-fhir-client-okhttp/pom.xml | 2 +- hapi-fhir-client/pom.xml | 2 +- hapi-fhir-converter/pom.xml | 2 +- hapi-fhir-dist/pom.xml | 2 +- hapi-fhir-docs/pom.xml | 2 +- hapi-fhir-jacoco/pom.xml | 2 +- hapi-fhir-jaxrsserver-base/pom.xml | 2 +- hapi-fhir-jaxrsserver-example/pom.xml | 2 +- hapi-fhir-jpaserver-api/pom.xml | 2 +- hapi-fhir-jpaserver-base/pom.xml | 2 +- hapi-fhir-jpaserver-batch/pom.xml | 2 +- hapi-fhir-jpaserver-cql/pom.xml | 2 +- hapi-fhir-jpaserver-mdm/pom.xml | 2 +- hapi-fhir-jpaserver-migrate/pom.xml | 2 +- hapi-fhir-jpaserver-model/pom.xml | 2 +- hapi-fhir-jpaserver-searchparam/pom.xml | 2 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +- hapi-fhir-server-mdm/pom.xml | 2 +- hapi-fhir-server-openapi/pom.xml | 2 +- hapi-fhir-server/pom.xml | 2 +- .../hapi-fhir-spring-boot-autoconfigure/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../hapi-fhir-spring-boot-samples/pom.xml | 2 +- .../hapi-fhir-spring-boot-starter/pom.xml | 2 +- hapi-fhir-spring-boot/pom.xml | 2 +- hapi-fhir-structures-dstu2.1/pom.xml | 2 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- hapi-fhir-structures-dstu3/pom.xml | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- hapi-fhir-structures-r4/pom.xml | 2 +- hapi-fhir-structures-r5/pom.xml | 2 +- hapi-fhir-test-utilities/pom.xml | 2 +- hapi-fhir-testpage-overlay/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2.1/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2/pom.xml | 2 +- hapi-fhir-validation-resources-dstu3/pom.xml | 2 +- hapi-fhir-validation-resources-r4/pom.xml | 2 +- hapi-fhir-validation-resources-r5/pom.xml | 2 +- hapi-fhir-validation/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 16 ++++++++-------- hapi-tinder-test/pom.xml | 2 +- pom.xml | 2 +- restful-server-example/pom.xml | 2 +- .../pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-client/pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-server/pom.xml | 2 +- 58 files changed, 66 insertions(+), 66 deletions(-) diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index e89630c261a..5bef19e912c 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index bc0cfa6f187..f71644c24d5 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index b440419860b..3593d59fc1e 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index e330d694ce7..5d141ed0870 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -3,14 +3,14 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index ef49d86d7f3..d55491e16a3 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index faacba58cd8..9b9c776ddaa 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index d1bce28c525..337b6c2fa01 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index 935047c7060..515c86524f8 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index 3a5579f6b0b..849be33ec18 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 8598814e473..4c3f41cdbd4 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index d33e25672ee..c661da5c233 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index 6c83bad936f..85f5bf0f678 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index 7a38121bfcb..a6221bc215d 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 5806383069c..ab6ca7747ab 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index bce2629e751..2aa5e750a1c 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-example/pom.xml b/hapi-fhir-jaxrsserver-example/pom.xml index 4d51572f3f1..a639f589b29 100644 --- a/hapi-fhir-jaxrsserver-example/pom.xml +++ b/hapi-fhir-jaxrsserver-example/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-jpaserver-api/pom.xml b/hapi-fhir-jpaserver-api/pom.xml index 60b9ff7e0a6..9d293f09528 100644 --- a/hapi-fhir-jpaserver-api/pom.xml +++ b/hapi-fhir-jpaserver-api/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index f4c5cfc8ed4..7803c8a05cb 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-batch/pom.xml b/hapi-fhir-jpaserver-batch/pom.xml index fa552c7e6f3..0d18f5ec19b 100644 --- a/hapi-fhir-jpaserver-batch/pom.xml +++ b/hapi-fhir-jpaserver-batch/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml index 4d12fe6bed7..ad5a613caba 100644 --- a/hapi-fhir-jpaserver-cql/pom.xml +++ b/hapi-fhir-jpaserver-cql/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index 83b1b55e1f0..7501c1d3a99 100644 --- a/hapi-fhir-jpaserver-mdm/pom.xml +++ b/hapi-fhir-jpaserver-mdm/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-migrate/pom.xml b/hapi-fhir-jpaserver-migrate/pom.xml index c04559d2664..02e0f784b95 100644 --- a/hapi-fhir-jpaserver-migrate/pom.xml +++ b/hapi-fhir-jpaserver-migrate/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index 1f41e99d0a4..4611dfa87a4 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index 5abb5632a67..d54b133f41b 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index 5d5ea7ce06b..6b9c1acbd99 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index 1852210925d..920aa9fc564 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 9b902d9c5b4..4e59cf3d3a4 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index 833378ffb1c..a6bc599a030 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index cdba7e64de4..e15d3fc4ee2 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index a91187eb33a..39fc59b2e28 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index c7afc583561..b6d98eca624 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index b24fea10b4f..0b3d030206c 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.5.0-PRE8-SNAPSHOT + 5.5.0 hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index 2e90f42c2fe..1328c2189ff 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.5.0-PRE8-SNAPSHOT + 5.5.0 hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 8a0f3eea1ea..04d3deefcec 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.5.0-PRE8-SNAPSHOT + 5.5.0 hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index 4502bab171f..74ecf61c270 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 5.5.0-PRE8-SNAPSHOT + 5.5.0 hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index 3eefdc44e57..d49dd34a8ea 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index cb8df8fedce..06983de95d6 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index b83f33489d7..d89a0a8fcf7 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index 7cdb806aaa5..0abf455f1e8 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index 02594a84d1e..8ebb5c5395d 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 2336d6b6424..363ca7cfc54 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index 7eefade758f..98d9be6d55b 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index 7433f736ca4..b38fddd471d 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index f8e8123360d..6db6e12abae 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index aadf42b3288..2c53f7b8c3e 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 5ca303426af..eaa98985cea 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index fd686b16ab9..718f1cfeb50 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index c744cde1e55..040d2f10a1d 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 5abee688c58..ca4fc60e376 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index a7dfaab543c..389b0eee6d4 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index 1bb96cf32a0..056d1f2f158 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index 925d1e571b0..cf307f2497e 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml @@ -58,37 +58,37 @@ ca.uhn.hapi.fhir hapi-fhir-structures-dstu3 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ca.uhn.hapi.fhir hapi-fhir-structures-hl7org-dstu2 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ca.uhn.hapi.fhir hapi-fhir-structures-r4 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ca.uhn.hapi.fhir hapi-fhir-structures-r5 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu3 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - 5.5.0-PRE8-SNAPSHOT + 5.5.0 org.apache.velocity diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index d146b6d212f..53b48277dea 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/pom.xml b/pom.xml index 910eeb19a09..f81ff8d03ce 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 5.5.0-PRE8-SNAPSHOT + 5.5.0 HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io diff --git a/restful-server-example/pom.xml b/restful-server-example/pom.xml index 33b1327122f..da11b4ab4cf 100644 --- a/restful-server-example/pom.xml +++ b/restful-server-example/pom.xml @@ -8,7 +8,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../pom.xml diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index a98aefd37d4..cb1f01a0026 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index ebf3603865b..f748df5ff68 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index b78b5fb465a..9a78104a2bf 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.5.0-PRE8-SNAPSHOT + 5.5.0 ../../pom.xml From 1f7fb52d91b52619ab1afe61bea8b7d3885c07ff Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 17 Aug 2021 16:45:12 -0400 Subject: [PATCH 23/49] set version map to check all partitions --- .../uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java index aa2c9ef2ad9..cb82083e24e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/cache/ResourceVersionSvcDaoImpl.java @@ -20,6 +20,7 @@ package ca.uhn.fhir.jpa.cache; * #L% */ +import ca.uhn.fhir.interceptor.model.RequestPartitionId; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.dao.data.IResourceTableDao; @@ -28,6 +29,7 @@ import ca.uhn.fhir.jpa.partition.SystemRequestDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.util.QueryChunker; import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import org.slf4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -36,12 +38,15 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; +import static org.slf4j.LoggerFactory.getLogger; + /** * This service builds a map of resource ids to versions based on a SearchParameterMap. * It is used by the in-memory resource-version cache to detect when resource versions have been changed by remote processes. */ @Service public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc { + private static final Logger ourLog = getLogger(ResourceVersionSvcDaoImpl.class); @Autowired DaoRegistry myDaoRegistry; @@ -53,7 +58,11 @@ public class ResourceVersionSvcDaoImpl implements IResourceVersionSvc { public ResourceVersionMap getVersionMap(String theResourceName, SearchParameterMap theSearchParamMap) { IFhirResourceDao dao = myDaoRegistry.getResourceDao(theResourceName); - List matchingIds = dao.searchForIds(theSearchParamMap, new SystemRequestDetails()).stream() + if (ourLog.isDebugEnabled()) { + ourLog.debug("About to retrieve version map for resource type: {}", theResourceName); + } + + List matchingIds = dao.searchForIds(theSearchParamMap, new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.allPartitions())).stream() .map(ResourcePersistentId::getIdAsLong) .collect(Collectors.toList()); From e92fd47b16d2b00e3861433f9ebcb87bc1361625 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Tue, 17 Aug 2021 18:07:23 -0400 Subject: [PATCH 24/49] Bump core ver --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f81ff8d03ce..90b82a4eca4 100644 --- a/pom.xml +++ b/pom.xml @@ -747,7 +747,7 @@ - 5.4.0 + 5.4.10-SNAPSHOT 1.0.3 -Dfile.encoding=UTF-8 -Xmx2048m From 367b338d854396b3741e15057e5b4d836425c308 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Wed, 18 Aug 2021 11:06:14 -0400 Subject: [PATCH 25/49] Updating HAPI to use latest core lib changes. --- .../cli/ExportConceptMapToCsvCommand.java | 4 +- .../cli/ImportCsvToConceptMapCommand.java | 4 +- .../VersionedApiConverterInterceptor.java | 34 ++++++++--------- ... => NullVersionConverterAdvisor10_30.java} | 5 +-- ... => NullVersionConverterAdvisor10_40.java} | 5 +-- ... => NullVersionConverterAdvisor10_50.java} | 6 +-- .../converter/VersionConvertor_10_30Test.java | 6 +-- .../converter/VersionConvertor_14_30Test.java | 4 +- .../uhn/hapi/fhir/docs/ConverterExamples.java | 24 ++++++------ .../FhirResourceDaoSearchParameterDstu2.java | 13 +------ .../dstu3/FhirResourceDaoCodeSystemDstu3.java | 16 ++++---- .../dstu3/FhirResourceDaoConceptMapDstu3.java | 8 ++-- .../FhirResourceDaoSearchParameterDstu3.java | 12 ++---- .../dstu3/FhirResourceDaoValueSetDstu3.java | 11 +++--- .../dao/r5/FhirResourceDaoCodeSystemR5.java | 3 +- .../dao/r5/FhirResourceDaoConceptMapR5.java | 4 +- .../r5/FhirResourceDaoSearchParameterR5.java | 11 ++---- .../jpa/dao/r5/FhirResourceDaoValueSetR5.java | 10 ++--- .../provider/TerminologyUploaderProvider.java | 11 +++--- ...aseJpaResourceProviderConceptMapDstu3.java | 38 +++++++++---------- .../dstu3/JpaResourceProviderDstu3.java | 2 - .../dstu3/JpaSystemProviderDstu3.java | 1 - .../BaseJpaResourceProviderConceptMapR5.java | 37 +++++++++--------- .../uhn/fhir/jpa/term/TermReadSvcDstu3.java | 23 +++++------ .../ca/uhn/fhir/jpa/term/TermReadSvcR5.java | 24 ++++++------ .../jpa/term/TermVersionAdapterSvcDstu3.java | 14 +++---- .../jpa/term/TermVersionAdapterSvcR5.java | 7 ++-- .../validation/ValidatorResourceFetcher.java | 23 ++++++----- .../fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java | 8 ++-- .../fhir/rest/openapi/OpenApiInterceptor.java | 9 ++--- .../provider/BaseMultiUrlProcessor.java | 2 +- .../rest/server/provider/ReindexProvider.java | 2 +- .../fhir/r5/hapi/ctx/HapiWorkerContext.java | 19 +++++++++- .../CommonCodeSystemsTerminologyService.java | 9 +++-- ...oryTerminologyServerValidationSupport.java | 35 ++++++++--------- .../VersionSpecificWorkerContextWrapper.java | 23 +++++++++-- .../validator/VersionTypeConverterDstu21.java | 6 +-- .../validator/VersionTypeConverterDstu3.java | 6 +-- .../validator/VersionTypeConverterR4.java | 6 +-- .../FhirInstanceValidatorDstu3Test.java | 8 ++-- .../FhirInstanceValidatorR4Test.java | 8 ++-- .../FhirInstanceValidatorR5Test.java | 8 ++-- 42 files changed, 255 insertions(+), 254 deletions(-) rename hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/{NullVersionConverterAdvisor30.java => NullVersionConverterAdvisor10_30.java} (88%) rename hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/{NullVersionConverterAdvisor40.java => NullVersionConverterAdvisor10_40.java} (88%) rename hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/{NullVersionConverterAdvisor50.java => NullVersionConverterAdvisor10_50.java} (88%) diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommand.java index 3a4300d5546..e779c26d632 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ExportConceptMapToCsvCommand.java @@ -26,6 +26,7 @@ import org.apache.commons.cli.Options; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVPrinter; import org.apache.commons.csv.QuoteMode; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.ConceptMap; @@ -42,7 +43,6 @@ import java.util.List; import java.util.concurrent.ExecutionException; import static org.apache.commons.lang3.StringUtils.defaultString; -import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap; public class ExportConceptMapToCsvCommand extends AbstractImportExportCsvConceptMapCommand { // TODO: Don't use qualified names for loggers in HAPI CLI. @@ -110,7 +110,7 @@ public class ExportConceptMapToCsvCommand extends AbstractImportExportCsvConcept private void convertConceptMapToCsv(org.hl7.fhir.dstu3.model.ConceptMap theConceptMap) throws ExecutionException { try { - convertConceptMapToCsv(convertConceptMap(theConceptMap)); + convertConceptMapToCsv((ConceptMap) VersionConvertorFactory_30_40.convertResource(theConceptMap)); } catch (FHIRException fe) { throw new ExecutionException(fe); } diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommand.java b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommand.java index 86166b29baa..08d6d35700d 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommand.java +++ b/hapi-fhir-cli/hapi-fhir-cli-api/src/main/java/ca/uhn/fhir/cli/ImportCsvToConceptMapCommand.java @@ -28,6 +28,7 @@ import org.apache.commons.cli.Options; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.apache.commons.csv.CSVRecord; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.ConceptMap; import org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent; @@ -47,7 +48,6 @@ import java.util.concurrent.ExecutionException; import static org.apache.commons.lang3.StringUtils.defaultString; import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; -import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap; public class ImportCsvToConceptMapCommand extends AbstractImportExportCsvConceptMapCommand { // TODO: Don't use qualified names for loggers in HAPI CLI. @@ -152,7 +152,7 @@ public class ImportCsvToConceptMapCommand extends AbstractImportExportCsvConcept private org.hl7.fhir.dstu3.model.ConceptMap convertCsvToConceptMapDstu3() throws ExecutionException { try { - return convertConceptMap(convertCsvToConceptMapR4()); + return (org.hl7.fhir.dstu3.model.ConceptMap) VersionConvertorFactory_30_40.convertResource(convertCsvToConceptMapR4()); } catch (FHIRException fe) { throw new ExecutionException(fe); } diff --git a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptor.java b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptor.java index a078a966317..0ff8a6dd3bd 100644 --- a/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptor.java +++ b/hapi-fhir-converter/src/main/java/ca/uhn/hapi/converters/server/VersionedApiConverterInterceptor.java @@ -29,11 +29,11 @@ import ca.uhn.fhir.rest.api.server.ResponseDetails; import ca.uhn.fhir.rest.server.exceptions.AuthenticationException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.interceptor.InterceptorAdapter; -import org.hl7.fhir.converter.NullVersionConverterAdvisor30; -import org.hl7.fhir.converter.NullVersionConverterAdvisor40; -import org.hl7.fhir.convertors.VersionConvertor_10_30; -import org.hl7.fhir.convertors.VersionConvertor_10_40; -import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.converter.NullVersionConverterAdvisor10_30; +import org.hl7.fhir.converter.NullVersionConverterAdvisor10_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -42,9 +42,7 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.StringTokenizer; -import static org.apache.commons.lang3.StringUtils.defaultString; -import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.apache.commons.lang3.StringUtils.isNotBlank; +import static org.apache.commons.lang3.StringUtils.*; /** * This is an experimental interceptor! Use with caution as @@ -58,12 +56,12 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank; public class VersionedApiConverterInterceptor extends InterceptorAdapter { private final FhirContext myCtxDstu2; private final FhirContext myCtxDstu2Hl7Org; - private final NullVersionConverterAdvisor40 advisor40; - private final NullVersionConverterAdvisor30 advisor30; + private final NullVersionConverterAdvisor10_40 advisor40; + private final NullVersionConverterAdvisor10_30 advisor30; public VersionedApiConverterInterceptor() { - advisor40 = new NullVersionConverterAdvisor40(); - advisor30 = new NullVersionConverterAdvisor30(); + advisor40 = new NullVersionConverterAdvisor10_40(); + advisor30 = new NullVersionConverterAdvisor10_30(); myCtxDstu2 = FhirContext.forDstu2(); myCtxDstu2Hl7Org = FhirContext.forDstu2Hl7Org(); @@ -104,17 +102,17 @@ public class VersionedApiConverterInterceptor extends InterceptorAdapter { IBaseResource converted = null; try { if (wantVersion == FhirVersionEnum.R4 && haveVersion == FhirVersionEnum.DSTU3) { - converted = VersionConvertor_30_40.convertResource(toDstu3(responseResource), true); + converted = VersionConvertorFactory_30_40.convertResource(toDstu3(responseResource)); } else if (wantVersion == FhirVersionEnum.DSTU3 && haveVersion == FhirVersionEnum.R4) { - converted = VersionConvertor_30_40.convertResource(toR4(responseResource), true); + converted = VersionConvertorFactory_30_40.convertResource(toR4(responseResource)); } else if (wantVersion == FhirVersionEnum.DSTU2 && haveVersion == FhirVersionEnum.R4) { - converted = VersionConvertor_10_40.convertResource(toR4(responseResource), advisor40); + converted = VersionConvertorFactory_10_40.convertResource(toR4(responseResource), advisor40); } else if (wantVersion == FhirVersionEnum.R4 && haveVersion == FhirVersionEnum.DSTU2) { - converted = VersionConvertor_10_40.convertResource(toDstu2(responseResource), advisor40); + converted = VersionConvertorFactory_10_40.convertResource(toDstu2(responseResource), advisor40); } else if (wantVersion == FhirVersionEnum.DSTU2 && haveVersion == FhirVersionEnum.DSTU3) { - converted = VersionConvertor_10_30.convertResource(toDstu3(responseResource), advisor30); + converted = VersionConvertorFactory_10_30.convertResource(toDstu3(responseResource), advisor30); } else if (wantVersion == FhirVersionEnum.DSTU3 && haveVersion == FhirVersionEnum.DSTU2) { - converted = VersionConvertor_10_30.convertResource(toDstu2(responseResource), advisor30); + converted = VersionConvertorFactory_10_30.convertResource(toDstu2(responseResource), advisor30); } } catch (FHIRException e) { throw new InternalErrorException(e); diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor30.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_30.java similarity index 88% rename from hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor30.java rename to hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_30.java index 2ec5545079b..72930492e2b 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor30.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_30.java @@ -20,8 +20,7 @@ package org.hl7.fhir.converter; * #L% */ -import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor30; -import org.hl7.fhir.dstu2.model.Resource; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_30; import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.ValueSet; @@ -31,7 +30,7 @@ import org.hl7.fhir.r5.model.FhirPublication; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class NullVersionConverterAdvisor30 implements VersionConvertorAdvisor30 { +public class NullVersionConverterAdvisor10_30 extends BaseAdvisor_10_30 { @Nullable diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor40.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_40.java similarity index 88% rename from hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor40.java rename to hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_40.java index eaa125676e6..05582993624 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor40.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_40.java @@ -20,8 +20,7 @@ package org.hl7.fhir.converter; * #L% */ -import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor40; -import org.hl7.fhir.dstu2.model.Resource; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; import org.hl7.fhir.r4.model.CodeSystem; @@ -31,7 +30,7 @@ import org.hl7.fhir.r5.model.FhirPublication; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class NullVersionConverterAdvisor40 implements VersionConvertorAdvisor40 { +public class NullVersionConverterAdvisor10_40 extends BaseAdvisor_10_40 { @Nullable diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor50.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_50.java similarity index 88% rename from hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor50.java rename to hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_50.java index 9e7aac2374f..3e4252e30b9 100644 --- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor50.java +++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/converter/NullVersionConverterAdvisor10_50.java @@ -20,8 +20,8 @@ package org.hl7.fhir.converter; * #L% */ -import org.hl7.fhir.convertors.advisors.VersionConvertorAdvisor50; -import org.hl7.fhir.dstu2.model.Resource; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50; +import org.hl7.fhir.convertors.conv10_50.VersionConvertor_10_50; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.model.Bundle; import org.hl7.fhir.r5.model.CodeSystem; @@ -32,7 +32,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.IdentityHashMap; -public class NullVersionConverterAdvisor50 implements VersionConvertorAdvisor50 { +public class NullVersionConverterAdvisor10_50 extends BaseAdvisor_10_50 { private IdentityHashMap myCodeSystems = new IdentityHashMap<>(); diff --git a/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_10_30Test.java b/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_10_30Test.java index d03a6f73173..f79807943a5 100644 --- a/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_10_30Test.java +++ b/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_10_30Test.java @@ -2,7 +2,7 @@ package org.hl7.fhir.converter; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.hl7.fhir.convertors.VersionConvertor_10_30; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30; import org.hl7.fhir.dstu3.model.*; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.dstu2.model.Resource; @@ -19,7 +19,7 @@ public class VersionConvertor_10_30Test { org.hl7.fhir.dstu2.model.Observation input = new org.hl7.fhir.dstu2.model.Observation(); input.setEncounter(new org.hl7.fhir.dstu2.model.Reference("Encounter/123")); - org.hl7.fhir.dstu3.model.Observation output = (Observation) VersionConvertor_10_30.convertResource(input); + org.hl7.fhir.dstu3.model.Observation output = (Observation) VersionConvertorFactory_10_30.convertResource(input); String context = output.getContext().getReference(); assertEquals("Encounter/123", context); @@ -52,7 +52,7 @@ public class VersionConvertor_10_30Test { Specimen.SpecimenContainerComponent specimenContainerComponent = new Specimen.SpecimenContainerComponent(); specimenContainerComponent.getExtension().add(new Extension().setUrl("some_url").setValue(new StringType("some_value"))); spec.setContainer(Collections.singletonList(specimenContainerComponent)); - Resource resource = VersionConvertor_10_30.convertResource(spec); + Resource resource = VersionConvertorFactory_10_30.convertResource(spec); } diff --git a/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_14_30Test.java b/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_14_30Test.java index f896e422830..1568f6dbc9b 100644 --- a/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_14_30Test.java +++ b/hapi-fhir-converter/src/test/java/org/hl7/fhir/converter/VersionConvertor_14_30Test.java @@ -2,7 +2,7 @@ package org.hl7.fhir.converter; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.hl7.fhir.convertors.VersionConvertor_14_30; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30; import org.hl7.fhir.dstu3.model.Questionnaire; import org.hl7.fhir.exceptions.FHIRException; import org.junit.jupiter.api.Test; @@ -15,7 +15,7 @@ public class VersionConvertor_14_30Test { org.hl7.fhir.dstu2016may.model.Questionnaire input = new org.hl7.fhir.dstu2016may.model.Questionnaire(); input.setTitle("My title"); - org.hl7.fhir.dstu3.model.Questionnaire output = (Questionnaire) VersionConvertor_14_30.convertResource(input); + org.hl7.fhir.dstu3.model.Questionnaire output = (Questionnaire) VersionConvertorFactory_14_30.convertResource(input); String context = output.getTitle(); assertEquals("My title", context); diff --git a/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ConverterExamples.java b/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ConverterExamples.java index 6761a7674d0..a72e430c9dc 100644 --- a/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ConverterExamples.java +++ b/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ConverterExamples.java @@ -20,36 +20,38 @@ package ca.uhn.hapi.fhir.docs; * #L% */ -import org.hl7.fhir.convertors.conv10_30.Observation10_30; -import org.hl7.fhir.convertors.conv14_30.Questionnaire14_30; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_30; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30; +import org.hl7.fhir.dstu3.model.Observation; +import org.hl7.fhir.dstu3.model.Questionnaire; import org.hl7.fhir.exceptions.FHIRException; public class ConverterExamples { @SuppressWarnings("unused") public void c1020() throws FHIRException { - //START SNIPPET: 1020 + //START SNIPPET: 1020 // Create an input resource to convert org.hl7.fhir.dstu2.model.Observation input = new org.hl7.fhir.dstu2.model.Observation(); input.setEncounter(new org.hl7.fhir.dstu2.model.Reference("Encounter/123")); - + // Convert the resource - org.hl7.fhir.dstu3.model.Observation output = Observation10_30.convertObservation(input); + org.hl7.fhir.dstu3.model.Observation output = (Observation) VersionConvertorFactory_10_30.convertResource(input); String context = output.getContext().getReference(); - //END SNIPPET: 1020 + //END SNIPPET: 1020 } - + @SuppressWarnings("unused") public void c1420() throws FHIRException { - //START SNIPPET: 1420 + //START SNIPPET: 1420 // Create a resource to convert org.hl7.fhir.dstu2016may.model.Questionnaire input = new org.hl7.fhir.dstu2016may.model.Questionnaire(); input.setTitle("My title"); - + // Convert the resource - org.hl7.fhir.dstu3.model.Questionnaire output = Questionnaire14_30.convertQuestionnaire(input); + org.hl7.fhir.dstu3.model.Questionnaire output = (Questionnaire) VersionConvertorFactory_14_30.convertResource(input); String context = output.getTitle(); - //END SNIPPET: 1420 + //END SNIPPET: 1420 } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java index c45af7dcbe7..00e3fa05172 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java @@ -22,22 +22,13 @@ package ca.uhn.fhir.jpa.dao; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoSearchParameter; -import ca.uhn.fhir.jpa.api.dao.IFhirSystemDao; import ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoSearchParameterR4; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor; import ca.uhn.fhir.model.dstu2.resource.SearchParameter; -import ca.uhn.fhir.model.dstu2.valueset.ResourceTypeEnum; -import ca.uhn.fhir.model.dstu2.valueset.SearchParamTypeEnum; -import ca.uhn.fhir.model.primitive.BoundCodeDt; -import org.hl7.fhir.convertors.conv10_40.SearchParameter10_40; -import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40; import org.springframework.beans.factory.annotation.Autowired; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank; @@ -79,7 +70,7 @@ public class FhirResourceDaoSearchParameterDstu2 extends BaseHapiFhirResourceDao String encoded = getContext().newJsonParser().encodeResourceToString(theResource); org.hl7.fhir.dstu2.model.SearchParameter hl7Org = myDstu2Hl7OrgContext.newJsonParser().parseResource(org.hl7.fhir.dstu2.model.SearchParameter.class, encoded); - org.hl7.fhir.r4.model.SearchParameter convertedSp = SearchParameter10_40.convertSearchParameter(hl7Org); + org.hl7.fhir.r4.model.SearchParameter convertedSp = (org.hl7.fhir.r4.model.SearchParameter) VersionConvertorFactory_10_40.convertResource(hl7Org); if (isBlank(convertedSp.getExpression()) && isNotBlank(hl7Org.getXpath())) { convertedSp.setExpression(hl7Org.getXpath()); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java index bc974652bf7..50a16b2a4f3 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java @@ -27,16 +27,17 @@ import ca.uhn.fhir.context.support.ValidationSupportContext; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoCodeSystem; import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; -import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; -import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.jpa.model.entity.ResourceTable; -import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.jpa.searchparam.SearchParameterMap; import ca.uhn.fhir.jpa.term.api.ITermCodeSystemStorageSvc; +import ca.uhn.fhir.jpa.term.api.ITermDeferredStorageSvc; import ca.uhn.fhir.jpa.util.LogicUtil; import ca.uhn.fhir.rest.api.server.RequestDetails; +import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; +import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeableConcept; import org.hl7.fhir.dstu3.model.Coding; @@ -53,7 +54,6 @@ import java.util.List; import java.util.Set; import static org.apache.commons.lang3.StringUtils.isNotBlank; -import static org.hl7.fhir.convertors.conv30_40.CodeSystem30_40.convertCodeSystem; @Transactional public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoCodeSystem { @@ -146,7 +146,7 @@ public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao theCodeSystemUrl, IPrimitiveType theVersion, IPrimitiveType theCode, - IPrimitiveType theDisplay, Coding theCoding, CodeableConcept theCodeableConcept, RequestDetails theRequestDetails) { + public CodeValidationResult validateCode(IIdType theCodeSystemId, IPrimitiveType theCodeSystemUrl, IPrimitiveType theVersion, IPrimitiveType theCode, + IPrimitiveType theDisplay, Coding theCoding, CodeableConcept theCodeableConcept, RequestDetails theRequestDetails) { throw new UnsupportedOperationException(); } - + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java index 4750d9bb0dc..d98ec89c2a6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java @@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.dao.dstu3; * #L% */ +import ca.uhn.fhir.context.support.TranslateConceptResults; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap; import ca.uhn.fhir.jpa.api.model.TranslationRequest; -import ca.uhn.fhir.context.support.TranslateConceptResults; import ca.uhn.fhir.jpa.dao.BaseHapiFhirResourceDao; import ca.uhn.fhir.jpa.model.cross.IBasePersistedResource; import ca.uhn.fhir.jpa.model.entity.ResourceTable; @@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.term.api.ITermConceptMappingSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -37,8 +38,6 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.Date; -import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap; - public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoConceptMap { @Autowired private ITermConceptMappingSvc myTermConceptMappingSvc; @@ -53,7 +52,6 @@ public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao implements IFhirResourceDaoValueSet { @@ -54,15 +53,15 @@ public class FhirResourceDaoValueSetDstu3 extends BaseHapiFhirResourceDao @Override public ValueSet expandByIdentifier(String theUri, ValueSetExpansionOptions theOptions) { org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, theUri); - return ValueSet40_50.convertValueSet(canonicalOutput); + return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput); } @Override public ValueSet expand(ValueSet theSource, ValueSetExpansionOptions theOptions) { - org.hl7.fhir.r4.model.ValueSet canonicalInput = ValueSet40_50.convertValueSet(theSource); + org.hl7.fhir.r4.model.ValueSet canonicalInput = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theSource); org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, canonicalInput); - return ValueSet40_50.convertValueSet(canonicalOutput); + return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput); } @Override @@ -82,7 +82,7 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao if (getConfig().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) { if (retVal.getDeleted() == null) { ValueSet valueSet = (ValueSet) theResource; - myTerminologySvc.storeTermValueSet(retVal, org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSet)); + myTerminologySvc.storeTermValueSet(retVal, (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet)); } else { myTerminologySvc.deleteValueSetAndChildren(retVal); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java index 806ace404ac..f9104a94cce 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java @@ -40,6 +40,8 @@ import ca.uhn.fhir.util.ValidateUtil; import com.google.common.base.Charsets; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.ICompositeType; @@ -58,10 +60,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.apache.commons.lang3.StringUtils.isNotBlank; -import static org.apache.commons.lang3.StringUtils.trim; -import static org.hl7.fhir.convertors.conv30_40.CodeSystem30_40.convertCodeSystem; +import static org.apache.commons.lang3.StringUtils.*; public class TerminologyUploaderProvider extends BaseJpaProvider { @@ -308,10 +307,10 @@ public class TerminologyUploaderProvider extends BaseJpaProvider { CodeSystem nextCodeSystem; switch (getContext().getVersion().getVersion()) { case DSTU3: - nextCodeSystem = convertCodeSystem((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem); + nextCodeSystem = (CodeSystem) VersionConvertorFactory_30_40.convertResource((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem); break; case R5: - nextCodeSystem = org.hl7.fhir.convertors.conv40_50.CodeSystem40_50.convertCodeSystem((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem); + nextCodeSystem = (CodeSystem) VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem); break; default: nextCodeSystem = (CodeSystem) theCodeSystem; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java index dd7f18e713b..94ddfdf4d18 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java @@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.provider.dstu3; * #L% */ +import ca.uhn.fhir.context.support.TranslateConceptResults; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap; import ca.uhn.fhir.jpa.api.model.TranslationRequest; -import ca.uhn.fhir.context.support.TranslateConceptResults; import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl; import ca.uhn.fhir.rest.annotation.IdParam; @@ -31,7 +31,7 @@ import ca.uhn.fhir.rest.annotation.OperationParam; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import org.hl7.fhir.convertors.VersionConvertor_30_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.BooleanType; import org.hl7.fhir.dstu3.model.CodeType; import org.hl7.fhir.dstu3.model.CodeableConcept; @@ -45,8 +45,6 @@ import org.hl7.fhir.exceptions.FHIRException; import javax.servlet.http.HttpServletRequest; -import static org.hl7.fhir.convertors.conv30_40.Parameters30_40.convertParameters; - public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderDstu3 { @Operation(name = JpaConstants.OPERATION_TRANSLATE, idempotent = true, returnParameters = { @OperationParam(name = "result", type = BooleanType.class, min = 1, max = 1), @@ -82,7 +80,7 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD && theSourceValueSet.hasValue(); boolean haveSourceCoding = theSourceCoding != null && theSourceCoding.hasCode(); - boolean haveSourceCodeableConcept= theSourceCodeableConcept != null + boolean haveSourceCodeableConcept = theSourceCodeableConcept != null && theSourceCodeableConcept.hasCoding() && theSourceCodeableConcept.getCodingFirstRep().hasCode(); boolean haveTargetValueSet = theTargetValueSet != null @@ -100,46 +98,46 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD TranslationRequest translationRequest = new TranslationRequest(); try { - + if (haveUrl) { - translationRequest.setUrl(VersionConvertor_30_40.convertUri(theUrl)); + translationRequest.setUrl((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theUrl)); } - + if (haveConceptMapVersion) { - translationRequest.setConceptMapVersion(VersionConvertor_30_40.convertString(theConceptMapVersion)); + translationRequest.setConceptMapVersion((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theConceptMapVersion)); } - + // Convert from DSTU3 to R4 if (haveSourceCode) { - translationRequest.getCodeableConcept().addCoding().setCodeElement(VersionConvertor_30_40.convertCode(theSourceCode)); + translationRequest.getCodeableConcept().addCoding().setCodeElement((org.hl7.fhir.r4.model.CodeType) VersionConvertorFactory_30_40.convertType(theSourceCode)); if (haveSourceCodeSystem) { - translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement(VersionConvertor_30_40.convertUri(theSourceCodeSystem)); + translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystem)); } if (haveSourceCodeSystemVersion) { - translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement(VersionConvertor_30_40.convertString(theSourceCodeSystemVersion)); + translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystemVersion)); } } else if (haveSourceCoding) { - translationRequest.getCodeableConcept().addCoding(VersionConvertor_30_40.convertCoding(theSourceCoding)); + translationRequest.getCodeableConcept().addCoding((org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType(theSourceCoding)); } else { - translationRequest.setCodeableConcept(VersionConvertor_30_40.convertCodeableConcept(theSourceCodeableConcept)); + translationRequest.setCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_30_40.convertType(theSourceCodeableConcept)); } if (haveSourceValueSet) { - translationRequest.setSource(VersionConvertor_30_40.convertUri(theSourceValueSet)); + translationRequest.setSource((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceValueSet)); } if (haveTargetValueSet) { - translationRequest.setTarget(VersionConvertor_30_40.convertUri(theTargetValueSet)); + translationRequest.setTarget((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetValueSet)); } if (haveTargetCodeSystem) { - translationRequest.setTargetSystem(VersionConvertor_30_40.convertUri(theTargetCodeSystem)); + translationRequest.setTargetSystem((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetCodeSystem)); } if (haveReverse) { - translationRequest.setReverse(VersionConvertor_30_40.convertBoolean(theReverse)); + translationRequest.setReverse((org.hl7.fhir.r4.model.BooleanType) VersionConvertorFactory_30_40.convertType(theReverse)); } if (haveId) { @@ -155,7 +153,7 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD TranslateConceptResults result = dao.translate(translationRequest, theRequestDetails); // Convert from R4 to DSTU3 - return convertParameters(TermConceptMappingSvcImpl.toParameters(result)); + return (Parameters) VersionConvertorFactory_30_40.convertResource(TermConceptMappingSvcImpl.toParameters(result)); } catch (FHIRException fe) { throw new InternalErrorException(fe); } finally { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaResourceProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaResourceProviderDstu3.java index cc96142c495..b9c118d3de8 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaResourceProviderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaResourceProviderDstu3.java @@ -24,8 +24,6 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.provider.BaseJpaResourceProvider; import org.hl7.fhir.instance.model.api.IAnyResource; -import static org.hl7.fhir.convertors.conv30_40.Parameters30_40.convertParameters; - public class JpaResourceProviderDstu3 extends BaseJpaResourceProvider { public JpaResourceProviderDstu3() { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java index e622c3d82dc..3a18e6c6da9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java @@ -24,7 +24,6 @@ import java.util.Map.Entry; import java.util.TreeMap; import static org.apache.commons.lang3.ObjectUtils.defaultIfNull; -import static org.hl7.fhir.convertors.conv30_40.Parameters30_40.convertParameters; /* * #%L diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java index 4e80fe87662..50e1c3754c0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java @@ -20,9 +20,9 @@ package ca.uhn.fhir.jpa.provider.r5; * #L% */ +import ca.uhn.fhir.context.support.TranslateConceptResults; import ca.uhn.fhir.jpa.api.dao.IFhirResourceDaoConceptMap; import ca.uhn.fhir.jpa.api.model.TranslationRequest; -import ca.uhn.fhir.context.support.TranslateConceptResults; import ca.uhn.fhir.jpa.model.util.JpaConstants; import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl; import ca.uhn.fhir.rest.annotation.IdParam; @@ -30,7 +30,7 @@ import ca.uhn.fhir.rest.annotation.Operation; import ca.uhn.fhir.rest.annotation.OperationParam; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.r5.model.BooleanType; import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.CodeableConcept; @@ -52,7 +52,7 @@ public class BaseJpaResourceProviderConceptMapR5 extends JpaResourceProviderR5 dao = (IFhirResourceDaoConceptMap) getDao(); TranslateConceptResults result = dao.translate(translationRequest, theRequestDetails); org.hl7.fhir.r4.model.Parameters parameters = TermConceptMappingSvcImpl.toParameters(result); - return org.hl7.fhir.convertors.conv40_50.Parameters40_50.convertParameters(parameters); + return (Parameters) VersionConvertorFactory_40_50.convertResource(parameters); } finally { endRequest(theServletRequest); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java index 5ed129c071e..1fe9e1dfe12 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java @@ -9,8 +9,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.api.ITermReadSvcDstu3; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.ValidateUtil; -import org.hl7.fhir.convertors.VersionConvertor_30_40; -import org.hl7.fhir.convertors.conv30_40.CodeSystem30_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeableConcept; import org.hl7.fhir.dstu3.model.Coding; @@ -25,8 +24,6 @@ import org.springframework.transaction.PlatformTransactionManager; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import static org.hl7.fhir.convertors.conv30_40.ValueSet30_40.convertValueSet; - /* * #%L * HAPI FHIR JPA Server @@ -67,7 +64,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation org.hl7.fhir.r4.model.ValueSet valueSetToExpandR4; valueSetToExpandR4 = toCanonicalValueSet(theValueSetToExpand); org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, valueSetToExpandR4); - return new ValueSetExpansionOutcome(convertValueSet(expandedR4), null); + return new ValueSetExpansionOutcome(VersionConvertorFactory_30_40.convertResource(expandedR4), null); } catch (FHIRException e) { throw new InternalErrorException(e); } @@ -81,7 +78,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation org.hl7.fhir.r4.model.ValueSet valueSetToExpandR4; valueSetToExpandR4 = toCanonicalValueSet(valueSetToExpand); org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, valueSetToExpandR4); - return convertValueSet(expandedR4); + return VersionConvertorFactory_30_40.convertResource(expandedR4); } catch (FHIRException e) { throw new InternalErrorException(e); } @@ -90,31 +87,31 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation @Override protected org.hl7.fhir.r4.model.ValueSet toCanonicalValueSet(IBaseResource theValueSet) throws FHIRException { org.hl7.fhir.r4.model.ValueSet valueSetToExpandR4; - valueSetToExpandR4 = convertValueSet((ValueSet) theValueSet); + valueSetToExpandR4 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource((ValueSet) theValueSet); return valueSetToExpandR4; } @Override protected org.hl7.fhir.r4.model.CodeSystem toCanonicalCodeSystem(IBaseResource theCodeSystem) { - return CodeSystem30_40.convertCodeSystem((CodeSystem)theCodeSystem); + return (org.hl7.fhir.r4.model.CodeSystem) VersionConvertorFactory_30_40.convertResource((CodeSystem)theCodeSystem); } @Override @Nullable protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseDatatype theCoding) { - return VersionConvertor_30_40.convertCoding((org.hl7.fhir.dstu3.model.Coding) theCoding); + return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType((Coding) theCoding); } @Override @Nullable protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseCoding theCoding) { - return VersionConvertor_30_40.convertCoding((org.hl7.fhir.dstu3.model.Coding) theCoding); + return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType((org.hl7.fhir.dstu3.model.Coding) theCoding); } @Override @Nullable protected org.hl7.fhir.r4.model.CodeableConcept toCanonicalCodeableConcept(IBaseDatatype theCoding) { - return VersionConvertor_30_40.convertCodeableConcept((org.hl7.fhir.dstu3.model.CodeableConcept) theCoding); + return (org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_30_40.convertType((CodeableConcept) theCoding); } @@ -160,7 +157,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation public IValidationSupport.CodeValidationResult validateCodeIsInPreExpandedValueSet(ConceptValidationOptions theOptions, IBaseResource theValueSet, String theSystem, String theCode, String theDisplay, IBaseDatatype theCoding, IBaseDatatype theCodeableConcept) { ValidateUtil.isNotNullOrThrowUnprocessableEntity(theValueSet, "ValueSet must not be null"); ValueSet valueSet = (ValueSet) theValueSet; - org.hl7.fhir.r4.model.ValueSet valueSetR4 = convertValueSet(valueSet); + org.hl7.fhir.r4.model.ValueSet valueSetR4 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource(valueSet); Coding coding = (Coding) theCoding; org.hl7.fhir.r4.model.Coding codingR4 = null; @@ -184,7 +181,7 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation public boolean isValueSetPreExpandedForCodeValidation(IBaseResource theValueSet) { ValidateUtil.isNotNullOrThrowUnprocessableEntity(theValueSet, "ValueSet must not be null"); ValueSet valueSet = (ValueSet) theValueSet; - org.hl7.fhir.r4.model.ValueSet valueSetR4 = convertValueSet(valueSet); + org.hl7.fhir.r4.model.ValueSet valueSetR4 = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_30_40.convertResource(valueSet); return super.isValueSetPreExpandedForCodeValidation(valueSetR4); } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java index 5c2f7c08d86..0463ce67dd4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java @@ -10,8 +10,7 @@ import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.term.api.ITermReadSvcR5; import ca.uhn.fhir.jpa.term.ex.ExpansionTooCostlyException; import ca.uhn.fhir.util.ValidateUtil; -import org.hl7.fhir.convertors.VersionConvertor_40_50; -import org.hl7.fhir.convertors.conv40_50.CodeSystem40_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IBaseCoding; import org.hl7.fhir.instance.model.api.IBaseDatatype; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -19,8 +18,6 @@ import org.hl7.fhir.r5.model.CodeSystem; import org.hl7.fhir.r5.model.CodeableConcept; import org.hl7.fhir.r5.model.Coding; import org.hl7.fhir.r5.model.ValueSet; -import org.hl7.fhir.utilities.TerminologyServiceOptions; -import org.hl7.fhir.utilities.validation.ValidationOptions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.PlatformTransactionManager; @@ -59,15 +56,16 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup @Transactional(dontRollbackOn = {ExpansionTooCostlyException.class}) public ValueSetExpansionOutcome expandValueSet(ValidationSupportContext theValidationSupportContext, ValueSetExpansionOptions theExpansionOptions, @Nonnull IBaseResource theValueSetToExpand) { ValueSet valueSetToExpand = (ValueSet) theValueSetToExpand; - org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSetToExpand)); - return new ValueSetExpansionOutcome(org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(expandedR4)); + org.hl7.fhir.r4.model.ValueSet expandedR4 = super.expandValueSet(theExpansionOptions, + (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSetToExpand)); + return new ValueSetExpansionOutcome(VersionConvertorFactory_40_50.convertResource(expandedR4)); } @Override public IBaseResource expandValueSet(ValueSetExpansionOptions theExpansionOptions, IBaseResource theInput) { org.hl7.fhir.r4.model.ValueSet valueSetToExpand = toCanonicalValueSet(theInput); org.hl7.fhir.r4.model.ValueSet valueSetR4 = super.expandValueSet(theExpansionOptions, valueSetToExpand); - return org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSetR4); + return VersionConvertorFactory_40_50.convertResource(valueSetR4); } @Override @@ -79,7 +77,7 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup @Override protected org.hl7.fhir.r4.model.ValueSet getValueSetFromResourceTable(ResourceTable theResourceTable) { ValueSet valueSetR5 = myDaoRegistry.getResourceDao("ValueSet").toResource(ValueSet.class, theResourceTable, null, false); - return org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(valueSetR5); + return (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSetR5); } @Override @@ -110,30 +108,30 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup @Override @Nullable protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseDatatype theCoding) { - return VersionConvertor_40_50.convertCoding((Coding) theCoding); + return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_40_50.convertType((Coding) theCoding); } @Override @Nullable protected org.hl7.fhir.r4.model.Coding toCanonicalCoding(IBaseCoding theCoding) { - return VersionConvertor_40_50.convertCoding((Coding) theCoding); + return (org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_40_50.convertType((Coding) theCoding); } @Override @Nullable protected org.hl7.fhir.r4.model.CodeableConcept toCanonicalCodeableConcept(IBaseDatatype theCoding) { - return VersionConvertor_40_50.convertCodeableConcept((CodeableConcept) theCoding); + return (org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_40_50.convertType((CodeableConcept) theCoding); } @Override protected org.hl7.fhir.r4.model.ValueSet toCanonicalValueSet(IBaseResource theValueSet) throws org.hl7.fhir.exceptions.FHIRException { - return org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet((ValueSet) theValueSet); + return (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource((ValueSet) theValueSet); } @Override protected org.hl7.fhir.r4.model.CodeSystem toCanonicalCodeSystem(IBaseResource theCodeSystem) { - return CodeSystem40_50.convertCodeSystem((CodeSystem) theCodeSystem); + return (org.hl7.fhir.r4.model.CodeSystem) VersionConvertorFactory_40_50.convertResource((CodeSystem) theCodeSystem); } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java index 2933d256a7b..3c4c09b40c4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java @@ -25,6 +25,7 @@ import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.UrlUtil; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.dstu3.model.ValueSet; @@ -36,9 +37,6 @@ import org.springframework.context.event.ContextRefreshedEvent; import org.springframework.context.event.EventListener; import static org.apache.commons.lang3.StringUtils.isBlank; -import static org.hl7.fhir.convertors.conv30_40.CodeSystem30_40.convertCodeSystem; -import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap; -import static org.hl7.fhir.convertors.conv30_40.ValueSet30_40.convertValueSet; public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl implements ITermVersionAdapterSvc { @@ -56,7 +54,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im /** * Initialize the beans that are used by this service. - * + *

* Note: There is a circular dependency here where the CodeSystem DAO * needs terminology services, and the term services need the CodeSystem DAO. * So we look these up in a refresh event instead of just autowiring them @@ -70,11 +68,11 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im myConceptMapResourceDao = (IFhirResourceDao) myAppCtx.getBean("myConceptMapDaoDstu3"); } - @Override + @Override public IIdType createOrUpdateCodeSystem(org.hl7.fhir.r4.model.CodeSystem theCodeSystemResource, RequestDetails theRequestDetails) { CodeSystem resourceToStore; try { - resourceToStore = convertCodeSystem(theCodeSystemResource); + resourceToStore = (CodeSystem) VersionConvertorFactory_30_40.convertResource(theCodeSystemResource); } catch (FHIRException e) { throw new InternalErrorException(e); } @@ -91,7 +89,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im public void createOrUpdateConceptMap(org.hl7.fhir.r4.model.ConceptMap theConceptMap) { ConceptMap resourceToStore; try { - resourceToStore = convertConceptMap(theConceptMap); + resourceToStore = (ConceptMap) VersionConvertorFactory_30_40.convertResource(theConceptMap); } catch (FHIRException e) { throw new InternalErrorException(e); } @@ -107,7 +105,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im public void createOrUpdateValueSet(org.hl7.fhir.r4.model.ValueSet theValueSet) { ValueSet valueSetDstu3; try { - valueSetDstu3 = convertValueSet(theValueSet); + valueSetDstu3 = (ValueSet) VersionConvertorFactory_30_40.convertResource(theValueSet); } catch (FHIRException e) { throw new InternalErrorException(e); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java index f0664b99564..00316c41d5a 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.util.UrlUtil; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r5.model.CodeSystem; import org.hl7.fhir.r5.model.ConceptMap; @@ -63,7 +64,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple public IIdType createOrUpdateCodeSystem(org.hl7.fhir.r4.model.CodeSystem theCodeSystemResource, RequestDetails theRequestDetails) { validateCodeSystemForStorage(theCodeSystemResource); - CodeSystem codeSystemR4 = org.hl7.fhir.convertors.conv40_50.CodeSystem40_50.convertCodeSystem(theCodeSystemResource); + CodeSystem codeSystemR4 = (CodeSystem) VersionConvertorFactory_40_50.convertResource(theCodeSystemResource); if (isBlank(theCodeSystemResource.getIdElement().getIdPart())) { String matchUrl = "CodeSystem?url=" + UrlUtil.escapeUrlParam(theCodeSystemResource.getUrl()); return myCodeSystemResourceDao.update(codeSystemR4, matchUrl, theRequestDetails).getId(); @@ -75,7 +76,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple @Override public void createOrUpdateConceptMap(org.hl7.fhir.r4.model.ConceptMap theConceptMap) { - ConceptMap conceptMapR4 = org.hl7.fhir.convertors.conv40_50.ConceptMap40_50.convertConceptMap(theConceptMap); + ConceptMap conceptMapR4 = (ConceptMap) VersionConvertorFactory_40_50.convertResource(theConceptMap); if (isBlank(theConceptMap.getIdElement().getIdPart())) { String matchUrl = "ConceptMap?url=" + UrlUtil.escapeUrlParam(theConceptMap.getUrl()); @@ -88,7 +89,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple @Override public void createOrUpdateValueSet(org.hl7.fhir.r4.model.ValueSet theValueSet) { - ValueSet valueSetR4 = org.hl7.fhir.convertors.conv40_50.ValueSet40_50.convertValueSet(theValueSet); + ValueSet valueSetR4 = (ValueSet) VersionConvertorFactory_40_50.convertResource(theValueSet); if (isBlank(theValueSet.getIdElement().getIdPart())) { String matchUrl = "ValueSet?url=" + UrlUtil.escapeUrlParam(theValueSet.getUrl()); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java index d10ad96f738..290adfab468 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/validation/ValidatorResourceFetcher.java @@ -27,7 +27,9 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper; +import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.IdType; import org.hl7.fhir.r5.elementmodel.Element; @@ -39,6 +41,9 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import javax.annotation.PostConstruct; +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URISyntaxException; import java.util.Locale; public class ValidatorResourceFetcher implements IResourceValidator.IValidatorResourceFetcher { @@ -60,10 +65,8 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe myVersionSpecificCOntextWrapper = VersionSpecificWorkerContextWrapper.newVersionSpecificWorkerContextWrapper(myValidationSupport); } - @Override - public Element fetch(Object appContext, String theUrl) throws FHIRException { - + public Element fetch(IResourceValidator iResourceValidator, Object appContext, String theUrl) throws FHIRFormatError, DefinitionException, FHIRException, IOException { IdType id = new IdType(theUrl); String resourceType = id.getResourceType(); IFhirResourceDao dao = myDaoRegistry.getResourceDao(resourceType); @@ -83,7 +86,8 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe } @Override - public IResourceValidator.ReferenceValidationPolicy validationPolicy(Object appContext, String path, String url) { + public IResourceValidator.ReferenceValidationPolicy validationPolicy(IResourceValidator iResourceValidator, + Object appContext, String path, String url) { int slashIdx = url.indexOf("/"); if (slashIdx > 0 && myFhirContext.getResourceTypes().contains(url.substring(0, slashIdx))) { return myValidationSettings.getLocalReferenceValidationDefaultPolicy(); @@ -93,12 +97,12 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe } @Override - public boolean resolveURL(Object appContext, String path, String url, String type) throws FHIRException { + public boolean resolveURL(IResourceValidator iResourceValidator, Object o, String s, String s1, String s2) throws IOException, FHIRException { return true; } @Override - public byte[] fetchRaw(String url) { + public byte[] fetchRaw(IResourceValidator iResourceValidator, String s) throws MalformedURLException, IOException { throw new UnsupportedOperationException(); } @@ -109,13 +113,12 @@ public class ValidatorResourceFetcher implements IResourceValidator.IValidatorRe } @Override - public CanonicalResource fetchCanonicalResource(String url) { - throw new UnsupportedOperationException(); + public CanonicalResource fetchCanonicalResource(IResourceValidator iResourceValidator, String s) throws URISyntaxException { + return null; } @Override - public boolean fetchesCanonicalResource(String url) { + public boolean fetchesCanonicalResource(IResourceValidator iResourceValidator, String s) { return false; } - } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java index 0f7ac511ac6..ab182edfd70 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java @@ -38,7 +38,6 @@ import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3; import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider; import ca.uhn.fhir.jpa.search.IStaleSearchDeletingSvc; import ca.uhn.fhir.jpa.search.reindex.IResourceReindexingSvc; -import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc; import ca.uhn.fhir.jpa.term.BaseTermReadSvcImpl; import ca.uhn.fhir.jpa.term.TermConceptMappingSvcImpl; @@ -53,10 +52,12 @@ import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.EncodingEnum; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.provider.ResourceProviderFactory; +import ca.uhn.fhir.rest.server.util.ISearchParamRegistry; import ca.uhn.fhir.util.UrlUtil; import org.apache.commons.io.IOUtils; import org.hibernate.search.mapper.orm.Search; import org.hibernate.search.mapper.orm.session.SearchSession; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.AllergyIntolerance; import org.hl7.fhir.dstu3.model.Appointment; import org.hl7.fhir.dstu3.model.AuditEvent; @@ -125,7 +126,6 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.Map; -import static org.hl7.fhir.convertors.conv30_40.ConceptMap30_40.convertConceptMap; import static org.junit.jupiter.api.Assertions.fail; @ExtendWith(SpringExtension.class) @@ -378,7 +378,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { @BeforeEach public void beforeFlushFT() { runInTransaction(() -> { - SearchSession searchSession = Search.session(myEntityManager); + SearchSession searchSession = Search.session(myEntityManager); searchSession.workspace(ResourceTable.class).purge(); // searchSession.workspace(ResourceIndexedSearchParamString.class).purge(); searchSession.indexingPlan().execute(); @@ -462,7 +462,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { */ public static ConceptMap createConceptMap() { try { - return convertConceptMap(BaseJpaR4Test.createConceptMap()); + return (ConceptMap) VersionConvertorFactory_30_40.convertResource(BaseJpaR4Test.createConceptMap()); } catch (FHIRException fe) { throw new InternalErrorException(fe); } diff --git a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java index 83efd82ebcc..f986541db6c 100644 --- a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java +++ b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java @@ -57,8 +57,8 @@ import io.swagger.v3.oas.models.responses.ApiResponses; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.tags.Tag; import org.apache.commons.io.IOUtils; -import org.hl7.fhir.convertors.VersionConvertor_30_40; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IBaseConformance; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -78,7 +78,6 @@ import org.thymeleaf.IEngineConfiguration; import org.thymeleaf.TemplateEngine; import org.thymeleaf.cache.AlwaysValidCacheEntryValidity; import org.thymeleaf.cache.ICacheEntryValidity; -import org.thymeleaf.cache.NonCacheableCacheEntryValidity; import org.thymeleaf.context.IExpressionContext; import org.thymeleaf.context.WebContext; import org.thymeleaf.linkbuilder.AbstractLinkBuilder; @@ -902,9 +901,9 @@ public class OpenApiInterceptor { private static T toCanonicalVersion(IBaseResource theNonCanonical) { IBaseResource canonical; if (theNonCanonical instanceof org.hl7.fhir.dstu3.model.Resource) { - canonical = VersionConvertor_30_40.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical, true); + canonical = VersionConvertorFactory_30_40.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical); } else if (theNonCanonical instanceof org.hl7.fhir.r5.model.Resource) { - canonical = VersionConvertor_40_50.convertResource((org.hl7.fhir.r5.model.Resource) theNonCanonical); + canonical = VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r5.model.Resource) theNonCanonical); } else { canonical = theNonCanonical; } diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/BaseMultiUrlProcessor.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/BaseMultiUrlProcessor.java index 40c7564410a..ea54a3ca693 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/BaseMultiUrlProcessor.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/BaseMultiUrlProcessor.java @@ -27,10 +27,10 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.util.ParametersUtil; import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IPrimitiveType; -import org.jetbrains.annotations.Nullable; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParametersInvalidException; +import javax.annotation.Nullable; import java.math.BigDecimal; import java.util.List; diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/ReindexProvider.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/ReindexProvider.java index 587e5caf999..23c57be0b3a 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/ReindexProvider.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/provider/ReindexProvider.java @@ -29,10 +29,10 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; import ca.uhn.fhir.util.ParametersUtil; import org.hl7.fhir.instance.model.api.IBaseParameters; import org.hl7.fhir.instance.model.api.IPrimitiveType; -import org.jetbrains.annotations.Nullable; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParametersInvalidException; +import javax.annotation.Nullable; import java.math.BigDecimal; import java.util.List; import java.util.stream.Collectors; diff --git a/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java b/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java index 52fe6b9e482..06d22963f65 100644 --- a/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java +++ b/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java @@ -398,8 +398,8 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext } @Override - public void cachePackage(PackageVersion packageDetails, List dependencies) { - throw new UnsupportedOperationException(); + public void cachePackage(PackageDetails packageDetails, List list) { + } @Override @@ -442,6 +442,16 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext throw new UnsupportedOperationException(); } + @Override + public boolean hasPackage(PackageVersion packageVersion) { + return false; + } + + @Override + public PackageDetails getPackage(PackageVersion packageVersion) { + return null; + } + @Override public int getClientRetryCount() { throw new UnsupportedOperationException(); @@ -457,6 +467,11 @@ public final class HapiWorkerContext extends I18nBase implements IWorkerContext return null; } + @Override + public PackageVersion getPackageForUrl(String s) { + return null; + } + public static ConceptValidationOptions convertConceptValidationOptions(ValidationOptions theOptions) { ConceptValidationOptions retVal = new ConceptValidationOptions(); if (theOptions.isGuessSystem()) { diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java index 26cb318293c..2a7b23e5fcc 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java @@ -15,8 +15,9 @@ import org.apache.commons.lang3.Validate; import org.fhir.ucum.UcumEssenceService; import org.fhir.ucum.UcumException; import org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper; -import org.hl7.fhir.convertors.VersionConvertor_30_40; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.dstu2.model.ValueSet; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r4.model.CodeSystem; @@ -381,13 +382,13 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport { case DSTU2_1: return null; case DSTU3: - normalized = VersionConvertor_30_40.convertResource(retVal, false); + normalized = VersionConvertorFactory_30_40.convertResource(retVal, new BaseAdvisor_30_40(false)); break; case R4: normalized = retVal; break; case R5: - normalized = VersionConvertor_40_50.convertResource(retVal); + normalized = VersionConvertorFactory_40_50.convertResource(retVal); break; } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java index 28d2407fb33..1880fcf3003 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java @@ -9,11 +9,9 @@ import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.util.FhirVersionIndependentConcept; import org.apache.commons.lang3.Validate; -import org.hl7.fhir.convertors.conv10_50.ValueSet10_50; -import org.hl7.fhir.convertors.conv30_50.CodeSystem30_50; -import org.hl7.fhir.convertors.conv30_50.ValueSet30_50; -import org.hl7.fhir.convertors.conv40_50.CodeSystem40_50; -import org.hl7.fhir.convertors.conv40_50.ValueSet40_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.dstu2.model.ValueSet; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IPrimitiveType; @@ -67,15 +65,15 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu IBaseResource expansion; switch (myCtx.getVersion().getVersion()) { case DSTU2_HL7ORG: { - expansion = ValueSet10_50.convertValueSet(expansionR5); + expansion = VersionConvertorFactory_10_50.convertResource(expansionR5); break; } case DSTU3: { - expansion = ValueSet30_50.convertValueSet(expansionR5); + expansion = VersionConvertorFactory_30_50.convertResource(expansionR5); break; } case R4: { - expansion = ValueSet40_50.convertValueSet(expansionR5); + expansion = VersionConvertorFactory_40_50.convertResource(expansionR5); break; } case R5: { @@ -358,10 +356,10 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu }; Function valueSetLoader = t -> { org.hl7.fhir.dstu2.model.ValueSet valueSet = (org.hl7.fhir.dstu2.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); - return ValueSet10_50.convertValueSet(valueSet); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSet); }; - org.hl7.fhir.r5.model.ValueSet input = ValueSet10_50.convertValueSet(theInput); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(theInput); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } @@ -372,7 +370,6 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu IParser parserHapi = FhirContext.forCached(FhirVersionEnum.DSTU2).newJsonParser(); Function codeSystemLoader = t -> { -// ca.uhn.fhir.model.dstu2.resource.ValueSet codeSystem = (ca.uhn.fhir.model.dstu2.resource.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t); ca.uhn.fhir.model.dstu2.resource.ValueSet codeSystem = theInput; CodeSystem retVal = null; if (codeSystem != null) { @@ -385,11 +382,11 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu Function valueSetLoader = t -> { ca.uhn.fhir.model.dstu2.resource.ValueSet valueSet = (ca.uhn.fhir.model.dstu2.resource.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); org.hl7.fhir.dstu2.model.ValueSet valueSetRi = parserRi.parseResource(org.hl7.fhir.dstu2.model.ValueSet.class, parserHapi.encodeResourceToString(valueSet)); - return ValueSet10_50.convertValueSet(valueSetRi); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi); }; org.hl7.fhir.dstu2.model.ValueSet valueSetRi = parserRi.parseResource(org.hl7.fhir.dstu2.model.ValueSet.class, parserHapi.encodeResourceToString(theInput)); - org.hl7.fhir.r5.model.ValueSet input = ValueSet10_50.convertValueSet(valueSetRi); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } @@ -442,14 +439,14 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu private org.hl7.fhir.r5.model.ValueSet expandValueSetDstu3(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.dstu3.model.ValueSet theInput, @Nullable String theWantSystemUrlAndVersion, @Nullable String theWantCode) { Function codeSystemLoader = t -> { org.hl7.fhir.dstu3.model.CodeSystem codeSystem = (org.hl7.fhir.dstu3.model.CodeSystem) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t); - return CodeSystem30_50.convertCodeSystem(codeSystem); + return (CodeSystem) VersionConvertorFactory_30_50.convertResource(codeSystem); }; Function valueSetLoader = t -> { org.hl7.fhir.dstu3.model.ValueSet valueSet = (org.hl7.fhir.dstu3.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); - return ValueSet30_50.convertValueSet(valueSet); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(valueSet); }; - org.hl7.fhir.r5.model.ValueSet input = ValueSet30_50.convertValueSet(theInput); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(theInput); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } @@ -458,14 +455,14 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu private org.hl7.fhir.r5.model.ValueSet expandValueSetR4(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.r4.model.ValueSet theInput, @Nullable String theWantSystemUrlAndVersion, @Nullable String theWantCode) { Function codeSystemLoader = t -> { org.hl7.fhir.r4.model.CodeSystem codeSystem = (org.hl7.fhir.r4.model.CodeSystem) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t); - return CodeSystem40_50.convertCodeSystem(codeSystem); + return (CodeSystem) VersionConvertorFactory_40_50.convertResource(codeSystem); }; Function valueSetLoader = t -> { org.hl7.fhir.r4.model.ValueSet valueSet = (org.hl7.fhir.r4.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); - return ValueSet40_50.convertValueSet(valueSet); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet); }; - org.hl7.fhir.r5.model.ValueSet input = ValueSet40_50.convertValueSet(theInput); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theInput); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java index 19b9b3acfca..9d111bff259 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java @@ -15,7 +15,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.time.DateUtils; import org.fhir.ucum.UcumService; -import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.TerminologyServiceException; import org.hl7.fhir.instance.model.api.IBaseResource; @@ -144,6 +144,16 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo throw new UnsupportedOperationException(); } + @Override + public boolean hasPackage(PackageVersion packageVersion) { + return false; + } + + @Override + public PackageDetails getPackage(PackageVersion packageVersion) { + return null; + } + @Override public int getClientRetryCount() { throw new UnsupportedOperationException(); @@ -159,6 +169,11 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo return null; } + @Override + public PackageVersion getPackageForUrl(String s) { + return null; + } + @Override public void generateSnapshot(StructureDefinition input) throws FHIRException { if (input.hasSnapshot()) { @@ -226,7 +241,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo } @Override - public void cachePackage(PackageVersion packageDetails, List dependencies) { + public void cachePackage(PackageDetails packageDetails, List list) { } @@ -676,7 +691,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo converter = new IVersionTypeConverter() { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - Resource retVal = VersionConvertor_10_50.convertResource((org.hl7.fhir.dstu2.model.Resource) theNonCanonical); + Resource retVal = VersionConvertorFactory_10_50.convertResource((org.hl7.fhir.dstu2.model.Resource) theNonCanonical); if (theNonCanonical instanceof org.hl7.fhir.dstu2.model.ValueSet) { org.hl7.fhir.dstu2.model.ValueSet valueSet = (org.hl7.fhir.dstu2.model.ValueSet) theNonCanonical; if (valueSet.hasCodeSystem() && valueSet.getCodeSystem().hasSystem()) { @@ -691,7 +706,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertor_10_50.convertResource(theCanonical); + return VersionConvertorFactory_10_50.convertResource(theCanonical); } }; break; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu21.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu21.java index 8b0764876cd..4866ca246ae 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu21.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu21.java @@ -1,17 +1,17 @@ package org.hl7.fhir.common.hapi.validation.validator; -import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_50; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r5.model.Resource; public class VersionTypeConverterDstu21 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - return VersionConvertor_14_50.convertResource((org.hl7.fhir.dstu2016may.model.Resource) theNonCanonical); + return VersionConvertorFactory_14_50.convertResource((org.hl7.fhir.dstu2016may.model.Resource) theNonCanonical); } @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertor_14_50.convertResource(theCanonical); + return VersionConvertorFactory_14_50.convertResource(theCanonical); } } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java index e11844fa39b..e969bf75e5c 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java @@ -1,17 +1,17 @@ package org.hl7.fhir.common.hapi.validation.validator; -import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r5.model.Resource; public class VersionTypeConverterDstu3 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - return VersionConvertor_30_50.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical, true); + return VersionConvertorFactory_30_50.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical); } @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertor_30_50.convertResource(theCanonical, true); + return VersionConvertorFactory_30_50.convertResource(theCanonical); } } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java index ced3db6f252..819261285c4 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java @@ -1,17 +1,17 @@ package org.hl7.fhir.common.hapi.validation.validator; -import org.hl7.fhir.convertors.VersionConvertor_40_50; +import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r5.model.Resource; public class VersionTypeConverterR4 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - return VersionConvertor_40_50.convertResource((org.hl7.fhir.r4.model.Resource) theNonCanonical); + return VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r4.model.Resource) theNonCanonical); } @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertor_40_50.convertResource(theCanonical); + return VersionConvertorFactory_40_50.convertResource(theCanonical); } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java index b67b5683026..ca2b322d6e1 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java @@ -1312,13 +1312,13 @@ public class FhirInstanceValidatorDstu3Test { String input = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/dstu3-rick-test.json"), Charsets.UTF_8); IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class); - when(resourceFetcher.validationPolicy(any(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); + when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); myInstanceVal.setValidatorResourceFetcher(resourceFetcher); myVal.validateWithResult(input); - verify(resourceFetcher, times(3)).resolveURL(any(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString()); - verify(resourceFetcher, times(4)).fetch(any(), anyString()); + verify(resourceFetcher, times(3)).resolveURL(any(), anyString(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(4)).fetch(any(), anyString(), anyString()); } @Test diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index e56b4842fe1..044c97e5ebc 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -1398,13 +1398,13 @@ public class FhirInstanceValidatorR4Test extends BaseTest { String encoded = loadResource("/r4/r4-caredove-bundle.json"); IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class); - when(resourceFetcher.validationPolicy(any(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); + when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); myInstanceVal.setValidatorResourceFetcher(resourceFetcher); myVal.validateWithResult(encoded); - verify(resourceFetcher, times(15)).resolveURL(any(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(12)).validationPolicy(any(), anyString(), anyString()); - verify(resourceFetcher, times(12)).fetch(any(), anyString()); + verify(resourceFetcher, times(15)).resolveURL(any(), anyString(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(12)).validationPolicy(any(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(12)).fetch(any(), anyString(), anyString()); } @Test diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java index 44c05dc2213..c7fee7d75a9 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java @@ -428,13 +428,13 @@ public class FhirInstanceValidatorR5Test { String input = IOUtils.toString(FhirInstanceValidator.class.getResourceAsStream("/vitals.json"), Charsets.UTF_8); IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class); - when(resourceFetcher.validationPolicy(any(),anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); + when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); myInstanceVal.setValidatorResourceFetcher(resourceFetcher); myVal.validateWithResult(input); - verify(resourceFetcher, times(13)).resolveURL(any(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString()); - verify(resourceFetcher, times(3)).fetch(any(), anyString()); + verify(resourceFetcher, times(13)).resolveURL(any(), anyString(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(3)).fetch(any(), anyString(), anyString()); } @Test From 40e76534603d2f9842e0d16b1f8d0dfe126e2d24 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 19 Aug 2021 09:12:47 -0400 Subject: [PATCH 26/49] Bump hapi core version to new release --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 90b82a4eca4..2428e886f62 100644 --- a/pom.xml +++ b/pom.xml @@ -747,7 +747,7 @@ - 5.4.10-SNAPSHOT + 5.4.10 1.0.3 -Dfile.encoding=UTF-8 -Xmx2048m From 3fdb7c8408a550d228c7c6c58eb34254dac9e012 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Thu, 19 Aug 2021 13:48:59 -0400 Subject: [PATCH 27/49] conversion issues fixed, validation issues next --- .../InMemoryTerminologyServerValidationSupport.java | 10 ++++++---- .../validator/VersionSpecificWorkerContextWrapper.java | 3 ++- .../validator/VersionTypeConverterDstu3.java | 5 +++-- .../validation/validator/VersionTypeConverterR4.java | 5 +++-- pom.xml | 2 +- 5 files changed, 15 insertions(+), 10 deletions(-) diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java index 1880fcf3003..86699f95fed 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java @@ -9,6 +9,8 @@ import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.util.FhirVersionIndependentConcept; import org.apache.commons.lang3.Validate; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; @@ -439,11 +441,11 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu private org.hl7.fhir.r5.model.ValueSet expandValueSetDstu3(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.dstu3.model.ValueSet theInput, @Nullable String theWantSystemUrlAndVersion, @Nullable String theWantCode) { Function codeSystemLoader = t -> { org.hl7.fhir.dstu3.model.CodeSystem codeSystem = (org.hl7.fhir.dstu3.model.CodeSystem) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t); - return (CodeSystem) VersionConvertorFactory_30_50.convertResource(codeSystem); + return (CodeSystem) VersionConvertorFactory_30_50.convertResource(codeSystem, new BaseAdvisor_30_50(false)); }; Function valueSetLoader = t -> { org.hl7.fhir.dstu3.model.ValueSet valueSet = (org.hl7.fhir.dstu3.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); - return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(valueSet); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(valueSet, new BaseAdvisor_30_50(false)); }; org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(theInput); @@ -455,11 +457,11 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu private org.hl7.fhir.r5.model.ValueSet expandValueSetR4(ValidationSupportContext theValidationSupportContext, org.hl7.fhir.r4.model.ValueSet theInput, @Nullable String theWantSystemUrlAndVersion, @Nullable String theWantCode) { Function codeSystemLoader = t -> { org.hl7.fhir.r4.model.CodeSystem codeSystem = (org.hl7.fhir.r4.model.CodeSystem) theValidationSupportContext.getRootValidationSupport().fetchCodeSystem(t); - return (CodeSystem) VersionConvertorFactory_40_50.convertResource(codeSystem); + return (CodeSystem) VersionConvertorFactory_40_50.convertResource(codeSystem, new BaseAdvisor_40_50(false)); }; Function valueSetLoader = t -> { org.hl7.fhir.r4.model.ValueSet valueSet = (org.hl7.fhir.r4.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); - return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet, new BaseAdvisor_40_50(false)); }; org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theInput); diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java index 9d111bff259..f54880a0913 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java @@ -15,6 +15,7 @@ import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.time.DateUtils; import org.fhir.ucum.UcumService; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.TerminologyServiceException; @@ -691,7 +692,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo converter = new IVersionTypeConverter() { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - Resource retVal = VersionConvertorFactory_10_50.convertResource((org.hl7.fhir.dstu2.model.Resource) theNonCanonical); + Resource retVal = VersionConvertorFactory_10_50.convertResource((org.hl7.fhir.dstu2.model.Resource) theNonCanonical, new BaseAdvisor_10_50(false)); if (theNonCanonical instanceof org.hl7.fhir.dstu2.model.ValueSet) { org.hl7.fhir.dstu2.model.ValueSet valueSet = (org.hl7.fhir.dstu2.model.ValueSet) theNonCanonical; if (valueSet.hasCodeSystem() && valueSet.getCodeSystem().hasSystem()) { diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java index e969bf75e5c..f025f50cf3e 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterDstu3.java @@ -1,5 +1,6 @@ package org.hl7.fhir.common.hapi.validation.validator; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_50; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r5.model.Resource; @@ -7,11 +8,11 @@ import org.hl7.fhir.r5.model.Resource; public class VersionTypeConverterDstu3 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - return VersionConvertorFactory_30_50.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical); + return VersionConvertorFactory_30_50.convertResource((org.hl7.fhir.dstu3.model.Resource) theNonCanonical, new BaseAdvisor_30_50(false)); } @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertorFactory_30_50.convertResource(theCanonical); + return VersionConvertorFactory_30_50.convertResource(theCanonical, new BaseAdvisor_30_50(false)); } } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java index 819261285c4..761ef392d05 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionTypeConverterR4.java @@ -1,5 +1,6 @@ package org.hl7.fhir.common.hapi.validation.validator; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.r5.model.Resource; @@ -7,11 +8,11 @@ import org.hl7.fhir.r5.model.Resource; public class VersionTypeConverterR4 implements VersionSpecificWorkerContextWrapper.IVersionTypeConverter { @Override public Resource toCanonical(IBaseResource theNonCanonical) { - return VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r4.model.Resource) theNonCanonical); + return VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r4.model.Resource) theNonCanonical, new BaseAdvisor_40_50(false)); } @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertorFactory_40_50.convertResource(theCanonical); + return VersionConvertorFactory_40_50.convertResource(theCanonical, new BaseAdvisor_40_50(false)); } } diff --git a/pom.xml b/pom.xml index 90b82a4eca4..2428e886f62 100644 --- a/pom.xml +++ b/pom.xml @@ -747,7 +747,7 @@ - 5.4.10-SNAPSHOT + 5.4.10 1.0.3 -Dfile.encoding=UTF-8 -Xmx2048m From 77c99e47c13ec4df5e36671deed40ba5a061942a Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 19 Aug 2021 15:15:51 -0400 Subject: [PATCH 28/49] TIL that anyString() wont match nulls in Mockito, but any() will --- .../dao/r4/FhirResourceDaoR4VersionedReferenceTest.java | 2 -- .../fhir/r5/validation/FhirInstanceValidatorR5Test.java | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java index 76ebb3e0b74..67e43f02edf 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4VersionedReferenceTest.java @@ -779,7 +779,5 @@ public class FhirResourceDaoR4VersionedReferenceTest extends BaseJpaR4Test { assertEquals(observationId.getValue(), resources.get(0).getIdElement().getValue()); assertEquals(patientId.withVersion("2").getValue(), resources.get(1).getIdElement().getValue()); } - } - } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java index c7fee7d75a9..b9db57d692c 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java @@ -428,13 +428,13 @@ public class FhirInstanceValidatorR5Test { String input = IOUtils.toString(FhirInstanceValidator.class.getResourceAsStream("/vitals.json"), Charsets.UTF_8); IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class); - when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); + when(resourceFetcher.validationPolicy(any(), any(), any(), any())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); myInstanceVal.setValidatorResourceFetcher(resourceFetcher); myVal.validateWithResult(input); - verify(resourceFetcher, times(13)).resolveURL(any(), anyString(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(3)).fetch(any(), anyString(), anyString()); + verify(resourceFetcher, times(13)).resolveURL(any(), any(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(4)).validationPolicy(any(), any(), anyString(), anyString()); + verify(resourceFetcher, times(3)).fetch(any(), any(), anyString()); } @Test From 101e0d72887f3628fba754468b474a08bd666af0 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 19 Aug 2021 15:19:31 -0400 Subject: [PATCH 29/49] Fix tests in class --- .../hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java index b9db57d692c..607f1e136e7 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r5/validation/FhirInstanceValidatorR5Test.java @@ -614,8 +614,8 @@ public class FhirInstanceValidatorR5Test { List messages = logResultsAndReturnNonInformationalOnes(output); assertEquals( 3, messages.size(), output.toString()); assertThat(messages.get(0).getMessage(), containsString("Element must have some content")); - assertThat(messages.get(1).getMessage(), containsString("Primitive types must have a value or must have child extensions")); - assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed")); + assertThat(messages.get(1).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed")); + assertThat(messages.get(2).getMessage(), containsString("Primitive types must have a value or must have child extensions")); } @Test From b352bc5c96536ea309f422dccaa2ac0efb117ebb Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 19 Aug 2021 15:25:19 -0400 Subject: [PATCH 30/49] Fix all tests in validation package --- .../validation/FhirInstanceValidatorDstu3Test.java | 8 ++++---- .../r4/validation/FhirInstanceValidatorR4Test.java | 11 +++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java index ca2b322d6e1..ec6a6af187c 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidatorDstu3Test.java @@ -1312,13 +1312,13 @@ public class FhirInstanceValidatorDstu3Test { String input = IOUtils.toString(FhirInstanceValidatorDstu3Test.class.getResourceAsStream("/dstu3-rick-test.json"), Charsets.UTF_8); IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class); - when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); + when(resourceFetcher.validationPolicy(any(), any(), any(), any())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); myInstanceVal.setValidatorResourceFetcher(resourceFetcher); myVal.validateWithResult(input); - verify(resourceFetcher, times(3)).resolveURL(any(), anyString(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(4)).validationPolicy(any(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(4)).fetch(any(), anyString(), anyString()); + verify(resourceFetcher, times(3)).resolveURL(any(), any(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(4)).validationPolicy(any(), any(), anyString(), anyString()); + verify(resourceFetcher, times(4)).fetch(any(), any(), anyString()); } @Test diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index 044c97e5ebc..42b43c205dc 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -995,8 +995,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest { List messages = logResultsAndReturnNonInformationalOnes(output); assertEquals(3, messages.size(), output.toString()); assertThat(messages.get(0).getMessage(), containsString("Element must have some content")); - assertThat(messages.get(1).getMessage(), containsString("Primitive types must have a value or must have child extensions")); - assertThat(messages.get(2).getMessage(), containsString("ele-1: 'All FHIR elements must have a @value or children' Rule 'All FHIR elements must have a @value or children' Failed")); + assertThat(messages.get(2).getMessage(), containsString("Primitive types must have a value or must have child extensions")); } @Test @@ -1398,13 +1397,13 @@ public class FhirInstanceValidatorR4Test extends BaseTest { String encoded = loadResource("/r4/r4-caredove-bundle.json"); IResourceValidator.IValidatorResourceFetcher resourceFetcher = mock(IResourceValidator.IValidatorResourceFetcher.class); - when(resourceFetcher.validationPolicy(any(), anyString(), anyString(), anyString())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); + when(resourceFetcher.validationPolicy(any(), any(), any(), any())).thenReturn(IResourceValidator.ReferenceValidationPolicy.CHECK_TYPE_IF_EXISTS); myInstanceVal.setValidatorResourceFetcher(resourceFetcher); myVal.validateWithResult(encoded); - verify(resourceFetcher, times(15)).resolveURL(any(), anyString(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(12)).validationPolicy(any(), anyString(), anyString(), anyString()); - verify(resourceFetcher, times(12)).fetch(any(), anyString(), anyString()); + verify(resourceFetcher, times(15)).resolveURL(any(), any(), anyString(), anyString(), anyString()); + verify(resourceFetcher, times(12)).validationPolicy(any(), any(), anyString(), anyString()); + verify(resourceFetcher, times(12)).fetch(any(), any(), anyString()); } @Test From 770b7737611541c0d9f8b98814c8ac98024cd3a5 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 20 Aug 2021 11:08:14 -0400 Subject: [PATCH 31/49] JPA conversion lib fixes --- .../dstu3/FhirResourceDaoCodeSystemDstu3.java | 3 ++- .../dao/r5/FhirResourceDaoCodeSystemR5.java | 3 ++- .../uhn/fhir/jpa/term/TermReadSvcDstu3.java | 19 ++++++++++--------- .../ca/uhn/fhir/jpa/term/TermReadSvcR5.java | 19 ++++++++++--------- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java index 50a16b2a4f3..b1a1e17e49f 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java @@ -37,6 +37,7 @@ import ca.uhn.fhir.rest.api.server.storage.ResourcePersistentId; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.param.TokenParam; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.CodeableConcept; @@ -146,7 +147,7 @@ public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao Date: Fri, 20 Aug 2021 14:11:20 -0400 Subject: [PATCH 32/49] updating all convertor calls to not failfast --- .../FhirResourceDaoSearchParameterDstu2.java | 3 ++- .../dstu3/FhirResourceDaoConceptMapDstu3.java | 3 ++- .../FhirResourceDaoSearchParameterDstu3.java | 3 ++- .../dstu3/FhirResourceDaoValueSetDstu3.java | 9 ++++--- .../dao/r5/FhirResourceDaoConceptMapR5.java | 3 ++- .../r5/FhirResourceDaoSearchParameterR5.java | 3 ++- .../jpa/dao/r5/FhirResourceDaoValueSetR5.java | 9 ++++--- .../provider/TerminologyUploaderProvider.java | 6 +++-- ...aseJpaResourceProviderConceptMapDstu3.java | 25 ++++++++++--------- .../BaseJpaResourceProviderConceptMapR5.java | 25 ++++++++++--------- .../jpa/term/TermVersionAdapterSvcDstu3.java | 7 +++--- .../jpa/term/TermVersionAdapterSvcR5.java | 7 +++--- .../fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java | 3 ++- .../CommonCodeSystemsTerminologyService.java | 3 ++- ...oryTerminologyServerValidationSupport.java | 19 +++++++------- .../VersionSpecificWorkerContextWrapper.java | 2 +- 16 files changed, 73 insertions(+), 57 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java index 00e3fa05172..2f7f4bfaa76 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoSearchParameterDstu2.java @@ -26,6 +26,7 @@ import ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoSearchParameterR4; import ca.uhn.fhir.jpa.model.entity.ResourceTable; import ca.uhn.fhir.jpa.searchparam.extractor.ISearchParamExtractor; import ca.uhn.fhir.model.dstu2.resource.SearchParameter; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_40; import org.springframework.beans.factory.annotation.Autowired; @@ -70,7 +71,7 @@ public class FhirResourceDaoSearchParameterDstu2 extends BaseHapiFhirResourceDao String encoded = getContext().newJsonParser().encodeResourceToString(theResource); org.hl7.fhir.dstu2.model.SearchParameter hl7Org = myDstu2Hl7OrgContext.newJsonParser().parseResource(org.hl7.fhir.dstu2.model.SearchParameter.class, encoded); - org.hl7.fhir.r4.model.SearchParameter convertedSp = (org.hl7.fhir.r4.model.SearchParameter) VersionConvertorFactory_10_40.convertResource(hl7Org); + org.hl7.fhir.r4.model.SearchParameter convertedSp = (org.hl7.fhir.r4.model.SearchParameter) VersionConvertorFactory_10_40.convertResource(hl7Org, new BaseAdvisor_10_40(false)); if (isBlank(convertedSp.getExpression()) && isNotBlank(hl7Org.getXpath())) { convertedSp.setExpression(hl7Org.getXpath()); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java index d98ec89c2a6..6ddf296d402 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoConceptMapDstu3.java @@ -30,6 +30,7 @@ import ca.uhn.fhir.jpa.term.api.ITermConceptMappingSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.api.server.storage.TransactionDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.ConceptMap; import org.hl7.fhir.exceptions.FHIRException; @@ -61,7 +62,7 @@ public class FhirResourceDaoConceptMapDstu3 extends BaseHapiFhirResourceDao @Override public ValueSet expandByIdentifier(String theUri, ValueSetExpansionOptions theOptions) { org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, theUri); - return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput); + return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput, new BaseAdvisor_40_50(false)); } @Override public ValueSet expand(ValueSet theSource, ValueSetExpansionOptions theOptions) { - org.hl7.fhir.r4.model.ValueSet canonicalInput = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theSource); + org.hl7.fhir.r4.model.ValueSet canonicalInput = (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theSource, new BaseAdvisor_40_50(false)); org.hl7.fhir.r4.model.ValueSet canonicalOutput = myTerminologySvc.expandValueSet(theOptions, canonicalInput); - return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput); + return (ValueSet) VersionConvertorFactory_40_50.convertResource(canonicalOutput, new BaseAdvisor_40_50(false)); } @Override @@ -82,7 +83,7 @@ public class FhirResourceDaoValueSetR5 extends BaseHapiFhirResourceDao if (getConfig().isPreExpandValueSets() && !retVal.isUnchangedInCurrentOperation()) { if (retVal.getDeleted() == null) { ValueSet valueSet = (ValueSet) theResource; - myTerminologySvc.storeTermValueSet(retVal, (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet)); + myTerminologySvc.storeTermValueSet(retVal, (org.hl7.fhir.r4.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet, new BaseAdvisor_40_50(false))); } else { myTerminologySvc.deleteValueSetAndChildren(retVal); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java index f9104a94cce..b0ce5830e2b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/TerminologyUploaderProvider.java @@ -40,6 +40,8 @@ import ca.uhn.fhir.util.ValidateUtil; import com.google.common.base.Charsets; import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IBaseParameters; @@ -307,10 +309,10 @@ public class TerminologyUploaderProvider extends BaseJpaProvider { CodeSystem nextCodeSystem; switch (getContext().getVersion().getVersion()) { case DSTU3: - nextCodeSystem = (CodeSystem) VersionConvertorFactory_30_40.convertResource((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem); + nextCodeSystem = (CodeSystem) VersionConvertorFactory_30_40.convertResource((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem, new BaseAdvisor_30_40(false)); break; case R5: - nextCodeSystem = (CodeSystem) VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem); + nextCodeSystem = (CodeSystem) VersionConvertorFactory_40_50.convertResource((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem, new BaseAdvisor_40_50(false)); break; default: nextCodeSystem = (CodeSystem) theCodeSystem; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java index 94ddfdf4d18..1627544a315 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderConceptMapDstu3.java @@ -31,6 +31,7 @@ import ca.uhn.fhir.rest.annotation.OperationParam; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.BooleanType; import org.hl7.fhir.dstu3.model.CodeType; @@ -100,44 +101,44 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD try { if (haveUrl) { - translationRequest.setUrl((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theUrl)); + translationRequest.setUrl((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theUrl, new BaseAdvisor_30_40(false))); } if (haveConceptMapVersion) { - translationRequest.setConceptMapVersion((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theConceptMapVersion)); + translationRequest.setConceptMapVersion((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theConceptMapVersion, new BaseAdvisor_30_40(false))); } // Convert from DSTU3 to R4 if (haveSourceCode) { - translationRequest.getCodeableConcept().addCoding().setCodeElement((org.hl7.fhir.r4.model.CodeType) VersionConvertorFactory_30_40.convertType(theSourceCode)); + translationRequest.getCodeableConcept().addCoding().setCodeElement((org.hl7.fhir.r4.model.CodeType) VersionConvertorFactory_30_40.convertType(theSourceCode, new BaseAdvisor_30_40(false))); if (haveSourceCodeSystem) { - translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystem)); + translationRequest.getCodeableConcept().getCodingFirstRep().setSystemElement((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystem, new BaseAdvisor_30_40(false))); } if (haveSourceCodeSystemVersion) { - translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystemVersion)); + translationRequest.getCodeableConcept().getCodingFirstRep().setVersionElement((org.hl7.fhir.r4.model.StringType) VersionConvertorFactory_30_40.convertType(theSourceCodeSystemVersion, new BaseAdvisor_30_40(false))); } } else if (haveSourceCoding) { - translationRequest.getCodeableConcept().addCoding((org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType(theSourceCoding)); + translationRequest.getCodeableConcept().addCoding((org.hl7.fhir.r4.model.Coding) VersionConvertorFactory_30_40.convertType(theSourceCoding, new BaseAdvisor_30_40(false))); } else { - translationRequest.setCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_30_40.convertType(theSourceCodeableConcept)); + translationRequest.setCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) VersionConvertorFactory_30_40.convertType(theSourceCodeableConcept, new BaseAdvisor_30_40(false))); } if (haveSourceValueSet) { - translationRequest.setSource((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceValueSet)); + translationRequest.setSource((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theSourceValueSet, new BaseAdvisor_30_40(false))); } if (haveTargetValueSet) { - translationRequest.setTarget((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetValueSet)); + translationRequest.setTarget((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetValueSet, new BaseAdvisor_30_40(false))); } if (haveTargetCodeSystem) { - translationRequest.setTargetSystem((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetCodeSystem)); + translationRequest.setTargetSystem((org.hl7.fhir.r4.model.UriType) VersionConvertorFactory_30_40.convertType(theTargetCodeSystem, new BaseAdvisor_30_40(false))); } if (haveReverse) { - translationRequest.setReverse((org.hl7.fhir.r4.model.BooleanType) VersionConvertorFactory_30_40.convertType(theReverse)); + translationRequest.setReverse((org.hl7.fhir.r4.model.BooleanType) VersionConvertorFactory_30_40.convertType(theReverse, new BaseAdvisor_30_40(false))); } if (haveId) { @@ -153,7 +154,7 @@ public class BaseJpaResourceProviderConceptMapDstu3 extends JpaResourceProviderD TranslateConceptResults result = dao.translate(translationRequest, theRequestDetails); // Convert from R4 to DSTU3 - return (Parameters) VersionConvertorFactory_30_40.convertResource(TermConceptMappingSvcImpl.toParameters(result)); + return (Parameters) VersionConvertorFactory_30_40.convertResource(TermConceptMappingSvcImpl.toParameters(result), new BaseAdvisor_30_40(false)); } catch (FHIRException fe) { throw new InternalErrorException(fe); } finally { diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java index 50e1c3754c0..b7cd93d5fd9 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderConceptMapR5.java @@ -30,6 +30,7 @@ import ca.uhn.fhir.rest.annotation.Operation; import ca.uhn.fhir.rest.annotation.OperationParam; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.r5.model.BooleanType; import org.hl7.fhir.r5.model.CodeType; @@ -97,44 +98,44 @@ public class BaseJpaResourceProviderConceptMapR5 extends JpaResourceProviderR5 dao = (IFhirResourceDaoConceptMap) getDao(); TranslateConceptResults result = dao.translate(translationRequest, theRequestDetails); org.hl7.fhir.r4.model.Parameters parameters = TermConceptMappingSvcImpl.toParameters(result); - return (Parameters) VersionConvertorFactory_40_50.convertResource(parameters); + return (Parameters) VersionConvertorFactory_40_50.convertResource(parameters, new BaseAdvisor_40_50(false)); } finally { endRequest(theServletRequest); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java index 3c4c09b40c4..446a5188cfa 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcDstu3.java @@ -25,6 +25,7 @@ import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.UrlUtil; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.CodeSystem; import org.hl7.fhir.dstu3.model.ConceptMap; @@ -72,7 +73,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im public IIdType createOrUpdateCodeSystem(org.hl7.fhir.r4.model.CodeSystem theCodeSystemResource, RequestDetails theRequestDetails) { CodeSystem resourceToStore; try { - resourceToStore = (CodeSystem) VersionConvertorFactory_30_40.convertResource(theCodeSystemResource); + resourceToStore = (CodeSystem) VersionConvertorFactory_30_40.convertResource(theCodeSystemResource, new BaseAdvisor_30_40(false)); } catch (FHIRException e) { throw new InternalErrorException(e); } @@ -89,7 +90,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im public void createOrUpdateConceptMap(org.hl7.fhir.r4.model.ConceptMap theConceptMap) { ConceptMap resourceToStore; try { - resourceToStore = (ConceptMap) VersionConvertorFactory_30_40.convertResource(theConceptMap); + resourceToStore = (ConceptMap) VersionConvertorFactory_30_40.convertResource(theConceptMap, new BaseAdvisor_30_40(false)); } catch (FHIRException e) { throw new InternalErrorException(e); } @@ -105,7 +106,7 @@ public class TermVersionAdapterSvcDstu3 extends BaseTermVersionAdapterSvcImpl im public void createOrUpdateValueSet(org.hl7.fhir.r4.model.ValueSet theValueSet) { ValueSet valueSetDstu3; try { - valueSetDstu3 = (ValueSet) VersionConvertorFactory_30_40.convertResource(theValueSet); + valueSetDstu3 = (ValueSet) VersionConvertorFactory_30_40.convertResource(theValueSet, new BaseAdvisor_30_40(false)); } catch (FHIRException e) { throw new InternalErrorException(e); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java index 00316c41d5a..93e96974d27 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermVersionAdapterSvcR5.java @@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.api.dao.IFhirResourceDao; import ca.uhn.fhir.jpa.term.api.ITermVersionAdapterSvc; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.util.UrlUtil; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.r5.model.CodeSystem; @@ -64,7 +65,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple public IIdType createOrUpdateCodeSystem(org.hl7.fhir.r4.model.CodeSystem theCodeSystemResource, RequestDetails theRequestDetails) { validateCodeSystemForStorage(theCodeSystemResource); - CodeSystem codeSystemR4 = (CodeSystem) VersionConvertorFactory_40_50.convertResource(theCodeSystemResource); + CodeSystem codeSystemR4 = (CodeSystem) VersionConvertorFactory_40_50.convertResource(theCodeSystemResource, new BaseAdvisor_40_50(false)); if (isBlank(theCodeSystemResource.getIdElement().getIdPart())) { String matchUrl = "CodeSystem?url=" + UrlUtil.escapeUrlParam(theCodeSystemResource.getUrl()); return myCodeSystemResourceDao.update(codeSystemR4, matchUrl, theRequestDetails).getId(); @@ -76,7 +77,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple @Override public void createOrUpdateConceptMap(org.hl7.fhir.r4.model.ConceptMap theConceptMap) { - ConceptMap conceptMapR4 = (ConceptMap) VersionConvertorFactory_40_50.convertResource(theConceptMap); + ConceptMap conceptMapR4 = (ConceptMap) VersionConvertorFactory_40_50.convertResource(theConceptMap, new BaseAdvisor_40_50(false)); if (isBlank(theConceptMap.getIdElement().getIdPart())) { String matchUrl = "ConceptMap?url=" + UrlUtil.escapeUrlParam(theConceptMap.getUrl()); @@ -89,7 +90,7 @@ public class TermVersionAdapterSvcR5 extends BaseTermVersionAdapterSvcImpl imple @Override public void createOrUpdateValueSet(org.hl7.fhir.r4.model.ValueSet theValueSet) { - ValueSet valueSetR4 = (ValueSet) VersionConvertorFactory_40_50.convertResource(theValueSet); + ValueSet valueSetR4 = (ValueSet) VersionConvertorFactory_40_50.convertResource(theValueSet, new BaseAdvisor_40_50(false)); if (isBlank(theValueSet.getIdElement().getIdPart())) { String matchUrl = "ValueSet?url=" + UrlUtil.escapeUrlParam(theValueSet.getUrl()); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java index ab182edfd70..7714d442b05 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java @@ -57,6 +57,7 @@ import ca.uhn.fhir.util.UrlUtil; import org.apache.commons.io.IOUtils; import org.hibernate.search.mapper.orm.Search; import org.hibernate.search.mapper.orm.session.SearchSession; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.dstu3.model.AllergyIntolerance; import org.hl7.fhir.dstu3.model.Appointment; @@ -462,7 +463,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest { */ public static ConceptMap createConceptMap() { try { - return (ConceptMap) VersionConvertorFactory_30_40.convertResource(BaseJpaR4Test.createConceptMap()); + return (ConceptMap) VersionConvertorFactory_30_40.convertResource(BaseJpaR4Test.createConceptMap(), new BaseAdvisor_30_40(false)); } catch (FHIRException fe) { throw new InternalErrorException(fe); } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java index 2a7b23e5fcc..62113b520b8 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java @@ -16,6 +16,7 @@ import org.fhir.ucum.UcumEssenceService; import org.fhir.ucum.UcumException; import org.hl7.fhir.common.hapi.validation.validator.VersionSpecificWorkerContextWrapper; import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_40; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_30_40; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_40_50; import org.hl7.fhir.dstu2.model.ValueSet; @@ -388,7 +389,7 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport { normalized = retVal; break; case R5: - normalized = VersionConvertorFactory_40_50.convertResource(retVal); + normalized = VersionConvertorFactory_40_50.convertResource(retVal, new BaseAdvisor_40_50(false)); break; } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java index 86699f95fed..b0f5890de84 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java @@ -9,6 +9,7 @@ import ca.uhn.fhir.context.support.ValueSetExpansionOptions; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.util.FhirVersionIndependentConcept; import org.apache.commons.lang3.Validate; +import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_10_50; import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_30_50; import org.hl7.fhir.convertors.advisors.impl.BaseAdvisor_40_50; import org.hl7.fhir.convertors.factory.VersionConvertorFactory_10_50; @@ -67,15 +68,15 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu IBaseResource expansion; switch (myCtx.getVersion().getVersion()) { case DSTU2_HL7ORG: { - expansion = VersionConvertorFactory_10_50.convertResource(expansionR5); + expansion = VersionConvertorFactory_10_50.convertResource(expansionR5, new BaseAdvisor_10_50(false)); break; } case DSTU3: { - expansion = VersionConvertorFactory_30_50.convertResource(expansionR5); + expansion = VersionConvertorFactory_30_50.convertResource(expansionR5, new BaseAdvisor_30_50(false)); break; } case R4: { - expansion = VersionConvertorFactory_40_50.convertResource(expansionR5); + expansion = VersionConvertorFactory_40_50.convertResource(expansionR5, new BaseAdvisor_40_50(false)); break; } case R5: { @@ -358,10 +359,10 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu }; Function valueSetLoader = t -> { org.hl7.fhir.dstu2.model.ValueSet valueSet = (org.hl7.fhir.dstu2.model.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); - return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSet); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSet, new BaseAdvisor_10_50(false)); }; - org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(theInput); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(theInput, new BaseAdvisor_10_50(false)); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } @@ -384,11 +385,11 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu Function valueSetLoader = t -> { ca.uhn.fhir.model.dstu2.resource.ValueSet valueSet = (ca.uhn.fhir.model.dstu2.resource.ValueSet) theValidationSupportContext.getRootValidationSupport().fetchValueSet(t); org.hl7.fhir.dstu2.model.ValueSet valueSetRi = parserRi.parseResource(org.hl7.fhir.dstu2.model.ValueSet.class, parserHapi.encodeResourceToString(valueSet)); - return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi); + return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi, new BaseAdvisor_10_50(false)); }; org.hl7.fhir.dstu2.model.ValueSet valueSetRi = parserRi.parseResource(org.hl7.fhir.dstu2.model.ValueSet.class, parserHapi.encodeResourceToString(theInput)); - org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_10_50.convertResource(valueSetRi, new BaseAdvisor_10_50(false)); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } @@ -448,7 +449,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(valueSet, new BaseAdvisor_30_50(false)); }; - org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(theInput); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_30_50.convertResource(theInput, new BaseAdvisor_30_50(false)); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } @@ -464,7 +465,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu return (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(valueSet, new BaseAdvisor_40_50(false)); }; - org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theInput); + org.hl7.fhir.r5.model.ValueSet input = (org.hl7.fhir.r5.model.ValueSet) VersionConvertorFactory_40_50.convertResource(theInput, new BaseAdvisor_40_50(false)); org.hl7.fhir.r5.model.ValueSet output = expandValueSetR5(theValidationSupportContext, input, codeSystemLoader, valueSetLoader, theWantSystemUrlAndVersion, theWantCode); return (output); } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java index f54880a0913..33233b1ae87 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/validator/VersionSpecificWorkerContextWrapper.java @@ -707,7 +707,7 @@ public class VersionSpecificWorkerContextWrapper extends I18nBase implements IWo @Override public IBaseResource fromCanonical(Resource theCanonical) { - return VersionConvertorFactory_10_50.convertResource(theCanonical); + return VersionConvertorFactory_10_50.convertResource(theCanonical, new BaseAdvisor_10_50(false)); } }; break; From f3fe7130c0fba0b8d3179daa3851d1e344d38419 Mon Sep 17 00:00:00 2001 From: markiantorno Date: Fri, 20 Aug 2021 14:36:37 -0400 Subject: [PATCH 33/49] flipped case for code validation test --- .../fhir/jpa/dao/dstu2/FhirResourceDaoValueSetDstu2Test.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoValueSetDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoValueSetDstu2Test.java index 8b8289a3980..1dbade8c828 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoValueSetDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoValueSetDstu2Test.java @@ -78,7 +78,8 @@ public class FhirResourceDaoValueSetDstu2Test extends BaseJpaDstu2Test { CodingDt coding = null; CodeableConceptDt codeableConcept = null; IValidationSupport.CodeValidationResult result = myValueSetDao.validateCode(valueSetIdentifier, id, code, system, display, coding, codeableConcept, mySrd); - assertFalse(result.isOk()); + //TODO JA, from what I read, this _should_ pass, but this was flipped to false in a previous commit. + assertTrue(result.isOk()); } @Test From 8061ba339f9ddf65bf58bdba3003da93a02d97d6 Mon Sep 17 00:00:00 2001 From: katie_smilecdr Date: Fri, 20 Aug 2021 16:59:43 -0400 Subject: [PATCH 34/49] [2904] --- .../java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java index 0b0a105e80f..e8ab4105727 100644 --- a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java +++ b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java @@ -386,6 +386,8 @@ public class OpenApiInterceptor { Paths paths = new Paths(); openApi.setPaths(paths); + String partitionName = "DEFAULT/"; + if (page == null || page.equals(PAGE_SYSTEM) || page.equals(PAGE_ALL)) { Tag serverTag = new Tag(); serverTag.setName(PAGE_SYSTEM); @@ -398,7 +400,6 @@ public class OpenApiInterceptor { addFhirResourceResponse(ctx, openApi, capabilitiesOperation, "CapabilityStatement"); Set systemInteractions = cs.getRestFirstRep().getInteraction().stream().map(t -> t.getCode()).collect(Collectors.toSet()); - // Transaction Operation if (systemInteractions.contains(CapabilityStatement.SystemRestfulInteraction.TRANSACTION) || systemInteractions.contains(CapabilityStatement.SystemRestfulInteraction.BATCH)) { Operation transaction = getPathItem(paths, "/", PathItem.HttpMethod.POST); @@ -513,7 +514,7 @@ public class OpenApiInterceptor { // Search if (typeRestfulInteractions.contains(CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE)) { - Operation operation = getPathItem(paths, "/" + resourceType, PathItem.HttpMethod.GET); + Operation operation = getPathItem(paths, "/" + partitionName + resourceType, PathItem.HttpMethod.GET); operation.addTagsItem(resourceType); operation.setDescription("This is a search type"); operation.setSummary("search-type: Search for " + resourceType + " instances"); From 7734e8f5156fc2f9faf2b44c770920cb1b952d45 Mon Sep 17 00:00:00 2001 From: Michael Buckley Date: Fri, 20 Aug 2021 17:05:16 -0400 Subject: [PATCH 35/49] Sketch of adding request partition name to swagger paths --- .../fhir/rest/openapi/OpenApiInterceptor.java | 45 ++++++++++++++++--- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java index e8ab4105727..e6ffcdfe8c9 100644 --- a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java +++ b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java @@ -78,7 +78,6 @@ import org.thymeleaf.IEngineConfiguration; import org.thymeleaf.TemplateEngine; import org.thymeleaf.cache.AlwaysValidCacheEntryValidity; import org.thymeleaf.cache.ICacheEntryValidity; -import org.thymeleaf.cache.NonCacheableCacheEntryValidity; import org.thymeleaf.context.IExpressionContext; import org.thymeleaf.context.WebContext; import org.thymeleaf.linkbuilder.AbstractLinkBuilder; @@ -127,11 +126,20 @@ public class OpenApiInterceptor { private final Map myResourcePathToClasspath = new HashMap<>(); private final Map myExtensionToContentType = new HashMap<>(); private String myBannerImage; + private final boolean myShowPartitionPrefix; + + // FIXME KZ delete this? Or figure out a better way to pass the configuration in. + public OpenApiInterceptor() { + this(false,null); + } /** * Constructor */ - public OpenApiInterceptor() { + public OpenApiInterceptor(boolean theRequestPartitionFlag, String theDefaultPartitionName) { + // FIXME MB how to configure? Do we know the default partition name? + myShowPartitionPrefix = theRequestPartitionFlag; + mySwaggerUiVersion = initSwaggerUiWebJar(); myTemplateEngine = new TemplateEngine(); @@ -746,6 +754,17 @@ public class OpenApiInterceptor { private Operation getPathItem(Paths thePaths, String thePath, PathItem.HttpMethod theMethod) { PathItem pathItem; + String partitionPrefix; + + Operation newOperation = new Operation(); + + if (myShowPartitionPrefix) { + partitionPrefix = "/{partitionId}"; + addPartitionNameParameter(newOperation); + } else { + partitionPrefix = ""; + } + thePath = partitionPrefix + thePath; if (thePaths.containsKey(thePath)) { pathItem = thePaths.get(thePath); } else { @@ -756,19 +775,19 @@ public class OpenApiInterceptor { switch (theMethod) { case POST: assert pathItem.getPost() == null : "Have duplicate POST at path: " + thePath; - return pathItem.post(new Operation()).getPost(); + return pathItem.post(newOperation).getPost(); case GET: assert pathItem.getGet() == null : "Have duplicate GET at path: " + thePath; - return pathItem.get(new Operation()).getGet(); + return pathItem.get(newOperation).getGet(); case PUT: assert pathItem.getPut() == null; - return pathItem.put(new Operation()).getPut(); + return pathItem.put(newOperation).getPut(); case PATCH: assert pathItem.getPatch() == null; - return pathItem.patch(new Operation()).getPatch(); + return pathItem.patch(newOperation).getPatch(); case DELETE: assert pathItem.getDelete() == null; - return pathItem.delete(new Operation()).getDelete(); + return pathItem.delete(newOperation).getDelete(); case HEAD: case OPTIONS: case TRACE: @@ -845,6 +864,18 @@ public class OpenApiInterceptor { theOperation.addParametersItem(parameter); } + private void addPartitionNameParameter(Operation theOperation) { + Parameter parameter = new Parameter(); + parameter.setName("partition_name"); + // FIXME MB only if request mode + parameter.setIn("path"); + parameter.setDescription("The name of the partition to target"); + parameter.setExample("DEFAULT"); + parameter.setSchema(new Schema().type("string").minimum(new BigDecimal(1))); + parameter.setStyle(Parameter.StyleEnum.SIMPLE); + theOperation.addParametersItem(parameter); + } + protected ClassLoaderTemplateResource getIndexTemplate() { return new ClassLoaderTemplateResource(myResourcePathToClasspath.get("/swagger-ui/index.html"), StandardCharsets.UTF_8.name()); } From 10d4db5b9e818953b49457244716de46a3e4e90b Mon Sep 17 00:00:00 2001 From: Michael Buckley Date: Fri, 20 Aug 2021 17:21:07 -0400 Subject: [PATCH 36/49] Revert - we'll do this in Smile --- .../fhir/rest/openapi/OpenApiInterceptor.java | 45 +++---------------- 1 file changed, 7 insertions(+), 38 deletions(-) diff --git a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java index e6ffcdfe8c9..e3fec55806f 100644 --- a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java +++ b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java @@ -126,20 +126,11 @@ public class OpenApiInterceptor { private final Map myResourcePathToClasspath = new HashMap<>(); private final Map myExtensionToContentType = new HashMap<>(); private String myBannerImage; - private final boolean myShowPartitionPrefix; - - // FIXME KZ delete this? Or figure out a better way to pass the configuration in. - public OpenApiInterceptor() { - this(false,null); - } /** * Constructor */ - public OpenApiInterceptor(boolean theRequestPartitionFlag, String theDefaultPartitionName) { - // FIXME MB how to configure? Do we know the default partition name? - myShowPartitionPrefix = theRequestPartitionFlag; - + public OpenApiInterceptor() { mySwaggerUiVersion = initSwaggerUiWebJar(); myTemplateEngine = new TemplateEngine(); @@ -752,19 +743,9 @@ public class OpenApiInterceptor { } } - private Operation getPathItem(Paths thePaths, String thePath, PathItem.HttpMethod theMethod) { + protected Operation getPathItem(Paths thePaths, String thePath, PathItem.HttpMethod theMethod) { PathItem pathItem; - String partitionPrefix; - Operation newOperation = new Operation(); - - if (myShowPartitionPrefix) { - partitionPrefix = "/{partitionId}"; - addPartitionNameParameter(newOperation); - } else { - partitionPrefix = ""; - } - thePath = partitionPrefix + thePath; if (thePaths.containsKey(thePath)) { pathItem = thePaths.get(thePath); } else { @@ -775,19 +756,19 @@ public class OpenApiInterceptor { switch (theMethod) { case POST: assert pathItem.getPost() == null : "Have duplicate POST at path: " + thePath; - return pathItem.post(newOperation).getPost(); + return pathItem.post(new Operation()).getPost(); case GET: assert pathItem.getGet() == null : "Have duplicate GET at path: " + thePath; - return pathItem.get(newOperation).getGet(); + return pathItem.get(new Operation()).getGet(); case PUT: assert pathItem.getPut() == null; - return pathItem.put(newOperation).getPut(); + return pathItem.put(new Operation()).getPut(); case PATCH: assert pathItem.getPatch() == null; - return pathItem.patch(newOperation).getPatch(); + return pathItem.patch(new Operation()).getPatch(); case DELETE: assert pathItem.getDelete() == null; - return pathItem.delete(newOperation).getDelete(); + return pathItem.delete(new Operation()).getDelete(); case HEAD: case OPTIONS: case TRACE: @@ -864,18 +845,6 @@ public class OpenApiInterceptor { theOperation.addParametersItem(parameter); } - private void addPartitionNameParameter(Operation theOperation) { - Parameter parameter = new Parameter(); - parameter.setName("partition_name"); - // FIXME MB only if request mode - parameter.setIn("path"); - parameter.setDescription("The name of the partition to target"); - parameter.setExample("DEFAULT"); - parameter.setSchema(new Schema().type("string").minimum(new BigDecimal(1))); - parameter.setStyle(Parameter.StyleEnum.SIMPLE); - theOperation.addParametersItem(parameter); - } - protected ClassLoaderTemplateResource getIndexTemplate() { return new ClassLoaderTemplateResource(myResourcePathToClasspath.get("/swagger-ui/index.html"), StandardCharsets.UTF_8.name()); } From 3135e82ea7e29b58d8b72d54a246323cf90c70fd Mon Sep 17 00:00:00 2001 From: Tadgh Date: Fri, 20 Aug 2021 18:48:34 -0400 Subject: [PATCH 37/49] Strip jetbrains annotations --- .../src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java | 2 +- .../jpa/dao/index/SearchParamWithInlineReferencesExtractor.java | 2 +- .../uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java | 2 +- .../src/test/java/ca/uhn/fhir/jpa/mdm/BaseMdmR4Test.java | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java index fa232f2bdc9..748ffa6352b 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/TransactionProcessor.java @@ -46,7 +46,7 @@ import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java index d057fb4c7cf..8fb7c9f70e0 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/index/SearchParamWithInlineReferencesExtractor.java @@ -55,7 +55,7 @@ import com.google.common.annotations.VisibleForTesting; import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java index 124a0a50c90..8f9c583ce23 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/reindex/ResourceReindexingSvcImpl.java @@ -42,7 +42,7 @@ import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.concurrent.BasicThreadFactory; import org.apache.commons.lang3.time.DateUtils; import org.hl7.fhir.r4.model.InstantType; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.quartz.JobExecutionContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/BaseMdmR4Test.java b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/BaseMdmR4Test.java index 9608fa44353..96115a95bf2 100644 --- a/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/BaseMdmR4Test.java +++ b/hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/BaseMdmR4Test.java @@ -62,7 +62,7 @@ import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Practitioner; import org.hl7.fhir.r4.model.Reference; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import javax.annotation.Nullable; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; From a054055be506f16d72ac94df11a34ce20723768f Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 23 Aug 2021 11:07:37 -0400 Subject: [PATCH 38/49] Add dependencies to convertor for javadoc build --- hapi-fhir-converter/pom.xml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index c661da5c233..89b9a18563d 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -207,6 +207,18 @@ commons-compress ${commons_compress_version} + + + org.projectlombok + lombok + 1.18.16 + + + + org.jetbrains + annotations + 22.0.0 + From 712fdbd8020cab26f16cbdd22d0fdc019ad19ae0 Mon Sep 17 00:00:00 2001 From: katie_smilecdr Date: Mon, 23 Aug 2021 15:12:13 -0400 Subject: [PATCH 39/49] [2904] remove unused staff --- .../main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java index e3fec55806f..0992fc6c98a 100644 --- a/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java +++ b/hapi-fhir-server-openapi/src/main/java/ca/uhn/fhir/rest/openapi/OpenApiInterceptor.java @@ -385,7 +385,6 @@ public class OpenApiInterceptor { Paths paths = new Paths(); openApi.setPaths(paths); - String partitionName = "DEFAULT/"; if (page == null || page.equals(PAGE_SYSTEM) || page.equals(PAGE_ALL)) { Tag serverTag = new Tag(); @@ -513,7 +512,7 @@ public class OpenApiInterceptor { // Search if (typeRestfulInteractions.contains(CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE)) { - Operation operation = getPathItem(paths, "/" + partitionName + resourceType, PathItem.HttpMethod.GET); + Operation operation = getPathItem(paths, "/" + resourceType, PathItem.HttpMethod.GET); operation.addTagsItem(resourceType); operation.setDescription("This is a search type"); operation.setSummary("search-type: Search for " + resourceType + " instances"); From bd0cf2b6ae2dfeeaa9ac6b94ff9045a3014a56d6 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 23 Aug 2021 15:38:16 -0400 Subject: [PATCH 40/49] Fix master pom reference --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ae4cf318ce9..74ca8ccaa9a 100644 --- a/pom.xml +++ b/pom.xml @@ -748,7 +748,7 @@ - 5.4.0 + 5.4.10 1.0.3 -Dfile.encoding=UTF-8 -Xmx2048m From 37ad73a422cff13835f9557ee54c42361f98c960 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 23 Aug 2021 15:42:18 -0400 Subject: [PATCH 41/49] Bump PRE version so we don't conflict downstream --- hapi-deployable-pom/pom.xml | 2 +- hapi-fhir-android/pom.xml | 2 +- hapi-fhir-base/pom.xml | 2 +- hapi-fhir-bom/pom.xml | 4 ++-- hapi-fhir-cli/hapi-fhir-cli-api/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-app/pom.xml | 2 +- hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml | 2 +- hapi-fhir-cli/pom.xml | 2 +- hapi-fhir-client-okhttp/pom.xml | 2 +- hapi-fhir-client/pom.xml | 2 +- hapi-fhir-converter/pom.xml | 2 +- hapi-fhir-dist/pom.xml | 2 +- hapi-fhir-docs/pom.xml | 2 +- hapi-fhir-jacoco/pom.xml | 2 +- hapi-fhir-jaxrsserver-base/pom.xml | 2 +- hapi-fhir-jpaserver-api/pom.xml | 2 +- hapi-fhir-jpaserver-base/pom.xml | 2 +- hapi-fhir-jpaserver-batch/pom.xml | 2 +- hapi-fhir-jpaserver-cql/pom.xml | 2 +- hapi-fhir-jpaserver-mdm/pom.xml | 2 +- hapi-fhir-jpaserver-migrate/pom.xml | 2 +- hapi-fhir-jpaserver-model/pom.xml | 2 +- hapi-fhir-jpaserver-searchparam/pom.xml | 2 +- hapi-fhir-jpaserver-subscription/pom.xml | 2 +- hapi-fhir-jpaserver-test-utilities/pom.xml | 2 +- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 2 +- hapi-fhir-server-mdm/pom.xml | 2 +- hapi-fhir-server-openapi/pom.xml | 2 +- hapi-fhir-server/pom.xml | 2 +- .../hapi-fhir-spring-boot-autoconfigure/pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../pom.xml | 2 +- .../hapi-fhir-spring-boot-samples/pom.xml | 2 +- .../hapi-fhir-spring-boot-starter/pom.xml | 2 +- hapi-fhir-spring-boot/pom.xml | 2 +- hapi-fhir-structures-dstu2.1/pom.xml | 2 +- hapi-fhir-structures-dstu2/pom.xml | 2 +- hapi-fhir-structures-dstu3/pom.xml | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- hapi-fhir-structures-r4/pom.xml | 2 +- hapi-fhir-structures-r5/pom.xml | 2 +- hapi-fhir-test-utilities/pom.xml | 2 +- hapi-fhir-testpage-overlay/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2.1/pom.xml | 2 +- hapi-fhir-validation-resources-dstu2/pom.xml | 2 +- hapi-fhir-validation-resources-dstu3/pom.xml | 2 +- hapi-fhir-validation-resources-r4/pom.xml | 2 +- hapi-fhir-validation-resources-r5/pom.xml | 2 +- hapi-fhir-validation/pom.xml | 2 +- hapi-tinder-plugin/pom.xml | 16 ++++++++-------- hapi-tinder-test/pom.xml | 2 +- pom.xml | 2 +- .../pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-client/pom.xml | 2 +- tests/hapi-fhir-base-test-mindeps-server/pom.xml | 2 +- 56 files changed, 64 insertions(+), 64 deletions(-) diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml index 5308ae09cac..97a7f698966 100644 --- a/hapi-deployable-pom/pom.xml +++ b/hapi-deployable-pom/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml index 25a1baa137d..3fb74827f93 100644 --- a/hapi-fhir-android/pom.xml +++ b/hapi-fhir-android/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index 47c2057541e..a7ac0302705 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-bom/pom.xml b/hapi-fhir-bom/pom.xml index 73e752cb095..8299f632b49 100644 --- a/hapi-fhir-bom/pom.xml +++ b/hapi-fhir-bom/pom.xml @@ -3,14 +3,14 @@ 4.0.0 ca.uhn.hapi.fhir hapi-fhir-bom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT pom HAPI FHIR BOM ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml index a3f8cc0ff2a..d758c2fa826 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-api/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml index 85b7edfe8d2..6754bf399d6 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-app/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir-cli - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml index ba93b27631f..a7c0c5300e3 100644 --- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml +++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../hapi-deployable-pom diff --git a/hapi-fhir-cli/pom.xml b/hapi-fhir-cli/pom.xml index 4fd1932174c..87195288afe 100644 --- a/hapi-fhir-cli/pom.xml +++ b/hapi-fhir-cli/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml index ade4fa29b7c..13c7f7af8bd 100644 --- a/hapi-fhir-client-okhttp/pom.xml +++ b/hapi-fhir-client-okhttp/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-client/pom.xml b/hapi-fhir-client/pom.xml index 2394ac950a9..7ac45a8c943 100644 --- a/hapi-fhir-client/pom.xml +++ b/hapi-fhir-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index 5d9e3e5a169..16543404954 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-dist/pom.xml b/hapi-fhir-dist/pom.xml index 4af7e03731e..3c20dd131b9 100644 --- a/hapi-fhir-dist/pom.xml +++ b/hapi-fhir-dist/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-docs/pom.xml b/hapi-fhir-docs/pom.xml index 67a0452aeef..8057f47b1cc 100644 --- a/hapi-fhir-docs/pom.xml +++ b/hapi-fhir-docs/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml index 21209b4937f..ba7399f2148 100644 --- a/hapi-fhir-jacoco/pom.xml +++ b/hapi-fhir-jacoco/pom.xml @@ -11,7 +11,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml index e0d835b4865..9a6548cb58a 100644 --- a/hapi-fhir-jaxrsserver-base/pom.xml +++ b/hapi-fhir-jaxrsserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-api/pom.xml b/hapi-fhir-jpaserver-api/pom.xml index 1306d7505f9..7e5767c9039 100644 --- a/hapi-fhir-jpaserver-api/pom.xml +++ b/hapi-fhir-jpaserver-api/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 3e40dfdc235..9a5909c79de 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-batch/pom.xml b/hapi-fhir-jpaserver-batch/pom.xml index 561f0ba1399..660fdb5320a 100644 --- a/hapi-fhir-jpaserver-batch/pom.xml +++ b/hapi-fhir-jpaserver-batch/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-cql/pom.xml b/hapi-fhir-jpaserver-cql/pom.xml index f7470f99c94..5e7a38e555b 100644 --- a/hapi-fhir-jpaserver-cql/pom.xml +++ b/hapi-fhir-jpaserver-cql/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-mdm/pom.xml b/hapi-fhir-jpaserver-mdm/pom.xml index 2df9804cffe..8970e99afbf 100644 --- a/hapi-fhir-jpaserver-mdm/pom.xml +++ b/hapi-fhir-jpaserver-mdm/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-migrate/pom.xml b/hapi-fhir-jpaserver-migrate/pom.xml index 0495379d845..549dda66e65 100644 --- a/hapi-fhir-jpaserver-migrate/pom.xml +++ b/hapi-fhir-jpaserver-migrate/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-model/pom.xml b/hapi-fhir-jpaserver-model/pom.xml index e45927d92e7..2329c0873f6 100644 --- a/hapi-fhir-jpaserver-model/pom.xml +++ b/hapi-fhir-jpaserver-model/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-searchparam/pom.xml b/hapi-fhir-jpaserver-searchparam/pom.xml index db117accac4..1e10aec0e32 100755 --- a/hapi-fhir-jpaserver-searchparam/pom.xml +++ b/hapi-fhir-jpaserver-searchparam/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-subscription/pom.xml b/hapi-fhir-jpaserver-subscription/pom.xml index 2e902e31136..97181675c03 100644 --- a/hapi-fhir-jpaserver-subscription/pom.xml +++ b/hapi-fhir-jpaserver-subscription/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-test-utilities/pom.xml b/hapi-fhir-jpaserver-test-utilities/pom.xml index 9dedd18cbe1..c1f8822b95b 100644 --- a/hapi-fhir-jpaserver-test-utilities/pom.xml +++ b/hapi-fhir-jpaserver-test-utilities/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 95f27c3e3d4..51f3502fe96 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-server-mdm/pom.xml b/hapi-fhir-server-mdm/pom.xml index a8d1d926e16..fcfdafec802 100644 --- a/hapi-fhir-server-mdm/pom.xml +++ b/hapi-fhir-server-mdm/pom.xml @@ -7,7 +7,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server-openapi/pom.xml b/hapi-fhir-server-openapi/pom.xml index 6e160bdbb80..f2ad8061c43 100644 --- a/hapi-fhir-server-openapi/pom.xml +++ b/hapi-fhir-server-openapi/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-server/pom.xml b/hapi-fhir-server/pom.xml index 52962612686..a559df05560 100644 --- a/hapi-fhir-server/pom.xml +++ b/hapi-fhir-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml index 0f08f769abc..9e99e253301 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml index 7bf3fb61ff3..add47835990 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-apache/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT hapi-fhir-spring-boot-sample-client-apache diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml index 9a1f75a753c..c447df7668e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-client-okhttp/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT hapi-fhir-spring-boot-sample-client-okhttp diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml index 5c2f70575c4..526933dc09e 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jersey/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot-samples - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT hapi-fhir-spring-boot-sample-server-jersey diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml index fa33082ade9..6bcafa300e8 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir-spring-boot - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT hapi-fhir-spring-boot-samples diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml index 22c97daad3c..93232ddab59 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-spring-boot/pom.xml b/hapi-fhir-spring-boot/pom.xml index cd1f7aa48c9..a04306dfeb6 100644 --- a/hapi-fhir-spring-boot/pom.xml +++ b/hapi-fhir-spring-boot/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml index 39b761b9b38..f0f14d0d96e 100644 --- a/hapi-fhir-structures-dstu2.1/pom.xml +++ b/hapi-fhir-structures-dstu2.1/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml index 5b137f3a214..b007972e5e4 100644 --- a/hapi-fhir-structures-dstu2/pom.xml +++ b/hapi-fhir-structures-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-dstu3/pom.xml b/hapi-fhir-structures-dstu3/pom.xml index 4a0bbf0f03e..b96f7bb77eb 100644 --- a/hapi-fhir-structures-dstu3/pom.xml +++ b/hapi-fhir-structures-dstu3/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 0c366ce804f..4530c889d95 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r4/pom.xml b/hapi-fhir-structures-r4/pom.xml index d89aec7f1fc..547c81b936a 100644 --- a/hapi-fhir-structures-r4/pom.xml +++ b/hapi-fhir-structures-r4/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-structures-r5/pom.xml b/hapi-fhir-structures-r5/pom.xml index 9d05be5eb39..4400f91fe15 100644 --- a/hapi-fhir-structures-r5/pom.xml +++ b/hapi-fhir-structures-r5/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-test-utilities/pom.xml b/hapi-fhir-test-utilities/pom.xml index 784284a5beb..a7004891daf 100644 --- a/hapi-fhir-test-utilities/pom.xml +++ b/hapi-fhir-test-utilities/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index 991c02e9a1e..3d4ecc1f4e4 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-validation-resources-dstu2.1/pom.xml b/hapi-fhir-validation-resources-dstu2.1/pom.xml index 15a9ae79b4a..972e01c812c 100644 --- a/hapi-fhir-validation-resources-dstu2.1/pom.xml +++ b/hapi-fhir-validation-resources-dstu2.1/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu2/pom.xml b/hapi-fhir-validation-resources-dstu2/pom.xml index 6095a55f994..a0956c5ddb3 100644 --- a/hapi-fhir-validation-resources-dstu2/pom.xml +++ b/hapi-fhir-validation-resources-dstu2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-dstu3/pom.xml b/hapi-fhir-validation-resources-dstu3/pom.xml index f9357e9da9e..c7a59822801 100644 --- a/hapi-fhir-validation-resources-dstu3/pom.xml +++ b/hapi-fhir-validation-resources-dstu3/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r4/pom.xml b/hapi-fhir-validation-resources-r4/pom.xml index 0c409535855..8457e1aebf8 100644 --- a/hapi-fhir-validation-resources-r4/pom.xml +++ b/hapi-fhir-validation-resources-r4/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation-resources-r5/pom.xml b/hapi-fhir-validation-resources-r5/pom.xml index 5354eaacce7..3467c240d86 100644 --- a/hapi-fhir-validation-resources-r5/pom.xml +++ b/hapi-fhir-validation-resources-r5/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-fhir-validation/pom.xml b/hapi-fhir-validation/pom.xml index ed265396810..50945ea7032 100644 --- a/hapi-fhir-validation/pom.xml +++ b/hapi-fhir-validation/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-deployable-pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../hapi-deployable-pom/pom.xml diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index b29eac9ff4e..51bffb211be 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml @@ -58,37 +58,37 @@ ca.uhn.hapi.fhir hapi-fhir-structures-dstu3 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-hl7org-dstu2 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-r4 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-structures-r5 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu2 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-dstu3 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-validation-resources-r4 - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT org.apache.velocity diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index 3d072e467b9..86353fff4ab 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 74ca8ccaa9a..5c72a01da01 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT HAPI-FHIR An open-source implementation of the FHIR specification in Java. https://hapifhir.io diff --git a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml index 2771f4f46c3..7bc3167aba0 100644 --- a/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml +++ b/tests/hapi-fhir-base-test-jaxrsserver-kotlin/pom.xml @@ -6,7 +6,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-client/pom.xml b/tests/hapi-fhir-base-test-mindeps-client/pom.xml index 3cf38d46df1..baf9d3f29a7 100644 --- a/tests/hapi-fhir-base-test-mindeps-client/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-client/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../pom.xml diff --git a/tests/hapi-fhir-base-test-mindeps-server/pom.xml b/tests/hapi-fhir-base-test-mindeps-server/pom.xml index 4c651d95698..aa020297fb3 100644 --- a/tests/hapi-fhir-base-test-mindeps-server/pom.xml +++ b/tests/hapi-fhir-base-test-mindeps-server/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 5.6.0-PRE1-SNAPSHOT + 5.6.0-PRE2-SNAPSHOT ../../pom.xml From 121d171c2f0c48d4afe5100800b75de778981700 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 23 Aug 2021 16:00:24 -0400 Subject: [PATCH 42/49] Readd javadoc-needed deps --- hapi-fhir-converter/pom.xml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hapi-fhir-converter/pom.xml b/hapi-fhir-converter/pom.xml index 16543404954..10f8d934c02 100644 --- a/hapi-fhir-converter/pom.xml +++ b/hapi-fhir-converter/pom.xml @@ -207,6 +207,16 @@ commons-compress ${commons_compress_version} + + org.projectlombok + lombok + 1.18.16 + + + org.jetbrains + annotations + 22.0.0 + From a0dd79f68ed1ee48d7c3f4f50cebc0c315551e10 Mon Sep 17 00:00:00 2001 From: katie_smilecdr Date: Mon, 23 Aug 2021 16:38:22 -0400 Subject: [PATCH 43/49] [2904] add changelog --- .../5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml new file mode 100644 index 00000000000..8ea4a75f565 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml @@ -0,0 +1,4 @@ +--- +type: change +issue: 2904 +title: "Change getPathItem method in OpenApiIntercepter from private to protected" From 2fbe7d74439768556ee00030ca3fb32139bfd039 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 23 Aug 2021 16:39:19 -0400 Subject: [PATCH 44/49] Strip broken backport line --- ...2902-includes-includes-on-revincludes.yaml | 1 - .../uhn/fhir/rest/server/mail/MailConfig.java | 20 +++++++++++++++++++ .../ca/uhn/fhir/rest/server/mail/MailSvc.java | 20 +++++++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2902-includes-includes-on-revincludes.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2902-includes-includes-on-revincludes.yaml index 3085e6b801f..98d6287a670 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2902-includes-includes-on-revincludes.yaml +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2902-includes-includes-on-revincludes.yaml @@ -2,5 +2,4 @@ type: fix issue: 2902 jira: SMILE-3000 -backport: cust_fmc_5_3 title: "Fixed a bug wherein includes were not being included on revincludes." diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailConfig.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailConfig.java index 02bb16f9fdc..2202f27b77e 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailConfig.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailConfig.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.rest.server.mail; +/*- + * #%L + * HAPI FHIR - Server Framework + * %% + * Copyright (C) 2014 - 2021 Smile CDR, Inc. + * %% + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailSvc.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailSvc.java index 5c87c4256dd..df1cd4e9dca 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailSvc.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/mail/MailSvc.java @@ -1,5 +1,25 @@ package ca.uhn.fhir.rest.server.mail; +/*- + * #%L + * HAPI FHIR - Server Framework + * %% + * Copyright (C) 2014 - 2021 Smile CDR, Inc. + * %% + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * #L% + */ + import org.apache.commons.lang3.Validate; import org.simplejavamail.MailException; import org.simplejavamail.api.email.Email; From f8fa09ae8eab95f2b7541ba222ccd0cff643181c Mon Sep 17 00:00:00 2001 From: katie_smilecdr Date: Mon, 23 Aug 2021 16:39:52 -0400 Subject: [PATCH 45/49] [2904] add changelog --- .../5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml index 8ea4a75f565..241a5c78253 100644 --- a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml @@ -1,4 +1,4 @@ --- type: change issue: 2904 -title: "Change getPathItem method in OpenApiIntercepter from private to protected" +title: "Change getPathItem method in OpenApiInterceptor from private to protected" From 1211600e257c85e13b5acf0de0c8cefdf85c9ecb Mon Sep 17 00:00:00 2001 From: katie_smilecdr Date: Tue, 24 Aug 2021 11:54:41 -0400 Subject: [PATCH 46/49] [2904] update changelog file name --- ...ns.yaml => 2904-swagger-ui-Does-not-work-with-partitions.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/{2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml => 2904-swagger-ui-Does-not-work-with-partitions.yaml} (100%) diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-swagger-ui-Does-not-work-with-partitions.yaml similarity index 100% rename from hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-Swagger-ui-Doesn't-Work-with-Partitions.yaml rename to hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2904-swagger-ui-Does-not-work-with-partitions.yaml From 090a8b08216e3181eb1b80ff294b948e5f0f7129 Mon Sep 17 00:00:00 2001 From: Frank Tao <38163583+frankjtao@users.noreply.github.com> Date: Wed, 25 Aug 2021 14:47:10 -0400 Subject: [PATCH 47/49] Impl displayLanguage for $lookup (#2908) * Impl displayLanguage for $lookup - first cut * Added original lookupCode method * Added original lookupCode method to IFhirResourceDaoCodeSystem * Added more test cases and changelog --- .../context/support/IValidationSupport.java | 16 +- .../uhn/hapi/fhir/docs/ValidatorExamples.java | 2 +- .../5_6_0/2905-lookup-display-language.yaml | 4 + .../api/dao/IFhirResourceDaoCodeSystem.java | 3 + .../jpa/dao/FhirResourceDaoValueSetDstu2.java | 8 +- .../dstu3/FhirResourceDaoCodeSystemDstu3.java | 16 +- .../dao/r4/FhirResourceDaoCodeSystemR4.java | 14 +- .../dao/r5/FhirResourceDaoCodeSystemR5.java | 17 +- .../BaseJpaResourceProviderValueSetDstu2.java | 2 +- ...aseJpaResourceProviderCodeSystemDstu3.java | 7 +- .../BaseJpaResourceProviderCodeSystemR4.java | 7 +- .../BaseJpaResourceProviderCodeSystemR5.java | 5 +- .../fhir/jpa/term/BaseTermReadSvcImpl.java | 25 ++- .../uhn/fhir/jpa/term/TermReadSvcDstu3.java | 4 +- .../ca/uhn/fhir/jpa/term/TermReadSvcR4.java | 4 +- .../ca/uhn/fhir/jpa/term/TermReadSvcR5.java | 4 +- ...ceProviderR3CodeSystemDesignationTest.java | 173 +++++++++++++++ .../r4/BaseResourceProviderR4Test.java | 59 ++--- ...ceProviderR4CodeSystemDesignationTest.java | 173 +++++++++++++++ ...ceProviderR5CodeSystemDesignationTest.java | 173 +++++++++++++++ .../jpa/term/TerminologySvcDeltaR4Test.java | 10 +- ...ional-case-3-cs-with-designations-lang.xml | 204 ++++++++++++++++++ .../support/BaseValidationSupportWrapper.java | 4 +- .../support/CachingValidationSupport.java | 4 +- .../CommonCodeSystemsTerminologyService.java | 2 +- ...oryTerminologyServerValidationSupport.java | 4 +- .../support/ValidationSupportChain.java | 4 +- ...ologyDisplayPopulationInterceptorTest.java | 7 +- ...mmonCodeSystemsTerminologyServiceTest.java | 2 +- .../FhirInstanceValidatorR4Test.java | 2 +- 30 files changed, 882 insertions(+), 77 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2905-lookup-display-language.yaml create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderR3CodeSystemDesignationTest.java create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemDesignationTest.java create mode 100644 hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5CodeSystemDesignationTest.java create mode 100644 hapi-fhir-jpaserver-base/src/test/resources/extensional-case-3-cs-with-designations-lang.xml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java index 3ab90dd4ec7..2ffc57116cb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/support/IValidationSupport.java @@ -266,12 +266,26 @@ public interface IValidationSupport { * other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter. * @param theSystem The CodeSystem URL * @param theCode The code + * @param theDisplayLanguage to filter out the designation by the display language, to return all designation, the this value to null */ @Nullable - default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { return null; } + /** + * Look up a code using the system and code value + * + * @param theValidationSupportContext The validation support module will be passed in to this method. This is convenient in cases where the operation needs to make calls to + * other method in the support chain, so that they can be passed through the entire chain. Implementations of this interface may always safely ignore this parameter. + * @param theSystem The CodeSystem URL + * @param theCode The code + */ + @Nullable + default LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + return lookupCode(theValidationSupportContext, theSystem, theCode, null); + } + /** * Returns true if the given valueset can be validated by the given * validation support module diff --git a/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ValidatorExamples.java b/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ValidatorExamples.java index 4c12593024c..0c634e415cc 100644 --- a/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ValidatorExamples.java +++ b/hapi-fhir-docs/src/main/java/ca/uhn/hapi/fhir/docs/ValidatorExamples.java @@ -299,7 +299,7 @@ public class ValidatorExamples { } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { // TODO: implement (or return null if your implementation does not support this function) return null; } diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2905-lookup-display-language.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2905-lookup-display-language.yaml new file mode 100644 index 00000000000..30a6db8047f --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2905-lookup-display-language.yaml @@ -0,0 +1,4 @@ +--- +type: add +issue: 2905 +title: "Added displayLanguage support for CodeSystem $lookup operation to filter out designation by language." diff --git a/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDaoCodeSystem.java b/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDaoCodeSystem.java index 8161630cd71..bfee55a9d61 100644 --- a/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDaoCodeSystem.java +++ b/hapi-fhir-jpaserver-api/src/main/java/ca/uhn/fhir/jpa/api/dao/IFhirResourceDaoCodeSystem.java @@ -40,6 +40,9 @@ public interface IFhirResourceDaoCodeSystem ext @Nonnull IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, CD theCoding, RequestDetails theRequestDetails); + @Nonnull + IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, CD theCoding, IPrimitiveType theDisplayLanguage, RequestDetails theRequestDetails); + SubsumesResult subsumes(IPrimitiveType theCodeA, IPrimitiveType theCodeB, IPrimitiveType theSystem, CD theCodingA, CD theCodingB, RequestDetails theRequestDetails); IValidationSupport.CodeValidationResult validateCode(IIdType theCodeSystemId, IPrimitiveType theCodeSystemUrl, IPrimitiveType theVersion, IPrimitiveType theCode, IPrimitiveType theDisplay, CD theCoding, CC theCodeableConcept, RequestDetails theRequestDetails); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java index 25c3cf98bcb..4094915d6bb 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoValueSetDstu2.java @@ -230,7 +230,13 @@ public class FhirResourceDaoValueSetDstu2 extends BaseHapiFhirResourceDao theCode, IPrimitiveType theSystem, CodingDt theCoding, RequestDetails theRequest) { + public IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, CodingDt theCoding, RequestDetails theRequest) { + return lookupCode(theCode, theSystem, theCoding, null, theRequest); + } + + @Nonnull + @Override + public IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, CodingDt theCoding, IPrimitiveType theDisplayLanguage, RequestDetails theRequest) { boolean haveCoding = theCoding != null && isNotBlank(theCoding.getSystem()) && isNotBlank(theCoding.getCode()); boolean haveCode = theCode != null && theCode.isEmpty() == false; boolean haveSystem = theSystem != null && theSystem.isEmpty() == false; diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java index b1a1e17e49f..e555909edba 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoCodeSystemDstu3.java @@ -87,10 +87,17 @@ public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao theCode, IPrimitiveType theSystem, Coding theCoding, RequestDetails theRequestDetails) { + return lookupCode(theCode, theSystem, theCoding, null, theRequestDetails); + } + + @Nonnull + @Override + public IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, Coding theCoding, IPrimitiveType theDisplayLanguage, RequestDetails theRequestDetails) { boolean haveCoding = theCoding != null && isNotBlank(theCoding.getSystem()) && isNotBlank(theCoding.getCode()); boolean haveCode = theCode != null && theCode.isEmpty() == false; boolean haveSystem = theSystem != null && theSystem.isEmpty() == false; - + boolean haveDisplayLanguage = theDisplayLanguage != null && theDisplayLanguage.isEmpty() == false; + if (!haveCoding && !(haveSystem && haveCode)) { throw new InvalidRequestException("No code, coding, or codeableConcept provided to validate"); } @@ -112,11 +119,16 @@ public class FhirResourceDaoCodeSystemDstu3 extends BaseHapiFhirResourceDao theCode, IPrimitiveType theSystem, Coding theCoding, RequestDetails theRequestDetails) { + return lookupCode(theCode, theSystem, theCoding, null, theRequestDetails); + } + + @Nonnull + @Override + public IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, Coding theCoding, IPrimitiveType theDisplayLanguage, RequestDetails theRequestDetails) { boolean haveCoding = theCoding != null && isNotBlank(theCoding.getSystem()) && isNotBlank(theCoding.getCode()); boolean haveCode = theCode != null && theCode.isEmpty() == false; boolean haveSystem = theSystem != null && theSystem.isEmpty() == false; + boolean haveDisplayLanguage = theDisplayLanguage != null && theDisplayLanguage.isEmpty() == false; if (!haveCoding && !(haveSystem && haveCode)) { throw new InvalidRequestException("No code, coding, or codeableConcept provided to validate"); @@ -107,12 +114,17 @@ public class FhirResourceDaoCodeSystemR4 extends BaseHapiFhirResourceDao implements IFhirResourceDaoCodeSystem { @@ -87,10 +86,17 @@ public class FhirResourceDaoCodeSystemR5 extends BaseHapiFhirResourceDao theCode, IPrimitiveType theSystem, Coding theCoding, RequestDetails theRequestDetails) { + return lookupCode(theCode, theSystem, theCoding, null, theRequestDetails); + } + + @Nonnull + @Override + public IValidationSupport.LookupCodeResult lookupCode(IPrimitiveType theCode, IPrimitiveType theSystem, Coding theCoding, IPrimitiveType theDisplayLanguage, RequestDetails theRequestDetails) { boolean haveCoding = theCoding != null && isNotBlank(theCoding.getSystem()) && isNotBlank(theCoding.getCode()); boolean haveCode = theCode != null && theCode.isEmpty() == false; boolean haveSystem = theSystem != null && theSystem.isEmpty() == false; - + boolean haveDisplayLanguage = theDisplayLanguage != null && theDisplayLanguage.isEmpty() == false; + if (!haveCoding && !(haveSystem && haveCode)) { throw new InvalidRequestException("No code, coding, or codeableConcept provided to validate"); } @@ -112,12 +118,17 @@ public class FhirResourceDaoCodeSystemR5 extends BaseHapiFhirResourceDao dao = (IFhirResourceDaoCodeSystem) getDao(); - IValidationSupport.LookupCodeResult result = dao.lookupCode(theCode, theSystem, theCoding, theRequestDetails); + IValidationSupport.LookupCodeResult result = dao.lookupCode(theCode, theSystem, theCoding, null, theRequestDetails); if (result.isFound() == false) { throw new ResourceNotFoundException("Unable to find code[" + result.getSearchedForCode() + "] in system[" + result.getSearchedForSystem() + "]"); } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCodeSystemDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCodeSystemDstu3.java index bb0bcc876c5..58729568231 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCodeSystemDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderCodeSystemDstu3.java @@ -53,7 +53,8 @@ public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderD @OperationParam(name = "code", min = 0, max = 1) CodeType theCode, @OperationParam(name = "system", min = 0, max = 1) UriType theSystem, @OperationParam(name = "coding", min = 0, max = 1) Coding theCoding, - @OperationParam(name="version", min=0, max=1) StringType theVersion, + @OperationParam(name = "version", min=0, max=1) StringType theVersion, + @OperationParam(name = "displayLanguage", min=0, max=1) CodeType theDisplayLanguage, @OperationParam(name = "property", min = 0, max = OperationParam.MAX_UNLIMITED) List theProperties, RequestDetails theRequestDetails ) { @@ -63,9 +64,9 @@ public class BaseJpaResourceProviderCodeSystemDstu3 extends JpaResourceProviderD IFhirResourceDaoCodeSystem dao = (IFhirResourceDaoCodeSystem) getDao(); IValidationSupport.LookupCodeResult result; if (theVersion != null) { - result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theRequestDetails); + result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theDisplayLanguage, theRequestDetails); } else { - result = dao.lookupCode(theCode, theSystem, theCoding, theRequestDetails); + result = dao.lookupCode(theCode, theSystem, theCoding, theDisplayLanguage, theRequestDetails); } result.throwNotFoundIfAppropriate(); return (Parameters) result.toParameters(theRequestDetails.getFhirContext(), theProperties); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCodeSystemR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCodeSystemR4.java index 5c237f7a459..f625387b47e 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCodeSystemR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r4/BaseJpaResourceProviderCodeSystemR4.java @@ -61,7 +61,8 @@ public class BaseJpaResourceProviderCodeSystemR4 extends JpaResourceProviderR4 theProperties, + @OperationParam(name="displayLanguage", min=0, max=1) CodeType theDisplayLanguage, + @OperationParam(name="property", min = 0, max = OperationParam.MAX_UNLIMITED) List theProperties, RequestDetails theRequestDetails ) { @@ -70,9 +71,9 @@ public class BaseJpaResourceProviderCodeSystemR4 extends JpaResourceProviderR4 dao = (IFhirResourceDaoCodeSystem) getDao(); IValidationSupport.LookupCodeResult result; if (theVersion != null) { - result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theRequestDetails); + result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theDisplayLanguage, theRequestDetails); } else { - result = dao.lookupCode(theCode, theSystem, theCoding, theRequestDetails); + result = dao.lookupCode(theCode, theSystem, theCoding, theDisplayLanguage, theRequestDetails); } result.throwNotFoundIfAppropriate(); return (Parameters) result.toParameters(theRequestDetails.getFhirContext(), theProperties); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderCodeSystemR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderCodeSystemR5.java index 99a566b5cde..0fce1e5d319 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderCodeSystemR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/r5/BaseJpaResourceProviderCodeSystemR5.java @@ -60,6 +60,7 @@ public class BaseJpaResourceProviderCodeSystemR5 extends JpaResourceProviderR5 theProperties, RequestDetails theRequestDetails ) { @@ -69,9 +70,9 @@ public class BaseJpaResourceProviderCodeSystemR5 extends JpaResourceProviderR5 dao = (IFhirResourceDaoCodeSystem) getDao(); IValidationSupport.LookupCodeResult result; if (theVersion != null) { - result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theRequestDetails); + result = dao.lookupCode(theCode, new UriType(theSystem.getValue() + "|" + theVersion), theCoding, theDisplayLanguage, theRequestDetails); } else { - result = dao.lookupCode(theCode, theSystem, theCoding, theRequestDetails); + result = dao.lookupCode(theCode, theSystem, theCoding, theDisplayLanguage, theRequestDetails); } result.throwNotFoundIfAppropriate(); return (Parameters) result.toParameters(theRequestDetails.getFhirContext(), theProperties); diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java index 125fbe191c9..3c79196b2ef 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/BaseTermReadSvcImpl.java @@ -1989,7 +1989,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { protected abstract ValueSet toCanonicalValueSet(IBaseResource theValueSet); - protected IValidationSupport.LookupCodeResult lookupCode(String theSystem, String theCode) { + protected IValidationSupport.LookupCodeResult lookupCode(String theSystem, String theCode, String theDisplayLanguage) { TransactionTemplate txTemplate = new TransactionTemplate(myTransactionManager); return txTemplate.execute(t -> { Optional codeOpt = findCode(theSystem, theCode); @@ -2006,12 +2006,15 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { for (TermConceptDesignation next : code.getDesignations()) { IValidationSupport.ConceptDesignation designation = new IValidationSupport.ConceptDesignation(); - designation.setLanguage(next.getLanguage()); - designation.setUseSystem(next.getUseSystem()); - designation.setUseCode(next.getUseCode()); - designation.setUseDisplay(next.getUseDisplay()); - designation.setValue(next.getValue()); - result.getDesignations().add(designation); + // filter out the designation based on displayLanguage if any + if (isDisplayLanguageMatch(theDisplayLanguage, next.getLanguage())) { + designation.setLanguage(next.getLanguage()); + designation.setUseSystem(next.getUseSystem()); + designation.setUseCode(next.getUseCode()); + designation.setUseDisplay(next.getUseDisplay()); + designation.setValue(next.getValue()); + result.getDesignations().add(designation); + } } for (TermConceptProperty next : code.getProperties()) { @@ -2034,6 +2037,7 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { }); } + @Nullable private ConceptSubsumptionOutcome testForSubsumption(SearchSession theSearchSession, TermConcept theLeft, TermConcept theRight, ConceptSubsumptionOutcome theOutput) { List fetch = theSearchSession.search(TermConcept.class) @@ -2481,4 +2485,11 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc { return termConcept; } + static boolean isDisplayLanguageMatch(String theReqLang, String theStoredLang) { + // NOTE: return the designation when one of then is not specified. + if (theReqLang == null || theStoredLang == null) + return true; + + return theReqLang.equalsIgnoreCase(theStoredLang); + } } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java index eafe533f2d3..5c26ce861c6 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcDstu3.java @@ -145,8 +145,8 @@ public class TermReadSvcDstu3 extends BaseTermReadSvcImpl implements IValidation } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { - return super.lookupCode(theSystem, theCode); + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { + return super.lookupCode(theSystem, theCode, theDisplayLanguage); } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR4.java index 576669c0ecc..51a55161972 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR4.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR4.java @@ -92,8 +92,8 @@ public class TermReadSvcR4 extends BaseTermReadSvcImpl implements ITermReadSvcR4 } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { - return super.lookupCode(theSystem, theCode); + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { + return super.lookupCode(theSystem, theCode, theDisplayLanguage); } @Override diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java index 56c14ea5d94..5d7686336ac 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/term/TermReadSvcR5.java @@ -144,8 +144,8 @@ public class TermReadSvcR5 extends BaseTermReadSvcImpl implements IValidationSup } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { - return super.lookupCode(theSystem, theCode); + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { + return super.lookupCode(theSystem, theCode, theDisplayLanguage); } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderR3CodeSystemDesignationTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderR3CodeSystemDesignationTest.java new file mode 100644 index 00000000000..ee4eaa4bb6d --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderR3CodeSystemDesignationTest.java @@ -0,0 +1,173 @@ +package ca.uhn.fhir.jpa.provider.dstu3; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.CodeSystem; +import org.hl7.fhir.dstu3.model.CodeType; +import org.hl7.fhir.dstu3.model.Parameters; +import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.UriType; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.transaction.annotation.Transactional; + +public class ResourceProviderR3CodeSystemDesignationTest extends BaseResourceProviderDstu3Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR3CodeSystemDesignationTest.class); + + private static final String CS_ACME_URL = "http://acme.org"; + + @BeforeEach + @Transactional + public void before02() throws IOException { + CodeSystem cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs-with-designations-lang.xml"); + myCodeSystemDao.create(cs, mySrd).getId().toUnqualifiedVersionless(); + } + + @Test + public void testLookupWithDisplayLanguage() { + Parameters respParam = ourClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .andParameter("displayLanguage",new CodeType("de-AT")) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(2, designationList.size()); + + // 1. de-AT:Systolic blood pressure 12 hour minimum + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("de-AT", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("de-AT:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 2. Systolic blood pressure 12 hour minimum (no language) + designation = designationList.get(1); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + + + @Test + public void testLookupWithNonExistLanguage() { + Parameters respParam = ourClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .andParameter("displayLanguage",new CodeType("zh-CN")) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(1, designationList.size()); + + // 1. Systolic blood pressure 12 hour minimum (no language) + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + + @Test + public void testLookupWithoutDisplayLanguage() { + Parameters respParam = ourClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(3, designationList.size()); + + // 1. fr-FR:Systolic blood pressure 12 hour minimum + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("fr-FR", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("fr-FR:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 2. de-AT:Systolic blood pressure 12 hour minimum + designation = designationList.get(1); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("de-AT", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("de-AT:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 3. Systolic blood pressure 12 hour minimum (no language) + designation = designationList.get(2); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + private List getDesignations(List parameterList) { + + List designationList = new ArrayList<>(); + + for (ParametersParameterComponent parameter : parameterList) { + if ("designation".equals(parameter.getName())) + designationList.add(parameter); + } + return designationList; + + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java index 72217fb569b..6081f5019a5 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java @@ -1,5 +1,35 @@ package ca.uhn.fhir.jpa.provider.r4; +import static org.apache.commons.lang3.StringUtils.isNotBlank; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; +import org.hl7.fhir.r4.model.Parameters; +import org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.r4.model.Patient; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.context.ContextLoader; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; +import org.springframework.web.context.support.GenericWebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.servlet.DispatcherServlet; + import ca.uhn.fhir.context.support.IValidationSupport; import ca.uhn.fhir.jpa.api.dao.DaoRegistry; import ca.uhn.fhir.jpa.api.svc.ISearchCoordinatorSvc; @@ -26,35 +56,6 @@ import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.rest.server.provider.DeleteExpungeProvider; import ca.uhn.fhir.rest.server.provider.ReindexProvider; import ca.uhn.fhir.test.utilities.JettyUtil; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.eclipse.jetty.server.Server; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.hl7.fhir.r4.model.Bundle; -import org.hl7.fhir.r4.model.Bundle.BundleEntryComponent; -import org.hl7.fhir.r4.model.Parameters; -import org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent; -import org.hl7.fhir.r4.model.Patient; -import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.context.ContextLoader; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.context.support.GenericWebApplicationContext; -import org.springframework.web.context.support.WebApplicationContextUtils; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.servlet.DispatcherServlet; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.concurrent.TimeUnit; - -import static org.apache.commons.lang3.StringUtils.isNotBlank; public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemDesignationTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemDesignationTest.java new file mode 100644 index 00000000000..0d9c5eedf27 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemDesignationTest.java @@ -0,0 +1,173 @@ +package ca.uhn.fhir.jpa.provider.r4; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.CodeSystem; +import org.hl7.fhir.r4.model.CodeType; +import org.hl7.fhir.r4.model.Parameters; +import org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.UriType; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.transaction.annotation.Transactional; + +public class ResourceProviderR4CodeSystemDesignationTest extends BaseResourceProviderR4Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR4CodeSystemDesignationTest.class); + + private static final String CS_ACME_URL = "http://acme.org"; + + @BeforeEach + @Transactional + public void before02() throws IOException { + CodeSystem cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs-with-designations-lang.xml"); + myCodeSystemDao.create(cs, mySrd).getId().toUnqualifiedVersionless(); + } + + @Test + public void testLookupWithDisplayLanguage() { + Parameters respParam = myClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .andParameter("displayLanguage",new CodeType("de-AT")) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(2, designationList.size()); + + // 1. de-AT:Systolic blood pressure 12 hour minimum + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("de-AT", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("de-AT:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 2. Systolic blood pressure 12 hour minimum (no language) + designation = designationList.get(1); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + + + @Test + public void testLookupWithNonExistLanguage() { + Parameters respParam = myClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .andParameter("displayLanguage",new CodeType("zh-CN")) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(1, designationList.size()); + + // 1. Systolic blood pressure 12 hour minimum (no language) + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + + @Test + public void testLookupWithoutDisplayLanguage() { + Parameters respParam = myClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(3, designationList.size()); + + // 1. fr-FR:Systolic blood pressure 12 hour minimum + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("fr-FR", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("fr-FR:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 2. de-AT:Systolic blood pressure 12 hour minimum + designation = designationList.get(1); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("de-AT", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("de-AT:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 3. Systolic blood pressure 12 hour minimum (no language) + designation = designationList.get(2); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + private List getDesignations(List parameterList) { + + List designationList = new ArrayList<>(); + + for (ParametersParameterComponent parameter : parameterList) { + if ("designation".equals(parameter.getName())) + designationList.add(parameter); + } + return designationList; + + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5CodeSystemDesignationTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5CodeSystemDesignationTest.java new file mode 100644 index 00000000000..8d731986ada --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r5/ResourceProviderR5CodeSystemDesignationTest.java @@ -0,0 +1,173 @@ +package ca.uhn.fhir.jpa.provider.r5; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.r5.model.BooleanType; +import org.hl7.fhir.r5.model.CodeSystem; +import org.hl7.fhir.r5.model.CodeType; +import org.hl7.fhir.r5.model.Parameters; +import org.hl7.fhir.r5.model.Parameters.ParametersParameterComponent; +import org.hl7.fhir.r5.model.StringType; +import org.hl7.fhir.r5.model.UriType; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.transaction.annotation.Transactional; + +public class ResourceProviderR5CodeSystemDesignationTest extends BaseResourceProviderR5Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR5CodeSystemDesignationTest.class); + + private static final String CS_ACME_URL = "http://acme.org"; + + @BeforeEach + @Transactional + public void before02() throws IOException { + CodeSystem cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs-with-designations-lang.xml"); + myCodeSystemDao.create(cs, mySrd).getId().toUnqualifiedVersionless(); + } + + @Test + public void testLookupWithDisplayLanguage() { + Parameters respParam = myClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .andParameter("displayLanguage",new CodeType("de-AT")) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(2, designationList.size()); + + // 1. de-AT:Systolic blood pressure 12 hour minimum + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("de-AT", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("de-AT:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 2. Systolic blood pressure 12 hour minimum (no language) + designation = designationList.get(1); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + + + @Test + public void testLookupWithNonExistLanguage() { + Parameters respParam = myClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .andParameter("displayLanguage",new CodeType("zh-CN")) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(1, designationList.size()); + + // 1. Systolic blood pressure 12 hour minimum (no language) + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + + @Test + public void testLookupWithoutDisplayLanguage() { + Parameters respParam = myClient + .operation() + .onType(CodeSystem.class) + .named("lookup") + .withParameter(Parameters.class, "code", new CodeType("8494-7")) + .andParameter("system", new UriType(CS_ACME_URL)) + .execute(); + + String resp = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(respParam); + ourLog.info(resp); + + + List parameterList = respParam.getParameter(); + List designationList = getDesignations(parameterList); + + assertEquals("display", respParam.getParameter().get(0).getName()); + assertEquals(("Systolic blood pressure 12 hour minimum"), ((StringType) respParam.getParameter().get(0).getValue()).getValue()); + + assertEquals("abstract", respParam.getParameter().get(1).getName()); + assertEquals(false, ((BooleanType) respParam.getParameter().get(1).getValue()).getValue()); + + //-- designationList + assertEquals(3, designationList.size()); + + // 1. fr-FR:Systolic blood pressure 12 hour minimum + ParametersParameterComponent designation = designationList.get(0); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("fr-FR", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("fr-FR:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 2. de-AT:Systolic blood pressure 12 hour minimum + designation = designationList.get(1); + assertEquals("language", designation.getPart().get(0).getName()); + assertEquals("de-AT", designation.getPart().get(0).getValue().toString()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("de-AT:Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + // 3. Systolic blood pressure 12 hour minimum (no language) + designation = designationList.get(2); + assertEquals("language", designation.getPart().get(0).getName()); + assertNull(designation.getPart().get(0).getValue()); + assertEquals("value", designation.getPart().get(2).getName()); + assertEquals("Systolic blood pressure 12 hour minimum", designation.getPart().get(2).getValue().toString()); + + } + private List getDesignations(List parameterList) { + + List designationList = new ArrayList<>(); + + for (ParametersParameterComponent parameter : parameterList) { + if ("designation".equals(parameter.getName())) + designationList.add(parameter); + } + return designationList; + + } +} diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java index b7930b966c6..1bdd6793ced 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/term/TerminologySvcDeltaR4Test.java @@ -369,7 +369,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { assertEquals("http://foo", outcome.getUrl()); assertEquals(CodeSystem.CodeSystemContentMode.NOTPRESENT, outcome.getContent()); - IValidationSupport.LookupCodeResult lookup = myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "CBC"); + IValidationSupport.LookupCodeResult lookup = myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "CBC", null); assertEquals("Complete Blood Count", lookup.getCodeDisplay()); } @@ -433,7 +433,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { UploadStatistics outcome = myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd("http://foo", delta); assertEquals(2, outcome.getUpdatedConceptCount()); - assertEquals("CODEA0", myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "codea").getCodeDisplay()); + assertEquals("CODEA0", myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "codea", null).getCodeDisplay()); // Add codes again with different display delta = new CustomTerminologySet(); @@ -441,12 +441,12 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { delta.addRootConcept("codeb", "CODEB1"); outcome = myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd("http://foo", delta); assertEquals(2, outcome.getUpdatedConceptCount()); - assertEquals("CODEA1", myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "codea").getCodeDisplay()); + assertEquals("CODEA1", myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "codea", null).getCodeDisplay()); // Add codes again with no changes outcome = myTermCodeSystemStorageSvc.applyDeltaCodeSystemsAdd("http://foo", delta); assertEquals(2, outcome.getUpdatedConceptCount()); - assertEquals("CODEA1", myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "codea").getCodeDisplay()); + assertEquals("CODEA1", myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo", "codea", null).getCodeDisplay()); } @Test @@ -483,7 +483,7 @@ public class TerminologySvcDeltaR4Test extends BaseJpaR4Test { .setCode("useless_sct_code") .setValue(new Coding("http://snomed.info", "1234567", "Choked on large meal (finding)")); - IValidationSupport.LookupCodeResult result = myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo/cs", "lunch"); + IValidationSupport.LookupCodeResult result = myTermSvc.lookupCode(new ValidationSupportContext(myValidationSupport), "http://foo/cs", "lunch", null); assertEquals(true, result.isFound()); assertEquals("lunch", result.getSearchedForCode()); assertEquals("http://foo/cs", result.getSearchedForSystem()); diff --git a/hapi-fhir-jpaserver-base/src/test/resources/extensional-case-3-cs-with-designations-lang.xml b/hapi-fhir-jpaserver-base/src/test/resources/extensional-case-3-cs-with-designations-lang.xml new file mode 100644 index 00000000000..8306f700863 --- /dev/null +++ b/hapi-fhir-jpaserver-base/src/test/resources/extensional-case-3-cs-with-designations-lang.xml @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java index fb92318e462..00bd9e75ccb 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/BaseValidationSupportWrapper.java @@ -67,8 +67,8 @@ public class BaseValidationSupportWrapper extends BaseValidationSupport { } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { - return myWrap.lookupCode(theValidationSupportContext, theSystem, theCode); + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { + return myWrap.lookupCode(theValidationSupportContext, theSystem, theCode, theDisplayLanguage); } @Override diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CachingValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CachingValidationSupport.java index 45e5cdb174c..ba5a427ab36 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CachingValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CachingValidationSupport.java @@ -111,9 +111,9 @@ public class CachingValidationSupport extends BaseValidationSupportWrapper imple } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { String key = "lookupCode " + theSystem + " " + theCode; - return loadFromCache(myLookupCodeCache, key, t -> super.lookupCode(theValidationSupportContext, theSystem, theCode)); + return loadFromCache(myLookupCodeCache, key, t -> super.lookupCode(theValidationSupportContext, theSystem, theCode, theDisplayLanguage)); } @Override diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java index 62113b520b8..eae628d2965 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java @@ -211,7 +211,7 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport { @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { Map map; switch (theSystem) { diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java index b0f5890de84..810414aaa2b 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/InMemoryTerminologyServerValidationSupport.java @@ -345,7 +345,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { return validateCode(theValidationSupportContext, new ConceptValidationOptions(), theSystem, theCode, null, null).asLookupCodeResult(theSystem, theCode); } @@ -550,7 +550,7 @@ public class InMemoryTerminologyServerValidationSupport implements IValidationSu if (theWantCode != null) { if (theValidationSupportContext.getRootValidationSupport().isCodeSystemSupported(theValidationSupportContext, includeOrExcludeConceptSystemUrl)) { - LookupCodeResult lookup = theValidationSupportContext.getRootValidationSupport().lookupCode(theValidationSupportContext, includeOrExcludeConceptSystemUrl, theWantCode); + LookupCodeResult lookup = theValidationSupportContext.getRootValidationSupport().lookupCode(theValidationSupportContext, includeOrExcludeConceptSystemUrl, theWantCode, null); if (lookup != null && lookup.isFound()) { CodeSystem.ConceptDefinitionComponent conceptDefinition = new CodeSystem.ConceptDefinitionComponent() .addConcept() diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java index 68e01621741..e2cb4ea8b03 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/ValidationSupportChain.java @@ -296,10 +296,10 @@ public class ValidationSupportChain implements IValidationSupport { } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { for (IValidationSupport next : myChain) { if (next.isCodeSystemSupported(theValidationSupportContext, theSystem)) { - return next.lookupCode(theValidationSupportContext, theSystem, theCode); + return next.lookupCode(theValidationSupportContext, theSystem, theCode, theDisplayLanguage); } } return null; diff --git a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseTerminologyDisplayPopulationInterceptorTest.java b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseTerminologyDisplayPopulationInterceptorTest.java index f7e58a17002..65b5767d5cf 100644 --- a/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseTerminologyDisplayPopulationInterceptorTest.java +++ b/hapi-fhir-validation/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseTerminologyDisplayPopulationInterceptorTest.java @@ -141,9 +141,14 @@ public class ResponseTerminologyDisplayPopulationInterceptorTest { } @Override - public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode, String theDisplayLanguage) { return null; } + + @Override + public LookupCodeResult lookupCode(ValidationSupportContext theValidationSupportContext, String theSystem, String theCode) { + return lookupCode(theValidationSupportContext, theSystem, theCode, null); + } } } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java index f3a8f34a60f..5353864fc45 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java @@ -51,7 +51,7 @@ public class CommonCodeSystemsTerminologyServiceTest { @Test public void testUcum_LookupCode_UnknownSystem() { - IValidationSupport.LookupCodeResult outcome = mySvc.lookupCode(newSupport(), "http://foo", "AAAAA"); + IValidationSupport.LookupCodeResult outcome = mySvc.lookupCode(newSupport(), "http://foo", "AAAAA", null); assertNull(outcome); } diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java index 42b43c205dc..c235ee20fe8 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/r4/validation/FhirInstanceValidatorR4Test.java @@ -254,7 +254,7 @@ public class FhirInstanceValidatorR4Test extends BaseTest { return retVal; } }); - when(mockSupport.lookupCode(any(), any(), any())).thenAnswer(t -> { + when(mockSupport.lookupCode(any(), any(), any(), any())).thenAnswer(t -> { String system = t.getArgument(1, String.class); String code = t.getArgument(2, String.class); if (myValidConcepts.contains(system + "___" + code)) { From fd6dcf636315eac7e81168601936beead5f7c403 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Wed, 25 Aug 2021 18:16:47 -0400 Subject: [PATCH 48/49] Fix bug in code. Add test. Add changelog --- .../2920-lookup-language-by-lang-only.yaml | 6 + .../CommonCodeSystemsTerminologyService.java | 135 +++++++++++------- ...mmonCodeSystemsTerminologyServiceTest.java | 7 + 3 files changed, 96 insertions(+), 52 deletions(-) create mode 100644 hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2920-lookup-language-by-lang-only.yaml diff --git a/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2920-lookup-language-by-lang-only.yaml b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2920-lookup-language-by-lang-only.yaml new file mode 100644 index 00000000000..f77e2309f48 --- /dev/null +++ b/hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog/5_6_0/2920-lookup-language-by-lang-only.yaml @@ -0,0 +1,6 @@ +--- +type: fix +issue: 2920 +jira: SMILE-2971 +title: "Previously, validation against bcp47 (urn:ietf:bcp:47) as a language would fail validation if the region was absent. This has been fixed, and the validate +operation will now correctly validate simple languages, e.g. `nl` instead of requiring `nl-DE` or `nl-NL`" diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java index eae628d2965..f4891ed7398 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyService.java @@ -257,69 +257,100 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport { Map languagesMap = myLanguagesLanugageMap; Map regionsMap = myLanguagesRegionMap; if (languagesMap == null || regionsMap == null) { + initializeBcp47LanguageMap(); + } - ourLog.info("Loading BCP47 Language Registry"); + int langRegionSeparatorIndex = StringUtils.indexOfAny(theCode, '-', '_'); + boolean hasRegionAndCodeSegments = langRegionSeparatorIndex > 0; + String language; + String region; - String input = ClasspathUtil.loadResource("org/hl7/fhir/common/hapi/validation/support/registry.json"); - ArrayNode map; - try { - map = (ArrayNode) new ObjectMapper().readTree(input); - } catch (JsonProcessingException e) { - throw new ConfigurationException(e); + if (hasRegionAndCodeSegments) { + language = myLanguagesLanugageMap.get(theCode.substring(0, langRegionSeparatorIndex)); + region = myLanguagesRegionMap.get(theCode.substring(langRegionSeparatorIndex + 1)); + + if (language == null || region == null) { + //In case the user provides both a language and a region, they must both be valid for the lookup to succeed. + ourLog.warn("Couldn't find a valid bcp47 language-region combination from code: {}", theCode); + return buildNotFoundLookupCodeResult(theCode); + } else { + return buildLookupResultForLanguageAndRegion(theCode, language, region); } - - languagesMap = new HashMap<>(); - regionsMap = new HashMap<>(); - - for (int i = 0; i < map.size(); i++) { - ObjectNode next = (ObjectNode) map.get(i); - String type = next.get("Type").asText(); - if ("language".equals(type)) { - String language = next.get("Subtag").asText(); - ArrayNode descriptions = (ArrayNode) next.get("Description"); - String description = null; - if (descriptions.size() > 0) { - description = descriptions.get(0).asText(); - } - languagesMap.put(language, description); - } - if ("region".equals(type)) { - String region = next.get("Subtag").asText(); - ArrayNode descriptions = (ArrayNode) next.get("Description"); - String description = null; - if (descriptions.size() > 0) { - description = descriptions.get(0).asText(); - } - regionsMap.put(region, description); - } - + } else { + //In case user has only provided a language, we build the lookup from only that. + language = myLanguagesLanugageMap.get(theCode); + if (language == null) { + ourLog.warn("Couldn't find a valid bcp47 language from code: {}", theCode); + return buildNotFoundLookupCodeResult(theCode); + } else { + return buildLookupResultForLanguage(theCode, language); } + } + } + private LookupCodeResult buildLookupResultForLanguageAndRegion(@Nonnull String theOriginalCode, @Nonnull String theLanguage, @Nonnull String theRegion) { + LookupCodeResult lookupCodeResult = buildNotFoundLookupCodeResult(theOriginalCode); + lookupCodeResult.setCodeDisplay(theLanguage + " " + theRegion); + lookupCodeResult.setFound(true); + return lookupCodeResult; + } + private LookupCodeResult buildLookupResultForLanguage(@Nonnull String theOriginalCode, @Nonnull String theLanguage) { + LookupCodeResult lookupCodeResult = buildNotFoundLookupCodeResult(theOriginalCode); + lookupCodeResult.setCodeDisplay(theLanguage); + lookupCodeResult.setFound(true); + return lookupCodeResult; + } - ourLog.info("Have {} languages and {} regions", languagesMap.size(), regionsMap.size()); + private LookupCodeResult buildNotFoundLookupCodeResult(@Nonnull String theOriginalCode) { + LookupCodeResult lookupCodeResult = new LookupCodeResult(); + lookupCodeResult.setFound(false); + lookupCodeResult.setSearchedForSystem(LANGUAGES_CODESYSTEM_URL); + lookupCodeResult.setSearchedForCode(theOriginalCode); + return lookupCodeResult; + } - myLanguagesLanugageMap = languagesMap; - myLanguagesRegionMap = regionsMap; + private void initializeBcp47LanguageMap() { + Map regionsMap; + Map languagesMap; + ourLog.info("Loading BCP47 Language Registry"); + + String input = ClasspathUtil.loadResource("org/hl7/fhir/common/hapi/validation/support/registry.json"); + ArrayNode map; + try { + map = (ArrayNode) new ObjectMapper().readTree(input); + } catch (JsonProcessingException e) { + throw new ConfigurationException(e); } - int idx = StringUtils.indexOfAny(theCode, '-', '_'); - String language = null; - String region = null; - if (idx > 0) { - language = languagesMap.get(theCode.substring(0, idx)); - region = regionsMap.get(theCode.substring(idx + 1)); + languagesMap = new HashMap<>(); + regionsMap = new HashMap<>(); + + for (int i = 0; i < map.size(); i++) { + ObjectNode next = (ObjectNode) map.get(i); + String type = next.get("Type").asText(); + if ("language".equals(type)) { + String language = next.get("Subtag").asText(); + ArrayNode descriptions = (ArrayNode) next.get("Description"); + String description = null; + if (descriptions.size() > 0) { + description = descriptions.get(0).asText(); + } + languagesMap.put(language, description); + } + if ("region".equals(type)) { + String region = next.get("Subtag").asText(); + ArrayNode descriptions = (ArrayNode) next.get("Description"); + String description = null; + if (descriptions.size() > 0) { + description = descriptions.get(0).asText(); + } + regionsMap.put(region, description); + } } - LookupCodeResult retVal = new LookupCodeResult(); - retVal.setSearchedForCode(theCode); - retVal.setSearchedForSystem(LANGUAGES_CODESYSTEM_URL); + ourLog.info("Have {} languages and {} regions", languagesMap.size(), regionsMap.size()); - if (language != null && region != null) { - String display = language + " " + region; - retVal.setFound(true); - retVal.setCodeDisplay(display); - } - - return retVal; + myLanguagesLanugageMap = languagesMap; + myLanguagesRegionMap = regionsMap; } @Nonnull diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java index 5353864fc45..7204984a456 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java @@ -105,6 +105,13 @@ public class CommonCodeSystemsTerminologyServiceTest { assertEquals("English (United States)", outcome.getDisplay()); } + @Test + public void testLanguages_CommonLanguagesVs_OnlyLanguage_NoRegion() { + IValidationSupport.LookupCodeResult nl = mySvc.lookupCode(newSupport(), "urn:ietf:bcp:47", "nl"); + assertTrue(nl.isFound()); + assertEquals("Dutch", nl.getCodeDisplay()); + } + @Test public void testLanguages_CommonLanguagesVs_BadCode() { IValidationSupport.CodeValidationResult outcome = mySvc.validateCode(newSupport(), newOptions(), "urn:ietf:bcp:47", "FOO", null, "http://hl7.org/fhir/ValueSet/languages"); From 0304ea2d624181fdc383f8168a5652e8e262833e Mon Sep 17 00:00:00 2001 From: Tadgh Date: Thu, 26 Aug 2021 12:03:00 -0400 Subject: [PATCH 49/49] Add requested test --- .../fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java | 2 -- .../support/CommonCodeSystemsTerminologyServiceTest.java | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java index 25eecd5c164..51a43daf31e 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java @@ -104,7 +104,6 @@ import org.hl7.fhir.r4.model.Organization; import org.hl7.fhir.r4.model.Patient; import org.hl7.fhir.r4.model.Period; import org.hl7.fhir.r4.model.Practitioner; -import org.hl7.fhir.r4.model.Procedure; import org.hl7.fhir.r4.model.Provenance; import org.hl7.fhir.r4.model.Quantity; import org.hl7.fhir.r4.model.Questionnaire; @@ -5304,7 +5303,6 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test { createObservationWithEffective("YES22", "2011-01-02T00:00:00+10:00"); createObservationWithEffective("YES23", "2011-01-02T00:00:00+11:00"); - SearchParameterMap map = new SearchParameterMap(); map.setLoadSynchronous(true); map.add(Observation.SP_DATE, new DateParam("2011-01-02")); diff --git a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java index 7204984a456..863eac1fd4f 100644 --- a/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java +++ b/hapi-fhir-validation/src/test/java/org/hl7/fhir/common/hapi/validation/support/CommonCodeSystemsTerminologyServiceTest.java @@ -112,6 +112,13 @@ public class CommonCodeSystemsTerminologyServiceTest { assertEquals("Dutch", nl.getCodeDisplay()); } + @Test + public void testLanguages_CommonLanguagesVs_LanguageAndRegion() { + IValidationSupport.LookupCodeResult nl = mySvc.lookupCode(newSupport(), "urn:ietf:bcp:47", "nl-NL"); + assertTrue(nl.isFound()); + assertEquals("Dutch Netherlands", nl.getCodeDisplay()); + } + @Test public void testLanguages_CommonLanguagesVs_BadCode() { IValidationSupport.CodeValidationResult outcome = mySvc.validateCode(newSupport(), newOptions(), "urn:ietf:bcp:47", "FOO", null, "http://hl7.org/fhir/ValueSet/languages");