diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml
index 53a8ac475..d57fb1f15 100644
--- a/org.hl7.fhir.convertors/pom.xml
+++ b/org.hl7.fhir.convertors/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirorg.hl7.fhir.core
- 4.1.54-SNAPSHOT
+ 4.1.63-SNAPSHOT../pom.xml
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java
index 3465ae370..d343c281d 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_50.java
@@ -152,8 +152,32 @@ public class VersionConvertor_30_50 {
return tgt;
}
+ public static org.hl7.fhir.r5.model.CodeType convertStringToCode(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException {
+ org.hl7.fhir.r5.model.CodeType tgt = new org.hl7.fhir.r5.model.CodeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu3.model.StringType convertCodeToString(org.hl7.fhir.r5.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu3.model.CodeType convertStringToCode(org.hl7.fhir.r5.model.StringType src) throws FHIRException {
+ org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public static org.hl7.fhir.r5.model.StringType convertCodeToString(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.r5.model.StringType tgt = new org.hl7.fhir.r5.model.StringType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
public static org.hl7.fhir.r5.model.DateType convertDate(org.hl7.fhir.dstu3.model.DateType src) throws FHIRException {
- org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString());
+ org.hl7.fhir.r5.model.DateType tgt = new org.hl7.fhir.r5.model.DateType(src.getValueAsString());
copyElement(src, tgt);
return tgt;
}
@@ -290,6 +314,18 @@ public class VersionConvertor_30_50 {
return tgt;
}
+ public static org.hl7.fhir.r5.model.MarkdownType convertStringToMarkdown(org.hl7.fhir.dstu3.model.StringType src) throws FHIRException {
+ org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu3.model.StringType convertMarkdownToString(org.hl7.fhir.r5.model.MarkdownType src) throws FHIRException {
+ org.hl7.fhir.dstu3.model.StringType tgt = new org.hl7.fhir.dstu3.model.StringType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
public static org.hl7.fhir.r5.model.TimeType convertTime(org.hl7.fhir.dstu3.model.TimeType src) throws FHIRException {
org.hl7.fhir.r5.model.TimeType tgt = new org.hl7.fhir.r5.model.TimeType(src.getValue());
copyElement(src, tgt);
@@ -326,6 +362,18 @@ public class VersionConvertor_30_50 {
return tgt;
}
+ public static org.hl7.fhir.r5.model.UriType convertCodeToUri(org.hl7.fhir.dstu3.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.r5.model.UriType tgt = new org.hl7.fhir.r5.model.UriType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public static org.hl7.fhir.dstu3.model.CodeType convertUriToCode(org.hl7.fhir.r5.model.UriType src) throws FHIRException {
+ org.hl7.fhir.dstu3.model.CodeType tgt = new org.hl7.fhir.dstu3.model.CodeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
public static org.hl7.fhir.r5.model.UuidType convertUuid(org.hl7.fhir.dstu3.model.UuidType src) throws FHIRException {
org.hl7.fhir.r5.model.UuidType tgt = new org.hl7.fhir.r5.model.UuidType(src.getValue());
copyElement(src, tgt);
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java
index e9fbe4376..4dc0430cd 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/OperationDefinition30_50.java
@@ -49,7 +49,7 @@ public class OperationDefinition30_50 {
if (src.hasCodeElement())
tgt.setCodeElement((org.hl7.fhir.r5.model.CodeType) VersionConvertor_30_50.convertType(src.getCodeElement()));
if (src.hasCommentElement())
- tgt.setCommentElement((org.hl7.fhir.r5.model.MarkdownType) VersionConvertor_30_50.convertType(src.getCommentElement()));
+ tgt.setCommentElement(VersionConvertor_30_50.convertStringToMarkdown(src.getCommentElement()));
if (src.hasBase())
tgt.setBaseElement(VersionConvertor_30_50.convertReferenceToCanonical(src.getBase()));
if (src.hasResource()) {
@@ -109,7 +109,7 @@ public class OperationDefinition30_50 {
if (src.hasCodeElement())
tgt.setCodeElement((org.hl7.fhir.dstu3.model.CodeType) VersionConvertor_30_50.convertType(src.getCodeElement()));
if (src.hasCommentElement())
- tgt.setCommentElement((org.hl7.fhir.dstu3.model.StringType) VersionConvertor_30_50.convertType(src.getCommentElement()));
+ tgt.setCommentElement(VersionConvertor_30_50.convertMarkdownToString(src.getCommentElement()));
if (src.hasBase())
tgt.setBase(VersionConvertor_30_50.convertCanonicalToReference(src.getBaseElement()));
if (src.hasResource()) {
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java
index 2e1346654..738c8ed1a 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/StructureDefinition30_50.java
@@ -175,8 +175,9 @@ public class StructureDefinition30_50 {
if (src.hasAbstractElement())
tgt.setAbstractElement((org.hl7.fhir.dstu3.model.BooleanType) VersionConvertor_30_50.convertType(src.getAbstractElement()));
for (org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionContextComponent t : src.getContext()) {
- if (!tgt.hasContextType())
- tgt.setTypeElement((org.hl7.fhir.dstu3.model.CodeType) VersionConvertor_30_50.convertType(src.getTypeElement()));
+ if (!tgt.hasContextType()) {
+ tgt.setTypeElement((org.hl7.fhir.dstu3.model.CodeType) VersionConvertor_30_50.convertUriToCode(src.getTypeElement()));
+ }
tgt.addContext("Element".equals(t.getExpression()) ? "*" : t.getExpression());
}
if (src.hasContextInvariant()) {
diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java
index 426e77c80..00e2ea731 100644
--- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java
+++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/conv30_50/ValueSet30_50.java
@@ -117,7 +117,7 @@ public class ValueSet30_50 {
if (src.hasOp())
tgt.setOp(convertFilterOperator2(src.getOp()));
if (src.hasValueElement())
- tgt.setValueElement((org.hl7.fhir.dstu3.model.CodeType) VersionConvertor_30_50.convertType(src.getValueElement()));
+ tgt.setValueElement((org.hl7.fhir.dstu3.model.CodeType) VersionConvertor_30_50.convertStringToCode(src.getValueElement()));
return tgt;
}
@@ -131,7 +131,7 @@ public class ValueSet30_50 {
if (src.hasOp())
tgt.setOp(VersionConvertor_30_50.convertFilterOperator(src.getOp()));
if (src.hasValueElement())
- tgt.setValueElement((org.hl7.fhir.r5.model.StringType) VersionConvertor_30_50.convertType(src.getValueElement()));
+ tgt.setValueElement((org.hl7.fhir.r5.model.StringType) VersionConvertor_30_50.convertCodeToString(src.getValueElement()));
return tgt;
}
diff --git a/org.hl7.fhir.core.generator/configuration/Meta.java b/org.hl7.fhir.core.generator/configuration/Meta.java
index 7137bf15b..e875d789c 100644
--- a/org.hl7.fhir.core.generator/configuration/Meta.java
+++ b/org.hl7.fhir.core.generator/configuration/Meta.java
@@ -29,7 +29,7 @@
* null if none
*/
public Coding getSecurity(String theSystem, String theCode) {
- for (Coding next : getTag()) {
+ for (Coding next : getSecurity()) {
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
return next;
}
diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml
index aa372157d..eb66cb271 100644
--- a/org.hl7.fhir.dstu2/pom.xml
+++ b/org.hl7.fhir.dstu2/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirorg.hl7.fhir.core
- 4.1.54-SNAPSHOT
+ 4.1.63-SNAPSHOT../pom.xml
diff --git a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Meta.java b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Meta.java
index bb0d97b8f..ae2b373e1 100644
--- a/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Meta.java
+++ b/org.hl7.fhir.dstu2/src/main/java/org/hl7/fhir/dstu2/model/Meta.java
@@ -277,7 +277,7 @@ public class Meta extends Type implements IBaseMetaType {
* null if none
*/
public Coding getSecurity(String theSystem, String theCode) {
- for (Coding next : getTag()) {
+ for (Coding next : getSecurity()) {
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
return next;
}
diff --git a/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java b/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java
new file mode 100644
index 000000000..6ded2d99c
--- /dev/null
+++ b/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java
@@ -0,0 +1,24 @@
+package org.hl7.fhir.dstu2.test;
+
+import org.hl7.fhir.dstu2.model.Coding;
+import org.hl7.fhir.dstu2.model.Meta;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MetaTest {
+ public static String TEST_SYSTEM = "TEST_SYSTEM";
+ public static String TEST_CODE = "TEST_CODE";
+
+ @Test
+ public void testMetaSecurity() {
+ Meta meta = new Meta();
+ Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
+ assertTrue(meta.hasSecurity());
+ assertNotNull(meta.getSecurity());
+ assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(1, meta.getSecurity().size());
+ assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ }
+}
diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml
index 906fb23b3..2a22e1068 100644
--- a/org.hl7.fhir.dstu2016may/pom.xml
+++ b/org.hl7.fhir.dstu2016may/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirorg.hl7.fhir.core
- 4.1.54-SNAPSHOT
+ 4.1.63-SNAPSHOT../pom.xml
diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml
index bb2834b61..d15a6299b 100644
--- a/org.hl7.fhir.dstu3/pom.xml
+++ b/org.hl7.fhir.dstu3/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirorg.hl7.fhir.core
- 4.1.54-SNAPSHOT
+ 4.1.63-SNAPSHOT../pom.xml
diff --git a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Meta.java b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Meta.java
index e98bef91f..90bfbf7fa 100644
--- a/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Meta.java
+++ b/org.hl7.fhir.dstu3/src/main/java/org/hl7/fhir/dstu3/model/Meta.java
@@ -421,7 +421,7 @@ public class Meta extends Type implements IBaseMetaType {
* null if none
*/
public Coding getSecurity(String theSystem, String theCode) {
- for (Coding next : getTag()) {
+ for (Coding next : getSecurity()) {
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
return next;
}
diff --git a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/MetaTest.java b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/MetaTest.java
new file mode 100644
index 000000000..2b6157fcc
--- /dev/null
+++ b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/MetaTest.java
@@ -0,0 +1,26 @@
+package org.hl7.fhir.dstu3.test;
+
+import org.hl7.fhir.dstu3.model.Coding;
+import org.hl7.fhir.dstu3.model.Meta;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class MetaTest {
+ public static String TEST_SYSTEM = "TEST_SYSTEM";
+ public static String TEST_CODE = "TEST_CODE";
+
+ @Test
+ public void testMetaSecurity() {
+ Meta meta = new Meta();
+ Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
+ assertTrue(meta.hasSecurity());
+ assertNotNull(meta.getSecurity());
+ assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(1, meta.getSecurity().size());
+ assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ }
+}
+
diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml
index 9768fbd06..b5d82f7ab 100644
--- a/org.hl7.fhir.r4/pom.xml
+++ b/org.hl7.fhir.r4/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirorg.hl7.fhir.core
- 4.1.54-SNAPSHOT
+ 4.1.63-SNAPSHOT../pom.xml
diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Meta.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Meta.java
index cf6835922..5a6440428 100644
--- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Meta.java
+++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Meta.java
@@ -476,7 +476,7 @@ public class Meta extends Type implements IBaseMetaType {
* null if none
*/
public Coding getSecurity(String theSystem, String theCode) {
- for (Coding next : getTag()) {
+ for (Coding next : getSecurity()) {
if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
return next;
}
diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/MetaTest.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/MetaTest.java
new file mode 100644
index 000000000..215ab9f7e
--- /dev/null
+++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/MetaTest.java
@@ -0,0 +1,26 @@
+package org.hl7.fhir.r4.test;
+
+import org.hl7.fhir.r4.model.Coding;
+import org.hl7.fhir.r4.model.Meta;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+
+public class MetaTest {
+ public static String TEST_SYSTEM = "TEST_SYSTEM";
+ public static String TEST_CODE = "TEST_CODE";
+
+ @Test
+ public void testMetaSecurity() {
+ Meta meta = new Meta();
+ Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE);
+ assertTrue(meta.hasSecurity());
+ assertNotNull(meta.getSecurity());
+ assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(1, meta.getSecurity().size());
+ assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE));
+ }
+}
diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml
index de7db29bc..667c503f7 100644
--- a/org.hl7.fhir.r5/pom.xml
+++ b/org.hl7.fhir.r5/pom.xml
@@ -5,7 +5,7 @@
ca.uhn.hapi.fhirorg.hl7.fhir.core
- 4.1.54-SNAPSHOT
+ 4.1.63-SNAPSHOT../pom.xml
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java
index e2c3a3aaa..f2d8742ec 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/conformance/ProfileUtilities.java
@@ -463,6 +463,9 @@ public class ProfileUtilities extends TranslatingUtilities {
if (derived == null) {
throw new DefinitionException("no derived structure provided");
}
+ checkNotGenerating(base, "Base for generating a snapshot for the profile "+derived.getUrl());
+ checkNotGenerating(derived, "Focus for generating a snapshot");
+ derived.setUserData("profileutils.snapshot.generating", true);
if (!base.hasType()) {
throw new DefinitionException("Base profile "+base.getUrl()+" has no type");
@@ -622,6 +625,7 @@ public class ProfileUtilities extends TranslatingUtilities {
derived.setSnapshot(null);
throw e;
}
+ derived.clearUserData("profileutils.snapshot.generating");
}
private void checkDifferential(List elements, String type, String url) {
@@ -853,10 +857,12 @@ public class ProfileUtilities extends TranslatingUtilities {
CanonicalType p = diffMatches.get(0).getType().get(0).getProfile().get(0);
StructureDefinition sd = context.fetchResource(StructureDefinition.class, p.getValue());
if (sd != null) {
+ checkNotGenerating(sd, "an extension definition");
if (!sd.hasSnapshot()) {
StructureDefinition sdb = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition());
if (sdb == null)
throw new DefinitionException("Unable to find base "+sd.getBaseDefinition()+" for "+sd.getUrl());
+ checkNotGenerating(sdb, "an extension base");
generateSnapshot(sdb, sd, sd.getUrl(), (sdb.hasUserData("path")) ? Utilities.extractBaseUrl(sdb.getUserString("path")) : webUrl, sd.getName());
}
ElementDefinition src;
@@ -905,7 +911,7 @@ public class ProfileUtilities extends TranslatingUtilities {
result.getElement().add(outcome);
baseCursor++;
diffCursor = differential.getElement().indexOf(diffMatches.get(0))+1;
- if (diffLimit >= diffCursor && outcome.getPath().contains(".") && (isDataType(outcome.getType()) || outcome.hasContentReference())) { // don't want to do this for the root, since that's base, and we're already processing it
+ if (diffLimit >= diffCursor && outcome.getPath().contains(".") && (isDataType(outcome.getType()) || isBaseResource(outcome.getType()) || outcome.hasContentReference())) { // don't want to do this for the root, since that's base, and we're already processing it
if (pathStartsWith(differential.getElement().get(diffCursor).getPath(), diffMatches.get(0).getPath()+".") && !baseWalksInto(base.getElement(), baseCursor)) {
if (outcome.getType().size() > 1) {
if (outcome.getPath().endsWith("[x]") && !diffMatches.get(0).getPath().endsWith("[x]")) {
@@ -1424,7 +1430,7 @@ public class ProfileUtilities extends TranslatingUtilities {
outcome.setSlicing(null);
if (!outcome.getPath().startsWith(resultPathBase))
throw new DefinitionException("Adding wrong path");
- if (diffpos < diffMatches.size() && diffMatches.get(diffpos).getSliceName().equals(outcome.getSliceName())) {
+ if (diffpos < diffMatches.size() && diffMatches.get(diffpos).hasSliceName() && diffMatches.get(diffpos).getSliceName().equals(outcome.getSliceName())) {
// if there's a diff, we update the outcome with diff
// no? updateFromDefinition(outcome, diffMatches.get(diffpos), profileName, closed, url);
//then process any children
@@ -1540,6 +1546,24 @@ public class ProfileUtilities extends TranslatingUtilities {
}
+ private void checkNotGenerating(StructureDefinition sd, String role) {
+ if (sd.hasUserData("profileutils.snapshot.generating")) {
+ throw new FHIRException("Attempt to use a snapshot on profile '"+sd.getUrl()+"' as "+role+" before it is generated");
+ }
+ }
+
+ private boolean isBaseResource(List types) {
+ if (types.isEmpty())
+ return false;
+ for (TypeRefComponent type : types) {
+ String t = type.getWorkingCode();
+ if ("Resource".equals(t))
+ return false;
+ }
+ return true;
+
+ }
+
public String determineFixedType(List diffMatches, String fixedType, int i) {
if (diffMatches.get(i).getType().size() == 0 && diffMatches.get(i).hasSliceName()) {
String n = tail(diffMatches.get(i).getPath()).replace("[x]", "");
@@ -2441,62 +2465,7 @@ public class ProfileUtilities extends TranslatingUtilities {
if (!Base.compareDeep(derived.getType(), base.getType(), false)) {
if (base.hasType()) {
for (TypeRefComponent ts : derived.getType()) {
- boolean ok = false;
- CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
- String t = ts.getWorkingCode();
- for (TypeRefComponent td : base.getType()) {;
- String tt = td.getWorkingCode();
- b.append(tt);
- if (td.hasCode() && (tt.equals(t))) {
- ok = true;
- }
- if (!ok) {
- StructureDefinition sdt = context.fetchTypeDefinition(tt);
- if (sdt != null && sdt.getAbstract()) {
- StructureDefinition sdb = context.fetchTypeDefinition(t);
- while (sdb != null && !ok) {
- ok = sdb.getType().equals(sdt.getUrl());
- sdb = context.fetchResource(StructureDefinition.class, sdb.getBaseDefinition());
- }
- }
- }
- // work around for old badly generated SDs
- if (DONT_DO_THIS && Utilities.existsInList(tt, "Extension", "uri", "string", "Element")) {
- ok = true;
- }
- if (DONT_DO_THIS && Utilities.existsInList(tt, "Resource","DomainResource") && pkp.isResource(t)) {
- ok = true;
- }
- if (ok && ts.hasTargetProfile()) {
- // check that any derived target has a reference chain back to one of the base target profiles
- for (UriType u : ts.getTargetProfile()) {
- String url = u.getValue();
- boolean tgtOk = !td.hasTargetProfile() || td.hasTargetProfile(url);
- while (url != null && !tgtOk) {
- StructureDefinition sd = context.fetchResource(StructureDefinition.class, url);
- if (sd == null) {
- if (messages != null) {
- messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.BUSINESSRULE, purl+"#"+derived.getPath(), "Connect check whether the target profile "+url+" is valid constraint on the base because it is not known", IssueSeverity.WARNING));
- }
- url = null;
- tgtOk = true; // suppress error message
- } else {
- url = sd.getBaseDefinition();
- tgtOk = td.hasTargetProfile(url);
- }
- }
- if (!tgtOk) {
- if (messages == null) {
- throw new FHIRException("Error at "+purl+"#"+derived.getPath()+": The target profile "+url+" is not valid constraint on the base ("+td.getTargetProfile()+")");
- } else {
- messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.BUSINESSRULE, derived.getPath(), "The target profile "+u.getValue()+" is not a valid constraint on the base ("+td.getTargetProfile()+") at "+derived.getPath(), IssueSeverity.ERROR));
- }
- }
- }
- }
- }
- if (!ok)
- throw new DefinitionException("StructureDefinition "+purl+" at "+derived.getPath()+": illegal constrained type "+t+" from "+b.toString()+" in "+srcSD.getUrl());
+ checkTypeDerivation(purl, srcSD, base, derived, ts);
}
}
base.getType().clear();
@@ -2576,6 +2545,66 @@ public class ProfileUtilities extends TranslatingUtilities {
}
}
+ public void checkTypeDerivation(String purl, StructureDefinition srcSD, ElementDefinition base, ElementDefinition derived, TypeRefComponent ts) {
+ boolean ok = false;
+ CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
+ String t = ts.getWorkingCode();
+ for (TypeRefComponent td : base.getType()) {;
+ String tt = td.getWorkingCode();
+ b.append(tt);
+ if (td.hasCode() && (tt.equals(t))) {
+ ok = true;
+ }
+ if (!ok) {
+ StructureDefinition sdt = context.fetchTypeDefinition(tt);
+ if (sdt != null && sdt.getAbstract()) {
+ StructureDefinition sdb = context.fetchTypeDefinition(t);
+ while (sdb != null && !ok) {
+ ok = sdb.getType().equals(sdt.getType());
+ sdb = context.fetchResource(StructureDefinition.class, sdb.getBaseDefinition());
+ }
+ }
+ }
+ // work around for old badly generated SDs
+ if (DONT_DO_THIS && Utilities.existsInList(tt, "Extension", "uri", "string", "Element")) {
+ ok = true;
+ }
+ if (DONT_DO_THIS && Utilities.existsInList(tt, "Resource","DomainResource") && pkp.isResource(t)) {
+ ok = true;
+ }
+ if (ok && ts.hasTargetProfile()) {
+ // check that any derived target has a reference chain back to one of the base target profiles
+ for (UriType u : ts.getTargetProfile()) {
+ String url = u.getValue();
+ boolean tgtOk = !td.hasTargetProfile() || td.hasTargetProfile(url);
+ while (url != null && !tgtOk) {
+ StructureDefinition sd = context.fetchRawProfile(url);
+ if (sd == null) {
+ if (messages != null) {
+ messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.BUSINESSRULE, purl+"#"+derived.getPath(), "Connect check whether the target profile "+url+" is valid constraint on the base because it is not known", IssueSeverity.WARNING));
+ }
+ url = null;
+ tgtOk = true; // suppress error message
+ } else {
+ url = sd.getBaseDefinition();
+ tgtOk = td.hasTargetProfile(url);
+ }
+ }
+ if (!tgtOk) {
+ if (messages == null) {
+ throw new FHIRException("Error at "+purl+"#"+derived.getPath()+": The target profile "+url+" is not valid constraint on the base ("+td.getTargetProfile()+")");
+ } else {
+ messages.add(new ValidationMessage(Source.InstanceValidator, IssueType.BUSINESSRULE, derived.getPath(), "The target profile "+u.getValue()+" is not a valid constraint on the base ("+td.getTargetProfile()+") at "+derived.getPath(), IssueSeverity.ERROR));
+ }
+ }
+ }
+ }
+ }
+ if (!ok) {
+ throw new DefinitionException("StructureDefinition "+purl+" at "+derived.getPath()+": illegal constrained type "+t+" from "+b.toString()+" in "+srcSD.getUrl());
+ }
+ }
+
public void checkTypeOk(ElementDefinition dest, String ft) {
boolean ok = false;
@@ -4354,13 +4383,13 @@ public class ProfileUtilities extends TranslatingUtilities {
@Override
public int compare(ElementDefinitionHolder o1, ElementDefinitionHolder o2) {
if (o1.getBaseIndex() == 0)
- o1.setBaseIndex(find(o1.getSelf().getPath()));
+ o1.setBaseIndex(find(o1.getSelf().getPath(), true));
if (o2.getBaseIndex() == 0)
- o2.setBaseIndex(find(o2.getSelf().getPath()));
+ o2.setBaseIndex(find(o2.getSelf().getPath(), true));
return o1.getBaseIndex() - o2.getBaseIndex();
}
- private int find(String path) {
+ private int find(String path, boolean mandatory) {
String op = path;
int lc = 0;
String actual = base+path.substring(prefixLength);
@@ -4392,10 +4421,12 @@ public class ProfileUtilities extends TranslatingUtilities {
throw new Error("Internal recursion detection: find() loop path recursion > "+MAX_RECURSION_LIMIT+" - check paths are valid (for path "+path+"/"+op+")");
}
}
- if (prefixLength == 0)
- errors.add("Differential contains path "+path+" which is not found in the base");
- else
- errors.add("Differential contains path "+path+" which is actually "+actual+", which is not found in the base");
+ if (mandatory) {
+ if (prefixLength == 0)
+ errors.add("Differential contains path "+path+" which is not found in the base");
+ else
+ errors.add("Differential contains path "+path+" which is actually "+actual+", which is not found in the base");
+ }
return 0;
}
@@ -4508,7 +4539,7 @@ public class ProfileUtilities extends TranslatingUtilities {
private void sortElements(ElementDefinitionHolder edh, ElementDefinitionComparer cmp, List errors) throws FHIRException {
if (edh.getChildren().size() == 1)
// special case - sort needsto allocate base numbers, but there'll be no sort if there's only 1 child. So in that case, we just go ahead and allocated base number directly
- edh.getChildren().get(0).baseIndex = cmp.find(edh.getChildren().get(0).getSelf().getPath());
+ edh.getChildren().get(0).baseIndex = cmp.find(edh.getChildren().get(0).getSelf().getPath(), false);
else
Collections.sort(edh.getChildren(), cmp);
cmp.checkForErrors(errors);
@@ -4516,8 +4547,9 @@ public class ProfileUtilities extends TranslatingUtilities {
for (ElementDefinitionHolder child : edh.getChildren()) {
if (child.getChildren().size() > 0) {
ElementDefinitionComparer ccmp = getComparer(cmp, child);
- if (ccmp != null)
- sortElements(child, ccmp, errors);
+ if (ccmp != null) {
+ sortElements(child, ccmp, errors);
+ }
}
}
}
@@ -4528,7 +4560,22 @@ public class ProfileUtilities extends TranslatingUtilities {
ElementDefinition ed = cmp.snapshot.get(child.getBaseIndex());
ElementDefinitionComparer ccmp;
if (ed.getType().isEmpty() || isAbstract(ed.getType().get(0).getWorkingCode()) || ed.getType().get(0).getWorkingCode().equals(ed.getPath())) {
- ccmp = new ElementDefinitionComparer(true, cmp.snapshot, cmp.base, cmp.prefixLength, cmp.name);
+ if (ed.hasType() && "Resource".equals(ed.getType().get(0).getWorkingCode()) && child.getSelf().getType().get(0).hasProfile()) {
+ if (child.getSelf().getType().get(0).getProfile().size() > 1) {
+ throw new FHIRException("Unhandled situation: resource is profiled to more than one option - cannot sort profile");
+ }
+ StructureDefinition profile = context.fetchResource(StructureDefinition.class, child.getSelf().getType().get(0).getProfile().get(0).getValue());
+ while (profile != null && profile.getDerivation() == TypeDerivationRule.CONSTRAINT) {
+ profile = context.fetchResource(StructureDefinition.class, profile.getBaseDefinition());
+ }
+ if (profile==null) {
+ ccmp = null; // this might happen before everything is loaded. And we don't so much care about sot order in this case
+ } else {
+ ccmp = new ElementDefinitionComparer(true, profile.getSnapshot().getElement(), profile.getType(), child.getSelf().getPath().length(), cmp.name);
+ }
+ } else {
+ ccmp = new ElementDefinitionComparer(true, cmp.snapshot, cmp.base, cmp.prefixLength, cmp.name);
+ }
} else if (ed.getType().get(0).getWorkingCode().equals("Extension") && child.getSelf().getType().size() == 1 && child.getSelf().getType().get(0).hasProfile()) {
StructureDefinition profile = context.fetchResource(StructureDefinition.class, child.getSelf().getType().get(0).getProfile().get(0).getValue());
if (profile==null)
@@ -5264,14 +5311,18 @@ public class ProfileUtilities extends TranslatingUtilities {
private String getCardinality(ElementDefinition ed, List list) {
int min = ed.getMin();
int max = !ed.hasMax() || ed.getMax().equals("*") ? Integer.MAX_VALUE : Integer.parseInt(ed.getMax());
- while (ed != null && ed.getPath().contains(".")) {
- ed = findParent(ed, list);
- if (ed.getMax().equals("0"))
- max = 0;
- else if (!ed.getMax().equals("1") && !ed.hasSlicing())
- max = Integer.MAX_VALUE;
- if (ed.getMin() == 0)
- min = 0;
+ ElementDefinition ned = ed;
+ while (ned != null && ned.getPath().contains(".")) {
+ ned = findParent(ned, list);
+ if (ned != null) { // todo: this can happen if we've walked into a resoruce. Not sure what to about that?
+ if ("0".equals(ned.getMax()))
+ max = 0;
+ else if (!ned.getMax().equals("1") && !ned.hasSlicing())
+ max = Integer.MAX_VALUE;
+ if (ned.getMin() == 0) {
+ min = 0;
+ }
+ }
}
return Integer.toString(min)+".."+(max == Integer.MAX_VALUE ? "*" : Integer.toString(max));
}
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java
index 19d69ca45..11c4a94cf 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/IWorkerContext.java
@@ -539,7 +539,8 @@ public interface IWorkerContext {
public void setOverrideVersionNs(String value);
public StructureDefinition fetchTypeDefinition(String typeName);
-
+ public StructureDefinition fetchRawProfile(String url);
+
public void setUcumService(UcumService ucumService);
public String getLinkForUrl(String corePath, String s);
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java
index a5838a0e4..455dc659f 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/context/SimpleWorkerContext.java
@@ -640,6 +640,12 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
return r;
}
+ @Override
+ public StructureDefinition fetchRawProfile(String uri) {
+ StructureDefinition r = super.fetchResource(StructureDefinition.class, uri);
+ return r;
+ }
+
@Override
public void generateSnapshot(StructureDefinition p) throws DefinitionException, FHIRException {
generateSnapshot(p, false);
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Meta.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Meta.java
index d6030976d..49fe64350 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Meta.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/model/Meta.java
@@ -1,685 +1,685 @@
-package org.hl7.fhir.r5.model;
-
-
-/*
- * #%L
- * org.hl7.fhir.r5
- * %%
- * Copyright (C) 2014 - 2019 Health Level 7
- * %%
- * 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%
- */
-
-/*
- Copyright (c) 2011+, HL7, Inc.
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modification, \
- are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright notice, this \
- list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright notice, \
- this list of conditions and the following disclaimer in the documentation \
- and/or other materials provided with the distribution.
- * Neither the name of HL7 nor the names of its contributors may be used to
- endorse or promote products derived from this software without specific
- prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
- IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import org.hl7.fhir.utilities.Utilities;
-import org.hl7.fhir.r5.model.Enumerations.*;
-import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
-import org.hl7.fhir.exceptions.FHIRException;
-import org.hl7.fhir.instance.model.api.ICompositeType;
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.ChildOrder;
-import ca.uhn.fhir.model.api.annotation.DatatypeDef;
-import ca.uhn.fhir.model.api.annotation.Description;
-import ca.uhn.fhir.model.api.annotation.Block;
-
-import org.hl7.fhir.instance.model.api.IBaseMetaType;
-/**
- * Base StructureDefinition for Meta Type: The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
- */
-@DatatypeDef(name="Meta")
-public class Meta extends DataType implements IBaseMetaType {
-
- /**
- * The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
- */
- @Child(name = "versionId", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Version specific identifier", formalDefinition="The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted." )
- protected IdType versionId;
-
- /**
- * When the resource last changed - e.g. when the version changed.
- */
- @Child(name = "lastUpdated", type = {InstantType.class}, order=1, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="When the resource version last changed", formalDefinition="When the resource last changed - e.g. when the version changed." )
- protected InstantType lastUpdated;
-
- /**
- * A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
- */
- @Child(name = "source", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Identifies where the resource comes from", formalDefinition="A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc." )
- protected UriType source;
-
- /**
- * A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).
- */
- @Child(name = "profile", type = {CanonicalType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Profiles this resource claims to conform to", formalDefinition="A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url)." )
- protected List profile;
-
- /**
- * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.
- */
- @Child(name = "security", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Security Labels applied to this resource", formalDefinition="Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure." )
- @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
- protected List security;
-
- /**
- * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.
- */
- @Child(name = "tag", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Tags applied to this resource", formalDefinition="Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource." )
- @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/common-tags")
- protected List tag;
-
- private static final long serialVersionUID = -1386695622L;
-
- /**
- * Constructor
- */
- public Meta() {
- super();
- }
-
- /**
- * @return {@link #versionId} (The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.). This is the underlying object with id, value and extensions. The accessor "getVersionId" gives direct access to the value
- */
- public IdType getVersionIdElement() {
- if (this.versionId == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Meta.versionId");
- else if (Configuration.doAutoCreate())
- this.versionId = new IdType(); // bb
- return this.versionId;
- }
-
- public boolean hasVersionIdElement() {
- return this.versionId != null && !this.versionId.isEmpty();
- }
-
- public boolean hasVersionId() {
- return this.versionId != null && !this.versionId.isEmpty();
- }
-
- /**
- * @param value {@link #versionId} (The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.). This is the underlying object with id, value and extensions. The accessor "getVersionId" gives direct access to the value
- */
- public Meta setVersionIdElement(IdType value) {
- this.versionId = value;
- return this;
- }
-
- /**
- * @return The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
- */
- public String getVersionId() {
- return this.versionId == null ? null : this.versionId.getValue();
- }
-
- /**
- * @param value The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
- */
- public Meta setVersionId(String value) {
- if (Utilities.noString(value))
- this.versionId = null;
- else {
- if (this.versionId == null)
- this.versionId = new IdType();
- this.versionId.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #lastUpdated} (When the resource last changed - e.g. when the version changed.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
- */
- public InstantType getLastUpdatedElement() {
- if (this.lastUpdated == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Meta.lastUpdated");
- else if (Configuration.doAutoCreate())
- this.lastUpdated = new InstantType(); // bb
- return this.lastUpdated;
- }
-
- public boolean hasLastUpdatedElement() {
- return this.lastUpdated != null && !this.lastUpdated.isEmpty();
- }
-
- public boolean hasLastUpdated() {
- return this.lastUpdated != null && !this.lastUpdated.isEmpty();
- }
-
- /**
- * @param value {@link #lastUpdated} (When the resource last changed - e.g. when the version changed.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
- */
- public Meta setLastUpdatedElement(InstantType value) {
- this.lastUpdated = value;
- return this;
- }
-
- /**
- * @return When the resource last changed - e.g. when the version changed.
- */
- public Date getLastUpdated() {
- return this.lastUpdated == null ? null : this.lastUpdated.getValue();
- }
-
- /**
- * @param value When the resource last changed - e.g. when the version changed.
- */
- public Meta setLastUpdated(Date value) {
- if (value == null)
- this.lastUpdated = null;
- else {
- if (this.lastUpdated == null)
- this.lastUpdated = new InstantType();
- this.lastUpdated.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #source} (A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
- */
- public UriType getSourceElement() {
- if (this.source == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Meta.source");
- else if (Configuration.doAutoCreate())
- this.source = new UriType(); // bb
- return this.source;
- }
-
- public boolean hasSourceElement() {
- return this.source != null && !this.source.isEmpty();
- }
-
- public boolean hasSource() {
- return this.source != null && !this.source.isEmpty();
- }
-
- /**
- * @param value {@link #source} (A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
- */
- public Meta setSourceElement(UriType value) {
- this.source = value;
- return this;
- }
-
- /**
- * @return A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
- */
- public String getSource() {
- return this.source == null ? null : this.source.getValue();
- }
-
- /**
- * @param value A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
- */
- public Meta setSource(String value) {
- if (Utilities.noString(value))
- this.source = null;
- else {
- if (this.source == null)
- this.source = new UriType();
- this.source.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
- */
- public List getProfile() {
- if (this.profile == null)
- this.profile = new ArrayList();
- return this.profile;
- }
-
- /**
- * @return Returns a reference to this for easy method chaining
- */
- public Meta setProfile(List theProfile) {
- this.profile = theProfile;
- return this;
- }
-
- public boolean hasProfile() {
- if (this.profile == null)
- return false;
- for (CanonicalType item : this.profile)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
- */
- public CanonicalType addProfileElement() {//2
- CanonicalType t = new CanonicalType();
- if (this.profile == null)
- this.profile = new ArrayList();
- this.profile.add(t);
- return t;
- }
-
- /**
- * @param value {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
- */
- public Meta addProfile(String value) { //1
- CanonicalType t = new CanonicalType();
- t.setValue(value);
- if (this.profile == null)
- this.profile = new ArrayList();
- this.profile.add(t);
- return this;
- }
-
- /**
- * @param value {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
- */
- public boolean hasProfile(String value) {
- if (this.profile == null)
- return false;
- for (CanonicalType v : this.profile)
- if (v.getValue().equals(value)) // canonical
- return true;
- return false;
- }
-
- /**
- * @return {@link #security} (Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.)
- */
- public List getSecurity() {
- if (this.security == null)
- this.security = new ArrayList();
- return this.security;
- }
-
- /**
- * @return Returns a reference to this for easy method chaining
- */
- public Meta setSecurity(List theSecurity) {
- this.security = theSecurity;
- return this;
- }
-
- public boolean hasSecurity() {
- if (this.security == null)
- return false;
- for (Coding item : this.security)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- public Coding addSecurity() { //3
- Coding t = new Coding();
- if (this.security == null)
- this.security = new ArrayList();
- this.security.add(t);
- return t;
- }
-
- public Meta addSecurity(Coding t) { //3
- if (t == null)
- return this;
- if (this.security == null)
- this.security = new ArrayList();
- this.security.add(t);
- return this;
- }
-
- /**
- * @return The first repetition of repeating field {@link #security}, creating it if it does not already exist {3}
- */
- public Coding getSecurityFirstRep() {
- if (getSecurity().isEmpty()) {
- addSecurity();
- }
- return getSecurity().get(0);
- }
-
- /**
- * @return {@link #tag} (Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.)
- */
- public List getTag() {
- if (this.tag == null)
- this.tag = new ArrayList();
- return this.tag;
- }
-
- /**
- * @return Returns a reference to this for easy method chaining
- */
- public Meta setTag(List theTag) {
- this.tag = theTag;
- return this;
- }
-
- public boolean hasTag() {
- if (this.tag == null)
- return false;
- for (Coding item : this.tag)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- public Coding addTag() { //3
- Coding t = new Coding();
- if (this.tag == null)
- this.tag = new ArrayList();
- this.tag.add(t);
- return t;
- }
-
- public Meta addTag(Coding t) { //3
- if (t == null)
- return this;
- if (this.tag == null)
- this.tag = new ArrayList();
- this.tag.add(t);
- return this;
- }
-
- /**
- * @return The first repetition of repeating field {@link #tag}, creating it if it does not already exist {3}
- */
- public Coding getTagFirstRep() {
- if (getTag().isEmpty()) {
- addTag();
- }
- return getTag().get(0);
- }
-
- protected void listChildren(List children) {
- super.listChildren(children);
- children.add(new Property("versionId", "id", "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", 0, 1, versionId));
- children.add(new Property("lastUpdated", "instant", "When the resource last changed - e.g. when the version changed.", 0, 1, lastUpdated));
- children.add(new Property("source", "uri", "A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", 0, 1, source));
- children.add(new Property("profile", "canonical(StructureDefinition)", "A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).", 0, java.lang.Integer.MAX_VALUE, profile));
- children.add(new Property("security", "Coding", "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", 0, java.lang.Integer.MAX_VALUE, security));
- children.add(new Property("tag", "Coding", "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", 0, java.lang.Integer.MAX_VALUE, tag));
- }
-
- @Override
- public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
- switch (_hash) {
- case -1407102957: /*versionId*/ return new Property("versionId", "id", "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", 0, 1, versionId);
- case 1649733957: /*lastUpdated*/ return new Property("lastUpdated", "instant", "When the resource last changed - e.g. when the version changed.", 0, 1, lastUpdated);
- case -896505829: /*source*/ return new Property("source", "uri", "A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", 0, 1, source);
- case -309425751: /*profile*/ return new Property("profile", "canonical(StructureDefinition)", "A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).", 0, java.lang.Integer.MAX_VALUE, profile);
- case 949122880: /*security*/ return new Property("security", "Coding", "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", 0, java.lang.Integer.MAX_VALUE, security);
- case 114586: /*tag*/ return new Property("tag", "Coding", "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", 0, java.lang.Integer.MAX_VALUE, tag);
- default: return super.getNamedProperty(_hash, _name, _checkValid);
- }
-
- }
-
- @Override
- public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
- switch (hash) {
- case -1407102957: /*versionId*/ return this.versionId == null ? new Base[0] : new Base[] {this.versionId}; // IdType
- case 1649733957: /*lastUpdated*/ return this.lastUpdated == null ? new Base[0] : new Base[] {this.lastUpdated}; // InstantType
- case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // UriType
- case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
- case 949122880: /*security*/ return this.security == null ? new Base[0] : this.security.toArray(new Base[this.security.size()]); // Coding
- case 114586: /*tag*/ return this.tag == null ? new Base[0] : this.tag.toArray(new Base[this.tag.size()]); // Coding
- default: return super.getProperty(hash, name, checkValid);
- }
-
- }
-
- @Override
- public Base setProperty(int hash, String name, Base value) throws FHIRException {
- switch (hash) {
- case -1407102957: // versionId
- this.versionId = TypeConvertor.castToId(value); // IdType
- return value;
- case 1649733957: // lastUpdated
- this.lastUpdated = TypeConvertor.castToInstant(value); // InstantType
- return value;
- case -896505829: // source
- this.source = TypeConvertor.castToUri(value); // UriType
- return value;
- case -309425751: // profile
- this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
- return value;
- case 949122880: // security
- this.getSecurity().add(TypeConvertor.castToCoding(value)); // Coding
- return value;
- case 114586: // tag
- this.getTag().add(TypeConvertor.castToCoding(value)); // Coding
- return value;
- default: return super.setProperty(hash, name, value);
- }
-
- }
-
- @Override
- public Base setProperty(String name, Base value) throws FHIRException {
- if (name.equals("versionId")) {
- this.versionId = TypeConvertor.castToId(value); // IdType
- } else if (name.equals("lastUpdated")) {
- this.lastUpdated = TypeConvertor.castToInstant(value); // InstantType
- } else if (name.equals("source")) {
- this.source = TypeConvertor.castToUri(value); // UriType
- } else if (name.equals("profile")) {
- this.getProfile().add(TypeConvertor.castToCanonical(value));
- } else if (name.equals("security")) {
- this.getSecurity().add(TypeConvertor.castToCoding(value));
- } else if (name.equals("tag")) {
- this.getTag().add(TypeConvertor.castToCoding(value));
- } else
- return super.setProperty(name, value);
- return value;
- }
-
- @Override
- public Base makeProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case -1407102957: return getVersionIdElement();
- case 1649733957: return getLastUpdatedElement();
- case -896505829: return getSourceElement();
- case -309425751: return addProfileElement();
- case 949122880: return addSecurity();
- case 114586: return addTag();
- default: return super.makeProperty(hash, name);
- }
-
- }
-
- @Override
- public String[] getTypesForProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case -1407102957: /*versionId*/ return new String[] {"id"};
- case 1649733957: /*lastUpdated*/ return new String[] {"instant"};
- case -896505829: /*source*/ return new String[] {"uri"};
- case -309425751: /*profile*/ return new String[] {"canonical"};
- case 949122880: /*security*/ return new String[] {"Coding"};
- case 114586: /*tag*/ return new String[] {"Coding"};
- default: return super.getTypesForProperty(hash, name);
- }
-
- }
-
- @Override
- public Base addChild(String name) throws FHIRException {
- if (name.equals("versionId")) {
- throw new FHIRException("Cannot call addChild on a primitive type Meta.versionId");
- }
- else if (name.equals("lastUpdated")) {
- throw new FHIRException("Cannot call addChild on a primitive type Meta.lastUpdated");
- }
- else if (name.equals("source")) {
- throw new FHIRException("Cannot call addChild on a primitive type Meta.source");
- }
- else if (name.equals("profile")) {
- throw new FHIRException("Cannot call addChild on a primitive type Meta.profile");
- }
- else if (name.equals("security")) {
- return addSecurity();
- }
- else if (name.equals("tag")) {
- return addTag();
- }
- else
- return super.addChild(name);
- }
-
- public String fhirType() {
- return "Meta";
-
- }
-
- public Meta copy() {
- Meta dst = new Meta();
- copyValues(dst);
- return dst;
- }
-
- public void copyValues(Meta dst) {
- super.copyValues(dst);
- dst.versionId = versionId == null ? null : versionId.copy();
- dst.lastUpdated = lastUpdated == null ? null : lastUpdated.copy();
- dst.source = source == null ? null : source.copy();
- if (profile != null) {
- dst.profile = new ArrayList();
- for (CanonicalType i : profile)
- dst.profile.add(i.copy());
- };
- if (security != null) {
- dst.security = new ArrayList();
- for (Coding i : security)
- dst.security.add(i.copy());
- };
- if (tag != null) {
- dst.tag = new ArrayList();
- for (Coding i : tag)
- dst.tag.add(i.copy());
- };
- }
-
- protected Meta typedCopy() {
- return copy();
- }
-
- @Override
- public boolean equalsDeep(Base other_) {
- if (!super.equalsDeep(other_))
- return false;
- if (!(other_ instanceof Meta))
- return false;
- Meta o = (Meta) other_;
- return compareDeep(versionId, o.versionId, true) && compareDeep(lastUpdated, o.lastUpdated, true)
- && compareDeep(source, o.source, true) && compareDeep(profile, o.profile, true) && compareDeep(security, o.security, true)
- && compareDeep(tag, o.tag, true);
- }
-
- @Override
- public boolean equalsShallow(Base other_) {
- if (!super.equalsShallow(other_))
- return false;
- if (!(other_ instanceof Meta))
- return false;
- Meta o = (Meta) other_;
- return compareValues(versionId, o.versionId, true) && compareValues(lastUpdated, o.lastUpdated, true)
- && compareValues(source, o.source, true) && compareValues(profile, o.profile, true);
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(versionId, lastUpdated, source
- , profile, security, tag);
- }
-
-// Manual code (from Configuration.txt)t:
- /**
- * Convenience method which adds a tag
- *
- * @param theSystem The code system
- * @param theCode The code
- * @param theDisplay The display name
- * @return Returns a reference to this for easy chaining
- */
- public Meta addTag(String theSystem, String theCode, String theDisplay) {
- addTag().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay);
- return this;
- }
-
- /**
- * Returns the first tag (if any) that has the given system and code, or returns
- * null if none
- */
- public Coding getTag(String theSystem, String theCode) {
- for (Coding next : getTag()) {
- if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
- return next;
- }
- }
- return null;
- }
-
- /**
- * Returns the first security label (if any) that has the given system and code, or returns
- * null if none
- */
- public Coding getSecurity(String theSystem, String theCode) {
- for (Coding next : getTag()) {
- if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
- return next;
- }
- }
- return null;
- }
-
-// end addition
-
-}
-
+package org.hl7.fhir.r5.model;
+
+
+/*
+ * #%L
+ * org.hl7.fhir.r5
+ * %%
+ * Copyright (C) 2014 - 2019 Health Level 7
+ * %%
+ * 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%
+ */
+
+/*
+ Copyright (c) 2011+, HL7, Inc.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification, \
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this \
+ list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice, \
+ this list of conditions and the following disclaimer in the documentation \
+ and/or other materials provided with the distribution.
+ * Neither the name of HL7 nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
+ NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Generated on Tue, Dec 31, 2019 12:12+1100 for FHIR vcurrent
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import org.hl7.fhir.utilities.Utilities;
+import org.hl7.fhir.r5.model.Enumerations.*;
+import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
+import org.hl7.fhir.exceptions.FHIRException;
+import org.hl7.fhir.instance.model.api.ICompositeType;
+import ca.uhn.fhir.model.api.annotation.Child;
+import ca.uhn.fhir.model.api.annotation.ChildOrder;
+import ca.uhn.fhir.model.api.annotation.DatatypeDef;
+import ca.uhn.fhir.model.api.annotation.Description;
+import ca.uhn.fhir.model.api.annotation.Block;
+
+import org.hl7.fhir.instance.model.api.IBaseMetaType;
+/**
+ * Base StructureDefinition for Meta Type: The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
+ */
+@DatatypeDef(name="Meta")
+public class Meta extends DataType implements IBaseMetaType {
+
+ /**
+ * The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
+ */
+ @Child(name = "versionId", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=true)
+ @Description(shortDefinition="Version specific identifier", formalDefinition="The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted." )
+ protected IdType versionId;
+
+ /**
+ * When the resource last changed - e.g. when the version changed.
+ */
+ @Child(name = "lastUpdated", type = {InstantType.class}, order=1, min=0, max=1, modifier=false, summary=true)
+ @Description(shortDefinition="When the resource version last changed", formalDefinition="When the resource last changed - e.g. when the version changed." )
+ protected InstantType lastUpdated;
+
+ /**
+ * A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
+ */
+ @Child(name = "source", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
+ @Description(shortDefinition="Identifies where the resource comes from", formalDefinition="A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc." )
+ protected UriType source;
+
+ /**
+ * A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).
+ */
+ @Child(name = "profile", type = {CanonicalType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
+ @Description(shortDefinition="Profiles this resource claims to conform to", formalDefinition="A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url)." )
+ protected List profile;
+
+ /**
+ * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.
+ */
+ @Child(name = "security", type = {Coding.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
+ @Description(shortDefinition="Security Labels applied to this resource", formalDefinition="Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure." )
+ @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/security-labels")
+ protected List security;
+
+ /**
+ * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.
+ */
+ @Child(name = "tag", type = {Coding.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
+ @Description(shortDefinition="Tags applied to this resource", formalDefinition="Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource." )
+ @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/common-tags")
+ protected List tag;
+
+ private static final long serialVersionUID = -1386695622L;
+
+ /**
+ * Constructor
+ */
+ public Meta() {
+ super();
+ }
+
+ /**
+ * @return {@link #versionId} (The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.). This is the underlying object with id, value and extensions. The accessor "getVersionId" gives direct access to the value
+ */
+ public IdType getVersionIdElement() {
+ if (this.versionId == null)
+ if (Configuration.errorOnAutoCreate())
+ throw new Error("Attempt to auto-create Meta.versionId");
+ else if (Configuration.doAutoCreate())
+ this.versionId = new IdType(); // bb
+ return this.versionId;
+ }
+
+ public boolean hasVersionIdElement() {
+ return this.versionId != null && !this.versionId.isEmpty();
+ }
+
+ public boolean hasVersionId() {
+ return this.versionId != null && !this.versionId.isEmpty();
+ }
+
+ /**
+ * @param value {@link #versionId} (The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.). This is the underlying object with id, value and extensions. The accessor "getVersionId" gives direct access to the value
+ */
+ public Meta setVersionIdElement(IdType value) {
+ this.versionId = value;
+ return this;
+ }
+
+ /**
+ * @return The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
+ */
+ public String getVersionId() {
+ return this.versionId == null ? null : this.versionId.getValue();
+ }
+
+ /**
+ * @param value The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
+ */
+ public Meta setVersionId(String value) {
+ if (Utilities.noString(value))
+ this.versionId = null;
+ else {
+ if (this.versionId == null)
+ this.versionId = new IdType();
+ this.versionId.setValue(value);
+ }
+ return this;
+ }
+
+ /**
+ * @return {@link #lastUpdated} (When the resource last changed - e.g. when the version changed.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
+ */
+ public InstantType getLastUpdatedElement() {
+ if (this.lastUpdated == null)
+ if (Configuration.errorOnAutoCreate())
+ throw new Error("Attempt to auto-create Meta.lastUpdated");
+ else if (Configuration.doAutoCreate())
+ this.lastUpdated = new InstantType(); // bb
+ return this.lastUpdated;
+ }
+
+ public boolean hasLastUpdatedElement() {
+ return this.lastUpdated != null && !this.lastUpdated.isEmpty();
+ }
+
+ public boolean hasLastUpdated() {
+ return this.lastUpdated != null && !this.lastUpdated.isEmpty();
+ }
+
+ /**
+ * @param value {@link #lastUpdated} (When the resource last changed - e.g. when the version changed.). This is the underlying object with id, value and extensions. The accessor "getLastUpdated" gives direct access to the value
+ */
+ public Meta setLastUpdatedElement(InstantType value) {
+ this.lastUpdated = value;
+ return this;
+ }
+
+ /**
+ * @return When the resource last changed - e.g. when the version changed.
+ */
+ public Date getLastUpdated() {
+ return this.lastUpdated == null ? null : this.lastUpdated.getValue();
+ }
+
+ /**
+ * @param value When the resource last changed - e.g. when the version changed.
+ */
+ public Meta setLastUpdated(Date value) {
+ if (value == null)
+ this.lastUpdated = null;
+ else {
+ if (this.lastUpdated == null)
+ this.lastUpdated = new InstantType();
+ this.lastUpdated.setValue(value);
+ }
+ return this;
+ }
+
+ /**
+ * @return {@link #source} (A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
+ */
+ public UriType getSourceElement() {
+ if (this.source == null)
+ if (Configuration.errorOnAutoCreate())
+ throw new Error("Attempt to auto-create Meta.source");
+ else if (Configuration.doAutoCreate())
+ this.source = new UriType(); // bb
+ return this.source;
+ }
+
+ public boolean hasSourceElement() {
+ return this.source != null && !this.source.isEmpty();
+ }
+
+ public boolean hasSource() {
+ return this.source != null && !this.source.isEmpty();
+ }
+
+ /**
+ * @param value {@link #source} (A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.). This is the underlying object with id, value and extensions. The accessor "getSource" gives direct access to the value
+ */
+ public Meta setSourceElement(UriType value) {
+ this.source = value;
+ return this;
+ }
+
+ /**
+ * @return A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
+ */
+ public String getSource() {
+ return this.source == null ? null : this.source.getValue();
+ }
+
+ /**
+ * @param value A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
+ */
+ public Meta setSource(String value) {
+ if (Utilities.noString(value))
+ this.source = null;
+ else {
+ if (this.source == null)
+ this.source = new UriType();
+ this.source.setValue(value);
+ }
+ return this;
+ }
+
+ /**
+ * @return {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
+ */
+ public List getProfile() {
+ if (this.profile == null)
+ this.profile = new ArrayList();
+ return this.profile;
+ }
+
+ /**
+ * @return Returns a reference to this for easy method chaining
+ */
+ public Meta setProfile(List theProfile) {
+ this.profile = theProfile;
+ return this;
+ }
+
+ public boolean hasProfile() {
+ if (this.profile == null)
+ return false;
+ for (CanonicalType item : this.profile)
+ if (!item.isEmpty())
+ return true;
+ return false;
+ }
+
+ /**
+ * @return {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
+ */
+ public CanonicalType addProfileElement() {//2
+ CanonicalType t = new CanonicalType();
+ if (this.profile == null)
+ this.profile = new ArrayList();
+ this.profile.add(t);
+ return t;
+ }
+
+ /**
+ * @param value {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
+ */
+ public Meta addProfile(String value) { //1
+ CanonicalType t = new CanonicalType();
+ t.setValue(value);
+ if (this.profile == null)
+ this.profile = new ArrayList();
+ this.profile.add(t);
+ return this;
+ }
+
+ /**
+ * @param value {@link #profile} (A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).)
+ */
+ public boolean hasProfile(String value) {
+ if (this.profile == null)
+ return false;
+ for (CanonicalType v : this.profile)
+ if (v.getValue().equals(value)) // canonical
+ return true;
+ return false;
+ }
+
+ /**
+ * @return {@link #security} (Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.)
+ */
+ public List getSecurity() {
+ if (this.security == null)
+ this.security = new ArrayList();
+ return this.security;
+ }
+
+ /**
+ * @return Returns a reference to this for easy method chaining
+ */
+ public Meta setSecurity(List theSecurity) {
+ this.security = theSecurity;
+ return this;
+ }
+
+ public boolean hasSecurity() {
+ if (this.security == null)
+ return false;
+ for (Coding item : this.security)
+ if (!item.isEmpty())
+ return true;
+ return false;
+ }
+
+ public Coding addSecurity() { //3
+ Coding t = new Coding();
+ if (this.security == null)
+ this.security = new ArrayList();
+ this.security.add(t);
+ return t;
+ }
+
+ public Meta addSecurity(Coding t) { //3
+ if (t == null)
+ return this;
+ if (this.security == null)
+ this.security = new ArrayList();
+ this.security.add(t);
+ return this;
+ }
+
+ /**
+ * @return The first repetition of repeating field {@link #security}, creating it if it does not already exist {3}
+ */
+ public Coding getSecurityFirstRep() {
+ if (getSecurity().isEmpty()) {
+ addSecurity();
+ }
+ return getSecurity().get(0);
+ }
+
+ /**
+ * @return {@link #tag} (Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.)
+ */
+ public List getTag() {
+ if (this.tag == null)
+ this.tag = new ArrayList();
+ return this.tag;
+ }
+
+ /**
+ * @return Returns a reference to this for easy method chaining
+ */
+ public Meta setTag(List theTag) {
+ this.tag = theTag;
+ return this;
+ }
+
+ public boolean hasTag() {
+ if (this.tag == null)
+ return false;
+ for (Coding item : this.tag)
+ if (!item.isEmpty())
+ return true;
+ return false;
+ }
+
+ public Coding addTag() { //3
+ Coding t = new Coding();
+ if (this.tag == null)
+ this.tag = new ArrayList();
+ this.tag.add(t);
+ return t;
+ }
+
+ public Meta addTag(Coding t) { //3
+ if (t == null)
+ return this;
+ if (this.tag == null)
+ this.tag = new ArrayList();
+ this.tag.add(t);
+ return this;
+ }
+
+ /**
+ * @return The first repetition of repeating field {@link #tag}, creating it if it does not already exist {3}
+ */
+ public Coding getTagFirstRep() {
+ if (getTag().isEmpty()) {
+ addTag();
+ }
+ return getTag().get(0);
+ }
+
+ protected void listChildren(List children) {
+ super.listChildren(children);
+ children.add(new Property("versionId", "id", "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", 0, 1, versionId));
+ children.add(new Property("lastUpdated", "instant", "When the resource last changed - e.g. when the version changed.", 0, 1, lastUpdated));
+ children.add(new Property("source", "uri", "A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", 0, 1, source));
+ children.add(new Property("profile", "canonical(StructureDefinition)", "A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).", 0, java.lang.Integer.MAX_VALUE, profile));
+ children.add(new Property("security", "Coding", "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", 0, java.lang.Integer.MAX_VALUE, security));
+ children.add(new Property("tag", "Coding", "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", 0, java.lang.Integer.MAX_VALUE, tag));
+ }
+
+ @Override
+ public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
+ switch (_hash) {
+ case -1407102957: /*versionId*/ return new Property("versionId", "id", "The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.", 0, 1, versionId);
+ case 1649733957: /*lastUpdated*/ return new Property("lastUpdated", "instant", "When the resource last changed - e.g. when the version changed.", 0, 1, lastUpdated);
+ case -896505829: /*source*/ return new Property("source", "uri", "A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.", 0, 1, source);
+ case -309425751: /*profile*/ return new Property("profile", "canonical(StructureDefinition)", "A list of profiles (references to [StructureDefinition](structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](structuredefinition-definitions.html#StructureDefinition.url).", 0, java.lang.Integer.MAX_VALUE, profile);
+ case 949122880: /*security*/ return new Property("security", "Coding", "Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.", 0, java.lang.Integer.MAX_VALUE, security);
+ case 114586: /*tag*/ return new Property("tag", "Coding", "Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.", 0, java.lang.Integer.MAX_VALUE, tag);
+ default: return super.getNamedProperty(_hash, _name, _checkValid);
+ }
+
+ }
+
+ @Override
+ public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
+ switch (hash) {
+ case -1407102957: /*versionId*/ return this.versionId == null ? new Base[0] : new Base[] {this.versionId}; // IdType
+ case 1649733957: /*lastUpdated*/ return this.lastUpdated == null ? new Base[0] : new Base[] {this.lastUpdated}; // InstantType
+ case -896505829: /*source*/ return this.source == null ? new Base[0] : new Base[] {this.source}; // UriType
+ case -309425751: /*profile*/ return this.profile == null ? new Base[0] : this.profile.toArray(new Base[this.profile.size()]); // CanonicalType
+ case 949122880: /*security*/ return this.security == null ? new Base[0] : this.security.toArray(new Base[this.security.size()]); // Coding
+ case 114586: /*tag*/ return this.tag == null ? new Base[0] : this.tag.toArray(new Base[this.tag.size()]); // Coding
+ default: return super.getProperty(hash, name, checkValid);
+ }
+
+ }
+
+ @Override
+ public Base setProperty(int hash, String name, Base value) throws FHIRException {
+ switch (hash) {
+ case -1407102957: // versionId
+ this.versionId = TypeConvertor.castToId(value); // IdType
+ return value;
+ case 1649733957: // lastUpdated
+ this.lastUpdated = TypeConvertor.castToInstant(value); // InstantType
+ return value;
+ case -896505829: // source
+ this.source = TypeConvertor.castToUri(value); // UriType
+ return value;
+ case -309425751: // profile
+ this.getProfile().add(TypeConvertor.castToCanonical(value)); // CanonicalType
+ return value;
+ case 949122880: // security
+ this.getSecurity().add(TypeConvertor.castToCoding(value)); // Coding
+ return value;
+ case 114586: // tag
+ this.getTag().add(TypeConvertor.castToCoding(value)); // Coding
+ return value;
+ default: return super.setProperty(hash, name, value);
+ }
+
+ }
+
+ @Override
+ public Base setProperty(String name, Base value) throws FHIRException {
+ if (name.equals("versionId")) {
+ this.versionId = TypeConvertor.castToId(value); // IdType
+ } else if (name.equals("lastUpdated")) {
+ this.lastUpdated = TypeConvertor.castToInstant(value); // InstantType
+ } else if (name.equals("source")) {
+ this.source = TypeConvertor.castToUri(value); // UriType
+ } else if (name.equals("profile")) {
+ this.getProfile().add(TypeConvertor.castToCanonical(value));
+ } else if (name.equals("security")) {
+ this.getSecurity().add(TypeConvertor.castToCoding(value));
+ } else if (name.equals("tag")) {
+ this.getTag().add(TypeConvertor.castToCoding(value));
+ } else
+ return super.setProperty(name, value);
+ return value;
+ }
+
+ @Override
+ public Base makeProperty(int hash, String name) throws FHIRException {
+ switch (hash) {
+ case -1407102957: return getVersionIdElement();
+ case 1649733957: return getLastUpdatedElement();
+ case -896505829: return getSourceElement();
+ case -309425751: return addProfileElement();
+ case 949122880: return addSecurity();
+ case 114586: return addTag();
+ default: return super.makeProperty(hash, name);
+ }
+
+ }
+
+ @Override
+ public String[] getTypesForProperty(int hash, String name) throws FHIRException {
+ switch (hash) {
+ case -1407102957: /*versionId*/ return new String[] {"id"};
+ case 1649733957: /*lastUpdated*/ return new String[] {"instant"};
+ case -896505829: /*source*/ return new String[] {"uri"};
+ case -309425751: /*profile*/ return new String[] {"canonical"};
+ case 949122880: /*security*/ return new String[] {"Coding"};
+ case 114586: /*tag*/ return new String[] {"Coding"};
+ default: return super.getTypesForProperty(hash, name);
+ }
+
+ }
+
+ @Override
+ public Base addChild(String name) throws FHIRException {
+ if (name.equals("versionId")) {
+ throw new FHIRException("Cannot call addChild on a primitive type Meta.versionId");
+ }
+ else if (name.equals("lastUpdated")) {
+ throw new FHIRException("Cannot call addChild on a primitive type Meta.lastUpdated");
+ }
+ else if (name.equals("source")) {
+ throw new FHIRException("Cannot call addChild on a primitive type Meta.source");
+ }
+ else if (name.equals("profile")) {
+ throw new FHIRException("Cannot call addChild on a primitive type Meta.profile");
+ }
+ else if (name.equals("security")) {
+ return addSecurity();
+ }
+ else if (name.equals("tag")) {
+ return addTag();
+ }
+ else
+ return super.addChild(name);
+ }
+
+ public String fhirType() {
+ return "Meta";
+
+ }
+
+ public Meta copy() {
+ Meta dst = new Meta();
+ copyValues(dst);
+ return dst;
+ }
+
+ public void copyValues(Meta dst) {
+ super.copyValues(dst);
+ dst.versionId = versionId == null ? null : versionId.copy();
+ dst.lastUpdated = lastUpdated == null ? null : lastUpdated.copy();
+ dst.source = source == null ? null : source.copy();
+ if (profile != null) {
+ dst.profile = new ArrayList();
+ for (CanonicalType i : profile)
+ dst.profile.add(i.copy());
+ };
+ if (security != null) {
+ dst.security = new ArrayList();
+ for (Coding i : security)
+ dst.security.add(i.copy());
+ };
+ if (tag != null) {
+ dst.tag = new ArrayList();
+ for (Coding i : tag)
+ dst.tag.add(i.copy());
+ };
+ }
+
+ protected Meta typedCopy() {
+ return copy();
+ }
+
+ @Override
+ public boolean equalsDeep(Base other_) {
+ if (!super.equalsDeep(other_))
+ return false;
+ if (!(other_ instanceof Meta))
+ return false;
+ Meta o = (Meta) other_;
+ return compareDeep(versionId, o.versionId, true) && compareDeep(lastUpdated, o.lastUpdated, true)
+ && compareDeep(source, o.source, true) && compareDeep(profile, o.profile, true) && compareDeep(security, o.security, true)
+ && compareDeep(tag, o.tag, true);
+ }
+
+ @Override
+ public boolean equalsShallow(Base other_) {
+ if (!super.equalsShallow(other_))
+ return false;
+ if (!(other_ instanceof Meta))
+ return false;
+ Meta o = (Meta) other_;
+ return compareValues(versionId, o.versionId, true) && compareValues(lastUpdated, o.lastUpdated, true)
+ && compareValues(source, o.source, true) && compareValues(profile, o.profile, true);
+ }
+
+ public boolean isEmpty() {
+ return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(versionId, lastUpdated, source
+ , profile, security, tag);
+ }
+
+// Manual code (from Configuration.txt)t:
+ /**
+ * Convenience method which adds a tag
+ *
+ * @param theSystem The code system
+ * @param theCode The code
+ * @param theDisplay The display name
+ * @return Returns a reference to this for easy chaining
+ */
+ public Meta addTag(String theSystem, String theCode, String theDisplay) {
+ addTag().setSystem(theSystem).setCode(theCode).setDisplay(theDisplay);
+ return this;
+ }
+
+ /**
+ * Returns the first tag (if any) that has the given system and code, or returns
+ * null if none
+ */
+ public Coding getTag(String theSystem, String theCode) {
+ for (Coding next : getTag()) {
+ if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
+ return next;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the first security label (if any) that has the given system and code, or returns
+ * null if none
+ */
+ public Coding getSecurity(String theSystem, String theCode) {
+ for (Coding next : getSecurity()) {
+ if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
+ return next;
+ }
+ }
+ return null;
+ }
+
+// end addition
+
+}
+
diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java
index 4515cc637..20053c157 100644
--- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java
+++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/NarrativeGenerator.java
@@ -1620,6 +1620,8 @@ public class NarrativeGenerator implements INarrativeGenerator {
return false;
} else if (e instanceof ElementDefinition) {
return false;
+ } else if (e instanceof Base64BinaryType) {
+ return false;
} else if (!(e instanceof Attachment))
throw new NotImplementedException("type "+e.getClass().getName()+" not handled yet");
return false;
@@ -2515,6 +2517,8 @@ public class NarrativeGenerator implements INarrativeGenerator {
if (!x.hasAttribute("xmlns"))
x.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
if (r.hasLanguage()) {
+ // use both - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues
+ x.setAttribute("lang", r.getLanguage());
x.setAttribute("xml:lang", r.getLanguage());
}
if (!r.hasText() || !r.getText().hasDiv() || r.getText().getDiv().getChildNodes().isEmpty()) {
@@ -2539,6 +2543,13 @@ public class NarrativeGenerator implements INarrativeGenerator {
private void inject(Element er, XhtmlNode x, NarrativeStatus status) {
if (!x.hasAttribute("xmlns"))
x.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
+ Element le = XMLUtil.getNamedChild(er, "language");
+ String l = le == null ? null : le.getAttribute("value");
+ if (!Utilities.noString(l)) {
+ // use both - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues
+ x.setAttribute("lang", l);
+ x.setAttribute("xml:lang", l);
+ }
Element txt = XMLUtil.getNamedChild(er, "text");
if (txt == null) {
txt = er.getOwnerDocument().createElementNS(FormatUtilities.FHIR_NS, "text");
@@ -2574,6 +2585,12 @@ public class NarrativeGenerator implements INarrativeGenerator {
private void inject(org.hl7.fhir.r5.elementmodel.Element er, XhtmlNode x, NarrativeStatus status) throws IOException, FHIRException {
if (!x.hasAttribute("xmlns"))
x.setAttribute("xmlns", "http://www.w3.org/1999/xhtml");
+ String l = er.getChildValue("language");
+ if (!Utilities.noString(l)) {
+ // use both - see https://www.w3.org/TR/i18n-html-tech-lang/#langvalues
+ x.setAttribute("lang", l);
+ x.setAttribute("xml:lang", l);
+ }
org.hl7.fhir.r5.elementmodel.Element txt = er.getNamedChild("text");
if (txt == null) {
txt = new org.hl7.fhir.r5.elementmodel.Element("text", er.getProperty().getChild(null, "text"));
@@ -2919,6 +2936,9 @@ public class NarrativeGenerator implements INarrativeGenerator {
}
private ConceptMapRenderInstructions findByTarget(DataType source) {
+ if (source == null) {
+ return null;
+ }
String src = source.primitiveValue();
if (src != null)
for (ConceptMapRenderInstructions t : renderingMaps) {
diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java
index 5d10d4150..5bf6c714c 100644
--- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java
+++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java
@@ -7,6 +7,8 @@ import org.junit.runners.Suite.SuiteClasses;
@RunWith(Suite.class)
@SuiteClasses({
+ NpmPackageTests.class,
+ PackageClientTests.class,
SnomedExpressionsTests.class,
GraphQLParserTests.class,
TurtleTests.class,
@@ -21,7 +23,8 @@ import org.junit.runners.Suite.SuiteClasses;
BaseDateTimeTypeTest.class,
OpenApiGeneratorTest.class,
MetadataResourceManagerTester.class,
- NpmPackageTests.class,
+ MetaTest.class,
+ UtilitiesTests.class,
SnapShotGenerationTests.class})
public class AllR5Tests {
diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java
index 555630d2a..63885a005 100644
--- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java
+++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java
@@ -99,7 +99,7 @@ public class FHIRPathTests {
@Parameters(name = "{index}: file {0}")
public static Iterable