diff --git a/examples/src/main/java/example/CustomObservation.java b/examples/src/main/java/example/CustomObservation.java new file mode 100644 index 00000000000..54269735c0e --- /dev/null +++ b/examples/src/main/java/example/CustomObservation.java @@ -0,0 +1,7 @@ +package example; + +import org.hl7.fhir.dstu3.model.Observation; + +public class CustomObservation extends Observation { + +} diff --git a/examples/src/main/java/example/Extensions.java b/examples/src/main/java/example/ExtensionsDstu2.java similarity index 98% rename from examples/src/main/java/example/Extensions.java rename to examples/src/main/java/example/ExtensionsDstu2.java index 3506f2af5a5..2cb26bcfbd8 100644 --- a/examples/src/main/java/example/Extensions.java +++ b/examples/src/main/java/example/ExtensionsDstu2.java @@ -12,7 +12,7 @@ import ca.uhn.fhir.model.primitive.DateTimeDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.parser.DataFormatException; -public class Extensions { +public class ExtensionsDstu2 { @SuppressWarnings("unused") public static void main(String[] args) throws DataFormatException, IOException { diff --git a/examples/src/main/java/example/ExtensionsDstu3.java b/examples/src/main/java/example/ExtensionsDstu3.java new file mode 100644 index 00000000000..01df6c3fd56 --- /dev/null +++ b/examples/src/main/java/example/ExtensionsDstu3.java @@ -0,0 +1,140 @@ +package example; + +import java.io.IOException; +import java.util.List; + +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.Extension; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.Identifier.IdentifierUse; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.StringType; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.parser.DataFormatException; +import ca.uhn.fhir.rest.client.IGenericClient; + +public class ExtensionsDstu3 { + + public void customType() { + +IGenericClient client = FhirContext.forDstu3().newRestfulGenericClient("http://foo"); + +//START SNIPPET: customTypeClientSimple +// Create an example patient +MyPatient custPatient = new MyPatient(); +custPatient.addName().addFamily("Smith").addGiven("John"); +custPatient.setPetName(new StringType("Rover")); // populate the extension + +// Create the resource like normal +client.create().resource(custPatient).execute(); + +// You can also read the resource back like normal +custPatient = client.read().resource(MyPatient.class).withId("123").execute(); +//END SNIPPET: customTypeClientSimple + + + } + + public void customTypeDeclared() { + + +//START SNIPPET: customTypeClientDeclared +FhirContext ctx = FhirContext.forDstu3(); + +// Instruct the context that if it receives a resource which +// claims to conform to the given profile (by URL), it should +// use the MyPatient type to parse this resource +ctx.setDefaultTypeForProfile("http://example.com/StructureDefinition/mypatient", MyPatient.class); + +// You can declare as many default types as you like +ctx.setDefaultTypeForProfile("http://foo.com/anotherProfile", CustomObservation.class); + +// Create a client +IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3"); + +// You can also read the resource back like normal +Patient patient = client.read().resource(Patient.class).withId("123").execute(); +if (patient instanceof MyPatient) { + // If the server supplied a resource which declared to conform + // to the given profile, MyPatient will have been returned so + // process it differently.. +} + +//END SNIPPET: customTypeClientDeclared + + + } + +@SuppressWarnings("unused") +public static void main(String[] args) throws DataFormatException, IOException { + + +// START SNIPPET: resourceExtension +// Create an example patient +Patient patient = new Patient(); +patient.addIdentifier().setUse(IdentifierUse.OFFICIAL).setSystem("urn:example").setValue("7000135"); + +// Create an extension +Extension ext = new Extension(); +ext.setUrl("http://example.com/extensions#someext"); +ext.setValue(new DateTimeType("2011-01-02T11:13:15")); + +// Add the extension to the resource +patient.addExtension(ext); +//END SNIPPET: resourceExtension + + +//START SNIPPET: resourceStringExtension +// Continuing the example from above, we will add a name to the patient, and then +// add an extension to part of that name +HumanName name = patient.addName(); +name.addFamily("Shmoe"); + +// Add a new "given name", which is of type String +StringType given = name.addGivenElement(); +given.setValue("Joe"); + +// Create an extension and add it to the String +Extension givenExt = new Extension("http://examples.com#moreext", new StringType("Hello")); +given.addExtension(givenExt); +//END SNIPPET: resourceStringExtension + +FhirContext ctx = FhirContext.forDstu3(); +String output = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient); +System.out.println(output); + + +//START SNIPPET: parseExtension +// Get all extensions (modifier or not) for a given URL +List resourceExts = patient.getExtensionsByUrl("http://fooextensions.com#exts"); + +// Get all non-modifier extensions regardless of URL +List nonModExts = patient.getExtension(); + +//Get all non-modifier extensions regardless of URL +List modExts = patient.getModifierExtension(); +//END SNIPPET: parseExtension + +} + + +public void foo() { +//START SNIPPET: subExtension +Patient patient = new Patient(); + +// Add an extension (initially with no contents) to the resource +Extension parent = new Extension("http://example.com#parent"); +patient.addExtension(parent); + +// Add two extensions as children to the parent extension +Extension child1 = new Extension("http://example.com#childOne", new StringType("value1")); +parent.addExtension(child1); + +Extension child2 = new Extension("http://example.com#chilwo", new StringType("value1")); +parent.addExtension(child2); +//END SNIPPET: subExtension + +} + +} diff --git a/examples/src/main/java/example/MyPatient.java b/examples/src/main/java/example/MyPatient.java index 6ff45280e33..02248f0a81d 100644 --- a/examples/src/main/java/example/MyPatient.java +++ b/examples/src/main/java/example/MyPatient.java @@ -4,13 +4,14 @@ package example; import java.util.ArrayList; import java.util.List; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.StringType; + import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.model.primitive.DateTimeDt; -import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.util.ElementUtil; /** @@ -25,7 +26,9 @@ import ca.uhn.fhir.util.ElementUtil; @ResourceDef(name="Patient", profile="http://example.com/StructureDefinition/mypatient") public class MyPatient extends Patient { - /** + private static final long serialVersionUID = 1L; + + /** * Each extension is defined in a field. Any valid HAPI Data Type * can be used for the field type. Note that the [name=""] attribute * in the @Child annotation needs to match the name for the bean accessor @@ -34,7 +37,7 @@ public class MyPatient extends Patient { @Child(name="petName") @Extension(url="http://example.com/dontuse#petname", definedLocally=false, isModifier=false) @Description(shortDefinition="The name of the patient's favourite pet") - private StringDt myPetName; + private StringType myPetName; /** * The second example extension uses a List type to provide @@ -46,7 +49,7 @@ public class MyPatient extends Patient { @Child(name="importantDates", max=Child.MAX_UNLIMITED) @Extension(url="http://example.com/dontuse#importantDates", definedLocally=false, isModifier=true) @Description(shortDefinition="Some dates of note for this patient") - private List myImportantDates; + private List myImportantDates; /** * It is important to override the isEmpty() method, adding a check for any @@ -67,28 +70,28 @@ public class MyPatient extends Patient { ********/ /** Getter for important dates */ - public List getImportantDates() { + public List getImportantDates() { if (myImportantDates==null) { - myImportantDates = new ArrayList(); + myImportantDates = new ArrayList(); } return myImportantDates; } /** Getter for pet name */ - public StringDt getPetName() { + public StringType getPetName() { if (myPetName == null) { - myPetName = new StringDt(); + myPetName = new StringType(); } return myPetName; } /** Setter for important dates */ - public void setImportantDates(List theImportantDates) { + public void setImportantDates(List theImportantDates) { myImportantDates = theImportantDates; } /** Setter for pet name */ - public void setPetName(StringDt thePetName) { + public void setPetName(StringType thePetName) { myPetName = thePetName; } diff --git a/examples/src/main/java/example/MyPatientUse.java b/examples/src/main/java/example/MyPatientUse.java index 548555eb4f5..d4068a86c7e 100644 --- a/examples/src/main/java/example/MyPatientUse.java +++ b/examples/src/main/java/example/MyPatientUse.java @@ -18,7 +18,7 @@ import ca.uhn.fhir.parser.IParser; public class MyPatientUse { - @ResourceDef + @ResourceDef() public static class MyPatient extends Patient { @Child(name="petName") diff --git a/hapi-fhir-base-test-mindeps-server/.classpath b/hapi-fhir-base-test-mindeps-server/.classpath index 75e8fd8df27..f8457d21055 100644 --- a/hapi-fhir-base-test-mindeps-server/.classpath +++ b/hapi-fhir-base-test-mindeps-server/.classpath @@ -6,22 +6,16 @@ + + + + + + - - - - - - - - - - - - diff --git a/hapi-fhir-base-test-mindeps-server/.project b/hapi-fhir-base-test-mindeps-server/.project index eabe6c28a36..96459364cdd 100644 --- a/hapi-fhir-base-test-mindeps-server/.project +++ b/hapi-fhir-base-test-mindeps-server/.project @@ -5,6 +5,16 @@ + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.wst.common.project.facet.core.builder + + + org.eclipse.m2e.core.maven2Builder @@ -13,5 +23,7 @@ org.eclipse.m2e.core.maven2Nature + org.eclipse.wst.common.project.facet.core.nature + org.eclipse.jdt.core.javanature diff --git a/hapi-fhir-base-test-mindeps-server/.settings/org.eclipse.jdt.core.prefs b/hapi-fhir-base-test-mindeps-server/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..f42de363afa --- /dev/null +++ b/hapi-fhir-base-test-mindeps-server/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,7 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/hapi-fhir-base-test-mindeps-server/.settings/org.eclipse.wst.common.project.facet.core.xml b/hapi-fhir-base-test-mindeps-server/.settings/org.eclipse.wst.common.project.facet.core.xml new file mode 100644 index 00000000000..bc0009a4558 --- /dev/null +++ b/hapi-fhir-base-test-mindeps-server/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionJsonParserTest.java b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionJsonParserTest.java index f11e483cad1..80c9309a928 100644 --- a/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionJsonParserTest.java +++ b/hapi-fhir-base-test-mindeps-server/src/test/java/ca/uhn/fhir/parser/MultiVersionJsonParserTest.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.parser; +import static org.hamcrest.Matchers.stringContainsInOrder; import static org.junit.Assert.assertThat; import org.hamcrest.core.StringContains; @@ -22,7 +23,10 @@ public class MultiVersionJsonParserTest { String str = FhirContext.forDstu2().newJsonParser().encodeResourceToString(p); ourLog.info(str); - assertThat(str, StringContains.containsString("{\"resourceType\":\"Patient\",\"extension\":[{\"url\":\"http://foo#ext\",\"valueQuantity\":{\"value\":2.2}}],\"identifier\":[{\"system\":\"urn:sys\",\"value\":\"001\"}]}")); + assertThat(str, stringContainsInOrder( + "{\"resourceType\":\"Patient\"", + "\"extension\":[{\"url\":\"http://foo#ext\",\"valueQuantity\":{\"value\":2.2}}]", + "\"identifier\":[{\"system\":\"urn:sys\",\"value\":\"001\"}]")); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java index ec3aa00dcbc..f74fa42a7cd 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java @@ -50,6 +50,7 @@ import ca.uhn.fhir.rest.client.IRestfulClientFactory; import ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory; import ca.uhn.fhir.rest.client.api.IBasicClient; import ca.uhn.fhir.rest.client.api.IRestfulClient; +import ca.uhn.fhir.rest.server.AddProfileTagEnum; import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory; import ca.uhn.fhir.util.FhirTerser; import ca.uhn.fhir.util.VersionUtil; @@ -77,7 +78,9 @@ public class FhirContext { private static final List> EMPTY_LIST = Collections.emptyList(); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirContext.class); + private AddProfileTagEnum myAddProfileTagWhenEncoding = AddProfileTagEnum.ONLY_FOR_CUSTOM; private volatile Map, BaseRuntimeElementDefinition> myClassToElementDefinition = Collections.emptyMap(); + private Map> myDefaultTypeForProfile = new HashMap>(); private volatile Map myIdToResourceDefinition = Collections.emptyMap(); private HapiLocalizer myLocalizer = new HapiLocalizer(); private volatile Map> myNameToElementDefinition = Collections.emptyMap(); @@ -89,7 +92,7 @@ public class FhirContext { private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition; private final IFhirVersion myVersion; private Map>> myVersionToNameToResourceType = Collections.emptyMap(); - + /** * Default constructor. In most cases this is the right constructor to use. */ @@ -144,6 +147,26 @@ public class FhirContext { return getLocalizer().getMessage(FhirContext.class, "unknownResourceName", theResourceName, theVersion); } + /** + * When encoding resources, this setting configures the parser to include + * an entry in the resource's metadata section which indicates which profile(s) the + * resource claims to conform to. The default is {@link AddProfileTagEnum#ONLY_FOR_CUSTOM}. + * + * @see #setAddProfileTagWhenEncoding(AddProfileTagEnum) for more information + */ + public AddProfileTagEnum getAddProfileTagWhenEncoding() { + return myAddProfileTagWhenEncoding; + } + + /** + * Returns the default resource type for the given profile + * + * @see #setDefaultTypeForProfile(String, Class) + */ + public Class getDefaultTypeForProfile(String theProfile) { + return myDefaultTypeForProfile.get(theProfile); + } + /** * Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed * for extending the core library. @@ -298,14 +321,6 @@ public class FhirContext { return myIdToResourceDefinition.values(); } - /** - * Set the restful client factory - * @param theRestfulClientFactory - */ - public void setRestfulClientFactory(IRestfulClientFactory theRestfulClientFactory) { - this.myRestfulClientFactory = theRestfulClientFactory; - } - /** * Get the restful client factory. If no factory has been set, this will be initialized with * a new ApacheRestfulClientFactory. @@ -326,6 +341,17 @@ public class FhirContext { return myVersion; } + /** + * Returns true if any default types for specific profiles have been defined + * within this context. + * + * @see #setDefaultTypeForProfile(String, Class) + * @see #getDefaultTypeForProfile(String) + */ + public boolean hasDefaultTypeForProfile() { + return !myDefaultTypeForProfile.isEmpty(); + } + /** * This method should be considered experimental and will likely change in future releases * of HAPI. Use with caution! @@ -472,6 +498,50 @@ public class FhirContext { return classToElementDefinition; } + + /** + * When encoding resources, this setting configures the parser to include + * an entry in the resource's metadata section which indicates which profile(s) the + * resource claims to conform to. The default is {@link AddProfileTagEnum#ONLY_FOR_CUSTOM}. + *

+ * This feature is intended for situations where custom resource types are being used, + * avoiding the need to manually add profile declarations for these custom types. + *

+ *

+ * See Profiling and Extensions + * for more information on using custom types. + *

+ *

+ * Note that this feature automatically adds the profile, but leaves any profile tags + * which have been manually added in place as well. + *

+ * + * @param theAddProfileTagWhenEncoding + * The add profile mode (must not be null) + */ + public void setAddProfileTagWhenEncoding(AddProfileTagEnum theAddProfileTagWhenEncoding) { + Validate.notNull(theAddProfileTagWhenEncoding, "theAddProfileTagWhenEncoding must not be null"); + myAddProfileTagWhenEncoding = theAddProfileTagWhenEncoding; + } + + /** + * Sets the default type which will be used when parsing a resource that is found to be + * of the given profile. + *

+ * For example, this method is invoked with the profile string of + * "http://example.com/some_patient_profile" and the type of MyPatient.class, + * if the parser is parsing a resource and finds that it declares that it conforms to that profile, + * the MyPatient type will be used unless otherwise specified. + *

+ * + * @param theProfile The profile string, e.g. "http://example.com/some_patient_profile". Must not be null or empty. + * @param theClass The resource type. Must not be null or empty. + */ + public void setDefaultTypeForProfile(String theProfile, Class theClass) { + Validate.notBlank(theProfile, "theProfile must not be null or empty"); + Validate.notNull(theClass, "theProfile must not be null"); + myDefaultTypeForProfile.put(theProfile, theClass); + } /** * This feature is not yet in its final state and should be considered an internal part of HAPI for now - use with @@ -495,6 +565,14 @@ public class FhirContext { myParserErrorHandler = theParserErrorHandler; } + /** + * Set the restful client factory + * @param theRestfulClientFactory + */ + public void setRestfulClientFactory(IRestfulClientFactory theRestfulClientFactory) { + this.myRestfulClientFactory = theRestfulClientFactory; + } + @SuppressWarnings({ "cast" }) private List> toElementList(Collection> theResourceTypes) { if (theResourceTypes == null) { @@ -508,21 +586,28 @@ public class FhirContext { } /** - * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU1} + * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU1 DSTU1} */ public static FhirContext forDstu1() { return new FhirContext(FhirVersionEnum.DSTU1); } /** - * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2 DSTU 2} + * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2 DSTU2} */ public static FhirContext forDstu2() { return new FhirContext(FhirVersionEnum.DSTU2); } /** - * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU3 DSTU 3} + * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU2_HL7ORG DSTU2} (using the Reference Implementation Structures) + */ + public static FhirContext forDstu2Hl7Org() { + return new FhirContext(FhirVersionEnum.DSTU2_HL7ORG); + } + + /** + * Creates and returns a new FhirContext with version {@link FhirVersionEnum#DSTU3 DSTU3} * * @since 1.4 */ @@ -530,10 +615,6 @@ public class FhirContext { return new FhirContext(FhirVersionEnum.DSTU3); } - public static FhirContext forDstu2Hl7Org() { - return new FhirContext(FhirVersionEnum.DSTU2_HL7ORG); - } - private static Collection> toCollection(Class theResourceType) { ArrayList> retVal = new ArrayList>(1); retVal.add(theResourceType); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java index 257e09a8751..5494fb73e3f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/ModelScanner.java @@ -683,6 +683,14 @@ class ModelScanner { } } + Class builtInType = myNameToResourceType.get(resourceName.toLowerCase()); + boolean standardType = builtInType != null && builtInType.equals(theClass) == true; + if (primaryNameProvider) { + if (builtInType != null && builtInType.equals(theClass) == false) { + primaryNameProvider = false; + } + } + String resourceId = resourceDefinition.id(); if (!isBlank(resourceId)) { if (myIdToResourceDefinition.containsKey(resourceId)) { @@ -691,7 +699,7 @@ class ModelScanner { } } - RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition, isStandardType(theClass)); + RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition, standardType); myClassToElementDefinitions.put(theClass, resourceDef); if (primaryNameProvider) { if (resourceDef.getStructureVersion() == myVersion) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java index 5da65435cf6..ca2423bed30 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeResourceDefinition.java @@ -155,10 +155,6 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini return "Bundle".equals(getName()); } - public boolean isStandardProfile() { - return myResourceProfile.startsWith("http://hl7.org/fhir/profiles"); - } - @Override public void sealAndInitialize(FhirContext theContext, Map, BaseRuntimeElementDefinition> theClassToElementDefinitions) { super.sealAndInitialize(theContext, theClassToElementDefinitions); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java index 5b7bdad7ffc..f53354a8714 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IResource.java @@ -1,5 +1,7 @@ package ca.uhn.fhir.model.api; +import org.hl7.fhir.instance.model.api.IBaseMetaType; + /* * #%L * HAPI FHIR - Core Library @@ -62,6 +64,15 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode */ CodeDt getLanguage(); + /** + * Returns a view of the {@link #getResourceMetadata() resource metadata} map. + * Note that getters from this map return immutable objects, but the addFoo() + * and setFoo() methods may be used to modify metadata. + * + * @since 1.5 + */ + IBaseMetaType getMeta(); + /** * Returns the metadata map for this object, creating it if neccesary. Metadata entries are used to get/set feed bundle entries, such as the resource version, or the last updated timestamp. *

@@ -72,10 +83,23 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode */ ResourceMetadataMap getResourceMetadata(); + /** + * Returns a String representing the name of this Resource. This return value is not used for anything by HAPI itself, but is provided as a convenience to developers using the API. + * + * @return the name of this resource, e.g. "Patient", or "Observation" + */ + String getResourceName(); + + /** + * Returns the FHIR version represented by this structure + */ + @Override + public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum(); + /** * Returns the narrative block for this resource */ - BaseNarrativeDt getText(); + BaseNarrativeDt getText(); /** * Sets the ID of this resource. Note that this identifier is the URL (or a portion of the URL) used to access this resource, and is not the same thing as any business identifiers stored within the @@ -99,16 +123,4 @@ public interface IResource extends ICompositeElement, org.hl7.fhir.instance.mode */ void setResourceMetadata(ResourceMetadataMap theMap); - /** - * Returns a String representing the name of this Resource. This return value is not used for anything by HAPI itself, but is provided as a convenience to developers using the API. - * - * @return the name of this resource, e.g. "Patient", or "Observation" - */ - String getResourceName(); - - /** - * Returns the FHIR version represented by this structure - */ - public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum(); - } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Tag.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Tag.java index 1d6cc434055..0b8194850ee 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Tag.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Tag.java @@ -26,6 +26,7 @@ import java.net.URI; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import org.hl7.fhir.instance.model.api.IBaseCoding; /** * A single tag @@ -34,7 +35,7 @@ import org.apache.commons.lang3.builder.ToStringStyle; * {@link #getScheme() scheme} and *

*/ -public class Tag extends BaseElement implements IElement { +public class Tag extends BaseElement implements IElement, IBaseCoding { private static final long serialVersionUID = 1L; @@ -59,10 +60,6 @@ public class Tag extends BaseElement implements IElement { private String myScheme; private String myTerm; - /** - * @deprecated Tags will become immutable in a future release, so this constructor should not be used. - */ - @Deprecated public Tag() { } @@ -149,12 +146,7 @@ public class Tag extends BaseElement implements IElement { /** * Sets the label and returns a reference to this tag - * - * @deprecated Tags will become immutable in a future release of HAPI in order to facilitate - * ensuring that the TagList acts as an unordered set. Use the constructor to set this field when creating a new - * tag object */ - @Deprecated public Tag setLabel(String theLabel) { myLabel = theLabel; return this; @@ -162,12 +154,7 @@ public class Tag extends BaseElement implements IElement { /** * Sets the scheme and returns a reference to this tag - * - * @deprecated Tags will become immutable in a future release of HAPI in order to facilitate - * ensuring that the TagList acts as an unordered set. Use the constructor to set this field when creating a new - * tag object */ - @Deprecated public Tag setScheme(String theScheme) { myScheme = theScheme; return this; @@ -175,12 +162,7 @@ public class Tag extends BaseElement implements IElement { /** * Sets the term and returns a reference to this tag - * - * @deprecated Tags will become immutable in a future release of HAPI in order to facilitate - * ensuring that the TagList acts as an unordered set. Use the constructor to set this field when creating a new - * tag object */ - @Deprecated public Tag setTerm(String theTerm) { myTerm = theTerm; return this; @@ -207,4 +189,37 @@ public class Tag extends BaseElement implements IElement { return b.toString(); } + @Override + public String getCode() { + return getTerm(); + } + + @Override + public String getDisplay() { + return getLabel(); + } + + @Override + public String getSystem() { + return getScheme(); + } + + @Override + public IBaseCoding setCode(String theTerm) { + setTerm(myTerm); + return this; + } + + @Override + public IBaseCoding setDisplay(String theLabel) { + setLabel(theLabel); + return this; + } + + @Override + public IBaseCoding setSystem(String theScheme) { + setScheme(theScheme); + return this; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java index 2448198facc..6ab6988f0f9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/ResourceDef.java @@ -46,13 +46,17 @@ public @interface ResourceDef { * for the generated profile exported by the server. For example, if you set this value to * "hello" on a custom resource class, your server will automatically export a profile with the * identity: http://localhost:8080/fhir/Profile/hello (the base URL will be whatever - * your server uses, not necessarily "http://localhost:8080/fhir") + * your server uses, not necessarily "http://localhost:8080/fhir") */ String id() default ""; /** * The URL indicating the profile for this resource definition. If specified, this URL will be * automatically added to the meta tag when the resource is serialized. + *

+ * This URL should be fully qualified to indicate the complete URL of + * the profile being used, e.g. http://example.com/fhir/StructureDefiniton/some_profile + *

*/ String profile() default ""; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java index 0def8b3d987..61852608ab9 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java @@ -78,12 +78,14 @@ public abstract class BaseParser implements IParser { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseParser.class); - private IIdType myEncodeForceResourceId; private ContainedResources myContainedResources; private FhirContext myContext; + private Set myDontEncodeElements; + private boolean myDontEncodeElementsIncludesStars; private Set myEncodeElements; private Set myEncodeElementsAppliesToResourceTypes; private boolean myEncodeElementsIncludesStars; + private IIdType myEncodeForceResourceId; private IParserErrorHandler myErrorHandler; private boolean myOmitResourceId; private String myServerBaseUrl; @@ -91,10 +93,6 @@ public abstract class BaseParser implements IParser { private boolean mySummaryMode; private boolean mySuppressNarratives; - private Set myDontEncodeElements; - - private boolean myDontEncodeElementsIncludesStars; - /** * Constructor * @@ -439,6 +437,47 @@ public abstract class BaseParser implements IParser { return tags; } + @SuppressWarnings("deprecation") + protected > List getProfileTagsForEncoding(IBaseResource theResource, List theProfiles) { + switch (myContext.getAddProfileTagWhenEncoding()) { + case NEVER: + return theProfiles; + case ONLY_FOR_CUSTOM: + RuntimeResourceDefinition resDef = myContext.getResourceDefinition(theResource); + if (resDef.isStandardType()) { + return theProfiles; + } + break; + case ALWAYS: + break; + } + + if (myContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) { + RuntimeResourceDefinition nextDef = myContext.getResourceDefinition(theResource); + String profile = nextDef.getResourceProfile(myServerBaseUrl); + if (isNotBlank(profile)) { + for (T next : theProfiles) { + if (profile.equals(next.getValue())) { + return theProfiles; + } + } + + List newList = new ArrayList(); + newList.addAll(theProfiles); + + BaseRuntimeElementDefinition idElement = myContext.getElementDefinition("id"); + @SuppressWarnings("unchecked") + T newId = (T) idElement.newInstance(); + newId.setValue(profile); + + newList.add(newId); + return newList; + } + } + + return theProfiles; + } + /** * If set to true (default is false), narratives will not be included in the encoded * values. @@ -595,6 +634,17 @@ public abstract class BaseParser implements IParser { filterCodingsWithNoCodeOrSystem(metaValue.getTag()); filterCodingsWithNoCodeOrSystem(metaValue.getSecurity()); + List> newProfileList = getProfileTagsForEncoding(theResource, metaValue.getProfile()); + List> oldProfileList = metaValue.getProfile(); + if (oldProfileList != newProfileList) { + oldProfileList.clear(); + for (IPrimitiveType next : newProfileList) { + if (isNotBlank(next.getValue())) { + metaValue.addProfile(next.getValue()); + } + } + } + if (shouldAddSubsettedTag()) { IBaseCoding coding = metaValue.addTag(); coding.setCode(Constants.TAG_SUBSETTED_CODE); @@ -748,11 +798,11 @@ public abstract class BaseParser implements IParser { } protected static List extractMetadataListNotNull(IResource resource, ResourceMetadataKeyEnum> key) { - List securityLabels = key.get(resource); + List securityLabels = key.get(resource); if (securityLabels == null) { securityLabels = Collections.emptyList(); } - return securityLabels; + return new ArrayList(securityLabels); } static boolean hasExtensions(IBase theElement) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java index 2febfef1b11..fc1a0b69fc0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java @@ -104,7 +104,7 @@ public interface IParser { boolean isOmitResourceId(); /** - * If set to true (which is the default), resource references containing a version + * If set to true (which is the default), resource references containing a version * will have the version removed when the resource is encoded. This is generally good behaviour because * in most situations, references from one resource to another should be to the resource by ID, not * by ID and version. In some cases though, it may be desirable to preserve the version in resource @@ -222,12 +222,13 @@ public interface IParser { *
  • Patient - Don't encode patient and all its children
  • *
  • Patient.name - Don't encode the patient's name
  • *
  • Patient.name.family - Don't encode the patient's family name
  • - *
  • *.text - Don't encode the text element on any resource (only the very first position may contain a wildcard)
  • + *
  • *.text - Don't encode the text element on any resource (only the very first position may contain a + * wildcard)
  • * *

    * DSTU2 note: Note that values including meta, such as Patient.meta * will work for DSTU2 parsers, but values with subelements on meta such - * as Patient.meta.lastUpdated will only work in + * as Patient.meta.lastUpdated will only work in * DSTU3+ mode. *

    * @@ -244,7 +245,8 @@ public interface IParser { *
  • Patient - Encode patient and all its children
  • *
  • Patient.name - Encode only the patient's name
  • *
  • Patient.name.family - Encode only the patient's family name
  • - *
  • *.text - Encode the text element on any resource (only the very first position may contain a wildcard)
  • + *
  • *.text - Encode the text element on any resource (only the very first position may contain a + * wildcard)
  • * * * @param theEncodeElements @@ -308,7 +310,7 @@ public interface IParser { IParser setServerBaseUrl(String theUrl); /** - * If set to true (which is the default), resource references containing a version + * If set to true (which is the default), resource references containing a version * will have the version removed when the resource is encoded. This is generally good behaviour because * in most situations, references from one resource to another should be to the resource by ID, not * by ID and version. In some cases though, it may be desirable to preserve the version in resource @@ -316,7 +318,7 @@ public interface IParser { * * @param theStripVersionsFromReferences * Set this to false to prevent the parser from removing - * resource versions from references. + * resource versions from references. * @return Returns a reference to this parser so that method calls can be chained together */ IParser setStripVersionsFromReferences(boolean theStripVersionsFromReferences); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java index b3adfa8795e..7522f4b17f3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java @@ -838,7 +838,9 @@ public class JsonParser extends BaseParser implements IParser { // Object securityLabelRawObj = List securityLabels = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.SECURITY_LABELS); - List profiles = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.PROFILES); + List profiles = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.PROFILES); + profiles = super.getProfileTagsForEncoding(resource, profiles); + TagList tags = getMetaTagsForEncoding(resource); InstantDt updated = (InstantDt) resource.getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED); IdDt resourceId = resource.getId(); @@ -854,7 +856,7 @@ public class JsonParser extends BaseParser implements IParser { if (profiles != null && profiles.isEmpty() == false) { theEventWriter.writeStartArray("profile"); - for (IdDt profile : profiles) { + for (IIdType profile : profiles) { if (profile != null && isNotBlank(profile.getValue())) { theEventWriter.write(profile.getValue()); } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index b5eb1057d63..12504caaf71 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -43,6 +43,7 @@ import org.hl7.fhir.instance.model.api.IBaseElement; import org.hl7.fhir.instance.model.api.IBaseExtension; import org.hl7.fhir.instance.model.api.IBaseHasExtensions; import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions; +import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IBaseReference; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseXhtml; @@ -1433,6 +1434,11 @@ class ParserState { } + @Override + protected void populateTarget() { + // nothing + } + } private class ContainedResourcesStateHl7Org extends PreResourceState { @@ -1464,6 +1470,11 @@ class ParserState { def.getChildByName("contained").getMutator().addValue(preResCurrentElement, res); } + @Override + protected void populateTarget() { + // nothing + } + } private class DeclaredExtensionState extends BaseState { @@ -1969,6 +1980,8 @@ class ParserState { } } + protected abstract void populateTarget(); + public PreResourceState(PreResourceState thePreResourcesState, FhirVersionEnum theParentVersion) { super(thePreResourcesState); Validate.notNull(theParentVersion); @@ -2045,6 +2058,40 @@ class ParserState { public void wereBack() { final boolean bundle = "Bundle".equals(myContext.getResourceDefinition(myInstance).getName()); + if (myContext.hasDefaultTypeForProfile()) { + IBaseMetaType meta = myInstance.getMeta(); + Class wantedProfileType = null; + String usedProfile = null; + for (IPrimitiveType next : meta.getProfile()) { + if (isNotBlank(next.getValue())) { + wantedProfileType = myContext.getDefaultTypeForProfile(next.getValue()); + if (wantedProfileType != null) { + usedProfile = next.getValue(); + break; + } + } + } + + if (wantedProfileType != null && !wantedProfileType.equals(myInstance.getClass())) { + if (myResourceType == null || myResourceType.isAssignableFrom(wantedProfileType)) { + ourLog.debug("Converting resource of type {} to type defined for profile \"{}\": {}", new Object[] {myInstance.getClass().getName(), usedProfile, wantedProfileType}); + + /* + * This isn't the most efficient thing really.. If we want a specific + * type we just re-parse into that type. The problem is that we don't know + * until we've parsed the resource which type we want to use because the + * profile declarations are in the text of the resource itself. + * + * At some point it would be good to write code which can present a view + * of one type backed by another type and use that. + */ + IParser parser = myContext.newJsonParser(); + String asString = parser.encodeResourceToString(myInstance); + myInstance = parser.parseResource(wantedProfileType, asString); + } + } + } + FhirTerser terser = myContext.newTerser(); terser.visit(myInstance, new IModelVisitor() { @@ -2114,6 +2161,7 @@ class ParserState { } + populateTarget(); } } @@ -2141,14 +2189,19 @@ class ParserState { assert theResourceType == null || IResource.class.isAssignableFrom(theResourceType); } +// @Override +// public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException { +// super.enteringNewElement(theNamespaceUri, theLocalPart); +// populateTarget(); +// } + @Override - public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException { - super.enteringNewElement(theNamespaceUri, theLocalPart); + protected void populateTarget() { if (myEntry != null) { myEntry.setResource((IResource) getCurrentElement()); } if (myMutator != null) { - myMutator.addValue(myTarget, getCurrentElement()); + myMutator.setValue(myTarget, getCurrentElement()); } } @@ -2192,10 +2245,9 @@ class ParserState { } @Override - public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException { - super.enteringNewElement(theNamespaceUri, theLocalPart); + protected void populateTarget() { if (myMutator != null) { - myMutator.addValue(myTarget, getCurrentElement()); + myMutator.setValue(myTarget, getCurrentElement()); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java index 1b87f3e46c2..aebe2ad0d1f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java @@ -132,16 +132,6 @@ public class XmlParser extends BaseParser implements IParser { } catch (XMLStreamException e1) { throw new DataFormatException(e1); } - - // XMLEventReader streamReader; - // try { - // streamReader = myXmlInputFactory.createXMLEventReader(theReader); - // } catch (XMLStreamException e) { - // throw new DataFormatException(e); - // } catch (FactoryConfigurationError e) { - // throw new ConfigurationException("Failed to initialize STaX event factory", e); - // } - // return streamReader; } private XMLStreamWriter createXmlWriter(Writer theWriter) throws XMLStreamException { @@ -433,8 +423,6 @@ public class XmlParser extends BaseParser implements IParser { theEventWriter.writeEndElement(); } - String bundleBaseUrl = theBundle.getLinkBase().getValue(); - writeOptionalTagWithValue(theEventWriter, "type", theBundle.getType().getValue()); writeOptionalTagWithValue(theEventWriter, "total", theBundle.getTotalResults().getValueAsString()); @@ -841,7 +829,9 @@ public class XmlParser extends BaseParser implements IParser { versionIdPart = ResourceMetadataKeyEnum.VERSION.get(resource); } List securityLabels = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.SECURITY_LABELS); - List profiles = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.PROFILES); + List profiles = extractMetadataListNotNull(resource, ResourceMetadataKeyEnum.PROFILES); + profiles = super.getProfileTagsForEncoding(resource, profiles); + TagList tags = getMetaTagsForEncoding((resource)); if (super.shouldEncodeResourceMeta(resource) && ElementUtil.isEmpty(versionIdPart, updated, securityLabels, tags, profiles) == false) { @@ -851,7 +841,7 @@ public class XmlParser extends BaseParser implements IParser { writeOptionalTagWithValue(theEventWriter, "lastUpdated", updated.getValueAsString()); } - for (IdDt profile : profiles) { + for (IIdType profile : profiles) { theEventWriter.writeStartElement("profile"); theEventWriter.writeAttribute("value", profile.getValue()); theEventWriter.writeEndElement(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/AddProfileTagEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/AddProfileTagEnum.java index 1d7f0c9d558..5c491d7f530 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/AddProfileTagEnum.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/AddProfileTagEnum.java @@ -1,5 +1,7 @@ package ca.uhn.fhir.rest.server; +import ca.uhn.fhir.context.FhirContext; + /* * #%L * HAPI FHIR - Core Library @@ -21,9 +23,9 @@ package ca.uhn.fhir.rest.server; */ /** - * RESTful server behaviour for automatically adding profile tags + * RESTful server behaviour for automatically adding profile tags when serializing resources * - * @see RestfulServer#setAddProfileTag(AddProfileTagEnum) + * @see FhirContext#setAddProfileTagWhenEncoding(AddProfileTagEnum) */ public enum AddProfileTagEnum { /** @@ -33,7 +35,13 @@ public enum AddProfileTagEnum { /** * Add any profile tags that returned resources appear to conform to + * + * @deprecated This mode causes even FHIR's default profiles to be exported in the + * resource metadata section. This is not generally expected behaviour from other + * systems and it offers no real benefit, so it will be removed at some point. This + * option was deprecated in HAPI 1.5 */ + @Deprecated ALWAYS, /** diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java index f42e8e76dcf..6df22aeeee0 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IRestfulServerDefaults.java @@ -48,7 +48,9 @@ public interface IRestfulServerDefaults { /** * @return Returns the setting for automatically adding profile tags + * @deprecated As of HAPI FHIR 1.5, this property has been moved to {@link FhirContext#setAddProfileTagWhenEncoding(AddProfileTagEnum)} */ + @Deprecated AddProfileTagEnum getAddProfileTag(); /** diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java index a6e29eb87d9..657297e7407 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/IVersionSpecificBundleFactory.java @@ -40,7 +40,7 @@ public interface IVersionSpecificBundleFactory { void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theCompleteUrl, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated); - void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, + void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theCount, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes); Bundle getDstu1Bundle(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java index be0f9944315..4438d602487 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java @@ -74,6 +74,7 @@ import ca.uhn.fhir.rest.server.interceptor.ExceptionHandlingInterceptor; import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor; import ca.uhn.fhir.rest.server.interceptor.ResponseHighlighterInterceptor; import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails; +import ca.uhn.fhir.util.CoverageIgnore; import ca.uhn.fhir.util.ReflectionUtil; import ca.uhn.fhir.util.UrlUtil; import ca.uhn.fhir.util.VersionUtil; @@ -93,7 +94,6 @@ public class RestfulServer extends HttpServlet implements IRestfulServer 0 && (nextString.charAt(0) == '_' || nextString.charAt(0) == '$' || nextString.equals(Constants.URL_TOKEN_METADATA)); } + /** + * @deprecated As of HAPI FHIR 1.5, this property has been moved to {@link FhirContext#setAddProfileTagWhenEncoding(AddProfileTagEnum)} + */ + @Override + @Deprecated + public AddProfileTagEnum getAddProfileTag() { + return myFhirContext.getAddProfileTagWhenEncoding(); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java index 52e3e84bffa..5cd377a204b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.io.Writer; import java.net.URLEncoder; -import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; @@ -49,15 +48,12 @@ import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.FhirVersionEnum; -import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.api.Tag; import ca.uhn.fhir.model.api.TagList; -import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.valueset.BundleTypeEnum; import ca.uhn.fhir.parser.IParser; @@ -77,36 +73,6 @@ public class RestfulServerUtils { private static final HashSet TEXT_ENCODE_ELEMENTS = new HashSet(Arrays.asList("Bundle", "*.text")); - public static void addProfileToBundleEntry(FhirContext theContext, IBaseResource theResource, String theServerBase) { - if (theResource instanceof IResource) { - if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) { - RuntimeResourceDefinition nextDef = theContext.getResourceDefinition(theResource); - String profile = nextDef.getResourceProfile(theServerBase); - if (isNotBlank(profile)) { - List newList = new ArrayList(); - List existingList = ResourceMetadataKeyEnum.PROFILES.get((IResource) theResource); - if (existingList != null) { - newList.addAll(existingList); - } - newList.add(new IdDt(profile)); - ResourceMetadataKeyEnum.PROFILES.put((IResource) theResource, newList); - } - } else { - TagList tl = ResourceMetadataKeyEnum.TAG_LIST.get((IResource) theResource); - if (tl == null) { - tl = new TagList(); - ResourceMetadataKeyEnum.TAG_LIST.put((IResource) theResource, tl); - } - - RuntimeResourceDefinition nextDef = theContext.getResourceDefinition(theResource); - String profile = nextDef.getResourceProfile(theServerBase); - if (isNotBlank(profile)) { - tl.add(new Tag(Tag.HL7_ORG_PROFILE_TAG, profile, null)); - } - } - } - } - public static void configureResponseParser(RequestDetails theRequestDetails, IParser parser) { // Pretty print boolean prettyPrint = RestfulServerUtils.prettyPrintResponse(theRequestDetails.getServer(), theRequestDetails); @@ -608,13 +574,6 @@ public class RestfulServerUtils { } } - if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(theResource); - if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { - addProfileToBundleEntry(theServer.getFhirContext(), theResource, serverBase); - } - } - String contentType; if (theResource instanceof IBaseBinary && responseEncoding == null) { IBaseBinary bin = (IBaseBinary) theResource; diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java index da06a0eebda..c36c8312ee0 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IAnyResource.java @@ -55,8 +55,6 @@ public interface IAnyResource extends IBaseResource { IPrimitiveType getLanguageElement(); - IBaseMetaType getMeta(); - public Object getUserData(String name); @Override diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java index 26553bd09d1..86deb2d4a0b 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IBaseResource.java @@ -39,6 +39,8 @@ import ca.uhn.fhir.model.api.Include; */ public interface IBaseResource extends IBase, IElement { + IBaseMetaType getMeta(); + /** * Include constant for * (return all includes) */ diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java index 2da4f1eee73..99989b2ccfe 100644 --- a/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java +++ b/hapi-fhir-base/src/main/java/org/hl7/fhir/instance/model/api/IIdType.java @@ -32,7 +32,7 @@ package org.hl7.fhir.instance.model.api; * which version of the strctures your application is using. *

    */ -public interface IIdType extends IBase { +public interface IIdType extends IPrimitiveType { void applyTo(IBaseResource theResource); diff --git a/hapi-fhir-structures-dstu/.classpath b/hapi-fhir-structures-dstu/.classpath index 44260d68296..5b517aa32bb 100644 --- a/hapi-fhir-structures-dstu/.classpath +++ b/hapi-fhir-structures-dstu/.classpath @@ -36,5 +36,5 @@
    - + diff --git a/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/resource/BaseResource.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/resource/BaseResource.java index 635a6ba6149..204e873a236 100644 --- a/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/resource/BaseResource.java +++ b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/model/dstu/resource/BaseResource.java @@ -1,5 +1,10 @@ package ca.uhn.fhir.model.dstu.resource; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + /* * #%L * HAPI FHIR Structures - DSTU1 (FHIR v0.80) @@ -23,35 +28,31 @@ package ca.uhn.fhir.model.dstu.resource; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import org.hl7.fhir.instance.model.api.IBaseCoding; +import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IIdType; +import org.hl7.fhir.instance.model.api.IPrimitiveType; import ca.uhn.fhir.model.api.BaseElement; import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; +import ca.uhn.fhir.model.api.Tag; +import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; +import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.resource.ResourceMetadataMap; +import ca.uhn.fhir.model.dstu.composite.CodingDt; import ca.uhn.fhir.model.dstu.composite.ContainedDt; import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.rest.gclient.StringClientParam; import ca.uhn.fhir.util.ElementUtil; public abstract class BaseResource extends BaseElement implements IResource { - /** - * Search parameter constant for _language - */ - @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" ) - public static final String SP_RES_LANGUAGE = "_language"; - - - /** - * Search parameter constant for _id - */ - @SearchParamDefinition(name="_id", path="", description="The ID of the resource", type="string" ) - public static final String SP_RES_ID = "_id"; - /** * Fluent Client search parameter constant for _id *

    @@ -63,9 +64,24 @@ public abstract class BaseResource extends BaseElement implements IResource { public static final StringClientParam RES_ID = new StringClientParam(BaseResource.SP_RES_ID); + /** + * Search parameter constant for _id + */ + @SearchParamDefinition(name="_id", path="", description="The ID of the resource", type="string" ) + public static final String SP_RES_ID = "_id"; + + /** + * Search parameter constant for _language + */ + @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" ) + public static final String SP_RES_LANGUAGE = "_language"; + + + @Child(name = "contained", order = 2, min = 0, max = 1) private ContainedDt myContained; + private IdDt myId; @Child(name = "language", order = 0, min = 0, max = Child.MAX_UNLIMITED) @@ -104,6 +120,216 @@ public abstract class BaseResource extends BaseElement implements IResource { return myLanguage; } + @Override + public IBaseMetaType getMeta() { + return new IBaseMetaType() { + + private static final long serialVersionUID = 1L; + + @Override + public IBaseMetaType addProfile(String theProfile) { + ArrayList newTagList = new ArrayList(); + List existingTagList = ResourceMetadataKeyEnum.PROFILES.get(BaseResource.this); + if (existingTagList != null) { + newTagList.addAll(existingTagList); + } + ResourceMetadataKeyEnum.PROFILES.put(BaseResource.this, newTagList); + + IdDt tag = new IdDt(theProfile); + newTagList.add(tag); + return this; + } + + @Override + public IBaseCoding addSecurity() { + List tagList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(BaseResource.this); + if (tagList == null) { + tagList = new ArrayList(); + ResourceMetadataKeyEnum.SECURITY_LABELS.put(BaseResource.this, tagList); + } + CodingDt tag = new CodingDt(); + tagList.add(tag); + return asBaseCoding(tag); + } + + @Override + public IBaseCoding addTag() { + TagList tagList = ResourceMetadataKeyEnum.TAG_LIST.get(BaseResource.this); + if (tagList == null) { + tagList = new TagList(); + ResourceMetadataKeyEnum.TAG_LIST.put(BaseResource.this, tagList); + } + Tag tag = new Tag(); + tagList.add(tag); + return tag; + } + + /** + * This view is used because the old DSTU1 BaseCodingDt can't implements IBaseCoding + */ + private IBaseCoding asBaseCoding(final BaseCodingDt theCoding) { + return new IBaseCoding() { + private static final long serialVersionUID = 1L; + + @Override + public String getCode() { + return theCoding.getCodeElement().getValue(); + } + + @Override + public String getDisplay() { + return theCoding.getDisplayElement().getValue(); + } + + @Override + public List getFormatCommentsPost() { + return Collections.emptyList(); + } + + @Override + public List getFormatCommentsPre() { + return Collections.emptyList(); + } + + @Override + public String getSystem() { + return theCoding.getSystemElement().getValue(); + } + + @Override + public boolean hasFormatComment() { + return false; + } + + @Override + public boolean isEmpty() { + return ElementUtil.isEmpty(getSystem(), getCode(), getDisplay()); + } + + @Override + public IBaseCoding setCode(String theTerm) { + theCoding.setCode(theTerm); + return this; + } + + @Override + public IBaseCoding setDisplay(String theLabel) { + theCoding.setDisplay(theLabel); + return this; + } + + @Override + public IBaseCoding setSystem(String theScheme) { + theCoding.setSystem(theScheme); + return this; + } + }; + } + + @Override + public List getFormatCommentsPost() { + return Collections.emptyList(); + } + + @Override + public List getFormatCommentsPre() { + return Collections.emptyList(); + } + + @Override + public Date getLastUpdated() { + InstantDt lu = ResourceMetadataKeyEnum.UPDATED.get(BaseResource.this); + if (lu != null) { + return lu.getValue(); + } + return null; + } + + @Override + public List> getProfile() { + ArrayList> retVal = new ArrayList>(); + List profilesList = ResourceMetadataKeyEnum.PROFILES.get(BaseResource.this); + if (profilesList == null) { + return Collections.emptyList(); + } + for (IdDt next : profilesList) { + retVal.add(next); + } + return Collections.unmodifiableList(retVal); + } + + @Override + public List getSecurity() { + ArrayList retVal = new ArrayList(); + List labelsList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(BaseResource.this); + if (labelsList == null) { + return Collections.emptyList(); + } + for (BaseCodingDt next : labelsList) { + retVal.add(asBaseCoding(next)); + } + return Collections.unmodifiableList(retVal); + } + + @Override + public IBaseCoding getSecurity(String theSystem, String theCode) { + for (BaseCodingDt next : ResourceMetadataKeyEnum.SECURITY_LABELS.get(BaseResource.this)) { + if (theSystem.equals(next.getSystemElement().getValue()) && theCode.equals(next.getCodeElement().getValue())) { + return asBaseCoding(next); + } + } + return null; + } + + @Override + public List getTag() { + ArrayList retVal = new ArrayList(); + for (Tag next : ResourceMetadataKeyEnum.TAG_LIST.get(BaseResource.this)) { + retVal.add(next); + } + return Collections.unmodifiableList(retVal); + } + + @Override + public IBaseCoding getTag(String theSystem, final String theCode) { + for (final Tag next : ResourceMetadataKeyEnum.TAG_LIST.get(BaseResource.this)) { + if (next.getScheme().equals(theSystem) && next.getTerm().equals(theCode)) { + return next; + } + } + return null; + } + + @Override + public String getVersionId() { + return getId().getVersionIdPart(); + } + + @Override + public boolean hasFormatComment() { + return false; + } + + @Override + public boolean isEmpty() { + return getResourceMetadata().isEmpty(); + } + + @Override + public IBaseMetaType setLastUpdated(Date theHeaderDateValue) { + ResourceMetadataKeyEnum.UPDATED.put(BaseResource.this, new InstantDt(theHeaderDateValue)); + return this; + } + + + @Override + public IBaseMetaType setVersionId(String theVersionId) { + setId(getId().withVersion(theVersionId)); + return this; + } + }; + } + @Override public ResourceMetadataMap getResourceMetadata() { if (myResourceMetadata == null) { @@ -120,10 +346,23 @@ public abstract class BaseResource extends BaseElement implements IResource { return myText; } + /** + * Intended to be called by extending classes {@link #isEmpty()} implementations, returns true if all + * content in this superclass instance is empty per the semantics of {@link #isEmpty()}. + */ + @Override + protected boolean isBaseEmpty() { + return super.isBaseEmpty() && ElementUtil.isEmpty(myLanguage, myText, myId); + } + public void setContained(ContainedDt theContained) { myContained = theContained; } + public void setId(IdDt theId) { + myId = theId; + } + public BaseResource setId(IIdType theId) { if (theId instanceof IdDt) { myId = (IdDt) theId; @@ -133,10 +372,6 @@ public abstract class BaseResource extends BaseElement implements IResource { return this; } - public void setId(IdDt theId) { - myId = theId; - } - public BaseResource setId(String theId) { if (theId == null) { myId = null; @@ -168,13 +403,4 @@ public abstract class BaseResource extends BaseElement implements IResource { return b.toString(); } - /** - * Intended to be called by extending classes {@link #isEmpty()} implementations, returns true if all - * content in this superclass instance is empty per the semantics of {@link #isEmpty()}. - */ - @Override - protected boolean isBaseEmpty() { - return super.isBaseEmpty() && ElementUtil.isEmpty(myLanguage, myText, myId); - } - } diff --git a/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java index 497158a65ce..70c8ee75201 100644 --- a/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java +++ b/hapi-fhir-structures-dstu/src/main/java/ca/uhn/fhir/rest/server/Dstu1BundleFactory.java @@ -19,8 +19,7 @@ package ca.uhn.fhir.rest.server; * limitations under the License. * #L% */ - -import static org.apache.commons.lang3.StringUtils.*; +import static org.apache.commons.lang3.StringUtils.isNotBlank; import java.util.ArrayList; import java.util.Date; @@ -29,7 +28,6 @@ import java.util.List; import java.util.Set; import java.util.UUID; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.Validate; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; @@ -43,6 +41,8 @@ import ca.uhn.fhir.model.api.BundleEntry; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; +import ca.uhn.fhir.model.api.Tag; +import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; import ca.uhn.fhir.model.primitive.IdDt; @@ -53,7 +53,6 @@ import ca.uhn.fhir.util.ResourceReferenceInfo; public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Dstu1BundleFactory.class); private Bundle myBundle; private FhirContext myContext; @@ -186,7 +185,7 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, + public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { int numToReturn; String searchId = null; @@ -224,17 +223,12 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)"); } } - } - - if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - for (IBaseResource nextRes : resourceList) { - RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); - if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { - RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); - } + if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { + addProfileIfNeeded(theServer, theServerBase, next); } } + addResourcesToBundle(new ArrayList(resourceList), theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType, theResult.getPublished()); @@ -256,6 +250,23 @@ public class Dstu1BundleFactory implements IVersionSpecificBundleFactory { } } + private void addProfileIfNeeded(IRestfulServer theServer, String theServerBase, IBaseResource nextRes) { + RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); + if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardType()) { + TagList tl = ResourceMetadataKeyEnum.TAG_LIST.get((IResource) nextRes); + if (tl == null) { + tl = new TagList(); + ResourceMetadataKeyEnum.TAG_LIST.put((IResource) nextRes, tl); + } + + RuntimeResourceDefinition nextDef = myContext.getResourceDefinition(nextRes); + String profile = nextDef.getResourceProfile(theServerBase); + if (isNotBlank(profile)) { + tl.add(new Tag(Tag.HL7_ORG_PROFILE_TAG, profile, null)); + } + } + } + @Override public void initializeBundleFromResourceList(String theAuthor, List theResult, String theServerBase, String theCompleteUrl, int theTotalResults, BundleTypeEnum theBundleType) { diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/CustomTypeTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/CustomTypeTest.java index 2b1007f994d..52b1e1fe4ff 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/CustomTypeTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/CustomTypeTest.java @@ -214,9 +214,6 @@ public class CustomTypeTest { private static boolean ourReturnExtended = false; - /** - * Created by dsotnikov on 2/25/2014. - */ public static class DummyPatientResourceProvider implements IResourceProvider { @Search diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ServerInvalidDefinitionTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ServerInvalidDefinitionTest.java index fc3915e1084..7218391e99d 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ServerInvalidDefinitionTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/server/ServerInvalidDefinitionTest.java @@ -7,6 +7,7 @@ import java.util.List; import javax.servlet.ServletException; import org.hamcrest.core.StringContains; +import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.junit.Test; @@ -299,6 +300,12 @@ public class ServerInvalidDefinitionTest { public List getFormatCommentsPost() { return null; } + + @Override + public IBaseMetaType getMeta() { + // TODO Auto-generated method stub + return null; + } }.getClass(); } diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java index 9ba59492d45..b485f292099 100644 --- a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java @@ -1,5 +1,10 @@ package ca.uhn.fhir.model.dstu2.resource; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Date; +import java.util.List; + /* * #%L * HAPI FHIR Structures - DSTU2 (FHIR v1.0.0) @@ -23,35 +28,31 @@ package ca.uhn.fhir.model.dstu2.resource; import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; +import org.hl7.fhir.instance.model.api.IBaseCoding; +import org.hl7.fhir.instance.model.api.IBaseMetaType; import org.hl7.fhir.instance.model.api.IIdType; +import org.hl7.fhir.instance.model.api.IPrimitiveType; import ca.uhn.fhir.model.api.BaseElement; import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; +import ca.uhn.fhir.model.api.Tag; +import ca.uhn.fhir.model.api.TagList; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; +import ca.uhn.fhir.model.base.composite.BaseCodingDt; import ca.uhn.fhir.model.base.resource.ResourceMetadataMap; +import ca.uhn.fhir.model.dstu2.composite.CodingDt; import ca.uhn.fhir.model.dstu2.composite.ContainedDt; import ca.uhn.fhir.model.dstu2.composite.NarrativeDt; import ca.uhn.fhir.model.primitive.CodeDt; import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.rest.gclient.StringClientParam; import ca.uhn.fhir.util.ElementUtil; public abstract class BaseResource extends BaseElement implements IResource { - /** - * Search parameter constant for _language - */ - @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" ) - public static final String SP_RES_LANGUAGE = "_language"; - - - /** - * Search parameter constant for _id - */ - @SearchParamDefinition(name="_id", path="", description="The ID of the resource", type="string" ) - public static final String SP_RES_ID = "_id"; - /** * Fluent Client search parameter constant for _id *

    @@ -61,11 +62,24 @@ public abstract class BaseResource extends BaseElement implements IResource { *

    */ public static final StringClientParam RES_ID = new StringClientParam(BaseResource.SP_RES_ID); + + /** + * Search parameter constant for _id + */ + @SearchParamDefinition(name="_id", path="", description="The ID of the resource", type="string" ) + public static final String SP_RES_ID = "_id"; + /** + * Search parameter constant for _language + */ + @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" ) + public static final String SP_RES_LANGUAGE = "_language"; + @Child(name = "contained", order = 2, min = 0, max = 1) private ContainedDt myContained; + private IdDt myId; @Child(name = "language", order = 0, min = 0, max = Child.MAX_UNLIMITED) @@ -104,6 +118,157 @@ public abstract class BaseResource extends BaseElement implements IResource { return myLanguage; } + @Override + public IBaseMetaType getMeta() { + return new IBaseMetaType() { + + private static final long serialVersionUID = 1L; + + @Override + public IBaseMetaType addProfile(String theProfile) { + ArrayList newTagList = new ArrayList(); + List existingTagList = ResourceMetadataKeyEnum.PROFILES.get(BaseResource.this); + if (existingTagList != null) { + newTagList.addAll(existingTagList); + } + ResourceMetadataKeyEnum.PROFILES.put(BaseResource.this, newTagList); + + IdDt tag = new IdDt(theProfile); + newTagList.add(tag); + return this; + } + + @Override + public IBaseCoding addSecurity() { + List tagList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(BaseResource.this); + if (tagList == null) { + tagList = new ArrayList(); + ResourceMetadataKeyEnum.SECURITY_LABELS.put(BaseResource.this, tagList); + } + CodingDt tag = new CodingDt(); + tagList.add(tag); + return tag; + } + + @Override + public IBaseCoding addTag() { + TagList tagList = ResourceMetadataKeyEnum.TAG_LIST.get(BaseResource.this); + if (tagList == null) { + tagList = new TagList(); + ResourceMetadataKeyEnum.TAG_LIST.put(BaseResource.this, tagList); + } + Tag tag = new Tag(); + tagList.add(tag); + return tag; + } + + @Override + public List getFormatCommentsPost() { + return Collections.emptyList(); + } + + @Override + public List getFormatCommentsPre() { + return Collections.emptyList(); + } + + @Override + public Date getLastUpdated() { + InstantDt lu = ResourceMetadataKeyEnum.UPDATED.get(BaseResource.this); + if (lu != null) { + return lu.getValue(); + } + return null; + } + + @Override + public List> getProfile() { + ArrayList> retVal = new ArrayList>(); + List profilesList = ResourceMetadataKeyEnum.PROFILES.get(BaseResource.this); + if (profilesList == null) { + return Collections.emptyList(); + } + for (IdDt next : profilesList) { + retVal.add(next); + } + return Collections.unmodifiableList(retVal); + } + + @Override + public List getSecurity() { + ArrayList retVal = new ArrayList(); + List labelsList = ResourceMetadataKeyEnum.SECURITY_LABELS.get(BaseResource.this); + if (labelsList == null) { + return Collections.emptyList(); + } + for (BaseCodingDt next : labelsList) { + retVal.add(new CodingDt(next.getSystemElement().getValue(), next.getCodeElement().getValue()).setDisplay(next.getDisplayElement().getValue())); + } + return Collections.unmodifiableList(retVal); + } + + @Override + public IBaseCoding getSecurity(String theSystem, String theCode) { + for (IBaseCoding next : getSecurity()) { + if (theSystem.equals(next.getSystem()) && theCode.equals(next.getCode())) { + return next; + } + } + return null; + } + + @Override + public List getTag() { + ArrayList retVal = new ArrayList(); + TagList tagList = ResourceMetadataKeyEnum.TAG_LIST.get(BaseResource.this); + if (tagList == null) { + return Collections.emptyList(); + } + for (Tag next : tagList) { + retVal.add(next); + } + return Collections.unmodifiableList(retVal); + } + + @Override + public IBaseCoding getTag(String theSystem, String theCode) { + for (IBaseCoding next : getTag()) { + if (next.getSystem().equals(theSystem) && next.getCode().equals(theCode)) { + return next; + } + } + return null; + } + + @Override + public String getVersionId() { + return getId().getVersionIdPart(); + } + + @Override + public boolean hasFormatComment() { + return false; + } + + @Override + public boolean isEmpty() { + return getResourceMetadata().isEmpty(); + } + + @Override + public IBaseMetaType setLastUpdated(Date theHeaderDateValue) { + ResourceMetadataKeyEnum.UPDATED.put(BaseResource.this, new InstantDt(theHeaderDateValue)); + return this; + } + + @Override + public IBaseMetaType setVersionId(String theVersionId) { + setId(getId().withVersion(theVersionId)); + return this; + } + }; + } + @Override public ResourceMetadataMap getResourceMetadata() { if (myResourceMetadata == null) { @@ -120,14 +285,23 @@ public abstract class BaseResource extends BaseElement implements IResource { return myText; } + /** + * Intended to be called by extending classes {@link #isEmpty()} implementations, returns true if all + * content in this superclass instance is empty per the semantics of {@link #isEmpty()}. + */ + @Override + protected boolean isBaseEmpty() { + return super.isBaseEmpty() && ElementUtil.isEmpty(myLanguage, myText, myId); + } + public void setContained(ContainedDt theContained) { myContained = theContained; } - + public void setId(IdDt theId) { myId = theId; } - + public BaseResource setId(IIdType theId) { if (theId instanceof IdDt) { myId = (IdDt) theId; @@ -168,13 +342,4 @@ public abstract class BaseResource extends BaseElement implements IResource { return b.toString(); } - /** - * Intended to be called by extending classes {@link #isEmpty()} implementations, returns true if all - * content in this superclass instance is empty per the semantics of {@link #isEmpty()}. - */ - @Override - protected boolean isBaseEmpty() { - return super.isBaseEmpty() && ElementUtil.isEmpty(myLanguage, myText, myId); - } - } diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java index 1166129d8b3..90fa7224a75 100644 --- a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java +++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java @@ -35,7 +35,6 @@ import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; @@ -51,7 +50,6 @@ import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum; import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum; import ca.uhn.fhir.model.valueset.BundleTypeEnum; -import ca.uhn.fhir.rest.server.AddProfileTagEnum; import ca.uhn.fhir.rest.server.BundleInclusionRule; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.EncodingEnum; @@ -65,7 +63,6 @@ import ca.uhn.fhir.util.ResourceReferenceInfo; public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Dstu2BundleFactory.class); private Bundle myBundle; private FhirContext myContext; private String myBase; @@ -302,7 +299,7 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, + public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { myBase = theServerBase; @@ -352,15 +349,6 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory { } } - if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - for (IBaseResource nextRes : resourceList) { - RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); - if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { - RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); - } - } - } - addResourcesToBundle(new ArrayList(resourceList), theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType, theResult.getPublished()); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java new file mode 100644 index 00000000000..b09500e5aef --- /dev/null +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu2Test.java @@ -0,0 +1,510 @@ +package ca.uhn.fhir.parser; + +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.stringContainsInOrder; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.ExtensionDt; +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.Extension; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.model.dstu2.composite.QuantityDt; +import ca.uhn.fhir.model.dstu2.resource.Bundle; +import ca.uhn.fhir.model.dstu2.resource.Patient; +import ca.uhn.fhir.model.primitive.DateTimeDt; +import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.rest.server.AddProfileTagEnum; +import ca.uhn.fhir.util.ElementUtil; + +public class CustomTypeDstu2Test { + + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeDstu2Test.class); + private static final FhirContext ourCtx = FhirContext.forDstu2(); + + @Test + public void testAccessEmptyMetaLists() { + Patient p = new Patient(); + assertThat(p.getMeta().getProfile(), empty()); + assertThat(p.getMeta().getFormatCommentsPost(), empty()); + assertThat(p.getMeta().getFormatCommentsPre(), empty()); + assertThat(p.getMeta().getLastUpdated(), nullValue()); + assertThat(p.getMeta().getSecurity(), empty()); + assertThat(p.getMeta().getSecurity("foo", "bar"), nullValue()); + assertThat(p.getMeta().getTag(), empty()); + assertThat(p.getMeta().getTag("foo", "bar"), nullValue()); + assertThat(p.getMeta().getVersionId(), nullValue()); + + } + + + @Test + public void testEncodeCompleteMetaLists() { + Patient p = new Patient(); + p.getMeta().addProfile("http://foo/profile1"); + p.getMeta().addProfile("http://foo/profile2"); + p.getMeta().addSecurity().setSystem("SEC_S1").setCode("SEC_C1").setDisplay("SED_D1"); + p.getMeta().addSecurity().setSystem("SEC_S2").setCode("SEC_C2").setDisplay("SED_D2"); + p.getMeta().addTag().setSystem("TAG_S1").setCode("TAG_C1").setDisplay("TAG_D1"); + p.getMeta().addTag().setSystem("TAG_S2").setCode("TAG_C2").setDisplay("TAG_D2"); + + String out = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p); + ourLog.info(out); + + //@formatter:off + assertThat(out, stringContainsInOrder( + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); + //@formatter:on + + } + + @Before + public void before() { + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + } + + @Test + public void testEncodeWithCustomType() { + + MyCustomPatient patient = new MyCustomPatient(); + + patient.addIdentifier().setSystem("urn:system").setValue("1234"); + patient.addName().addFamily("Rossi").addGiven("Mario"); + patient.setInsulinLevel(new QuantityDt()); + patient.setGlucoseLevel(new QuantityDt()); + patient.setHbA1c(new QuantityDt()); + patient.setBloodPressure(new QuantityDt()); + patient.setCholesterol(new QuantityDt()); + patient.setWeight(new StringDt("80 kg")); + patient.setWeight(new StringDt("185 cm")); + patient.setCheckDates(new ArrayList()); + patient.getCheckDates().add(new DateTimeDt("2014-01-26T11:11:11")); + + IParser p = ourCtx.newXmlParser().setPrettyPrint(true); + String messageString = p.encodeResourceToString(patient); + + ourLog.info(messageString); + + //@formatter:off + assertThat(messageString, stringContainsInOrder( + "", + "", + "")); + //@formatter:on + + //@formatter:off + assertThat(messageString, not(stringContainsInOrder( + "", + "", + "", + ""))); + //@formatter:on + } + + @Test + public void testEncodeWithCustomTypeAndAutoInsertedProfile() { + + MyCustomPatient patient = new MyCustomPatient(); + + patient.getMeta().addProfile("http://example.com/foo"); + patient.getMeta().addProfile("http://example.com/bar"); + + patient.addIdentifier().setSystem("urn:system").setValue("1234"); + patient.addName().addFamily("Rossi").addGiven("Mario"); + patient.setInsulinLevel(new QuantityDt()); + patient.setGlucoseLevel(new QuantityDt()); + patient.setHbA1c(new QuantityDt()); + patient.setBloodPressure(new QuantityDt()); + patient.setCholesterol(new QuantityDt()); + patient.setWeight(new StringDt("80 kg")); + patient.setWeight(new StringDt("185 cm")); + patient.setCheckDates(new ArrayList()); + patient.getCheckDates().add(new DateTimeDt("2014-01-26T11:11:11")); + + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + IParser p = ourCtx.newXmlParser().setPrettyPrint(true); + String messageString = p.encodeResourceToString(patient); + + ourLog.info(messageString); + + //@formatter:off + assertThat(messageString, stringContainsInOrder( + "", + "", + "", + "")); + //@formatter:on + + //@formatter:off + assertThat(messageString, not(stringContainsInOrder( + "", + "", + "", + ""))); + //@formatter:on + } + + @Test + public void testEncodeNormalType() { + + Patient patient = new Patient(); + + patient.addIdentifier().setSystem("urn:system").setValue("1234"); + patient.addName().addFamily("Rossi").addGiven("Mario"); + + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + IParser p = ourCtx.newXmlParser().setPrettyPrint(true); + String messageString = p.encodeResourceToString(patient); + ourLog.info(messageString); + + assertThat(messageString, not(containsString(" exts = parsed.getUndeclaredExtensionsByUrl("http://example.com/Weight"); + assertEquals(1, exts.size()); + assertEquals("185 cm", ((StringDt)exts.get(0).getValueAsPrimitive()).getValue()); + } + + @Test + public void parseResourceWithDirective() { + String input = createResource(true); + + FhirContext ctx = FhirContext.forDstu2(); + ctx.setDefaultTypeForProfile("http://example.com/foo", MyCustomPatient.class); + + MyCustomPatient parsed = (MyCustomPatient) ctx.newXmlParser().parseResource(input); + assertEquals(1, parsed.getMeta().getProfile().size()); + assertEquals("http://example.com/foo", parsed.getMeta().getProfile().get(0).getValue()); + + List exts = parsed.getUndeclaredExtensionsByUrl("http://example.com/Weight"); + assertEquals(0, exts.size()); + + assertEquals("185 cm", parsed.getWeight().getValue()); + } + + @Test + public void parseBundleWithResourceDirective() { + + String input = createBundle(createResource(false), createResource(true)); + + FhirContext ctx = FhirContext.forDstu2(); + ctx.setDefaultTypeForProfile("http://example.com/foo", MyCustomPatient.class); + + Bundle bundle = ctx.newXmlParser().parseResource(Bundle.class, input); + + Patient res0 = (Patient) bundle.getEntry().get(0).getResource(); + assertEquals(0, res0.getMeta().getProfile().size()); + List exts = res0.getUndeclaredExtensionsByUrl("http://example.com/Weight"); + assertEquals(1, exts.size()); + assertEquals("185 cm", ((StringDt)exts.get(0).getValueAsPrimitive()).getValue()); + + MyCustomPatient res1 = (MyCustomPatient) bundle.getEntry().get(1).getResource(); + assertEquals(1, res1.getMeta().getProfile().size()); + assertEquals("http://example.com/foo", res1.getMeta().getProfile().get(0).getValue()); + exts = res1.getUndeclaredExtensionsByUrl("http://example.com/Weight"); + assertEquals(0, exts.size()); + assertEquals("185 cm", res1.getWeight().getValue()); + } + + private String createBundle(String... theResources) { + StringBuilder b = new StringBuilder(); + b.append("\n"); + for (String next : theResources) { + b.append(" \n"); + b.append(" \n"); + b.append(next); + b.append(" \n"); + b.append(" \n"); + } + b.append(""); + return b.toString(); + } + + private String createResource(boolean theWithProfile) { + StringBuilder b = new StringBuilder(); + b.append("\n"); + if (theWithProfile) { + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + } + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(""); + String input = + b.toString(); + return input; + } + + + @ResourceDef(name = "Patient", profile = "http://example.com/foo") + public static class MyCustomPatient extends Patient { + + private static final long serialVersionUID = 1L; + + @Child(name = "bloodPressure") // once every 3 month. The average target is 130/80 mmHg or less + @Extension(url = "http://example.com/BloodPressure", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The value of the patient's blood pressure") + private QuantityDt myBloodPressure; + + // Dates of periodic tests + @Child(name = "CheckDates", max = Child.MAX_UNLIMITED) + @Extension(url = "http://example.com/diabetes2", definedLocally = false, isModifier = true) + @Description(shortDefinition = "Dates of periodic tests") + private List myCheckDates; + + @Child(name = "cholesterol") // once a year. The target is triglycerides =< 2 mmol/l e cholesterol =< 4 mmol/l + @Extension(url = "http://example.com/Cholesterol", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The value of the patient's cholesterol") + private QuantityDt myCholesterol; + + @Child(name = "glucoseLevel") // fingerprick test + @Extension(url = "http://example.com/Glucose", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The value of the patient's blood glucose") + private QuantityDt myGlucoseLevel; + + // Periodic Tests + @Child(name = "hbA1c") // once every 6 month. The average target is 53 mmol/mol (or 7%) or less. + @Extension(url = "http://example.com/HbA1c", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The value of the patient's glucose") + private QuantityDt myHbA1c; + + @Child(name = "Height") + @Extension(url = "http://example.com/Height", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The patient's height in cm") + private StringDt myHeight; + + @Child(name = "insulinLevel") // Normal range is [43,208] pmol/l + @Extension(url = "http://example.com/Insuline", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The value of the patient's insulin") + private QuantityDt myInsulinLevel; + + // Other parameters + @Child(name = "weight") + @Extension(url = "http://example.com/Weight", definedLocally = false, isModifier = false) + @Description(shortDefinition = "The patient's weight in Kg") + private StringDt myWeight; + + public QuantityDt Cholesterol() { + if (myCholesterol == null) { + myCholesterol = new QuantityDt(); + } + myCholesterol.getValue(); + myCholesterol.getSystem(); + myCholesterol.getCode(); + + return myCholesterol; + } + + public QuantityDt getBloodPressure() { + if (myBloodPressure == null) { + myBloodPressure = new QuantityDt(); + } + myBloodPressure.getValue(); + myBloodPressure.getSystem(); + myBloodPressure.getCode(); + + return myBloodPressure; + } + + public List getCheckDates() { + if (myCheckDates == null) { + myCheckDates = new ArrayList(); + } + return myCheckDates; + } + + public QuantityDt getGlucoseLevel() { + if (myGlucoseLevel == null) { + myGlucoseLevel = new QuantityDt(); + } + myGlucoseLevel.getValue(); + myGlucoseLevel.getSystem(); + myGlucoseLevel.getCode(); + + return myGlucoseLevel; + } + + public QuantityDt getHbA1c() { + if (myHbA1c == null) { + myHbA1c = new QuantityDt(); + } + myHbA1c.getValue(); + myHbA1c.getSystem(); + myHbA1c.getCode(); + + return myHbA1c; + } + + public StringDt getHeight() { + if (myHeight == null) { + myHeight = new StringDt(); + } + return myHeight; + } + + public QuantityDt getInsulinLevel() { + if (myInsulinLevel == null) { + myInsulinLevel = new QuantityDt(); + } + myInsulinLevel.getValue(); + myInsulinLevel.getSystem(); + myInsulinLevel.getCode(); + + return myInsulinLevel; + } + + public StringDt getWeight() { + if (myWeight == null) { + myWeight = new StringDt(); + } + return myWeight; + } + + @Override + public boolean isEmpty() { + return super.isEmpty() && ElementUtil.isEmpty(myInsulinLevel, myGlucoseLevel, myHbA1c, myBloodPressure, myCholesterol, myWeight, myHeight, myCheckDates); + } + + public void setBloodPressure(QuantityDt bloodPressure) { + myBloodPressure = bloodPressure; + myBloodPressure.setValue(110); + myBloodPressure.setSystem("http://unitsofmeasure.org"); + myBloodPressure.setCode("mmHg"); + } + + public void setCheckDates(List theCheckDates) { + myCheckDates = theCheckDates; + myCheckDates.add(new DateTimeDt("2010-01-02")); + } + + public void setCholesterol(QuantityDt cholesterol) { + myCholesterol = cholesterol; + myCholesterol.setValue(2); + myCholesterol.setSystem("http://unitsofmeasure.org"); + myCholesterol.setCode("mmol/l"); + } + + public void setGlucoseLevel(QuantityDt glucoseLevel) { + myGlucoseLevel = glucoseLevel; + myGlucoseLevel.setValue(95); + myGlucoseLevel.setSystem("http://unitsofmeasure.org"); + myGlucoseLevel.setCode("mg/dl"); + } + + public void setHbA1c(QuantityDt hba1c) { + myHbA1c = hba1c; + myHbA1c.setValue(48); + myHbA1c.setSystem("http://unitsofmeasure.org"); + myHbA1c.setCode("mmol/mol"); + } + + public void setHeight(StringDt height) { + myHeight = height; + } + + // Setter/Getter methods + public void setInsulinLevel(QuantityDt insulinLevel) { + myInsulinLevel = insulinLevel; + myInsulinLevel.setValue(125); + myInsulinLevel.setSystem("http://unitsofmeasure.org"); + myInsulinLevel.setCode("pmol/l"); + } + + public void setWeight(StringDt weight) { + myWeight = weight; + } + + } +} \ No newline at end of file diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeTest.java deleted file mode 100644 index e44a91c88bd..00000000000 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/CustomTypeTest.java +++ /dev/null @@ -1,228 +0,0 @@ -package ca.uhn.fhir.parser; - -import java.util.ArrayList; -import java.util.List; - -import org.junit.Test; - -import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.api.annotation.Extension; -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.model.dstu2.composite.QuantityDt; -import ca.uhn.fhir.model.dstu2.resource.Patient; -import ca.uhn.fhir.model.primitive.DateTimeDt; -import ca.uhn.fhir.model.primitive.StringDt; -import ca.uhn.fhir.util.ElementUtil; - -public class CustomTypeTest { - - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeTest.class); - - @Test - public void testEncode() { - - FhirContext ctx = FhirContext.forDstu2(); - - MyCustomPatient patient = new MyCustomPatient(); - - patient.addIdentifier().setSystem("urn:system").setValue("1234"); - patient.addName().addFamily("Rossi").addGiven("Mario"); - patient.setInsulinLevel(new QuantityDt()); - patient.setGlucoseLevel(new QuantityDt()); - patient.setHbA1c(new QuantityDt()); - patient.setBloodPressure(new QuantityDt()); - patient.setCholesterol(new QuantityDt()); - patient.setWeight(new StringDt("80 kg")); - patient.setWeight(new StringDt("185 cm")); - patient.setCheckDates(new ArrayList()); - patient.getCheckDates().add(new DateTimeDt("2014-01-26T11:11:11")); - - IParser p = ctx.newXmlParser().setPrettyPrint(true); - String messageString = p.encodeResourceToString(patient); - - ourLog.info(messageString); - - } - - @ResourceDef(name = "Patient") - public static class MyCustomPatient extends Patient { - - private static final long serialVersionUID = 1L; - - @Child(name = "bloodPressure") // once every 3 month. The average target is 130/80 mmHg or less - @Extension(url = "http://example.com/BloodPressure", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The value of the patient's blood pressure") - private QuantityDt myBloodPressure; - - // Dates of periodic tests - @Child(name = "CheckDates", max = Child.MAX_UNLIMITED) - @Extension(url = "http://example.com/diabetes2", definedLocally = false, isModifier = true) - @Description(shortDefinition = "Dates of periodic tests") - private List myCheckDates; - - @Child(name = "cholesterol") // once a year. The target is triglycerides =< 2 mmol/l e cholesterol =< 4 mmol/l - @Extension(url = "http://example.com/Cholesterol", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The value of the patient's cholesterol") - private QuantityDt myCholesterol; - - @Child(name = "glucoseLevel") // fingerprick test - @Extension(url = "http://example.com/Glucose", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The value of the patient's blood glucose") - private QuantityDt myGlucoseLevel; - - // Periodic Tests - @Child(name = "hbA1c") // once every 6 month. The average target is 53 mmol/mol (or 7%) or less. - @Extension(url = "http://example.com/HbA1c", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The value of the patient's glucose") - private QuantityDt myHbA1c; - - @Child(name = "Height") - @Extension(url = "http://example.com/Height", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The patient's height in cm") - private StringDt myHeight; - - @Child(name = "insulinLevel") // Normal range is [43,208] pmol/l - @Extension(url = "http://example.com/Insuline", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The value of the patient's insulin") - private QuantityDt myInsulinLevel; - - // Other parameters - @Child(name = "weight") - @Extension(url = "http://example.com/Weight", definedLocally = false, isModifier = false) - @Description(shortDefinition = "The patient's weight in Kg") - private StringDt myWeight; - - public QuantityDt Cholesterol() { - if (myCholesterol == null) { - myCholesterol = new QuantityDt(); - } - myCholesterol.getValue(); - myCholesterol.getSystem(); - myCholesterol.getCode(); - - return myCholesterol; - } - - public QuantityDt getBloodPressure() { - if (myBloodPressure == null) { - myBloodPressure = new QuantityDt(); - } - myBloodPressure.getValue(); - myBloodPressure.getSystem(); - myBloodPressure.getCode(); - - return myBloodPressure; - } - - public List getCheckDates() { - if (myCheckDates == null) { - myCheckDates = new ArrayList(); - } - return myCheckDates; - } - - public QuantityDt getGlucoseLevel() { - if (myGlucoseLevel == null) { - myGlucoseLevel = new QuantityDt(); - } - myGlucoseLevel.getValue(); - myGlucoseLevel.getSystem(); - myGlucoseLevel.getCode(); - - return myGlucoseLevel; - } - - public QuantityDt getHbA1c() { - if (myHbA1c == null) { - myHbA1c = new QuantityDt(); - } - myHbA1c.getValue(); - myHbA1c.getSystem(); - myHbA1c.getCode(); - - return myHbA1c; - } - - public StringDt getHeight() { - if (myHeight == null) { - myHeight = new StringDt(); - } - return myHeight; - } - - public QuantityDt getInsulinLevel() { - if (myInsulinLevel == null) { - myInsulinLevel = new QuantityDt(); - } - myInsulinLevel.getValue(); - myInsulinLevel.getSystem(); - myInsulinLevel.getCode(); - - return myInsulinLevel; - } - - public StringDt getWeight() { - if (myWeight == null) { - myWeight = new StringDt(); - } - return myWeight; - } - - @Override - public boolean isEmpty() { - return super.isEmpty() && ElementUtil.isEmpty(myInsulinLevel, myGlucoseLevel, myHbA1c, myBloodPressure, myCholesterol, myWeight, myHeight, myCheckDates); - } - - public void setBloodPressure(QuantityDt bloodPressure) { - myBloodPressure = bloodPressure; - myBloodPressure.setValue(110); - myBloodPressure.setSystem("http://unitsofmeasure.org"); - myBloodPressure.setCode("mmHg"); - } - - public void setCheckDates(List theCheckDates) { - myCheckDates = theCheckDates; - myCheckDates.add(new DateTimeDt("2010-01-02")); - } - - public void setCholesterol(QuantityDt cholesterol) { - myCholesterol = cholesterol; - myCholesterol.setValue(2); - myCholesterol.setSystem("http://unitsofmeasure.org"); - myCholesterol.setCode("mmol/l"); - } - - public void setGlucoseLevel(QuantityDt glucoseLevel) { - myGlucoseLevel = glucoseLevel; - myGlucoseLevel.setValue(95); - myGlucoseLevel.setSystem("http://unitsofmeasure.org"); - myGlucoseLevel.setCode("mg/dl"); - } - - public void setHbA1c(QuantityDt hba1c) { - myHbA1c = hba1c; - myHbA1c.setValue(48); - myHbA1c.setSystem("http://unitsofmeasure.org"); - myHbA1c.setCode("mmol/mol"); - } - - public void setHeight(StringDt height) { - myHeight = height; - } - - // Setter/Getter methods - public void setInsulinLevel(QuantityDt insulinLevel) { - myInsulinLevel = insulinLevel; - myInsulinLevel.setValue(125); - myInsulinLevel.setSystem("http://unitsofmeasure.org"); - myInsulinLevel.setCode("pmol/l"); - } - - public void setWeight(StringDt weight) { - myWeight = weight; - } - - } -} \ No newline at end of file diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java index e9c28a3bd80..7431739b5cc 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2Test.java @@ -94,6 +94,24 @@ public class JsonParserDstu2Test { assertEquals(true, obs.getReadOnly().getValue().booleanValue()); } + + @Test + public void testParseBundleWithCustomObservationType() { + ReportObservation obs = new ReportObservation(); + obs.setReadOnly(true); + + IParser p = ourCtx.newJsonParser(); +// p.set + p.setParserErrorHandler(mock(IParserErrorHandler.class, new ThrowsException(new IllegalStateException()))); + + String encoded = p.encodeResourceToString(obs); + ourLog.info(encoded); + + obs = p.parseResource(ReportObservation.class, encoded); + assertEquals(true, obs.getReadOnly().getValue().booleanValue()); + } + + @Test public void testEncodeAndParseExtensions() throws Exception { diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ReportObservation.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ReportObservation.java index 1072eb0a081..df47f7b70f6 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ReportObservation.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/ReportObservation.java @@ -9,7 +9,7 @@ import ca.uhn.fhir.model.primitive.BooleanDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.util.ElementUtil; -@ResourceDef(name = "Observation", id = "reportobservation") +@ResourceDef(name = "Observation", id = "http://example.com/reportobservation") public class ReportObservation extends Observation { private static final long serialVersionUID = 1L; diff --git a/hapi-fhir-structures-dstu2/src/test/resources/bundle_orion.xml b/hapi-fhir-structures-dstu2/src/test/resources/bundle_orion.xml index 37a83687b99..7f2fc0a8275 100644 --- a/hapi-fhir-structures-dstu2/src/test/resources/bundle_orion.xml +++ b/hapi-fhir-structures-dstu2/src/test/resources/bundle_orion.xml @@ -1,72 +1,69 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java index 66fabe2c80e..1f4cde6ec94 100644 --- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java +++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/rest/server/Dstu3BundleFactory.java @@ -31,27 +31,24 @@ import java.util.UUID; import org.apache.commons.lang3.Validate; import org.hl7.fhir.dstu3.model.Bundle; -import org.hl7.fhir.dstu3.model.DomainResource; -import org.hl7.fhir.dstu3.model.IdType; -import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent; import org.hl7.fhir.dstu3.model.Bundle.BundleLinkComponent; import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb; import org.hl7.fhir.dstu3.model.Bundle.SearchEntryMode; +import org.hl7.fhir.dstu3.model.DomainResource; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.instance.model.api.IAnyResource; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt; import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; -import ca.uhn.fhir.model.valueset.BundleEntryTransactionMethodEnum; import ca.uhn.fhir.model.valueset.BundleTypeEnum; -import ca.uhn.fhir.rest.server.AddProfileTagEnum; import ca.uhn.fhir.rest.server.BundleInclusionRule; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.EncodingEnum; @@ -65,7 +62,6 @@ import ca.uhn.fhir.util.ResourceReferenceInfo; public class Dstu3BundleFactory implements IVersionSpecificBundleFactory { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(Dstu3BundleFactory.class); private Bundle myBundle; private FhirContext myContext; private String myBase; @@ -308,7 +304,7 @@ public class Dstu3BundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, + public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { myBase = theServerBase; @@ -358,15 +354,6 @@ public class Dstu3BundleFactory implements IVersionSpecificBundleFactory { } } - if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - for (IBaseResource nextRes : resourceList) { - RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); - if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { - RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); - } - } - } - addResourcesToBundle(new ArrayList(resourceList), theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType, theResult.getPublished()); diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java index d03a2a9bf88..46441b01e3c 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/context/FhirContextDstu3Test.java @@ -9,12 +9,24 @@ import org.junit.Test; import ca.uhn.fhir.context.BaseRuntimeChildDatatypeDefinition; import ca.uhn.fhir.context.FhirContext; import ca.uhn.fhir.context.RuntimeResourceDefinition; +import ca.uhn.fhir.rest.client.MyPatientWithExtensions; public class FhirContextDstu3Test { private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirContextDstu3Test.class); private FhirContext ourCtx = FhirContext.forDstu3(); + @Test + public void testCustomTypeDoesntBecomeDefault() { + FhirContext ctx = FhirContext.forDstu3(); + + MyPatientWithExtensions pt = new MyPatientWithExtensions(); + pt.addName().addGiven("FOO"); + ctx.newXmlParser().encodeResourceToString(pt); + + assertEquals(Patient.class, ctx.getResourceDefinition("Patient").getImplementingClass()); + } + @Test public void testQueryBoundCode() { RuntimeResourceDefinition patientType = ourCtx.getResourceDefinition(Patient.class); diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java index 4bc1dca467f..32c7e47b4b5 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/parser/CustomTypeDstu3Test.java @@ -1,11 +1,20 @@ package ca.uhn.fhir.parser; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.stringContainsInOrder; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + import java.util.ArrayList; import java.util.List; -import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.Bundle; import org.hl7.fhir.dstu3.model.Patient; import org.hl7.fhir.dstu3.model.Quantity; +import org.hl7.fhir.dstu3.model.StringType; +import org.junit.Before; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; @@ -13,17 +22,215 @@ import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.Extension; import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.model.primitive.DateTimeDt; import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.rest.server.AddProfileTagEnum; import ca.uhn.fhir.util.ElementUtil; public class CustomTypeDstu3Test { + private static final FhirContext ourCtx = FhirContext.forDstu3(); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeDstu3Test.class); - @Test - public void testEncode() { + @Before + public void before() { + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + } + + + private String createBundle(String... theResources) { + StringBuilder b = new StringBuilder(); + b.append("\n"); + for (String next : theResources) { + b.append(" \n"); + b.append(" \n"); + b.append(next); + b.append(" \n"); + b.append(" \n"); + } + b.append(""); + return b.toString(); + } + + private String createResource(boolean theWithProfile) { + StringBuilder b = new StringBuilder(); + b.append("\n"); + if (theWithProfile) { + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + } + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(" \n"); + b.append(""); + String input = + b.toString(); + return input; + } + @Test + public void parseBundleWithResourceDirective() { + + String input = createBundle(createResource(false), createResource(true)); + FhirContext ctx = FhirContext.forDstu3(); + ctx.setDefaultTypeForProfile("http://example.com/foo", MyCustomPatient.class); + + Bundle bundle = ctx.newXmlParser().parseResource(Bundle.class, input); + + Patient res0 = (Patient) bundle.getEntry().get(0).getResource(); + assertEquals(0, res0.getMeta().getProfile().size()); + List exts = res0.getExtensionsByUrl("http://example.com/Weight"); + assertEquals(1, exts.size()); + assertEquals("185 cm", ((StringType)exts.get(0).getValue()).getValue()); + + MyCustomPatient res1 = (MyCustomPatient) bundle.getEntry().get(1).getResource(); + assertEquals(1, res1.getMeta().getProfile().size()); + assertEquals("http://example.com/foo", res1.getMeta().getProfile().get(0).getValue()); + exts = res1.getExtensionsByUrl("http://example.com/Weight"); + assertEquals(0, exts.size()); + assertEquals("185 cm", res1.getWeight().getValue()); + } + + @Test + public void parseResourceWithDirective() { + String input = createResource(true); + + FhirContext ctx = FhirContext.forDstu3(); + ctx.setDefaultTypeForProfile("http://example.com/foo", MyCustomPatient.class); + + MyCustomPatient parsed = (MyCustomPatient) ctx.newXmlParser().parseResource(input); + assertEquals(1, parsed.getMeta().getProfile().size()); + assertEquals("http://example.com/foo", parsed.getMeta().getProfile().get(0).getValue()); + + List exts = parsed.getExtensionsByUrl("http://example.com/Weight"); + assertEquals(0, exts.size()); + + assertEquals("185 cm", parsed.getWeight().getValue()); + } + + @Test + public void parseResourceWithNoDirective() { + String input = createResource(true); + + FhirContext ctx = FhirContext.forDstu3(); + Patient parsed = (Patient) ctx.newXmlParser().parseResource(input); + assertEquals(1, parsed.getMeta().getProfile().size()); + assertEquals("http://example.com/foo", parsed.getMeta().getProfile().get(0).getValue()); + + List exts = parsed.getExtensionsByUrl("http://example.com/Weight"); + assertEquals(1, exts.size()); + assertEquals("185 cm", ((StringType)exts.get(0).getValue()).getValue()); + } + + @Test + public void testAccessEmptyMetaLists() { + Patient p = new Patient(); + assertThat(p.getMeta().getProfile(), empty()); + assertThat(p.getMeta().getFormatCommentsPost(), empty()); + assertThat(p.getMeta().getFormatCommentsPre(), empty()); + assertThat(p.getMeta().getLastUpdated(), nullValue()); + assertThat(p.getMeta().getSecurity(), empty()); + assertThat(p.getMeta().getSecurity("foo", "bar"), nullValue()); + assertThat(p.getMeta().getTag(), empty()); + assertThat(p.getMeta().getTag("foo", "bar"), nullValue()); + assertThat(p.getMeta().getVersionId(), nullValue()); + + } + + @Test + public void testEncodeCompleteMetaLists() { + Patient p = new Patient(); + p.getMeta().addProfile("http://foo/profile1"); + p.getMeta().addProfile("http://foo/profile2"); + p.getMeta().addSecurity().setSystem("SEC_S1").setCode("SEC_C1").setDisplay("SED_D1"); + p.getMeta().addSecurity().setSystem("SEC_S2").setCode("SEC_C2").setDisplay("SED_D2"); + p.getMeta().addTag().setSystem("TAG_S1").setCode("TAG_C1").setDisplay("TAG_D1"); + p.getMeta().addTag().setSystem("TAG_S2").setCode("TAG_C2").setDisplay("TAG_D2"); + + String out = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p); + ourLog.info(out); + + //@formatter:off + assertThat(out, stringContainsInOrder( + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "")); + //@formatter:on + + } + + @Test + public void testEncodeWithCustomType() { MyCustomPatient patient = new MyCustomPatient(); @@ -36,17 +243,76 @@ public class CustomTypeDstu3Test { patient.setCholesterol(new Quantity()); patient.setWeight(new StringDt("80 kg")); patient.setWeight(new StringDt("185 cm")); - patient.setCheckDates(new ArrayList()); - patient.getCheckDates().add(new DateTimeType("2014-01-26T11:11:11")); + patient.setCheckDates(new ArrayList()); + patient.getCheckDates().add(new DateTimeDt("2014-01-26T11:11:11")); - IParser p = ctx.newXmlParser().setPrettyPrint(true); + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + IParser p = ourCtx.newXmlParser().setPrettyPrint(true); String messageString = p.encodeResourceToString(patient); ourLog.info(messageString); + + //@formatter:off + assertThat(messageString, stringContainsInOrder( + "", + "", + "")); + //@formatter:on + //@formatter:off + assertThat(messageString, not(stringContainsInOrder( + "", + "", + "", + ""))); + //@formatter:on } - @ResourceDef(name = "Patient") + @Test + public void testEncodeWithCustomTypeAndAutoInsertedProfile() { + + MyCustomPatient patient = new MyCustomPatient(); + + patient.getMeta().addProfile("http://example.com/foo"); + patient.getMeta().addProfile("http://example.com/bar"); + + patient.addIdentifier().setSystem("urn:system").setValue("1234"); + patient.addName().addFamily("Rossi").addGiven("Mario"); + patient.setInsulinLevel(new Quantity()); + patient.setGlucoseLevel(new Quantity()); + patient.setHbA1c(new Quantity()); + patient.setBloodPressure(new Quantity()); + patient.setCholesterol(new Quantity()); + patient.setWeight(new StringDt("80 kg")); + patient.setWeight(new StringDt("185 cm")); + patient.setCheckDates(new ArrayList()); + patient.getCheckDates().add(new DateTimeDt("2014-01-26T11:11:11")); + + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + IParser p = ourCtx.newXmlParser().setPrettyPrint(true); + String messageString = p.encodeResourceToString(patient); + + ourLog.info(messageString); + + //@formatter:off + assertThat(messageString, stringContainsInOrder( + "", + "", + "", + "")); + //@formatter:on + + //@formatter:off + assertThat(messageString, not(stringContainsInOrder( + "", + "", + "", + ""))); + //@formatter:on + } + + + @ResourceDef(name = "Patient", profile = "http://example.com/foo") public static class MyCustomPatient extends Patient { private static final long serialVersionUID = 1L; @@ -60,7 +326,7 @@ public class CustomTypeDstu3Test { @Child(name = "CheckDates", max = Child.MAX_UNLIMITED) @Extension(url = "http://example.com/diabetes2", definedLocally = false, isModifier = true) @Description(shortDefinition = "Dates of periodic tests") - private List myCheckDates; + private List myCheckDates; @Child(name = "cholesterol") // once a year. The target is triglycerides =< 2 mmol/l e cholesterol =< 4 mmol/l @Extension(url = "http://example.com/Cholesterol", definedLocally = false, isModifier = false) @@ -116,9 +382,9 @@ public class CustomTypeDstu3Test { return myBloodPressure; } - public List getCheckDates() { + public List getCheckDates() { if (myCheckDates == null) { - myCheckDates = new ArrayList(); + myCheckDates = new ArrayList(); } return myCheckDates; } @@ -182,9 +448,9 @@ public class CustomTypeDstu3Test { myBloodPressure.setCode("mmHg"); } - public void setCheckDates(List theCheckDates) { + public void setCheckDates(List theCheckDates) { myCheckDates = theCheckDates; - myCheckDates.add(new DateTimeType("2010-01-02")); + myCheckDates.add(new DateTimeDt("2010-01-02")); } public void setCholesterol(Quantity cholesterol) { diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java new file mode 100644 index 00000000000..ff0a2c29a63 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/ClientWithCustomTypeDstu3Test.java @@ -0,0 +1,116 @@ +package ca.uhn.fhir.rest.client; + +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.io.StringReader; +import java.nio.charset.Charset; +import java.util.Arrays; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.io.input.ReaderInputStream; +import org.apache.http.HttpResponse; +import org.apache.http.ProtocolVersion; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpEntityEnclosingRequestBase; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.hl7.fhir.dstu3.model.Binary; +import org.hl7.fhir.dstu3.model.Conformance; +import org.hl7.fhir.dstu3.model.OperationOutcome; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.parser.IParser; +import ca.uhn.fhir.rest.server.Constants; +import ca.uhn.fhir.util.VersionUtil; + +public class ClientWithCustomTypeDstu3Test { + private static FhirContext ourCtx; + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ClientWithCustomTypeDstu3Test.class); + private HttpClient myHttpClient; + private HttpResponse myHttpResponse; + + @Before + public void before() { + myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient); + ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER); + myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + } + + private byte[] extractBodyAsByteArray(ArgumentCaptor capt) throws IOException { + byte[] body = IOUtils.toByteArray(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(0)).getEntity().getContent()); + return body; + } + + private String extractBodyAsString(ArgumentCaptor capt) throws IOException { + String body = IOUtils.toString(((HttpEntityEnclosingRequestBase) capt.getAllValues().get(0)).getEntity().getContent(), "UTF-8"); + return body; + } + + + @Test + public void testReadCustomType() throws Exception { + IParser p = ourCtx.newXmlParser(); + + MyPatientWithExtensions response = new MyPatientWithExtensions(); + response.addName().addFamily("FAMILY"); + response.getStringExt().setValue("STRINGVAL"); + response.getDateExt().setValueAsString("2011-01-02"); + final String respString = p.encodeResourceToString(response); + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse); + when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK")); + when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() { + @Override + public ReaderInputStream answer(InvocationOnMock theInvocation) throws Throwable { + return new ReaderInputStream(new StringReader(respString), Charset.forName("UTF-8")); + } + }); + + IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir"); + + //@formatter:off + MyPatientWithExtensions value = client + .read() + .resource(MyPatientWithExtensions.class) + .withId("123") + .execute(); + //@formatter:on + + HttpUriRequest request = capt.getAllValues().get(0); + + assertEquals("http://example.com/fhir/Patient/123", request.getURI().toASCIIString()); + assertEquals("GET", request.getMethod()); + + assertEquals(1, value.getName().size()); + assertEquals("FAMILY", value.getName().get(0).getFamilyAsSingleString()); + assertEquals("STRINGVAL", value.getStringExt().getValue()); + assertEquals("2011-01-02", value.getDateExt().getValueAsString()); + + } + + + + @BeforeClass + public static void beforeClass() { + ourCtx = FhirContext.forDstu3(); + } + +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/MyPatientWithExtensions.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/MyPatientWithExtensions.java new file mode 100644 index 00000000000..dea015cce34 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/client/MyPatientWithExtensions.java @@ -0,0 +1,94 @@ +package ca.uhn.fhir.rest.client; + +import java.util.ArrayList; +import java.util.List; + +import org.hl7.fhir.dstu3.model.BaseResource; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DomainResource; +import org.hl7.fhir.dstu3.model.HumanName; +import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.dstu3.model.ResourceType; +import org.hl7.fhir.dstu3.model.StringType; + +import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.api.annotation.Description; +import ca.uhn.fhir.model.api.annotation.Extension; +import ca.uhn.fhir.model.api.annotation.ResourceDef; +import ca.uhn.fhir.util.ElementUtil; + + +@ResourceDef(name="Patient", profile="http://example.com/StructureDefinition/patient_with_extensions") +public class MyPatientWithExtensions extends DomainResource { + + private static final long serialVersionUID = 1L; + + @Extension(url = "http://example.com/ext/date", definedLocally = false, isModifier = true) + @Child(name = "modExt") + private DateType myDateExt; + + @Extension(url = "http://example.com/ext/string", definedLocally = false, isModifier = false) + @Child(name = "extAtt") + private StringType myStringExt; + + @Child(name = "name", type = {HumanName.class}, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) + @Description(shortDefinition="A name associated with the patient", formalDefinition="A name associated with the individual." ) + private List myName; + + + public List getName() { + if (myName == null) { + myName = new ArrayList(); + } + return myName; + } + + public void setName(List theName) { + myName = theName; + } + + public DateType getDateExt() { + if (myDateExt == null) { + myDateExt = new DateType(); + } + return myDateExt; + } + + public StringType getStringExt() { + if (myStringExt == null) { + myStringExt = new StringType(); + } + return myStringExt; + } + + @Override + public boolean isEmpty() { + return super.isEmpty() && ElementUtil.isEmpty(myStringExt, myDateExt); + } + + public void setDateExt(DateType theDateExt) { + myDateExt = theDateExt; + } + + public void setStringExt(StringType theStringExt) { + myStringExt = theStringExt; + } + + @Override + public DomainResource copy() { + return null; + } + + @Override + public ResourceType getResourceType() { + return ResourceType.Patient; + } + + public HumanName addName() { + HumanName retVal = new HumanName(); + getName().add(retVal); + return retVal; + } + + +} diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java index 5b57cb928b0..0b57c91de99 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CreateDstu3Test.java @@ -1,6 +1,8 @@ package ca.uhn.fhir.rest.server; import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.stringContainsInOrder; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; @@ -10,120 +12,88 @@ import java.util.concurrent.TimeUnit; import org.apache.commons.io.IOUtils; import org.apache.http.HttpResponse; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.entity.ContentType; -import org.apache.http.entity.StringEntity; +import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.servlet.ServletHandler; import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.dstu3.model.DateType; import org.hl7.fhir.dstu3.model.IdType; -import org.hl7.fhir.dstu3.model.OperationOutcome; import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IBaseResource; import org.junit.AfterClass; -import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.primitive.StringDt; -import ca.uhn.fhir.rest.annotation.ConditionalUrlParam; -import ca.uhn.fhir.rest.annotation.Create; import ca.uhn.fhir.rest.annotation.IdParam; -import ca.uhn.fhir.rest.annotation.OptionalParam; -import ca.uhn.fhir.rest.annotation.ResourceParam; +import ca.uhn.fhir.rest.annotation.Read; import ca.uhn.fhir.rest.annotation.Search; -import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.rest.client.MyPatientWithExtensions; import ca.uhn.fhir.util.PortUtil; public class CreateDstu3Test { private static CloseableHttpClient ourClient; - private static String ourLastConditionalUrl; + private static FhirContext ourCtx = FhirContext.forDstu3(); private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CreateDstu3Test.class); private static int ourPort; private static Server ourServer; - private static IdType ourLastId; - private static IdType ourLastIdParam; - private static boolean ourLastRequestWasSearch; - private static FhirContext ourCtx = FhirContext.forDstu3(); - - @Before - public void before() { - ourLastId = null; - ourLastConditionalUrl = null; - ourLastIdParam = null; - ourLastRequestWasSearch = false; - } @Test - public void testCreateWithIdInBody() throws Exception { + public void testRead() throws Exception { - Patient patient = new Patient(); - patient.setId("2"); - patient.addIdentifier().setValue("002"); - - HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); -// httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001"); - httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); - - HttpResponse status = ourClient.execute(httpPost); + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2?_format=xml&_pretty=true"); + HttpResponse status = ourClient.execute(httpGet); String responseContent = IOUtils.toString(status.getEntity().getContent()); IOUtils.closeQuietly(status.getEntity().getContent()); ourLog.info("Response was:\n{}", responseContent); - assertEquals(400, status.getStatusLine().getStatusCode()); - OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); - assertEquals("Can not create resource with ID \"2\", an ID element must not be supplied in the resource body on a create (POST) operation", oo.getIssue().get(0).getDiagnostics()); + assertEquals(200, status.getStatusLine().getStatusCode()); + + //@formatter:off + assertThat(responseContent, stringContainsInOrder("", + "", + "", + "", + "", + "", + "", + "", + "")); + //@formatter:on } @Test - public void testCreateWithIdInUrl() throws Exception { + public void testSearch() throws Exception { - Patient patient = new Patient(); - patient.addIdentifier().setValue("002"); - - HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/2"); -// httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001"); - httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); - - HttpResponse status = ourClient.execute(httpPost); + HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?_format=xml&_pretty=true"); + HttpResponse status = ourClient.execute(httpGet); String responseContent = IOUtils.toString(status.getEntity().getContent()); IOUtils.closeQuietly(status.getEntity().getContent()); ourLog.info("Response was:\n{}", responseContent); - assertEquals(400, status.getStatusLine().getStatusCode()); - OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); - assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics()); - } - - @Test - public void testCreateWithIdInUrlForConditional() throws Exception { - - Patient patient = new Patient(); - patient.addIdentifier().setValue("002"); - - HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/2"); - httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001"); - httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); - - HttpResponse status = ourClient.execute(httpPost); - - String responseContent = IOUtils.toString(status.getEntity().getContent()); - IOUtils.closeQuietly(status.getEntity().getContent()); - - ourLog.info("Response was:\n{}", responseContent); - - assertEquals(400, status.getStatusLine().getStatusCode()); - OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); - assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics()); + assertEquals(200, status.getStatusLine().getStatusCode()); + + //@formatter:off + assertThat(responseContent, stringContainsInOrder("", + "", + "", + "", + "", + "", + "", + "", + "")); + //@formatter:on + + assertThat(responseContent, not(containsString("http://hl7.org/fhir/"))); } @AfterClass @@ -140,6 +110,7 @@ public class CreateDstu3Test { ServletHandler proxyHandler = new ServletHandler(); RestfulServer servlet = new RestfulServer(ourCtx); + servlet.setResourceProviders(patientProvider); ServletHolder servletHolder = new ServletHolder(servlet); proxyHandler.addServletWithMapping(servletHolder, "/*"); @@ -160,18 +131,29 @@ public class CreateDstu3Test { return Patient.class; } - @Search - public List search(@OptionalParam(name = "foo") StringDt theString) { - ourLastRequestWasSearch = true; - return new ArrayList(); + @Read() + public MyPatientWithExtensions read(@IdParam IdType theIdParam) { + MyPatientWithExtensions p0 = new MyPatientWithExtensions(); + p0.setId(theIdParam); + p0.setDateExt(new DateType("2011-01-01")); + return p0; } - @Create() - public MethodOutcome createPatient(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditional, @IdParam IdType theIdParam) { - ourLastConditionalUrl = theConditional; - ourLastId = thePatient.getIdElement(); - ourLastIdParam = theIdParam; - return new MethodOutcome(new IdType("Patient/001/_history/002")); + @Search + public List search() { + ArrayList retVal = new ArrayList(); + + MyPatientWithExtensions p0 = new MyPatientWithExtensions(); + p0.setId(new IdType("Patient/0")); + p0.setDateExt(new DateType("2011-01-01")); + retVal.add(p0); + + Patient p1 = new Patient(); + p1.setId(new IdType("Patient/1")); + p1.addName().addFamily("The Family"); + retVal.add(p1); + + return retVal; } } diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java new file mode 100644 index 00000000000..3bb93458051 --- /dev/null +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/CustomTypeServerDstu3.java @@ -0,0 +1,179 @@ +package ca.uhn.fhir.rest.server; + +import static org.hamcrest.Matchers.containsString; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.apache.commons.io.IOUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.hl7.fhir.dstu3.model.IdType; +import org.hl7.fhir.dstu3.model.OperationOutcome; +import org.hl7.fhir.dstu3.model.Patient; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.api.IResource; +import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.rest.annotation.ConditionalUrlParam; +import ca.uhn.fhir.rest.annotation.Create; +import ca.uhn.fhir.rest.annotation.IdParam; +import ca.uhn.fhir.rest.annotation.OptionalParam; +import ca.uhn.fhir.rest.annotation.ResourceParam; +import ca.uhn.fhir.rest.annotation.Search; +import ca.uhn.fhir.rest.api.MethodOutcome; +import ca.uhn.fhir.util.PortUtil; + +public class CustomTypeServerDstu3 { + private static CloseableHttpClient ourClient; + + private static String ourLastConditionalUrl; + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CustomTypeServerDstu3.class); + private static int ourPort; + private static Server ourServer; + private static IdType ourLastId; + private static IdType ourLastIdParam; + private static boolean ourLastRequestWasSearch; + private static FhirContext ourCtx = FhirContext.forDstu3(); + + @Before + public void before() { + ourLastId = null; + ourLastConditionalUrl = null; + ourLastIdParam = null; + ourLastRequestWasSearch = false; + } + + @Test + public void testCreateWithIdInBody() throws Exception { + + Patient patient = new Patient(); + patient.setId("2"); + patient.addIdentifier().setValue("002"); + + HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient"); +// httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001"); + httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); + + HttpResponse status = ourClient.execute(httpPost); + + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + + ourLog.info("Response was:\n{}", responseContent); + + assertEquals(400, status.getStatusLine().getStatusCode()); + OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); + assertEquals("Can not create resource with ID \"2\", an ID element must not be supplied in the resource body on a create (POST) operation", oo.getIssue().get(0).getDiagnostics()); + } + + @Test + public void testCreateWithIdInUrl() throws Exception { + + Patient patient = new Patient(); + patient.addIdentifier().setValue("002"); + + HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/2"); +// httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001"); + httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); + + HttpResponse status = ourClient.execute(httpPost); + + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + + ourLog.info("Response was:\n{}", responseContent); + + assertEquals(400, status.getStatusLine().getStatusCode()); + OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); + assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics()); + } + + @Test + public void testCreateWithIdInUrlForConditional() throws Exception { + + Patient patient = new Patient(); + patient.addIdentifier().setValue("002"); + + HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient/2"); + httpPost.addHeader(Constants.HEADER_IF_NONE_EXIST, "Patient?identifier=system%7C001"); + httpPost.setEntity(new StringEntity(ourCtx.newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8"))); + + HttpResponse status = ourClient.execute(httpPost); + + String responseContent = IOUtils.toString(status.getEntity().getContent()); + IOUtils.closeQuietly(status.getEntity().getContent()); + + ourLog.info("Response was:\n{}", responseContent); + + assertEquals(400, status.getStatusLine().getStatusCode()); + OperationOutcome oo = ourCtx.newXmlParser().parseResource(OperationOutcome.class, responseContent); + assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)", oo.getIssue().get(0).getDiagnostics()); + } + + @AfterClass + public static void afterClass() throws Exception { + ourServer.stop(); + } + + @BeforeClass + public static void beforeClass() throws Exception { + ourPort = PortUtil.findFreePort(); + ourServer = new Server(ourPort); + + PatientProvider patientProvider = new PatientProvider(); + + ServletHandler proxyHandler = new ServletHandler(); + RestfulServer servlet = new RestfulServer(ourCtx); + servlet.setResourceProviders(patientProvider); + ServletHolder servletHolder = new ServletHolder(servlet); + proxyHandler.addServletWithMapping(servletHolder, "/*"); + ourServer.setHandler(proxyHandler); + ourServer.start(); + + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); + HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setConnectionManager(connectionManager); + ourClient = builder.build(); + + } + + public static class PatientProvider implements IResourceProvider { + + @Override + public Class getResourceType() { + return Patient.class; + } + + @Search + public List search(@OptionalParam(name = "foo") StringDt theString) { + ourLastRequestWasSearch = true; + return new ArrayList(); + } + + @Create() + public MethodOutcome createPatient(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditional, @IdParam IdType theIdParam) { + ourLastConditionalUrl = theConditional; + ourLastId = thePatient.getIdElement(); + ourLastIdParam = theIdParam; + return new MethodOutcome(new IdType("Patient/001/_history/002")); + } + + } + +} diff --git a/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java b/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java index 06545c49405..ff122f8edd8 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2hl7org/Dstu2Hl7OrgBundleFactory.java @@ -48,10 +48,8 @@ import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.instance.model.api.IPrimitiveType; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.context.RuntimeResourceDefinition; import ca.uhn.fhir.model.api.Include; import ca.uhn.fhir.model.valueset.BundleTypeEnum; -import ca.uhn.fhir.rest.server.AddProfileTagEnum; import ca.uhn.fhir.rest.server.BundleInclusionRule; import ca.uhn.fhir.rest.server.Constants; import ca.uhn.fhir.rest.server.EncodingEnum; @@ -59,7 +57,6 @@ import ca.uhn.fhir.rest.server.IBundleProvider; import ca.uhn.fhir.rest.server.IPagingProvider; import ca.uhn.fhir.rest.server.IRestfulServer; import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory; -import ca.uhn.fhir.rest.server.RestfulServer; import ca.uhn.fhir.rest.server.RestfulServerUtils; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.util.ResourceReferenceInfo; @@ -298,7 +295,7 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory { } @Override - public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, + public void initializeBundleFromBundleProvider(IRestfulServer theServer, IBundleProvider theResult, EncodingEnum theResponseEncoding, String theServerBase, String theCompleteUrl, boolean thePrettyPrint, int theOffset, Integer theLimit, String theSearchId, BundleTypeEnum theBundleType, Set theIncludes) { myBase = theServerBase; @@ -344,15 +341,6 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory { } } - if (theServer.getAddProfileTag() != AddProfileTagEnum.NEVER) { - for (IBaseResource nextRes : resourceList) { - RuntimeResourceDefinition def = theServer.getFhirContext().getResourceDefinition(nextRes); - if (theServer.getAddProfileTag() == AddProfileTagEnum.ALWAYS || !def.isStandardProfile()) { - RestfulServerUtils.addProfileToBundleEntry(theServer.getFhirContext(), nextRes, theServerBase); - } - } - } - addResourcesToBundle(resourceList, theBundleType, theServerBase, theServer.getBundleInclusionRule(), theIncludes); addRootPropertiesToBundle(null, theServerBase, theCompleteUrl, theResult.size(), theBundleType, theResult.getPublished()); diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java index a3272730092..e3a93c5bc70 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java @@ -60,6 +60,7 @@ import org.hl7.fhir.instance.model.StringType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.INarrative; import org.hl7.fhir.instance.model.api.IPrimitiveType; +import org.junit.After; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; @@ -67,11 +68,11 @@ import org.xml.sax.SAXException; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.base.composite.BaseNarrativeDt; import ca.uhn.fhir.narrative.INarrativeGenerator; import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredAddressExtension; import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredEnumerationExtension; import ca.uhn.fhir.parser.JsonParserHl7OrgTest.MyPatientWithOneDeclaredExtension; +import ca.uhn.fhir.rest.server.AddProfileTagEnum; import ca.uhn.fhir.rest.server.Constants; import net.sf.json.JSON; import net.sf.json.JSONSerializer; @@ -81,33 +82,19 @@ public class XmlParserHl7OrgDstu2Test { private static FhirContext ourCtx; private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserHl7OrgDstu2Test.class); + @After + public void after() { + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.ONLY_FOR_CUSTOM); + } + private String fixDivNodeText(String htmlNoNs) { return htmlNoNs.replace("
    ", "
    "); } - private String fixDivNodeTextJson(String htmlNoNs) { + private String fixDivNodeTextJson(String htmlNoNs) { return htmlNoNs.replace("
    ", "
    "); } - /** - * See #216 - Profiled datatypes should use their unprofiled parent type as the choice[x] name - * - * Disabled after conversation with Grahame - */ - @Test - @Ignore - public void testEncodeAndParseProfiledDatatypeChoice() throws Exception { - IParser xmlParser = ourCtx.newXmlParser(); - - String input = IOUtils.toString(XmlParser.class.getResourceAsStream("/medicationstatement_invalidelement.xml")); - MedicationStatement ms = xmlParser.parseResource(MedicationStatement.class, input); - SimpleQuantity q = (SimpleQuantity) ms.getDosage().get(0).getQuantity(); - assertEquals("1", q.getValueElement().getValueAsString()); - - String output = xmlParser.encodeResourceToString(ms); - assertThat(output, containsString("")); - } - @Test public void testComposition() { @@ -575,6 +562,26 @@ public class XmlParserHl7OrgDstu2Test { } + /** + * See #216 - Profiled datatypes should use their unprofiled parent type as the choice[x] name + * + * Disabled after conversation with Grahame + */ + @Test + @Ignore + public void testEncodeAndParseProfiledDatatypeChoice() throws Exception { + IParser xmlParser = ourCtx.newXmlParser(); + + String input = IOUtils.toString(XmlParser.class.getResourceAsStream("/medicationstatement_invalidelement.xml")); + MedicationStatement ms = xmlParser.parseResource(MedicationStatement.class, input); + SimpleQuantity q = (SimpleQuantity) ms.getDosage().get(0).getQuantity(); + assertEquals("1", q.getValueElement().getValueAsString()); + + String output = xmlParser.encodeResourceToString(ms); + assertThat(output, containsString("")); + } + + @Test public void testEncodeBinaryResource() { @@ -587,7 +594,6 @@ public class XmlParserHl7OrgDstu2Test { } - @Test public void testEncodeBinaryWithNoContentType() { Binary b = new Binary(); @@ -613,7 +619,6 @@ public class XmlParserHl7OrgDstu2Test { assertThat(val, containsString("home")); assertThat(val, containsString("male")); } - @Test public void testEncodeBundle() throws InterruptedException { Bundle b = new Bundle(); @@ -650,6 +655,7 @@ public class XmlParserHl7OrgDstu2Test { assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings)); } + @Test public void testEncodeBundleCategory() { @@ -676,7 +682,7 @@ public class XmlParserHl7OrgDstu2Test { assertEquals("term", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getCode()); assertEquals("label", b.getEntry().get(0).getResource().getMeta().getTag().get(0).getDisplay()); } - + @Test public void testEncodeContainedAndIncludedResources() { @@ -718,6 +724,7 @@ public class XmlParserHl7OrgDstu2Test { } + @Test public void testEncodeContainedWithNarrativeIsSuppresed() throws Exception { IParser parser = ourCtx.newXmlParser().setPrettyPrint(true); @@ -745,7 +752,6 @@ public class XmlParserHl7OrgDstu2Test { } - @Test public void testEncodeDeclaredExtensionWithAddressContent() { IParser parser = ourCtx.newXmlParser(); @@ -1110,6 +1116,7 @@ public class XmlParserHl7OrgDstu2Test { } + @Test public void testExtensionOnComposite() throws Exception { @@ -1133,7 +1140,6 @@ public class XmlParserHl7OrgDstu2Test { } - @Test public void testExtensionOnPrimitive() throws Exception { @@ -1215,10 +1221,11 @@ public class XmlParserHl7OrgDstu2Test { assertTrue(d.toString(), d.identical()); } - + @Test public void testLoadAndEncodeDeclaredExtensions() throws ConfigurationException, DataFormatException, SAXException, IOException { IParser p = ourCtx.newXmlParser(); + ourCtx.setAddProfileTagWhenEncoding(AddProfileTagEnum.NEVER); //@formatter:off String msg = "\n" + diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseHl7OrgTest.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseHl7OrgTest.java index 5b3ae2c394e..81c6fefdab5 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseHl7OrgTest.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/BundleTypeInResponseHl7OrgTest.java @@ -26,9 +26,6 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.util.PortUtil; -/** - * Created by dsotnikov on 2/25/2014. - */ public class BundleTypeInResponseHl7OrgTest { private static CloseableHttpClient ourClient; diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java deleted file mode 100644 index be525cbc766..00000000000 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/BaseResource.java +++ /dev/null @@ -1,180 +0,0 @@ -package ca.uhn.fhir.model.dstu2.resource; - -/* - * #%L - * HAPI FHIR Structures - DSTU2 (FHIR v0.4.0) - * %% - * Copyright (C) 2014 - 2015 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import org.apache.commons.lang3.Validate; -import org.apache.commons.lang3.builder.ToStringBuilder; -import org.apache.commons.lang3.builder.ToStringStyle; -import org.hl7.fhir.instance.model.api.IIdType; - -import ca.uhn.fhir.model.api.BaseElement; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; -import ca.uhn.fhir.model.base.resource.ResourceMetadataMap; -import ca.uhn.fhir.model.dstu2.composite.ContainedDt; -import ca.uhn.fhir.model.dstu2.composite.NarrativeDt; -import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.gclient.StringClientParam; -import ca.uhn.fhir.util.ElementUtil; - -public abstract class BaseResource extends BaseElement implements IResource { - - /** - * Search parameter constant for _language - */ - @SearchParamDefinition(name="_language", path="", description="The language of the resource", type="string" ) - public static final String SP_RES_LANGUAGE = "_language"; - - - /** - * Search parameter constant for _id - */ - @SearchParamDefinition(name="_id", path="", description="The ID of the resource", type="string" ) - public static final String SP_RES_ID = "_id"; - - /** - * Fluent Client search parameter constant for _id - *

    - * Description: the _id of a resource
    - * Type: string
    - * Path: Resource._id
    - *

    - */ - public static final StringClientParam RES_ID = new StringClientParam(BaseResource.SP_RES_ID); - - - @Child(name = "contained", order = 2, min = 0, max = 1) - private ContainedDt myContained; - - private IdDt myId; - - @Child(name = "language", order = 0, min = 0, max = Child.MAX_UNLIMITED) - private CodeDt myLanguage; - - private ResourceMetadataMap myResourceMetadata; - - @Child(name = "text", order = 1, min = 0, max = 1) - private NarrativeDt myText; - - @Override - public ContainedDt getContained() { - if (myContained == null) { - myContained = new ContainedDt(); - } - return myContained; - } - - public IdDt getId() { - if (myId == null) { - myId = new IdDt(); - } - return myId; - } - - @Override - public IIdType getIdElement() { - return getId(); - } - - @Override - public CodeDt getLanguage() { - if (myLanguage == null) { - myLanguage = new CodeDt(); - } - return myLanguage; - } - - @Override - public ResourceMetadataMap getResourceMetadata() { - if (myResourceMetadata == null) { - myResourceMetadata = new ResourceMetadataMap(); - } - return myResourceMetadata; - } - - @Override - public NarrativeDt getText() { - if (myText == null) { - myText = new NarrativeDt(); - } - return myText; - } - - public void setContained(ContainedDt theContained) { - myContained = theContained; - } - - public void setId(IdDt theId) { - myId = theId; - } - - public BaseResource setId(IIdType theId) { - if (theId instanceof IdDt) { - myId = (IdDt) theId; - } else if (theId != null) { - myId = new IdDt(theId.getValue()); - } - return this; - } - - public BaseResource setId(String theId) { - if (theId == null) { - myId = null; - } else { - myId = new IdDt(theId); - } - return this; - } - - @Override - public void setLanguage(CodeDt theLanguage) { - myLanguage = theLanguage; - } - - @Override - public void setResourceMetadata(ResourceMetadataMap theMap) { - Validate.notNull(theMap, "The Map must not be null"); - myResourceMetadata = theMap; - } - - public void setText(NarrativeDt theText) { - myText = theText; - } - - @Override - public String toString() { - ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE); - b.append("id", getId().toUnqualified()); - return b.toString(); - } - - /** - * Intended to be called by extending classes {@link #isEmpty()} implementations, returns true if all - * content in this superclass instance is empty per the semantics of {@link #isEmpty()}. - */ - @Override - protected boolean isBaseEmpty() { - return super.isBaseEmpty() && ElementUtil.isEmpty(myLanguage, myText, myId); - } - -} diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/Bundle.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/Bundle.java deleted file mode 100644 index 056b4568ab8..00000000000 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/Bundle.java +++ /dev/null @@ -1,2025 +0,0 @@ - - - - - - - - - - - - - - - - -package ca.uhn.fhir.model.dstu2.resource; - -import java.math.BigDecimal; -import java.util.Date; -import java.util.List; - -import org.hl7.fhir.instance.model.api.IBaseBundle; - -import ca.uhn.fhir.model.api.BaseIdentifiableElement; -import ca.uhn.fhir.model.api.IElement; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.api.IResourceBlock; -import ca.uhn.fhir.model.api.Include; -import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.model.api.annotation.Block; -import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; -import ca.uhn.fhir.model.dstu2.composite.SignatureDt; -import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum; -import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum; -import ca.uhn.fhir.model.dstu2.valueset.SearchEntryModeEnum; -import ca.uhn.fhir.model.primitive.BoundCodeDt; -import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.DecimalDt; -import ca.uhn.fhir.model.primitive.InstantDt; -import ca.uhn.fhir.model.primitive.StringDt; -import ca.uhn.fhir.model.primitive.UnsignedIntDt; -import ca.uhn.fhir.model.primitive.UriDt; -import ca.uhn.fhir.rest.gclient.ReferenceClientParam; -import ca.uhn.fhir.rest.gclient.TokenClientParam; - - -/** - * HAPI/FHIR Bundle Resource - * () - * - *

    - * Definition: - * A container for a collection of resources - *

    - * - *

    - * Requirements: - * - *

    - * - *

    - * Profile Definition: - * http://hl7.org/fhir/profiles/Bundle - *

    - * - */ -@ResourceDef(name="Bundle", profile="http://hl7.org/fhir/profiles/Bundle", id="bundle") -public class Bundle extends ca.uhn.fhir.model.dstu2.resource.BaseResource - implements IResource , org.hl7.fhir.instance.model.api.IBaseBundle - { - - /** - * Search parameter constant for type - *

    - * Description:
    - * Type: token
    - * Path: Bundle.type
    - *

    - */ - @SearchParamDefinition(name="type", path="Bundle.type", description="", type="token" ) - public static final String SP_TYPE = "type"; - - /** - * Fluent Client search parameter constant for type - *

    - * Description:
    - * Type: token
    - * Path: Bundle.type
    - *

    - */ - public static final TokenClientParam TYPE = new TokenClientParam(SP_TYPE); - - /** - * Search parameter constant for message - *

    - * Description: The first resource in the bundle, if the bundle type is \"message\" - this is a message header, and this parameter provides access to search its contents
    - * Type: reference
    - * Path: Bundle.entry.resource(0)
    - *

    - */ - @SearchParamDefinition(name="message", path="Bundle.entry.resource(0)", description="The first resource in the bundle, if the bundle type is \"message\" - this is a message header, and this parameter provides access to search its contents", type="reference" ) - public static final String SP_MESSAGE = "message"; - - /** - * Fluent Client search parameter constant for message - *

    - * Description: The first resource in the bundle, if the bundle type is \"message\" - this is a message header, and this parameter provides access to search its contents
    - * Type: reference
    - * Path: Bundle.entry.resource(0)
    - *

    - */ - public static final ReferenceClientParam MESSAGE = new ReferenceClientParam(SP_MESSAGE); - - /** - * Search parameter constant for composition - *

    - * Description: The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to searches its contents
    - * Type: reference
    - * Path: Bundle.entry.resource(0)
    - *

    - */ - @SearchParamDefinition(name="composition", path="Bundle.entry.resource(0)", description="The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to searches its contents", type="reference" ) - public static final String SP_COMPOSITION = "composition"; - - /** - * Fluent Client search parameter constant for composition - *

    - * Description: The first resource in the bundle, if the bundle type is \"document\" - this is a composition, and this parameter provides access to searches its contents
    - * Type: reference
    - * Path: Bundle.entry.resource(0)
    - *

    - */ - public static final ReferenceClientParam COMPOSITION = new ReferenceClientParam(SP_COMPOSITION); - - - /** - * Constant for fluent queries to be used to add include statements. Specifies - * the path value of "Bundle:composition". - */ - public static final Include INCLUDE_COMPOSITION = new Include("Bundle:composition"); - - /** - * Constant for fluent queries to be used to add include statements. Specifies - * the path value of "Bundle:message". - */ - public static final Include INCLUDE_MESSAGE = new Include("Bundle:message"); - - - @Child(name="type", type=CodeDt.class, order=0, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Indicates the purpose of this bundle- how it was intended to be used" - ) - private BoundCodeDt myType; - - @Child(name="total", type=UnsignedIntDt.class, order=1, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle)" - ) - private UnsignedIntDt myTotal; - - @Child(name="link", order=2, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A series of links that provide context to this bundle" - ) - private java.util.List myLink; - - @Child(name="entry", order=3, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only)" - ) - private java.util.List myEntry; - - @Child(name="signature", type=SignatureDt.class, order=4, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Digital Signature - base64 encoded. XML DigSIg or a JWT" - ) - private SignatureDt mySignature; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myType, myTotal, myLink, myEntry, mySignature); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myType, myTotal, myLink, myEntry, mySignature); - } - - /** - * Gets the value(s) for type (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Indicates the purpose of this bundle- how it was intended to be used - *

    - */ - public BoundCodeDt getTypeElement() { - if (myType == null) { - myType = new BoundCodeDt(BundleTypeEnum.VALUESET_BINDER); - } - return myType; - } - - - /** - * Gets the value(s) for type (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Indicates the purpose of this bundle- how it was intended to be used - *

    - */ - public String getType() { - return getTypeElement().getValue(); - } - - /** - * Sets the value(s) for type () - * - *

    - * Definition: - * Indicates the purpose of this bundle- how it was intended to be used - *

    - */ - public Bundle setType(BoundCodeDt theValue) { - myType = theValue; - return this; - } - - - - /** - * Sets the value(s) for type () - * - *

    - * Definition: - * Indicates the purpose of this bundle- how it was intended to be used - *

    - */ - public Bundle setType(BundleTypeEnum theValue) { - getTypeElement().setValueAsEnum(theValue); - return this; - } - - - /** - * Gets the value(s) for total (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle) - *

    - */ - public UnsignedIntDt getTotalElement() { - if (myTotal == null) { - myTotal = new UnsignedIntDt(); - } - return myTotal; - } - - - /** - * Gets the value(s) for total (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle) - *

    - */ - public Integer getTotal() { - return getTotalElement().getValue(); - } - - /** - * Sets the value(s) for total () - * - *

    - * Definition: - * If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle) - *

    - */ - public Bundle setTotal(UnsignedIntDt theValue) { - myTotal = theValue; - return this; - } - - - - /** - * Sets the value for total () - * - *

    - * Definition: - * If a set of search matches, this is the total number of matches for the search (as opposed to the number of results in this bundle) - *

    - */ - public Bundle setTotal( int theInteger) { - myTotal = new UnsignedIntDt(theInteger); - return this; - } - - - /** - * Gets the value(s) for link (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A series of links that provide context to this bundle - *

    - */ - public java.util.List getLink() { - if (myLink == null) { - myLink = new java.util.ArrayList(); - } - return myLink; - } - - /** - * Sets the value(s) for link () - * - *

    - * Definition: - * A series of links that provide context to this bundle - *

    - */ - public Bundle setLink(java.util.List theValue) { - myLink = theValue; - return this; - } - - - - /** - * Adds and returns a new value for link () - * - *

    - * Definition: - * A series of links that provide context to this bundle - *

    - */ - public Link addLink() { - Link newType = new Link(); - getLink().add(newType); - return newType; - } - - /** - * Adds a given new value for link () - * - *

    - * Definition: - * A series of links that provide context to this bundle - *

    - * @param theValue The link to add (must not be null) - */ - public Bundle addLink(Link theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getLink().add(theValue); - return this; - } - - /** - * Gets the first repetition for link (), - * creating it if it does not already exist. - * - *

    - * Definition: - * A series of links that provide context to this bundle - *

    - */ - public Link getLinkFirstRep() { - if (getLink().isEmpty()) { - return addLink(); - } - return getLink().get(0); - } - - /** - * Gets the value(s) for entry (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only) - *

    - */ - public java.util.List getEntry() { - if (myEntry == null) { - myEntry = new java.util.ArrayList(); - } - return myEntry; - } - - /** - * Sets the value(s) for entry () - * - *

    - * Definition: - * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only) - *

    - */ - public Bundle setEntry(java.util.List theValue) { - myEntry = theValue; - return this; - } - - - - /** - * Adds and returns a new value for entry () - * - *

    - * Definition: - * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only) - *

    - */ - public Entry addEntry() { - Entry newType = new Entry(); - getEntry().add(newType); - return newType; - } - - /** - * Adds a given new value for entry () - * - *

    - * Definition: - * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only) - *

    - * @param theValue The entry to add (must not be null) - */ - public Bundle addEntry(Entry theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getEntry().add(theValue); - return this; - } - - /** - * Gets the first repetition for entry (), - * creating it if it does not already exist. - * - *

    - * Definition: - * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only) - *

    - */ - public Entry getEntryFirstRep() { - if (getEntry().isEmpty()) { - return addEntry(); - } - return getEntry().get(0); - } - - /** - * Gets the value(s) for signature (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Digital Signature - base64 encoded. XML DigSIg or a JWT - *

    - */ - public SignatureDt getSignature() { - if (mySignature == null) { - mySignature = new SignatureDt(); - } - return mySignature; - } - - /** - * Sets the value(s) for signature () - * - *

    - * Definition: - * Digital Signature - base64 encoded. XML DigSIg or a JWT - *

    - */ - public Bundle setSignature(SignatureDt theValue) { - mySignature = theValue; - return this; - } - - - - - /** - * Block class for child element: Bundle.link () - * - *

    - * Definition: - * A series of links that provide context to this bundle - *

    - */ - @Block() - public static class Link - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="relation", type=StringDt.class, order=0, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]]" - ) - private StringDt myRelation; - - @Child(name="url", type=UriDt.class, order=1, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The reference details for the link" - ) - private UriDt myUrl; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myRelation, myUrl); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myRelation, myUrl); - } - - /** - * Gets the value(s) for relation (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]] - *

    - */ - public StringDt getRelationElement() { - if (myRelation == null) { - myRelation = new StringDt(); - } - return myRelation; - } - - - /** - * Gets the value(s) for relation (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]] - *

    - */ - public String getRelation() { - return getRelationElement().getValue(); - } - - /** - * Sets the value(s) for relation () - * - *

    - * Definition: - * A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]] - *

    - */ - public Link setRelation(StringDt theValue) { - myRelation = theValue; - return this; - } - - - - /** - * Sets the value for relation () - * - *

    - * Definition: - * A name which details the functional use for this link - see [[http://www.iana.org/assignments/link-relations/link-relations.xhtml]] - *

    - */ - public Link setRelation( String theString) { - myRelation = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for url (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The reference details for the link - *

    - */ - public UriDt getUrlElement() { - if (myUrl == null) { - myUrl = new UriDt(); - } - return myUrl; - } - - - /** - * Gets the value(s) for url (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The reference details for the link - *

    - */ - public String getUrl() { - return getUrlElement().getValue(); - } - - /** - * Sets the value(s) for url () - * - *

    - * Definition: - * The reference details for the link - *

    - */ - public Link setUrl(UriDt theValue) { - myUrl = theValue; - return this; - } - - - - /** - * Sets the value for url () - * - *

    - * Definition: - * The reference details for the link - *

    - */ - public Link setUrl( String theUri) { - myUrl = new UriDt(theUri); - return this; - } - - - - - } - - - /** - * Block class for child element: Bundle.entry () - * - *

    - * Definition: - * An entry in a bundle resource - will either contain a resource, or information about a resource (transactions and history only) - *

    - */ - @Block() - public static class Entry - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="link", type=Link.class, order=0, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A series of links that provide context to this entry" - ) - private java.util.List myLink; - - @Child(name="fullUrl", type=UriDt.class, order=1, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource" - ) - private UriDt myFullUrl; - - @Child(name="resource", type=IResource.class, order=2, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The Resources for the entry" - ) - private IResource myResource; - - @Child(name="search", order=3, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Information about the search process that lead to the creation of this entry" - ) - private EntrySearch mySearch; - - @Child(name="request", order=4, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Additional information about how this entry should be processed as part of a transaction" - ) - private EntryRequest myRequest; - - @Child(name="response", order=5, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Additional information about how this entry should be processed as part of a transaction" - ) - private EntryResponse myResponse; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myLink, myFullUrl, myResource, mySearch, myRequest, myResponse); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myLink, myFullUrl, myResource, mySearch, myRequest, myResponse); - } - - /** - * Gets the value(s) for link (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A series of links that provide context to this entry - *

    - */ - public java.util.List getLink() { - if (myLink == null) { - myLink = new java.util.ArrayList(); - } - return myLink; - } - - /** - * Sets the value(s) for link () - * - *

    - * Definition: - * A series of links that provide context to this entry - *

    - */ - public Entry setLink(java.util.List theValue) { - myLink = theValue; - return this; - } - - - - /** - * Adds and returns a new value for link () - * - *

    - * Definition: - * A series of links that provide context to this entry - *

    - */ - public Link addLink() { - Link newType = new Link(); - getLink().add(newType); - return newType; - } - - /** - * Adds a given new value for link () - * - *

    - * Definition: - * A series of links that provide context to this entry - *

    - * @param theValue The link to add (must not be null) - */ - public Entry addLink(Link theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getLink().add(theValue); - return this; - } - - /** - * Gets the first repetition for link (), - * creating it if it does not already exist. - * - *

    - * Definition: - * A series of links that provide context to this entry - *

    - */ - public Link getLinkFirstRep() { - if (getLink().isEmpty()) { - return addLink(); - } - return getLink().get(0); - } - - /** - * Gets the value(s) for fullUrl (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource - *

    - */ - public UriDt getFullUrlElement() { - if (myFullUrl == null) { - myFullUrl = new UriDt(); - } - return myFullUrl; - } - - - /** - * Gets the value(s) for fullUrl (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource - *

    - */ - public String getFullUrl() { - return getFullUrlElement().getValue(); - } - - /** - * Sets the value(s) for fullUrl () - * - *

    - * Definition: - * The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource - *

    - */ - public Entry setFullUrl(UriDt theValue) { - myFullUrl = theValue; - return this; - } - - - - /** - * Sets the value for fullUrl () - * - *

    - * Definition: - * The Absolute URL for the resource. This must be provided for all resources. The fullUrl SHALL not disagree with the id in the resource. The fullUrl is a version independent reference to the resource - *

    - */ - public Entry setFullUrl( String theUri) { - myFullUrl = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for resource (). - * - *

    - * Definition: - * The Resources for the entry - *

    - */ - public IResource getResource() { - return myResource; - } - - - /** - * Sets the value(s) for resource () - * - *

    - * Definition: - * The Resources for the entry - *

    - */ - public Entry setResource(IResource theValue) { - myResource = theValue; - return this; - } - - - - - /** - * Gets the value(s) for search (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Information about the search process that lead to the creation of this entry - *

    - */ - public EntrySearch getSearch() { - if (mySearch == null) { - mySearch = new EntrySearch(); - } - return mySearch; - } - - /** - * Sets the value(s) for search () - * - *

    - * Definition: - * Information about the search process that lead to the creation of this entry - *

    - */ - public Entry setSearch(EntrySearch theValue) { - mySearch = theValue; - return this; - } - - - - - /** - * Gets the value(s) for request (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Additional information about how this entry should be processed as part of a transaction - *

    - */ - public EntryRequest getRequest() { - if (myRequest == null) { - myRequest = new EntryRequest(); - } - return myRequest; - } - - /** - * Sets the value(s) for request () - * - *

    - * Definition: - * Additional information about how this entry should be processed as part of a transaction - *

    - */ - public Entry setRequest(EntryRequest theValue) { - myRequest = theValue; - return this; - } - - - - - /** - * Gets the value(s) for response (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Additional information about how this entry should be processed as part of a transaction - *

    - */ - public EntryResponse getResponse() { - if (myResponse == null) { - myResponse = new EntryResponse(); - } - return myResponse; - } - - /** - * Sets the value(s) for response () - * - *

    - * Definition: - * Additional information about how this entry should be processed as part of a transaction - *

    - */ - public Entry setResponse(EntryResponse theValue) { - myResponse = theValue; - return this; - } - - - - - - - } - - /** - * Block class for child element: Bundle.entry.search () - * - *

    - * Definition: - * Information about the search process that lead to the creation of this entry - *

    - */ - @Block() - public static class EntrySearch - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="mode", type=CodeDt.class, order=0, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Why this entry is in the result set - whether it's included as a match or because of an _include requirement" - ) - private BoundCodeDt myMode; - - @Child(name="score", type=DecimalDt.class, order=1, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="When searching, the server's search ranking score for the entry" - ) - private DecimalDt myScore; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myMode, myScore); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myMode, myScore); - } - - /** - * Gets the value(s) for mode (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Why this entry is in the result set - whether it's included as a match or because of an _include requirement - *

    - */ - public BoundCodeDt getModeElement() { - if (myMode == null) { - myMode = new BoundCodeDt(SearchEntryModeEnum.VALUESET_BINDER); - } - return myMode; - } - - - /** - * Gets the value(s) for mode (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Why this entry is in the result set - whether it's included as a match or because of an _include requirement - *

    - */ - public String getMode() { - return getModeElement().getValue(); - } - - /** - * Sets the value(s) for mode () - * - *

    - * Definition: - * Why this entry is in the result set - whether it's included as a match or because of an _include requirement - *

    - */ - public EntrySearch setMode(BoundCodeDt theValue) { - myMode = theValue; - return this; - } - - - - /** - * Sets the value(s) for mode () - * - *

    - * Definition: - * Why this entry is in the result set - whether it's included as a match or because of an _include requirement - *

    - */ - public EntrySearch setMode(SearchEntryModeEnum theValue) { - getModeElement().setValueAsEnum(theValue); - return this; - } - - - /** - * Gets the value(s) for score (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * When searching, the server's search ranking score for the entry - *

    - */ - public DecimalDt getScoreElement() { - if (myScore == null) { - myScore = new DecimalDt(); - } - return myScore; - } - - - /** - * Gets the value(s) for score (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * When searching, the server's search ranking score for the entry - *

    - */ - public BigDecimal getScore() { - return getScoreElement().getValue(); - } - - /** - * Sets the value(s) for score () - * - *

    - * Definition: - * When searching, the server's search ranking score for the entry - *

    - */ - public EntrySearch setScore(DecimalDt theValue) { - myScore = theValue; - return this; - } - - - - /** - * Sets the value for score () - * - *

    - * Definition: - * When searching, the server's search ranking score for the entry - *

    - */ - public EntrySearch setScore( long theValue) { - myScore = new DecimalDt(theValue); - return this; - } - - /** - * Sets the value for score () - * - *

    - * Definition: - * When searching, the server's search ranking score for the entry - *

    - */ - public EntrySearch setScore( double theValue) { - myScore = new DecimalDt(theValue); - return this; - } - - /** - * Sets the value for score () - * - *

    - * Definition: - * When searching, the server's search ranking score for the entry - *

    - */ - public EntrySearch setScore( java.math.BigDecimal theValue) { - myScore = new DecimalDt(theValue); - return this; - } - - - - - } - - - /** - * Block class for child element: Bundle.entry.request () - * - *

    - * Definition: - * Additional information about how this entry should be processed as part of a transaction - *

    - */ - @Block() - public static class EntryRequest - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="method", type=CodeDt.class, order=0, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The HTTP verb for this entry in either a update history, or a transaction/ transaction response" - ) - private BoundCodeDt myMethod; - - @Child(name="url", type=UriDt.class, order=1, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The URL for this entry, relative to the root (the address to which the request is posted)" - ) - private UriDt myUrl; - - @Child(name="ifNoneMatch", type=StringDt.class, order=2, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="If the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation" - ) - private StringDt myIfNoneMatch; - - @Child(name="ifMatch", type=StringDt.class, order=3, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Only perform the operation if the Etag value matches. For more information, see the API section \"Managing Resource Contention\"" - ) - private StringDt myIfMatch; - - @Child(name="ifModifiedSince", type=InstantDt.class, order=4, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Only perform the operation if the last updated date matches. For more information, see the API section \"Managing Resource Contention\"" - ) - private InstantDt myIfModifiedSince; - - @Child(name="ifNoneExist", type=StringDt.class, order=5, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Instruct the server not to perform the create if a specified resource already exists. For further information, see \"Conditional Create\". This is just the query portion of the URL - what follows the \"?\" (not including the \"?\")" - ) - private StringDt myIfNoneExist; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myMethod, myUrl, myIfNoneMatch, myIfMatch, myIfModifiedSince, myIfNoneExist); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myMethod, myUrl, myIfNoneMatch, myIfMatch, myIfModifiedSince, myIfNoneExist); - } - - /** - * Gets the value(s) for method (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The HTTP verb for this entry in either a update history, or a transaction/ transaction response - *

    - */ - public BoundCodeDt getMethodElement() { - if (myMethod == null) { - myMethod = new BoundCodeDt(HTTPVerbEnum.VALUESET_BINDER); - } - return myMethod; - } - - - /** - * Gets the value(s) for method (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The HTTP verb for this entry in either a update history, or a transaction/ transaction response - *

    - */ - public String getMethod() { - return getMethodElement().getValue(); - } - - /** - * Sets the value(s) for method () - * - *

    - * Definition: - * The HTTP verb for this entry in either a update history, or a transaction/ transaction response - *

    - */ - public EntryRequest setMethod(BoundCodeDt theValue) { - myMethod = theValue; - return this; - } - - - - /** - * Sets the value(s) for method () - * - *

    - * Definition: - * The HTTP verb for this entry in either a update history, or a transaction/ transaction response - *

    - */ - public EntryRequest setMethod(HTTPVerbEnum theValue) { - getMethodElement().setValueAsEnum(theValue); - return this; - } - - - /** - * Gets the value(s) for url (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The URL for this entry, relative to the root (the address to which the request is posted) - *

    - */ - public UriDt getUrlElement() { - if (myUrl == null) { - myUrl = new UriDt(); - } - return myUrl; - } - - - /** - * Gets the value(s) for url (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The URL for this entry, relative to the root (the address to which the request is posted) - *

    - */ - public String getUrl() { - return getUrlElement().getValue(); - } - - /** - * Sets the value(s) for url () - * - *

    - * Definition: - * The URL for this entry, relative to the root (the address to which the request is posted) - *

    - */ - public EntryRequest setUrl(UriDt theValue) { - myUrl = theValue; - return this; - } - - - - /** - * Sets the value for url () - * - *

    - * Definition: - * The URL for this entry, relative to the root (the address to which the request is posted) - *

    - */ - public EntryRequest setUrl( String theUri) { - myUrl = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for ifNoneMatch (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation - *

    - */ - public StringDt getIfNoneMatchElement() { - if (myIfNoneMatch == null) { - myIfNoneMatch = new StringDt(); - } - return myIfNoneMatch; - } - - - /** - * Gets the value(s) for ifNoneMatch (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation - *

    - */ - public String getIfNoneMatch() { - return getIfNoneMatchElement().getValue(); - } - - /** - * Sets the value(s) for ifNoneMatch () - * - *

    - * Definition: - * If the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation - *

    - */ - public EntryRequest setIfNoneMatch(StringDt theValue) { - myIfNoneMatch = theValue; - return this; - } - - - - /** - * Sets the value for ifNoneMatch () - * - *

    - * Definition: - * If the ETag values match, return a 304 Not modified status. See the read/vread interaction documentation - *

    - */ - public EntryRequest setIfNoneMatch( String theString) { - myIfNoneMatch = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for ifMatch (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Only perform the operation if the Etag value matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public StringDt getIfMatchElement() { - if (myIfMatch == null) { - myIfMatch = new StringDt(); - } - return myIfMatch; - } - - - /** - * Gets the value(s) for ifMatch (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Only perform the operation if the Etag value matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public String getIfMatch() { - return getIfMatchElement().getValue(); - } - - /** - * Sets the value(s) for ifMatch () - * - *

    - * Definition: - * Only perform the operation if the Etag value matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public EntryRequest setIfMatch(StringDt theValue) { - myIfMatch = theValue; - return this; - } - - - - /** - * Sets the value for ifMatch () - * - *

    - * Definition: - * Only perform the operation if the Etag value matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public EntryRequest setIfMatch( String theString) { - myIfMatch = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for ifModifiedSince (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Only perform the operation if the last updated date matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public InstantDt getIfModifiedSinceElement() { - if (myIfModifiedSince == null) { - myIfModifiedSince = new InstantDt(); - } - return myIfModifiedSince; - } - - - /** - * Gets the value(s) for ifModifiedSince (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Only perform the operation if the last updated date matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public Date getIfModifiedSince() { - return getIfModifiedSinceElement().getValue(); - } - - /** - * Sets the value(s) for ifModifiedSince () - * - *

    - * Definition: - * Only perform the operation if the last updated date matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public EntryRequest setIfModifiedSince(InstantDt theValue) { - myIfModifiedSince = theValue; - return this; - } - - - - /** - * Sets the value for ifModifiedSince () - * - *

    - * Definition: - * Only perform the operation if the last updated date matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public EntryRequest setIfModifiedSinceWithMillisPrecision( Date theDate) { - myIfModifiedSince = new InstantDt(theDate); - return this; - } - - /** - * Sets the value for ifModifiedSince () - * - *

    - * Definition: - * Only perform the operation if the last updated date matches. For more information, see the API section \"Managing Resource Contention\" - *

    - */ - public EntryRequest setIfModifiedSince( Date theDate, TemporalPrecisionEnum thePrecision) { - myIfModifiedSince = new InstantDt(theDate, thePrecision); - return this; - } - - - /** - * Gets the value(s) for ifNoneExist (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Instruct the server not to perform the create if a specified resource already exists. For further information, see \"Conditional Create\". This is just the query portion of the URL - what follows the \"?\" (not including the \"?\") - *

    - */ - public StringDt getIfNoneExistElement() { - if (myIfNoneExist == null) { - myIfNoneExist = new StringDt(); - } - return myIfNoneExist; - } - - - /** - * Gets the value(s) for ifNoneExist (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Instruct the server not to perform the create if a specified resource already exists. For further information, see \"Conditional Create\". This is just the query portion of the URL - what follows the \"?\" (not including the \"?\") - *

    - */ - public String getIfNoneExist() { - return getIfNoneExistElement().getValue(); - } - - /** - * Sets the value(s) for ifNoneExist () - * - *

    - * Definition: - * Instruct the server not to perform the create if a specified resource already exists. For further information, see \"Conditional Create\". This is just the query portion of the URL - what follows the \"?\" (not including the \"?\") - *

    - */ - public EntryRequest setIfNoneExist(StringDt theValue) { - myIfNoneExist = theValue; - return this; - } - - - - /** - * Sets the value for ifNoneExist () - * - *

    - * Definition: - * Instruct the server not to perform the create if a specified resource already exists. For further information, see \"Conditional Create\". This is just the query portion of the URL - what follows the \"?\" (not including the \"?\") - *

    - */ - public EntryRequest setIfNoneExist( String theString) { - myIfNoneExist = new StringDt(theString); - return this; - } - - - - - } - - - /** - * Block class for child element: Bundle.entry.response () - * - *

    - * Definition: - * Additional information about how this entry should be processed as part of a transaction - *

    - */ - @Block() - public static class EntryResponse - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="status", type=StringDt.class, order=0, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The status code returned by processing this entry" - ) - private StringDt myStatus; - - @Child(name="location", type=UriDt.class, order=1, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The location header created by processing this operation" - ) - private UriDt myLocation; - - @Child(name="etag", type=StringDt.class, order=2, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The etag for the resource, it the operation for the entry produced a versioned resource" - ) - private StringDt myEtag; - - @Child(name="lastModified", type=InstantDt.class, order=3, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The date/time that the resource was modified on the server" - ) - private InstantDt myLastModified; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myStatus, myLocation, myEtag, myLastModified); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myStatus, myLocation, myEtag, myLastModified); - } - - /** - * Gets the value(s) for status (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The status code returned by processing this entry - *

    - */ - public StringDt getStatusElement() { - if (myStatus == null) { - myStatus = new StringDt(); - } - return myStatus; - } - - - /** - * Gets the value(s) for status (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The status code returned by processing this entry - *

    - */ - public String getStatus() { - return getStatusElement().getValue(); - } - - /** - * Sets the value(s) for status () - * - *

    - * Definition: - * The status code returned by processing this entry - *

    - */ - public EntryResponse setStatus(StringDt theValue) { - myStatus = theValue; - return this; - } - - - - /** - * Sets the value for status () - * - *

    - * Definition: - * The status code returned by processing this entry - *

    - */ - public EntryResponse setStatus( String theString) { - myStatus = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for location (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The location header created by processing this operation - *

    - */ - public UriDt getLocationElement() { - if (myLocation == null) { - myLocation = new UriDt(); - } - return myLocation; - } - - - /** - * Gets the value(s) for location (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The location header created by processing this operation - *

    - */ - public String getLocation() { - return getLocationElement().getValue(); - } - - /** - * Sets the value(s) for location () - * - *

    - * Definition: - * The location header created by processing this operation - *

    - */ - public EntryResponse setLocation(UriDt theValue) { - myLocation = theValue; - return this; - } - - - - /** - * Sets the value for location () - * - *

    - * Definition: - * The location header created by processing this operation - *

    - */ - public EntryResponse setLocation( String theUri) { - myLocation = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for etag (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The etag for the resource, it the operation for the entry produced a versioned resource - *

    - */ - public StringDt getEtagElement() { - if (myEtag == null) { - myEtag = new StringDt(); - } - return myEtag; - } - - - /** - * Gets the value(s) for etag (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The etag for the resource, it the operation for the entry produced a versioned resource - *

    - */ - public String getEtag() { - return getEtagElement().getValue(); - } - - /** - * Sets the value(s) for etag () - * - *

    - * Definition: - * The etag for the resource, it the operation for the entry produced a versioned resource - *

    - */ - public EntryResponse setEtag(StringDt theValue) { - myEtag = theValue; - return this; - } - - - - /** - * Sets the value for etag () - * - *

    - * Definition: - * The etag for the resource, it the operation for the entry produced a versioned resource - *

    - */ - public EntryResponse setEtag( String theString) { - myEtag = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for lastModified (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The date/time that the resource was modified on the server - *

    - */ - public InstantDt getLastModifiedElement() { - if (myLastModified == null) { - myLastModified = new InstantDt(); - } - return myLastModified; - } - - - /** - * Gets the value(s) for lastModified (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The date/time that the resource was modified on the server - *

    - */ - public Date getLastModified() { - return getLastModifiedElement().getValue(); - } - - /** - * Sets the value(s) for lastModified () - * - *

    - * Definition: - * The date/time that the resource was modified on the server - *

    - */ - public EntryResponse setLastModified(InstantDt theValue) { - myLastModified = theValue; - return this; - } - - - - /** - * Sets the value for lastModified () - * - *

    - * Definition: - * The date/time that the resource was modified on the server - *

    - */ - public EntryResponse setLastModifiedWithMillisPrecision( Date theDate) { - myLastModified = new InstantDt(theDate); - return this; - } - - /** - * Sets the value for lastModified () - * - *

    - * Definition: - * The date/time that the resource was modified on the server - *

    - */ - public EntryResponse setLastModified( Date theDate, TemporalPrecisionEnum thePrecision) { - myLastModified = new InstantDt(theDate, thePrecision); - return this; - } - - - - - } - - - - - - @Override - public String getResourceName() { - return "Bundle"; - } - - public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() { - return ca.uhn.fhir.context.FhirVersionEnum.DSTU2; - } - - /** - * Returns the {@link #getLink() link} which matches a given {@link Link#getRelation() relation}. - * If no link is found which matches the given relation, returns null. If more than one - * link is found which matches the given relation, returns the first matching Link. - * - * @param theRelation - * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. - * @return Returns a matching Link, or null - * @see IBaseBundle#LINK_NEXT - * @see IBaseBundle#LINK_PREV - * @see IBaseBundle#LINK_SELF - */ - public Link getLink(String theRelation) { - org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); - for (Link next : getLink()) { - if (theRelation.equals(next.getRelation())) { - return next; - } - } - return null; - } - - /** - * Returns the {@link #getLink() link} which matches a given {@link Link#getRelation() relation}. - * If no link is found which matches the given relation, creates a new Link with the - * given relation and adds it to this Bundle. If more than one - * link is found which matches the given relation, returns the first matching Link. - * - * @param theRelation - * The relation, such as "next", or "self. See the constants such as {@link IBaseBundle#LINK_SELF} and {@link IBaseBundle#LINK_NEXT}. - * @return Returns a matching Link, or null - * @see IBaseBundle#LINK_NEXT - * @see IBaseBundle#LINK_PREV - * @see IBaseBundle#LINK_SELF - */ - public Link getLinkOrCreate(String theRelation) { - org.apache.commons.lang3.Validate.notBlank(theRelation, "theRelation may not be null or empty"); - for (Link next : getLink()) { - if (theRelation.equals(next.getRelation())) { - return next; - } - } - Link retVal = new Link(); - retVal.setRelation(theRelation); - getLink().add(retVal); - return retVal; - } - -} diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/StructureDefinition.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/StructureDefinition.java deleted file mode 100644 index 29f0376a1b3..00000000000 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/StructureDefinition.java +++ /dev/null @@ -1,3044 +0,0 @@ - - - - - - - - - - - - - - - - -package ca.uhn.fhir.model.dstu2.resource; - -import java.util.Date; -import java.util.List; - -import ca.uhn.fhir.model.api.BaseIdentifiableElement; -import ca.uhn.fhir.model.api.IElement; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.api.IResourceBlock; -import ca.uhn.fhir.model.api.Include; -import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.model.api.annotation.Block; -import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; -import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; -import ca.uhn.fhir.model.dstu2.composite.CodingDt; -import ca.uhn.fhir.model.dstu2.composite.ContactPointDt; -import ca.uhn.fhir.model.dstu2.composite.ElementDefinitionDt; -import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; -import ca.uhn.fhir.model.dstu2.valueset.ConformanceResourceStatusEnum; -import ca.uhn.fhir.model.dstu2.valueset.ExtensionContextEnum; -import ca.uhn.fhir.model.dstu2.valueset.StructureDefinitionKindEnum; -import ca.uhn.fhir.model.primitive.BooleanDt; -import ca.uhn.fhir.model.primitive.BoundCodeDt; -import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.DateTimeDt; -import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.model.primitive.StringDt; -import ca.uhn.fhir.model.primitive.UriDt; -import ca.uhn.fhir.rest.gclient.DateClientParam; -import ca.uhn.fhir.rest.gclient.ReferenceClientParam; -import ca.uhn.fhir.rest.gclient.StringClientParam; -import ca.uhn.fhir.rest.gclient.TokenClientParam; -import ca.uhn.fhir.rest.gclient.UriClientParam; - - -/** - * HAPI/FHIR StructureDefinition Resource - * (conformance.content) - * - *

    - * Definition: - * A definition of a FHIR structure. This resource is used to describe the underlying resources, data types defined in FHIR, and also for describing extensions, and constraints on resources and data types - *

    - * - *

    - * Requirements: - * - *

    - * - *

    - * Profile Definition: - * http://hl7.org/fhir/profiles/StructureDefinition - *

    - * - */ -@ResourceDef(name="StructureDefinition", profile="http://hl7.org/fhir/profiles/StructureDefinition", id="structuredefinition") -public class StructureDefinition extends ca.uhn.fhir.model.dstu2.resource.BaseResource - implements IResource { - - /** - * Search parameter constant for url - *

    - * Description:
    - * Type: uri
    - * Path: StructureDefinition.url
    - *

    - */ - @SearchParamDefinition(name="url", path="StructureDefinition.url", description="", type="uri" ) - public static final String SP_URL = "url"; - - /** - * Fluent Client search parameter constant for url - *

    - * Description:
    - * Type: uri
    - * Path: StructureDefinition.url
    - *

    - */ - public static final UriClientParam URL = new UriClientParam(SP_URL); - - /** - * Search parameter constant for identifier - *

    - * Description: The identifier of the profile
    - * Type: token
    - * Path: StructureDefinition.identifier
    - *

    - */ - @SearchParamDefinition(name="identifier", path="StructureDefinition.identifier", description="The identifier of the profile", type="token" ) - public static final String SP_IDENTIFIER = "identifier"; - - /** - * Fluent Client search parameter constant for identifier - *

    - * Description: The identifier of the profile
    - * Type: token
    - * Path: StructureDefinition.identifier
    - *

    - */ - public static final TokenClientParam IDENTIFIER = new TokenClientParam(SP_IDENTIFIER); - - /** - * Search parameter constant for version - *

    - * Description: The version identifier of the profile
    - * Type: token
    - * Path: StructureDefinition.version
    - *

    - */ - @SearchParamDefinition(name="version", path="StructureDefinition.version", description="The version identifier of the profile", type="token" ) - public static final String SP_VERSION = "version"; - - /** - * Fluent Client search parameter constant for version - *

    - * Description: The version identifier of the profile
    - * Type: token
    - * Path: StructureDefinition.version
    - *

    - */ - public static final TokenClientParam VERSION = new TokenClientParam(SP_VERSION); - - /** - * Search parameter constant for name - *

    - * Description: Name of the profile
    - * Type: string
    - * Path: StructureDefinition.name
    - *

    - */ - @SearchParamDefinition(name="name", path="StructureDefinition.name", description="Name of the profile", type="string" ) - public static final String SP_NAME = "name"; - - /** - * Fluent Client search parameter constant for name - *

    - * Description: Name of the profile
    - * Type: string
    - * Path: StructureDefinition.name
    - *

    - */ - public static final StringClientParam NAME = new StringClientParam(SP_NAME); - - /** - * Search parameter constant for publisher - *

    - * Description: Name of the publisher of the profile
    - * Type: string
    - * Path: StructureDefinition.publisher
    - *

    - */ - @SearchParamDefinition(name="publisher", path="StructureDefinition.publisher", description="Name of the publisher of the profile", type="string" ) - public static final String SP_PUBLISHER = "publisher"; - - /** - * Fluent Client search parameter constant for publisher - *

    - * Description: Name of the publisher of the profile
    - * Type: string
    - * Path: StructureDefinition.publisher
    - *

    - */ - public static final StringClientParam PUBLISHER = new StringClientParam(SP_PUBLISHER); - - /** - * Search parameter constant for description - *

    - * Description: Text search in the description of the profile
    - * Type: string
    - * Path: StructureDefinition.description
    - *

    - */ - @SearchParamDefinition(name="description", path="StructureDefinition.description", description="Text search in the description of the profile", type="string" ) - public static final String SP_DESCRIPTION = "description"; - - /** - * Fluent Client search parameter constant for description - *

    - * Description: Text search in the description of the profile
    - * Type: string
    - * Path: StructureDefinition.description
    - *

    - */ - public static final StringClientParam DESCRIPTION = new StringClientParam(SP_DESCRIPTION); - - /** - * Search parameter constant for status - *

    - * Description: The current status of the profile
    - * Type: token
    - * Path: StructureDefinition.status
    - *

    - */ - @SearchParamDefinition(name="status", path="StructureDefinition.status", description="The current status of the profile", type="token" ) - public static final String SP_STATUS = "status"; - - /** - * Fluent Client search parameter constant for status - *

    - * Description: The current status of the profile
    - * Type: token
    - * Path: StructureDefinition.status
    - *

    - */ - public static final TokenClientParam STATUS = new TokenClientParam(SP_STATUS); - - /** - * Search parameter constant for date - *

    - * Description: The profile publication date
    - * Type: date
    - * Path: StructureDefinition.date
    - *

    - */ - @SearchParamDefinition(name="date", path="StructureDefinition.date", description="The profile publication date", type="date" ) - public static final String SP_DATE = "date"; - - /** - * Fluent Client search parameter constant for date - *

    - * Description: The profile publication date
    - * Type: date
    - * Path: StructureDefinition.date
    - *

    - */ - public static final DateClientParam DATE = new DateClientParam(SP_DATE); - - /** - * Search parameter constant for code - *

    - * Description: A code for the profile
    - * Type: token
    - * Path: StructureDefinition.code
    - *

    - */ - @SearchParamDefinition(name="code", path="StructureDefinition.code", description="A code for the profile", type="token" ) - public static final String SP_CODE = "code"; - - /** - * Fluent Client search parameter constant for code - *

    - * Description: A code for the profile
    - * Type: token
    - * Path: StructureDefinition.code
    - *

    - */ - public static final TokenClientParam CODE = new TokenClientParam(SP_CODE); - - /** - * Search parameter constant for valueset - *

    - * Description: A vocabulary binding reference
    - * Type: reference
    - * Path: StructureDefinition.snapshot.element.binding.valueSet[x]
    - *

    - */ - @SearchParamDefinition(name="valueset", path="StructureDefinition.snapshot.element.binding.valueSet[x]", description="A vocabulary binding reference", type="reference" ) - public static final String SP_VALUESET = "valueset"; - - /** - * Fluent Client search parameter constant for valueset - *

    - * Description: A vocabulary binding reference
    - * Type: reference
    - * Path: StructureDefinition.snapshot.element.binding.valueSet[x]
    - *

    - */ - public static final ReferenceClientParam VALUESET = new ReferenceClientParam(SP_VALUESET); - - /** - * Search parameter constant for type - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.constrainedType
    - *

    - */ - @SearchParamDefinition(name="type", path="StructureDefinition.constrainedType", description="", type="token" ) - public static final String SP_TYPE = "type"; - - /** - * Fluent Client search parameter constant for type - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.constrainedType
    - *

    - */ - public static final TokenClientParam TYPE = new TokenClientParam(SP_TYPE); - - /** - * Search parameter constant for kind - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.kind
    - *

    - */ - @SearchParamDefinition(name="kind", path="StructureDefinition.kind", description="", type="token" ) - public static final String SP_KIND = "kind"; - - /** - * Fluent Client search parameter constant for kind - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.kind
    - *

    - */ - public static final TokenClientParam KIND = new TokenClientParam(SP_KIND); - - /** - * Search parameter constant for path - *

    - * Description: A path that is constrained in the profile
    - * Type: token
    - * Path: StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path
    - *

    - */ - @SearchParamDefinition(name="path", path="StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path ", description="A path that is constrained in the profile", type="token" ) - public static final String SP_PATH = "path"; - - /** - * Fluent Client search parameter constant for path - *

    - * Description: A path that is constrained in the profile
    - * Type: token
    - * Path: StructureDefinition.snapshot.element.path | StructureDefinition.differential.element.path
    - *

    - */ - public static final TokenClientParam PATH = new TokenClientParam(SP_PATH); - - /** - * Search parameter constant for context - *

    - * Description: A use context assigned to the structure
    - * Type: token
    - * Path: StructureDefinition.useContext
    - *

    - */ - @SearchParamDefinition(name="context", path="StructureDefinition.useContext", description="A use context assigned to the structure", type="token" ) - public static final String SP_CONTEXT = "context"; - - /** - * Fluent Client search parameter constant for context - *

    - * Description: A use context assigned to the structure
    - * Type: token
    - * Path: StructureDefinition.useContext
    - *

    - */ - public static final TokenClientParam CONTEXT = new TokenClientParam(SP_CONTEXT); - - /** - * Search parameter constant for display - *

    - * Description:
    - * Type: string
    - * Path: StructureDefinition.display
    - *

    - */ - @SearchParamDefinition(name="display", path="StructureDefinition.display", description="", type="string" ) - public static final String SP_DISPLAY = "display"; - - /** - * Fluent Client search parameter constant for display - *

    - * Description:
    - * Type: string
    - * Path: StructureDefinition.display
    - *

    - */ - public static final StringClientParam DISPLAY = new StringClientParam(SP_DISPLAY); - - /** - * Search parameter constant for experimental - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.experimental
    - *

    - */ - @SearchParamDefinition(name="experimental", path="StructureDefinition.experimental", description="", type="token" ) - public static final String SP_EXPERIMENTAL = "experimental"; - - /** - * Fluent Client search parameter constant for experimental - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.experimental
    - *

    - */ - public static final TokenClientParam EXPERIMENTAL = new TokenClientParam(SP_EXPERIMENTAL); - - /** - * Search parameter constant for abstract - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.abstract
    - *

    - */ - @SearchParamDefinition(name="abstract", path="StructureDefinition.abstract", description="", type="token" ) - public static final String SP_ABSTRACT = "abstract"; - - /** - * Fluent Client search parameter constant for abstract - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.abstract
    - *

    - */ - public static final TokenClientParam ABSTRACT = new TokenClientParam(SP_ABSTRACT); - - /** - * Search parameter constant for context-type - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.contextType
    - *

    - */ - @SearchParamDefinition(name="context-type", path="StructureDefinition.contextType", description="", type="token" ) - public static final String SP_CONTEXT_TYPE = "context-type"; - - /** - * Fluent Client search parameter constant for context-type - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.contextType
    - *

    - */ - public static final TokenClientParam CONTEXT_TYPE = new TokenClientParam(SP_CONTEXT_TYPE); - - /** - * Search parameter constant for ext-context - *

    - * Description:
    - * Type: string
    - * Path: StructureDefinition.context
    - *

    - */ - @SearchParamDefinition(name="ext-context", path="StructureDefinition.context", description="", type="string" ) - public static final String SP_EXT_CONTEXT = "ext-context"; - - /** - * Fluent Client search parameter constant for ext-context - *

    - * Description:
    - * Type: string
    - * Path: StructureDefinition.context
    - *

    - */ - public static final StringClientParam EXT_CONTEXT = new StringClientParam(SP_EXT_CONTEXT); - - /** - * Search parameter constant for base - *

    - * Description:
    - * Type: uri
    - * Path: StructureDefinition.base
    - *

    - */ - @SearchParamDefinition(name="base", path="StructureDefinition.base", description="", type="uri" ) - public static final String SP_BASE = "base"; - - /** - * Fluent Client search parameter constant for base - *

    - * Description:
    - * Type: uri
    - * Path: StructureDefinition.base
    - *

    - */ - public static final UriClientParam BASE = new UriClientParam(SP_BASE); - - /** - * Search parameter constant for base-path - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path
    - *

    - */ - @SearchParamDefinition(name="base-path", path="StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path ", description="", type="token" ) - public static final String SP_BASE_PATH = "base-path"; - - /** - * Fluent Client search parameter constant for base-path - *

    - * Description:
    - * Type: token
    - * Path: StructureDefinition.snapshot.element.base.path | StructureDefinition.differential.element.base.path
    - *

    - */ - public static final TokenClientParam BASE_PATH = new TokenClientParam(SP_BASE_PATH); - - - /** - * Constant for fluent queries to be used to add include statements. Specifies - * the path value of "StructureDefinition:valueset". - */ - public static final Include INCLUDE_VALUESET = new Include("StructureDefinition:valueset"); - - - @Child(name="url", type=UriDt.class, order=0, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="id", - formalDefinition="An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published" - ) - private UriDt myUrl; - - @Child(name="identifier", type=IdentifierDt.class, order=1, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="id", - formalDefinition="Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI)" - ) - private java.util.List myIdentifier; - - @Child(name="version", type=StringDt.class, order=2, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="id.version", - formalDefinition="The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually" - ) - private StringDt myVersion; - - @Child(name="name", type=StringDt.class, order=3, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A free text natural language name identifying the StructureDefinition" - ) - private StringDt myName; - - @Child(name="display", type=StringDt.class, order=4, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Defined so that applications can use this name when displaying the value of the extension to the user" - ) - private StringDt myDisplay; - - @Child(name="status", type=CodeDt.class, order=5, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="status", - formalDefinition="The status of the StructureDefinition" - ) - private BoundCodeDt myStatus; - - @Child(name="experimental", type=BooleanDt.class, order=6, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="class", - formalDefinition="This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage" - ) - private BooleanDt myExperimental; - - @Child(name="publisher", type=StringDt.class, order=7, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="who.witness", - formalDefinition="The name of the individual or organization that published the structure definition" - ) - private StringDt myPublisher; - - @Child(name="contact", order=8, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Contacts to assist a user in finding and communicating with the publisher" - ) - private java.util.List myContact; - - @Child(name="date", type=DateTimeDt.class, order=9, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="when.recorded", - formalDefinition="The date that this version of the StructureDefinition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the structure definition changes" - ) - private DateTimeDt myDate; - - @Child(name="description", type=StringDt.class, order=10, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A free text natural language description of the StructureDefinition and its use" - ) - private StringDt myDescription; - - @Child(name="useContext", type=CodeableConceptDt.class, order=11, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions." - ) - private java.util.List myUseContext; - - @Child(name="requirements", type=StringDt.class, order=12, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="why", - formalDefinition="Explains why this structure definition is needed and why it's been constrained as it has" - ) - private StringDt myRequirements; - - @Child(name="copyright", type=StringDt.class, order=13, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings" - ) - private StringDt myCopyright; - - @Child(name="code", type=CodingDt.class, order=14, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A set of terms from external terminologies that may be used to assist with indexing and searching of templates." - ) - private java.util.List myCode; - - @Child(name="fhirVersion", type=IdDt.class, order=15, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is $version$ for this version" - ) - private IdDt myFhirVersion; - - @Child(name="mapping", order=16, min=0, max=Child.MAX_UNLIMITED, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="An external specification that the content is mapped to" - ) - private java.util.List myMapping; - - @Child(name="kind", type=CodeDt.class, order=17, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Defines the kind of structure that this definition is describing" - ) - private BoundCodeDt myKind; - - @Child(name="constrainedType", type=CodeDt.class, order=18, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure" - ) - private CodeDt myConstrainedType; - - @Child(name="abstract", type=BooleanDt.class, order=19, min=1, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Whether structure this definition describes is abstract or not - that is, whether an actual exchanged item can ever be of this type" - ) - private BooleanDt myAbstract; - - @Child(name="contextType", type=CodeDt.class, order=20, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="If this is an extension, Identifies the context within FHIR resources where the extension can be used" - ) - private BoundCodeDt myContextType; - - @Child(name="context", type=StringDt.class, order=21, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Identifies the types of resource or data type elements to which the extension can be applied" - ) - private java.util.List myContext; - - @Child(name="base", type=UriDt.class, order=22, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="An absolute URI that is the base structure from which this set of constraints is derived" - ) - private UriDt myBase; - - @Child(name="snapshot", order=23, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition" - ) - private Snapshot mySnapshot; - - @Child(name="differential", order=24, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies" - ) - private Differential myDifferential; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myUrl, myIdentifier, myVersion, myName, myDisplay, myStatus, myExperimental, myPublisher, myContact, myDate, myDescription, myUseContext, myRequirements, myCopyright, myCode, myFhirVersion, myMapping, myKind, myConstrainedType, myAbstract, myContextType, myContext, myBase, mySnapshot, myDifferential); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myUrl, myIdentifier, myVersion, myName, myDisplay, myStatus, myExperimental, myPublisher, myContact, myDate, myDescription, myUseContext, myRequirements, myCopyright, myCode, myFhirVersion, myMapping, myKind, myConstrainedType, myAbstract, myContextType, myContext, myBase, mySnapshot, myDifferential); - } - - /** - * Gets the value(s) for url (id). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published - *

    - */ - public UriDt getUrlElement() { - if (myUrl == null) { - myUrl = new UriDt(); - } - return myUrl; - } - - - /** - * Gets the value(s) for url (id). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published - *

    - */ - public String getUrl() { - return getUrlElement().getValue(); - } - - /** - * Sets the value(s) for url (id) - * - *

    - * Definition: - * An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published - *

    - */ - public StructureDefinition setUrl(UriDt theValue) { - myUrl = theValue; - return this; - } - - - - /** - * Sets the value for url (id) - * - *

    - * Definition: - * An absolute URL that is used to identify this structure definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this structure definition is (or will be) published - *

    - */ - public StructureDefinition setUrl( String theUri) { - myUrl = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for identifier (id). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI) - *

    - */ - public java.util.List getIdentifier() { - if (myIdentifier == null) { - myIdentifier = new java.util.ArrayList(); - } - return myIdentifier; - } - - /** - * Sets the value(s) for identifier (id) - * - *

    - * Definition: - * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI) - *

    - */ - public StructureDefinition setIdentifier(java.util.List theValue) { - myIdentifier = theValue; - return this; - } - - - - /** - * Adds and returns a new value for identifier (id) - * - *

    - * Definition: - * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI) - *

    - */ - public IdentifierDt addIdentifier() { - IdentifierDt newType = new IdentifierDt(); - getIdentifier().add(newType); - return newType; - } - - /** - * Adds a given new value for identifier (id) - * - *

    - * Definition: - * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI) - *

    - * @param theValue The identifier to add (must not be null) - */ - public StructureDefinition addIdentifier(IdentifierDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getIdentifier().add(theValue); - return this; - } - - /** - * Gets the first repetition for identifier (id), - * creating it if it does not already exist. - * - *

    - * Definition: - * Formal identifier that is used to identify this StructureDefinition when it is represented in other formats, or referenced in a specification, model, design or an instance (should be globally unique OID, UUID, or URI), (if it's not possible to use the literal URI) - *

    - */ - public IdentifierDt getIdentifierFirstRep() { - if (getIdentifier().isEmpty()) { - return addIdentifier(); - } - return getIdentifier().get(0); - } - - /** - * Gets the value(s) for version (id.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually - *

    - */ - public StringDt getVersionElement() { - if (myVersion == null) { - myVersion = new StringDt(); - } - return myVersion; - } - - - /** - * Gets the value(s) for version (id.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually - *

    - */ - public String getVersion() { - return getVersionElement().getValue(); - } - - /** - * Sets the value(s) for version (id.version) - * - *

    - * Definition: - * The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually - *

    - */ - public StructureDefinition setVersion(StringDt theValue) { - myVersion = theValue; - return this; - } - - - - /** - * Sets the value for version (id.version) - * - *

    - * Definition: - * The identifier that is used to identify this version of the StructureDefinition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the StructureDefinition author manually - *

    - */ - public StructureDefinition setVersion( String theString) { - myVersion = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for name (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language name identifying the StructureDefinition - *

    - */ - public StringDt getNameElement() { - if (myName == null) { - myName = new StringDt(); - } - return myName; - } - - - /** - * Gets the value(s) for name (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language name identifying the StructureDefinition - *

    - */ - public String getName() { - return getNameElement().getValue(); - } - - /** - * Sets the value(s) for name () - * - *

    - * Definition: - * A free text natural language name identifying the StructureDefinition - *

    - */ - public StructureDefinition setName(StringDt theValue) { - myName = theValue; - return this; - } - - - - /** - * Sets the value for name () - * - *

    - * Definition: - * A free text natural language name identifying the StructureDefinition - *

    - */ - public StructureDefinition setName( String theString) { - myName = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for display (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Defined so that applications can use this name when displaying the value of the extension to the user - *

    - */ - public StringDt getDisplayElement() { - if (myDisplay == null) { - myDisplay = new StringDt(); - } - return myDisplay; - } - - - /** - * Gets the value(s) for display (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Defined so that applications can use this name when displaying the value of the extension to the user - *

    - */ - public String getDisplay() { - return getDisplayElement().getValue(); - } - - /** - * Sets the value(s) for display () - * - *

    - * Definition: - * Defined so that applications can use this name when displaying the value of the extension to the user - *

    - */ - public StructureDefinition setDisplay(StringDt theValue) { - myDisplay = theValue; - return this; - } - - - - /** - * Sets the value for display () - * - *

    - * Definition: - * Defined so that applications can use this name when displaying the value of the extension to the user - *

    - */ - public StructureDefinition setDisplay( String theString) { - myDisplay = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for status (status). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The status of the StructureDefinition - *

    - */ - public BoundCodeDt getStatusElement() { - if (myStatus == null) { - myStatus = new BoundCodeDt(ConformanceResourceStatusEnum.VALUESET_BINDER); - } - return myStatus; - } - - - /** - * Gets the value(s) for status (status). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The status of the StructureDefinition - *

    - */ - public String getStatus() { - return getStatusElement().getValue(); - } - - /** - * Sets the value(s) for status (status) - * - *

    - * Definition: - * The status of the StructureDefinition - *

    - */ - public StructureDefinition setStatus(BoundCodeDt theValue) { - myStatus = theValue; - return this; - } - - - - /** - * Sets the value(s) for status (status) - * - *

    - * Definition: - * The status of the StructureDefinition - *

    - */ - public StructureDefinition setStatus(ConformanceResourceStatusEnum theValue) { - getStatusElement().setValueAsEnum(theValue); - return this; - } - - - /** - * Gets the value(s) for experimental (class). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public BooleanDt getExperimentalElement() { - if (myExperimental == null) { - myExperimental = new BooleanDt(); - } - return myExperimental; - } - - - /** - * Gets the value(s) for experimental (class). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public Boolean getExperimental() { - return getExperimentalElement().getValue(); - } - - /** - * Sets the value(s) for experimental (class) - * - *

    - * Definition: - * This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public StructureDefinition setExperimental(BooleanDt theValue) { - myExperimental = theValue; - return this; - } - - - - /** - * Sets the value for experimental (class) - * - *

    - * Definition: - * This StructureDefinition was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public StructureDefinition setExperimental( boolean theBoolean) { - myExperimental = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for publisher (who.witness). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of the individual or organization that published the structure definition - *

    - */ - public StringDt getPublisherElement() { - if (myPublisher == null) { - myPublisher = new StringDt(); - } - return myPublisher; - } - - - /** - * Gets the value(s) for publisher (who.witness). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of the individual or organization that published the structure definition - *

    - */ - public String getPublisher() { - return getPublisherElement().getValue(); - } - - /** - * Sets the value(s) for publisher (who.witness) - * - *

    - * Definition: - * The name of the individual or organization that published the structure definition - *

    - */ - public StructureDefinition setPublisher(StringDt theValue) { - myPublisher = theValue; - return this; - } - - - - /** - * Sets the value for publisher (who.witness) - * - *

    - * Definition: - * The name of the individual or organization that published the structure definition - *

    - */ - public StructureDefinition setPublisher( String theString) { - myPublisher = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for contact (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public java.util.List getContact() { - if (myContact == null) { - myContact = new java.util.ArrayList(); - } - return myContact; - } - - /** - * Sets the value(s) for contact () - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public StructureDefinition setContact(java.util.List theValue) { - myContact = theValue; - return this; - } - - - - /** - * Adds and returns a new value for contact () - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public Contact addContact() { - Contact newType = new Contact(); - getContact().add(newType); - return newType; - } - - /** - * Adds a given new value for contact () - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - * @param theValue The contact to add (must not be null) - */ - public StructureDefinition addContact(Contact theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getContact().add(theValue); - return this; - } - - /** - * Gets the first repetition for contact (), - * creating it if it does not already exist. - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public Contact getContactFirstRep() { - if (getContact().isEmpty()) { - return addContact(); - } - return getContact().get(0); - } - - /** - * Gets the value(s) for date (when.recorded). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The date that this version of the StructureDefinition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the structure definition changes - *

    - */ - public DateTimeDt getDateElement() { - if (myDate == null) { - myDate = new DateTimeDt(); - } - return myDate; - } - - - /** - * Gets the value(s) for date (when.recorded). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The date that this version of the StructureDefinition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the structure definition changes - *

    - */ - public Date getDate() { - return getDateElement().getValue(); - } - - /** - * Sets the value(s) for date (when.recorded) - * - *

    - * Definition: - * The date that this version of the StructureDefinition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the structure definition changes - *

    - */ - public StructureDefinition setDate(DateTimeDt theValue) { - myDate = theValue; - return this; - } - - - - /** - * Sets the value for date (when.recorded) - * - *

    - * Definition: - * The date that this version of the StructureDefinition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the structure definition changes - *

    - */ - public StructureDefinition setDate( Date theDate, TemporalPrecisionEnum thePrecision) { - myDate = new DateTimeDt(theDate, thePrecision); - return this; - } - - /** - * Sets the value for date (when.recorded) - * - *

    - * Definition: - * The date that this version of the StructureDefinition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the structure definition changes - *

    - */ - public StructureDefinition setDateWithSecondsPrecision( Date theDate) { - myDate = new DateTimeDt(theDate); - return this; - } - - - /** - * Gets the value(s) for description (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language description of the StructureDefinition and its use - *

    - */ - public StringDt getDescriptionElement() { - if (myDescription == null) { - myDescription = new StringDt(); - } - return myDescription; - } - - - /** - * Gets the value(s) for description (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language description of the StructureDefinition and its use - *

    - */ - public String getDescription() { - return getDescriptionElement().getValue(); - } - - /** - * Sets the value(s) for description () - * - *

    - * Definition: - * A free text natural language description of the StructureDefinition and its use - *

    - */ - public StructureDefinition setDescription(StringDt theValue) { - myDescription = theValue; - return this; - } - - - - /** - * Sets the value for description () - * - *

    - * Definition: - * A free text natural language description of the StructureDefinition and its use - *

    - */ - public StructureDefinition setDescription( String theString) { - myDescription = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for useContext (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions. - *

    - */ - public java.util.List getUseContext() { - if (myUseContext == null) { - myUseContext = new java.util.ArrayList(); - } - return myUseContext; - } - - /** - * Sets the value(s) for useContext () - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions. - *

    - */ - public StructureDefinition setUseContext(java.util.List theValue) { - myUseContext = theValue; - return this; - } - - - - /** - * Adds and returns a new value for useContext () - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions. - *

    - */ - public CodeableConceptDt addUseContext() { - CodeableConceptDt newType = new CodeableConceptDt(); - getUseContext().add(newType); - return newType; - } - - /** - * Adds a given new value for useContext () - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions. - *

    - * @param theValue The useContext to add (must not be null) - */ - public StructureDefinition addUseContext(CodeableConceptDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getUseContext().add(theValue); - return this; - } - - /** - * Gets the first repetition for useContext (), - * creating it if it does not already exist. - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of structure definitions. - *

    - */ - public CodeableConceptDt getUseContextFirstRep() { - if (getUseContext().isEmpty()) { - return addUseContext(); - } - return getUseContext().get(0); - } - - /** - * Gets the value(s) for requirements (why). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Explains why this structure definition is needed and why it's been constrained as it has - *

    - */ - public StringDt getRequirementsElement() { - if (myRequirements == null) { - myRequirements = new StringDt(); - } - return myRequirements; - } - - - /** - * Gets the value(s) for requirements (why). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Explains why this structure definition is needed and why it's been constrained as it has - *

    - */ - public String getRequirements() { - return getRequirementsElement().getValue(); - } - - /** - * Sets the value(s) for requirements (why) - * - *

    - * Definition: - * Explains why this structure definition is needed and why it's been constrained as it has - *

    - */ - public StructureDefinition setRequirements(StringDt theValue) { - myRequirements = theValue; - return this; - } - - - - /** - * Sets the value for requirements (why) - * - *

    - * Definition: - * Explains why this structure definition is needed and why it's been constrained as it has - *

    - */ - public StructureDefinition setRequirements( String theString) { - myRequirements = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for copyright (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings - *

    - */ - public StringDt getCopyrightElement() { - if (myCopyright == null) { - myCopyright = new StringDt(); - } - return myCopyright; - } - - - /** - * Gets the value(s) for copyright (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings - *

    - */ - public String getCopyright() { - return getCopyrightElement().getValue(); - } - - /** - * Sets the value(s) for copyright () - * - *

    - * Definition: - * A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings - *

    - */ - public StructureDefinition setCopyright(StringDt theValue) { - myCopyright = theValue; - return this; - } - - - - /** - * Sets the value for copyright () - * - *

    - * Definition: - * A copyright statement relating to the structure definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the details of the constraints and mappings - *

    - */ - public StructureDefinition setCopyright( String theString) { - myCopyright = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for code (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A set of terms from external terminologies that may be used to assist with indexing and searching of templates. - *

    - */ - public java.util.List getCode() { - if (myCode == null) { - myCode = new java.util.ArrayList(); - } - return myCode; - } - - /** - * Sets the value(s) for code () - * - *

    - * Definition: - * A set of terms from external terminologies that may be used to assist with indexing and searching of templates. - *

    - */ - public StructureDefinition setCode(java.util.List theValue) { - myCode = theValue; - return this; - } - - - - /** - * Adds and returns a new value for code () - * - *

    - * Definition: - * A set of terms from external terminologies that may be used to assist with indexing and searching of templates. - *

    - */ - public CodingDt addCode() { - CodingDt newType = new CodingDt(); - getCode().add(newType); - return newType; - } - - /** - * Adds a given new value for code () - * - *

    - * Definition: - * A set of terms from external terminologies that may be used to assist with indexing and searching of templates. - *

    - * @param theValue The code to add (must not be null) - */ - public StructureDefinition addCode(CodingDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getCode().add(theValue); - return this; - } - - /** - * Gets the first repetition for code (), - * creating it if it does not already exist. - * - *

    - * Definition: - * A set of terms from external terminologies that may be used to assist with indexing and searching of templates. - *

    - */ - public CodingDt getCodeFirstRep() { - if (getCode().isEmpty()) { - return addCode(); - } - return getCode().get(0); - } - - /** - * Gets the value(s) for fhirVersion (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is $version$ for this version - *

    - */ - public IdDt getFhirVersionElement() { - if (myFhirVersion == null) { - myFhirVersion = new IdDt(); - } - return myFhirVersion; - } - - - /** - * Gets the value(s) for fhirVersion (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is $version$ for this version - *

    - */ - public String getFhirVersion() { - return getFhirVersionElement().getValue(); - } - - /** - * Sets the value(s) for fhirVersion () - * - *

    - * Definition: - * The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is $version$ for this version - *

    - */ - public StructureDefinition setFhirVersion(IdDt theValue) { - myFhirVersion = theValue; - return this; - } - - - - /** - * Sets the value for fhirVersion () - * - *

    - * Definition: - * The version of the FHIR specification on which this StructureDefinition is based - this is the formal version of the specification, without the revision number, e.g. [publication].[major].[minor], which is $version$ for this version - *

    - */ - public StructureDefinition setFhirVersion( String theId) { - myFhirVersion = new IdDt(theId); - return this; - } - - - /** - * Gets the value(s) for mapping (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An external specification that the content is mapped to - *

    - */ - public java.util.List getMapping() { - if (myMapping == null) { - myMapping = new java.util.ArrayList(); - } - return myMapping; - } - - /** - * Sets the value(s) for mapping () - * - *

    - * Definition: - * An external specification that the content is mapped to - *

    - */ - public StructureDefinition setMapping(java.util.List theValue) { - myMapping = theValue; - return this; - } - - - - /** - * Adds and returns a new value for mapping () - * - *

    - * Definition: - * An external specification that the content is mapped to - *

    - */ - public Mapping addMapping() { - Mapping newType = new Mapping(); - getMapping().add(newType); - return newType; - } - - /** - * Adds a given new value for mapping () - * - *

    - * Definition: - * An external specification that the content is mapped to - *

    - * @param theValue The mapping to add (must not be null) - */ - public StructureDefinition addMapping(Mapping theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getMapping().add(theValue); - return this; - } - - /** - * Gets the first repetition for mapping (), - * creating it if it does not already exist. - * - *

    - * Definition: - * An external specification that the content is mapped to - *

    - */ - public Mapping getMappingFirstRep() { - if (getMapping().isEmpty()) { - return addMapping(); - } - return getMapping().get(0); - } - - /** - * Gets the value(s) for kind (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Defines the kind of structure that this definition is describing - *

    - */ - public BoundCodeDt getKindElement() { - if (myKind == null) { - myKind = new BoundCodeDt(StructureDefinitionKindEnum.VALUESET_BINDER); - } - return myKind; - } - - - /** - * Gets the value(s) for kind (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Defines the kind of structure that this definition is describing - *

    - */ - public String getKind() { - return getKindElement().getValue(); - } - - /** - * Sets the value(s) for kind () - * - *

    - * Definition: - * Defines the kind of structure that this definition is describing - *

    - */ - public StructureDefinition setKind(BoundCodeDt theValue) { - myKind = theValue; - return this; - } - - - - /** - * Sets the value(s) for kind () - * - *

    - * Definition: - * Defines the kind of structure that this definition is describing - *

    - */ - public StructureDefinition setKind(StructureDefinitionKindEnum theValue) { - getKindElement().setValueAsEnum(theValue); - return this; - } - - - /** - * Gets the value(s) for constrainedType (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure - *

    - */ - public CodeDt getConstrainedTypeElement() { - if (myConstrainedType == null) { - myConstrainedType = new CodeDt(); - } - return myConstrainedType; - } - - - /** - * Gets the value(s) for constrainedType (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure - *

    - */ - public String getConstrainedType() { - return getConstrainedTypeElement().getValue(); - } - - /** - * Sets the value(s) for constrainedType () - * - *

    - * Definition: - * The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure - *

    - */ - public StructureDefinition setConstrainedType(CodeDt theValue) { - myConstrainedType = theValue; - return this; - } - - - - /** - * Sets the value for constrainedType () - * - *

    - * Definition: - * The type of type that is being constrained - a data type, an extension, a resource, including abstract ones. If this field is present, it indicates that the structure definition is a constraint. If it is not present, then the structure definition is the definition of a base structure - *

    - */ - public StructureDefinition setConstrainedType( String theCode) { - myConstrainedType = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for abstract (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Whether structure this definition describes is abstract or not - that is, whether an actual exchanged item can ever be of this type - *

    - */ - public BooleanDt getAbstractElement() { - if (myAbstract == null) { - myAbstract = new BooleanDt(); - } - return myAbstract; - } - - - /** - * Gets the value(s) for abstract (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Whether structure this definition describes is abstract or not - that is, whether an actual exchanged item can ever be of this type - *

    - */ - public Boolean getAbstract() { - return getAbstractElement().getValue(); - } - - /** - * Sets the value(s) for abstract () - * - *

    - * Definition: - * Whether structure this definition describes is abstract or not - that is, whether an actual exchanged item can ever be of this type - *

    - */ - public StructureDefinition setAbstract(BooleanDt theValue) { - myAbstract = theValue; - return this; - } - - - - /** - * Sets the value for abstract () - * - *

    - * Definition: - * Whether structure this definition describes is abstract or not - that is, whether an actual exchanged item can ever be of this type - *

    - */ - public StructureDefinition setAbstract( boolean theBoolean) { - myAbstract = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for contextType (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If this is an extension, Identifies the context within FHIR resources where the extension can be used - *

    - */ - public BoundCodeDt getContextTypeElement() { - if (myContextType == null) { - myContextType = new BoundCodeDt(ExtensionContextEnum.VALUESET_BINDER); - } - return myContextType; - } - - - /** - * Gets the value(s) for contextType (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If this is an extension, Identifies the context within FHIR resources where the extension can be used - *

    - */ - public String getContextType() { - return getContextTypeElement().getValue(); - } - - /** - * Sets the value(s) for contextType () - * - *

    - * Definition: - * If this is an extension, Identifies the context within FHIR resources where the extension can be used - *

    - */ - public StructureDefinition setContextType(BoundCodeDt theValue) { - myContextType = theValue; - return this; - } - - - - /** - * Sets the value(s) for contextType () - * - *

    - * Definition: - * If this is an extension, Identifies the context within FHIR resources where the extension can be used - *

    - */ - public StructureDefinition setContextType(ExtensionContextEnum theValue) { - getContextTypeElement().setValueAsEnum(theValue); - return this; - } - - - /** - * Gets the value(s) for context (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Identifies the types of resource or data type elements to which the extension can be applied - *

    - */ - public java.util.List getContext() { - if (myContext == null) { - myContext = new java.util.ArrayList(); - } - return myContext; - } - - /** - * Sets the value(s) for context () - * - *

    - * Definition: - * Identifies the types of resource or data type elements to which the extension can be applied - *

    - */ - public StructureDefinition setContext(java.util.List theValue) { - myContext = theValue; - return this; - } - - - - /** - * Adds and returns a new value for context () - * - *

    - * Definition: - * Identifies the types of resource or data type elements to which the extension can be applied - *

    - */ - public StringDt addContext() { - StringDt newType = new StringDt(); - getContext().add(newType); - return newType; - } - - /** - * Adds a given new value for context () - * - *

    - * Definition: - * Identifies the types of resource or data type elements to which the extension can be applied - *

    - * @param theValue The context to add (must not be null) - */ - public StructureDefinition addContext(StringDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getContext().add(theValue); - return this; - } - - /** - * Gets the first repetition for context (), - * creating it if it does not already exist. - * - *

    - * Definition: - * Identifies the types of resource or data type elements to which the extension can be applied - *

    - */ - public StringDt getContextFirstRep() { - if (getContext().isEmpty()) { - return addContext(); - } - return getContext().get(0); - } - /** - * Adds a new value for context () - * - *

    - * Definition: - * Identifies the types of resource or data type elements to which the extension can be applied - *

    - * - * @return Returns a reference to this object, to allow for simple chaining. - */ - public StructureDefinition addContext( String theString) { - if (myContext == null) { - myContext = new java.util.ArrayList(); - } - myContext.add(new StringDt(theString)); - return this; - } - - - /** - * Gets the value(s) for base (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI that is the base structure from which this set of constraints is derived - *

    - */ - public UriDt getBaseElement() { - if (myBase == null) { - myBase = new UriDt(); - } - return myBase; - } - - - /** - * Gets the value(s) for base (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI that is the base structure from which this set of constraints is derived - *

    - */ - public String getBase() { - return getBaseElement().getValue(); - } - - /** - * Sets the value(s) for base () - * - *

    - * Definition: - * An absolute URI that is the base structure from which this set of constraints is derived - *

    - */ - public StructureDefinition setBase(UriDt theValue) { - myBase = theValue; - return this; - } - - - - /** - * Sets the value for base () - * - *

    - * Definition: - * An absolute URI that is the base structure from which this set of constraints is derived - *

    - */ - public StructureDefinition setBase( String theUri) { - myBase = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for snapshot (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition - *

    - */ - public Snapshot getSnapshot() { - if (mySnapshot == null) { - mySnapshot = new Snapshot(); - } - return mySnapshot; - } - - /** - * Sets the value(s) for snapshot () - * - *

    - * Definition: - * A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition - *

    - */ - public StructureDefinition setSnapshot(Snapshot theValue) { - mySnapshot = theValue; - return this; - } - - - - - /** - * Gets the value(s) for differential (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies - *

    - */ - public Differential getDifferential() { - if (myDifferential == null) { - myDifferential = new Differential(); - } - return myDifferential; - } - - /** - * Sets the value(s) for differential () - * - *

    - * Definition: - * A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies - *

    - */ - public StructureDefinition setDifferential(Differential theValue) { - myDifferential = theValue; - return this; - } - - - - - /** - * Block class for child element: StructureDefinition.contact () - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - @Block() - public static class Contact - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="name", type=StringDt.class, order=0, min=0, max=1, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="The name of an individual to contact regarding the structure definition" - ) - private StringDt myName; - - @Child(name="telecom", type=ContactPointDt.class, order=1, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Contact details for individual (if a name was provided) or the publisher" - ) - private java.util.List myTelecom; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myTelecom); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myName, myTelecom); - } - - /** - * Gets the value(s) for name (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of an individual to contact regarding the structure definition - *

    - */ - public StringDt getNameElement() { - if (myName == null) { - myName = new StringDt(); - } - return myName; - } - - - /** - * Gets the value(s) for name (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of an individual to contact regarding the structure definition - *

    - */ - public String getName() { - return getNameElement().getValue(); - } - - /** - * Sets the value(s) for name () - * - *

    - * Definition: - * The name of an individual to contact regarding the structure definition - *

    - */ - public Contact setName(StringDt theValue) { - myName = theValue; - return this; - } - - - - /** - * Sets the value for name () - * - *

    - * Definition: - * The name of an individual to contact regarding the structure definition - *

    - */ - public Contact setName( String theString) { - myName = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for telecom (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public java.util.List getTelecom() { - if (myTelecom == null) { - myTelecom = new java.util.ArrayList(); - } - return myTelecom; - } - - /** - * Sets the value(s) for telecom () - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public Contact setTelecom(java.util.List theValue) { - myTelecom = theValue; - return this; - } - - - - /** - * Adds and returns a new value for telecom () - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public ContactPointDt addTelecom() { - ContactPointDt newType = new ContactPointDt(); - getTelecom().add(newType); - return newType; - } - - /** - * Adds a given new value for telecom () - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - * @param theValue The telecom to add (must not be null) - */ - public Contact addTelecom(ContactPointDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getTelecom().add(theValue); - return this; - } - - /** - * Gets the first repetition for telecom (), - * creating it if it does not already exist. - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public ContactPointDt getTelecomFirstRep() { - if (getTelecom().isEmpty()) { - return addTelecom(); - } - return getTelecom().get(0); - } - - - - } - - - /** - * Block class for child element: StructureDefinition.mapping () - * - *

    - * Definition: - * An external specification that the content is mapped to - *

    - */ - @Block() - public static class Mapping - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="identity", type=IdDt.class, order=0, min=1, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="An Internal id that is used to identify this mapping set when specific mappings are made" - ) - private IdDt myIdentity; - - @Child(name="uri", type=UriDt.class, order=1, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="An absolute URI that identifies the specification that this mapping is expressed to" - ) - private UriDt myUri; - - @Child(name="name", type=StringDt.class, order=2, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="A name for the specification that is being mapped to" - ) - private StringDt myName; - - @Child(name="comments", type=StringDt.class, order=3, min=0, max=1, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage" - ) - private StringDt myComments; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentity, myUri, myName, myComments); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentity, myUri, myName, myComments); - } - - /** - * Gets the value(s) for identity (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An Internal id that is used to identify this mapping set when specific mappings are made - *

    - */ - public IdDt getIdentityElement() { - if (myIdentity == null) { - myIdentity = new IdDt(); - } - return myIdentity; - } - - - /** - * Gets the value(s) for identity (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An Internal id that is used to identify this mapping set when specific mappings are made - *

    - */ - public String getIdentity() { - return getIdentityElement().getValue(); - } - - /** - * Sets the value(s) for identity () - * - *

    - * Definition: - * An Internal id that is used to identify this mapping set when specific mappings are made - *

    - */ - public Mapping setIdentity(IdDt theValue) { - myIdentity = theValue; - return this; - } - - - - /** - * Sets the value for identity () - * - *

    - * Definition: - * An Internal id that is used to identify this mapping set when specific mappings are made - *

    - */ - public Mapping setIdentity( String theId) { - myIdentity = new IdDt(theId); - return this; - } - - - /** - * Gets the value(s) for uri (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI that identifies the specification that this mapping is expressed to - *

    - */ - public UriDt getUriElement() { - if (myUri == null) { - myUri = new UriDt(); - } - return myUri; - } - - - /** - * Gets the value(s) for uri (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI that identifies the specification that this mapping is expressed to - *

    - */ - public String getUri() { - return getUriElement().getValue(); - } - - /** - * Sets the value(s) for uri () - * - *

    - * Definition: - * An absolute URI that identifies the specification that this mapping is expressed to - *

    - */ - public Mapping setUri(UriDt theValue) { - myUri = theValue; - return this; - } - - - - /** - * Sets the value for uri () - * - *

    - * Definition: - * An absolute URI that identifies the specification that this mapping is expressed to - *

    - */ - public Mapping setUri( String theUri) { - myUri = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for name (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A name for the specification that is being mapped to - *

    - */ - public StringDt getNameElement() { - if (myName == null) { - myName = new StringDt(); - } - return myName; - } - - - /** - * Gets the value(s) for name (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A name for the specification that is being mapped to - *

    - */ - public String getName() { - return getNameElement().getValue(); - } - - /** - * Sets the value(s) for name () - * - *

    - * Definition: - * A name for the specification that is being mapped to - *

    - */ - public Mapping setName(StringDt theValue) { - myName = theValue; - return this; - } - - - - /** - * Sets the value for name () - * - *

    - * Definition: - * A name for the specification that is being mapped to - *

    - */ - public Mapping setName( String theString) { - myName = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for comments (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage - *

    - */ - public StringDt getCommentsElement() { - if (myComments == null) { - myComments = new StringDt(); - } - return myComments; - } - - - /** - * Gets the value(s) for comments (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage - *

    - */ - public String getComments() { - return getCommentsElement().getValue(); - } - - /** - * Sets the value(s) for comments () - * - *

    - * Definition: - * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage - *

    - */ - public Mapping setComments(StringDt theValue) { - myComments = theValue; - return this; - } - - - - /** - * Sets the value for comments () - * - *

    - * Definition: - * Comments about this mapping, including version notes, issues, scope limitations, and other important notes for usage - *

    - */ - public Mapping setComments( String theString) { - myComments = new StringDt(theString); - return this; - } - - - - - } - - - /** - * Block class for child element: StructureDefinition.snapshot () - * - *

    - * Definition: - * A snapshot view is expressed in a stand alone form that can be used and interpreted without considering the base StructureDefinition - *

    - */ - @Block() - public static class Snapshot - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="element", type=ElementDefinitionDt.class, order=0, min=1, max=Child.MAX_UNLIMITED, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Captures constraints on each element within the resource" - ) - private java.util.List myElement; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myElement); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myElement); - } - - /** - * Gets the value(s) for element (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public java.util.List getElement() { - if (myElement == null) { - myElement = new java.util.ArrayList(); - } - return myElement; - } - - /** - * Sets the value(s) for element () - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public Snapshot setElement(java.util.List theValue) { - myElement = theValue; - return this; - } - - - - /** - * Adds and returns a new value for element () - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public ElementDefinitionDt addElement() { - ElementDefinitionDt newType = new ElementDefinitionDt(); - getElement().add(newType); - return newType; - } - - /** - * Adds a given new value for element () - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - * @param theValue The element to add (must not be null) - */ - public Snapshot addElement(ElementDefinitionDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getElement().add(theValue); - return this; - } - - /** - * Gets the first repetition for element (), - * creating it if it does not already exist. - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public ElementDefinitionDt getElementFirstRep() { - if (getElement().isEmpty()) { - return addElement(); - } - return getElement().get(0); - } - - - - } - - - /** - * Block class for child element: StructureDefinition.differential () - * - *

    - * Definition: - * A differential view is expressed relative to the base StructureDefinition - a statement of differences that it applies - *

    - */ - @Block() - public static class Differential - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="element", type=ElementDefinitionDt.class, order=0, min=1, max=Child.MAX_UNLIMITED, summary=false, modifier=false) - @Description( - shortDefinition="", - formalDefinition="Captures constraints on each element within the resource" - ) - private java.util.List myElement; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myElement); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myElement); - } - - /** - * Gets the value(s) for element (). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public java.util.List getElement() { - if (myElement == null) { - myElement = new java.util.ArrayList(); - } - return myElement; - } - - /** - * Sets the value(s) for element () - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public Differential setElement(java.util.List theValue) { - myElement = theValue; - return this; - } - - - - /** - * Adds and returns a new value for element () - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public ElementDefinitionDt addElement() { - ElementDefinitionDt newType = new ElementDefinitionDt(); - getElement().add(newType); - return newType; - } - - /** - * Adds a given new value for element () - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - * @param theValue The element to add (must not be null) - */ - public Differential addElement(ElementDefinitionDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getElement().add(theValue); - return this; - } - - /** - * Gets the first repetition for element (), - * creating it if it does not already exist. - * - *

    - * Definition: - * Captures constraints on each element within the resource - *

    - */ - public ElementDefinitionDt getElementFirstRep() { - if (getElement().isEmpty()) { - return addElement(); - } - return getElement().get(0); - } - - - - } - - - - - @Override - public String getResourceName() { - return "StructureDefinition"; - } - - public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() { - return ca.uhn.fhir.context.FhirVersionEnum.DSTU2; - } - - -} diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/ValueSet.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/ValueSet.java deleted file mode 100644 index 4446a5c0001..00000000000 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/model/dstu2/resource/ValueSet.java +++ /dev/null @@ -1,4986 +0,0 @@ - - - - - - - - - - - - - - - - -package ca.uhn.fhir.model.dstu2.resource; - -import java.util.Date; -import java.util.List; - -import ca.uhn.fhir.model.api.BaseIdentifiableElement; -import ca.uhn.fhir.model.api.IDatatype; -import ca.uhn.fhir.model.api.IElement; -import ca.uhn.fhir.model.api.IResource; -import ca.uhn.fhir.model.api.IResourceBlock; -import ca.uhn.fhir.model.api.TemporalPrecisionEnum; -import ca.uhn.fhir.model.api.annotation.Block; -import ca.uhn.fhir.model.api.annotation.Child; -import ca.uhn.fhir.model.api.annotation.Description; -import ca.uhn.fhir.model.api.annotation.ResourceDef; -import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; -import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt; -import ca.uhn.fhir.model.dstu2.composite.CodingDt; -import ca.uhn.fhir.model.dstu2.composite.ContactPointDt; -import ca.uhn.fhir.model.dstu2.composite.IdentifierDt; -import ca.uhn.fhir.model.primitive.BooleanDt; -import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.DateDt; -import ca.uhn.fhir.model.primitive.DateTimeDt; -import ca.uhn.fhir.model.primitive.DecimalDt; -import ca.uhn.fhir.model.primitive.IntegerDt; -import ca.uhn.fhir.model.primitive.StringDt; -import ca.uhn.fhir.model.primitive.UriDt; -import ca.uhn.fhir.rest.gclient.DateClientParam; -import ca.uhn.fhir.rest.gclient.StringClientParam; -import ca.uhn.fhir.rest.gclient.TokenClientParam; -import ca.uhn.fhir.rest.gclient.UriClientParam; - - -/** - * HAPI/FHIR ValueSet Resource - * (ValueSet) - * - *

    - * Definition: - * A value set specifies a set of codes drawn from one or more code systems - *

    - * - *

    - * Requirements: - * - *

    - * - *

    - * Profile Definition: - * http://hl7.org/fhir/profiles/ValueSet - *

    - * - */ -@ResourceDef(name="ValueSet", profile="http://hl7.org/fhir/profiles/ValueSet", id="valueset") -public class ValueSet extends ca.uhn.fhir.model.dstu2.resource.BaseResource - implements IResource { - - /** - * Search parameter constant for url - *

    - * Description: The logical url for the value set
    - * Type: uri
    - * Path: ValueSet.url
    - *

    - */ - @SearchParamDefinition(name="url", path="ValueSet.url", description="The logical url for the value set", type="uri" ) - public static final String SP_URL = "url"; - - /** - * Fluent Client search parameter constant for url - *

    - * Description: The logical url for the value set
    - * Type: uri
    - * Path: ValueSet.url
    - *

    - */ - public static final UriClientParam URL = new UriClientParam(SP_URL); - - /** - * Search parameter constant for identifier - *

    - * Description: The identifier for the value set
    - * Type: token
    - * Path: ValueSet.identifier
    - *

    - */ - @SearchParamDefinition(name="identifier", path="ValueSet.identifier", description="The identifier for the value set", type="token" ) - public static final String SP_IDENTIFIER = "identifier"; - - /** - * Fluent Client search parameter constant for identifier - *

    - * Description: The identifier for the value set
    - * Type: token
    - * Path: ValueSet.identifier
    - *

    - */ - public static final TokenClientParam IDENTIFIER = new TokenClientParam(SP_IDENTIFIER); - - /** - * Search parameter constant for version - *

    - * Description: The version identifier of the value set
    - * Type: token
    - * Path: ValueSet.version
    - *

    - */ - @SearchParamDefinition(name="version", path="ValueSet.version", description="The version identifier of the value set", type="token" ) - public static final String SP_VERSION = "version"; - - /** - * Fluent Client search parameter constant for version - *

    - * Description: The version identifier of the value set
    - * Type: token
    - * Path: ValueSet.version
    - *

    - */ - public static final TokenClientParam VERSION = new TokenClientParam(SP_VERSION); - - /** - * Search parameter constant for name - *

    - * Description: The name of the value set
    - * Type: string
    - * Path: ValueSet.name
    - *

    - */ - @SearchParamDefinition(name="name", path="ValueSet.name", description="The name of the value set", type="string" ) - public static final String SP_NAME = "name"; - - /** - * Fluent Client search parameter constant for name - *

    - * Description: The name of the value set
    - * Type: string
    - * Path: ValueSet.name
    - *

    - */ - public static final StringClientParam NAME = new StringClientParam(SP_NAME); - - /** - * Search parameter constant for publisher - *

    - * Description: Name of the publisher of the value set
    - * Type: string
    - * Path: ValueSet.publisher
    - *

    - */ - @SearchParamDefinition(name="publisher", path="ValueSet.publisher", description="Name of the publisher of the value set", type="string" ) - public static final String SP_PUBLISHER = "publisher"; - - /** - * Fluent Client search parameter constant for publisher - *

    - * Description: Name of the publisher of the value set
    - * Type: string
    - * Path: ValueSet.publisher
    - *

    - */ - public static final StringClientParam PUBLISHER = new StringClientParam(SP_PUBLISHER); - - /** - * Search parameter constant for description - *

    - * Description: Text search in the description of the value set
    - * Type: string
    - * Path: ValueSet.description
    - *

    - */ - @SearchParamDefinition(name="description", path="ValueSet.description", description="Text search in the description of the value set", type="string" ) - public static final String SP_DESCRIPTION = "description"; - - /** - * Fluent Client search parameter constant for description - *

    - * Description: Text search in the description of the value set
    - * Type: string
    - * Path: ValueSet.description
    - *

    - */ - public static final StringClientParam DESCRIPTION = new StringClientParam(SP_DESCRIPTION); - - /** - * Search parameter constant for status - *

    - * Description: The status of the value set
    - * Type: token
    - * Path: ValueSet.status
    - *

    - */ - @SearchParamDefinition(name="status", path="ValueSet.status", description="The status of the value set", type="token" ) - public static final String SP_STATUS = "status"; - - /** - * Fluent Client search parameter constant for status - *

    - * Description: The status of the value set
    - * Type: token
    - * Path: ValueSet.status
    - *

    - */ - public static final TokenClientParam STATUS = new TokenClientParam(SP_STATUS); - - /** - * Search parameter constant for date - *

    - * Description: The value set publication date
    - * Type: date
    - * Path: ValueSet.date
    - *

    - */ - @SearchParamDefinition(name="date", path="ValueSet.date", description="The value set publication date", type="date" ) - public static final String SP_DATE = "date"; - - /** - * Fluent Client search parameter constant for date - *

    - * Description: The value set publication date
    - * Type: date
    - * Path: ValueSet.date
    - *

    - */ - public static final DateClientParam DATE = new DateClientParam(SP_DATE); - - /** - * Search parameter constant for system - *

    - * Description: The system for any codes defined by this value set
    - * Type: uri
    - * Path: ValueSet.codeSystem.system
    - *

    - */ - @SearchParamDefinition(name="system", path="ValueSet.codeSystem.system", description="The system for any codes defined by this value set", type="uri" ) - public static final String SP_SYSTEM = "system"; - - /** - * Fluent Client search parameter constant for system - *

    - * Description: The system for any codes defined by this value set
    - * Type: uri
    - * Path: ValueSet.codeSystem.system
    - *

    - */ - public static final UriClientParam SYSTEM = new UriClientParam(SP_SYSTEM); - - /** - * Search parameter constant for code - *

    - * Description: A code defined in the value set
    - * Type: token
    - * Path: ValueSet.codeSystem.concept.code
    - *

    - */ - @SearchParamDefinition(name="code", path="ValueSet.codeSystem.concept.code", description="A code defined in the value set", type="token" ) - public static final String SP_CODE = "code"; - - /** - * Fluent Client search parameter constant for code - *

    - * Description: A code defined in the value set
    - * Type: token
    - * Path: ValueSet.codeSystem.concept.code
    - *

    - */ - public static final TokenClientParam CODE = new TokenClientParam(SP_CODE); - - /** - * Search parameter constant for reference - *

    - * Description: A code system included or excluded in the value set or an imported value set
    - * Type: uri
    - * Path: ValueSet.compose.include.system
    - *

    - */ - @SearchParamDefinition(name="reference", path="ValueSet.compose.include.system", description="A code system included or excluded in the value set or an imported value set", type="uri" ) - public static final String SP_REFERENCE = "reference"; - - /** - * Fluent Client search parameter constant for reference - *

    - * Description: A code system included or excluded in the value set or an imported value set
    - * Type: uri
    - * Path: ValueSet.compose.include.system
    - *

    - */ - public static final UriClientParam REFERENCE = new UriClientParam(SP_REFERENCE); - - /** - * Search parameter constant for context - *

    - * Description: A use context assigned to the value set
    - * Type: token
    - * Path: ValueSet.useContext
    - *

    - */ - @SearchParamDefinition(name="context", path="ValueSet.useContext", description="A use context assigned to the value set", type="token" ) - public static final String SP_CONTEXT = "context"; - - /** - * Fluent Client search parameter constant for context - *

    - * Description: A use context assigned to the value set
    - * Type: token
    - * Path: ValueSet.useContext
    - *

    - */ - public static final TokenClientParam CONTEXT = new TokenClientParam(SP_CONTEXT); - - /** - * Search parameter constant for expansion - *

    - * Description:
    - * Type: uri
    - * Path: ValueSet.expansion.identifier
    - *

    - */ - @SearchParamDefinition(name="expansion", path="ValueSet.expansion.identifier", description="", type="uri" ) - public static final String SP_EXPANSION = "expansion"; - - /** - * Fluent Client search parameter constant for expansion - *

    - * Description:
    - * Type: uri
    - * Path: ValueSet.expansion.identifier
    - *

    - */ - public static final UriClientParam EXPANSION = new UriClientParam(SP_EXPANSION); - - - - @Child(name="url", type=UriDt.class, order=0, min=0, max=1) - @Description( - shortDefinition="ValueSet.url", - formalDefinition="An absolute URL that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published" - ) - private UriDt myUrl; - - @Child(name="identifier", type=IdentifierDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.identifier", - formalDefinition="Formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance." - ) - private IdentifierDt myIdentifier; - - @Child(name="version", type=StringDt.class, order=2, min=0, max=1) - @Description( - shortDefinition="ValueSet.version", - formalDefinition="Used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp" - ) - private StringDt myVersion; - - @Child(name="name", type=StringDt.class, order=3, min=0, max=1) - @Description( - shortDefinition="ValueSet.name", - formalDefinition="A free text natural language name describing the value set" - ) - private StringDt myName; - - @Child(name="status", type=CodeDt.class, order=4, min=1, max=1) - @Description( - shortDefinition="ValueSet.status", - formalDefinition="The status of the value set" - ) - private CodeDt myStatus; - - @Child(name="experimental", type=BooleanDt.class, order=5, min=0, max=1) - @Description( - shortDefinition="ValueSet.experimental", - formalDefinition="This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage" - ) - private BooleanDt myExperimental; - - @Child(name="publisher", type=StringDt.class, order=6, min=0, max=1) - @Description( - shortDefinition="ValueSet.publisher", - formalDefinition="The name of the individual or organization that published the value set" - ) - private StringDt myPublisher; - - @Child(name="contact", order=7, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.contact", - formalDefinition="Contacts to assist a user in finding and communicating with the publisher" - ) - private java.util.List myContact; - - @Child(name="date", type=DateTimeDt.class, order=8, min=0, max=1) - @Description( - shortDefinition="ValueSet.date", - formalDefinition="The date that the value set status was last changed. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the implementation guide changes (e.g. the 'content logical definition')" - ) - private DateTimeDt myDate; - - @Child(name="lockedDate", type=DateDt.class, order=9, min=0, max=1) - @Description( - shortDefinition="ValueSet.lockedDate", - formalDefinition="If a Locked Date is defined, then the Content Logical Definition must be evaluated using the current version of all referenced code system(s) and value sets as of the Locked Date" - ) - private DateDt myLockedDate; - - @Child(name="description", type=StringDt.class, order=10, min=0, max=1) - @Description( - shortDefinition="ValueSet.description", - formalDefinition="A free text natural language description of the use of the value set - reason for definition, \"the semantic space\" to be included in the value set, conditions of use, etc. The description may include a list of expected usages for the value set and can also describe the approach taken to build the value set." - ) - private StringDt myDescription; - - @Child(name="useContext", type=CodeableConceptDt.class, order=11, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.useContext", - formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of value set definitions." - ) - private java.util.List myUseContext; - - @Child(name="immutable", type=BooleanDt.class, order=12, min=0, max=1) - @Description( - shortDefinition="ValueSet.immutable", - formalDefinition="If this is set to 'true', then no new versions of the content logical definition can be created. Note: Other metadata might still change" - ) - private BooleanDt myImmutable; - - @Child(name="requirements", type=StringDt.class, order=13, min=0, max=1) - @Description( - shortDefinition="ValueSet.requirements", - formalDefinition="Explains why this value set is needed and why it's been constrained as it has" - ) - private StringDt myRequirements; - - @Child(name="copyright", type=StringDt.class, order=14, min=0, max=1) - @Description( - shortDefinition="ValueSet.copyright", - formalDefinition="A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set" - ) - private StringDt myCopyright; - - @Child(name="extensible", type=BooleanDt.class, order=15, min=0, max=1) - @Description( - shortDefinition="ValueSet.extensible", - formalDefinition="Whether this is intended to be used with an extensible binding or not" - ) - private BooleanDt myExtensible; - - @Child(name="codeSystem", order=16, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem", - formalDefinition="A definition of an code system, inlined into the value set (as a packaging convenience). Note that the inline code system may be used from other value sets by referring to it's (codeSystem.system) directly" - ) - private CodeSystem myCodeSystem; - - @Child(name="compose", order=17, min=0, max=1) - @Description( - shortDefinition="ValueSet.compose", - formalDefinition="A set of criteria that provide the content logical definition of the value set by including or excluding codes from outside this value set" - ) - private Compose myCompose; - - @Child(name="expansion", order=18, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion", - formalDefinition="A value set can also be \"expanded\", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed" - ) - private Expansion myExpansion; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myUrl, myIdentifier, myVersion, myName, myStatus, myExperimental, myPublisher, myContact, myDate, myLockedDate, myDescription, myUseContext, myImmutable, myRequirements, myCopyright, myExtensible, myCodeSystem, myCompose, myExpansion); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myUrl, myIdentifier, myVersion, myName, myStatus, myExperimental, myPublisher, myContact, myDate, myLockedDate, myDescription, myUseContext, myImmutable, myRequirements, myCopyright, myExtensible, myCodeSystem, myCompose, myExpansion); - } - - /** - * Gets the value(s) for url (ValueSet.url). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URL that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published - *

    - */ - public UriDt getUrlElement() { - if (myUrl == null) { - myUrl = new UriDt(); - } - return myUrl; - } - - - /** - * Gets the value(s) for url (ValueSet.url). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URL that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published - *

    - */ - public String getUrl() { - return getUrlElement().getValue(); - } - - /** - * Sets the value(s) for url (ValueSet.url) - * - *

    - * Definition: - * An absolute URL that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published - *

    - */ - public ValueSet setUrl(UriDt theValue) { - myUrl = theValue; - return this; - } - - - - /** - * Sets the value for url (ValueSet.url) - * - *

    - * Definition: - * An absolute URL that is used to identify this value set when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this value set is (or will be) published - *

    - */ - public ValueSet setUrl( String theUri) { - myUrl = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for identifier (ValueSet.identifier). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance. - *

    - */ - public IdentifierDt getIdentifier() { - if (myIdentifier == null) { - myIdentifier = new IdentifierDt(); - } - return myIdentifier; - } - - /** - * Sets the value(s) for identifier (ValueSet.identifier) - * - *

    - * Definition: - * Formal identifier that is used to identify this value set when it is represented in other formats, or referenced in a specification, model, design or an instance. - *

    - */ - public ValueSet setIdentifier(IdentifierDt theValue) { - myIdentifier = theValue; - return this; - } - - - - - /** - * Gets the value(s) for version (ValueSet.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp - *

    - */ - public StringDt getVersionElement() { - if (myVersion == null) { - myVersion = new StringDt(); - } - return myVersion; - } - - - /** - * Gets the value(s) for version (ValueSet.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp - *

    - */ - public String getVersion() { - return getVersionElement().getValue(); - } - - /** - * Sets the value(s) for version (ValueSet.version) - * - *

    - * Definition: - * Used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp - *

    - */ - public ValueSet setVersion(StringDt theValue) { - myVersion = theValue; - return this; - } - - - - /** - * Sets the value for version (ValueSet.version) - * - *

    - * Definition: - * Used to identify this version of the value set when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp - *

    - */ - public ValueSet setVersion( String theString) { - myVersion = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for name (ValueSet.name). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language name describing the value set - *

    - */ - public StringDt getNameElement() { - if (myName == null) { - myName = new StringDt(); - } - return myName; - } - - - /** - * Gets the value(s) for name (ValueSet.name). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language name describing the value set - *

    - */ - public String getName() { - return getNameElement().getValue(); - } - - /** - * Sets the value(s) for name (ValueSet.name) - * - *

    - * Definition: - * A free text natural language name describing the value set - *

    - */ - public ValueSet setName(StringDt theValue) { - myName = theValue; - return this; - } - - - - /** - * Sets the value for name (ValueSet.name) - * - *

    - * Definition: - * A free text natural language name describing the value set - *

    - */ - public ValueSet setName( String theString) { - myName = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for status (ValueSet.status). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The status of the value set - *

    - */ - public CodeDt getStatusElement() { - if (myStatus == null) { - myStatus = new CodeDt(); - } - return myStatus; - } - - - /** - * Gets the value(s) for status (ValueSet.status). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The status of the value set - *

    - */ - public String getStatus() { - return getStatusElement().getValue(); - } - - /** - * Sets the value(s) for status (ValueSet.status) - * - *

    - * Definition: - * The status of the value set - *

    - */ - public ValueSet setStatus(CodeDt theValue) { - myStatus = theValue; - return this; - } - - - - /** - * Sets the value for status (ValueSet.status) - * - *

    - * Definition: - * The status of the value set - *

    - */ - public ValueSet setStatus( String theCode) { - myStatus = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for experimental (ValueSet.experimental). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public BooleanDt getExperimentalElement() { - if (myExperimental == null) { - myExperimental = new BooleanDt(); - } - return myExperimental; - } - - - /** - * Gets the value(s) for experimental (ValueSet.experimental). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public Boolean getExperimental() { - return getExperimentalElement().getValue(); - } - - /** - * Sets the value(s) for experimental (ValueSet.experimental) - * - *

    - * Definition: - * This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public ValueSet setExperimental(BooleanDt theValue) { - myExperimental = theValue; - return this; - } - - - - /** - * Sets the value for experimental (ValueSet.experimental) - * - *

    - * Definition: - * This valueset was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage - *

    - */ - public ValueSet setExperimental( boolean theBoolean) { - myExperimental = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for publisher (ValueSet.publisher). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of the individual or organization that published the value set - *

    - */ - public StringDt getPublisherElement() { - if (myPublisher == null) { - myPublisher = new StringDt(); - } - return myPublisher; - } - - - /** - * Gets the value(s) for publisher (ValueSet.publisher). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of the individual or organization that published the value set - *

    - */ - public String getPublisher() { - return getPublisherElement().getValue(); - } - - /** - * Sets the value(s) for publisher (ValueSet.publisher) - * - *

    - * Definition: - * The name of the individual or organization that published the value set - *

    - */ - public ValueSet setPublisher(StringDt theValue) { - myPublisher = theValue; - return this; - } - - - - /** - * Sets the value for publisher (ValueSet.publisher) - * - *

    - * Definition: - * The name of the individual or organization that published the value set - *

    - */ - public ValueSet setPublisher( String theString) { - myPublisher = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for contact (ValueSet.contact). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public java.util.List getContact() { - if (myContact == null) { - myContact = new java.util.ArrayList(); - } - return myContact; - } - - /** - * Sets the value(s) for contact (ValueSet.contact) - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public ValueSet setContact(java.util.List theValue) { - myContact = theValue; - return this; - } - - - - /** - * Adds and returns a new value for contact (ValueSet.contact) - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public Contact addContact() { - Contact newType = new Contact(); - getContact().add(newType); - return newType; - } - - /** - * Adds a given new value for contact (ValueSet.contact) - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - * @param theValue The contact to add (must not be null) - */ - public ValueSet addContact(Contact theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getContact().add(theValue); - return this; - } - - /** - * Gets the first repetition for contact (ValueSet.contact), - * creating it if it does not already exist. - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - public Contact getContactFirstRep() { - if (getContact().isEmpty()) { - return addContact(); - } - return getContact().get(0); - } - - /** - * Gets the value(s) for date (ValueSet.date). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The date that the value set status was last changed. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the implementation guide changes (e.g. the 'content logical definition') - *

    - */ - public DateTimeDt getDateElement() { - if (myDate == null) { - myDate = new DateTimeDt(); - } - return myDate; - } - - - /** - * Gets the value(s) for date (ValueSet.date). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The date that the value set status was last changed. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the implementation guide changes (e.g. the 'content logical definition') - *

    - */ - public Date getDate() { - return getDateElement().getValue(); - } - - /** - * Sets the value(s) for date (ValueSet.date) - * - *

    - * Definition: - * The date that the value set status was last changed. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the implementation guide changes (e.g. the 'content logical definition') - *

    - */ - public ValueSet setDate(DateTimeDt theValue) { - myDate = theValue; - return this; - } - - - - /** - * Sets the value for date (ValueSet.date) - * - *

    - * Definition: - * The date that the value set status was last changed. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the implementation guide changes (e.g. the 'content logical definition') - *

    - */ - public ValueSet setDate( Date theDate, TemporalPrecisionEnum thePrecision) { - myDate = new DateTimeDt(theDate, thePrecision); - return this; - } - - /** - * Sets the value for date (ValueSet.date) - * - *

    - * Definition: - * The date that the value set status was last changed. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the implementation guide changes (e.g. the 'content logical definition') - *

    - */ - public ValueSet setDateWithSecondsPrecision( Date theDate) { - myDate = new DateTimeDt(theDate); - return this; - } - - - /** - * Gets the value(s) for lockedDate (ValueSet.lockedDate). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If a Locked Date is defined, then the Content Logical Definition must be evaluated using the current version of all referenced code system(s) and value sets as of the Locked Date - *

    - */ - public DateDt getLockedDateElement() { - if (myLockedDate == null) { - myLockedDate = new DateDt(); - } - return myLockedDate; - } - - - /** - * Gets the value(s) for lockedDate (ValueSet.lockedDate). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If a Locked Date is defined, then the Content Logical Definition must be evaluated using the current version of all referenced code system(s) and value sets as of the Locked Date - *

    - */ - public Date getLockedDate() { - return getLockedDateElement().getValue(); - } - - /** - * Sets the value(s) for lockedDate (ValueSet.lockedDate) - * - *

    - * Definition: - * If a Locked Date is defined, then the Content Logical Definition must be evaluated using the current version of all referenced code system(s) and value sets as of the Locked Date - *

    - */ - public ValueSet setLockedDate(DateDt theValue) { - myLockedDate = theValue; - return this; - } - - - - /** - * Sets the value for lockedDate (ValueSet.lockedDate) - * - *

    - * Definition: - * If a Locked Date is defined, then the Content Logical Definition must be evaluated using the current version of all referenced code system(s) and value sets as of the Locked Date - *

    - */ - public ValueSet setLockedDate( Date theDate, TemporalPrecisionEnum thePrecision) { - myLockedDate = new DateDt(theDate, thePrecision); - return this; - } - - /** - * Sets the value for lockedDate (ValueSet.lockedDate) - * - *

    - * Definition: - * If a Locked Date is defined, then the Content Logical Definition must be evaluated using the current version of all referenced code system(s) and value sets as of the Locked Date - *

    - */ - public ValueSet setLockedDateWithDayPrecision( Date theDate) { - myLockedDate = new DateDt(theDate); - return this; - } - - - /** - * Gets the value(s) for description (ValueSet.description). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language description of the use of the value set - reason for definition, \"the semantic space\" to be included in the value set, conditions of use, etc. The description may include a list of expected usages for the value set and can also describe the approach taken to build the value set. - *

    - */ - public StringDt getDescriptionElement() { - if (myDescription == null) { - myDescription = new StringDt(); - } - return myDescription; - } - - - /** - * Gets the value(s) for description (ValueSet.description). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A free text natural language description of the use of the value set - reason for definition, \"the semantic space\" to be included in the value set, conditions of use, etc. The description may include a list of expected usages for the value set and can also describe the approach taken to build the value set. - *

    - */ - public String getDescription() { - return getDescriptionElement().getValue(); - } - - /** - * Sets the value(s) for description (ValueSet.description) - * - *

    - * Definition: - * A free text natural language description of the use of the value set - reason for definition, \"the semantic space\" to be included in the value set, conditions of use, etc. The description may include a list of expected usages for the value set and can also describe the approach taken to build the value set. - *

    - */ - public ValueSet setDescription(StringDt theValue) { - myDescription = theValue; - return this; - } - - - - /** - * Sets the value for description (ValueSet.description) - * - *

    - * Definition: - * A free text natural language description of the use of the value set - reason for definition, \"the semantic space\" to be included in the value set, conditions of use, etc. The description may include a list of expected usages for the value set and can also describe the approach taken to build the value set. - *

    - */ - public ValueSet setDescription( String theString) { - myDescription = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for useContext (ValueSet.useContext). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of value set definitions. - *

    - */ - public java.util.List getUseContext() { - if (myUseContext == null) { - myUseContext = new java.util.ArrayList(); - } - return myUseContext; - } - - /** - * Sets the value(s) for useContext (ValueSet.useContext) - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of value set definitions. - *

    - */ - public ValueSet setUseContext(java.util.List theValue) { - myUseContext = theValue; - return this; - } - - - - /** - * Adds and returns a new value for useContext (ValueSet.useContext) - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of value set definitions. - *

    - */ - public CodeableConceptDt addUseContext() { - CodeableConceptDt newType = new CodeableConceptDt(); - getUseContext().add(newType); - return newType; - } - - /** - * Adds a given new value for useContext (ValueSet.useContext) - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of value set definitions. - *

    - * @param theValue The useContext to add (must not be null) - */ - public ValueSet addUseContext(CodeableConceptDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getUseContext().add(theValue); - return this; - } - - /** - * Gets the first repetition for useContext (ValueSet.useContext), - * creating it if it does not already exist. - * - *

    - * Definition: - * The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of value set definitions. - *

    - */ - public CodeableConceptDt getUseContextFirstRep() { - if (getUseContext().isEmpty()) { - return addUseContext(); - } - return getUseContext().get(0); - } - - /** - * Gets the value(s) for immutable (ValueSet.immutable). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If this is set to 'true', then no new versions of the content logical definition can be created. Note: Other metadata might still change - *

    - */ - public BooleanDt getImmutableElement() { - if (myImmutable == null) { - myImmutable = new BooleanDt(); - } - return myImmutable; - } - - - /** - * Gets the value(s) for immutable (ValueSet.immutable). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If this is set to 'true', then no new versions of the content logical definition can be created. Note: Other metadata might still change - *

    - */ - public Boolean getImmutable() { - return getImmutableElement().getValue(); - } - - /** - * Sets the value(s) for immutable (ValueSet.immutable) - * - *

    - * Definition: - * If this is set to 'true', then no new versions of the content logical definition can be created. Note: Other metadata might still change - *

    - */ - public ValueSet setImmutable(BooleanDt theValue) { - myImmutable = theValue; - return this; - } - - - - /** - * Sets the value for immutable (ValueSet.immutable) - * - *

    - * Definition: - * If this is set to 'true', then no new versions of the content logical definition can be created. Note: Other metadata might still change - *

    - */ - public ValueSet setImmutable( boolean theBoolean) { - myImmutable = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for requirements (ValueSet.requirements). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Explains why this value set is needed and why it's been constrained as it has - *

    - */ - public StringDt getRequirementsElement() { - if (myRequirements == null) { - myRequirements = new StringDt(); - } - return myRequirements; - } - - - /** - * Gets the value(s) for requirements (ValueSet.requirements). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Explains why this value set is needed and why it's been constrained as it has - *

    - */ - public String getRequirements() { - return getRequirementsElement().getValue(); - } - - /** - * Sets the value(s) for requirements (ValueSet.requirements) - * - *

    - * Definition: - * Explains why this value set is needed and why it's been constrained as it has - *

    - */ - public ValueSet setRequirements(StringDt theValue) { - myRequirements = theValue; - return this; - } - - - - /** - * Sets the value for requirements (ValueSet.requirements) - * - *

    - * Definition: - * Explains why this value set is needed and why it's been constrained as it has - *

    - */ - public ValueSet setRequirements( String theString) { - myRequirements = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for copyright (ValueSet.copyright). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set - *

    - */ - public StringDt getCopyrightElement() { - if (myCopyright == null) { - myCopyright = new StringDt(); - } - return myCopyright; - } - - - /** - * Gets the value(s) for copyright (ValueSet.copyright). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set - *

    - */ - public String getCopyright() { - return getCopyrightElement().getValue(); - } - - /** - * Sets the value(s) for copyright (ValueSet.copyright) - * - *

    - * Definition: - * A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set - *

    - */ - public ValueSet setCopyright(StringDt theValue) { - myCopyright = theValue; - return this; - } - - - - /** - * Sets the value for copyright (ValueSet.copyright) - * - *

    - * Definition: - * A copyright statement relating to the value set and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the value set - *

    - */ - public ValueSet setCopyright( String theString) { - myCopyright = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for extensible (ValueSet.extensible). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Whether this is intended to be used with an extensible binding or not - *

    - */ - public BooleanDt getExtensibleElement() { - if (myExtensible == null) { - myExtensible = new BooleanDt(); - } - return myExtensible; - } - - - /** - * Gets the value(s) for extensible (ValueSet.extensible). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Whether this is intended to be used with an extensible binding or not - *

    - */ - public Boolean getExtensible() { - return getExtensibleElement().getValue(); - } - - /** - * Sets the value(s) for extensible (ValueSet.extensible) - * - *

    - * Definition: - * Whether this is intended to be used with an extensible binding or not - *

    - */ - public ValueSet setExtensible(BooleanDt theValue) { - myExtensible = theValue; - return this; - } - - - - /** - * Sets the value for extensible (ValueSet.extensible) - * - *

    - * Definition: - * Whether this is intended to be used with an extensible binding or not - *

    - */ - public ValueSet setExtensible( boolean theBoolean) { - myExtensible = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for codeSystem (ValueSet.codeSystem). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A definition of an code system, inlined into the value set (as a packaging convenience). Note that the inline code system may be used from other value sets by referring to it's (codeSystem.system) directly - *

    - */ - public CodeSystem getCodeSystem() { - if (myCodeSystem == null) { - myCodeSystem = new CodeSystem(); - } - return myCodeSystem; - } - - /** - * Sets the value(s) for codeSystem (ValueSet.codeSystem) - * - *

    - * Definition: - * A definition of an code system, inlined into the value set (as a packaging convenience). Note that the inline code system may be used from other value sets by referring to it's (codeSystem.system) directly - *

    - */ - public ValueSet setCodeSystem(CodeSystem theValue) { - myCodeSystem = theValue; - return this; - } - - - - - /** - * Gets the value(s) for compose (ValueSet.compose). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A set of criteria that provide the content logical definition of the value set by including or excluding codes from outside this value set - *

    - */ - public Compose getCompose() { - if (myCompose == null) { - myCompose = new Compose(); - } - return myCompose; - } - - /** - * Sets the value(s) for compose (ValueSet.compose) - * - *

    - * Definition: - * A set of criteria that provide the content logical definition of the value set by including or excluding codes from outside this value set - *

    - */ - public ValueSet setCompose(Compose theValue) { - myCompose = theValue; - return this; - } - - - - - /** - * Gets the value(s) for expansion (ValueSet.expansion). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A value set can also be \"expanded\", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed - *

    - */ - public Expansion getExpansion() { - if (myExpansion == null) { - myExpansion = new Expansion(); - } - return myExpansion; - } - - /** - * Sets the value(s) for expansion (ValueSet.expansion) - * - *

    - * Definition: - * A value set can also be \"expanded\", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed - *

    - */ - public ValueSet setExpansion(Expansion theValue) { - myExpansion = theValue; - return this; - } - - - - - /** - * Block class for child element: ValueSet.contact (ValueSet.contact) - * - *

    - * Definition: - * Contacts to assist a user in finding and communicating with the publisher - *

    - */ - @Block() - public static class Contact - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="name", type=StringDt.class, order=0, min=0, max=1) - @Description( - shortDefinition="ValueSet.contact.name", - formalDefinition="The name of an individual to contact regarding the value set" - ) - private StringDt myName; - - @Child(name="telecom", type=ContactPointDt.class, order=1, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.contact.telecom", - formalDefinition="Contact details for individual (if a name was provided) or the publisher" - ) - private java.util.List myTelecom; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myTelecom); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myName, myTelecom); - } - - /** - * Gets the value(s) for name (ValueSet.contact.name). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of an individual to contact regarding the value set - *

    - */ - public StringDt getNameElement() { - if (myName == null) { - myName = new StringDt(); - } - return myName; - } - - - /** - * Gets the value(s) for name (ValueSet.contact.name). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of an individual to contact regarding the value set - *

    - */ - public String getName() { - return getNameElement().getValue(); - } - - /** - * Sets the value(s) for name (ValueSet.contact.name) - * - *

    - * Definition: - * The name of an individual to contact regarding the value set - *

    - */ - public Contact setName(StringDt theValue) { - myName = theValue; - return this; - } - - - - /** - * Sets the value for name (ValueSet.contact.name) - * - *

    - * Definition: - * The name of an individual to contact regarding the value set - *

    - */ - public Contact setName( String theString) { - myName = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for telecom (ValueSet.contact.telecom). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public java.util.List getTelecom() { - if (myTelecom == null) { - myTelecom = new java.util.ArrayList(); - } - return myTelecom; - } - - /** - * Sets the value(s) for telecom (ValueSet.contact.telecom) - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public Contact setTelecom(java.util.List theValue) { - myTelecom = theValue; - return this; - } - - - - /** - * Adds and returns a new value for telecom (ValueSet.contact.telecom) - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public ContactPointDt addTelecom() { - ContactPointDt newType = new ContactPointDt(); - getTelecom().add(newType); - return newType; - } - - /** - * Adds a given new value for telecom (ValueSet.contact.telecom) - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - * @param theValue The telecom to add (must not be null) - */ - public Contact addTelecom(ContactPointDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getTelecom().add(theValue); - return this; - } - - /** - * Gets the first repetition for telecom (ValueSet.contact.telecom), - * creating it if it does not already exist. - * - *

    - * Definition: - * Contact details for individual (if a name was provided) or the publisher - *

    - */ - public ContactPointDt getTelecomFirstRep() { - if (getTelecom().isEmpty()) { - return addTelecom(); - } - return getTelecom().get(0); - } - - - - } - - - /** - * Block class for child element: ValueSet.codeSystem (ValueSet.codeSystem) - * - *

    - * Definition: - * A definition of an code system, inlined into the value set (as a packaging convenience). Note that the inline code system may be used from other value sets by referring to it's (codeSystem.system) directly - *

    - */ - @Block() - public static class CodeSystem - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="system", type=UriDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.system", - formalDefinition="An absolute URI that is used to reference this code system, including in [Coding]{datatypes.html#Coding}.system" - ) - private UriDt mySystem; - - @Child(name="version", type=StringDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.version", - formalDefinition="The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked" - ) - private StringDt myVersion; - - @Child(name="caseSensitive", type=BooleanDt.class, order=2, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.caseSensitive", - formalDefinition="If code comparison is case sensitive when codes within this system are compared to each other" - ) - private BooleanDt myCaseSensitive; - - @Child(name="concept", order=3, min=1, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.codeSystem.concept", - formalDefinition="Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are" - ) - private java.util.List myConcept; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCaseSensitive, myConcept); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySystem, myVersion, myCaseSensitive, myConcept); - } - - /** - * Gets the value(s) for system (ValueSet.codeSystem.system). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI that is used to reference this code system, including in [Coding]{datatypes.html#Coding}.system - *

    - */ - public UriDt getSystemElement() { - if (mySystem == null) { - mySystem = new UriDt(); - } - return mySystem; - } - - - /** - * Gets the value(s) for system (ValueSet.codeSystem.system). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI that is used to reference this code system, including in [Coding]{datatypes.html#Coding}.system - *

    - */ - public String getSystem() { - return getSystemElement().getValue(); - } - - /** - * Sets the value(s) for system (ValueSet.codeSystem.system) - * - *

    - * Definition: - * An absolute URI that is used to reference this code system, including in [Coding]{datatypes.html#Coding}.system - *

    - */ - public CodeSystem setSystem(UriDt theValue) { - mySystem = theValue; - return this; - } - - - - /** - * Sets the value for system (ValueSet.codeSystem.system) - * - *

    - * Definition: - * An absolute URI that is used to reference this code system, including in [Coding]{datatypes.html#Coding}.system - *

    - */ - public CodeSystem setSystem( String theUri) { - mySystem = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for version (ValueSet.codeSystem.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked - *

    - */ - public StringDt getVersionElement() { - if (myVersion == null) { - myVersion = new StringDt(); - } - return myVersion; - } - - - /** - * Gets the value(s) for version (ValueSet.codeSystem.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked - *

    - */ - public String getVersion() { - return getVersionElement().getValue(); - } - - /** - * Sets the value(s) for version (ValueSet.codeSystem.version) - * - *

    - * Definition: - * The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked - *

    - */ - public CodeSystem setVersion(StringDt theValue) { - myVersion = theValue; - return this; - } - - - - /** - * Sets the value for version (ValueSet.codeSystem.version) - * - *

    - * Definition: - * The version of this code system that defines the codes. Note that the version is optional because a well maintained code system does not suffer from versioning, and therefore the version does not need to be maintained. However many code systems are not well maintained, and the version needs to be defined and tracked - *

    - */ - public CodeSystem setVersion( String theString) { - myVersion = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for caseSensitive (ValueSet.codeSystem.caseSensitive). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If code comparison is case sensitive when codes within this system are compared to each other - *

    - */ - public BooleanDt getCaseSensitiveElement() { - if (myCaseSensitive == null) { - myCaseSensitive = new BooleanDt(); - } - return myCaseSensitive; - } - - - /** - * Gets the value(s) for caseSensitive (ValueSet.codeSystem.caseSensitive). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If code comparison is case sensitive when codes within this system are compared to each other - *

    - */ - public Boolean getCaseSensitive() { - return getCaseSensitiveElement().getValue(); - } - - /** - * Sets the value(s) for caseSensitive (ValueSet.codeSystem.caseSensitive) - * - *

    - * Definition: - * If code comparison is case sensitive when codes within this system are compared to each other - *

    - */ - public CodeSystem setCaseSensitive(BooleanDt theValue) { - myCaseSensitive = theValue; - return this; - } - - - - /** - * Sets the value for caseSensitive (ValueSet.codeSystem.caseSensitive) - * - *

    - * Definition: - * If code comparison is case sensitive when codes within this system are compared to each other - *

    - */ - public CodeSystem setCaseSensitive( boolean theBoolean) { - myCaseSensitive = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for concept (ValueSet.codeSystem.concept). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are - *

    - */ - public java.util.List getConcept() { - if (myConcept == null) { - myConcept = new java.util.ArrayList(); - } - return myConcept; - } - - /** - * Sets the value(s) for concept (ValueSet.codeSystem.concept) - * - *

    - * Definition: - * Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are - *

    - */ - public CodeSystem setConcept(java.util.List theValue) { - myConcept = theValue; - return this; - } - - - - /** - * Adds and returns a new value for concept (ValueSet.codeSystem.concept) - * - *

    - * Definition: - * Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are - *

    - */ - public CodeSystemConcept addConcept() { - CodeSystemConcept newType = new CodeSystemConcept(); - getConcept().add(newType); - return newType; - } - - /** - * Adds a given new value for concept (ValueSet.codeSystem.concept) - * - *

    - * Definition: - * Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are - *

    - * @param theValue The concept to add (must not be null) - */ - public CodeSystem addConcept(CodeSystemConcept theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getConcept().add(theValue); - return this; - } - - /** - * Gets the first repetition for concept (ValueSet.codeSystem.concept), - * creating it if it does not already exist. - * - *

    - * Definition: - * Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are - *

    - */ - public CodeSystemConcept getConceptFirstRep() { - if (getConcept().isEmpty()) { - return addConcept(); - } - return getConcept().get(0); - } - - - - } - - /** - * Block class for child element: ValueSet.codeSystem.concept (ValueSet.codeSystem.concept) - * - *

    - * Definition: - * Concepts that are in the code system. The concept definitions are inherently heirarchical, but the definitions must be consulted to determine what the meaning of the heirachical relationships are - *

    - */ - @Block() - public static class CodeSystemConcept - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="code", type=CodeDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.code", - formalDefinition="A code - a text symbol - that uniquely identifies the concept within the code system" - ) - private CodeDt myCode; - - @Child(name="abstract", type=BooleanDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.abstract", - formalDefinition="If this code is not for use as a real concept" - ) - private BooleanDt myAbstract; - - @Child(name="display", type=StringDt.class, order=2, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.display", - formalDefinition="A human readable string that is the recommended default way to present this concept to a user" - ) - private StringDt myDisplay; - - @Child(name="definition", type=StringDt.class, order=3, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.definition", - formalDefinition="The formal definition of the concept. The value set resource does not make formal definitions required, because of the prevalence of legacy systems. However, but they are highly recommended, as without them there is no formal meaning associated with the concept" - ) - private StringDt myDefinition; - - @Child(name="designation", order=4, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.codeSystem.concept.designation", - formalDefinition="Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc" - ) - private java.util.List myDesignation; - - @Child(name="concept", type=CodeSystemConcept.class, order=5, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.codeSystem.concept.concept", - formalDefinition="Child Concepts - a heirarchy of concepts. The nature of the relationships is variable (is-a / contains / categorises) and can only be determined by examining the definitions of the concepts" - ) - private java.util.List myConcept; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myAbstract, myDisplay, myDefinition, myDesignation, myConcept); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myCode, myAbstract, myDisplay, myDefinition, myDesignation, myConcept); - } - - /** - * Gets the value(s) for code (ValueSet.codeSystem.concept.code). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A code - a text symbol - that uniquely identifies the concept within the code system - *

    - */ - public CodeDt getCodeElement() { - if (myCode == null) { - myCode = new CodeDt(); - } - return myCode; - } - - - /** - * Gets the value(s) for code (ValueSet.codeSystem.concept.code). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A code - a text symbol - that uniquely identifies the concept within the code system - *

    - */ - public String getCode() { - return getCodeElement().getValue(); - } - - /** - * Sets the value(s) for code (ValueSet.codeSystem.concept.code) - * - *

    - * Definition: - * A code - a text symbol - that uniquely identifies the concept within the code system - *

    - */ - public CodeSystemConcept setCode(CodeDt theValue) { - myCode = theValue; - return this; - } - - - - /** - * Sets the value for code (ValueSet.codeSystem.concept.code) - * - *

    - * Definition: - * A code - a text symbol - that uniquely identifies the concept within the code system - *

    - */ - public CodeSystemConcept setCode( String theCode) { - myCode = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for abstract (ValueSet.codeSystem.concept.abstract). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If this code is not for use as a real concept - *

    - */ - public BooleanDt getAbstractElement() { - if (myAbstract == null) { - myAbstract = new BooleanDt(); - } - return myAbstract; - } - - - /** - * Gets the value(s) for abstract (ValueSet.codeSystem.concept.abstract). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If this code is not for use as a real concept - *

    - */ - public Boolean getAbstract() { - return getAbstractElement().getValue(); - } - - /** - * Sets the value(s) for abstract (ValueSet.codeSystem.concept.abstract) - * - *

    - * Definition: - * If this code is not for use as a real concept - *

    - */ - public CodeSystemConcept setAbstract(BooleanDt theValue) { - myAbstract = theValue; - return this; - } - - - - /** - * Sets the value for abstract (ValueSet.codeSystem.concept.abstract) - * - *

    - * Definition: - * If this code is not for use as a real concept - *

    - */ - public CodeSystemConcept setAbstract( boolean theBoolean) { - myAbstract = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for display (ValueSet.codeSystem.concept.display). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A human readable string that is the recommended default way to present this concept to a user - *

    - */ - public StringDt getDisplayElement() { - if (myDisplay == null) { - myDisplay = new StringDt(); - } - return myDisplay; - } - - - /** - * Gets the value(s) for display (ValueSet.codeSystem.concept.display). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A human readable string that is the recommended default way to present this concept to a user - *

    - */ - public String getDisplay() { - return getDisplayElement().getValue(); - } - - /** - * Sets the value(s) for display (ValueSet.codeSystem.concept.display) - * - *

    - * Definition: - * A human readable string that is the recommended default way to present this concept to a user - *

    - */ - public CodeSystemConcept setDisplay(StringDt theValue) { - myDisplay = theValue; - return this; - } - - - - /** - * Sets the value for display (ValueSet.codeSystem.concept.display) - * - *

    - * Definition: - * A human readable string that is the recommended default way to present this concept to a user - *

    - */ - public CodeSystemConcept setDisplay( String theString) { - myDisplay = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for definition (ValueSet.codeSystem.concept.definition). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The formal definition of the concept. The value set resource does not make formal definitions required, because of the prevalence of legacy systems. However, but they are highly recommended, as without them there is no formal meaning associated with the concept - *

    - */ - public StringDt getDefinitionElement() { - if (myDefinition == null) { - myDefinition = new StringDt(); - } - return myDefinition; - } - - - /** - * Gets the value(s) for definition (ValueSet.codeSystem.concept.definition). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The formal definition of the concept. The value set resource does not make formal definitions required, because of the prevalence of legacy systems. However, but they are highly recommended, as without them there is no formal meaning associated with the concept - *

    - */ - public String getDefinition() { - return getDefinitionElement().getValue(); - } - - /** - * Sets the value(s) for definition (ValueSet.codeSystem.concept.definition) - * - *

    - * Definition: - * The formal definition of the concept. The value set resource does not make formal definitions required, because of the prevalence of legacy systems. However, but they are highly recommended, as without them there is no formal meaning associated with the concept - *

    - */ - public CodeSystemConcept setDefinition(StringDt theValue) { - myDefinition = theValue; - return this; - } - - - - /** - * Sets the value for definition (ValueSet.codeSystem.concept.definition) - * - *

    - * Definition: - * The formal definition of the concept. The value set resource does not make formal definitions required, because of the prevalence of legacy systems. However, but they are highly recommended, as without them there is no formal meaning associated with the concept - *

    - */ - public CodeSystemConcept setDefinition( String theString) { - myDefinition = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for designation (ValueSet.codeSystem.concept.designation). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public java.util.List getDesignation() { - if (myDesignation == null) { - myDesignation = new java.util.ArrayList(); - } - return myDesignation; - } - - /** - * Sets the value(s) for designation (ValueSet.codeSystem.concept.designation) - * - *

    - * Definition: - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public CodeSystemConcept setDesignation(java.util.List theValue) { - myDesignation = theValue; - return this; - } - - - - /** - * Adds and returns a new value for designation (ValueSet.codeSystem.concept.designation) - * - *

    - * Definition: - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public CodeSystemConceptDesignation addDesignation() { - CodeSystemConceptDesignation newType = new CodeSystemConceptDesignation(); - getDesignation().add(newType); - return newType; - } - - /** - * Adds a given new value for designation (ValueSet.codeSystem.concept.designation) - * - *

    - * Definition: - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - * @param theValue The designation to add (must not be null) - */ - public CodeSystemConcept addDesignation(CodeSystemConceptDesignation theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getDesignation().add(theValue); - return this; - } - - /** - * Gets the first repetition for designation (ValueSet.codeSystem.concept.designation), - * creating it if it does not already exist. - * - *

    - * Definition: - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public CodeSystemConceptDesignation getDesignationFirstRep() { - if (getDesignation().isEmpty()) { - return addDesignation(); - } - return getDesignation().get(0); - } - - /** - * Gets the value(s) for concept (ValueSet.codeSystem.concept.concept). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Child Concepts - a heirarchy of concepts. The nature of the relationships is variable (is-a / contains / categorises) and can only be determined by examining the definitions of the concepts - *

    - */ - public java.util.List getConcept() { - if (myConcept == null) { - myConcept = new java.util.ArrayList(); - } - return myConcept; - } - - /** - * Sets the value(s) for concept (ValueSet.codeSystem.concept.concept) - * - *

    - * Definition: - * Child Concepts - a heirarchy of concepts. The nature of the relationships is variable (is-a / contains / categorises) and can only be determined by examining the definitions of the concepts - *

    - */ - public CodeSystemConcept setConcept(java.util.List theValue) { - myConcept = theValue; - return this; - } - - - - /** - * Adds and returns a new value for concept (ValueSet.codeSystem.concept.concept) - * - *

    - * Definition: - * Child Concepts - a heirarchy of concepts. The nature of the relationships is variable (is-a / contains / categorises) and can only be determined by examining the definitions of the concepts - *

    - */ - public CodeSystemConcept addConcept() { - CodeSystemConcept newType = new CodeSystemConcept(); - getConcept().add(newType); - return newType; - } - - /** - * Adds a given new value for concept (ValueSet.codeSystem.concept.concept) - * - *

    - * Definition: - * Child Concepts - a heirarchy of concepts. The nature of the relationships is variable (is-a / contains / categorises) and can only be determined by examining the definitions of the concepts - *

    - * @param theValue The concept to add (must not be null) - */ - public CodeSystemConcept addConcept(CodeSystemConcept theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getConcept().add(theValue); - return this; - } - - /** - * Gets the first repetition for concept (ValueSet.codeSystem.concept.concept), - * creating it if it does not already exist. - * - *

    - * Definition: - * Child Concepts - a heirarchy of concepts. The nature of the relationships is variable (is-a / contains / categorises) and can only be determined by examining the definitions of the concepts - *

    - */ - public CodeSystemConcept getConceptFirstRep() { - if (getConcept().isEmpty()) { - return addConcept(); - } - return getConcept().get(0); - } - - - - } - - /** - * Block class for child element: ValueSet.codeSystem.concept.designation (ValueSet.codeSystem.concept.designation) - * - *

    - * Definition: - * Additional representations for the concept - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - @Block() - public static class CodeSystemConceptDesignation - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="language", type=CodeDt.class, order=0, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.designation.language", - formalDefinition="The language this designation is defined for" - ) - private CodeDt myLanguage; - - @Child(name="use", type=CodingDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.designation.use", - formalDefinition="A code that details how this designation would be used" - ) - private CodingDt myUse; - - @Child(name="value", type=StringDt.class, order=2, min=1, max=1) - @Description( - shortDefinition="ValueSet.codeSystem.concept.designation.value", - formalDefinition="The text value for this designation" - ) - private StringDt myValue; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myLanguage, myUse, myValue); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myLanguage, myUse, myValue); - } - - /** - * Gets the value(s) for language (ValueSet.codeSystem.concept.designation.language). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The language this designation is defined for - *

    - */ - public CodeDt getLanguageElement() { - if (myLanguage == null) { - myLanguage = new CodeDt(); - } - return myLanguage; - } - - - /** - * Gets the value(s) for language (ValueSet.codeSystem.concept.designation.language). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The language this designation is defined for - *

    - */ - public String getLanguage() { - return getLanguageElement().getValue(); - } - - /** - * Sets the value(s) for language (ValueSet.codeSystem.concept.designation.language) - * - *

    - * Definition: - * The language this designation is defined for - *

    - */ - public CodeSystemConceptDesignation setLanguage(CodeDt theValue) { - myLanguage = theValue; - return this; - } - - - - /** - * Sets the value for language (ValueSet.codeSystem.concept.designation.language) - * - *

    - * Definition: - * The language this designation is defined for - *

    - */ - public CodeSystemConceptDesignation setLanguage( String theCode) { - myLanguage = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for use (ValueSet.codeSystem.concept.designation.use). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A code that details how this designation would be used - *

    - */ - public CodingDt getUse() { - if (myUse == null) { - myUse = new CodingDt(); - } - return myUse; - } - - /** - * Sets the value(s) for use (ValueSet.codeSystem.concept.designation.use) - * - *

    - * Definition: - * A code that details how this designation would be used - *

    - */ - public CodeSystemConceptDesignation setUse(CodingDt theValue) { - myUse = theValue; - return this; - } - - - - - /** - * Gets the value(s) for value (ValueSet.codeSystem.concept.designation.value). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The text value for this designation - *

    - */ - public StringDt getValueElement() { - if (myValue == null) { - myValue = new StringDt(); - } - return myValue; - } - - - /** - * Gets the value(s) for value (ValueSet.codeSystem.concept.designation.value). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The text value for this designation - *

    - */ - public String getValue() { - return getValueElement().getValue(); - } - - /** - * Sets the value(s) for value (ValueSet.codeSystem.concept.designation.value) - * - *

    - * Definition: - * The text value for this designation - *

    - */ - public CodeSystemConceptDesignation setValue(StringDt theValue) { - myValue = theValue; - return this; - } - - - - /** - * Sets the value for value (ValueSet.codeSystem.concept.designation.value) - * - *

    - * Definition: - * The text value for this designation - *

    - */ - public CodeSystemConceptDesignation setValue( String theString) { - myValue = new StringDt(theString); - return this; - } - - - - - } - - - - - /** - * Block class for child element: ValueSet.compose (ValueSet.compose) - * - *

    - * Definition: - * A set of criteria that provide the content logical definition of the value set by including or excluding codes from outside this value set - *

    - */ - @Block() - public static class Compose - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="import", type=UriDt.class, order=0, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.compose.import", - formalDefinition="Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri" - ) - private java.util.List myImport; - - @Child(name="include", order=1, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.compose.include", - formalDefinition="Include one or more codes from a code system" - ) - private java.util.List myInclude; - - @Child(name="exclude", type=ComposeInclude.class, order=2, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.compose.exclude", - formalDefinition="Exclude one or more codes from the value set" - ) - private java.util.List myExclude; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myImport, myInclude, myExclude); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myImport, myInclude, myExclude); - } - - /** - * Gets the value(s) for import (ValueSet.compose.import). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri - *

    - */ - public java.util.List getImport() { - if (myImport == null) { - myImport = new java.util.ArrayList(); - } - return myImport; - } - - /** - * Sets the value(s) for import (ValueSet.compose.import) - * - *

    - * Definition: - * Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri - *

    - */ - public Compose setImport(java.util.List theValue) { - myImport = theValue; - return this; - } - - - - /** - * Adds and returns a new value for import (ValueSet.compose.import) - * - *

    - * Definition: - * Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri - *

    - */ - public UriDt addImport() { - UriDt newType = new UriDt(); - getImport().add(newType); - return newType; - } - - /** - * Adds a given new value for import (ValueSet.compose.import) - * - *

    - * Definition: - * Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri - *

    - * @param theValue The import to add (must not be null) - */ - public Compose addImport(UriDt theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getImport().add(theValue); - return this; - } - - /** - * Gets the first repetition for import (ValueSet.compose.import), - * creating it if it does not already exist. - * - *

    - * Definition: - * Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri - *

    - */ - public UriDt getImportFirstRep() { - if (getImport().isEmpty()) { - return addImport(); - } - return getImport().get(0); - } - /** - * Adds a new value for import (ValueSet.compose.import) - * - *

    - * Definition: - * Includes the contents of the referenced value set as a part of the contents of this value set. This is an absolute URI that is a reference to ValueSet.uri - *

    - * - * @return Returns a reference to this object, to allow for simple chaining. - */ - public Compose addImport( String theUri) { - if (myImport == null) { - myImport = new java.util.ArrayList(); - } - myImport.add(new UriDt(theUri)); - return this; - } - - - /** - * Gets the value(s) for include (ValueSet.compose.include). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Include one or more codes from a code system - *

    - */ - public java.util.List getInclude() { - if (myInclude == null) { - myInclude = new java.util.ArrayList(); - } - return myInclude; - } - - /** - * Sets the value(s) for include (ValueSet.compose.include) - * - *

    - * Definition: - * Include one or more codes from a code system - *

    - */ - public Compose setInclude(java.util.List theValue) { - myInclude = theValue; - return this; - } - - - - /** - * Adds and returns a new value for include (ValueSet.compose.include) - * - *

    - * Definition: - * Include one or more codes from a code system - *

    - */ - public ComposeInclude addInclude() { - ComposeInclude newType = new ComposeInclude(); - getInclude().add(newType); - return newType; - } - - /** - * Adds a given new value for include (ValueSet.compose.include) - * - *

    - * Definition: - * Include one or more codes from a code system - *

    - * @param theValue The include to add (must not be null) - */ - public Compose addInclude(ComposeInclude theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getInclude().add(theValue); - return this; - } - - /** - * Gets the first repetition for include (ValueSet.compose.include), - * creating it if it does not already exist. - * - *

    - * Definition: - * Include one or more codes from a code system - *

    - */ - public ComposeInclude getIncludeFirstRep() { - if (getInclude().isEmpty()) { - return addInclude(); - } - return getInclude().get(0); - } - - /** - * Gets the value(s) for exclude (ValueSet.compose.exclude). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Exclude one or more codes from the value set - *

    - */ - public java.util.List getExclude() { - if (myExclude == null) { - myExclude = new java.util.ArrayList(); - } - return myExclude; - } - - /** - * Sets the value(s) for exclude (ValueSet.compose.exclude) - * - *

    - * Definition: - * Exclude one or more codes from the value set - *

    - */ - public Compose setExclude(java.util.List theValue) { - myExclude = theValue; - return this; - } - - - - /** - * Adds and returns a new value for exclude (ValueSet.compose.exclude) - * - *

    - * Definition: - * Exclude one or more codes from the value set - *

    - */ - public ComposeInclude addExclude() { - ComposeInclude newType = new ComposeInclude(); - getExclude().add(newType); - return newType; - } - - /** - * Adds a given new value for exclude (ValueSet.compose.exclude) - * - *

    - * Definition: - * Exclude one or more codes from the value set - *

    - * @param theValue The exclude to add (must not be null) - */ - public Compose addExclude(ComposeInclude theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getExclude().add(theValue); - return this; - } - - /** - * Gets the first repetition for exclude (ValueSet.compose.exclude), - * creating it if it does not already exist. - * - *

    - * Definition: - * Exclude one or more codes from the value set - *

    - */ - public ComposeInclude getExcludeFirstRep() { - if (getExclude().isEmpty()) { - return addExclude(); - } - return getExclude().get(0); - } - - - - } - - /** - * Block class for child element: ValueSet.compose.include (ValueSet.compose.include) - * - *

    - * Definition: - * Include one or more codes from a code system - *

    - */ - @Block() - public static class ComposeInclude - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="system", type=UriDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.compose.include.system", - formalDefinition="An absolute URI which is the code system from which the selected codes come from" - ) - private UriDt mySystem; - - @Child(name="version", type=StringDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.compose.include.version", - formalDefinition="The version of the code system that the codes are selected from" - ) - private StringDt myVersion; - - @Child(name="concept", order=2, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.compose.include.concept", - formalDefinition="Specifies a concept to be included or excluded." - ) - private java.util.List myConcept; - - @Child(name="filter", order=3, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.compose.include.filter", - formalDefinition="Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true." - ) - private java.util.List myFilter; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myConcept, myFilter); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySystem, myVersion, myConcept, myFilter); - } - - /** - * Gets the value(s) for system (ValueSet.compose.include.system). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI which is the code system from which the selected codes come from - *

    - */ - public UriDt getSystemElement() { - if (mySystem == null) { - mySystem = new UriDt(); - } - return mySystem; - } - - - /** - * Gets the value(s) for system (ValueSet.compose.include.system). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI which is the code system from which the selected codes come from - *

    - */ - public String getSystem() { - return getSystemElement().getValue(); - } - - /** - * Sets the value(s) for system (ValueSet.compose.include.system) - * - *

    - * Definition: - * An absolute URI which is the code system from which the selected codes come from - *

    - */ - public ComposeInclude setSystem(UriDt theValue) { - mySystem = theValue; - return this; - } - - - - /** - * Sets the value for system (ValueSet.compose.include.system) - * - *

    - * Definition: - * An absolute URI which is the code system from which the selected codes come from - *

    - */ - public ComposeInclude setSystem( String theUri) { - mySystem = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for version (ValueSet.compose.include.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of the code system that the codes are selected from - *

    - */ - public StringDt getVersionElement() { - if (myVersion == null) { - myVersion = new StringDt(); - } - return myVersion; - } - - - /** - * Gets the value(s) for version (ValueSet.compose.include.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of the code system that the codes are selected from - *

    - */ - public String getVersion() { - return getVersionElement().getValue(); - } - - /** - * Sets the value(s) for version (ValueSet.compose.include.version) - * - *

    - * Definition: - * The version of the code system that the codes are selected from - *

    - */ - public ComposeInclude setVersion(StringDt theValue) { - myVersion = theValue; - return this; - } - - - - /** - * Sets the value for version (ValueSet.compose.include.version) - * - *

    - * Definition: - * The version of the code system that the codes are selected from - *

    - */ - public ComposeInclude setVersion( String theString) { - myVersion = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for concept (ValueSet.compose.include.concept). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Specifies a concept to be included or excluded. - *

    - */ - public java.util.List getConcept() { - if (myConcept == null) { - myConcept = new java.util.ArrayList(); - } - return myConcept; - } - - /** - * Sets the value(s) for concept (ValueSet.compose.include.concept) - * - *

    - * Definition: - * Specifies a concept to be included or excluded. - *

    - */ - public ComposeInclude setConcept(java.util.List theValue) { - myConcept = theValue; - return this; - } - - - - /** - * Adds and returns a new value for concept (ValueSet.compose.include.concept) - * - *

    - * Definition: - * Specifies a concept to be included or excluded. - *

    - */ - public ComposeIncludeConcept addConcept() { - ComposeIncludeConcept newType = new ComposeIncludeConcept(); - getConcept().add(newType); - return newType; - } - - /** - * Adds a given new value for concept (ValueSet.compose.include.concept) - * - *

    - * Definition: - * Specifies a concept to be included or excluded. - *

    - * @param theValue The concept to add (must not be null) - */ - public ComposeInclude addConcept(ComposeIncludeConcept theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getConcept().add(theValue); - return this; - } - - /** - * Gets the first repetition for concept (ValueSet.compose.include.concept), - * creating it if it does not already exist. - * - *

    - * Definition: - * Specifies a concept to be included or excluded. - *

    - */ - public ComposeIncludeConcept getConceptFirstRep() { - if (getConcept().isEmpty()) { - return addConcept(); - } - return getConcept().get(0); - } - - /** - * Gets the value(s) for filter (ValueSet.compose.include.filter). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true. - *

    - */ - public java.util.List getFilter() { - if (myFilter == null) { - myFilter = new java.util.ArrayList(); - } - return myFilter; - } - - /** - * Sets the value(s) for filter (ValueSet.compose.include.filter) - * - *

    - * Definition: - * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true. - *

    - */ - public ComposeInclude setFilter(java.util.List theValue) { - myFilter = theValue; - return this; - } - - - - /** - * Adds and returns a new value for filter (ValueSet.compose.include.filter) - * - *

    - * Definition: - * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true. - *

    - */ - public ComposeIncludeFilter addFilter() { - ComposeIncludeFilter newType = new ComposeIncludeFilter(); - getFilter().add(newType); - return newType; - } - - /** - * Adds a given new value for filter (ValueSet.compose.include.filter) - * - *

    - * Definition: - * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true. - *

    - * @param theValue The filter to add (must not be null) - */ - public ComposeInclude addFilter(ComposeIncludeFilter theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getFilter().add(theValue); - return this; - } - - /** - * Gets the first repetition for filter (ValueSet.compose.include.filter), - * creating it if it does not already exist. - * - *

    - * Definition: - * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true. - *

    - */ - public ComposeIncludeFilter getFilterFirstRep() { - if (getFilter().isEmpty()) { - return addFilter(); - } - return getFilter().get(0); - } - - - - } - - /** - * Block class for child element: ValueSet.compose.include.concept (ValueSet.compose.include.concept) - * - *

    - * Definition: - * Specifies a concept to be included or excluded. - *

    - */ - @Block() - public static class ComposeIncludeConcept - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="code", type=CodeDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.compose.include.concept.code", - formalDefinition="Specifies a code for the concept to be included or excluded" - ) - private CodeDt myCode; - - @Child(name="display", type=StringDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.compose.include.concept.display", - formalDefinition="The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system" - ) - private StringDt myDisplay; - - @Child(name="designation", type=CodeSystemConceptDesignation.class, order=2, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.compose.include.concept.designation", - formalDefinition="Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc" - ) - private java.util.List myDesignation; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myDisplay, myDesignation); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myCode, myDisplay, myDesignation); - } - - /** - * Gets the value(s) for code (ValueSet.compose.include.concept.code). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Specifies a code for the concept to be included or excluded - *

    - */ - public CodeDt getCodeElement() { - if (myCode == null) { - myCode = new CodeDt(); - } - return myCode; - } - - - /** - * Gets the value(s) for code (ValueSet.compose.include.concept.code). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Specifies a code for the concept to be included or excluded - *

    - */ - public String getCode() { - return getCodeElement().getValue(); - } - - /** - * Sets the value(s) for code (ValueSet.compose.include.concept.code) - * - *

    - * Definition: - * Specifies a code for the concept to be included or excluded - *

    - */ - public ComposeIncludeConcept setCode(CodeDt theValue) { - myCode = theValue; - return this; - } - - - - /** - * Sets the value for code (ValueSet.compose.include.concept.code) - * - *

    - * Definition: - * Specifies a code for the concept to be included or excluded - *

    - */ - public ComposeIncludeConcept setCode( String theCode) { - myCode = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for display (ValueSet.compose.include.concept.display). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system - *

    - */ - public StringDt getDisplayElement() { - if (myDisplay == null) { - myDisplay = new StringDt(); - } - return myDisplay; - } - - - /** - * Gets the value(s) for display (ValueSet.compose.include.concept.display). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system - *

    - */ - public String getDisplay() { - return getDisplayElement().getValue(); - } - - /** - * Sets the value(s) for display (ValueSet.compose.include.concept.display) - * - *

    - * Definition: - * The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system - *

    - */ - public ComposeIncludeConcept setDisplay(StringDt theValue) { - myDisplay = theValue; - return this; - } - - - - /** - * Sets the value for display (ValueSet.compose.include.concept.display) - * - *

    - * Definition: - * The text to display to the user for this concept in the context of this valueset. If no display is provided, then applications using the value set use the display specified for the code by the system - *

    - */ - public ComposeIncludeConcept setDisplay( String theString) { - myDisplay = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for designation (ValueSet.compose.include.concept.designation). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public java.util.List getDesignation() { - if (myDesignation == null) { - myDesignation = new java.util.ArrayList(); - } - return myDesignation; - } - - /** - * Sets the value(s) for designation (ValueSet.compose.include.concept.designation) - * - *

    - * Definition: - * Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public ComposeIncludeConcept setDesignation(java.util.List theValue) { - myDesignation = theValue; - return this; - } - - - - /** - * Adds and returns a new value for designation (ValueSet.compose.include.concept.designation) - * - *

    - * Definition: - * Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public CodeSystemConceptDesignation addDesignation() { - CodeSystemConceptDesignation newType = new CodeSystemConceptDesignation(); - getDesignation().add(newType); - return newType; - } - - /** - * Adds a given new value for designation (ValueSet.compose.include.concept.designation) - * - *

    - * Definition: - * Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - * @param theValue The designation to add (must not be null) - */ - public ComposeIncludeConcept addDesignation(CodeSystemConceptDesignation theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getDesignation().add(theValue); - return this; - } - - /** - * Gets the first repetition for designation (ValueSet.compose.include.concept.designation), - * creating it if it does not already exist. - * - *

    - * Definition: - * Additional representations for this concept when used in this value set - other languages, aliases, specialized purposes, used for particular purposes, etc - *

    - */ - public CodeSystemConceptDesignation getDesignationFirstRep() { - if (getDesignation().isEmpty()) { - return addDesignation(); - } - return getDesignation().get(0); - } - - - - } - - - /** - * Block class for child element: ValueSet.compose.include.filter (ValueSet.compose.include.filter) - * - *

    - * Definition: - * Select concepts by specify a matching criteria based on the properties (including relationships) defined by the system. If multiple filters are specified, they SHALL all be true. - *

    - */ - @Block() - public static class ComposeIncludeFilter - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="property", type=CodeDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.compose.include.filter.property", - formalDefinition="A code that identifies a property defined in the code system" - ) - private CodeDt myProperty; - - @Child(name="op", type=CodeDt.class, order=1, min=1, max=1) - @Description( - shortDefinition="ValueSet.compose.include.filter.op", - formalDefinition="The kind of operation to perform as a part of the filter criteria" - ) - private CodeDt myOp; - - @Child(name="value", type=CodeDt.class, order=2, min=1, max=1) - @Description( - shortDefinition="ValueSet.compose.include.filter.value", - formalDefinition="The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value" - ) - private CodeDt myValue; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myProperty, myOp, myValue); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myProperty, myOp, myValue); - } - - /** - * Gets the value(s) for property (ValueSet.compose.include.filter.property). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A code that identifies a property defined in the code system - *

    - */ - public CodeDt getPropertyElement() { - if (myProperty == null) { - myProperty = new CodeDt(); - } - return myProperty; - } - - - /** - * Gets the value(s) for property (ValueSet.compose.include.filter.property). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A code that identifies a property defined in the code system - *

    - */ - public String getProperty() { - return getPropertyElement().getValue(); - } - - /** - * Sets the value(s) for property (ValueSet.compose.include.filter.property) - * - *

    - * Definition: - * A code that identifies a property defined in the code system - *

    - */ - public ComposeIncludeFilter setProperty(CodeDt theValue) { - myProperty = theValue; - return this; - } - - - - /** - * Sets the value for property (ValueSet.compose.include.filter.property) - * - *

    - * Definition: - * A code that identifies a property defined in the code system - *

    - */ - public ComposeIncludeFilter setProperty( String theCode) { - myProperty = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for op (ValueSet.compose.include.filter.op). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The kind of operation to perform as a part of the filter criteria - *

    - */ - public CodeDt getOpElement() { - if (myOp == null) { - myOp = new CodeDt(); - } - return myOp; - } - - - /** - * Gets the value(s) for op (ValueSet.compose.include.filter.op). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The kind of operation to perform as a part of the filter criteria - *

    - */ - public String getOp() { - return getOpElement().getValue(); - } - - /** - * Sets the value(s) for op (ValueSet.compose.include.filter.op) - * - *

    - * Definition: - * The kind of operation to perform as a part of the filter criteria - *

    - */ - public ComposeIncludeFilter setOp(CodeDt theValue) { - myOp = theValue; - return this; - } - - - - /** - * Sets the value for op (ValueSet.compose.include.filter.op) - * - *

    - * Definition: - * The kind of operation to perform as a part of the filter criteria - *

    - */ - public ComposeIncludeFilter setOp( String theCode) { - myOp = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for value (ValueSet.compose.include.filter.value). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value - *

    - */ - public CodeDt getValueElement() { - if (myValue == null) { - myValue = new CodeDt(); - } - return myValue; - } - - - /** - * Gets the value(s) for value (ValueSet.compose.include.filter.value). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value - *

    - */ - public String getValue() { - return getValueElement().getValue(); - } - - /** - * Sets the value(s) for value (ValueSet.compose.include.filter.value) - * - *

    - * Definition: - * The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value - *

    - */ - public ComposeIncludeFilter setValue(CodeDt theValue) { - myValue = theValue; - return this; - } - - - - /** - * Sets the value for value (ValueSet.compose.include.filter.value) - * - *

    - * Definition: - * The match value may be either a code defined by the system, or a string value which is used a regex match on the literal string of the property value - *

    - */ - public ComposeIncludeFilter setValue( String theCode) { - myValue = new CodeDt(theCode); - return this; - } - - - - - } - - - - - /** - * Block class for child element: ValueSet.expansion (ValueSet.expansion) - * - *

    - * Definition: - * A value set can also be \"expanded\", where the value set is turned into a simple collection of enumerated codes. This element holds the expansion, if it has been performed - *

    - */ - @Block() - public static class Expansion - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="identifier", type=UriDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.expansion.identifier", - formalDefinition="An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so" - ) - private UriDt myIdentifier; - - @Child(name="timestamp", type=DateTimeDt.class, order=1, min=1, max=1) - @Description( - shortDefinition="ValueSet.expansion.timestamp", - formalDefinition="The time at which the expansion was produced by the expanding system." - ) - private DateTimeDt myTimestamp; - - @Child(name="total", type=IntegerDt.class, order=2, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.total", - formalDefinition="The total nober of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter" - ) - private IntegerDt myTotal; - - @Child(name="offset", type=IntegerDt.class, order=3, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.offset", - formalDefinition="If paging is being used, the offset at which this resource starts - e.g. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present" - ) - private IntegerDt myOffset; - - @Child(name="parameter", order=4, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.expansion.parameter", - formalDefinition="A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion" - ) - private java.util.List myParameter; - - @Child(name="contains", order=5, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.expansion.contains", - formalDefinition="The codes that are contained in the value set expansion" - ) - private java.util.List myContains; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myTimestamp, myTotal, myOffset, myParameter, myContains); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myIdentifier, myTimestamp, myTotal, myOffset, myParameter, myContains); - } - - /** - * Gets the value(s) for identifier (ValueSet.expansion.identifier). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so - *

    - */ - public UriDt getIdentifierElement() { - if (myIdentifier == null) { - myIdentifier = new UriDt(); - } - return myIdentifier; - } - - - /** - * Gets the value(s) for identifier (ValueSet.expansion.identifier). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so - *

    - */ - public String getIdentifier() { - return getIdentifierElement().getValue(); - } - - /** - * Sets the value(s) for identifier (ValueSet.expansion.identifier) - * - *

    - * Definition: - * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so - *

    - */ - public Expansion setIdentifier(UriDt theValue) { - myIdentifier = theValue; - return this; - } - - - - /** - * Sets the value for identifier (ValueSet.expansion.identifier) - * - *

    - * Definition: - * An identifier that uniquely identifies this expansion of the valueset. Systems may re-use the same identifier as long as the expansion and the definition remain the same, but are not required to do so - *

    - */ - public Expansion setIdentifier( String theUri) { - myIdentifier = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for timestamp (ValueSet.expansion.timestamp). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The time at which the expansion was produced by the expanding system. - *

    - */ - public DateTimeDt getTimestampElement() { - if (myTimestamp == null) { - myTimestamp = new DateTimeDt(); - } - return myTimestamp; - } - - - /** - * Gets the value(s) for timestamp (ValueSet.expansion.timestamp). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The time at which the expansion was produced by the expanding system. - *

    - */ - public Date getTimestamp() { - return getTimestampElement().getValue(); - } - - /** - * Sets the value(s) for timestamp (ValueSet.expansion.timestamp) - * - *

    - * Definition: - * The time at which the expansion was produced by the expanding system. - *

    - */ - public Expansion setTimestamp(DateTimeDt theValue) { - myTimestamp = theValue; - return this; - } - - - - /** - * Sets the value for timestamp (ValueSet.expansion.timestamp) - * - *

    - * Definition: - * The time at which the expansion was produced by the expanding system. - *

    - */ - public Expansion setTimestamp( Date theDate, TemporalPrecisionEnum thePrecision) { - myTimestamp = new DateTimeDt(theDate, thePrecision); - return this; - } - - /** - * Sets the value for timestamp (ValueSet.expansion.timestamp) - * - *

    - * Definition: - * The time at which the expansion was produced by the expanding system. - *

    - */ - public Expansion setTimestampWithSecondsPrecision( Date theDate) { - myTimestamp = new DateTimeDt(theDate); - return this; - } - - - /** - * Gets the value(s) for total (ValueSet.expansion.total). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The total nober of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter - *

    - */ - public IntegerDt getTotalElement() { - if (myTotal == null) { - myTotal = new IntegerDt(); - } - return myTotal; - } - - - /** - * Gets the value(s) for total (ValueSet.expansion.total). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The total nober of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter - *

    - */ - public Integer getTotal() { - return getTotalElement().getValue(); - } - - /** - * Sets the value(s) for total (ValueSet.expansion.total) - * - *

    - * Definition: - * The total nober of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter - *

    - */ - public Expansion setTotal(IntegerDt theValue) { - myTotal = theValue; - return this; - } - - - - /** - * Sets the value for total (ValueSet.expansion.total) - * - *

    - * Definition: - * The total nober of concepts in the expansion. If the number of concept nodes in this resource is less than the stated number, then the server can return more using the offset parameter - *

    - */ - public Expansion setTotal( int theInteger) { - myTotal = new IntegerDt(theInteger); - return this; - } - - - /** - * Gets the value(s) for offset (ValueSet.expansion.offset). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If paging is being used, the offset at which this resource starts - e.g. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present - *

    - */ - public IntegerDt getOffsetElement() { - if (myOffset == null) { - myOffset = new IntegerDt(); - } - return myOffset; - } - - - /** - * Gets the value(s) for offset (ValueSet.expansion.offset). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If paging is being used, the offset at which this resource starts - e.g. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present - *

    - */ - public Integer getOffset() { - return getOffsetElement().getValue(); - } - - /** - * Sets the value(s) for offset (ValueSet.expansion.offset) - * - *

    - * Definition: - * If paging is being used, the offset at which this resource starts - e.g. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present - *

    - */ - public Expansion setOffset(IntegerDt theValue) { - myOffset = theValue; - return this; - } - - - - /** - * Sets the value for offset (ValueSet.expansion.offset) - * - *

    - * Definition: - * If paging is being used, the offset at which this resource starts - e.g. this resource is a partial view into the expansion. If paging is not being used, this element SHALL not be present - *

    - */ - public Expansion setOffset( int theInteger) { - myOffset = new IntegerDt(theInteger); - return this; - } - - - /** - * Gets the value(s) for parameter (ValueSet.expansion.parameter). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion - *

    - */ - public java.util.List getParameter() { - if (myParameter == null) { - myParameter = new java.util.ArrayList(); - } - return myParameter; - } - - /** - * Sets the value(s) for parameter (ValueSet.expansion.parameter) - * - *

    - * Definition: - * A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion - *

    - */ - public Expansion setParameter(java.util.List theValue) { - myParameter = theValue; - return this; - } - - - - /** - * Adds and returns a new value for parameter (ValueSet.expansion.parameter) - * - *

    - * Definition: - * A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion - *

    - */ - public ExpansionParameter addParameter() { - ExpansionParameter newType = new ExpansionParameter(); - getParameter().add(newType); - return newType; - } - - /** - * Adds a given new value for parameter (ValueSet.expansion.parameter) - * - *

    - * Definition: - * A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion - *

    - * @param theValue The parameter to add (must not be null) - */ - public Expansion addParameter(ExpansionParameter theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getParameter().add(theValue); - return this; - } - - /** - * Gets the first repetition for parameter (ValueSet.expansion.parameter), - * creating it if it does not already exist. - * - *

    - * Definition: - * A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion - *

    - */ - public ExpansionParameter getParameterFirstRep() { - if (getParameter().isEmpty()) { - return addParameter(); - } - return getParameter().get(0); - } - - /** - * Gets the value(s) for contains (ValueSet.expansion.contains). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The codes that are contained in the value set expansion - *

    - */ - public java.util.List getContains() { - if (myContains == null) { - myContains = new java.util.ArrayList(); - } - return myContains; - } - - /** - * Sets the value(s) for contains (ValueSet.expansion.contains) - * - *

    - * Definition: - * The codes that are contained in the value set expansion - *

    - */ - public Expansion setContains(java.util.List theValue) { - myContains = theValue; - return this; - } - - - - /** - * Adds and returns a new value for contains (ValueSet.expansion.contains) - * - *

    - * Definition: - * The codes that are contained in the value set expansion - *

    - */ - public ExpansionContains addContains() { - ExpansionContains newType = new ExpansionContains(); - getContains().add(newType); - return newType; - } - - /** - * Adds a given new value for contains (ValueSet.expansion.contains) - * - *

    - * Definition: - * The codes that are contained in the value set expansion - *

    - * @param theValue The contains to add (must not be null) - */ - public Expansion addContains(ExpansionContains theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getContains().add(theValue); - return this; - } - - /** - * Gets the first repetition for contains (ValueSet.expansion.contains), - * creating it if it does not already exist. - * - *

    - * Definition: - * The codes that are contained in the value set expansion - *

    - */ - public ExpansionContains getContainsFirstRep() { - if (getContains().isEmpty()) { - return addContains(); - } - return getContains().get(0); - } - - - - } - - /** - * Block class for child element: ValueSet.expansion.parameter (ValueSet.expansion.parameter) - * - *

    - * Definition: - * A Parameter that controlled the expansion process. These parameters may be used by users of expanded value sets to check whether the expansion is suitable for a particular purpose, or to pick the correct expansion - *

    - */ - @Block() - public static class ExpansionParameter - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="name", type=StringDt.class, order=0, min=1, max=1) - @Description( - shortDefinition="ValueSet.expansion.parameter.name", - formalDefinition="The name of the parameter" - ) - private StringDt myName; - - @Child(name="value", order=1, min=0, max=1, type={ - StringDt.class, BooleanDt.class, IntegerDt.class, DecimalDt.class, UriDt.class, CodeDt.class }) - @Description( - shortDefinition="ValueSet.expansion.parameter.value[x]", - formalDefinition="The value of the parameter" - ) - private IDatatype myValue; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myValue); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myName, myValue); - } - - /** - * Gets the value(s) for name (ValueSet.expansion.parameter.name). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of the parameter - *

    - */ - public StringDt getNameElement() { - if (myName == null) { - myName = new StringDt(); - } - return myName; - } - - - /** - * Gets the value(s) for name (ValueSet.expansion.parameter.name). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The name of the parameter - *

    - */ - public String getName() { - return getNameElement().getValue(); - } - - /** - * Sets the value(s) for name (ValueSet.expansion.parameter.name) - * - *

    - * Definition: - * The name of the parameter - *

    - */ - public ExpansionParameter setName(StringDt theValue) { - myName = theValue; - return this; - } - - - - /** - * Sets the value for name (ValueSet.expansion.parameter.name) - * - *

    - * Definition: - * The name of the parameter - *

    - */ - public ExpansionParameter setName( String theString) { - myName = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for value[x] (ValueSet.expansion.parameter.value[x]). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The value of the parameter - *

    - */ - public IDatatype getValue() { - return myValue; - } - - /** - * Sets the value(s) for value[x] (ValueSet.expansion.parameter.value[x]) - * - *

    - * Definition: - * The value of the parameter - *

    - */ - public ExpansionParameter setValue(IDatatype theValue) { - myValue = theValue; - return this; - } - - - - - - - } - - - /** - * Block class for child element: ValueSet.expansion.contains (ValueSet.expansion.contains) - * - *

    - * Definition: - * The codes that are contained in the value set expansion - *

    - */ - @Block() - public static class ExpansionContains - extends BaseIdentifiableElement implements IResourceBlock { - - @Child(name="system", type=UriDt.class, order=0, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.contains.system", - formalDefinition="An absolute URI which is the code system in which the code for this item in the expansion is defined" - ) - private UriDt mySystem; - - @Child(name="abstract", type=BooleanDt.class, order=1, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.contains.abstract", - formalDefinition="If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value" - ) - private BooleanDt myAbstract; - - @Child(name="version", type=StringDt.class, order=2, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.contains.version", - formalDefinition="The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence" - ) - private StringDt myVersion; - - @Child(name="code", type=CodeDt.class, order=3, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.contains.code", - formalDefinition="The code for this item in the expansion heirarchy. If this code is missing the entry in the heirarchy is a place holder (abstract) and doesn't represent a valid code in the value set" - ) - private CodeDt myCode; - - @Child(name="display", type=StringDt.class, order=4, min=0, max=1) - @Description( - shortDefinition="ValueSet.expansion.contains.display", - formalDefinition="The recommended display for this item in the expansion" - ) - private StringDt myDisplay; - - @Child(name="contains", type=ExpansionContains.class, order=5, min=0, max=Child.MAX_UNLIMITED) - @Description( - shortDefinition="ValueSet.expansion.contains.contains", - formalDefinition="Other codes and entries contained under this entry in the heirarchy" - ) - private java.util.List myContains; - - - @Override - public boolean isEmpty() { - return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myAbstract, myVersion, myCode, myDisplay, myContains); - } - - @Override - public List getAllPopulatedChildElementsOfType(Class theType) { - return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySystem, myAbstract, myVersion, myCode, myDisplay, myContains); - } - - /** - * Gets the value(s) for system (ValueSet.expansion.contains.system). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI which is the code system in which the code for this item in the expansion is defined - *

    - */ - public UriDt getSystemElement() { - if (mySystem == null) { - mySystem = new UriDt(); - } - return mySystem; - } - - - /** - * Gets the value(s) for system (ValueSet.expansion.contains.system). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * An absolute URI which is the code system in which the code for this item in the expansion is defined - *

    - */ - public String getSystem() { - return getSystemElement().getValue(); - } - - /** - * Sets the value(s) for system (ValueSet.expansion.contains.system) - * - *

    - * Definition: - * An absolute URI which is the code system in which the code for this item in the expansion is defined - *

    - */ - public ExpansionContains setSystem(UriDt theValue) { - mySystem = theValue; - return this; - } - - - - /** - * Sets the value for system (ValueSet.expansion.contains.system) - * - *

    - * Definition: - * An absolute URI which is the code system in which the code for this item in the expansion is defined - *

    - */ - public ExpansionContains setSystem( String theUri) { - mySystem = new UriDt(theUri); - return this; - } - - - /** - * Gets the value(s) for abstract (ValueSet.expansion.contains.abstract). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value - *

    - */ - public BooleanDt getAbstractElement() { - if (myAbstract == null) { - myAbstract = new BooleanDt(); - } - return myAbstract; - } - - - /** - * Gets the value(s) for abstract (ValueSet.expansion.contains.abstract). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value - *

    - */ - public Boolean getAbstract() { - return getAbstractElement().getValue(); - } - - /** - * Sets the value(s) for abstract (ValueSet.expansion.contains.abstract) - * - *

    - * Definition: - * If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value - *

    - */ - public ExpansionContains setAbstract(BooleanDt theValue) { - myAbstract = theValue; - return this; - } - - - - /** - * Sets the value for abstract (ValueSet.expansion.contains.abstract) - * - *

    - * Definition: - * If true, this entry is included in the expansion for navigational purposes, and the user cannot select the code directly as a proper value - *

    - */ - public ExpansionContains setAbstract( boolean theBoolean) { - myAbstract = new BooleanDt(theBoolean); - return this; - } - - - /** - * Gets the value(s) for version (ValueSet.expansion.contains.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence - *

    - */ - public StringDt getVersionElement() { - if (myVersion == null) { - myVersion = new StringDt(); - } - return myVersion; - } - - - /** - * Gets the value(s) for version (ValueSet.expansion.contains.version). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence - *

    - */ - public String getVersion() { - return getVersionElement().getValue(); - } - - /** - * Sets the value(s) for version (ValueSet.expansion.contains.version) - * - *

    - * Definition: - * The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence - *

    - */ - public ExpansionContains setVersion(StringDt theValue) { - myVersion = theValue; - return this; - } - - - - /** - * Sets the value for version (ValueSet.expansion.contains.version) - * - *

    - * Definition: - * The version of this code system that defined this code and/or display. This should only be used with code systems that do not enforce concept permanence - *

    - */ - public ExpansionContains setVersion( String theString) { - myVersion = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for code (ValueSet.expansion.contains.code). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The code for this item in the expansion heirarchy. If this code is missing the entry in the heirarchy is a place holder (abstract) and doesn't represent a valid code in the value set - *

    - */ - public CodeDt getCodeElement() { - if (myCode == null) { - myCode = new CodeDt(); - } - return myCode; - } - - - /** - * Gets the value(s) for code (ValueSet.expansion.contains.code). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The code for this item in the expansion heirarchy. If this code is missing the entry in the heirarchy is a place holder (abstract) and doesn't represent a valid code in the value set - *

    - */ - public String getCode() { - return getCodeElement().getValue(); - } - - /** - * Sets the value(s) for code (ValueSet.expansion.contains.code) - * - *

    - * Definition: - * The code for this item in the expansion heirarchy. If this code is missing the entry in the heirarchy is a place holder (abstract) and doesn't represent a valid code in the value set - *

    - */ - public ExpansionContains setCode(CodeDt theValue) { - myCode = theValue; - return this; - } - - - - /** - * Sets the value for code (ValueSet.expansion.contains.code) - * - *

    - * Definition: - * The code for this item in the expansion heirarchy. If this code is missing the entry in the heirarchy is a place holder (abstract) and doesn't represent a valid code in the value set - *

    - */ - public ExpansionContains setCode( String theCode) { - myCode = new CodeDt(theCode); - return this; - } - - - /** - * Gets the value(s) for display (ValueSet.expansion.contains.display). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The recommended display for this item in the expansion - *

    - */ - public StringDt getDisplayElement() { - if (myDisplay == null) { - myDisplay = new StringDt(); - } - return myDisplay; - } - - - /** - * Gets the value(s) for display (ValueSet.expansion.contains.display). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * The recommended display for this item in the expansion - *

    - */ - public String getDisplay() { - return getDisplayElement().getValue(); - } - - /** - * Sets the value(s) for display (ValueSet.expansion.contains.display) - * - *

    - * Definition: - * The recommended display for this item in the expansion - *

    - */ - public ExpansionContains setDisplay(StringDt theValue) { - myDisplay = theValue; - return this; - } - - - - /** - * Sets the value for display (ValueSet.expansion.contains.display) - * - *

    - * Definition: - * The recommended display for this item in the expansion - *

    - */ - public ExpansionContains setDisplay( String theString) { - myDisplay = new StringDt(theString); - return this; - } - - - /** - * Gets the value(s) for contains (ValueSet.expansion.contains.contains). - * creating it if it does - * not exist. Will not return null. - * - *

    - * Definition: - * Other codes and entries contained under this entry in the heirarchy - *

    - */ - public java.util.List getContains() { - if (myContains == null) { - myContains = new java.util.ArrayList(); - } - return myContains; - } - - /** - * Sets the value(s) for contains (ValueSet.expansion.contains.contains) - * - *

    - * Definition: - * Other codes and entries contained under this entry in the heirarchy - *

    - */ - public ExpansionContains setContains(java.util.List theValue) { - myContains = theValue; - return this; - } - - - - /** - * Adds and returns a new value for contains (ValueSet.expansion.contains.contains) - * - *

    - * Definition: - * Other codes and entries contained under this entry in the heirarchy - *

    - */ - public ExpansionContains addContains() { - ExpansionContains newType = new ExpansionContains(); - getContains().add(newType); - return newType; - } - - /** - * Adds a given new value for contains (ValueSet.expansion.contains.contains) - * - *

    - * Definition: - * Other codes and entries contained under this entry in the heirarchy - *

    - * @param theValue The contains to add (must not be null) - */ - public ExpansionContains addContains(ExpansionContains theValue) { - if (theValue == null) { - throw new NullPointerException("theValue must not be null"); - } - getContains().add(theValue); - return this; - } - - /** - * Gets the first repetition for contains (ValueSet.expansion.contains.contains), - * creating it if it does not already exist. - * - *

    - * Definition: - * Other codes and entries contained under this entry in the heirarchy - *

    - */ - public ExpansionContains getContainsFirstRep() { - if (getContains().isEmpty()) { - return addContains(); - } - return getContains().get(0); - } - - - - } - - - - - - @Override - public String getResourceName() { - return "ValueSet"; - } - - public ca.uhn.fhir.context.FhirVersionEnum getStructureFhirVersionEnum() { - return ca.uhn.fhir.context.FhirVersionEnum.DSTU2; - } - - -} diff --git a/hapi-tinder-plugin/src/main/resources/vm/templates_dstu.vm b/hapi-tinder-plugin/src/main/resources/vm/templates_dstu.vm index 0749f83b598..07aabdd053c 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/templates_dstu.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/templates_dstu.vm @@ -51,6 +51,7 @@ } #foreach ( $child in $childElements ) +#if (${child.methodName} != 'Meta') /** * Gets the value(s) for ${child.elementName} ($esc.html(${child.shortName})). * creating it if it does @@ -73,7 +74,7 @@ #end return ${child.variableName}; } - +#end /** * Gets the value(s) for ${child.elementName} ($esc.html(${child.shortName})). diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 7048c0351e2..34ffbd98ee6 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -8,15 +8,15 @@ - Bump the version of a few dependencies to the - latest versions (dependent HAPI modules listed in brackets): - -
  • Hibernate (JPA, Web Tester): 5.0.7 -> 5.1.0
  • -
  • Spring (JPA, Web Tester): 4.2.4 -> 4.2.5
  • + Bump the version of a few dependencies to the + latest versions (dependent HAPI modules listed in brackets): + +
  • Hibernate (JPA, Web Tester): 5.0.7 -> 5.1.0
  • +
  • Spring (JPA, Web Tester): 4.2.4 -> 4.2.5
  • SLF4j (All): 1.7.14 -> 1.7.16
  • - - ]]> + + ]]>
    Support comments when parsing and encoding both JSON and XML. Comments are retrieved @@ -119,7 +119,7 @@ IServerInterceptor#incomingRequestPreHandled()
    is called for a @Validate method, the resource was not populated in the - ActionRequestDetails argument. Thanks to Ravi Kuchi for reporting! + ActionRequestDetails argument. Thanks to Ravi Kuchi for reporting! ]]> @@ -261,21 +261,59 @@ header containing "application/xml" as some browsers do. + + DSTU2 resources now have a + getMeta()
    ]]> method which returns a + modifiable view of the resource metadata for convenience. This + matches the equivalent method in the DSTU3 structures. + + + Add a new method to FhirContext called + setDefaultTypeForProfile
    + ]]> + which can be used to specify that when recources are received which declare + support for specific profiles, a specific custom structures should be used + instead of the default. For example, if you have created a custom Observation + class for a specific profile, you could use this method to cause your custom + type to be used by the parser for resources in a search bundle you receive. +
    + See the documentation page on + Profiles and Extensions + for more information. + ]]> + + + Parsing/Encoding a custom resource type which extends a + base type sometimes caused the FhirContext to treat all future + parses of the same resource as using the custom type even when + this was not wanted. +
    ]]> + Custom structures may now be explicitly declared by profile + using the + setDefaultTypeForProfile
    + ]]> + method. +
    ]]> + This issue was discovered and fixed as a part of the implementation of issue #315. + - Bump the version of a few dependencies to the - latest versions (dependent HAPI modules listed in brackets): - -
  • Hibernate (JPA, Web Tester): 5.0.3 -> 5.0.7
  • -
  • Springframework (JPA, Web Tester): 4.2.2 -> 4.2.4
  • + Bump the version of a few dependencies to the + latest versions (dependent HAPI modules listed in brackets): + +
  • Hibernate (JPA, Web Tester): 5.0.3 -> 5.0.7
  • +
  • Springframework (JPA, Web Tester): 4.2.2 -> 4.2.4
  • Phloc-Commons (Schematron Validator): 4.3.6 -> 4.4.4
  • Apache httpclient (Client): 4.4 -> 4.5.1
  • Apache httpcore (Client): 4.4 -> 4.4.4
  • SLF4j (All): 1.7.13 -> 1.7.14
  • - - ]]> + + ]]>
    Remove a dependency on a Java 1.7 class @@ -430,20 +468,20 @@
    - Bump the version of a few dependencies to the - latest versions (dependent HAPI modules listed in brackets): - -
  • Commons-lang3 (Core): 3.3.2 -> 3.4
  • -
  • Logback (Core): 1.1.2 -> 1.1.3
  • -
  • SLF4j (Core): 1.7.102 -> 1.7.12
  • -
  • Springframework (JPA, Web Tester): 4.1.5 -> 4.2.2
  • -
  • Hibernate (JPA, Web Tester): 4.2.17 -> 5."
  • -
  • Hibernate Validator (JPA, Web Tester): 5.2.1 -> 5.2.2
  • -
  • Derby (JPA, CLI, Public Server): 10.11.1.1 -> 10.12.1.1
  • -
  • Jetty (JPA, CLI, Public Server): 9.2.6.v20141205 -> 9.3.4.v20151007
  • - - ]]> + Bump the version of a few dependencies to the + latest versions (dependent HAPI modules listed in brackets): + +
  • Commons-lang3 (Core): 3.3.2 -> 3.4
  • +
  • Logback (Core): 1.1.2 -> 1.1.3
  • +
  • SLF4j (Core): 1.7.102 -> 1.7.12
  • +
  • Springframework (JPA, Web Tester): 4.1.5 -> 4.2.2
  • +
  • Hibernate (JPA, Web Tester): 4.2.17 -> 5."
  • +
  • Hibernate Validator (JPA, Web Tester): 5.2.1 -> 5.2.2
  • +
  • Derby (JPA, CLI, Public Server): 10.11.1.1 -> 10.12.1.1
  • +
  • Jetty (JPA, CLI, Public Server): 9.2.6.v20141205 -> 9.3.4.v20151007
  • + + ]]>
    JPA and Tester Overlay now use Spring Java config files instead @@ -500,7 +538,7 @@ In server, if a client request is received and it has an Accept header indicating - that it supports both XML and JSON with equal weight, the server's default is used instead of the first entry in the list. + that it supports both XML and JSON with equal weight, the server's default is used instead of the first entry in the list. JPA server now supports searching with sort by token, quantity, @@ -780,7 +818,7 @@ Resource references using resource instance objects instead of resource IDs - will correctly qualify the IDs with the resource type if they aren't already qualified + will correctly qualify the IDs with the resource type if they aren't already qualified Testpage Overlay project now properly allows a custom client @@ -1314,7 +1352,7 @@ RestfulClientConfig. Thanks to Grahame Grieve for the suggestion! - JPA module now supports deleting resource via transaction + JPA module now supports deleting resource via transaction DateClientParam#second() incorrectly used DAY precision instead @@ -1359,15 +1397,15 @@ Add support for FHIR "extended operations" as defined in the FHIR DSTU2 specification, for the Generic Client, Annotation Client, and - Server. + Server. Observation.applies[x] and other similar search fields with multiple allowable - value types were not being correctly indexed in the JPA server. + value types were not being correctly indexed in the JPA server. DateClientParam.before() incorrectly placed "<=" instead of - "<" in the request URL. Thanks to Ryan for reporting! + "<" in the request URL. Thanks to Ryan for reporting! Server now only automatically adds _include resources which are provided @@ -1396,7 +1434,7 @@ own JAR, in order to allow support for DEV resources, and DSTU2 resources when thast version is finalized. See the DSTU2 page]]> - for more information. + for more information. Remove unnecessary IOException from narrative generator API. Thanks to - Petro Mykhailysyn for the pull request! + Petro Mykhailysyn for the pull request! Introduced a new @@ -1709,7 +1747,7 @@ Add a - Vagrant]]> + Vagrant]]> based environment (basically a fully built, self contained development environment) for trying out the HAPI server modules. Thanks to Preston Lee for the pull request, and for offering to maintain this! @@ -1726,19 +1764,19 @@ Add server interceptor framework, and new interceptor for logging incoming - requests. + requests. Add server validation framework for validating resources against the FHIR schemas and schematrons Tester UI created double _format and _pretty param entries in searches. Thanks to Gered King of University - Health Network for reporting! + Health Network for reporting! Create method was incorrectly returning an HTTP 204 on sucessful completion, but @@ -1939,7 +1977,7 @@ space (e.g. a WAR file with a space in the name) failed to work correctly. Thanks to David Hay of Orion for reporting this! - +
    BREAKING CHANGE:]]>: IdDt has been modified so that it diff --git a/src/site/xdoc/doc_extensions.xml b/src/site/xdoc/doc_extensions.xml index 9776fb7a771..273434c2f78 100644 --- a/src/site/xdoc/doc_extensions.xml +++ b/src/site/xdoc/doc_extensions.xml @@ -3,13 +3,20 @@ Profiles and Extensions - James Agnew + James Agnew
    +

    + Note on FHIR Versions: Because of the differences in the way the structures + work between DSTU2 and DSTU3, we have provided two versions of many of the + examples on this page. See the download page + for more information on FHIR versions. +

    +

    Extensions are a key part of the FHIR specification, providing a standardized way of placing additional data in a resource. @@ -21,19 +28,42 @@ Undeclared extensions can be added to any of the built in FHIR resource types that come with HAPI-FHIR.

    +

    + DSTU2 +

    - + + + +

    + DSTU3 +

    + + +

    Undeclared extensions can also be added to datatypes (composite or primitive).

    + +

    + DSTU2 +

    - + +

    + DSTU3 +

    + + + + +

    @@ -41,24 +71,48 @@ of a datatype. This is done by adding a child undeclared extension to the parent extension.

    + +

    + DSTU2 +

    - + +

    + DSTU3 +

    + + + + +

    HAPI provides a few ways of accessing extension values in resources - which are receieved from other sources (i.e. downloaded by a client). + which are received from other sources (i.e. downloaded by a client). +

    + +

    + DSTU2

    - + +

    + DSTU3 +

    + + + + +
    @@ -119,85 +173,44 @@ - +

    - Note in the example above the use of the @Description - annotation on the extension fields. This documentation is important, - as the FHIR Server will automatically add it to the generated Profile - resources which are exported by the server. + If you are using a client and wish to use a specific custom structure, + you may simply use the custom structure as you would a build in + HAPI type.

    + + + +

    - These bits of documentation will then be re-added to any automatically - generated clients built using Tinder - against your server. + Sometimes you may not know in advance exactly which + type you will be receiving. For example, there are Patient resources + which conform to several different profiles on a server and you + aren't sure which profile you will get back for a specific read, + you can declare the "primary" type for a given profile.

    + + + + + +
    + +

    - The following is a snippet from the generated Profile resource - which is automatically created by a HAPI RESTful server using - your new type. (Don't worry if this part doens't make sense to you - yet, this is an advanced feature) + If you are using a client and wish to use a specific custom structure, + you may simply use the custom structure as you would a build in + HAPI type.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -]]> - + + + + +