Merge branch 'rel_7_6' of github.com:hapifhir/hapi-fhir into rel_7_6

This commit is contained in:
Tadgh 2024-11-12 12:05:09 -08:00
commit 72b48f6f51
108 changed files with 552 additions and 313 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -38,7 +38,6 @@ import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions; import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
import ca.uhn.fhir.model.base.composite.BaseContainedDt; import ca.uhn.fhir.model.base.composite.BaseContainedDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.parser.DataFormatException; import ca.uhn.fhir.parser.DataFormatException;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -71,6 +70,7 @@ import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -78,7 +78,6 @@ import java.util.stream.Collectors;
import static org.apache.commons.lang3.StringUtils.defaultString; import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.apache.commons.lang3.StringUtils.isBlank; import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank; import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.substring;
public class FhirTerser { public class FhirTerser {
@ -1789,7 +1788,6 @@ public class FhirTerser {
} }
public static class ContainedResources { public static class ContainedResources {
private long myNextContainedId = 1;
private List<IBaseResource> myResourceList; private List<IBaseResource> myResourceList;
private IdentityHashMap<IBaseResource, IIdType> myResourceToIdMap; private IdentityHashMap<IBaseResource, IIdType> myResourceToIdMap;
private Map<String, IBaseResource> myExistingIdToContainedResourceMap; private Map<String, IBaseResource> myExistingIdToContainedResourceMap;
@ -1814,19 +1812,7 @@ public class FhirTerser {
IIdType newId = theResource.getIdElement(); IIdType newId = theResource.getIdElement();
if (isBlank(newId.getValue())) { if (isBlank(newId.getValue())) {
newId.setValue("#" + myNextContainedId++); newId.setValue("#" + UUID.randomUUID());
} else {
// Avoid auto-assigned contained IDs colliding with pre-existing ones
String idPart = newId.getValue();
if (substring(idPart, 0, 1).equals("#")) {
idPart = idPart.substring(1);
if (StringUtils.isNumeric(idPart)) {
// If there is a user-supplied numeric contained ID, our auto-assigned IDs should exceed the
// largest
// client-assigned contained ID.
myNextContainedId = Math.max(myNextContainedId, Long.parseLong(idPart) + 1);
}
}
} }
getResourceToIdMap().put(theResource, newId); getResourceToIdMap().put(theResource, newId);
@ -1890,46 +1876,5 @@ public class FhirTerser {
public boolean hasExistingIdToContainedResource() { public boolean hasExistingIdToContainedResource() {
return myExistingIdToContainedResourceMap != null; return myExistingIdToContainedResourceMap != null;
} }
public void assignIdsToContainedResources() {
// TODO JA: Dead code?
if (!getContainedResources().isEmpty()) {
/*
* The idea with the code block below:
*
* We want to preserve any IDs that were user-assigned, so that if it's really
* important to someone that their contained resource have the ID of #FOO
* or #1 we will keep that.
*
* For any contained resources where no ID was assigned by the user, we
* want to manually create an ID but make sure we don't reuse an existing ID.
*/
Set<String> ids = new HashSet<>();
// Gather any user assigned IDs
for (IBaseResource nextResource : getContainedResources()) {
if (getResourceToIdMap().get(nextResource) != null) {
ids.add(getResourceToIdMap().get(nextResource).getValue());
}
}
// Automatically assign IDs to the rest
for (IBaseResource nextResource : getContainedResources()) {
while (getResourceToIdMap().get(nextResource) == null) {
String nextCandidate = "#" + myNextContainedId;
myNextContainedId++;
if (!ids.add(nextCandidate)) {
continue;
}
getResourceToIdMap().put(nextResource, new IdDt(nextCandidate));
}
}
}
}
} }
} }

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 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%
*/
package ca.uhn.fhir.util.adapters; package ca.uhn.fhir.util.adapters;
import jakarta.annotation.Nonnull; import jakarta.annotation.Nonnull;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 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%
*/
package ca.uhn.fhir.util.adapters; package ca.uhn.fhir.util.adapters;
import java.util.Optional; import java.util.Optional;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 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%
*/
package ca.uhn.fhir.util.adapters; package ca.uhn.fhir.util.adapters;
import jakarta.annotation.Nonnull; import jakarta.annotation.Nonnull;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 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%
*/
package ca.uhn.fhir.util.adapters; package ca.uhn.fhir.util.adapters;
import java.util.Collection; import java.util.Collection;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 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%
*/
package ca.uhn.fhir.util.adapters; package ca.uhn.fhir.util.adapters;
import java.util.Optional; import java.util.Optional;

View File

@ -1,3 +1,22 @@
/*-
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2024 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%
*/
/** /**
* Implements the Adapter pattern to allow external classes to extend/adapt existing classes. * Implements the Adapter pattern to allow external classes to extend/adapt existing classes.
* Useful for extending interfaces that are closed to modification, or restricted for classpath reasons. * Useful for extending interfaces that are closed to modification, or restricted for classpath reasons.

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId> <artifactId>hapi-fhir-bom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>HAPI FHIR BOM</name> <name>HAPI FHIR BOM</name>
@ -12,7 +12,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId> <artifactId>hapi-fhir-cli</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -0,0 +1,4 @@
---
type: change
jira: SMILE-9161
title: "Contained resources which arrive without assigned IDs are now assigned GUIDs, as opposed to monotonically increasing numeric IDs. This avoids a whole class of issues related to processing order and collisions."

View File

@ -4,7 +4,7 @@
title: "The version of a few dependencies have been bumped to more recent versions title: "The version of a few dependencies have been bumped to more recent versions
(dependent HAPI modules listed in brackets): (dependent HAPI modules listed in brackets):
<ul> <ul>
<li>org.hl7.fhir.core (Base): 6.3.18 -&gt; 6.3.25</li> <li>org.hl7.fhir.core (Base): 6.3.18 -&gt; 6.4.0</li>
<li>Bower/Moment.js (hapi-fhir-testpage-overlay): 2.27.0 -&gt; 2.29.4</li> <li>Bower/Moment.js (hapi-fhir-testpage-overlay): 2.27.0 -&gt; 2.29.4</li>
<li>htmlunit (Base): 3.9.0 -&gt; 3.11.0</li> <li>htmlunit (Base): 3.9.0 -&gt; 3.11.0</li>
<li>Elasticsearch (Base): 8.11.1 -&gt; 8.14.3</li> <li>Elasticsearch (Base): 8.11.1 -&gt; 8.14.3</li>

View File

@ -11,7 +11,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -3,7 +3,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -28,6 +28,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException; import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.BundleBuilder; import ca.uhn.fhir.util.BundleBuilder;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -81,6 +82,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future; import java.util.concurrent.Future;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ca.uhn.fhir.test.utilities.UuidUtils.HASH_UUID_PATTERN;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
@ -738,7 +740,8 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test {
String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(p); String encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info("Input: {}", encoded); ourLog.info("Input: {}", encoded);
assertThat(encoded).contains("#1"); String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuid);
IIdType id = myPatientDao.create(p).getId().toUnqualifiedVersionless(); IIdType id = myPatientDao.create(p).getId().toUnqualifiedVersionless();
@ -746,10 +749,12 @@ public class FhirResourceDaoR4CreateTest extends BaseJpaR4Test {
encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(p); encoded = myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info("Output: {}", encoded); ourLog.info("Output: {}", encoded);
assertThat(encoded).contains("#1"); String organizationUuidParsed = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuidParsed);
assertEquals(organizationUuid, organizationUuidParsed);
Organization org = (Organization) p.getManagingOrganization().getResource(); Organization org = (Organization) p.getManagingOrganization().getResource();
assertEquals("#1", org.getId()); assertEquals("#" + organizationUuid, org.getId());
assertThat(org.getMeta().getTag()).hasSize(1); assertThat(org.getMeta().getTag()).hasSize(1);
} }

View File

@ -1,5 +1,6 @@
package ca.uhn.fhir.jpa.dao.r4; package ca.uhn.fhir.jpa.dao.r4;
import static ca.uhn.fhir.test.utilities.UuidUtils.HASH_UUID_PATTERN;
import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -3191,8 +3192,8 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
String id = outcome.getEntry().get(0).getResponse().getLocation(); String id = outcome.getEntry().get(0).getResponse().getLocation();
patient = myPatientDao.read(new IdType(id)); patient = myPatientDao.read(new IdType(id));
assertEquals("#1", patient.getManagingOrganization().getReference()); assertThat(patient.getManagingOrganization().getReference()).containsPattern(HASH_UUID_PATTERN);
assertEquals("#1", patient.getContained().get(0).getId()); assertEquals(patient.getManagingOrganization().getReference(), patient.getContained().get(0).getId());
} }
@Nonnull @Nonnull

View File

@ -696,7 +696,7 @@ public class JpaPatientEverythingTest extends BaseResourceProviderR4Test {
Reference referenceToPatient = createPatient(); Reference referenceToPatient = createPatient();
Consent consent = new Consent(); Consent consent = new Consent();
Consent.provisionComponent provisionComponent = new Consent.provisionComponent(); Consent.ProvisionComponent provisionComponent = new Consent.ProvisionComponent();
Consent.provisionActorComponent actorComponent = new Consent.provisionActorComponent(); Consent.provisionActorComponent actorComponent = new Consent.provisionActorComponent();
actorComponent.setReference(referenceToPatient); actorComponent.setReference(referenceToPatient);
provisionComponent.setActor(List.of(actorComponent)); provisionComponent.setActor(List.of(actorComponent));

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -6,7 +6,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -1068,5 +1068,15 @@ public abstract class BaseJpaR4Test extends BaseJpaTest implements ITestDataBuil
String url) { String url) {
return ContainedReferenceValidationPolicy.CHECK_VALID; return ContainedReferenceValidationPolicy.CHECK_VALID;
} }
@Override
public boolean isSuppressMessageId(String path, String messageId) {
return false;
}
@Override
public ReferenceValidationPolicy getReferencePolicy() {
return ReferenceValidationPolicy.IGNORE;
}
} }
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir-serviceloaders</artifactId> <artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir-serviceloaders</artifactId> <artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>
@ -21,7 +21,7 @@
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId> <artifactId>hapi-fhir-caching-api</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir-serviceloaders</artifactId> <artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath> <relativePath>../../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
</parent> </parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId> <artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId> <artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId> <artifactId>hapi-fhir-spring-boot</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,7 +7,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -117,4 +117,14 @@ public class ValidatorPolicyAdvisor implements IValidationPolicyAdvisor {
List<ValidationMessage> messages) { List<ValidationMessage> messages) {
return Arrays.asList(); return Arrays.asList();
} }
@Override
public boolean isSuppressMessageId(String path, String messageId) {
return false;
}
@Override
public ReferenceValidationPolicy getReferencePolicy() {
return ReferenceValidationPolicy.IGNORE;
}
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -59,6 +59,12 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId> <artifactId>hapi-fhir-client</artifactId>

View File

@ -11,6 +11,7 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation; import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation;
import ca.uhn.fhir.parser.PatientWithExtendedContactDstu3.CustomContactComponent; import ca.uhn.fhir.parser.PatientWithExtendedContactDstu3.CustomContactComponent;
import ca.uhn.fhir.parser.XmlParserDstu2_1Test.TestPatientFor327; import ca.uhn.fhir.parser.XmlParserDstu2_1Test.TestPatientFor327;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -407,6 +408,8 @@ public class JsonParserDstu2_1Test {
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).containsSubsequence( assertThat(encoded).containsSubsequence(
@ -415,14 +418,14 @@ public class JsonParserDstu2_1Test {
"\"contained\": [", "\"contained\": [",
"{", "{",
"\"resourceType\": \"Condition\",", "\"resourceType\": \"Condition\",",
"\"id\": \"1\"", "\"id\": \"" + conditionUuid + "\"",
"}", "}",
"],", "],",
"\"extension\": [", "\"extension\": [",
"{", "{",
"\"url\": \"test\",", "\"url\": \"test\",",
"\"valueReference\": {", "\"valueReference\": {",
"\"reference\": \"#1\"", "\"reference\": \"#" + conditionUuid + "\"",
"}", "}",
"}", "}",
"],", "],",
@ -632,19 +635,21 @@ public class JsonParserDstu2_1Test {
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).containsSubsequence( assertThat(encoded).containsSubsequence(
"\"resourceType\": \"Patient\"", "\"resourceType\": \"Patient\"",
"\"contained\": [", "\"contained\": [",
"\"resourceType\": \"Condition\"", "\"resourceType\": \"Condition\"",
"\"id\": \"1\"", "\"id\": \"" + conditionUuid + "\"",
"\"bodySite\": [", "\"bodySite\": [",
"\"text\": \"BODY SITE\"", "\"text\": \"BODY SITE\"",
"\"extension\": [", "\"extension\": [",
"\"url\": \"testCondition\",", "\"url\": \"testCondition\",",
"\"valueReference\": {", "\"valueReference\": {",
"\"reference\": \"#1\"", "\"reference\": \"#" + conditionUuid + "\"",
"\"birthDate\": \"2016-04-14\"", "\"birthDate\": \"2016-04-14\"",
"}" "}"
); );

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.parser.FooMessageHeaderWithExplicitField.FooMessageSourceComp
import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation; import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation;
import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension; import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -378,8 +379,11 @@ public class XmlParserDstu2_1Test {
String encoded = xmlParser.encodeResourceToString(patient); String encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuid);
assertThat(encoded).contains("<contained>"); assertThat(encoded).contains("<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// Create a bundle with just the patient resource // Create a bundle with just the patient resource
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -388,35 +392,35 @@ public class XmlParserDstu2_1Test {
// Encode the bundle // Encode the bundle
encoded = xmlParser.encodeResourceToString(b); encoded = xmlParser.encodeResourceToString(b);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<id value=\"1\"/>", "</contained>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<id value=\"" + organizationUuid + "\"/>", "</contained>"));
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
assertThat(encoded).containsSubsequence(Arrays.asList("<entry>", "</entry>")); assertThat(encoded).containsSubsequence(Arrays.asList("<entry>", "</entry>"));
assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>"); assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>");
// Re-parse the bundle // Re-parse the bundle
patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient)); patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient));
assertEquals("#1", patient.getManagingOrganization().getReference()); assertEquals("#" + organizationUuid, patient.getManagingOrganization().getReference());
assertNotNull(patient.getManagingOrganization().getResource()); assertNotNull(patient.getManagingOrganization().getResource());
org = (Organization) patient.getManagingOrganization().getResource(); org = (Organization) patient.getManagingOrganization().getResource();
assertEquals("#1", org.getIdElement().getValue()); assertEquals("#" + organizationUuid, org.getIdElement().getValue());
assertEquals("Contained Test Organization", org.getName()); assertEquals("Contained Test Organization", org.getName());
// And re-encode a second time // And re-encode a second time
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", "</Organization", "</contained>", "<reference value=\"#1\"/>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid + "\"/>", "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared // And re-encode once more, with the references cleared
patient.getContained().clear(); patient.getContained().clear();
patient.getManagingOrganization().setReference(null); patient.getManagingOrganization().setReference(null);
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", "</Organization", "</contained>", "<reference value=\"#1\"/>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid + "\"/>", "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared and a manually set local ID // And re-encode once more, with the references cleared and a manually set local ID
patient.getContained().clear(); patient.getContained().clear();
@ -447,6 +451,8 @@ public class XmlParserDstu2_1Test {
String output = parser.encodeResourceToString(dr); String output = parser.encodeResourceToString(dr);
ourLog.info(output); ourLog.info(output);
String observationUuid = UuidUtils.findFirstUUID(output);
assertNotNull(observationUuid);
//@formatter:off //@formatter:off
assertThat(output).containsSubsequence( assertThat(output).containsSubsequence(
@ -456,7 +462,7 @@ public class XmlParserDstu2_1Test {
"</meta>", "</meta>",
"<contained>", "<contained>",
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + observationUuid + "\"/>",
"<meta>", "<meta>",
"<profile value=\"http://custom_Observation\"/>", "<profile value=\"http://custom_Observation\"/>",
"</meta>", "</meta>",
@ -465,7 +471,7 @@ public class XmlParserDstu2_1Test {
"</contained>", "</contained>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"<result>", "<result>",
"<reference value=\"#1\"/>", "<reference value=\"#" + observationUuid + "\"/>",
"</result>", "</result>",
"</DiagnosticReport>"); "</DiagnosticReport>");
//@formatter:on //@formatter:on
@ -477,7 +483,7 @@ public class XmlParserDstu2_1Test {
dr = (CustomDiagnosticReport) parser.parseResource(output); dr = (CustomDiagnosticReport) parser.parseResource(output);
assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus()); assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus());
assertEquals("#1", dr.getResult().get(0).getReference()); assertEquals("#" + observationUuid, dr.getResult().get(0).getReference());
obs = (CustomObservation) dr.getResult().get(0).getResource(); obs = (CustomObservation) dr.getResult().get(0).getResource();
assertEquals(ObservationStatus.FINAL, obs.getStatus()); assertEquals(ObservationStatus.FINAL, obs.getStatus());
@ -500,19 +506,21 @@ public class XmlParserDstu2_1Test {
String output = parser.encodeResourceToString(dr); String output = parser.encodeResourceToString(dr);
ourLog.info(output); ourLog.info(output);
String observationUuid = UuidUtils.findFirstUUID(output);
assertNotNull(observationUuid);
//@formatter:off //@formatter:off
assertThat(output).containsSubsequence( assertThat(output).containsSubsequence(
"<DiagnosticReport xmlns=\"http://hl7.org/fhir\">", "<DiagnosticReport xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + observationUuid + "\"/>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"</Observation>", "</Observation>",
"</contained>", "</contained>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"<result>", "<result>",
"<reference value=\"#1\"/>", "<reference value=\"#" + observationUuid + "\"/>",
"</result>", "</result>",
"</DiagnosticReport>"); "</DiagnosticReport>");
//@formatter:on //@formatter:on
@ -524,7 +532,7 @@ public class XmlParserDstu2_1Test {
dr = (DiagnosticReport) parser.parseResource(output); dr = (DiagnosticReport) parser.parseResource(output);
assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus()); assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus());
assertEquals("#1", dr.getResult().get(0).getReference()); assertEquals("#" + observationUuid, dr.getResult().get(0).getReference());
obs = (Observation) dr.getResult().get(0).getResource(); obs = (Observation) dr.getResult().get(0).getResource();
assertEquals(ObservationStatus.FINAL, obs.getStatus()); assertEquals(ObservationStatus.FINAL, obs.getStatus());
@ -832,18 +840,20 @@ public class XmlParserDstu2_1Test {
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).containsSubsequence( assertThat(encoded).containsSubsequence(
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Condition xmlns=\"http://hl7.org/fhir\">", "<Condition xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + conditionUuid + "\"/>",
"</Condition>", "</Condition>",
"</contained>", "</contained>",
"<extension url=\"test\">", "<extension url=\"test\">",
"<valueReference>", "<valueReference>",
"<reference value=\"#1\"/>", "<reference value=\"#" + conditionUuid + "\"/>",
"</valueReference>", "</valueReference>",
"</extension>", "</extension>",
"<birthDate value=\"2016-04-05\"/>", "<birthDate value=\"2016-04-05\"/>",
@ -911,10 +921,12 @@ public class XmlParserDstu2_1Test {
IParser p = ourCtx.newXmlParser().setPrettyPrint(true); IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String encoded = p.encodeResourceToString(medicationPrescript); String encoded = p.encodeResourceToString(medicationPrescript);
ourLog.info(encoded); ourLog.info(encoded);
String medicationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(medicationUuid);
//@formatter:on //@formatter:on
assertThat(encoded).containsSubsequence("<MedicationOrder xmlns=\"http://hl7.org/fhir\">", "<contained>", "<Medication xmlns=\"http://hl7.org/fhir\">", "<id value=\"1\"/>", "<code>", "<coding>", assertThat(encoded).containsSubsequence("<MedicationOrder xmlns=\"http://hl7.org/fhir\">", "<contained>", "<Medication xmlns=\"http://hl7.org/fhir\">", "<id value=\"" + medicationUuid + "\"/>", "<code>", "<coding>",
"<system value=\"urn:sys\"/>", "<code value=\"code1\"/>", "</coding>", "</code>", "</Medication>", "</contained>", "<medicationReference>", "<reference value=\"#1\"/>", "<system value=\"urn:sys\"/>", "<code value=\"code1\"/>", "</coding>", "</code>", "</Medication>", "</contained>", "<medicationReference>", "<reference value=\"#" + medicationUuid + "\"/>",
"<display value=\"MedRef\"/>", "</medicationReference>", "</MedicationOrder>"); "<display value=\"MedRef\"/>", "</medicationReference>", "</MedicationOrder>");
//@formatter:off //@formatter:off
} }
@ -1185,13 +1197,15 @@ public class XmlParserDstu2_1Test {
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).containsSubsequence( assertThat(encoded).containsSubsequence(
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Condition xmlns=\"http://hl7.org/fhir\">", "<Condition xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + conditionUuid + "\"/>",
"<bodySite>", "<bodySite>",
"<text value=\"BODY SITE\"/>", "<text value=\"BODY SITE\"/>",
"</bodySite>", "</bodySite>",
@ -1199,7 +1213,7 @@ public class XmlParserDstu2_1Test {
"</contained>", "</contained>",
"<extension url=\"testCondition\">", "<extension url=\"testCondition\">",
"<valueReference>", "<valueReference>",
"<reference value=\"#1\"/>", "<reference value=\"#" + conditionUuid + "\"/>",
"</valueReference>", "</valueReference>",
"</extension>", "</extension>",
"<birthDate value=\"2016-04-14\"/>", "<birthDate value=\"2016-04-14\"/>",

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -35,6 +35,12 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId> <artifactId>hapi-fhir-client</artifactId>

View File

@ -16,6 +16,7 @@ import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.primitive.DateTimeDt; import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.parser.CustomResource364Dstu2.CustomResource364CustomDate; import ca.uhn.fhir.parser.CustomResource364Dstu2.CustomResource364CustomDate;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ElementUtil; import ca.uhn.fhir.util.ElementUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
@ -55,19 +56,22 @@ public class CustomTypeDstu2Test {
String string = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo); String string = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(mo);
ourLog.info(string); ourLog.info(string);
String medicationUuid = UuidUtils.findFirstUUID(string);
assertNotNull(medicationUuid);
//@formatter:on //@formatter:on
assertThat(string).containsSubsequence( assertThat(string).containsSubsequence(
"<MedicationOrder xmlns=\"http://hl7.org/fhir\">", "<MedicationOrder xmlns=\"http://hl7.org/fhir\">",
" <contained>", " <contained>",
" <Medication xmlns=\"http://hl7.org/fhir\">", " <Medication xmlns=\"http://hl7.org/fhir\">",
" <id value=\"1\"/>", " <id value=\"" + medicationUuid + "\"/>",
" <code>", " <code>",
" <text value=\"MED TEXT\"/>", " <text value=\"MED TEXT\"/>",
" </code>", " </code>",
" </Medication>", " </Medication>",
" </contained>", " </contained>",
" <medication>", " <medication>",
" <reference value=\"#1\"/>", " <reference value=\"#" + medicationUuid + "\"/>",
" </medication>", " </medication>",
"</MedicationOrder>"); "</MedicationOrder>");
//@formatter:on //@formatter:on
@ -76,7 +80,7 @@ public class CustomTypeDstu2Test {
medication = (Medication) mo.getMedication().getResource(); medication = (Medication) mo.getMedication().getResource();
assertNotNull(medication); assertNotNull(medication);
assertEquals("#1", medication.getId().getValue()); assertEquals("#" + medicationUuid, medication.getId().getValue());
assertEquals("MED TEXT", medication.getCode().getText()); assertEquals("MED TEXT", medication.getCode().getText());
} }

View File

@ -50,6 +50,7 @@ import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation;
import ca.uhn.fhir.parser.testprofile.CommunicationProfile; import ca.uhn.fhir.parser.testprofile.CommunicationProfile;
import ca.uhn.fhir.parser.testprofile.PatientProfile; import ca.uhn.fhir.parser.testprofile.PatientProfile;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import ch.qos.logback.classic.Level; import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.Logger; import ch.qos.logback.classic.Logger;
@ -1705,14 +1706,16 @@ public class JsonParserDstu2Test {
String enc = parser.encodeResourceToString(o); String enc = parser.encodeResourceToString(o);
ourLog.info(enc); ourLog.info(enc);
String patientUuid = UuidUtils.findFirstUUID(enc);
assertNotNull(patientUuid);
//@formatter:off //@formatter:off
assertThat(enc).containsSubsequence( assertThat(enc).containsSubsequence(
"\"resourceType\": \"Observation\"", "\"resourceType\": \"Observation\"",
"\"contained\": [", "\"contained\": [",
"\"resourceType\": \"Patient\",", "\"resourceType\": \"Patient\",",
"\"id\": \"1\"", "\"id\": \"" + patientUuid + "\"",
"\"reference\": \"#1\"" "\"reference\": \"#" + patientUuid + "\""
); );
//@formatter:on //@formatter:on

View File

@ -62,6 +62,7 @@ import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation; import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.client.api.IGenericClient; import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -512,8 +513,10 @@ public class XmlParserDstu2Test {
String encoded = xmlParser.encodeResourceToString(patient); String encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuid);
assertThat(encoded).contains("<contained>"); assertThat(encoded).contains("<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// Create a bundle with just the patient resource // Create a bundle with just the patient resource
ca.uhn.fhir.model.dstu2.resource.Bundle b = new ca.uhn.fhir.model.dstu2.resource.Bundle(); ca.uhn.fhir.model.dstu2.resource.Bundle b = new ca.uhn.fhir.model.dstu2.resource.Bundle();
@ -522,35 +525,37 @@ public class XmlParserDstu2Test {
// Encode the bundle // Encode the bundle
encoded = xmlParser.encodeResourceToString(b); encoded = xmlParser.encodeResourceToString(b);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<id value=\"1\"/>", "</contained>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<id value=\"" + organizationUuid + "\"/>", "</contained>"));
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
assertThat(encoded).containsSubsequence(Arrays.asList("<entry>", "</entry>")); assertThat(encoded).containsSubsequence(Arrays.asList("<entry>", "</entry>"));
assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>"); assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>");
// Re-parse the bundle // Re-parse the bundle
patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient)); patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient));
assertEquals("#1", patient.getManagingOrganization().getReference().getValue()); assertEquals("#" + organizationUuid, patient.getManagingOrganization().getReference().getValue());
assertNotNull(patient.getManagingOrganization().getResource()); assertNotNull(patient.getManagingOrganization().getResource());
org = (Organization) patient.getManagingOrganization().getResource(); org = (Organization) patient.getManagingOrganization().getResource();
assertEquals("#1", org.getId().getValue()); assertEquals("#" + organizationUuid, org.getId().getValue());
assertEquals("Contained Test Organization", org.getName()); assertEquals("Contained Test Organization", org.getName());
// And re-encode a second time // And re-encode a second time
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", "</Organization", "</contained>", "<reference value=\"#1\"/>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\""
+ organizationUuid + "\"/>", "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared // And re-encode once more, with the references cleared
patient.getContained().getContainedResources().clear(); patient.getContained().getContainedResources().clear();
patient.getManagingOrganization().setReference((String) null); patient.getManagingOrganization().setReference((String) null);
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", "</Organization", "</contained>", "<reference value=\"#1\"/>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid +
"\"/>", "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared and a manually set local ID // And re-encode once more, with the references cleared and a manually set local ID
patient.getContained().getContainedResources().clear(); patient.getContained().getContainedResources().clear();
@ -581,6 +586,8 @@ public class XmlParserDstu2Test {
String output = parser.encodeResourceToString(dr); String output = parser.encodeResourceToString(dr);
ourLog.info(output); ourLog.info(output);
String observationUuid = UuidUtils.findFirstUUID(output);
assertNotNull(observationUuid);
//@formatter:off //@formatter:off
assertThat(output).containsSubsequence( assertThat(output).containsSubsequence(
@ -590,7 +597,7 @@ public class XmlParserDstu2Test {
"</meta>", "</meta>",
"<contained>", "<contained>",
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + observationUuid + "\"/>",
"<meta>", "<meta>",
"<profile value=\"http://custom_Observation\"/>", "<profile value=\"http://custom_Observation\"/>",
"</meta>", "</meta>",
@ -599,7 +606,7 @@ public class XmlParserDstu2Test {
"</contained>", "</contained>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"<result>", "<result>",
"<reference value=\"#1\"/>", "<reference value=\"#" + observationUuid + "\"/>",
"</result>", "</result>",
"</DiagnosticReport>"); "</DiagnosticReport>");
//@formatter:on //@formatter:on
@ -611,7 +618,7 @@ public class XmlParserDstu2Test {
dr = (CustomDiagnosticReportDstu2) parser.parseResource(output); dr = (CustomDiagnosticReportDstu2) parser.parseResource(output);
assertEquals(DiagnosticReportStatusEnum.FINAL, dr.getStatusElement().getValueAsEnum()); assertEquals(DiagnosticReportStatusEnum.FINAL, dr.getStatusElement().getValueAsEnum());
assertEquals("#1", dr.getResult().get(0).getReference().getValueAsString()); assertEquals("#" + observationUuid, dr.getResult().get(0).getReference().getValueAsString());
obs = (CustomObservationDstu2) dr.getResult().get(0).getResource(); obs = (CustomObservationDstu2) dr.getResult().get(0).getResource();
assertEquals(ObservationStatusEnum.FINAL, obs.getStatusElement().getValueAsEnum()); assertEquals(ObservationStatusEnum.FINAL, obs.getStatusElement().getValueAsEnum());
@ -665,19 +672,21 @@ public class XmlParserDstu2Test {
String output = parser.encodeResourceToString(dr); String output = parser.encodeResourceToString(dr);
ourLog.info(output); ourLog.info(output);
String observationUuid = UuidUtils.findFirstUUID(output);
assertNotNull(observationUuid);
//@formatter:off //@formatter:off
assertThat(output).containsSubsequence( assertThat(output).containsSubsequence(
"<DiagnosticReport xmlns=\"http://hl7.org/fhir\">", "<DiagnosticReport xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + observationUuid + "\"/>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"</Observation>", "</Observation>",
"</contained>", "</contained>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"<result>", "<result>",
"<reference value=\"#1\"/>", "<reference value=\"#" + observationUuid + "\"/>",
"</result>", "</result>",
"</DiagnosticReport>"); "</DiagnosticReport>");
//@formatter:on //@formatter:on
@ -689,7 +698,7 @@ public class XmlParserDstu2Test {
dr = (DiagnosticReport) parser.parseResource(output); dr = (DiagnosticReport) parser.parseResource(output);
assertEquals(DiagnosticReportStatusEnum.FINAL, dr.getStatusElement().getValueAsEnum()); assertEquals(DiagnosticReportStatusEnum.FINAL, dr.getStatusElement().getValueAsEnum());
assertEquals("#1", dr.getResult().get(0).getReference().getValueAsString()); assertEquals("#" + observationUuid, dr.getResult().get(0).getReference().getValueAsString());
obs = (Observation) dr.getResult().get(0).getResource(); obs = (Observation) dr.getResult().get(0).getResource();
assertEquals(ObservationStatusEnum.FINAL, obs.getStatusElement().getValueAsEnum()); assertEquals(ObservationStatusEnum.FINAL, obs.getStatusElement().getValueAsEnum());
@ -1305,10 +1314,12 @@ public class XmlParserDstu2Test {
IParser p = ourCtx.newXmlParser().setPrettyPrint(true); IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String encoded = p.encodeResourceToString(medicationPrescript); String encoded = p.encodeResourceToString(medicationPrescript);
ourLog.info(encoded); ourLog.info(encoded);
String medicationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(medicationUuid);
//@formatter:on //@formatter:on
assertThat(encoded).containsSubsequence("<MedicationOrder xmlns=\"http://hl7.org/fhir\">", "<contained>", "<Medication xmlns=\"http://hl7.org/fhir\">", "<id value=\"1\"/>", "<code>", "<coding>", assertThat(encoded).containsSubsequence("<MedicationOrder xmlns=\"http://hl7.org/fhir\">", "<contained>", "<Medication xmlns=\"http://hl7.org/fhir\">", "<id value=\"" + medicationUuid + "\"/>", "<code>", "<coding>",
"<system value=\"urn:sys\"/>", "<code value=\"code1\"/>", "</coding>", "</code>", "</Medication>", "</contained>", "<medicationReference>", "<reference value=\"#1\"/>", "<system value=\"urn:sys\"/>", "<code value=\"code1\"/>", "</coding>", "</code>", "</Medication>", "</contained>", "<medicationReference>", "<reference value=\"#" + medicationUuid + "\"/>",
"<display value=\"MedRef\"/>", "</medicationReference>", "</MedicationOrder>"); "<display value=\"MedRef\"/>", "</medicationReference>", "</MedicationOrder>");
//@formatter:off //@formatter:off
} }
@ -1561,13 +1572,15 @@ public class XmlParserDstu2Test {
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).containsSubsequence( assertThat(encoded).containsSubsequence(
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Condition xmlns=\"http://hl7.org/fhir\">", "<Condition xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + conditionUuid + "\"/>",
"<bodySite>", "<bodySite>",
"<text value=\"BODY SITE\"/>", "<text value=\"BODY SITE\"/>",
"</bodySite>", "</bodySite>",
@ -1575,7 +1588,7 @@ public class XmlParserDstu2Test {
"</contained>", "</contained>",
"<extension url=\"testCondition\">", "<extension url=\"testCondition\">",
"<valueReference>", "<valueReference>",
"<reference value=\"#1\"/>", "<reference value=\"#" + conditionUuid + "\"/>",
"</valueReference>", "</valueReference>",
"</extension>", "</extension>",
"<birthDate value=\"2016-04-17\"/>", "<birthDate value=\"2016-04-17\"/>",
@ -2535,15 +2548,17 @@ public class XmlParserDstu2Test {
String enc = parser.encodeResourceToString(o); String enc = parser.encodeResourceToString(o);
ourLog.info(enc); ourLog.info(enc);
String patientUuid = UuidUtils.findFirstUUID(enc);
assertNotNull(patientUuid);
//@formatter:off //@formatter:off
assertThat(enc).containsSubsequence( assertThat(enc).containsSubsequence(
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + patientUuid + "\"/>",
"</contained>", "</contained>",
"<reference value=\"#1\"/>" "<reference value=\"#" + patientUuid + "\"/>"
); );
//@formatter:on //@formatter:on

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -137,6 +137,12 @@
<artifactId>woodstox-core</artifactId> <artifactId>woodstox-core</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId> <artifactId>hapi-fhir-client</artifactId>

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.parser.PatientWithExtendedContactDstu3.CustomContactComponent
import ca.uhn.fhir.parser.XmlParserDstu3Test.TestPatientFor327; import ca.uhn.fhir.parser.XmlParserDstu3Test.TestPatientFor327;
import ca.uhn.fhir.parser.json.BaseJsonLikeValue.ScalarType; import ca.uhn.fhir.parser.json.BaseJsonLikeValue.ScalarType;
import ca.uhn.fhir.parser.json.BaseJsonLikeValue.ValueType; import ca.uhn.fhir.parser.json.BaseJsonLikeValue.ValueType;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.validation.FhirValidator; import ca.uhn.fhir.validation.FhirValidator;
@ -648,6 +649,8 @@ public class JsonParserDstu3Test {
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).contains( assertThat(encoded).contains(
@ -656,14 +659,14 @@ public class JsonParserDstu3Test {
"\"contained\": [", "\"contained\": [",
"{", "{",
"\"resourceType\": \"Condition\",", "\"resourceType\": \"Condition\",",
"\"id\": \"1\"", "\"id\": \"" + conditionUuid + "\"",
"}", "}",
"],", "],",
"\"extension\": [", "\"extension\": [",
"{", "{",
"\"url\": \"test\",", "\"url\": \"test\",",
"\"valueReference\": {", "\"valueReference\": {",
"\"reference\": \"#1\"", "\"reference\": \"#" + conditionUuid + "\"",
"}", "}",
"}", "}",
"],", "],",
@ -920,19 +923,21 @@ public class JsonParserDstu3Test {
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).contains( assertThat(encoded).contains(
"\"resourceType\": \"Patient\"", "\"resourceType\": \"Patient\"",
"\"contained\": [", "\"contained\": [",
"\"resourceType\": \"Condition\"", "\"resourceType\": \"Condition\"",
"\"id\": \"1\"", "\"id\": \"" + conditionUuid + "\"",
"\"bodySite\": [", "\"bodySite\": [",
"\"text\": \"BODY SITE\"", "\"text\": \"BODY SITE\"",
"\"extension\": [", "\"extension\": [",
"\"url\": \"testCondition\",", "\"url\": \"testCondition\",",
"\"valueReference\": {", "\"valueReference\": {",
"\"reference\": \"#1\"", "\"reference\": \"#" + conditionUuid + "\"",
"\"birthDate\": \"2016-04-14\"", "\"birthDate\": \"2016-04-14\"",
"}" "}"
); );

View File

@ -13,6 +13,7 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.parser.FooMessageHeaderWithExplicitField.FooMessageSourceComponent; import ca.uhn.fhir.parser.FooMessageHeaderWithExplicitField.FooMessageSourceComponent;
import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation; import ca.uhn.fhir.parser.IParserErrorHandler.IParseLocation;
import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension; import ca.uhn.fhir.parser.PatientWithCustomCompositeExtension.FooParentExtension;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -560,8 +561,11 @@ public class XmlParserDstu3Test {
String encoded = xmlParser.encodeResourceToString(patient); String encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuid);
assertThat(encoded).contains("<contained>"); assertThat(encoded).contains("<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// Create a bundle with just the patient resource // Create a bundle with just the patient resource
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -570,35 +574,35 @@ public class XmlParserDstu3Test {
// Encode the bundle // Encode the bundle
encoded = xmlParser.encodeResourceToString(b); encoded = xmlParser.encodeResourceToString(b);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).contains(Arrays.asList("<contained>", "<id value=\"1\"/>", "</contained>")); assertThat(encoded).contains(Arrays.asList("<contained>", "<id value=\"" + organizationUuid + "\"/>", "</contained>"));
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
assertThat(encoded).contains(Arrays.asList("<entry>", "</entry>")); assertThat(encoded).contains(Arrays.asList("<entry>", "</entry>"));
assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>"); assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>");
// Re-parse the bundle // Re-parse the bundle
patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient)); patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient));
assertEquals("#1", patient.getManagingOrganization().getReference()); assertEquals("#" + organizationUuid, patient.getManagingOrganization().getReference());
assertNotNull(patient.getManagingOrganization().getResource()); assertNotNull(patient.getManagingOrganization().getResource());
org = (Organization) patient.getManagingOrganization().getResource(); org = (Organization) patient.getManagingOrganization().getResource();
assertEquals("#1", org.getIdElement().getValue()); assertEquals("#" + organizationUuid, org.getIdElement().getValue());
assertEquals("Contained Test Organization", org.getName()); assertEquals("Contained Test Organization", org.getName());
// And re-encode a second time // And re-encode a second time
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).contains(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", "</Organization", "</contained>", "<reference value=\"#1\"/>")); assertThat(encoded).contains(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid + "\"/>", "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared // And re-encode once more, with the references cleared
patient.getContained().clear(); patient.getContained().clear();
patient.getManagingOrganization().setReference(null); patient.getManagingOrganization().setReference(null);
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).contains(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", "</Organization", "</contained>", "<reference value=\"#1\"/>")); assertThat(encoded).contains(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid + "\"/>", "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared and a manually set local ID // And re-encode once more, with the references cleared and a manually set local ID
patient.getContained().clear(); patient.getContained().clear();
@ -629,6 +633,8 @@ public class XmlParserDstu3Test {
String output = parser.encodeResourceToString(dr); String output = parser.encodeResourceToString(dr);
ourLog.info(output); ourLog.info(output);
String observationUuid = UuidUtils.findFirstUUID(output);
assertNotNull(observationUuid);
assertThat(output).contains( assertThat(output).contains(
"<DiagnosticReport xmlns=\"http://hl7.org/fhir\">", "<DiagnosticReport xmlns=\"http://hl7.org/fhir\">",
@ -637,7 +643,7 @@ public class XmlParserDstu3Test {
"</meta>", "</meta>",
"<contained>", "<contained>",
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + observationUuid + "\"/>",
"<meta>", "<meta>",
"<profile value=\"http://custom_Observation\"/>", "<profile value=\"http://custom_Observation\"/>",
"</meta>", "</meta>",
@ -646,7 +652,7 @@ public class XmlParserDstu3Test {
"</contained>", "</contained>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"<result>", "<result>",
"<reference value=\"#1\"/>", "<reference value=\"#" + observationUuid + "\"/>",
"</result>", "</result>",
"</DiagnosticReport>"); "</DiagnosticReport>");
@ -657,7 +663,7 @@ public class XmlParserDstu3Test {
dr = (CustomDiagnosticReport) parser.parseResource(output); dr = (CustomDiagnosticReport) parser.parseResource(output);
assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus()); assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus());
assertEquals("#1", dr.getResult().get(0).getReference()); assertEquals("#" + observationUuid, dr.getResult().get(0).getReference());
obs = (CustomObservation) dr.getResult().get(0).getResource(); obs = (CustomObservation) dr.getResult().get(0).getResource();
assertEquals(ObservationStatus.FINAL, obs.getStatus()); assertEquals(ObservationStatus.FINAL, obs.getStatus());
@ -680,18 +686,20 @@ public class XmlParserDstu3Test {
String output = parser.encodeResourceToString(dr); String output = parser.encodeResourceToString(dr);
ourLog.info(output); ourLog.info(output);
String observationUuid = UuidUtils.findFirstUUID(output);
assertNotNull(observationUuid);
assertThat(output).contains( assertThat(output).contains(
"<DiagnosticReport xmlns=\"http://hl7.org/fhir\">", "<DiagnosticReport xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Observation xmlns=\"http://hl7.org/fhir\">", "<Observation xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + observationUuid + "\"/>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"</Observation>", "</Observation>",
"</contained>", "</contained>",
"<status value=\"final\"/>", "<status value=\"final\"/>",
"<result>", "<result>",
"<reference value=\"#1\"/>", "<reference value=\"#" + observationUuid + "\"/>",
"</result>", "</result>",
"</DiagnosticReport>"); "</DiagnosticReport>");
@ -702,7 +710,7 @@ public class XmlParserDstu3Test {
dr = (DiagnosticReport) parser.parseResource(output); dr = (DiagnosticReport) parser.parseResource(output);
assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus()); assertEquals(DiagnosticReportStatus.FINAL, dr.getStatus());
assertEquals("#1", dr.getResult().get(0).getReference()); assertEquals("#" + observationUuid, dr.getResult().get(0).getReference());
obs = (Observation) dr.getResult().get(0).getResource(); obs = (Observation) dr.getResult().get(0).getResource();
assertEquals(ObservationStatus.FINAL, obs.getStatus()); assertEquals(ObservationStatus.FINAL, obs.getStatus());
@ -1282,17 +1290,19 @@ public class XmlParserDstu3Test {
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
assertThat(encoded).contains( assertThat(encoded).contains(
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Condition xmlns=\"http://hl7.org/fhir\">", "<Condition xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + conditionUuid + "\"/>",
"</Condition>", "</Condition>",
"</contained>", "</contained>",
"<extension url=\"test\">", "<extension url=\"test\">",
"<valueReference>", "<valueReference>",
"<reference value=\"#1\"/>", "<reference value=\"#" + conditionUuid + "\"/>",
"</valueReference>", "</valueReference>",
"</extension>", "</extension>",
"<birthDate value=\"2016-04-05\"/>", "<birthDate value=\"2016-04-05\"/>",
@ -1359,10 +1369,12 @@ public class XmlParserDstu3Test {
IParser p = ourCtx.newXmlParser().setPrettyPrint(true); IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String encoded = p.encodeResourceToString(medicationPrescript); String encoded = p.encodeResourceToString(medicationPrescript);
ourLog.info(encoded); ourLog.info(encoded);
String medicationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(medicationUuid);
assertThat(encoded).contains assertThat(encoded).contains
("<MedicationRequest xmlns=\"http://hl7.org/fhir\">", "<contained>", "<Medication xmlns=\"http://hl7.org/fhir\">", "<id value=\"1\"/>", "<code>", "<coding>", ("<MedicationRequest xmlns=\"http://hl7.org/fhir\">", "<contained>", "<Medication xmlns=\"http://hl7.org/fhir\">", "<id value=\"" + medicationUuid + "\"/>", "<code>", "<coding>",
"<system value=\"urn:sys\"/>", "<code value=\"code1\"/>", "</coding>", "</code>", "</Medication>", "</contained>", "<medicationReference>", "<reference value=\"#1\"/>", "<system value=\"urn:sys\"/>", "<code value=\"code1\"/>", "</coding>", "</code>", "</Medication>", "</contained>", "<medicationReference>", "<reference value=\"#" + medicationUuid + "\"/>",
"<display value=\"MedRef\"/>", "</medicationReference>", "</MedicationRequest>"); "<display value=\"MedRef\"/>", "</medicationReference>", "</MedicationRequest>");
} }
@ -1726,12 +1738,14 @@ public class XmlParserDstu3Test {
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
assertThat(encoded).contains( assertThat(encoded).contains(
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Condition xmlns=\"http://hl7.org/fhir\">", "<Condition xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + conditionUuid + "\"/>",
"<bodySite>", "<bodySite>",
"<text value=\"BODY SITE\"/>", "<text value=\"BODY SITE\"/>",
"</bodySite>", "</bodySite>",
@ -1739,7 +1753,7 @@ public class XmlParserDstu3Test {
"</contained>", "</contained>",
"<extension url=\"testCondition\">", "<extension url=\"testCondition\">",
"<valueReference>", "<valueReference>",
"<reference value=\"#1\"/>", "<reference value=\"#" + conditionUuid + "\"/>",
"</valueReference>", "</valueReference>",
"</extension>", "</extension>",
"<birthDate value=\"2016-04-14\"/>", "<birthDate value=\"2016-04-14\"/>",

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>
@ -53,6 +53,12 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-test-utilities</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-client</artifactId> <artifactId>hapi-fhir-client</artifactId>

View File

@ -4,6 +4,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.test.utilities.UuidUtils;
import ca.uhn.fhir.util.ClasspathUtil; import ca.uhn.fhir.util.ClasspathUtil;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import net.sf.json.JSON; import net.sf.json.JSON;
@ -58,6 +59,7 @@ import java.io.StringReader;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import static ca.uhn.fhir.test.utilities.UuidUtils.UUID_PATTERN;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -408,7 +410,10 @@ public class JsonParserHl7OrgDstu2Test {
String encoded = jsonParser.encodeResourceToString(patient); String encoded = jsonParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"1\"", "\"identifier\"", "\"reference\": \"#1\"")); String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuid);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"" + organizationUuid + "\"", "\"identifier\"", "\"reference\": \"#" + organizationUuid + "\""));
// Create a bundle with just the patient resource // Create a bundle with just the patient resource
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -417,21 +422,21 @@ public class JsonParserHl7OrgDstu2Test {
// Encode the bundle // Encode the bundle
encoded = jsonParser.encodeResourceToString(b); encoded = jsonParser.encodeResourceToString(b);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"1\"", "\"identifier\"", "\"reference\": \"#1\"")); assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"" + organizationUuid + "\"", "\"identifier\"", "\"reference\": \"#" + organizationUuid + "\""));
// Re-parse the bundle // Re-parse the bundle
patient = (Patient) jsonParser.parseResource(jsonParser.encodeResourceToString(patient)); patient = (Patient) jsonParser.parseResource(jsonParser.encodeResourceToString(patient));
assertEquals("#1", patient.getManagingOrganization().getReference()); assertEquals("#" + organizationUuid, patient.getManagingOrganization().getReference());
assertNotNull(patient.getManagingOrganization().getResource()); assertNotNull(patient.getManagingOrganization().getResource());
org = (Organization) patient.getManagingOrganization().getResource(); org = (Organization) patient.getManagingOrganization().getResource();
assertEquals("#1", org.getIdElement().getValue()); assertEquals("#" + organizationUuid, org.getIdElement().getValue());
assertEquals("Contained Test Organization", org.getName()); assertEquals("Contained Test Organization", org.getName());
// And re-encode a second time // And re-encode a second time
encoded = jsonParser.encodeResourceToString(patient); encoded = jsonParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"1\"", "\"identifier\"", "\"reference\": \"#1\"")); assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"" + organizationUuid + "\"", "\"identifier\"", "\"reference\": \"#" + organizationUuid + "\""));
assertThat(encoded).doesNotContainPattern("(?s)\"contained\":.*\\[.*\"contained\":"); assertThat(encoded).doesNotContainPattern("(?s)\"contained\":.*\\[.*\"contained\":");
// And re-encode once more, with the references cleared // And re-encode once more, with the references cleared
@ -439,7 +444,7 @@ public class JsonParserHl7OrgDstu2Test {
patient.getManagingOrganization().setReference(null); patient.getManagingOrganization().setReference(null);
encoded = jsonParser.encodeResourceToString(patient); encoded = jsonParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"1\"", "\"identifier\"", "\"reference\": \"#1\"")); assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\": [", "\"id\": \"" + organizationUuid + "\"", "\"identifier\"", "\"reference\": \"#" + organizationUuid + "\""));
assertThat(encoded).doesNotContainPattern("(?s).*\"contained\":.*\\[.*\"contained\":"); assertThat(encoded).doesNotContainPattern("(?s).*\"contained\":.*\\[.*\"contained\":");
// And re-encode once more, with the references cleared and a manually set local ID // And re-encode once more, with the references cleared and a manually set local ID
@ -472,13 +477,16 @@ public class JsonParserHl7OrgDstu2Test {
// Encode the buntdle // Encode the buntdle
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b); String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(b);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\"", "resourceType\": \"Organization", "id\": \"1\"")); String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertThat(encoded).contains("reference\": \"#1\""); assertNotNull(organizationUuid);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\"", "resourceType\": \"Organization", "id\": \"" + organizationUuid + "\""));
assertThat(encoded).contains("reference\": \"#" + organizationUuid + "\"");
encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient); encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\"", "resourceType\": \"Organization", "id\": \"1\"")); assertThat(encoded).containsSubsequence(Arrays.asList("\"contained\"", "resourceType\": \"Organization", "id\": \"" + organizationUuid + "\""));
assertThat(encoded).contains("reference\": \"#1\""); assertThat(encoded).contains("reference\": \"#" + organizationUuid + "\"");
} }
@Test @Test
@ -696,7 +704,7 @@ public class JsonParserHl7OrgDstu2Test {
String enc = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(list); String enc = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(list);
ourLog.info(enc); ourLog.info(enc);
assertThat(enc).contains("\"id\": \"1\""); assertThat(enc).containsPattern("\"id\": \"" + UUID_PATTERN);
List_ parsed = ourCtx.newJsonParser().parseResource(List_.class,enc); List_ parsed = ourCtx.newJsonParser().parseResource(List_.class,enc);
assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass()); assertEquals(Patient.class, parsed.getEntry().get(0).getItem().getResource().getClass());

View File

@ -9,6 +9,7 @@ import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.parser.JsonParserHl7OrgDstu2Test.MyPatientWithOneDeclaredAddressExtension; import ca.uhn.fhir.parser.JsonParserHl7OrgDstu2Test.MyPatientWithOneDeclaredAddressExtension;
import ca.uhn.fhir.parser.JsonParserHl7OrgDstu2Test.MyPatientWithOneDeclaredExtension; import ca.uhn.fhir.parser.JsonParserHl7OrgDstu2Test.MyPatientWithOneDeclaredExtension;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.test.utilities.UuidUtils;
import net.sf.json.JSON; import net.sf.json.JSON;
import net.sf.json.JSONSerializer; import net.sf.json.JSONSerializer;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
@ -216,8 +217,11 @@ public class XmlParserHl7OrgDstu2Test {
String encoded = xmlParser.encodeResourceToString(patient); String encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String organizationUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(organizationUuid);
assertThat(encoded).contains("<contained>"); assertThat(encoded).contains("<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// Create a bundle with just the patient resource // Create a bundle with just the patient resource
Bundle b = new Bundle(); Bundle b = new Bundle();
@ -226,37 +230,37 @@ public class XmlParserHl7OrgDstu2Test {
// Encode the bundle // Encode the bundle
encoded = xmlParser.encodeResourceToString(b); encoded = xmlParser.encodeResourceToString(b);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<id value=\"1\"/>", "</contained>")); assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<id value=\"" + organizationUuid + "\"/>", "</contained>"));
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
assertThat(encoded).containsSubsequence(Arrays.asList("<entry>", "</entry>")); assertThat(encoded).containsSubsequence(Arrays.asList("<entry>", "</entry>"));
assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>"); assertThat(encoded).doesNotContainPattern("(?s)<entry>.*</entry>.*<entry>");
// Re-parse the bundle // Re-parse the bundle
patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient)); patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient));
assertEquals("#1", patient.getManagingOrganization().getReferenceElement().getValue()); assertEquals("#" + organizationUuid, patient.getManagingOrganization().getReferenceElement().getValue());
assertNotNull(patient.getManagingOrganization().getResource()); assertNotNull(patient.getManagingOrganization().getResource());
org = (Organization) patient.getManagingOrganization().getResource(); org = (Organization) patient.getManagingOrganization().getResource();
assertEquals("#1", org.getIdElement().getValue()); assertEquals("#" + organizationUuid, org.getIdElement().getValue());
assertEquals("Contained Test Organization", org.getName()); assertEquals("Contained Test Organization", org.getName());
// And re-encode a second time // And re-encode a second time
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid + "\"/>",
"</Organization", "</contained>", "<reference value=\"#1\"/>")); "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared // And re-encode once more, with the references cleared
patient.getContained().clear(); patient.getContained().clear();
patient.getManagingOrganization().setReference(null); patient.getManagingOrganization().setReference(null);
encoded = xmlParser.encodeResourceToString(patient); encoded = xmlParser.encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"1\"/>", assertThat(encoded).containsSubsequence(Arrays.asList("<contained>", "<Organization ", "<id value=\"" + organizationUuid + "\"/>",
"</Organization", "</contained>", "<reference value=\"#1\"/>")); "</Organization", "</contained>", "<reference value=\"#" + organizationUuid + "\"/>"));
assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>"); assertThat(encoded).doesNotContainPattern("(?s)<contained>.*<Org.*<contained>");
assertThat(encoded).contains("<reference value=\"#1\"/>"); assertThat(encoded).contains("<reference value=\"#" + organizationUuid + "\"/>");
// And re-encode once more, with the references cleared and a manually set // And re-encode once more, with the references cleared and a manually set
// local ID // local ID
@ -969,13 +973,15 @@ public class XmlParserHl7OrgDstu2Test {
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded); ourLog.info(encoded);
String conditionUuid = UuidUtils.findFirstUUID(encoded);
assertNotNull(conditionUuid);
//@formatter:off //@formatter:off
assertThat(encoded).containsSubsequence( assertThat(encoded).containsSubsequence(
"<Patient xmlns=\"http://hl7.org/fhir\">", "<Patient xmlns=\"http://hl7.org/fhir\">",
"<contained>", "<contained>",
"<Condition xmlns=\"http://hl7.org/fhir\">", "<Condition xmlns=\"http://hl7.org/fhir\">",
"<id value=\"1\"/>", "<id value=\"" + conditionUuid + "\"/>",
"<bodySite>", "<bodySite>",
"<text value=\"BODY SITE\"/>", "<text value=\"BODY SITE\"/>",
"</bodySite>", "</bodySite>",
@ -983,7 +989,7 @@ public class XmlParserHl7OrgDstu2Test {
"</contained>", "</contained>",
"<extension url=\"testCondition\">", "<extension url=\"testCondition\">",
"<valueReference>", "<valueReference>",
"<reference value=\"#1\"/>", "<reference value=\"#" + conditionUuid + "\"/>",
"</valueReference>", "</valueReference>",
"</extension>", "</extension>",
"<birthDate value=\"2016-04-14\"/>", "<birthDate value=\"2016-04-14\"/>",

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -7,6 +7,7 @@ import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.rest.api.Constants; import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.test.BaseTest; import ca.uhn.fhir.test.BaseTest;
import ca.uhn.fhir.util.BundleBuilder;
import ca.uhn.fhir.util.StopWatch; import ca.uhn.fhir.util.StopWatch;
import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.TestUtil;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -28,6 +29,7 @@ import org.hl7.fhir.r4.model.DocumentReference;
import org.hl7.fhir.r4.model.Encounter; import org.hl7.fhir.r4.model.Encounter;
import org.hl7.fhir.r4.model.Extension; import org.hl7.fhir.r4.model.Extension;
import org.hl7.fhir.r4.model.HumanName; import org.hl7.fhir.r4.model.HumanName;
import org.hl7.fhir.r4.model.IdType;
import org.hl7.fhir.r4.model.Identifier; import org.hl7.fhir.r4.model.Identifier;
import org.hl7.fhir.r4.model.Medication; import org.hl7.fhir.r4.model.Medication;
import org.hl7.fhir.r4.model.MedicationDispense; import org.hl7.fhir.r4.model.MedicationDispense;
@ -60,6 +62,7 @@ import jakarta.annotation.Nonnull;
import org.testcontainers.shaded.com.trilead.ssh2.packets.PacketDisconnect; import org.testcontainers.shaded.com.trilead.ssh2.packets.PacketDisconnect;
import java.io.IOException; import java.io.IOException;
import java.sql.Ref;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
@ -284,10 +287,10 @@ public class JsonParserR4Test extends BaseTest {
String encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(b); String encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(b);
//Then: Diag should contain one local contained specimen //Then: Diag should contain one local contained specimen
assertThat(encoded).contains("[{\"resource\":{\"resourceType\":\"DiagnosticReport\",\"contained\":[{\"resourceType\":\"Specimen\",\"id\":\"1\"}]"); assertThat(encoded).contains("[{\"resource\":{\"resourceType\":\"DiagnosticReport\",\"contained\":[{\"resourceType\":\"Specimen\",\"id\":\""+ specimen.getId().replaceFirst("#", "") +"\"}]");
//Then: Obs should contain one local contained specimen, and one local contained pract //Then: Obs should contain one local contained specimen, and one local contained pract
assertThat(encoded).contains("\"resource\":{\"resourceType\":\"Observation\",\"contained\":[{\"resourceType\":\"Specimen\",\"id\":\"1\"},{\"resourceType\":\"Practitioner\",\"id\":\"2\"}]"); assertThat(encoded).contains("\"resource\":{\"resourceType\":\"Observation\",\"contained\":[{\"resourceType\":\"Specimen\",\"id\":\""+ specimen.getId().replaceFirst("#", "") +"\"},{\"resourceType\":\"Practitioner\",\"id\":\"" + practitioner.getId().replaceAll("#","") + "\"}]");
assertThat(encoded).contains("\"performer\":[{\"reference\":\"#2\"}],\"specimen\":{\"reference\":\"#1\"}"); assertThat(encoded).contains("\"performer\":[{\"reference\":\""+practitioner.getId()+"\"}],\"specimen\":{\"reference\":\""+specimen.getId()+"\"}");
//Also, reverting the operation should work too! //Also, reverting the operation should work too!
Bundle bundle = ourCtx.newJsonParser().parseResource(Bundle.class, encoded); Bundle bundle = ourCtx.newJsonParser().parseResource(Bundle.class, encoded);
@ -298,50 +301,6 @@ public class JsonParserR4Test extends BaseTest {
} }
@Test
public void testAutoAssignedContainedCollisionOrderDependent() {
{
Specimen specimen = new Specimen();
Practitioner practitioner = new Practitioner();
DiagnosticReport report = new DiagnosticReport();
report.addSpecimen(new Reference(specimen));
Observation obs = new Observation();
//When: The practitioner (which is parsed first, has an assigned id that will collide with auto-assigned
practitioner.setId("#1");
obs.addPerformer(new Reference(practitioner));
obs.setSpecimen(new Reference(specimen));
String encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(obs);
assertThat(encoded).contains("\"contained\":[{\"resourceType\":\"Practitioner\",\"id\":\"1\"},{\"resourceType\":\"Specimen\",\"id\":\"2\"}]");
assertThat(encoded).contains("\"performer\":[{\"reference\":\"#1\"}]");
assertThat(encoded).contains("\"specimen\":{\"reference\":\"#2\"}}");
ourLog.info(encoded);
}
{
Specimen specimen = new Specimen();
Practitioner practitioner = new Practitioner();
DiagnosticReport report = new DiagnosticReport();
report.addSpecimen(new Reference(specimen));
Observation obs = new Observation();
//When: The specimen (which is parsed second, has an assigned id that will collide with auto-assigned practitioner
specimen.setId("#1");
obs.addPerformer(new Reference(practitioner));
obs.setSpecimen(new Reference(specimen));
String encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(obs);
assertThat(encoded).contains("\"contained\":[{\"resourceType\":\"Specimen\",\"id\":\"1\"},{\"resourceType\":\"Practitioner\",\"id\":\"2\"}]");
assertThat(encoded).contains("\"performer\":[{\"reference\":\"#2\"}]");
assertThat(encoded).contains("\"specimen\":{\"reference\":\"#1\"}}");
ourLog.info(encoded);
}
}
@Test @Test
public void testContainedResourcesNotAutoContainedWhenConfiguredNotToDoSo() { public void testContainedResourcesNotAutoContainedWhenConfiguredNotToDoSo() {
MedicationDispense md = new MedicationDispense(); MedicationDispense md = new MedicationDispense();
@ -357,8 +316,9 @@ public class JsonParserR4Test extends BaseTest {
ourCtx.getParserOptions().setAutoContainReferenceTargetsWithNoId(true); ourCtx.getParserOptions().setAutoContainReferenceTargetsWithNoId(true);
encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(md); encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(md);
assertEquals("{\"resourceType\":\"MedicationDispense\",\"contained\":[{\"resourceType\":\"Medication\",\"id\":\"1\",\"code\":{\"text\":\"MED\"}}],\"identifier\":[{\"value\":\"DISPENSE\"}],\"medicationReference\":{\"reference\":\"#1\"}}", encoded); String guidWithHash = med.getId();
String withoutHash = guidWithHash.replace("#", "");
assertThat(encoded).contains("{\"resourceType\":\"MedicationDispense\",\"contained\":[{\"resourceType\":\"Medication\",\"id\":\"" + withoutHash + "\",\"code\":{\"text\":\"MED\"}}],\"identifier\":[{\"value\":\"DISPENSE\"}],\"medicationReference\":{\"reference\":\"" + guidWithHash +"\"}}"); //Note we dont check exact ID since its a GUID
} }
@Test @Test
@ -649,7 +609,7 @@ public class JsonParserR4Test extends BaseTest {
obs = ourCtx.newJsonParser().parseResource(Observation.class, encoded); obs = ourCtx.newJsonParser().parseResource(Observation.class, encoded);
assertEquals("#1", obs.getContained().get(0).getId()); assertEquals("#1", obs.getContained().get(0).getId());
assertEquals("#2", obs.getContained().get(1).getId()); assertEquals(enc.getId(), obs.getContained().get(1).getId());
pt = (Patient) obs.getSubject().getResource(); pt = (Patient) obs.getSubject().getResource();
assertEquals("FAM", pt.getNameFirstRep().getFamily()); assertEquals("FAM", pt.getNameFirstRep().getFamily());
@ -678,7 +638,7 @@ public class JsonParserR4Test extends BaseTest {
obs = ourCtx.newJsonParser().parseResource(Observation.class, encoded); obs = ourCtx.newJsonParser().parseResource(Observation.class, encoded);
assertEquals("#1", obs.getContained().get(0).getId()); assertEquals("#1", obs.getContained().get(0).getId());
assertEquals("#2", obs.getContained().get(1).getId()); assertEquals(pt.getId(), obs.getContained().get(1).getId());
pt = (Patient) obs.getSubject().getResource(); pt = (Patient) obs.getSubject().getResource();
assertEquals("FAM", pt.getNameFirstRep().getFamily()); assertEquals("FAM", pt.getNameFirstRep().getFamily());
@ -698,13 +658,14 @@ public class JsonParserR4Test extends BaseTest {
ourLog.info(encoded); ourLog.info(encoded);
mr = ourCtx.newJsonParser().parseResource(MedicationRequest.class, encoded); mr = ourCtx.newJsonParser().parseResource(MedicationRequest.class, encoded);
mr.setMedication(new Reference(new Medication().setStatus(Medication.MedicationStatus.ACTIVE))); Medication med = new Medication().setStatus(Medication.MedicationStatus.ACTIVE);
mr.setMedication(new Reference(med));
encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(mr); encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(mr);
ourLog.info(encoded); ourLog.info(encoded);
mr = ourCtx.newJsonParser().parseResource(MedicationRequest.class, encoded); mr = ourCtx.newJsonParser().parseResource(MedicationRequest.class, encoded);
assertEquals("#1", mr.getContained().get(0).getId()); assertEquals(pract.getId(), mr.getContained().get(0).getId());
assertEquals("#2", mr.getContained().get(1).getId()); assertEquals(med.getId(), mr.getContained().get(1).getId());
} }

View File

@ -67,6 +67,7 @@ import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static ca.uhn.fhir.test.utilities.UuidUtils.HASH_UUID_PATTERN;
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertFalse;
@ -193,12 +194,12 @@ public class FhirTerserR4Test {
FhirTerser.ContainedResources contained = myCtx.newTerser().containResources(mr, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS); FhirTerser.ContainedResources contained = myCtx.newTerser().containResources(mr, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS);
assertEquals("#1", mr.getContained().get(0).getId()); assertThat(mr.getContained().get(0).getId()).containsPattern(HASH_UUID_PATTERN);
assertEquals("#2", mr.getContained().get(1).getId()); assertThat(mr.getContained().get(1).getId()).containsPattern(HASH_UUID_PATTERN);
assertEquals(ResourceType.Medication, mr.getContained().get(0).getResourceType()); assertEquals(ResourceType.Medication, mr.getContained().get(0).getResourceType());
assertEquals(ResourceType.Practitioner, mr.getContained().get(1).getResourceType()); assertEquals(ResourceType.Practitioner, mr.getContained().get(1).getResourceType());
assertEquals("#1", mr.getMedicationReference().getReference()); assertEquals(mr.getContained().get(0).getId(), mr.getMedicationReference().getReference());
assertEquals("#2", mr.getRequester().getReference()); assertEquals(mr.getContained().get(1).getId(), mr.getRequester().getReference());
FhirTerser.ContainedResources secondPass = myCtx.newTerser().containResources(mr, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS); FhirTerser.ContainedResources secondPass = myCtx.newTerser().containResources(mr, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS);
assertThat(secondPass).isSameAs(contained); assertThat(secondPass).isSameAs(contained);
@ -217,12 +218,12 @@ public class FhirTerserR4Test {
myCtx.newTerser().containResources(medAdmin, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS); myCtx.newTerser().containResources(medAdmin, FhirTerser.OptionsEnum.MODIFY_RESOURCE, FhirTerser.OptionsEnum.STORE_AND_REUSE_RESULTS);
assertEquals("#1", medAdmin.getContained().get(0).getId()); assertThat(medAdmin.getContained().get(0).getId()).containsPattern(HASH_UUID_PATTERN);
assertEquals("#2", medAdmin.getContained().get(1).getId()); assertThat(medAdmin.getContained().get(1).getId()).containsPattern(HASH_UUID_PATTERN);
assertEquals(ResourceType.Medication, medAdmin.getContained().get(0).getResourceType()); assertEquals(ResourceType.Medication, medAdmin.getContained().get(0).getResourceType());
assertEquals(ResourceType.Substance, medAdmin.getContained().get(1).getResourceType()); assertEquals(ResourceType.Substance, medAdmin.getContained().get(1).getResourceType());
assertEquals("#1", medAdmin.getMedicationReference().getReference()); assertEquals(medAdmin.getContained().get(0).getId(), medAdmin.getMedicationReference().getReference());
assertEquals("#2", ((Medication) (medAdmin.getContained().get(0))).getIngredientFirstRep().getItemReference().getReference()); assertEquals(medAdmin.getContained().get(1).getId(), ((Medication) (medAdmin.getContained().get(0))).getIngredientFirstRep().getItemReference().getReference());
} }

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -0,0 +1,47 @@
/*-
* #%L
* HAPI FHIR Test Utilities
* %%
* Copyright (C) 2014 - 2024 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%
*/
package ca.uhn.fhir.test.utilities;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class UuidUtils {
private UuidUtils() {
}
public static final String UUID_PATTERN = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
public static final String HASH_UUID_PATTERN = "#" + UUID_PATTERN;
private static final Pattern COMPILED_UUID_PATTERN = Pattern.compile(UUID_PATTERN);
/**
* Extracts first UUID from String.
* Returns null if no UUID present in the String.
*/
public static String findFirstUUID(String input) {
Matcher matcher = COMPILED_UUID_PATTERN.matcher(input);
if (matcher.find()) {
return matcher.group();
}
return null;
}
}

View File

@ -0,0 +1,29 @@
package ca.uhn.fhir.test.utilities;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
public class UuidUtilsTest {
@Test
void testFindsUuid() {
String xml = "<id value=#cdb6dfa1-74b7-4ea9-88e0-d3afaef8c016/>";
String uuid = UuidUtils.findFirstUUID(xml);
assertEquals("cdb6dfa1-74b7-4ea9-88e0-d3afaef8c016", uuid);
}
@Test
void testFindsFirstUuid() {
String xml = "<id value=#cdb6dfa1-74b7-4ea9-88e0-d3afaef8c016/><id value=#da8a08e3-ddf5-4a62-baae-3e8c3ea04687/>";
String uuid = UuidUtils.findFirstUUID(xml);
assertEquals("cdb6dfa1-74b7-4ea9-88e0-d3afaef8c016", uuid);
}
@Test
void testNoUuidReturnsNull() {
String xml = "<id value=x />";
assertNull(UuidUtils.findFirstUUID(xml));
}
}

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId> <artifactId>hapi-fhir</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath> <relativePath>../pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>ca.uhn.hapi.fhir</groupId> <groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId> <artifactId>hapi-deployable-pom</artifactId>
<version>7.5.3-SNAPSHOT</version> <version>7.5.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath> <relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent> </parent>

View File

@ -85,4 +85,14 @@ public class FhirDefaultPolicyAdvisor implements IValidationPolicyAdvisor {
List<ValidationMessage> messages) { List<ValidationMessage> messages) {
return Arrays.asList(); return Arrays.asList();
} }
@Override
public boolean isSuppressMessageId(String path, String messageId) {
return false;
}
@Override
public ReferenceValidationPolicy getReferencePolicy() {
return ReferenceValidationPolicy.IGNORE;
}
} }

View File

@ -699,10 +699,14 @@ public class FhirInstanceValidatorDstu3Test extends BaseValidationTestWithInline
} else if (t.getMessage().equals("The nominated WG 'rcrim' is unknown")) { } else if (t.getMessage().equals("The nominated WG 'rcrim' is unknown")) {
//The rcrim workgroup is now brr http://www.hl7.org/Special/committees/rcrim/index.cfm //The rcrim workgroup is now brr http://www.hl7.org/Special/committees/rcrim/index.cfm
return false; return false;
} else if (t.getMessage().contains("which is experimental, but this structure is not labeled as experimental")
//DSTU3 resources will not pass validation with this new business rule (2024-09-17) https://github.com/hapifhir/org.hl7.fhir.core/commit/7d05d38509895ddf8614b35ffb51b1f5363f394c
) {
return false;
} else if (t.getSeverity() == ResultSeverityEnum.WARNING } else if (t.getSeverity() == ResultSeverityEnum.WARNING
&& ( t.getMessageId().equals("VALIDATION_HL7_PUBLISHER_MISMATCH") && ( "VALIDATION_HL7_PUBLISHER_MISMATCH".equals(t.getMessageId())
|| t.getMessageId().equals("VALIDATION_HL7_PUBLISHER_MISMATCH2") || "VALIDATION_HL7_PUBLISHER_MISMATCH2".equals(t.getMessageId())
|| t.getMessageId().equals("VALIDATION_HL7_WG_URL") || "VALIDATION_HL7_WG_URL".equals(t.getMessageId())
)) { )) {
// Workgroups have been updated and have slightly different naming conventions and URLs. // Workgroups have been updated and have slightly different naming conventions and URLs.
return false; return false;

Some files were not shown because too many files have changed in this diff Show More