Add support for mustHaveValue and valueAlternatives + render imposesProfile + compliesWithProfile
This commit is contained in:
parent
11eb2cef53
commit
dfb4404ce6
|
@ -12,7 +12,12 @@ import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Id10
|
|||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Integer10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.MarkDown10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.String10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50.Uri10_50;
|
||||
import org.hl7.fhir.convertors.conv10_50.resources10_50.Enumerations10_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Boolean14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Uri14_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||
import org.hl7.fhir.dstu2.utils.ToolingExtensions;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
|
@ -23,7 +28,7 @@ public class ElementDefinition10_50 {
|
|||
public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2.model.ElementDefinition src, List<String> slicePaths, List<org.hl7.fhir.dstu2.model.ElementDefinition> context, int pos) throws FHIRException {
|
||||
if (src == null || src.isEmpty()) return null;
|
||||
org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives");
|
||||
if (src.hasPathElement()) tgt.setPathElement(String10_50.convertString(src.getPathElement()));
|
||||
tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition10_50::convertPropertyRepresentation).collect(Collectors.toList()));
|
||||
if (src.hasName()) {
|
||||
|
@ -74,6 +79,13 @@ public class ElementDefinition10_50 {
|
|||
for (org.hl7.fhir.dstu2.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
if (!tgt.hasId()) tgt.setId(tgt.getPath());
|
||||
|
||||
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue")) {
|
||||
tgt.setMustHaveValueElement(Boolean10_50.convertBoolean((org.hl7.fhir.dstu2.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue").getValue()));
|
||||
}
|
||||
for (org.hl7.fhir.dstu2.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives")) {
|
||||
tgt.addValueAlternative(Uri10_50.convertCanonical((org.hl7.fhir.dstu2.model.UriType)ext.getValue()));
|
||||
}
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -127,6 +139,14 @@ public class ElementDefinition10_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
if (src.hasMustHaveValue()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", Boolean10_50.convertBoolean(src.getMustHaveValueElement()));
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType ct : src.getValueAlternatives()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives", Uri10_50.convertCanonical(ct));
|
||||
}
|
||||
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv10_50.datatypes10_50.primitivetypes10_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext10_50;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext14_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class Uri10_50 {
|
||||
|
@ -15,4 +16,18 @@ public class Uri10_50 {
|
|||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
||||
public static org.hl7.fhir.r5.model.CanonicalType convertCanonical(org.hl7.fhir.dstu2.model.UriType src) throws FHIRException {
|
||||
org.hl7.fhir.r5.model.CanonicalType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CanonicalType(src.getValueAsString()) : new org.hl7.fhir.r5.model.CanonicalType();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu2.model.UriType convertCanonical(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException {
|
||||
org.hl7.fhir.dstu2.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.dstu2.model.UriType(src.getValueAsString()) : new org.hl7.fhir.dstu2.model.UriType();
|
||||
ConversionContext10_50.INSTANCE.getVersionConvertor_10_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,8 +15,13 @@ import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Mark
|
|||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.String14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50.Uri14_50;
|
||||
import org.hl7.fhir.convertors.conv14_50.resources14_50.Enumerations14_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||
import org.hl7.fhir.dstu2016may.model.ElementDefinition;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.BooleanType;
|
||||
import org.hl7.fhir.r5.conformance.profile.ProfileUtilities;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
|
||||
|
@ -24,7 +29,7 @@ public class ElementDefinition14_50 {
|
|||
public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu2016may.model.ElementDefinition src, List<ElementDefinition> context, int pos) throws FHIRException {
|
||||
if (src == null || src.isEmpty()) return null;
|
||||
org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives");
|
||||
if (src.hasPathElement()) tgt.setPathElement(String14_50.convertString(src.getPathElement()));
|
||||
tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition14_50::convertPropertyRepresentation).collect(Collectors.toList()));
|
||||
if (src.hasName()) tgt.setSliceNameElement(String14_50.convertString(src.getNameElement()));
|
||||
|
@ -75,6 +80,14 @@ public class ElementDefinition14_50 {
|
|||
for (ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
}
|
||||
|
||||
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue")) {
|
||||
tgt.setMustHaveValueElement(Boolean14_50.convertBoolean((org.hl7.fhir.dstu2016may.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue").getValue()));
|
||||
}
|
||||
for (org.hl7.fhir.dstu2016may.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives")) {
|
||||
tgt.addValueAlternative(Uri14_50.convertCanonical((org.hl7.fhir.dstu2016may.model.UriType)ext.getValue()));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -126,6 +139,14 @@ public class ElementDefinition14_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
if (src.hasMustHaveValue()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", Boolean14_50.convertBoolean(src.getMustHaveValueElement()));
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType ct : src.getValueAlternatives()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives", Uri14_50.convertCanonical(ct));
|
||||
}
|
||||
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.hl7.fhir.convertors.conv14_50.datatypes14_50.primitivetypes14_50;
|
||||
|
||||
import org.hl7.fhir.convertors.context.ConversionContext14_50;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext30_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
|
||||
public class Uri14_50 {
|
||||
|
@ -15,4 +16,19 @@ public class Uri14_50 {
|
|||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
||||
public static org.hl7.fhir.r5.model.CanonicalType convertCanonical(org.hl7.fhir.dstu2016may.model.UriType src) throws FHIRException {
|
||||
org.hl7.fhir.r5.model.CanonicalType tgt = src.hasValue() ? new org.hl7.fhir.r5.model.CanonicalType(src.getValueAsString()) : new org.hl7.fhir.r5.model.CanonicalType();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu2016may.model.UriType convertCanonical(org.hl7.fhir.r5.model.CanonicalType src) throws FHIRException {
|
||||
org.hl7.fhir.dstu2016may.model.UriType tgt = src.hasValue() ? new org.hl7.fhir.dstu2016may.model.UriType(src.getValueAsString()) : new org.hl7.fhir.dstu2016may.model.UriType();
|
||||
ConversionContext14_50.INSTANCE.getVersionConvertor_14_50().copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@ import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Stri
|
|||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.UnsignedInt30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Uri30_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.resources30_50.Enumerations30_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
|
@ -26,7 +30,7 @@ public class ElementDefinition30_50 {
|
|||
public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.dstu3.model.ElementDefinition src) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition();
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
|
||||
ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives");
|
||||
if (src.hasPath()) tgt.setPathElement(String30_50.convertString(src.getPathElement()));
|
||||
tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition30_50::convertPropertyRepresentation).collect(Collectors.toList()));
|
||||
if (src.hasSliceName()) tgt.setSliceNameElement(String30_50.convertString(src.getSliceNameElement()));
|
||||
|
@ -75,6 +79,14 @@ public class ElementDefinition30_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.dstu3.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
|
||||
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue")) {
|
||||
tgt.setMustHaveValueElement(Boolean30_50.convertBoolean((org.hl7.fhir.dstu3.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue").getValueAsPrimitive()));
|
||||
}
|
||||
for (org.hl7.fhir.dstu3.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives")) {
|
||||
tgt.addValueAlternative(Uri30_50.convertCanonical((org.hl7.fhir.dstu3.model.UriType)ext.getValue()));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -127,6 +139,13 @@ public class ElementDefinition30_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
if (src.hasMustHaveValue()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", Boolean30_50.convertBoolean(src.getMustHaveValueElement()));
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType ct : src.getValueAlternatives()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives", Uri30_50.convertCanonical(ct));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext40_50;
|
||||
import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Boolean30_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.BackboneElement40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.general40_50.Coding40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Boolean40_50;
|
||||
|
@ -16,13 +17,16 @@ import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.String40_
|
|||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.UnsignedInt40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Uri40_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.resources40_50.Enumerations40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Canonical43_50;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r4.model.BooleanType;
|
||||
|
||||
public class ElementDefinition40_50 {
|
||||
public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition();
|
||||
BackboneElement40_50.copyBackboneElement(src, tgt);
|
||||
BackboneElement40_50.copyBackboneElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives");
|
||||
if (src.hasPath()) tgt.setPathElement(String40_50.convertString(src.getPathElement()));
|
||||
tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition40_50::convertPropertyRepresentation).collect(Collectors.toList()));
|
||||
if (src.hasSliceName()) tgt.setSliceNameElement(String40_50.convertString(src.getSliceNameElement()));
|
||||
|
@ -70,6 +74,14 @@ public class ElementDefinition40_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
|
||||
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue")) {
|
||||
tgt.setMustHaveValueElement(Boolean40_50.convertBoolean((org.hl7.fhir.r4.model.BooleanType) src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue").getValueAsPrimitive()));
|
||||
}
|
||||
for (org.hl7.fhir.r4.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives")) {
|
||||
tgt.addValueAlternative(Canonical40_50.convertCanonical((org.hl7.fhir.r4.model.CanonicalType)ext.getValue()));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -124,6 +136,13 @@ public class ElementDefinition40_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
if (src.hasMustHaveValue()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", Boolean40_50.convertBoolean(src.getMustHaveValueElement()));
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType ct : src.getValueAlternatives()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives", Canonical40_50.convertCanonical(ct));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import org.hl7.fhir.convertors.VersionConvertorConstants;
|
||||
import org.hl7.fhir.convertors.context.ConversionContext43_50;
|
||||
import org.hl7.fhir.convertors.conv40_50.datatypes40_50.primitive40_50.Canonical40_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.BackboneElement43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50.Coding43_50;
|
||||
import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Boolean43_50;
|
||||
|
@ -22,7 +23,7 @@ public class ElementDefinition43_50 {
|
|||
public static org.hl7.fhir.r5.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4b.model.ElementDefinition src) throws FHIRException {
|
||||
if (src == null) return null;
|
||||
org.hl7.fhir.r5.model.ElementDefinition tgt = new org.hl7.fhir.r5.model.ElementDefinition();
|
||||
BackboneElement43_50.copyBackboneElement(src, tgt);
|
||||
BackboneElement43_50.copyBackboneElement(src, tgt, "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", "http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives");
|
||||
if (src.hasPath()) tgt.setPathElement(String43_50.convertString(src.getPathElement()));
|
||||
tgt.setRepresentation(src.getRepresentation().stream().map(ElementDefinition43_50::convertPropertyRepresentation).collect(Collectors.toList()));
|
||||
if (src.hasSliceName()) tgt.setSliceNameElement(String43_50.convertString(src.getSliceNameElement()));
|
||||
|
@ -70,6 +71,14 @@ public class ElementDefinition43_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r4b.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
|
||||
if (src.hasExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue")) {
|
||||
tgt.setMustHaveValueElement(Boolean43_50.convertBoolean(src.getExtensionByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue").getValueBooleanType()));
|
||||
}
|
||||
for (org.hl7.fhir.r4b.model.Extension ext : src.getExtensionsByUrl("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives")) {
|
||||
tgt.addValueAlternative(Canonical43_50.convertCanonical(ext.getValueCanonicalType()));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
@ -124,6 +133,13 @@ public class ElementDefinition43_50 {
|
|||
if (src.hasBinding()) tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
|
||||
for (org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
|
||||
tgt.addMapping(convertElementDefinitionMappingComponent(t));
|
||||
if (src.hasMustHaveValue()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.mustHaveValue", Boolean43_50.convertBoolean(src.getMustHaveValueElement()));
|
||||
}
|
||||
for (org.hl7.fhir.r5.model.CanonicalType ct : src.getValueAlternatives()) {
|
||||
tgt.addExtension("http://hl7.org/fhir/5.0/StructureDefinition/extension-ElementDefinition.valueAlternatives", Canonical43_50.convertCanonical(ct));
|
||||
}
|
||||
|
||||
return tgt;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,19 +6,19 @@ package org.hl7.fhir.dstu2.model;
|
|||
/*
|
||||
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
|
||||
|
||||
* 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,
|
||||
* 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
|
||||
* 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.
|
||||
|
@ -29,8 +29,8 @@ package org.hl7.fhir.dstu2.model;
|
|||
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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
|
||||
import java.util.ArrayList;
|
||||
|
@ -47,136 +47,161 @@ import org.hl7.fhir.utilities.Utilities;
|
|||
*/
|
||||
public abstract class Element extends Base implements IBaseHasExtensions, IBaseElement {
|
||||
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." )
|
||||
protected IdType id;
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." )
|
||||
protected IdType id;
|
||||
|
||||
/**
|
||||
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
|
||||
protected List<Extension> extension;
|
||||
/**
|
||||
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
|
||||
protected List<Extension> extension;
|
||||
|
||||
private static final long serialVersionUID = -158027598L;
|
||||
private static final long serialVersionUID = -158027598L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public IdType getIdElement() {
|
||||
/**
|
||||
* @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public IdType getIdElement() {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new IdType(); // bb
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public Element setIdElement(IdType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new IdType(); // bb
|
||||
return this.id;
|
||||
this.id = new IdType();
|
||||
this.id.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public Element setIdElement(IdType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
this.id = new IdType();
|
||||
this.id.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
}
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
// syntactic sugar
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
}
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL.
|
||||
*
|
||||
* @param theUrl The URL. Must not be blank or null.
|
||||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
public void addExtension(String url, Type value) {
|
||||
Extension ex = new Extension();
|
||||
ex.setUrl(url);
|
||||
ex.setValue(value);
|
||||
getExtension().add(ex);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL.
|
||||
*
|
||||
* @param theUrl The URL. Must not be blank or null.
|
||||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
public boolean hasExtension(String theUrl) {
|
||||
return !getExtensionsByUrl(theUrl).isEmpty();
|
||||
}
|
||||
|
@ -192,73 +217,73 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
|||
return ext.get(0).getValue().primitiveValue();
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id));
|
||||
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
|
||||
}
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id));
|
||||
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String name, Base value) throws FHIRException {
|
||||
if (name.equals("id"))
|
||||
this.id = castToId(value); // IdType
|
||||
else if (name.equals("extension"))
|
||||
this.getExtension().add(castToExtension(value));
|
||||
else
|
||||
super.setProperty(name, value);
|
||||
}
|
||||
@Override
|
||||
public void setProperty(String name, Base value) throws FHIRException {
|
||||
if (name.equals("id"))
|
||||
this.id = castToId(value); // IdType
|
||||
else if (name.equals("extension"))
|
||||
this.getExtension().add(castToExtension(value));
|
||||
else
|
||||
super.setProperty(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base addChild(String name) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
|
||||
}
|
||||
else if (name.equals("extension")) {
|
||||
return addExtension();
|
||||
}
|
||||
else
|
||||
return super.addChild(name);
|
||||
}
|
||||
@Override
|
||||
public Base addChild(String name) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
|
||||
}
|
||||
else if (name.equals("extension")) {
|
||||
return addExtension();
|
||||
}
|
||||
else
|
||||
return super.addChild(name);
|
||||
}
|
||||
|
||||
public String fhirType() {
|
||||
return "Element";
|
||||
|
||||
}
|
||||
|
||||
public abstract Element copy();
|
||||
public abstract Element copy();
|
||||
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
|
||||
}
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareValues(id, o.id, true);
|
||||
}
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareValues(id, o.id, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
|
||||
;
|
||||
}
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -6,19 +6,19 @@ package org.hl7.fhir.dstu2016may.model;
|
|||
/*
|
||||
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
|
||||
|
||||
* 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,
|
||||
* 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
|
||||
* 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.
|
||||
|
@ -29,13 +29,14 @@ package org.hl7.fhir.dstu2016may.model;
|
|||
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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.instance.model.api.IBaseElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
|
@ -48,140 +49,163 @@ import ca.uhn.fhir.model.api.annotation.Description;
|
|||
*/
|
||||
public abstract class Element extends Base implements IBaseHasExtensions, IBaseElement {
|
||||
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." )
|
||||
protected IdType id;
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." )
|
||||
protected IdType id;
|
||||
|
||||
/**
|
||||
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
|
||||
protected List<Extension> extension;
|
||||
/**
|
||||
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
|
||||
protected List<Extension> extension;
|
||||
|
||||
private static final long serialVersionUID = -158027598L;
|
||||
private static final long serialVersionUID = -158027598L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public IdType getIdElement() {
|
||||
/**
|
||||
* @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public IdType getIdElement() {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new IdType(); // bb
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public Element setIdElement(IdType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new IdType(); // bb
|
||||
return this.id;
|
||||
this.id = new IdType();
|
||||
this.id.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public Element setIdElement(IdType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references).
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
this.id = new IdType();
|
||||
this.id.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
}
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
// syntactic sugar
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
}
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL.
|
||||
*
|
||||
* @param theUrl The URL. Must not be blank or null.
|
||||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL.
|
||||
*
|
||||
* @param theUrl The URL. Must not be blank or null.
|
||||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
public boolean hasExtension(String theUrl) {
|
||||
return !getExtensionsByUrl(theUrl).isEmpty();
|
||||
}
|
||||
|
||||
public void addExtension(String url, Type value) {
|
||||
Extension ex = new Extension();
|
||||
ex.setUrl(url);
|
||||
ex.setValue(value);
|
||||
getExtension().add(ex);
|
||||
}
|
||||
|
||||
public String getExtensionString(String theUrl) throws FHIRException {
|
||||
List<Extension> ext = getExtensionsByUrl(theUrl);
|
||||
if (ext.isEmpty())
|
||||
|
@ -193,107 +217,107 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
|||
return ext.get(0).getValue().primitiveValue();
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id));
|
||||
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
|
||||
}
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id));
|
||||
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: /*id*/ return this.id == null ? new Base[0] : new Base[] {this.id}; // IdType
|
||||
case -612557761: /*extension*/ return this.extension == null ? new Base[0] : this.extension.toArray(new Base[this.extension.size()]); // Extension
|
||||
default: return super.getProperty(hash, name, checkValid);
|
||||
}
|
||||
@Override
|
||||
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: /*id*/ return this.id == null ? new Base[0] : new Base[] {this.id}; // IdType
|
||||
case -612557761: /*extension*/ return this.extension == null ? new Base[0] : this.extension.toArray(new Base[this.extension.size()]); // Extension
|
||||
default: return super.getProperty(hash, name, checkValid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(int hash, String name, Base value) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: // id
|
||||
this.id = castToId(value); // IdType
|
||||
break;
|
||||
case -612557761: // extension
|
||||
this.getExtension().add(castToExtension(value)); // Extension
|
||||
break;
|
||||
default: super.setProperty(hash, name, value);
|
||||
}
|
||||
@Override
|
||||
public void setProperty(int hash, String name, Base value) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: // id
|
||||
this.id = castToId(value); // IdType
|
||||
break;
|
||||
case -612557761: // extension
|
||||
this.getExtension().add(castToExtension(value)); // Extension
|
||||
break;
|
||||
default: super.setProperty(hash, name, value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperty(String name, Base value) throws FHIRException {
|
||||
if (name.equals("id"))
|
||||
this.id = castToId(value); // IdType
|
||||
else if (name.equals("extension"))
|
||||
this.getExtension().add(castToExtension(value));
|
||||
else
|
||||
super.setProperty(name, value);
|
||||
}
|
||||
@Override
|
||||
public void setProperty(String name, Base value) throws FHIRException {
|
||||
if (name.equals("id"))
|
||||
this.id = castToId(value); // IdType
|
||||
else if (name.equals("extension"))
|
||||
this.getExtension().add(castToExtension(value));
|
||||
else
|
||||
super.setProperty(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base makeProperty(int hash, String name) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: throw new FHIRException("Cannot make property id as it is not a complex type"); // IdType
|
||||
case -612557761: return addExtension(); // Extension
|
||||
default: return super.makeProperty(hash, name);
|
||||
}
|
||||
@Override
|
||||
public Base makeProperty(int hash, String name) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: throw new FHIRException("Cannot make property id as it is not a complex type"); // IdType
|
||||
case -612557761: return addExtension(); // Extension
|
||||
default: return super.makeProperty(hash, name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base addChild(String name) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
|
||||
}
|
||||
else if (name.equals("extension")) {
|
||||
return addExtension();
|
||||
}
|
||||
else
|
||||
return super.addChild(name);
|
||||
}
|
||||
@Override
|
||||
public Base addChild(String name) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
|
||||
}
|
||||
else if (name.equals("extension")) {
|
||||
return addExtension();
|
||||
}
|
||||
else
|
||||
return super.addChild(name);
|
||||
}
|
||||
|
||||
public String fhirType() {
|
||||
return "Element";
|
||||
|
||||
}
|
||||
|
||||
public abstract Element copy();
|
||||
public abstract Element copy();
|
||||
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
|
||||
}
|
||||
@Override
|
||||
public boolean equalsDeep(Base other) {
|
||||
if (!super.equalsDeep(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareValues(id, o.id, true);
|
||||
}
|
||||
@Override
|
||||
public boolean equalsShallow(Base other) {
|
||||
if (!super.equalsShallow(other))
|
||||
return false;
|
||||
if (!(other instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other;
|
||||
return compareValues(id, o.id, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
|
||||
;
|
||||
}
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -5,19 +5,19 @@ package org.hl7.fhir.dstu3.model;
|
|||
/*
|
||||
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
|
||||
|
||||
* 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,
|
||||
* 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
|
||||
* 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.
|
||||
|
@ -28,8 +28,8 @@ package org.hl7.fhir.dstu3.model;
|
|||
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 Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.x
|
||||
import java.util.ArrayList;
|
||||
|
@ -48,166 +48,166 @@ import ca.uhn.fhir.model.api.annotation.Description;
|
|||
*/
|
||||
public abstract class Element extends Base implements IBaseHasExtensions, IBaseElement {
|
||||
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
|
||||
*/
|
||||
@Child(name = "id", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." )
|
||||
protected StringType id;
|
||||
/**
|
||||
* unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
|
||||
*/
|
||||
@Child(name = "id", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=false)
|
||||
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces." )
|
||||
protected StringType id;
|
||||
|
||||
/**
|
||||
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
|
||||
protected List<Extension> extension;
|
||||
/**
|
||||
* May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
|
||||
*/
|
||||
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
|
||||
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension." )
|
||||
protected List<Extension> extension;
|
||||
|
||||
private static final long serialVersionUID = -1452745816L;
|
||||
private static final long serialVersionUID = -1452745816L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
public Element() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #id} (unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public StringType getIdElement() {
|
||||
/**
|
||||
* @return {@link #id} (unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public StringType getIdElement() {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new StringType(); // bb
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #id} (unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public Element setIdElement(StringType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Element.id");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.id = new StringType(); // bb
|
||||
return this.id;
|
||||
this.id = new StringType();
|
||||
this.id.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasIdElement() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
public boolean hasId() {
|
||||
return this.id != null && !this.id.isEmpty();
|
||||
}
|
||||
/**
|
||||
* @return Returns a reference to <code>this</code> for easy method chaining
|
||||
*/
|
||||
public Element setExtension(List<Extension> theExtension) {
|
||||
this.extension = theExtension;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #id} (unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
|
||||
*/
|
||||
public Element setIdElement(StringType value) {
|
||||
this.id = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
|
||||
*/
|
||||
public String getId() {
|
||||
return this.id == null ? null : this.id.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
|
||||
*/
|
||||
public Element setId(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.id = null;
|
||||
else {
|
||||
if (this.id == null)
|
||||
this.id = new StringType();
|
||||
this.id.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.)
|
||||
*/
|
||||
public List<Extension> getExtension() {
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
return this.extension;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns a reference to <code>this</code> for easy method chaining
|
||||
*/
|
||||
public Element setExtension(List<Extension> theExtension) {
|
||||
this.extension = theExtension;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
public boolean hasExtension() {
|
||||
if (this.extension == null)
|
||||
return false;
|
||||
}
|
||||
for (Extension item : this.extension)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
public Extension addExtension() { //3
|
||||
Extension t = new Extension();
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
public Element addExtension(Extension t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.extension == null)
|
||||
this.extension = new ArrayList<Extension>();
|
||||
this.extension.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The first repetition of repeating field {@link #extension}, creating it if it does not already exist
|
||||
*/
|
||||
public Extension getExtensionFirstRep() {
|
||||
if (getExtension().isEmpty()) {
|
||||
addExtension();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The first repetition of repeating field {@link #extension}, creating it if it does not already exist
|
||||
*/
|
||||
public Extension getExtensionFirstRep() {
|
||||
if (getExtension().isEmpty()) {
|
||||
addExtension();
|
||||
}
|
||||
return getExtension().get(0);
|
||||
}
|
||||
return getExtension().get(0);
|
||||
}
|
||||
|
||||
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
if (retVal.size() == 0)
|
||||
return null;
|
||||
else {
|
||||
org.apache.commons.lang3.Validate.isTrue(retVal.size() == 1, "Url "+theUrl+" must have only one match");
|
||||
return retVal.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL.
|
||||
*
|
||||
* @param theUrl The URL. Must not be blank or null.
|
||||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
/**
|
||||
* Returns an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL.
|
||||
*
|
||||
* @param theUrl The URL. Must not be blank or null.
|
||||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
for (Extension next : getExtension()) {
|
||||
if (theUrl.equals(next.getUrl())) {
|
||||
retVal.add(next);
|
||||
}
|
||||
}
|
||||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
public boolean hasExtension(String theUrl) {
|
||||
return !getExtensionsByUrl(theUrl).isEmpty();
|
||||
}
|
||||
|
@ -223,138 +223,138 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
|||
return ext.get(0).getValue().primitiveValue();
|
||||
}
|
||||
|
||||
protected void listChildren(List<Property> children) {
|
||||
children.add(new Property("id", "string", "unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", 0, 1, id));
|
||||
children.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
|
||||
}
|
||||
protected void listChildren(List<Property> children) {
|
||||
children.add(new Property("id", "string", "unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", 0, 1, id));
|
||||
children.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
|
||||
switch (_hash) {
|
||||
case 3355: /*id*/ return new Property("id", "string", "unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", 0, 1, id);
|
||||
case -612557761: /*extension*/ return new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension);
|
||||
default: return super.getNamedProperty(_hash, _name, _checkValid);
|
||||
}
|
||||
@Override
|
||||
public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
|
||||
switch (_hash) {
|
||||
case 3355: /*id*/ return new Property("id", "string", "unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", 0, 1, id);
|
||||
case -612557761: /*extension*/ return new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order to make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.", 0, java.lang.Integer.MAX_VALUE, extension);
|
||||
default: return super.getNamedProperty(_hash, _name, _checkValid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: /*id*/ return this.id == null ? new Base[0] : new Base[] {this.id}; // StringType
|
||||
case -612557761: /*extension*/ return this.extension == null ? new Base[0] : this.extension.toArray(new Base[this.extension.size()]); // Extension
|
||||
default: return super.getProperty(hash, name, checkValid);
|
||||
}
|
||||
@Override
|
||||
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: /*id*/ return this.id == null ? new Base[0] : new Base[] {this.id}; // StringType
|
||||
case -612557761: /*extension*/ return this.extension == null ? new Base[0] : this.extension.toArray(new Base[this.extension.size()]); // Extension
|
||||
default: return super.getProperty(hash, name, checkValid);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base setProperty(int hash, String name, Base value) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: // id
|
||||
this.id = castToString(value); // StringType
|
||||
return value;
|
||||
case -612557761: // extension
|
||||
this.getExtension().add(castToExtension(value)); // Extension
|
||||
return value;
|
||||
default: return super.setProperty(hash, name, value);
|
||||
}
|
||||
@Override
|
||||
public Base setProperty(int hash, String name, Base value) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: // id
|
||||
this.id = castToString(value); // StringType
|
||||
return value;
|
||||
case -612557761: // extension
|
||||
this.getExtension().add(castToExtension(value)); // Extension
|
||||
return value;
|
||||
default: return super.setProperty(hash, name, value);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base setProperty(String name, Base value) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
this.id = castToString(value); // StringType
|
||||
} else if (name.equals("extension")) {
|
||||
this.getExtension().add(castToExtension(value));
|
||||
} else
|
||||
return super.setProperty(name, value);
|
||||
return value;
|
||||
}
|
||||
@Override
|
||||
public Base setProperty(String name, Base value) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
this.id = castToString(value); // StringType
|
||||
} else if (name.equals("extension")) {
|
||||
this.getExtension().add(castToExtension(value));
|
||||
} else
|
||||
return super.setProperty(name, value);
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base makeProperty(int hash, String name) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: return getIdElement();
|
||||
case -612557761: return addExtension();
|
||||
default: return super.makeProperty(hash, name);
|
||||
}
|
||||
@Override
|
||||
public Base makeProperty(int hash, String name) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: return getIdElement();
|
||||
case -612557761: return addExtension();
|
||||
default: return super.makeProperty(hash, name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: /*id*/ return new String[] {"string"};
|
||||
case -612557761: /*extension*/ return new String[] {"Extension"};
|
||||
default: return super.getTypesForProperty(hash, name);
|
||||
}
|
||||
@Override
|
||||
public String[] getTypesForProperty(int hash, String name) throws FHIRException {
|
||||
switch (hash) {
|
||||
case 3355: /*id*/ return new String[] {"string"};
|
||||
case -612557761: /*extension*/ return new String[] {"Extension"};
|
||||
default: return super.getTypesForProperty(hash, name);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Base addChild(String name) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
|
||||
}
|
||||
else if (name.equals("extension")) {
|
||||
return addExtension();
|
||||
}
|
||||
else
|
||||
return super.addChild(name);
|
||||
}
|
||||
@Override
|
||||
public Base addChild(String name) throws FHIRException {
|
||||
if (name.equals("id")) {
|
||||
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
|
||||
}
|
||||
else if (name.equals("extension")) {
|
||||
return addExtension();
|
||||
}
|
||||
else
|
||||
return super.addChild(name);
|
||||
}
|
||||
|
||||
public String fhirType() {
|
||||
return "Element";
|
||||
|
||||
}
|
||||
|
||||
public abstract Element copy();
|
||||
public abstract Element copy();
|
||||
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
public void copyValues(Element dst) {
|
||||
dst.id = id == null ? null : id.copy();
|
||||
if (extension != null) {
|
||||
dst.extension = new ArrayList<Extension>();
|
||||
for (Extension i : extension)
|
||||
dst.extension.add(i.copy());
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsDeep(Base other_) {
|
||||
if (!super.equalsDeep(other_))
|
||||
return false;
|
||||
if (!(other_ instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other_;
|
||||
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
|
||||
}
|
||||
@Override
|
||||
public boolean equalsDeep(Base other_) {
|
||||
if (!super.equalsDeep(other_))
|
||||
return false;
|
||||
if (!(other_ instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other_;
|
||||
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalsShallow(Base other_) {
|
||||
if (!super.equalsShallow(other_))
|
||||
return false;
|
||||
if (!(other_ instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other_;
|
||||
return compareValues(id, o.id, true);
|
||||
}
|
||||
@Override
|
||||
public boolean equalsShallow(Base other_) {
|
||||
if (!super.equalsShallow(other_))
|
||||
return false;
|
||||
if (!(other_ instanceof Element))
|
||||
return false;
|
||||
Element o = (Element) other_;
|
||||
return compareValues(id, o.id, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(id, extension);
|
||||
}
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(id, extension);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIdBase() {
|
||||
return getId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setIdBase(String value) {
|
||||
setId(value);
|
||||
}
|
||||
// added from java-adornments.txt:
|
||||
// added from java-adornments.txt:
|
||||
public void addExtension(String url, Type value) {
|
||||
Extension ex = new Extension();
|
||||
ex.setUrl(url);
|
||||
|
@ -363,6 +363,6 @@ public abstract class Element extends Base implements IBaseHasExtensions, IBaseE
|
|||
}
|
||||
|
||||
|
||||
// end addition
|
||||
// end addition
|
||||
|
||||
}
|
|
@ -55,6 +55,7 @@ import org.hl7.fhir.r5.elementmodel.ObjectConverter;
|
|||
import org.hl7.fhir.r5.elementmodel.Property;
|
||||
import org.hl7.fhir.r5.model.Base;
|
||||
import org.hl7.fhir.r5.model.BooleanType;
|
||||
import org.hl7.fhir.r5.model.CanonicalType;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.r5.model.DataType;
|
||||
import org.hl7.fhir.r5.model.Element;
|
||||
|
@ -2428,7 +2429,18 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
else
|
||||
derived.getMustHaveValueElement().setUserData(UD_DERIVATION_EQUALS, true);
|
||||
}
|
||||
|
||||
if (derived.hasValueAlternatives()) {
|
||||
if (!Base.compareDeep(derived.getValueAlternatives(), base.getValueAlternatives(), false))
|
||||
for (CanonicalType s : derived.getValueAlternatives()) {
|
||||
if (!base.hasValueAlternatives(s.getValue()))
|
||||
base.getValueAlternatives().add(s.copy());
|
||||
}
|
||||
else if (trimDifferential)
|
||||
derived.getValueAlternatives().clear();
|
||||
else
|
||||
for (CanonicalType t : derived.getValueAlternatives())
|
||||
t.setUserData(UD_DERIVATION_EQUALS, true);
|
||||
}
|
||||
|
||||
// profiles cannot change : isModifier, defaultValue, meaningWhenMissing
|
||||
// but extensions can change isModifier
|
||||
|
|
|
@ -12853,6 +12853,14 @@ If a pattern[x] is declared on a repeating element, the pattern applies to all r
|
|||
return getMin() == 1;
|
||||
}
|
||||
|
||||
public CanonicalType addValueAlternative(CanonicalType t) {
|
||||
if (this.valueAlternatives == null)
|
||||
this.valueAlternatives = new ArrayList<CanonicalType>();
|
||||
this.valueAlternatives.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
||||
|
|
|
@ -85,68 +85,68 @@ import org.hl7.fhir.utilities.xhtml.XhtmlNodeList;
|
|||
|
||||
public class StructureDefinitionRenderer extends ResourceRenderer {
|
||||
|
||||
// public class ObligationWrapper {
|
||||
//
|
||||
// private Extension ext;
|
||||
//
|
||||
// public ObligationWrapper(Extension ext) {
|
||||
// this.ext = ext;
|
||||
// }
|
||||
//
|
||||
// public boolean hasActor() {
|
||||
// return ext.hasExtension("actor");
|
||||
// }
|
||||
//
|
||||
// public boolean hasActor(String id) {
|
||||
// return ext.hasExtension("actor") && id.equals(ext.getExtensionByUrl("actor").getValue().primitiveValue());
|
||||
// }
|
||||
//
|
||||
// public Coding getCode() {
|
||||
// Extension code = ext.getExtensionByUrl("obligation");
|
||||
// if (code != null && code.hasValueCoding()) {
|
||||
// return code.getValueCoding();
|
||||
// }
|
||||
// if (code != null && code.hasValueCodeType()) {
|
||||
// return new Coding().setSystem("http://hl7.org/fhir/tools/CodeSystem/obligation").setCode(code.getValueCodeType().primitiveValue());
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public boolean hasFilter() {
|
||||
// return ext.hasExtension("filter");
|
||||
// }
|
||||
//
|
||||
// public String getFilter() {
|
||||
// Extension code = ext.getExtensionByUrl("filter");
|
||||
// if (code != null && code.getValue() != null) {
|
||||
// return code.getValue().primitiveValue();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public boolean hasUsage() {
|
||||
// return ext.hasExtension("usage");
|
||||
// }
|
||||
//
|
||||
// public String getFilterDocumentation() {
|
||||
// Extension code = ext.getExtensionByUrl("filter-desc");
|
||||
// if (code != null && code.getValue() != null) {
|
||||
// return code.getValue().primitiveValue();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public List<UsageContext> getUsage() {
|
||||
// List<UsageContext> usage = new ArrayList<>();
|
||||
// for (Extension u : ext.getExtensionsByUrl("usage" )) {
|
||||
// if (u.hasValueUsageContext()) {
|
||||
// usage.add(u.getValueUsageContext());
|
||||
// }
|
||||
// }
|
||||
// return usage;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// public class ObligationWrapper {
|
||||
//
|
||||
// private Extension ext;
|
||||
//
|
||||
// public ObligationWrapper(Extension ext) {
|
||||
// this.ext = ext;
|
||||
// }
|
||||
//
|
||||
// public boolean hasActor() {
|
||||
// return ext.hasExtension("actor");
|
||||
// }
|
||||
//
|
||||
// public boolean hasActor(String id) {
|
||||
// return ext.hasExtension("actor") && id.equals(ext.getExtensionByUrl("actor").getValue().primitiveValue());
|
||||
// }
|
||||
//
|
||||
// public Coding getCode() {
|
||||
// Extension code = ext.getExtensionByUrl("obligation");
|
||||
// if (code != null && code.hasValueCoding()) {
|
||||
// return code.getValueCoding();
|
||||
// }
|
||||
// if (code != null && code.hasValueCodeType()) {
|
||||
// return new Coding().setSystem("http://hl7.org/fhir/tools/CodeSystem/obligation").setCode(code.getValueCodeType().primitiveValue());
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public boolean hasFilter() {
|
||||
// return ext.hasExtension("filter");
|
||||
// }
|
||||
//
|
||||
// public String getFilter() {
|
||||
// Extension code = ext.getExtensionByUrl("filter");
|
||||
// if (code != null && code.getValue() != null) {
|
||||
// return code.getValue().primitiveValue();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public boolean hasUsage() {
|
||||
// return ext.hasExtension("usage");
|
||||
// }
|
||||
//
|
||||
// public String getFilterDocumentation() {
|
||||
// Extension code = ext.getExtensionByUrl("filter-desc");
|
||||
// if (code != null && code.getValue() != null) {
|
||||
// return code.getValue().primitiveValue();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public List<UsageContext> getUsage() {
|
||||
// List<UsageContext> usage = new ArrayList<>();
|
||||
// for (Extension u : ext.getExtensionsByUrl("usage" )) {
|
||||
// if (u.hasValueUsageContext()) {
|
||||
// usage.add(u.getValueUsageContext());
|
||||
// }
|
||||
// }
|
||||
// return usage;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
@ -159,7 +159,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
public StructureDefinitionRenderer(RenderingContext context, ResourceContext rcontext) {
|
||||
super(context, rcontext);
|
||||
}
|
||||
|
||||
|
||||
public boolean render(XhtmlNode x, Resource dr) throws FHIRFormatError, DefinitionException, IOException {
|
||||
return render(x, (StructureDefinition) dr);
|
||||
}
|
||||
|
@ -194,10 +194,10 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
|
||||
// private static final int AGG_NONE = 0;
|
||||
// private static final int AGG_IND = 1;
|
||||
// private static final int AGG_GR = 2;
|
||||
// private static final boolean TABLE_FORMAT_FOR_FIXED_VALUES = false;
|
||||
// private static final int AGG_NONE = 0;
|
||||
// private static final int AGG_IND = 1;
|
||||
// private static final int AGG_GR = 2;
|
||||
// private static final boolean TABLE_FORMAT_FOR_FIXED_VALUES = false;
|
||||
public static final String CONSTRAINT_CHAR = "C";
|
||||
public static final String CONSTRAINT_STYLE = "padding-left: 3px; padding-right: 3px; border: 1px maroon solid; font-weight: bold; color: #301212; background-color: #fdf4f4;";
|
||||
private final boolean ADD_REFERENCE_TO_TABLE = true;
|
||||
|
@ -219,7 +219,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
private String profileLink;
|
||||
private String resLink;
|
||||
private String type;
|
||||
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private class ElementInStructure {
|
||||
|
@ -297,7 +297,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
public ElementDefinition getElement() {
|
||||
return element;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
private ElementInStructure getElementByName(List<ElementDefinition> elements, String contentReference, StructureDefinition source) {
|
||||
if (contentReference.contains("#")) {
|
||||
|
@ -323,7 +323,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
throw new Error("getElementByName: can't find "+contentReference+" in "+elements.toString()+" from "+source.getUrl());
|
||||
// return null;
|
||||
// return null;
|
||||
}
|
||||
|
||||
public XhtmlNode generateGrid(String defFile, StructureDefinition profile, String imageFolder, boolean inlineGraphics, String profileBaseFileName, String corePath, String imagePath, Set<String> outputTracker) throws IOException, FHIRException {
|
||||
|
@ -361,7 +361,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
this.hint = hint;
|
||||
this.link = link;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
public XhtmlNode generateTable(String defFile, StructureDefinition profile, boolean diff, String imageFolder, boolean inlineGraphics, String profileBaseFileName, boolean snapshot, String corePath, String imagePath,
|
||||
boolean logicalModel, boolean allInvariants, Set<String> outputTracker, boolean mustSupport, RenderingContext rc, String anchorPrefix) throws IOException, FHIRException {
|
||||
|
@ -376,7 +376,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
list = new ArrayList<>();
|
||||
list.addAll(profile.getSnapshot().getElement());
|
||||
}
|
||||
|
||||
|
||||
List<Column> columns = new ArrayList<>();
|
||||
TableModel model;
|
||||
switch (context.getStructureMode()) {
|
||||
|
@ -444,7 +444,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
columns.add(new Column("example", "Example", "Instances are not expected or even encouraged to draw from the specified value set. The value set merely provides examples of the types of concepts intended to be included."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void scanBindings(Set<String> cols, List<ElementDefinition> list, ElementDefinition ed) {
|
||||
if (ed.hasBinding()) {
|
||||
if (ed.getBinding().hasValueSet() && ed.getBinding().hasStrength()) {
|
||||
|
@ -472,13 +472,13 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
cols.add(ext.getExtensionString("purpose"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
List<ElementDefinition> children = getChildren(list, ed);
|
||||
for (ElementDefinition element : children) {
|
||||
scanBindings(cols, list, element);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void scanObligations(List<Column> columns, List<ElementDefinition> list) {
|
||||
Set<String> cols = new HashSet<>();
|
||||
scanObligations(cols, list, list.get(0));
|
||||
|
@ -517,7 +517,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
|
||||
public TableModel initCustomTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, boolean alternating, String id, boolean isActive, List<Column> columns) throws IOException {
|
||||
TableModel model = gen.new TableModel(id, isActive);
|
||||
|
||||
|
||||
model.setAlternating(alternating);
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
|
@ -531,16 +531,16 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
private Row genElement(String defPath, HierarchicalTableGenerator gen, List<Row> rows, ElementDefinition element, List<ElementDefinition> all, List<StructureDefinition> profiles, boolean showMissing, String profileBaseFileName, Boolean extensions,
|
||||
boolean snapshot, String corePath, String imagePath, boolean root, boolean logicalModel, boolean isConstraintMode, boolean allInvariants, Row slicingRow, boolean mustSupport, RenderingContext rc, String anchorPrefix, Resource srcSD, List<Column> columns) throws IOException, FHIRException {
|
||||
Row originalRow = slicingRow;
|
||||
StructureDefinition profile = profiles == null ? null : profiles.get(profiles.size()-1);
|
||||
Row typesRow = null;
|
||||
|
||||
|
||||
List<ElementDefinition> children = getChildren(all, element);
|
||||
// if (!snapshot && isExtension && extensions != null && extensions != isExtension)
|
||||
// return;
|
||||
// if (!snapshot && isExtension && extensions != null && extensions != isExtension)
|
||||
// return;
|
||||
|
||||
if (!onlyInformationIsMapping(all, element)) {
|
||||
Row row = gen.new Row();
|
||||
|
@ -700,7 +700,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
row.getSubRows().add(hrow);
|
||||
row = hrow;
|
||||
}
|
||||
|
||||
|
||||
Row currRow = row;
|
||||
List<ElementChoiceGroup> groups = readChoices(element, children);
|
||||
boolean isExtension = Utilities.existsInList(tail(element.getPath()), "extension", "modifierExtension");
|
||||
|
@ -716,10 +716,10 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
}
|
||||
}
|
||||
// if (!snapshot && (extensions == null || !extensions))
|
||||
// for (ElementDefinition child : children)
|
||||
// if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension"))
|
||||
// genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, true, false, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
|
||||
// if (!snapshot && (extensions == null || !extensions))
|
||||
// for (ElementDefinition child : children)
|
||||
// if (child.getPath().endsWith(".extension") || child.getPath().endsWith(".modifierExtension"))
|
||||
// genElement(defPath, gen, row.getSubRows(), child, all, profiles, showMissing, profileBaseFileName, true, false, corePath, imagePath, false, logicalModel, isConstraintMode, allInvariants);
|
||||
}
|
||||
if (typesRow != null && !element.prohibited() && context.getStructureMode() == StructureDefinitionRendererMode.SUMMARY) {
|
||||
makeChoiceRows(typesRow.getSubRows(), element, gen, corePath, profileBaseFileName, mustSupport, srcSD);
|
||||
|
@ -843,6 +843,9 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
if (element != null && element.getIsSummary()) {
|
||||
checkForNoChange(element.getIsSummaryElement(), gc.addStyledText(translate("sd.table", "This element is included in summaries"), "\u03A3", null, null, null, false));
|
||||
}
|
||||
if (element != null && element.getMustHaveValue()) {
|
||||
checkForNoChange(element.getMustHaveValueElement(), gc.addStyledText(translate("sd.table", "This primitive element must have a value"), "V", "maroon", null, null, true));
|
||||
}
|
||||
if (element != null && (hasNonBaseConstraints(element.getConstraint()) || hasNonBaseConditions(element.getCondition()))) {
|
||||
Piece p = gc.addText(CONSTRAINT_CHAR);
|
||||
p.setHint(translate("sd.table", "This element has or is affected by constraints ("+listConstraintsAndConditions(element)+")"));
|
||||
|
@ -1001,7 +1004,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
prow.getSubRows().add(row);
|
||||
return row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void insertMissingSparseElements(List<ElementDefinition> list) {
|
||||
int i = 1;
|
||||
|
@ -1031,7 +1034,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private String urltail(String path) {
|
||||
if (path.contains("#"))
|
||||
|
@ -1046,13 +1049,13 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
private boolean standardExtensionSlicing(ElementDefinition element) {
|
||||
String t = tail(element.getPath());
|
||||
return (t.equals("extension") || t.equals("modifierExtension"))
|
||||
&& element.getSlicing().getRules() != SlicingRules.CLOSED && element.getSlicing().getDiscriminator().size() == 1 && element.getSlicing().getDiscriminator().get(0).getPath().equals("url") && element.getSlicing().getDiscriminator().get(0).getType().equals(DiscriminatorType.VALUE);
|
||||
&& element.getSlicing().getRules() != SlicingRules.CLOSED && element.getSlicing().getDiscriminator().size() == 1 && element.getSlicing().getDiscriminator().get(0).getPath().equals("url") && element.getSlicing().getDiscriminator().get(0).getType().equals(DiscriminatorType.VALUE);
|
||||
}
|
||||
|
||||
public Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, boolean snapshot, boolean mustSupportOnly, boolean allowSubRows, RenderingContext rc) throws IOException, FHIRException {
|
||||
return generateDescription(gen, row, definition, fallback, used, baseURL, url, profile, corePath, imagePath, root, logicalModel, allInvariants, null, snapshot, mustSupportOnly, allowSubRows, rc);
|
||||
}
|
||||
|
||||
|
||||
public Cell generateDescription(HierarchicalTableGenerator gen, Row row, ElementDefinition definition, ElementDefinition fallback, boolean used, String baseURL, String url, StructureDefinition profile, String corePath, String imagePath, boolean root, boolean logicalModel, boolean allInvariants, ElementDefinition valueDefn, boolean snapshot, boolean mustSupportOnly, boolean allowSubRows, RenderingContext rc) throws IOException, FHIRException {
|
||||
Cell c = gen.new Cell();
|
||||
row.getCells().add(c);
|
||||
|
@ -1072,7 +1075,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
if (profile != null && profile.getAbstract()) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.addPiece(gen.new Piece(null, "This is an abstract "+(profile.getDerivation() == TypeDerivationRule.CONSTRAINT ? "profile" : "type")+". ", null));
|
||||
|
||||
|
||||
List<StructureDefinition> children = new ArrayList<>();
|
||||
for (StructureDefinition sd : context.getWorker().fetchResourcesByType(StructureDefinition.class)) {
|
||||
if (sd.hasBaseDefinition() && sd.getBaseDefinition().equals(profile.getUrl())) {
|
||||
|
@ -1138,7 +1141,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
c.getPieces().add(gen.new Piece(ref2, fixedUrl, null));
|
||||
c.getPieces().add(gen.new Piece(null, translate("sd.table", " profiled by ")+" ", null).addStyle("font-weight:bold"));
|
||||
c.getPieces().add(gen.new Piece(ref, fullUrl, null));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1154,6 +1157,9 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
c.getPieces().add(gen.new Piece(null, ToolingExtensions.readStringExtension(profile, ToolingExtensions.EXT_BINDING_STYLE), null));
|
||||
c.getPieces().add(gen.new Piece(null, " binding style", null));
|
||||
}
|
||||
if (definition.hasValueAlternatives()) {
|
||||
addCanonicalList(gen, c, definition.getValueAlternatives(), "The primitive value may be replaced by the extension", true);
|
||||
}
|
||||
if (definition.hasExtension(ToolingExtensions.EXT_IMPLIED_PREFIX)) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.getPieces().add(gen.new Piece(null, "When this element is read ", null));
|
||||
|
@ -1233,7 +1239,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
c.getPieces().add(piece);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (ToolingExtensions.readBoolExtension(definition, ToolingExtensions.EXT_JSON_PRIMITIVE_CHOICE)) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.getPieces().add(gen.new Piece(null, "JSON: The type of this element is inferred from the JSON type in the instance", null));
|
||||
|
@ -1272,19 +1278,9 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.addPiece(gen.new Piece(null, "This is an obligation profile that only contains obligations and additional bindings", null).addStyle("font-weight:bold"));
|
||||
}
|
||||
for (Extension ext : profile.getExtensionsByUrl(ToolingExtensions.EXT_OBLIGATION_INHERITS)) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
String iu = ext.getValue().primitiveValue();
|
||||
c.addPiece(gen.new Piece(null, "This profile picks up obligations and additional bindings from ", null).addStyle("font-weight:bold"));
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, iu);
|
||||
if (sd == null) {
|
||||
c.addPiece(gen.new Piece(null, iu, null).addStyle("font-weight:bold"));
|
||||
} else if (sd.hasWebPath()) {
|
||||
c.addPiece(gen.new Piece(sd.getWebPath(), sd.present(), null).addStyle("font-weight:bold"));
|
||||
} else {
|
||||
c.addPiece(gen.new Piece(iu, sd.present(), null).addStyle("font-weight:bold"));
|
||||
}
|
||||
}
|
||||
addCanonicalListExt(gen, c, profile.getExtensionsByUrl(ToolingExtensions.EXT_OBLIGATION_INHERITS), "This profile picks up obligations and additional bindings from the profile", true);
|
||||
addCanonicalListExt(gen, c, profile.getExtensionsByUrl(ToolingExtensions.EXT_SD_IMPOSE_PROFILE), "This profile also imposes the profile", true);
|
||||
addCanonicalListExt(gen, c, profile.getExtensionsByUrl(ToolingExtensions.EXT_SD_COMPLIES_WITH_PROFILE), "This profile also complies with the profile", true);
|
||||
|
||||
if (profile.getKind() == StructureDefinitionKind.LOGICAL) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
|
@ -1306,7 +1302,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
c.addPiece(gen.new Piece("br"));
|
||||
BindingResolution br = context.getPkp() == null ? makeNullBr(binding) : context.getPkp().resolveBinding(profile, binding, definition.getPath());
|
||||
c.getPieces().add(checkForNoChange(binding, gen.new Piece(null, translate("sd.table", "Binding")+": ", null).addStyle("font-weight:bold")));
|
||||
c.getPieces().add(checkForNoChange(binding.getValueSetElement(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !context.getPkp().prependLinks() ? br.url : corePath+br.url, br.display, null)));
|
||||
c.getPieces().add(checkForNoChange(binding.getValueSetElement(), gen.new Piece(br.url == null ? null : Utilities.isAbsoluteUrl(br.url) || !context.getPkp().prependLinks() ? br.url : corePath+br.url, br.display, null)));
|
||||
if (binding.hasStrength()) {
|
||||
c.getPieces().add(checkForNoChange(binding.getStrengthElement(), gen.new Piece(null, " (", null)));
|
||||
c.getPieces().add(checkForNoChange(binding.getStrengthElement(), gen.new Piece(corePath+"terminologies.html#"+binding.getStrength().toCode(), egt(binding.getStrengthElement()), binding.getStrength().getDefinition())));
|
||||
|
@ -1386,7 +1382,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
obr.seeObligations(definition.getExtensionsByUrl(ToolingExtensions.EXT_OBLIGATION));
|
||||
}
|
||||
obr.renderTable(gen, c);
|
||||
|
||||
|
||||
if (definition.hasMaxLength() && definition.getMaxLength()!=0) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.getPieces().add(checkForNoChange(definition.getMaxLengthElement(), gen.new Piece(null, "Max Length: ", null).addStyle("font-weight:bold")));
|
||||
|
@ -1413,7 +1409,51 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
private void addCanonicalListExt(HierarchicalTableGenerator gen, Cell c, List<Extension> list, String start, boolean bold) {
|
||||
List<CanonicalType> clist = new ArrayList<>();
|
||||
for (Extension ext : list) {
|
||||
if (ext.hasValueCanonicalType()) {
|
||||
clist.add(ext.getValueCanonicalType());
|
||||
}
|
||||
}
|
||||
addCanonicalList(gen, c, clist, start, bold);
|
||||
}
|
||||
|
||||
private void addCanonicalList(HierarchicalTableGenerator gen, Cell c, List<CanonicalType> list, String start, boolean bold) {
|
||||
if (!list.isEmpty()) {
|
||||
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
Piece p = gen.new Piece(null, start+(list.size() != 1 ? "s" : "")+" ", null);
|
||||
c.addPiece(p);
|
||||
if (bold) p.addStyle("font-weight:bold");
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CanonicalType ct = list.get(i);
|
||||
if (i > 0) {
|
||||
if (i < list.size() - 1) {
|
||||
c.addPiece(gen.new Piece(null, ", ", null));
|
||||
} else {
|
||||
c.addPiece(gen.new Piece(null, " and ", null));
|
||||
}
|
||||
}
|
||||
String iu = ct.primitiveValue();
|
||||
StructureDefinition sd = context.getContext().fetchResource(StructureDefinition.class, iu);
|
||||
if (sd == null) {
|
||||
p = gen.new Piece(null, iu, null).addStyle("font-weight:bold");
|
||||
c.addPiece(p);
|
||||
} else if (sd.hasWebPath()) {
|
||||
p = gen.new Piece(sd.getWebPath(), sd.present(), null).addStyle("font-weight:bold");
|
||||
c.addPiece(p);
|
||||
} else {
|
||||
p = gen.new Piece(iu, sd.present(), null).addStyle("font-weight:bold");
|
||||
c.addPiece(p);
|
||||
}
|
||||
if (bold) p.addStyle("font-weight:bold");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Piece checkForNoChange(Element source, Piece piece) {
|
||||
if (source.hasUserData(ProfileUtilities.UD_DERIVATION_EQUALS)) {
|
||||
|
@ -1706,7 +1746,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
else
|
||||
row.getCells().add(gen.new Cell());
|
||||
generateGridDescription(gen, row, element, null, used.used, null, null, profile, corePath, imagePath, root, null);
|
||||
/* if (element.hasSlicing()) {
|
||||
/* if (element.hasSlicing()) {
|
||||
if (standardExtensionSlicing(element)) {
|
||||
used.used = element.hasType() && element.getType().get(0).hasProfile();
|
||||
showMissing = false;
|
||||
|
@ -1754,8 +1794,8 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
private boolean extensionIsComplex(String value) {
|
||||
if (value.contains("#")) {
|
||||
StructureDefinition ext = context.getWorker().fetchResource(StructureDefinition.class, value.substring(0, value.indexOf("#")));
|
||||
if (ext == null)
|
||||
return false;
|
||||
if (ext == null)
|
||||
return false;
|
||||
String tail = value.substring(value.indexOf("#")+1);
|
||||
ElementDefinition ed = null;
|
||||
for (ElementDefinition ted : ext.getSnapshot().getElement()) {
|
||||
|
@ -1778,7 +1818,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private BindingResolution makeNullBr(ElementDefinitionBindingComponent binding) {
|
||||
BindingResolution br = new BindingResolution();
|
||||
|
@ -1991,7 +2031,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
return true;
|
||||
for (Coding c : cc.getCoding())
|
||||
if (c.hasDisplay())
|
||||
return true;
|
||||
return true;
|
||||
} // (fixed instanceof CodeType) || (fixed instanceof Quantity);
|
||||
return false;
|
||||
}
|
||||
|
@ -2118,14 +2158,14 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
c.getPieces().add(gen.new Piece(null, "Definition: ", null).addStyle("font-weight:bold"));
|
||||
c.addPiece(gen.new Piece("br"));
|
||||
c.addMarkdown(definition.getDefinition());
|
||||
// c.getPieces().add(checkForNoChange(definition.getCommentElement(), gen.new Piece(null, definition.getComment(), null)));
|
||||
// c.getPieces().add(checkForNoChange(definition.getCommentElement(), gen.new Piece(null, definition.getComment(), null)));
|
||||
}
|
||||
if (definition.getComment()!=null) {
|
||||
if (!c.getPieces().isEmpty()) { c.addPiece(gen.new Piece("br")); }
|
||||
c.getPieces().add(gen.new Piece(null, "Comments: ", null).addStyle("font-weight:bold"));
|
||||
c.addPiece(gen.new Piece("br"));
|
||||
c.addMarkdown(definition.getComment());
|
||||
// c.getPieces().add(checkForNoChange(definition.getCommentElement(), gen.new Piece(null, definition.getComment(), null)));
|
||||
// c.getPieces().add(checkForNoChange(definition.getCommentElement(), gen.new Piece(null, definition.getComment(), null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2191,7 +2231,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
StructureDefinition sd = context.getWorker().fetchTypeDefinition(value);
|
||||
if (sd == null) // might be running before all SDs are available
|
||||
return Utilities.existsInList(value, "Address", "Age", "Annotation", "Attachment", "CodeableConcept", "Coding", "ContactPoint", "Count", "Distance", "Duration", "HumanName", "Identifier", "Money", "Period", "Quantity", "Range", "Ratio", "Reference", "SampledData", "Signature", "Timing",
|
||||
"ContactDetail", "Contributor", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext");
|
||||
"ContactDetail", "Contributor", "DataRequirement", "Expression", "ParameterDefinition", "RelatedArtifact", "TriggerDefinition", "UsageContext");
|
||||
else
|
||||
return sd.getKind() == StructureDefinitionKind.COMPLEXTYPE && sd.getDerivation() == TypeDerivationRule.SPECIALIZATION;
|
||||
}
|
||||
|
@ -2220,7 +2260,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
|
||||
|
||||
private Cell addCell(Row row, Cell cell) {
|
||||
private Cell addCell(Row row, Cell cell) {
|
||||
row.getCells().add(cell);
|
||||
return (cell);
|
||||
}
|
||||
|
@ -2441,7 +2481,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
}
|
||||
return !all && !any;
|
||||
}
|
||||
|
||||
|
||||
private boolean allProfilesMustSupport(List<CanonicalType> profiles) {
|
||||
boolean all = true;
|
||||
boolean any = false;
|
||||
|
@ -2557,7 +2597,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
|
||||
private TableModel initSpanningTable(HierarchicalTableGenerator gen, String prefix, boolean isLogical, String id) throws IOException {
|
||||
TableModel model = gen.new TableModel(id, true);
|
||||
|
||||
|
||||
if (context.getRules() == GenerationRules.VALID_RESOURCE || context.isInlineGraphics()) {
|
||||
model.setDocoImg(HierarchicalTableGenerator.help16AsData());
|
||||
} else {
|
||||
|
@ -2581,7 +2621,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
} else {
|
||||
row.setIcon("icon_resource.png", HierarchicalTableGenerator.TEXT_ICON_RESOURCE);
|
||||
}
|
||||
|
||||
|
||||
row.getCells().add(gen.new Cell(null, null, span.getName(), null, null));
|
||||
row.getCells().add(gen.new Cell(null, null, span.getCardinality(), null, null));
|
||||
row.getCells().add(gen.new Cell(null, span.getProfileLink(), span.getType(), null, null));
|
||||
|
@ -2599,7 +2639,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
TableModel model = initSpanningTable(gen, "", false, profile.getId());
|
||||
Set<String> processed = new HashSet<String>();
|
||||
SpanEntry span = buildSpanningTable("(focus)", "", profile, processed, onlyConstraints, constraintPrefix);
|
||||
|
||||
|
||||
genSpanEntry(gen, model.getRows(), span);
|
||||
return gen.generate(model, "", 0, outputTracker);
|
||||
}
|
||||
|
@ -2807,7 +2847,7 @@ public class StructureDefinitionRenderer extends ResourceRenderer {
|
|||
throw new FHIRException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private String describeCardinality(ElementDefinition definition, ElementDefinition fallback, UnusedTracker tracker) {
|
||||
IntegerType min = definition.hasMinElement() ? definition.getMinElement() : new IntegerType();
|
||||
StringType max = definition.hasMaxElement() ? definition.getMaxElement() : new StringType();
|
||||
|
|
|
@ -210,6 +210,7 @@ public class ToolingExtensions {
|
|||
public static final String EXT_CAP_STMT_EXPECT = "http://hl7.org/fhir/StructureDefinition/capabilitystatement-expectation";
|
||||
public static final String EXT_ED_HEIRARCHY = "http://hl7.org/fhir/StructureDefinition/elementdefinition-heirarchy";
|
||||
public static final String EXT_SD_IMPOSE_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-imposeProfile";
|
||||
public static final String EXT_SD_COMPLIES_WITH_PROFILE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-compliesWithProfile";
|
||||
public static final String EXT_XML_NO_ORDER = "http://hl7.org/fhir/StructureDefinition/structuredefinition-xml-no-order";
|
||||
public static final String EXT_DEF_TYPE = "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaulttype";
|
||||
public static final String EXT_TYPE_SPEC = "http://hl7.org/fhir/tools/StructureDefinition/type-specifier";
|
||||
|
@ -225,7 +226,7 @@ public class ToolingExtensions {
|
|||
public static final String EXT_DATE_FORMAT = "http://hl7.org/fhir/tools/StructureDefinition/elementdefinition-date-format";
|
||||
public static final String EXT_ID_EXPECTATION = "http://hl7.org/fhir/tools/StructureDefinition/id-expectation";
|
||||
public static final String EXT_JSON_PRIMITIVE_CHOICE = "http://hl7.org/fhir/tools/StructureDefinition/json-primitive-choice";
|
||||
public static final String EXT_SUMMARY = "http://hl7.org/fhir/tools/StructureDefinition/profile-summary";
|
||||
public static final String EXT_SUMMARY = "http://hl7.org/fhir/StructureDefinition/structuredefinition-summary";
|
||||
public static final String EXT_BINDING_DEFINITION = "http://hl7.org/fhir/tools/StructureDefinition/binding-definition";
|
||||
|
||||
|
||||
|
@ -750,6 +751,13 @@ public class ToolingExtensions {
|
|||
element.getExtension().add(extension);
|
||||
}
|
||||
|
||||
public static boolean hasAllowedUnits(ElementDefinition eld) {
|
||||
for (Extension e : eld.getExtension())
|
||||
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static DataType getAllowedUnits(ElementDefinition eld) {
|
||||
for (Extension e : eld.getExtension())
|
||||
if (e.getUrl().equals(EXT_ALLOWABLE_UNITS))
|
||||
|
|
|
@ -907,6 +907,8 @@ public class I18nConstants {
|
|||
public static final String QUESTIONNAIRE_Q_ITEM_DERIVED_NI_ANSWER_VS = "QUESTIONNAIRE_Q_ITEM_DERIVED_NI_ANSWER_VS";
|
||||
public static final String QUESTIONNAIRE_Q_ITEM_DERIVED_ANSWER_OPTIONS = "QUESTIONNAIRE_Q_ITEM_DERIVED_ANSWER_OPTIONS";
|
||||
public static final String QUESTIONNAIRE_Q_ITEM_DERIVED_ANSWER_OPTIONS_NEW = "QUESTIONNAIRE_Q_ITEM_DERIVED_ANSWER_OPTIONS_NEW";
|
||||
public static final String PRIMITIVE_MUSTHAVEVALUE_MESSAGE = "PRIMITIVE_MUSTHAVEVALUE_MESSAGE";
|
||||
public static final String PRIMITIVE_VALUE_ALTERNATIVES_MESSAGE = "PRIMITIVE_VALUE_ALTERNATIVES_MESSAGE";
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ import java.io.OutputStream;
|
|||
import java.io.OutputStreamWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xml.IXMLWriter;
|
||||
|
@ -79,6 +80,15 @@ public class XhtmlComposer {
|
|||
return sdst.toString();
|
||||
}
|
||||
|
||||
public String compose(List<XhtmlNode> nodes) throws IOException {
|
||||
StringWriter sdst = new StringWriter();
|
||||
dst = sdst;
|
||||
for (XhtmlNode node : nodes) {
|
||||
writeNode("", node, false);
|
||||
}
|
||||
return sdst.toString();
|
||||
}
|
||||
|
||||
public void compose(OutputStream stream, XhtmlDocument doc) throws IOException {
|
||||
byte[] bom = new byte[] { (byte)0xEF, (byte)0xBB, (byte)0xBF };
|
||||
stream.write(bom);
|
||||
|
@ -360,5 +370,10 @@ public class XhtmlComposer {
|
|||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public String compose(XhtmlNodeList childNodes) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -960,4 +960,6 @@ QUESTIONNAIRE_Q_ITEM_DERIVED_NC_ANSWER_TYPE = The item with linkId ''{1}'' found
|
|||
QUESTIONNAIRE_Q_ITEM_DERIVED_NI_ANSWER_VS = The validator can''t check derived item value set consistency (yet?)
|
||||
QUESTIONNAIRE_Q_ITEM_DERIVED_ANSWER_OPTIONS = The item with linkId ''{1}'' found in questionnaire ''{0}'' has answerOptions, so this item must have some too
|
||||
QUESTIONNAIRE_Q_ITEM_DERIVED_ANSWER_OPTIONS_NEW = The item with linkId ''{1}'' found in questionnaire ''{0}'' does not have this answerOption, so it is not valid
|
||||
|
||||
PRIMITIVE_MUSTHAVEVALUE_MESSAGE = The element definition ``{0}`` in the profile ''{1}'' requires that a value be present in this element
|
||||
PRIMITIVE_VALUE_ALTERNATIVES_MESSAGE_one = The element definition ``{0}`` in the profile ''{1}'' requires that if a value is not present, the extension ''{2}'' must be present
|
||||
PRIMITIVE_VALUE_ALTERNATIVES_MESSAGE_other = The element definition ``{0}`` in the profile ''{1}'' requires that if a value is not present, one of the extensions ''{2}'' must be present
|
||||
|
|
|
@ -2290,6 +2290,16 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
if (context.hasBinding()) {
|
||||
ok = rule(errors, NO_RULE_DATE, IssueType.CODEINVALID, e.line(), e.col(), path, context.getBinding().getStrength() != BindingStrength.REQUIRED, I18nConstants.Terminology_TX_Code_ValueSet_MISSING) && ok;
|
||||
}
|
||||
ok = rule(errors, "2023-06-18", IssueType.INVALID, e.line(), e.col(), path, !context.getMustHaveValue(), I18nConstants.PRIMITIVE_MUSTHAVEVALUE_MESSAGE, context.getId(), profile.getVersionedUrl()) && ok;
|
||||
if (context.hasValueAlternatives()) {
|
||||
boolean found = false;
|
||||
CommaSeparatedStringBuilder b = new CommaSeparatedStringBuilder();
|
||||
for (CanonicalType ct : context.getValueAlternatives()) {
|
||||
found = found || e.hasExtension(ct.getValue());
|
||||
b.append(ct.getValue());
|
||||
}
|
||||
ok = rulePlural(errors, "2023-06-18", IssueType.INVALID, e.line(), e.col(), path, found, context.getValueAlternatives().size(), I18nConstants.PRIMITIVE_VALUE_ALTERNATIVES_MESSAGE, context.getId(), profile.getVersionedUrl(), b.toString()) && ok;
|
||||
}
|
||||
return ok;
|
||||
} else {
|
||||
boolean hasBiDiControls = UnicodeUtilities.hasBiDiChars(e.primitiveValue());
|
||||
|
|
Loading…
Reference in New Issue