diff --git a/TODO.txt b/TODO.txt index f0746b792d9..7584c61d846 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,4 +4,5 @@ * Fix XML encoder to not encode empty elements * Add SimpleSetters for all primitive datatypes * Implement and add Simple Getters in a similar way to simple setters + * Add support for modifierExtensions * \ No newline at end of file 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 9ae79a32324..b0086be93c7 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 @@ -10,6 +10,7 @@ import ca.uhn.fhir.model.api.IElement; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.parser.IParser; import ca.uhn.fhir.parser.XmlParser; +import ca.uhn.fhir.rest.client.IRestfulClientFactory; import ca.uhn.fhir.rest.client.RestfulClientFactory; public class FhirContext { @@ -37,10 +38,6 @@ public class FhirContext { return myClassToElementDefinition; } - public Map getNameToResourceDefinition() { - return myNameToElementDefinition; - } - public RuntimeResourceDefinition getResourceDefinition(Class theResourceType) { return (RuntimeResourceDefinition) myClassToElementDefinition.get(theResourceType); } @@ -53,7 +50,7 @@ public class FhirContext { return myRuntimeChildUndeclaredExtensionDefinition; } - public RestfulClientFactory newClientFactory() { + public IRestfulClientFactory newRestfulClientFactory() { return new RestfulClientFactory(this); } @@ -67,4 +64,8 @@ public class FhirContext { return retVal; } + public BaseRuntimeElementDefinition getResourceDefinition(String theResourceName) { + return myNameToElementDefinition.get(theResourceName); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseBundle.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseBundle.java index 83ca7b0d50c..63b275d6c1d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseBundle.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseBundle.java @@ -1,8 +1,9 @@ package ca.uhn.fhir.model.api; import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.util.ElementUtil; -public class BaseBundle { +public class BaseBundle implements IElement { private StringDt myAuthorName; private StringDt myAuthorUri; @@ -21,4 +22,11 @@ public class BaseBundle { return myAuthorUri; } + @Override + public boolean isEmpty() { + return ElementUtil.isEmpty(myAuthorName, myAuthorUri); + } + + + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseElement.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseElement.java index b7f944f8f85..0b17337ce29 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseElement.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseElement.java @@ -15,4 +15,19 @@ public abstract class BaseElement implements IElement, ISupportsUndeclaredExtens return myUndeclaredExtensions; } + /** + * 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()}. + */ + protected boolean isBaseEmpty() { + if (myUndeclaredExtensions != null) { + for (UndeclaredExtension next : myUndeclaredExtensions) { + if (!next.isEmpty()) { + return false; + } + } + } + return true; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BasePrimitive.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BasePrimitive.java new file mode 100644 index 00000000000..cc5409277ad --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BasePrimitive.java @@ -0,0 +1,11 @@ +package ca.uhn.fhir.model.api; + + +public abstract class BasePrimitive extends BaseElement implements IPrimitiveDatatype { + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && getValue() == null; + } + +} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResource.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResource.java index 4a5ff1628e5..1d7f8ed54c3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResource.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BaseResource.java @@ -1,24 +1,25 @@ package ca.uhn.fhir.model.api; import ca.uhn.fhir.model.api.annotation.Child; +import ca.uhn.fhir.model.dstu.composite.NarrativeDt; import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.XhtmlDt; +import ca.uhn.fhir.util.ElementUtil; -public class BaseResource extends BaseElement implements IResource { +public abstract class BaseResource extends BaseElement implements IResource { @Child(name="language", order=0, min=0, max=Child.MAX_UNLIMITED) private CodeDt myLanguage; @Child(name="text", order=1, min=0, max=1) - private XhtmlDt myText; + private NarrativeDt myText; public CodeDt getLanguage() { return myLanguage; } - public XhtmlDt getText() { + public NarrativeDt getText() { if (myText == null) { - myText = new XhtmlDt(); + myText = new NarrativeDt(); } return myText; } @@ -27,8 +28,18 @@ public class BaseResource extends BaseElement implements IResource { myLanguage = theLanguage; } - public void setText(XhtmlDt theText) { + public void setText(NarrativeDt theText) { myText = theText; } + /** + * 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); + } + + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java index c1ac1241b45..3b5c67c9aed 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/Bundle.java @@ -6,9 +6,15 @@ import java.util.List; import ca.uhn.fhir.model.primitive.InstantDt; import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.StringDt; +import ca.uhn.fhir.util.ElementUtil; public class Bundle extends BaseBundle implements IElement { - + + //@formatter:off + /* **************************************************** + * NB: add any new fields to the isEmpty() method!!! + *****************************************************/ + //@formatter:on private List myEntries; private StringDt myId; private StringDt myLinkBase; @@ -22,6 +28,15 @@ public class Bundle extends BaseBundle implements IElement { private IntegerDt myTotalResults; private InstantDt myUpdated; + @Override + public boolean isEmpty() { + //@formatter:off + return super.isEmpty() && + ElementUtil.isEmpty(myId, myLinkBase, myLinkFirst, myLinkLast, myLinkNext, myLinkPrevious, myLinkSelf, myPublished, myTitle, myTotalResults) && + ElementUtil.isEmpty(myEntries); + //@formatter:on + } + /** * Adds and returns a new bundle entry */ diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleCategory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleCategory.java index 1a1b3c03008..6c719b298b8 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleCategory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleCategory.java @@ -1,6 +1,8 @@ package ca.uhn.fhir.model.api; -public class BundleCategory { +import org.apache.commons.lang3.StringUtils; + +public class BundleCategory implements IElement { private String myLabel; private String myScheme; @@ -30,4 +32,9 @@ public class BundleCategory { myTerm = theTerm; } + @Override + public boolean isEmpty() { + return StringUtils.isBlank(myLabel) && StringUtils.isBlank(myScheme) && StringUtils.isBlank(myTerm); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleEntry.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleEntry.java index 31c0c59f2ed..6f932a72acf 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleEntry.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/BundleEntry.java @@ -4,10 +4,18 @@ import java.util.ArrayList; import java.util.List; import ca.uhn.fhir.model.primitive.InstantDt; +import ca.uhn.fhir.model.primitive.IntegerDt; import ca.uhn.fhir.model.primitive.StringDt; import ca.uhn.fhir.model.primitive.XhtmlDt; +import ca.uhn.fhir.util.ElementUtil; public class BundleEntry extends BaseBundle { + + //@formatter:off + /* **************************************************** + * NB: add any new fields to the isEmpty() method!!! + *****************************************************/ + //@formatter:on private StringDt myId; private StringDt myLinkSelf; private InstantDt myPublished; @@ -17,6 +25,15 @@ public class BundleEntry extends BaseBundle { private XhtmlDt mySummary; private List myCategories; + @Override + public boolean isEmpty() { + //@formatter:off + return super.isEmpty() && + ElementUtil.isEmpty(myId, myLinkSelf, myPublished, myResource, myTitle, myUpdated, mySummary) && + ElementUtil.isEmpty(myCategories); + //@formatter:on + } + public StringDt getId() { if (myId == null) { myId = new StringDt(); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IElement.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IElement.java index 4a5e09c0107..a0d341bc49b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IElement.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/IElement.java @@ -2,4 +2,6 @@ package ca.uhn.fhir.model.api; public interface IElement { + boolean isEmpty(); + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceReference.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceReference.java index 667986196cf..523481210d4 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceReference.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/ResourceReference.java @@ -24,8 +24,9 @@ public class ResourceReference implements IDatatype { myReference = theReference; } - public boolean hasContent() { - return StringUtils.isNotBlank(myDisplay) || StringUtils.isNotBlank(myReference); + @Override + public boolean isEmpty() { + return StringUtils.isBlank(myDisplay) && StringUtils.isBlank(myReference); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/UndeclaredExtension.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/UndeclaredExtension.java index 1645474d8cf..a880f3002cc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/UndeclaredExtension.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/UndeclaredExtension.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.model.api; + public class UndeclaredExtension extends BaseElement { private String myUrl; @@ -29,4 +30,9 @@ public class UndeclaredExtension extends BaseElement { myValue = theValue; } + @Override + public boolean isEmpty() { + return myValue == null || myValue.isEmpty(); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java index 32093ccfee5..605d2231f1f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/api/annotation/Child.java @@ -6,7 +6,6 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import ca.uhn.fhir.model.api.IElement; -import ca.uhn.fhir.model.api.IValueSetEnumBinder; @Retention(RetentionPolicy.RUNTIME) @Target(value= {ElementType.FIELD}) @@ -43,6 +42,11 @@ public @interface Child { private NoDatatype() { // non instantiable } + + @Override + public boolean isEmpty() { + return true; + } } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AddressDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AddressDt.java index f5526ee2fba..212f50082ad 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AddressDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AddressDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Address") -public class AddressDt extends BaseElement implements ICompositeDatatype { +public class AddressDt extends BaseElement implements ICompositeDatatype { + @Child(name="use", type=CodeDt.class, order=0, min=0, max=1) private BoundCodeDt myUse; @@ -64,6 +65,12 @@ public class AddressDt extends BaseElement implements ICompositeDatatype { @Child(name="period", type=PeriodDt.class, order=7, min=0, max=1) private PeriodDt myPeriod; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myUse, myText, myLine, myCity, myState, myZip, myCountry, myPeriod); + } + /** * Gets the value(s) for use (home | work | temp | old - purpose of this address). * creating it if it does @@ -93,6 +100,7 @@ public class AddressDt extends BaseElement implements ICompositeDatatype { myUse = theValue; } + /** * Sets the value(s) for use (home | work | temp | old - purpose of this address) * @@ -135,8 +143,9 @@ public class AddressDt extends BaseElement implements ICompositeDatatype { myText = theValue; } + /** - * Sets the value(s) for text (Text representation of the address) + * Sets the value for text (Text representation of the address) * *

* Definition: @@ -146,6 +155,7 @@ public class AddressDt extends BaseElement implements ICompositeDatatype { public void setText( String theString) { myText = new StringDt(theString); } + /** * Gets the value(s) for line (Street name, number, direction & P.O. Box etc ). @@ -178,8 +188,23 @@ P.O. Box number, delivery hints, and similar address information myLine = theValue; } + /** + * Adds and returns a new value for line (Street name, number, direction & P.O. Box etc ) + * + *

+ * Definition: + * This component contains the house number, apartment number, street name, street direction, +P.O. Box number, delivery hints, and similar address information + *

+ */ + public StringDt addLine() { + StringDt newType = new StringDt(); + getLine().add(newType); + return newType; + } + /** - * Sets the value(s) for line (Street name, number, direction & P.O. Box etc ) + * Adds a new value for line (Street name, number, direction & P.O. Box etc ) * *

* Definition: @@ -193,6 +218,7 @@ P.O. Box number, delivery hints, and similar address information } myLine.add(new StringDt(theString)); } + /** * Gets the value(s) for city (Name of city, town etc.). @@ -223,8 +249,9 @@ P.O. Box number, delivery hints, and similar address information myCity = theValue; } + /** - * Sets the value(s) for city (Name of city, town etc.) + * Sets the value for city (Name of city, town etc.) * *

* Definition: @@ -234,6 +261,7 @@ P.O. Box number, delivery hints, and similar address information public void setCity( String theString) { myCity = new StringDt(theString); } + /** * Gets the value(s) for state (Sub-unit of country (abreviations ok)). @@ -264,8 +292,9 @@ P.O. Box number, delivery hints, and similar address information myState = theValue; } + /** - * Sets the value(s) for state (Sub-unit of country (abreviations ok)) + * Sets the value for state (Sub-unit of country (abreviations ok)) * *

* Definition: @@ -275,6 +304,7 @@ P.O. Box number, delivery hints, and similar address information public void setState( String theString) { myState = new StringDt(theString); } + /** * Gets the value(s) for zip (Postal code for area). @@ -305,8 +335,9 @@ P.O. Box number, delivery hints, and similar address information myZip = theValue; } + /** - * Sets the value(s) for zip (Postal code for area) + * Sets the value for zip (Postal code for area) * *

* Definition: @@ -316,6 +347,7 @@ P.O. Box number, delivery hints, and similar address information public void setZip( String theString) { myZip = new StringDt(theString); } + /** * Gets the value(s) for country (Country (can be ISO 3166 3 letter code)). @@ -346,8 +378,9 @@ P.O. Box number, delivery hints, and similar address information myCountry = theValue; } + /** - * Sets the value(s) for country (Country (can be ISO 3166 3 letter code)) + * Sets the value for country (Country (can be ISO 3166 3 letter code)) * *

* Definition: @@ -357,6 +390,7 @@ P.O. Box number, delivery hints, and similar address information public void setCountry( String theString) { myCountry = new StringDt(theString); } + /** * Gets the value(s) for period (Time period when address was/is in use). @@ -387,6 +421,7 @@ P.O. Box number, delivery hints, and similar address information myPeriod = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java index d4053f1b40a..ee233260aa2 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/AttachmentDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Attachment") -public class AttachmentDt extends BaseElement implements ICompositeDatatype { +public class AttachmentDt extends BaseElement implements ICompositeDatatype { + @Child(name="contentType", type=CodeDt.class, order=0, min=1, max=1) private CodeDt myContentType; @@ -61,6 +62,12 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { @Child(name="title", type=StringDt.class, order=6, min=0, max=1) private StringDt myTitle; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myContentType, myLanguage, myData, myUrl, mySize, myHash, myTitle); + } + /** * Gets the value(s) for contentType (Mime type of the content, with charset etc.). * creating it if it does @@ -90,6 +97,7 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { myContentType = theValue; } + /** * Gets the value(s) for language (Human language of the content (BCP-47)). @@ -120,6 +128,7 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { myLanguage = theValue; } + /** * Gets the value(s) for data (Data inline, base64ed). @@ -150,7 +159,20 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { myData = theValue; } - + + /** + * Sets the value for data (Data inline, base64ed) + * + *

+ * Definition: + * The actual data of the attachment - a sequence of bytes. In XML, represented using base64 + *

+ */ + public void setData( byte[] theBytes) { + myData = new Base64BinaryDt(theBytes); + } + + /** * Gets the value(s) for url (Uri where the data can be found). * creating it if it does @@ -180,8 +202,9 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { myUrl = theValue; } + /** - * Sets the value(s) for url (Uri where the data can be found) + * Sets the value for url (Uri where the data can be found) * *

* Definition: @@ -191,6 +214,7 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { public void setUrl( String theUri) { myUrl = new UriDt(theUri); } + /** * Gets the value(s) for size (Number of bytes of content (if url provided)). @@ -221,7 +245,20 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { mySize = theValue; } - + + /** + * Sets the value for size (Number of bytes of content (if url provided)) + * + *

+ * Definition: + * The number of bytes of data that make up this attachment. + *

+ */ + public void setSize( Integer theInteger) { + mySize = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for hash (Hash of the data (sha-1, base64ed )). * creating it if it does @@ -251,7 +288,20 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { myHash = theValue; } - + + /** + * Sets the value for hash (Hash of the data (sha-1, base64ed )) + * + *

+ * Definition: + * The calculated hash of the data using SHA-1. Represented using base64 + *

+ */ + public void setHash( byte[] theBytes) { + myHash = new Base64BinaryDt(theBytes); + } + + /** * Gets the value(s) for title (Label to display in place of the data). * creating it if it does @@ -281,8 +331,9 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { myTitle = theValue; } + /** - * Sets the value(s) for title (Label to display in place of the data) + * Sets the value for title (Label to display in place of the data) * *

* Definition: @@ -292,6 +343,7 @@ public class AttachmentDt extends BaseElement implements ICompositeDatatype { public void setTitle( String theString) { myTitle = new StringDt(theString); } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodeableConceptDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodeableConceptDt.java index d2d9bc0008d..2cab9dcd44a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodeableConceptDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodeableConceptDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="CodeableConcept") -public class CodeableConceptDt extends BaseElement implements ICompositeDatatype { +public class CodeableConceptDt extends BaseElement implements ICompositeDatatype { + @Child(name="coding", type=CodingDt.class, order=0, min=0, max=Child.MAX_UNLIMITED) private List myCoding; @@ -46,6 +47,12 @@ public class CodeableConceptDt extends BaseElement implements ICompositeDatatype @Child(name="text", type=StringDt.class, order=1, min=0, max=1) private StringDt myText; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCoding, myText); + } + /** * Gets the value(s) for coding (Code defined by a terminology system ). * creating it if it does @@ -75,6 +82,20 @@ public class CodeableConceptDt extends BaseElement implements ICompositeDatatype myCoding = theValue; } + /** + * Adds and returns a new value for coding (Code defined by a terminology system ) + * + *

+ * Definition: + * A reference to a code defined by a terminology system + *

+ */ + public CodingDt addCoding() { + CodingDt newType = new CodingDt(); + getCoding().add(newType); + return newType; + } + /** * Gets the value(s) for text (Plain text representation of the concept). @@ -105,8 +126,9 @@ public class CodeableConceptDt extends BaseElement implements ICompositeDatatype myText = theValue; } + /** - * Sets the value(s) for text (Plain text representation of the concept) + * Sets the value for text (Plain text representation of the concept) * *

* Definition: @@ -116,6 +138,7 @@ public class CodeableConceptDt extends BaseElement implements ICompositeDatatype public void setText( String theString) { myText = new StringDt(theString); } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java index a5a1076a88c..4bca31d2e8c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/CodingDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Coding") -public class CodingDt extends BaseElement implements ICompositeDatatype { +public class CodingDt extends BaseElement implements ICompositeDatatype { + @Child(name="system", type=UriDt.class, order=0, min=0, max=1) private UriDt mySystem; @@ -61,6 +62,12 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { }) private ResourceReference myValueSet; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCode, myDisplay, myPrimary, myValueSet); + } + /** * Gets the value(s) for system (Identity of the terminology system ). * creating it if it does @@ -90,8 +97,9 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { mySystem = theValue; } + /** - * Sets the value(s) for system (Identity of the terminology system ) + * Sets the value for system (Identity of the terminology system ) * *

* Definition: @@ -101,6 +109,7 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { public void setSystem( String theUri) { mySystem = new UriDt(theUri); } + /** * Gets the value(s) for version (Version of the system - if relevant). @@ -131,8 +140,9 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { myVersion = theValue; } + /** - * Sets the value(s) for version (Version of the system - if relevant) + * Sets the value for version (Version of the system - if relevant) * *

* Definition: @@ -142,6 +152,7 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { public void setVersion( String theString) { myVersion = new StringDt(theString); } + /** * Gets the value(s) for code (Symbol in syntax defined by the system). @@ -172,6 +183,7 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { myCode = theValue; } + /** * Gets the value(s) for display (Representation defined by the system). @@ -202,8 +214,9 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { myDisplay = theValue; } + /** - * Sets the value(s) for display (Representation defined by the system) + * Sets the value for display (Representation defined by the system) * *

* Definition: @@ -213,6 +226,7 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { public void setDisplay( String theString) { myDisplay = new StringDt(theString); } + /** * Gets the value(s) for primary (If this code was chosen directly by the user). @@ -243,7 +257,20 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { myPrimary = theValue; } - + + /** + * Sets the value for primary (If this code was chosen directly by the user) + * + *

+ * Definition: + * Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays) + *

+ */ + public void setPrimary( Boolean theBoolean) { + myPrimary = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for valueSet (Set this coding was chosen from). * creating it if it does @@ -273,6 +300,7 @@ public class CodingDt extends BaseElement implements ICompositeDatatype { myValueSet = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContactDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContactDt.java index f4e88dca2bc..2999d648c49 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContactDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ContactDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Contact") -public class ContactDt extends BaseElement implements ICompositeDatatype { +public class ContactDt extends BaseElement implements ICompositeDatatype { + @Child(name="system", type=CodeDt.class, order=0, min=0, max=1) private BoundCodeDt mySystem; @@ -52,6 +53,12 @@ public class ContactDt extends BaseElement implements ICompositeDatatype { @Child(name="period", type=PeriodDt.class, order=3, min=0, max=1) private PeriodDt myPeriod; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myValue, myUse, myPeriod); + } + /** * Gets the value(s) for system (phone | fax | email | url). * creating it if it does @@ -81,6 +88,7 @@ public class ContactDt extends BaseElement implements ICompositeDatatype { mySystem = theValue; } + /** * Sets the value(s) for system (phone | fax | email | url) * @@ -123,8 +131,9 @@ public class ContactDt extends BaseElement implements ICompositeDatatype { myValue = theValue; } + /** - * Sets the value(s) for value (The actual contact details) + * Sets the value for value (The actual contact details) * *

* Definition: @@ -134,6 +143,7 @@ public class ContactDt extends BaseElement implements ICompositeDatatype { public void setValue( String theString) { myValue = new StringDt(theString); } + /** * Gets the value(s) for use (home | work | temp | old | mobile - purpose of this address). @@ -164,6 +174,7 @@ public class ContactDt extends BaseElement implements ICompositeDatatype { myUse = theValue; } + /** * Sets the value(s) for use (home | work | temp | old | mobile - purpose of this address) * @@ -206,6 +217,7 @@ public class ContactDt extends BaseElement implements ICompositeDatatype { myPeriod = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java index 355300cd4b6..2f84d0bcf76 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/HumanNameDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="HumanName") -public class HumanNameDt extends BaseElement implements ICompositeDatatype { +public class HumanNameDt extends BaseElement implements ICompositeDatatype { + @Child(name="use", type=CodeDt.class, order=0, min=0, max=1) private BoundCodeDt myUse; @@ -61,6 +62,12 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { @Child(name="period", type=PeriodDt.class, order=6, min=0, max=1) private PeriodDt myPeriod; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myUse, myText, myFamily, myGiven, myPrefix, mySuffix, myPeriod); + } + /** * Gets the value(s) for use (usual | official | temp | nickname | anonymous | old | maiden). * creating it if it does @@ -90,6 +97,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { myUse = theValue; } + /** * Sets the value(s) for use (usual | official | temp | nickname | anonymous | old | maiden) * @@ -132,8 +140,9 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { myText = theValue; } + /** - * Sets the value(s) for text (Text representation of the full name) + * Sets the value for text (Text representation of the full name) * *

* Definition: @@ -143,6 +152,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { public void setText( String theString) { myText = new StringDt(theString); } + /** * Gets the value(s) for family (Family name (often called 'Surname')). @@ -173,8 +183,22 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { myFamily = theValue; } + /** + * Adds and returns a new value for family (Family name (often called 'Surname')) + * + *

+ * Definition: + * The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father. + *

+ */ + public StringDt addFamily() { + StringDt newType = new StringDt(); + getFamily().add(newType); + return newType; + } + /** - * Sets the value(s) for family (Family name (often called 'Surname')) + * Adds a new value for family (Family name (often called 'Surname')) * *

* Definition: @@ -187,6 +211,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { } myFamily.add(new StringDt(theString)); } + /** * Gets the value(s) for given (Given names (not always 'first'). Includes middle names). @@ -217,8 +242,22 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { myGiven = theValue; } + /** + * Adds and returns a new value for given (Given names (not always 'first'). Includes middle names) + * + *

+ * Definition: + * Given name + *

+ */ + public StringDt addGiven() { + StringDt newType = new StringDt(); + getGiven().add(newType); + return newType; + } + /** - * Sets the value(s) for given (Given names (not always 'first'). Includes middle names) + * Adds a new value for given (Given names (not always 'first'). Includes middle names) * *

* Definition: @@ -231,6 +270,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { } myGiven.add(new StringDt(theString)); } + /** * Gets the value(s) for prefix (Parts that come before the name). @@ -261,8 +301,22 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { myPrefix = theValue; } + /** + * Adds and returns a new value for prefix (Parts that come before the name) + * + *

+ * Definition: + * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name + *

+ */ + public StringDt addPrefix() { + StringDt newType = new StringDt(); + getPrefix().add(newType); + return newType; + } + /** - * Sets the value(s) for prefix (Parts that come before the name) + * Adds a new value for prefix (Parts that come before the name) * *

* Definition: @@ -275,6 +329,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { } myPrefix.add(new StringDt(theString)); } + /** * Gets the value(s) for suffix (Parts that come after the name). @@ -305,8 +360,22 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { mySuffix = theValue; } + /** + * Adds and returns a new value for suffix (Parts that come after the name) + * + *

+ * Definition: + * Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name + *

+ */ + public StringDt addSuffix() { + StringDt newType = new StringDt(); + getSuffix().add(newType); + return newType; + } + /** - * Sets the value(s) for suffix (Parts that come after the name) + * Adds a new value for suffix (Parts that come after the name) * *

* Definition: @@ -319,6 +388,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { } mySuffix.add(new StringDt(theString)); } + /** * Gets the value(s) for period (Time period when name was/is in use). @@ -349,6 +419,7 @@ public class HumanNameDt extends BaseElement implements ICompositeDatatype { myPeriod = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java index e99bfe0315b..e8f9e699e1e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/IdentifierDt.java @@ -17,7 +17,6 @@ package ca.uhn.fhir.model.dstu.composite; import java.util.*; - import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.api.annotation.*; import ca.uhn.fhir.model.primitive.*; @@ -39,7 +38,22 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Identifier") -public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQueryParameterType { +public class IdentifierDt extends BaseElement implements ICompositeDatatype , IQueryParameterType { + + /** + * Creates a new identifier + */ + public IdentifierDt() { + // nothing + } + + /** + * Creates a new identifier with the given system and value + */ + public IdentifierDt(String theSystem, String theValue) { + setSystem(theSystem); + setValue(theValue); + } @Child(name="use", type=CodeDt.class, order=0, min=0, max=1) private BoundCodeDt myUse; @@ -62,19 +76,10 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu }) private ResourceReference myAssigner; - /** - * Creates a new identifier - */ - public IdentifierDt() { - // nothing - } - /** - * Creates a new identifier with the given system and value - */ - public IdentifierDt(String theSystem, String theValue) { - setSystem(theSystem); - setValue(theValue); + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myUse, myLabel, mySystem, myValue, myPeriod, myAssigner); } /** @@ -108,6 +113,7 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu myUse = theValue; } + /** * Sets the value(s) for use (usual | official | temp | secondary (If known) ) @@ -151,8 +157,9 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu myLabel = theValue; } + /** - * Sets the value(s) for label (Description of identifier) + * Sets the value for label (Description of identifier) * *

* Definition: @@ -162,6 +169,7 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu public void setLabel( String theString) { myLabel = new StringDt(theString); } + /** * Gets the value(s) for system (The namespace for the identifier). @@ -192,8 +200,9 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu mySystem = theValue; } + /** - * Sets the value(s) for system (The namespace for the identifier) + * Sets the value for system (The namespace for the identifier) * *

* Definition: @@ -203,6 +212,7 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu public void setSystem( String theUri) { mySystem = new UriDt(theUri); } + /** * Gets the value(s) for value (The value that is unique). @@ -233,8 +243,9 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu myValue = theValue; } + /** - * Sets the value(s) for value (The value that is unique) + * Sets the value for value (The value that is unique) * *

* Definition: @@ -244,6 +255,7 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu public void setValue( String theString) { myValue = new StringDt(theString); } + /** * Gets the value(s) for period (Time period when id is/was valid for use). @@ -274,6 +286,7 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu myPeriod = theValue; } + /** * Gets the value(s) for assigner (Organization that issued id (may be just text)). @@ -304,6 +317,7 @@ public class IdentifierDt extends BaseElement implements ICompositeDatatype, IQu myAssigner = theValue; } + /** diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java index d633ac9ca57..474577074dc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/NarrativeDt.java @@ -17,6 +17,7 @@ package ca.uhn.fhir.model.dstu.composite; import java.util.*; + import ca.uhn.fhir.model.api.*; import ca.uhn.fhir.model.api.annotation.*; import ca.uhn.fhir.model.primitive.*; @@ -45,6 +46,11 @@ public class NarrativeDt extends BaseElement implements ICompositeDatatype { @Child(name="div", type=XhtmlDt.class, order=1, min=1, max=1) private XhtmlDt myDiv; + @Override + public boolean isEmpty() { + return ca.uhn.fhir.util.ElementUtil.isEmpty( myStatus, myDiv ); + } + /** * Gets the value(s) for status (generated | extensions | additional). * creating it if it does diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/PeriodDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/PeriodDt.java index 7b7a65aa822..a92649361b1 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/PeriodDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/PeriodDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Period") -public class PeriodDt extends BaseElement implements ICompositeDatatype { +public class PeriodDt extends BaseElement implements ICompositeDatatype { + @Child(name="start", type=DateTimeDt.class, order=0, min=0, max=1) private DateTimeDt myStart; @@ -46,6 +47,12 @@ public class PeriodDt extends BaseElement implements ICompositeDatatype { @Child(name="end", type=DateTimeDt.class, order=1, min=0, max=1) private DateTimeDt myEnd; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myStart, myEnd); + } + /** * Gets the value(s) for start (Starting time with inclusive boundary). * creating it if it does @@ -75,8 +82,9 @@ public class PeriodDt extends BaseElement implements ICompositeDatatype { myStart = theValue; } + /** - * Sets the value(s) for start (Starting time with inclusive boundary) + * Sets the value for start (Starting time with inclusive boundary) * *

* Definition: @@ -86,6 +94,19 @@ public class PeriodDt extends BaseElement implements ICompositeDatatype { public void setStartWithSecondsPrecision( Date theDate) { myStart = new DateTimeDt(theDate); } + + /** + * Sets the value for start (Starting time with inclusive boundary) + * + *

+ * Definition: + * The start of the period. The boundary is inclusive. + *

+ */ + public void setStart( Date theDate, TemporalPrecisionEnum thePrecision) { + myStart = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for end (End time with inclusive boundary, if not ongoing). @@ -116,8 +137,9 @@ public class PeriodDt extends BaseElement implements ICompositeDatatype { myEnd = theValue; } + /** - * Sets the value(s) for end (End time with inclusive boundary, if not ongoing) + * Sets the value for end (End time with inclusive boundary, if not ongoing) * *

* Definition: @@ -127,6 +149,19 @@ public class PeriodDt extends BaseElement implements ICompositeDatatype { public void setEndWithSecondsPrecision( Date theDate) { myEnd = new DateTimeDt(theDate); } + + /** + * Sets the value for end (End time with inclusive boundary, if not ongoing) + * + *

+ * Definition: + * The end of the period. If the end of the period is missing, it means that the period is ongoing + *

+ */ + public void setEnd( Date theDate, TemporalPrecisionEnum thePrecision) { + myEnd = new DateTimeDt(theDate, thePrecision); + } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/QuantityDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/QuantityDt.java index 1e4cd757be2..ed3e5609254 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/QuantityDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/QuantityDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Quantity") -public class QuantityDt extends BaseElement implements ICompositeDatatype { +public class QuantityDt extends BaseElement implements ICompositeDatatype { + @Child(name="value", type=DecimalDt.class, order=0, min=0, max=1) private DecimalDt myValue; @@ -55,6 +56,12 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { @Child(name="code", type=CodeDt.class, order=4, min=0, max=1) private CodeDt myCode; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myValue, myComparator, myUnits, mySystem, myCode); + } + /** * Gets the value(s) for value (Numerical value (with implicit precision)). * creating it if it does @@ -84,7 +91,44 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { myValue = theValue; } - + + /** + * Sets the value for value (Numerical value (with implicit precision)) + * + *

+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *

+ */ + public void setValue( java.math.BigDecimal theValue) { + myValue = new DecimalDt(theValue); + } + + /** + * Sets the value for value (Numerical value (with implicit precision)) + * + *

+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *

+ */ + public void setValue( double theValue) { + myValue = new DecimalDt(theValue); + } + + /** + * Sets the value for value (Numerical value (with implicit precision)) + * + *

+ * Definition: + * The value of the measured amount. The value includes an implicit precision in the presentation of the value + *

+ */ + public void setValue( long theValue) { + myValue = new DecimalDt(theValue); + } + + /** * Gets the value(s) for comparator (< | <= | >= | > - how to understand the value). * creating it if it does @@ -114,6 +158,7 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { myComparator = theValue; } + /** * Sets the value(s) for comparator (< | <= | >= | > - how to understand the value) * @@ -156,8 +201,9 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { myUnits = theValue; } + /** - * Sets the value(s) for units (Unit representation) + * Sets the value for units (Unit representation) * *

* Definition: @@ -167,6 +213,7 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { public void setUnits( String theString) { myUnits = new StringDt(theString); } + /** * Gets the value(s) for system (System that defines coded unit form). @@ -197,8 +244,9 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { mySystem = theValue; } + /** - * Sets the value(s) for system (System that defines coded unit form) + * Sets the value for system (System that defines coded unit form) * *

* Definition: @@ -208,6 +256,7 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { public void setSystem( String theUri) { mySystem = new UriDt(theUri); } + /** * Gets the value(s) for code (Coded form of the unit). @@ -238,6 +287,7 @@ public class QuantityDt extends BaseElement implements ICompositeDatatype { myCode = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java index a0cd5776f3e..8f0d69b4697 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RangeDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Range") -public class RangeDt extends BaseElement implements ICompositeDatatype { +public class RangeDt extends BaseElement implements ICompositeDatatype { + @Child(name="low", type=QuantityDt.class, order=0, min=0, max=1) private QuantityDt myLow; @@ -46,6 +47,12 @@ public class RangeDt extends BaseElement implements ICompositeDatatype { @Child(name="high", type=QuantityDt.class, order=1, min=0, max=1) private QuantityDt myHigh; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myLow, myHigh); + } + /** * Gets the value(s) for low (Low limit ). * creating it if it does @@ -75,6 +82,7 @@ public class RangeDt extends BaseElement implements ICompositeDatatype { myLow = theValue; } + /** * Gets the value(s) for high (High limit ). @@ -105,6 +113,7 @@ public class RangeDt extends BaseElement implements ICompositeDatatype { myHigh = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java index 24546cbf89d..7d694718cd6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/RatioDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Ratio") -public class RatioDt extends BaseElement implements ICompositeDatatype { +public class RatioDt extends BaseElement implements ICompositeDatatype { + @Child(name="numerator", type=QuantityDt.class, order=0, min=0, max=1) private QuantityDt myNumerator; @@ -46,6 +47,12 @@ public class RatioDt extends BaseElement implements ICompositeDatatype { @Child(name="denominator", type=QuantityDt.class, order=1, min=0, max=1) private QuantityDt myDenominator; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myNumerator, myDenominator); + } + /** * Gets the value(s) for numerator (Numerator value). * creating it if it does @@ -75,6 +82,7 @@ public class RatioDt extends BaseElement implements ICompositeDatatype { myNumerator = theValue; } + /** * Gets the value(s) for denominator (Denominator value). @@ -105,6 +113,7 @@ public class RatioDt extends BaseElement implements ICompositeDatatype { myDenominator = theValue; } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java index 7a5d163e38c..f604f43fa64 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ResourceReferenceDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="ResourceReference") -public class ResourceReferenceDt extends BaseElement implements ICompositeDatatype { +public class ResourceReferenceDt extends BaseElement implements ICompositeDatatype { + @Child(name="reference", type=StringDt.class, order=0, min=0, max=1) private StringDt myReference; @@ -46,6 +47,12 @@ public class ResourceReferenceDt extends BaseElement implements ICompositeDataty @Child(name="display", type=StringDt.class, order=1, min=0, max=1) private StringDt myDisplay; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myReference, myDisplay); + } + /** * Gets the value(s) for reference (Relative, internal or absolute URL reference). * creating it if it does @@ -75,8 +82,9 @@ public class ResourceReferenceDt extends BaseElement implements ICompositeDataty myReference = theValue; } + /** - * Sets the value(s) for reference (Relative, internal or absolute URL reference) + * Sets the value for reference (Relative, internal or absolute URL reference) * *

* Definition: @@ -86,6 +94,7 @@ public class ResourceReferenceDt extends BaseElement implements ICompositeDataty public void setReference( String theString) { myReference = new StringDt(theString); } + /** * Gets the value(s) for display (Text alternative for the resource). @@ -116,8 +125,9 @@ public class ResourceReferenceDt extends BaseElement implements ICompositeDataty myDisplay = theValue; } + /** - * Sets the value(s) for display (Text alternative for the resource) + * Sets the value for display (Text alternative for the resource) * *

* Definition: @@ -127,6 +137,7 @@ public class ResourceReferenceDt extends BaseElement implements ICompositeDataty public void setDisplay( String theString) { myDisplay = new StringDt(theString); } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java index 03475f878bf..4bcfe59c33b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/SampledDataDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="SampledData") -public class SampledDataDt extends BaseElement implements ICompositeDatatype { +public class SampledDataDt extends BaseElement implements ICompositeDatatype { + @Child(name="origin", type=QuantityDt.class, order=0, min=1, max=1) private QuantityDt myOrigin; @@ -61,6 +62,12 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { @Child(name="data", type=StringDt.class, order=6, min=1, max=1) private StringDt myData; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myOrigin, myPeriod, myFactor, myLowerLimit, myUpperLimit, myDimensions, myData); + } + /** * Gets the value(s) for origin (Zero value and units). * creating it if it does @@ -90,6 +97,7 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myOrigin = theValue; } + /** * Gets the value(s) for period (Number of milliseconds between samples). @@ -120,7 +128,44 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myPeriod = theValue; } - + + /** + * Sets the value for period (Number of milliseconds between samples) + * + *

+ * Definition: + * The length of time between sampling times, measured in milliseconds + *

+ */ + public void setPeriod( java.math.BigDecimal theValue) { + myPeriod = new DecimalDt(theValue); + } + + /** + * Sets the value for period (Number of milliseconds between samples) + * + *

+ * Definition: + * The length of time between sampling times, measured in milliseconds + *

+ */ + public void setPeriod( double theValue) { + myPeriod = new DecimalDt(theValue); + } + + /** + * Sets the value for period (Number of milliseconds between samples) + * + *

+ * Definition: + * The length of time between sampling times, measured in milliseconds + *

+ */ + public void setPeriod( long theValue) { + myPeriod = new DecimalDt(theValue); + } + + /** * Gets the value(s) for factor (Multiply data by this before adding to origin). * creating it if it does @@ -150,7 +195,44 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myFactor = theValue; } - + + /** + * Sets the value for factor (Multiply data by this before adding to origin) + * + *

+ * Definition: + * A correction factor that is applied to the sampled data points before they are added to the origin + *

+ */ + public void setFactor( java.math.BigDecimal theValue) { + myFactor = new DecimalDt(theValue); + } + + /** + * Sets the value for factor (Multiply data by this before adding to origin) + * + *

+ * Definition: + * A correction factor that is applied to the sampled data points before they are added to the origin + *

+ */ + public void setFactor( double theValue) { + myFactor = new DecimalDt(theValue); + } + + /** + * Sets the value for factor (Multiply data by this before adding to origin) + * + *

+ * Definition: + * A correction factor that is applied to the sampled data points before they are added to the origin + *

+ */ + public void setFactor( long theValue) { + myFactor = new DecimalDt(theValue); + } + + /** * Gets the value(s) for lowerLimit (Lower limit of detection). * creating it if it does @@ -180,7 +262,44 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myLowerLimit = theValue; } - + + /** + * Sets the value for lowerLimit (Lower limit of detection) + * + *

+ * Definition: + * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit) + *

+ */ + public void setLowerLimit( java.math.BigDecimal theValue) { + myLowerLimit = new DecimalDt(theValue); + } + + /** + * Sets the value for lowerLimit (Lower limit of detection) + * + *

+ * Definition: + * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit) + *

+ */ + public void setLowerLimit( double theValue) { + myLowerLimit = new DecimalDt(theValue); + } + + /** + * Sets the value for lowerLimit (Lower limit of detection) + * + *

+ * Definition: + * The lower limit of detection of the measured points. This is needed if any of the data points have the value "L" (lower than detection limit) + *

+ */ + public void setLowerLimit( long theValue) { + myLowerLimit = new DecimalDt(theValue); + } + + /** * Gets the value(s) for upperLimit (Upper limit of detection). * creating it if it does @@ -210,7 +329,44 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myUpperLimit = theValue; } - + + /** + * Sets the value for upperLimit (Upper limit of detection) + * + *

+ * Definition: + * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit) + *

+ */ + public void setUpperLimit( java.math.BigDecimal theValue) { + myUpperLimit = new DecimalDt(theValue); + } + + /** + * Sets the value for upperLimit (Upper limit of detection) + * + *

+ * Definition: + * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit) + *

+ */ + public void setUpperLimit( double theValue) { + myUpperLimit = new DecimalDt(theValue); + } + + /** + * Sets the value for upperLimit (Upper limit of detection) + * + *

+ * Definition: + * The upper limit of detection of the measured points. This is needed if any of the data points have the value "U" (higher than detection limit) + *

+ */ + public void setUpperLimit( long theValue) { + myUpperLimit = new DecimalDt(theValue); + } + + /** * Gets the value(s) for dimensions (Number of sample points at each time point). * creating it if it does @@ -240,7 +396,20 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myDimensions = theValue; } - + + /** + * Sets the value for dimensions (Number of sample points at each time point) + * + *

+ * Definition: + * The number of sample points at each time point. If this value is greater than one, then the dimensions will be interlaced - all the sample points for a point in time will be recorded at once + *

+ */ + public void setDimensions( Integer theInteger) { + myDimensions = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for data (Decimal values with spaces, or "E" | "U" | "L"). * creating it if it does @@ -270,8 +439,9 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { myData = theValue; } + /** - * Sets the value(s) for data (Decimal values with spaces, or "E" | "U" | "L") + * Sets the value for data (Decimal values with spaces, or "E" | "U" | "L") * *

* Definition: @@ -281,6 +451,7 @@ public class SampledDataDt extends BaseElement implements ICompositeDatatype { public void setData( String theString) { myData = new StringDt(theString); } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java index 68664517c6d..a23bc495c3f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/composite/ScheduleDt.java @@ -38,7 +38,8 @@ import ca.uhn.fhir.model.dstu.resource.*; *

*/ @DatatypeDef(name="Schedule") -public class ScheduleDt extends BaseElement implements ICompositeDatatype { +public class ScheduleDt extends BaseElement implements ICompositeDatatype { + @Child(name="event", type=PeriodDt.class, order=0, min=0, max=Child.MAX_UNLIMITED) private List myEvent; @@ -46,6 +47,12 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { @Child(name="repeat", order=1, min=0, max=1) private Repeat myRepeat; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myEvent, myRepeat); + } + /** * Gets the value(s) for event (When the event occurs). * creating it if it does @@ -75,6 +82,20 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myEvent = theValue; } + /** + * Adds and returns a new value for event (When the event occurs) + * + *

+ * Definition: + * Identifies specific time periods when the event should occur + *

+ */ + public PeriodDt addEvent() { + PeriodDt newType = new PeriodDt(); + getEvent().add(newType); + return newType; + } + /** * Gets the value(s) for repeat (Only if there is none or one event). @@ -105,6 +126,7 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myRepeat = theValue; } + /** * Block class for child element: Schedule.repeat (Only if there is none or one event) @@ -135,6 +157,12 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { @Child(name="end", type=DateTimeDt.class, order=5, min=0, max=1) private DateTimeDt myEnd; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myFrequency, myWhen, myDuration, myUnits, myCount, myEnd); + } + /** * Gets the value(s) for frequency (Event occurs frequency times per duration). * creating it if it does @@ -164,7 +192,20 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myFrequency = theValue; } - + + /** + * Sets the value for frequency (Event occurs frequency times per duration) + * + *

+ * Definition: + * Indicates how often the event should occur. + *

+ */ + public void setFrequency( Integer theInteger) { + myFrequency = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for when (HS | WAKE | AC | ACM | ACD | ACV | PC | PCM | PCD | PCV - common life events). * creating it if it does @@ -194,6 +235,7 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myWhen = theValue; } + /** * Sets the value(s) for when (HS | WAKE | AC | ACM | ACD | ACV | PC | PCM | PCD | PCV - common life events) * @@ -236,7 +278,44 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myDuration = theValue; } - + + /** + * Sets the value for duration (Repeating or event-related duration) + * + *

+ * Definition: + * How long each repetition should last + *

+ */ + public void setDuration( java.math.BigDecimal theValue) { + myDuration = new DecimalDt(theValue); + } + + /** + * Sets the value for duration (Repeating or event-related duration) + * + *

+ * Definition: + * How long each repetition should last + *

+ */ + public void setDuration( double theValue) { + myDuration = new DecimalDt(theValue); + } + + /** + * Sets the value for duration (Repeating or event-related duration) + * + *

+ * Definition: + * How long each repetition should last + *

+ */ + public void setDuration( long theValue) { + myDuration = new DecimalDt(theValue); + } + + /** * Gets the value(s) for units (s | min | h | d | wk | mo | a - unit of time (UCUM)). * creating it if it does @@ -266,6 +345,7 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myUnits = theValue; } + /** * Sets the value(s) for units (s | min | h | d | wk | mo | a - unit of time (UCUM)) * @@ -308,7 +388,20 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myCount = theValue; } - + + /** + * Sets the value for count (Number of times to repeat) + * + *

+ * Definition: + * A total count of the desired number of repetitions + *

+ */ + public void setCount( Integer theInteger) { + myCount = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for end (When to stop repeats). * creating it if it does @@ -338,8 +431,9 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { myEnd = theValue; } + /** - * Sets the value(s) for end (When to stop repeats) + * Sets the value for end (When to stop repeats) * *

* Definition: @@ -349,6 +443,19 @@ public class ScheduleDt extends BaseElement implements ICompositeDatatype { public void setEndWithSecondsPrecision( Date theDate) { myEnd = new DateTimeDt(theDate); } + + /** + * Sets the value for end (When to stop repeats) + * + *

+ * Definition: + * When to stop repeating the schedule + *

+ */ + public void setEnd( Date theDate, TemporalPrecisionEnum thePrecision) { + myEnd = new DateTimeDt(theDate, thePrecision); + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java index f4b8b08f136..8ed69f677dc 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Device.java @@ -169,6 +169,12 @@ public class Device extends BaseResource implements IResource { @Child(name="url", type=UriDt.class, order=12, min=0, max=1) private UriDt myUrl; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myType, myManufacturer, myModel, myVersion, myExpiry, myUdi, myLotNumber, myOwner, myLocation, myPatient, myContact, myUrl); + } + /** * Gets the value(s) for identifier (Instance id from manufacturer, owner and others). * creating it if it does @@ -198,6 +204,20 @@ public class Device extends BaseResource implements IResource { myIdentifier = theValue; } + /** + * Adds and returns a new value for identifier (Instance id from manufacturer, owner and others) + * + *

+ * Definition: + * Identifiers assigned to this device by various organizations. The most likely organizations to assign identifiers are the manufacturer and the owner, though regulatory agencies may also assign an identifier. The identifiers identify the particular device, not the kind of device + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + /** * Gets the value(s) for type (What kind of device this is). @@ -228,6 +248,7 @@ public class Device extends BaseResource implements IResource { myType = theValue; } + /** * Gets the value(s) for manufacturer (Name of device manufacturer). @@ -258,8 +279,9 @@ public class Device extends BaseResource implements IResource { myManufacturer = theValue; } + /** - * Sets the value(s) for manufacturer (Name of device manufacturer) + * Sets the value for manufacturer (Name of device manufacturer) * *

* Definition: @@ -269,6 +291,7 @@ public class Device extends BaseResource implements IResource { public void setManufacturer( String theString) { myManufacturer = new StringDt(theString); } + /** * Gets the value(s) for model (Model id assigned by the manufacturer). @@ -299,8 +322,9 @@ public class Device extends BaseResource implements IResource { myModel = theValue; } + /** - * Sets the value(s) for model (Model id assigned by the manufacturer) + * Sets the value for model (Model id assigned by the manufacturer) * *

* Definition: @@ -310,6 +334,7 @@ public class Device extends BaseResource implements IResource { public void setModel( String theString) { myModel = new StringDt(theString); } + /** * Gets the value(s) for version (Version number (i.e. software)). @@ -340,8 +365,9 @@ public class Device extends BaseResource implements IResource { myVersion = theValue; } + /** - * Sets the value(s) for version (Version number (i.e. software)) + * Sets the value for version (Version number (i.e. software)) * *

* Definition: @@ -351,6 +377,7 @@ public class Device extends BaseResource implements IResource { public void setVersion( String theString) { myVersion = new StringDt(theString); } + /** * Gets the value(s) for expiry (Date of expiry of this device (if applicable)). @@ -381,7 +408,32 @@ public class Device extends BaseResource implements IResource { myExpiry = theValue; } - + + /** + * Sets the value for expiry (Date of expiry of this device (if applicable)) + * + *

+ * Definition: + * Date of expiry of this device (if applicable) + *

+ */ + public void setExpiry( Date theDate, TemporalPrecisionEnum thePrecision) { + myExpiry = new DateDt(theDate, thePrecision); + } + + /** + * Sets the value for expiry (Date of expiry of this device (if applicable)) + * + *

+ * Definition: + * Date of expiry of this device (if applicable) + *

+ */ + public void setExpiryWithDayPrecision( Date theDate) { + myExpiry = new DateDt(theDate); + } + + /** * Gets the value(s) for udi (FDA Mandated Unique Device Identifier). * creating it if it does @@ -411,8 +463,9 @@ public class Device extends BaseResource implements IResource { myUdi = theValue; } + /** - * Sets the value(s) for udi (FDA Mandated Unique Device Identifier) + * Sets the value for udi (FDA Mandated Unique Device Identifier) * *

* Definition: @@ -422,6 +475,7 @@ public class Device extends BaseResource implements IResource { public void setUdi( String theString) { myUdi = new StringDt(theString); } + /** * Gets the value(s) for lotNumber (Lot number of manufacture). @@ -452,8 +506,9 @@ public class Device extends BaseResource implements IResource { myLotNumber = theValue; } + /** - * Sets the value(s) for lotNumber (Lot number of manufacture) + * Sets the value for lotNumber (Lot number of manufacture) * *

* Definition: @@ -463,6 +518,7 @@ public class Device extends BaseResource implements IResource { public void setLotNumber( String theString) { myLotNumber = new StringDt(theString); } + /** * Gets the value(s) for owner (Organization responsible for device). @@ -493,6 +549,7 @@ public class Device extends BaseResource implements IResource { myOwner = theValue; } + /** * Gets the value(s) for location (Where the resource is found). @@ -523,6 +580,7 @@ public class Device extends BaseResource implements IResource { myLocation = theValue; } + /** * Gets the value(s) for patient (If the resource is affixed to a person). @@ -553,6 +611,7 @@ public class Device extends BaseResource implements IResource { myPatient = theValue; } + /** * Gets the value(s) for contact (Details for human/organization for support). @@ -583,6 +642,20 @@ public class Device extends BaseResource implements IResource { myContact = theValue; } + /** + * Adds and returns a new value for contact (Details for human/organization for support) + * + *

+ * Definition: + * Contact details for an organization or a particular human that is responsible for the device + *

+ */ + public ContactDt addContact() { + ContactDt newType = new ContactDt(); + getContact().add(newType); + return newType; + } + /** * Gets the value(s) for url (Network address to contact device). @@ -613,8 +686,9 @@ public class Device extends BaseResource implements IResource { myUrl = theValue; } + /** - * Sets the value(s) for url (Network address to contact device) + * Sets the value for url (Network address to contact device) * *

* Definition: @@ -624,6 +698,7 @@ public class Device extends BaseResource implements IResource { public void setUrl( String theUri) { myUrl = new UriDt(theUri); } + diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java index df8bdd1d93c..7f8abe8ec9d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Group.java @@ -162,6 +162,12 @@ public class Group extends BaseResource implements IResource { }) private List myMember; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myType, myActual, myCode, myName, myQuantity, myCharacteristic, myMember); + } + /** * Gets the value(s) for identifier (Unique id). * creating it if it does @@ -191,6 +197,7 @@ public class Group extends BaseResource implements IResource { myIdentifier = theValue; } + /** * Gets the value(s) for type (person | animal | practitioner | device | medication | substance). @@ -221,6 +228,7 @@ public class Group extends BaseResource implements IResource { myType = theValue; } + /** * Sets the value(s) for type (person | animal | practitioner | device | medication | substance) * @@ -263,7 +271,20 @@ public class Group extends BaseResource implements IResource { myActual = theValue; } - + + /** + * Sets the value for actual (Descriptive or actual) + * + *

+ * Definition: + * If true, indicates that the resource refers to a specific group of real individuals. If false, the group defines a set of intended individuals + *

+ */ + public void setActual( Boolean theBoolean) { + myActual = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for code (Kind of Group members). * creating it if it does @@ -293,6 +314,7 @@ public class Group extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for name (Label for Group). @@ -323,8 +345,9 @@ public class Group extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Label for Group) + * Sets the value for name (Label for Group) * *

* Definition: @@ -334,6 +357,7 @@ public class Group extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for quantity (Number of members). @@ -364,7 +388,20 @@ public class Group extends BaseResource implements IResource { myQuantity = theValue; } - + + /** + * Sets the value for quantity (Number of members) + * + *

+ * Definition: + * A count of the number of resource instances that are part of the group + *

+ */ + public void setQuantity( Integer theInteger) { + myQuantity = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for characteristic (Trait of group members). * creating it if it does @@ -394,6 +431,20 @@ public class Group extends BaseResource implements IResource { myCharacteristic = theValue; } + /** + * Adds and returns a new value for characteristic (Trait of group members) + * + *

+ * Definition: + * Identifies the traits shared by members of the group + *

+ */ + public Characteristic addCharacteristic() { + Characteristic newType = new Characteristic(); + getCharacteristic().add(newType); + return newType; + } + /** * Gets the value(s) for member (Who is in group). @@ -421,6 +472,7 @@ public class Group extends BaseResource implements IResource { myMember = theValue; } + /** * Block class for child element: Group.characteristic (Trait of group members) @@ -447,6 +499,12 @@ public class Group extends BaseResource implements IResource { @Child(name="exclude", type=BooleanDt.class, order=2, min=1, max=1) private BooleanDt myExclude; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myValue, myExclude); + } + /** * Gets the value(s) for code (Kind of characteristic). * creating it if it does @@ -476,6 +534,7 @@ public class Group extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for value[x] (Value held by characteristic). @@ -503,6 +562,7 @@ public class Group extends BaseResource implements IResource { myValue = theValue; } + /** * Gets the value(s) for exclude (Group includes or excludes). @@ -533,7 +593,20 @@ public class Group extends BaseResource implements IResource { myExclude = theValue; } - + + /** + * Sets the value for exclude (Group includes or excludes) + * + *

+ * Definition: + * If true, indicates the characteristic is one that is NOT held by members of the group + *

+ */ + public void setExclude( Boolean theBoolean) { + myExclude = new BooleanDt(theBoolean); + } + + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java index f5b24ba8ddd..432e1b1e4f7 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Location.java @@ -163,6 +163,12 @@ public class Location extends BaseResource implements IResource { @Child(name="mode", type=CodeDt.class, order=11, min=0, max=1) private BoundCodeDt myMode; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myName, myDescription, myType, myTelecom, myAddress, myPhysicalType, myPosition, myManagingOrganization, myStatus, myPartOf, myMode); + } + /** * Gets the value(s) for identifier (Unique code or number identifying the location to its users). * creating it if it does @@ -192,6 +198,7 @@ public class Location extends BaseResource implements IResource { myIdentifier = theValue; } + /** * Gets the value(s) for name (Name of the location as used by humans). @@ -222,8 +229,9 @@ public class Location extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Name of the location as used by humans) + * Sets the value for name (Name of the location as used by humans) * *

* Definition: @@ -233,6 +241,7 @@ public class Location extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for description (Description of the Location, which helps in finding or referencing the place). @@ -263,8 +272,9 @@ public class Location extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Description of the Location, which helps in finding or referencing the place) + * Sets the value for description (Description of the Location, which helps in finding or referencing the place) * *

* Definition: @@ -274,6 +284,7 @@ public class Location extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for type (Indicates the type of function performed at the location). @@ -304,6 +315,7 @@ public class Location extends BaseResource implements IResource { myType = theValue; } + /** * Gets the value(s) for telecom (Contact details of the location). @@ -334,6 +346,20 @@ public class Location extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (Contact details of the location) + * + *

+ * Definition: + * The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for address (Physical location). @@ -364,6 +390,7 @@ public class Location extends BaseResource implements IResource { myAddress = theValue; } + /** * Gets the value(s) for physicalType (Physical form of the location). @@ -394,6 +421,7 @@ public class Location extends BaseResource implements IResource { myPhysicalType = theValue; } + /** * Gets the value(s) for position (The absolute geographic location ). @@ -424,6 +452,7 @@ public class Location extends BaseResource implements IResource { myPosition = theValue; } + /** * Gets the value(s) for managingOrganization (The organization that is responsible for the provisioning and upkeep of the location). @@ -454,6 +483,7 @@ public class Location extends BaseResource implements IResource { myManagingOrganization = theValue; } + /** * Gets the value(s) for status (active | suspended | inactive). @@ -484,6 +514,7 @@ public class Location extends BaseResource implements IResource { myStatus = theValue; } + /** * Sets the value(s) for status (active | suspended | inactive) * @@ -526,6 +557,7 @@ public class Location extends BaseResource implements IResource { myPartOf = theValue; } + /** * Gets the value(s) for mode (instance | kind). @@ -556,6 +588,7 @@ public class Location extends BaseResource implements IResource { myMode = theValue; } + /** * Sets the value(s) for mode (instance | kind) * @@ -589,6 +622,12 @@ public class Location extends BaseResource implements IResource { @Child(name="altitude", type=DecimalDt.class, order=2, min=0, max=1) private DecimalDt myAltitude; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myLongitude, myLatitude, myAltitude); + } + /** * Gets the value(s) for longitude (Longitude as expressed in KML). * creating it if it does @@ -618,7 +657,44 @@ public class Location extends BaseResource implements IResource { myLongitude = theValue; } - + + /** + * Sets the value for longitude (Longitude as expressed in KML) + * + *

+ * Definition: + * Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below) + *

+ */ + public void setLongitude( java.math.BigDecimal theValue) { + myLongitude = new DecimalDt(theValue); + } + + /** + * Sets the value for longitude (Longitude as expressed in KML) + * + *

+ * Definition: + * Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below) + *

+ */ + public void setLongitude( double theValue) { + myLongitude = new DecimalDt(theValue); + } + + /** + * Sets the value for longitude (Longitude as expressed in KML) + * + *

+ * Definition: + * Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below) + *

+ */ + public void setLongitude( long theValue) { + myLongitude = new DecimalDt(theValue); + } + + /** * Gets the value(s) for latitude (Latitude as expressed in KML). * creating it if it does @@ -648,7 +724,44 @@ public class Location extends BaseResource implements IResource { myLatitude = theValue; } - + + /** + * Sets the value for latitude (Latitude as expressed in KML) + * + *

+ * Definition: + * Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below) + *

+ */ + public void setLatitude( java.math.BigDecimal theValue) { + myLatitude = new DecimalDt(theValue); + } + + /** + * Sets the value for latitude (Latitude as expressed in KML) + * + *

+ * Definition: + * Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below) + *

+ */ + public void setLatitude( double theValue) { + myLatitude = new DecimalDt(theValue); + } + + /** + * Sets the value for latitude (Latitude as expressed in KML) + * + *

+ * Definition: + * Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below) + *

+ */ + public void setLatitude( long theValue) { + myLatitude = new DecimalDt(theValue); + } + + /** * Gets the value(s) for altitude (Altitude as expressed in KML). * creating it if it does @@ -678,7 +791,44 @@ public class Location extends BaseResource implements IResource { myAltitude = theValue; } - + + /** + * Sets the value for altitude (Altitude as expressed in KML) + * + *

+ * Definition: + * Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below) + *

+ */ + public void setAltitude( java.math.BigDecimal theValue) { + myAltitude = new DecimalDt(theValue); + } + + /** + * Sets the value for altitude (Altitude as expressed in KML) + * + *

+ * Definition: + * Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below) + *

+ */ + public void setAltitude( double theValue) { + myAltitude = new DecimalDt(theValue); + } + + /** + * Sets the value for altitude (Altitude as expressed in KML) + * + *

+ * Definition: + * Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below) + *

+ */ + public void setAltitude( long theValue) { + myAltitude = new DecimalDt(theValue); + } + + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java index 564768f451c..2c5b483a51c 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Medication.java @@ -135,6 +135,12 @@ public class Medication extends BaseResource implements IResource { @Child(name="package", type=CodeDt.class, order=6, min=0, max=1) private CodeDt myPackage; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myCode, myIsBrand, myManufacturer, myKind, myProduct, myPackage); + } + /** * Gets the value(s) for name (Common / Commercial name). * creating it if it does @@ -164,8 +170,9 @@ public class Medication extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Common / Commercial name) + * Sets the value for name (Common / Commercial name) * *

* Definition: @@ -175,6 +182,7 @@ public class Medication extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for code (Codes that identify this medication). @@ -205,6 +213,7 @@ public class Medication extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for isBrand (True if a brand). @@ -235,7 +244,20 @@ public class Medication extends BaseResource implements IResource { myIsBrand = theValue; } - + + /** + * Sets the value for isBrand (True if a brand) + * + *

+ * Definition: + * Set to true if the item is attributable to a specific manufacturer (even if we don't know who that is) + *

+ */ + public void setIsBrand( Boolean theBoolean) { + myIsBrand = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for manufacturer (Manufacturer of the item). * creating it if it does @@ -265,6 +287,7 @@ public class Medication extends BaseResource implements IResource { myManufacturer = theValue; } + /** * Gets the value(s) for kind (product | package). @@ -295,6 +318,7 @@ public class Medication extends BaseResource implements IResource { myKind = theValue; } + /** * Sets the value(s) for kind (product | package) * @@ -337,6 +361,7 @@ public class Medication extends BaseResource implements IResource { myProduct = theValue; } + /** * Gets the value(s) for package (Details about packaged medications). @@ -367,6 +392,7 @@ public class Medication extends BaseResource implements IResource { myPackage = theValue; } + /** * Block class for child element: Medication.product (Administrable medication details) @@ -385,6 +411,12 @@ public class Medication extends BaseResource implements IResource { @Child(name="ingredient", order=1, min=0, max=Child.MAX_UNLIMITED) private List myIngredient; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myForm, myIngredient); + } + /** * Gets the value(s) for form (powder | tablets | carton +). * creating it if it does @@ -414,6 +446,7 @@ public class Medication extends BaseResource implements IResource { myForm = theValue; } + /** * Gets the value(s) for ingredient (Active or inactive ingredient). @@ -444,6 +477,20 @@ public class Medication extends BaseResource implements IResource { myIngredient = theValue; } + /** + * Adds and returns a new value for ingredient (Active or inactive ingredient) + * + *

+ * Definition: + * Identifies a particular constituent of interest in the product + *

+ */ + public ProductIngredient addIngredient() { + ProductIngredient newType = new ProductIngredient(); + getIngredient().add(newType); + return newType; + } + } @@ -469,6 +516,12 @@ public class Medication extends BaseResource implements IResource { @Child(name="amount", type=RatioDt.class, order=1, min=0, max=1) private RatioDt myAmount; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myItem, myAmount); + } + /** * Gets the value(s) for item (The product contained). * creating it if it does @@ -495,6 +548,7 @@ public class Medication extends BaseResource implements IResource { myItem = theValue; } + /** * Gets the value(s) for amount (How much ingredient in product). @@ -525,6 +579,7 @@ public class Medication extends BaseResource implements IResource { myAmount = theValue; } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java index 0cf0a6f2b3c..3a179a986d1 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Observation.java @@ -264,6 +264,12 @@ public class Observation extends BaseResource implements IResource { @Child(name="related", order=15, min=0, max=Child.MAX_UNLIMITED) private List myRelated; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myValue, myInterpretation, myComments, myApplies, myIssued, myStatus, myReliability, myBodySite, myMethod, myIdentifier, mySubject, mySpecimen, myPerformer, myReferenceRange, myRelated); + } + /** * Gets the value(s) for name (Type of observation (code / type)). * creating it if it does @@ -293,6 +299,7 @@ public class Observation extends BaseResource implements IResource { myName = theValue; } + /** * Gets the value(s) for value[x] (Actual result). @@ -320,6 +327,7 @@ public class Observation extends BaseResource implements IResource { myValue = theValue; } + /** * Gets the value(s) for interpretation (High, low, normal, etc.). @@ -350,6 +358,7 @@ public class Observation extends BaseResource implements IResource { myInterpretation = theValue; } + /** * Gets the value(s) for comments (Comments about result). @@ -380,8 +389,9 @@ public class Observation extends BaseResource implements IResource { myComments = theValue; } + /** - * Sets the value(s) for comments (Comments about result) + * Sets the value for comments (Comments about result) * *

* Definition: @@ -391,6 +401,7 @@ public class Observation extends BaseResource implements IResource { public void setComments( String theString) { myComments = new StringDt(theString); } + /** * Gets the value(s) for applies[x] (Physiologically Relevant time/time-period for observation). @@ -418,6 +429,7 @@ public class Observation extends BaseResource implements IResource { myApplies = theValue; } + /** * Gets the value(s) for issued (Date/Time this was made available). @@ -448,7 +460,32 @@ public class Observation extends BaseResource implements IResource { myIssued = theValue; } - + + /** + * Sets the value for issued (Date/Time this was made available) + * + *

+ * Definition: + * + *

+ */ + public void setIssuedWithMillisPrecision( Date theDate) { + myIssued = new InstantDt(theDate); + } + + /** + * Sets the value for issued (Date/Time this was made available) + * + *

+ * Definition: + * + *

+ */ + public void setIssued( Date theDate, TemporalPrecisionEnum thePrecision) { + myIssued = new InstantDt(theDate, thePrecision); + } + + /** * Gets the value(s) for status (registered | preliminary | final | amended +). * creating it if it does @@ -478,6 +515,7 @@ public class Observation extends BaseResource implements IResource { myStatus = theValue; } + /** * Sets the value(s) for status (registered | preliminary | final | amended +) * @@ -520,6 +558,7 @@ public class Observation extends BaseResource implements IResource { myReliability = theValue; } + /** * Sets the value(s) for reliability (ok | ongoing | early | questionable | calibrating | error + ) * @@ -562,6 +601,7 @@ public class Observation extends BaseResource implements IResource { myBodySite = theValue; } + /** * Gets the value(s) for method (How it was done). @@ -592,6 +632,7 @@ public class Observation extends BaseResource implements IResource { myMethod = theValue; } + /** * Gets the value(s) for identifier (Unique Id for this particular observation). @@ -622,6 +663,7 @@ public class Observation extends BaseResource implements IResource { myIdentifier = theValue; } + /** * Gets the value(s) for subject (Who and/or what this is about). @@ -649,6 +691,7 @@ public class Observation extends BaseResource implements IResource { mySubject = theValue; } + /** * Gets the value(s) for specimen (Specimen used for this observation). @@ -679,6 +722,7 @@ public class Observation extends BaseResource implements IResource { mySpecimen = theValue; } + /** * Gets the value(s) for performer (Who did the observation). @@ -706,6 +750,7 @@ public class Observation extends BaseResource implements IResource { myPerformer = theValue; } + /** * Gets the value(s) for referenceRange (Provides guide for interpretation). @@ -736,6 +781,20 @@ public class Observation extends BaseResource implements IResource { myReferenceRange = theValue; } + /** + * Adds and returns a new value for referenceRange (Provides guide for interpretation) + * + *

+ * Definition: + * Guidance on how to interpret the value by comparison to a normal or recommended range + *

+ */ + public ReferenceRange addReferenceRange() { + ReferenceRange newType = new ReferenceRange(); + getReferenceRange().add(newType); + return newType; + } + /** * Gets the value(s) for related (Observations related to this observation). @@ -766,6 +825,20 @@ public class Observation extends BaseResource implements IResource { myRelated = theValue; } + /** + * Adds and returns a new value for related (Observations related to this observation) + * + *

+ * Definition: + * Related observations - either components, or previous observations, or statements of derivation + *

+ */ + public Related addRelated() { + Related newType = new Related(); + getRelated().add(newType); + return newType; + } + /** * Block class for child element: Observation.referenceRange (Provides guide for interpretation) @@ -790,6 +863,12 @@ public class Observation extends BaseResource implements IResource { @Child(name="age", type=RangeDt.class, order=3, min=0, max=1) private RangeDt myAge; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myLow, myHigh, myMeaning, myAge); + } + /** * Gets the value(s) for low (Low Range, if relevant). * creating it if it does @@ -819,6 +898,7 @@ public class Observation extends BaseResource implements IResource { myLow = theValue; } + /** * Gets the value(s) for high (High Range, if relevant). @@ -849,6 +929,7 @@ public class Observation extends BaseResource implements IResource { myHigh = theValue; } + /** * Gets the value(s) for meaning (Indicates the meaning/use of this range of this range). @@ -879,6 +960,7 @@ public class Observation extends BaseResource implements IResource { myMeaning = theValue; } + /** * Gets the value(s) for age (Applicable age range, if relevant). @@ -909,6 +991,7 @@ public class Observation extends BaseResource implements IResource { myAge = theValue; } + } @@ -934,6 +1017,12 @@ public class Observation extends BaseResource implements IResource { }) private ResourceReference myTarget; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myType, myTarget); + } + /** * Gets the value(s) for type (has-component | has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by). * creating it if it does @@ -963,6 +1052,7 @@ public class Observation extends BaseResource implements IResource { myType = theValue; } + /** * Sets the value(s) for type (has-component | has-member | derived-from | sequel-to | replaces | qualified-by | interfered-by) * @@ -1005,6 +1095,7 @@ public class Observation extends BaseResource implements IResource { myTarget = theValue; } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java index c4f54728360..4f5c583ad4f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Organization.java @@ -144,6 +144,12 @@ public class Organization extends BaseResource implements IResource { @Child(name="active", type=BooleanDt.class, order=8, min=0, max=1) private BooleanDt myActive; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myName, myType, myTelecom, myAddress, myPartOf, myContact, myLocation, myActive); + } + /** * Gets the value(s) for identifier (Identifies this organization across multiple systems). * creating it if it does @@ -173,6 +179,20 @@ public class Organization extends BaseResource implements IResource { myIdentifier = theValue; } + /** + * Adds and returns a new value for identifier (Identifies this organization across multiple systems) + * + *

+ * Definition: + * Identifier for the organization that is used to identify the organization across multiple disparate systems + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + /** * Gets the value(s) for name (Name used for the organization). @@ -203,8 +223,9 @@ public class Organization extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Name used for the organization) + * Sets the value for name (Name used for the organization) * *

* Definition: @@ -214,6 +235,7 @@ public class Organization extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for type (Kind of organization). @@ -244,6 +266,7 @@ public class Organization extends BaseResource implements IResource { myType = theValue; } + /** * Gets the value(s) for telecom (A contact detail for the organization). @@ -274,6 +297,20 @@ public class Organization extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (A contact detail for the organization) + * + *

+ * Definition: + * A contact detail for the organization + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for address (An address for the organization). @@ -304,6 +341,20 @@ public class Organization extends BaseResource implements IResource { myAddress = theValue; } + /** + * Adds and returns a new value for address (An address for the organization) + * + *

+ * Definition: + * An address for the organization + *

+ */ + public AddressDt addAddress() { + AddressDt newType = new AddressDt(); + getAddress().add(newType); + return newType; + } + /** * Gets the value(s) for partOf (The organization of which this organization forms a part). @@ -334,6 +385,7 @@ public class Organization extends BaseResource implements IResource { myPartOf = theValue; } + /** * Gets the value(s) for contact (Contact for the organization for a certain purpose). @@ -364,6 +416,20 @@ public class Organization extends BaseResource implements IResource { myContact = theValue; } + /** + * Adds and returns a new value for contact (Contact for the organization for a certain purpose) + * + *

+ * Definition: + * + *

+ */ + public Contact addContact() { + Contact newType = new Contact(); + getContact().add(newType); + return newType; + } + /** * Gets the value(s) for location (Location(s) the organization uses to provide services). @@ -394,6 +460,7 @@ public class Organization extends BaseResource implements IResource { myLocation = theValue; } + /** * Gets the value(s) for active (Whether the organization's record is still in active use). @@ -424,7 +491,20 @@ public class Organization extends BaseResource implements IResource { myActive = theValue; } - + + /** + * Sets the value for active (Whether the organization's record is still in active use) + * + *

+ * Definition: + * Whether the organization's record is still in active use + *

+ */ + public void setActive( Boolean theBoolean) { + myActive = new BooleanDt(theBoolean); + } + + /** * Block class for child element: Organization.contact (Contact for the organization for a certain purpose) * @@ -451,6 +531,12 @@ public class Organization extends BaseResource implements IResource { @Child(name="gender", type=CodeableConceptDt.class, order=4, min=0, max=1) private CodeableConceptDt myGender; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myPurpose, myName, myTelecom, myAddress, myGender); + } + /** * Gets the value(s) for purpose (The type of contact). * creating it if it does @@ -480,6 +566,7 @@ public class Organization extends BaseResource implements IResource { myPurpose = theValue; } + /** * Gets the value(s) for name (A name associated with the contact). @@ -510,6 +597,7 @@ public class Organization extends BaseResource implements IResource { myName = theValue; } + /** * Gets the value(s) for telecom (Contact details (telephone, email, etc) for a contact). @@ -540,6 +628,20 @@ public class Organization extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (Contact details (telephone, email, etc) for a contact) + * + *

+ * Definition: + * A contact detail (e.g. a telephone number or an email address) by which the party may be contacted. + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for address (Visiting or postal addresses for the contact). @@ -570,6 +672,7 @@ public class Organization extends BaseResource implements IResource { myAddress = theValue; } + /** * Gets the value(s) for gender (Gender for administrative purposes). @@ -600,6 +703,7 @@ public class Organization extends BaseResource implements IResource { myGender = theValue; } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java index 8c38c1499c3..01e0ad5346d 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Patient.java @@ -255,6 +255,12 @@ public class Patient extends BaseResource implements IResource { @Child(name="active", type=BooleanDt.class, order=16, min=0, max=1) private BooleanDt myActive; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myName, myTelecom, myGender, myBirthDate, myDeceased, myAddress, myMaritalStatus, myMultipleBirth, myPhoto, myContact, myAnimal, myCommunication, myCareProvider, myManagingOrganization, myLink, myActive); + } + /** * Gets the value(s) for identifier (An identifier for the person as this patient). * creating it if it does @@ -284,6 +290,20 @@ public class Patient extends BaseResource implements IResource { myIdentifier = theValue; } + /** + * Adds and returns a new value for identifier (An identifier for the person as this patient) + * + *

+ * Definition: + * An identifier that applies to this person as a patient + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + /** * Gets the value(s) for name (A name associated with the patient). @@ -314,6 +334,20 @@ public class Patient extends BaseResource implements IResource { myName = theValue; } + /** + * Adds and returns a new value for name (A name associated with the patient) + * + *

+ * Definition: + * A name associated with the individual. + *

+ */ + public HumanNameDt addName() { + HumanNameDt newType = new HumanNameDt(); + getName().add(newType); + return newType; + } + /** * Gets the value(s) for telecom (A contact detail for the individual). @@ -344,6 +378,20 @@ public class Patient extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (A contact detail for the individual) + * + *

+ * Definition: + * A contact detail (e.g. a telephone number or an email address) by which the individual may be contacted. + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for gender (Gender for administrative purposes). @@ -374,6 +422,7 @@ public class Patient extends BaseResource implements IResource { myGender = theValue; } + /** * Gets the value(s) for birthDate (The date and time of birth for the individual). @@ -404,8 +453,9 @@ public class Patient extends BaseResource implements IResource { myBirthDate = theValue; } + /** - * Sets the value(s) for birthDate (The date and time of birth for the individual) + * Sets the value for birthDate (The date and time of birth for the individual) * *

* Definition: @@ -415,6 +465,19 @@ public class Patient extends BaseResource implements IResource { public void setBirthDateWithSecondsPrecision( Date theDate) { myBirthDate = new DateTimeDt(theDate); } + + /** + * Sets the value for birthDate (The date and time of birth for the individual) + * + *

+ * Definition: + * The date and time of birth for the individual + *

+ */ + public void setBirthDate( Date theDate, TemporalPrecisionEnum thePrecision) { + myBirthDate = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for deceased[x] (Indicates if the individual is deceased or not). @@ -442,6 +505,7 @@ public class Patient extends BaseResource implements IResource { myDeceased = theValue; } + /** * Gets the value(s) for address (Addresses for the individual). @@ -472,6 +536,20 @@ public class Patient extends BaseResource implements IResource { myAddress = theValue; } + /** + * Adds and returns a new value for address (Addresses for the individual) + * + *

+ * Definition: + * Addresses for the individual + *

+ */ + public AddressDt addAddress() { + AddressDt newType = new AddressDt(); + getAddress().add(newType); + return newType; + } + /** * Gets the value(s) for maritalStatus (Marital (civil) status of a person). @@ -502,6 +580,7 @@ public class Patient extends BaseResource implements IResource { myMaritalStatus = theValue; } + /** * Gets the value(s) for multipleBirth[x] (Whether patient is part of a multiple birth). @@ -529,6 +608,7 @@ public class Patient extends BaseResource implements IResource { myMultipleBirth = theValue; } + /** * Gets the value(s) for photo (Image of the person). @@ -559,6 +639,20 @@ public class Patient extends BaseResource implements IResource { myPhoto = theValue; } + /** + * Adds and returns a new value for photo (Image of the person) + * + *

+ * Definition: + * Image of the person + *

+ */ + public AttachmentDt addPhoto() { + AttachmentDt newType = new AttachmentDt(); + getPhoto().add(newType); + return newType; + } + /** * Gets the value(s) for contact (A contact party (e.g. guardian, partner, friend) for the patient). @@ -589,6 +683,20 @@ public class Patient extends BaseResource implements IResource { myContact = theValue; } + /** + * Adds and returns a new value for contact (A contact party (e.g. guardian, partner, friend) for the patient) + * + *

+ * Definition: + * A contact party (e.g. guardian, partner, friend) for the patient + *

+ */ + public Contact addContact() { + Contact newType = new Contact(); + getContact().add(newType); + return newType; + } + /** * Gets the value(s) for animal (If this patient is an animal (non-human)). @@ -619,6 +727,7 @@ public class Patient extends BaseResource implements IResource { myAnimal = theValue; } + /** * Gets the value(s) for communication (Languages which may be used to communicate with the patient about his or her health). @@ -649,6 +758,20 @@ public class Patient extends BaseResource implements IResource { myCommunication = theValue; } + /** + * Adds and returns a new value for communication (Languages which may be used to communicate with the patient about his or her health) + * + *

+ * Definition: + * Languages which may be used to communicate with the patient about his or her health + *

+ */ + public CodeableConceptDt addCommunication() { + CodeableConceptDt newType = new CodeableConceptDt(); + getCommunication().add(newType); + return newType; + } + /** * Gets the value(s) for careProvider (Patient's nominated care provider). @@ -676,6 +799,7 @@ public class Patient extends BaseResource implements IResource { myCareProvider = theValue; } + /** * Gets the value(s) for managingOrganization (Organization that is the custodian of the patient record). @@ -706,6 +830,7 @@ public class Patient extends BaseResource implements IResource { myManagingOrganization = theValue; } + /** * Gets the value(s) for link (Link to another patient resource that concerns the same actual person). @@ -736,6 +861,20 @@ public class Patient extends BaseResource implements IResource { myLink = theValue; } + /** + * Adds and returns a new value for link (Link to another patient resource that concerns the same actual person) + * + *

+ * Definition: + * Link to another patient resource that concerns the same actual person + *

+ */ + public Link addLink() { + Link newType = new Link(); + getLink().add(newType); + return newType; + } + /** * Gets the value(s) for active (Whether this patient's record is in active use). @@ -766,7 +905,20 @@ public class Patient extends BaseResource implements IResource { myActive = theValue; } - + + /** + * Sets the value for active (Whether this patient's record is in active use) + * + *

+ * Definition: + * Whether this patient record is in active use + *

+ */ + public void setActive( Boolean theBoolean) { + myActive = new BooleanDt(theBoolean); + } + + /** * Block class for child element: Patient.contact (A contact party (e.g. guardian, partner, friend) for the patient) * @@ -799,6 +951,12 @@ public class Patient extends BaseResource implements IResource { }) private ResourceReference myOrganization; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myRelationship, myName, myTelecom, myAddress, myGender, myOrganization); + } + /** * Gets the value(s) for relationship (The kind of relationship). * creating it if it does @@ -828,6 +986,20 @@ public class Patient extends BaseResource implements IResource { myRelationship = theValue; } + /** + * Adds and returns a new value for relationship (The kind of relationship) + * + *

+ * Definition: + * The nature of the relationship between the patient and the contact person + *

+ */ + public CodeableConceptDt addRelationship() { + CodeableConceptDt newType = new CodeableConceptDt(); + getRelationship().add(newType); + return newType; + } + /** * Gets the value(s) for name (A name associated with the person). @@ -858,6 +1030,7 @@ public class Patient extends BaseResource implements IResource { myName = theValue; } + /** * Gets the value(s) for telecom (A contact detail for the person). @@ -888,6 +1061,20 @@ public class Patient extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (A contact detail for the person) + * + *

+ * Definition: + * A contact detail for the person, e.g. a telephone number or an email address. + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for address (Address for the contact person). @@ -918,6 +1105,7 @@ public class Patient extends BaseResource implements IResource { myAddress = theValue; } + /** * Gets the value(s) for gender (Gender for administrative purposes). @@ -948,6 +1136,7 @@ public class Patient extends BaseResource implements IResource { myGender = theValue; } + /** * Gets the value(s) for organization (Organization that is associated with the contact). @@ -978,6 +1167,7 @@ public class Patient extends BaseResource implements IResource { myOrganization = theValue; } + } @@ -1003,6 +1193,12 @@ public class Patient extends BaseResource implements IResource { @Child(name="genderStatus", type=CodeableConceptDt.class, order=2, min=0, max=1) private CodeableConceptDt myGenderStatus; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySpecies, myBreed, myGenderStatus); + } + /** * Gets the value(s) for species (E.g. Dog, Cow). * creating it if it does @@ -1032,6 +1228,7 @@ public class Patient extends BaseResource implements IResource { mySpecies = theValue; } + /** * Gets the value(s) for breed (E.g. Poodle, Angus). @@ -1062,6 +1259,7 @@ public class Patient extends BaseResource implements IResource { myBreed = theValue; } + /** * Gets the value(s) for genderStatus (E.g. Neutered, Intact). @@ -1092,6 +1290,7 @@ public class Patient extends BaseResource implements IResource { myGenderStatus = theValue; } + } @@ -1117,6 +1316,12 @@ public class Patient extends BaseResource implements IResource { @Child(name="type", type=CodeDt.class, order=1, min=1, max=1) private BoundCodeDt myType; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myOther, myType); + } + /** * Gets the value(s) for other (The other patient resource that the link refers to). * creating it if it does @@ -1146,6 +1351,7 @@ public class Patient extends BaseResource implements IResource { myOther = theValue; } + /** * Gets the value(s) for type (replace | refer | seealso - type of link). @@ -1176,6 +1382,7 @@ public class Patient extends BaseResource implements IResource { myType = theValue; } + /** * Sets the value(s) for type (replace | refer | seealso - type of link) * diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java index 778d89c0b9c..ea8358356eb 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Practitioner.java @@ -179,6 +179,12 @@ public class Practitioner extends BaseResource implements IResource { @Child(name="communication", type=CodeableConceptDt.class, order=13, min=0, max=Child.MAX_UNLIMITED) private List myCommunication; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myName, myTelecom, myAddress, myGender, myBirthDate, myPhoto, myOrganization, myRole, mySpecialty, myPeriod, myLocation, myQualification, myCommunication); + } + /** * Gets the value(s) for identifier (A identifier for the person as this agent). * creating it if it does @@ -208,6 +214,20 @@ public class Practitioner extends BaseResource implements IResource { myIdentifier = theValue; } + /** + * Adds and returns a new value for identifier (A identifier for the person as this agent) + * + *

+ * Definition: + * An identifier that applies to this person in this role + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + /** * Gets the value(s) for name (A name associated with the person). @@ -238,6 +258,7 @@ public class Practitioner extends BaseResource implements IResource { myName = theValue; } + /** * Gets the value(s) for telecom (A contact detail for the practitioner). @@ -268,6 +289,20 @@ public class Practitioner extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (A contact detail for the practitioner) + * + *

+ * Definition: + * A contact detail for the practitioner, e.g. a telephone number or an email address. + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for address (Where practitioner can be found/visited). @@ -298,6 +333,7 @@ public class Practitioner extends BaseResource implements IResource { myAddress = theValue; } + /** * Gets the value(s) for gender (Gender for administrative purposes). @@ -328,6 +364,7 @@ public class Practitioner extends BaseResource implements IResource { myGender = theValue; } + /** * Gets the value(s) for birthDate (The date and time of birth for the practitioner). @@ -358,8 +395,9 @@ public class Practitioner extends BaseResource implements IResource { myBirthDate = theValue; } + /** - * Sets the value(s) for birthDate (The date and time of birth for the practitioner) + * Sets the value for birthDate (The date and time of birth for the practitioner) * *

* Definition: @@ -369,6 +407,19 @@ public class Practitioner extends BaseResource implements IResource { public void setBirthDateWithSecondsPrecision( Date theDate) { myBirthDate = new DateTimeDt(theDate); } + + /** + * Sets the value for birthDate (The date and time of birth for the practitioner) + * + *

+ * Definition: + * The date and time of birth for the practitioner + *

+ */ + public void setBirthDate( Date theDate, TemporalPrecisionEnum thePrecision) { + myBirthDate = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for photo (Image of the person). @@ -399,6 +450,20 @@ public class Practitioner extends BaseResource implements IResource { myPhoto = theValue; } + /** + * Adds and returns a new value for photo (Image of the person) + * + *

+ * Definition: + * Image of the person + *

+ */ + public AttachmentDt addPhoto() { + AttachmentDt newType = new AttachmentDt(); + getPhoto().add(newType); + return newType; + } + /** * Gets the value(s) for organization (The represented organization). @@ -429,6 +494,7 @@ public class Practitioner extends BaseResource implements IResource { myOrganization = theValue; } + /** * Gets the value(s) for role (Roles which this practitioner may perform). @@ -459,6 +525,20 @@ public class Practitioner extends BaseResource implements IResource { myRole = theValue; } + /** + * Adds and returns a new value for role (Roles which this practitioner may perform) + * + *

+ * Definition: + * Roles which this practitioner is authorized to perform for the organization + *

+ */ + public CodeableConceptDt addRole() { + CodeableConceptDt newType = new CodeableConceptDt(); + getRole().add(newType); + return newType; + } + /** * Gets the value(s) for specialty (Specific specialty of the practitioner). @@ -489,6 +569,20 @@ public class Practitioner extends BaseResource implements IResource { mySpecialty = theValue; } + /** + * Adds and returns a new value for specialty (Specific specialty of the practitioner) + * + *

+ * Definition: + * Specific specialty of the practitioner + *

+ */ + public CodeableConceptDt addSpecialty() { + CodeableConceptDt newType = new CodeableConceptDt(); + getSpecialty().add(newType); + return newType; + } + /** * Gets the value(s) for period (The period during which the practitioner is authorized to perform in these role(s)). @@ -519,6 +613,7 @@ public class Practitioner extends BaseResource implements IResource { myPeriod = theValue; } + /** * Gets the value(s) for location (The location(s) at which this practitioner provides care). @@ -549,6 +644,7 @@ public class Practitioner extends BaseResource implements IResource { myLocation = theValue; } + /** * Gets the value(s) for qualification (Qualifications obtained by training and certification). @@ -579,6 +675,20 @@ public class Practitioner extends BaseResource implements IResource { myQualification = theValue; } + /** + * Adds and returns a new value for qualification (Qualifications obtained by training and certification) + * + *

+ * Definition: + * + *

+ */ + public Qualification addQualification() { + Qualification newType = new Qualification(); + getQualification().add(newType); + return newType; + } + /** * Gets the value(s) for communication (A language the practitioner is able to use in patient communication). @@ -609,6 +719,20 @@ public class Practitioner extends BaseResource implements IResource { myCommunication = theValue; } + /** + * Adds and returns a new value for communication (A language the practitioner is able to use in patient communication) + * + *

+ * Definition: + * A language the practitioner is able to use in patient communication + *

+ */ + public CodeableConceptDt addCommunication() { + CodeableConceptDt newType = new CodeableConceptDt(); + getCommunication().add(newType); + return newType; + } + /** * Block class for child element: Practitioner.qualification (Qualifications obtained by training and certification) @@ -633,6 +757,12 @@ public class Practitioner extends BaseResource implements IResource { }) private ResourceReference myIssuer; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myPeriod, myIssuer); + } + /** * Gets the value(s) for code (Coded representation of the qualification). * creating it if it does @@ -662,6 +792,7 @@ public class Practitioner extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for period (Period during which the qualification is valid). @@ -692,6 +823,7 @@ public class Practitioner extends BaseResource implements IResource { myPeriod = theValue; } + /** * Gets the value(s) for issuer (Organization that regulates and issues the qualification). @@ -722,6 +854,7 @@ public class Practitioner extends BaseResource implements IResource { myIssuer = theValue; } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java index 4720cb5b375..761f5f1b1c6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Profile.java @@ -199,6 +199,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="query", order=15, min=0, max=Child.MAX_UNLIMITED) private List myQuery; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myVersion, myName, myPublisher, myTelecom, myDescription, myCode, myStatus, myExperimental, myDate, myRequirements, myFhirVersion, myMapping, myStructure, myExtensionDefn, myQuery); + } + /** * Gets the value(s) for identifier (Logical id to reference this profile). * creating it if it does @@ -228,8 +234,9 @@ public class Profile extends BaseResource implements IResource { myIdentifier = theValue; } + /** - * Sets the value(s) for identifier (Logical id to reference this profile) + * Sets the value for identifier (Logical id to reference this profile) * *

* Definition: @@ -239,6 +246,7 @@ public class Profile extends BaseResource implements IResource { public void setIdentifier( String theString) { myIdentifier = new StringDt(theString); } + /** * Gets the value(s) for version (Logical id for this version of the profile). @@ -269,8 +277,9 @@ public class Profile extends BaseResource implements IResource { myVersion = theValue; } + /** - * Sets the value(s) for version (Logical id for this version of the profile) + * Sets the value for version (Logical id for this version of the profile) * *

* Definition: @@ -280,6 +289,7 @@ public class Profile extends BaseResource implements IResource { public void setVersion( String theString) { myVersion = new StringDt(theString); } + /** * Gets the value(s) for name (Informal name for this profile). @@ -310,8 +320,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Informal name for this profile) + * Sets the value for name (Informal name for this profile) * *

* Definition: @@ -321,6 +332,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for publisher (Name of the publisher (Organization or individual)). @@ -351,8 +363,9 @@ public class Profile extends BaseResource implements IResource { myPublisher = theValue; } + /** - * Sets the value(s) for publisher (Name of the publisher (Organization or individual)) + * Sets the value for publisher (Name of the publisher (Organization or individual)) * *

* Definition: @@ -362,6 +375,7 @@ public class Profile extends BaseResource implements IResource { public void setPublisher( String theString) { myPublisher = new StringDt(theString); } + /** * Gets the value(s) for telecom (Contact information of the publisher). @@ -392,6 +406,20 @@ public class Profile extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (Contact information of the publisher) + * + *

+ * Definition: + * Contact details to assist a user in finding and communicating with the publisher + *

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for description (Natural language description of the profile). @@ -422,8 +450,9 @@ public class Profile extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Natural language description of the profile) + * Sets the value for description (Natural language description of the profile) * *

* Definition: @@ -433,6 +462,7 @@ public class Profile extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for code (Assist with indexing and finding). @@ -463,6 +493,20 @@ public class Profile extends BaseResource implements IResource { myCode = theValue; } + /** + * Adds and returns a new value for code (Assist with indexing and finding) + * + *

+ * 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; + } + /** * Gets the value(s) for status (draft | active | retired). @@ -493,6 +537,7 @@ public class Profile extends BaseResource implements IResource { myStatus = theValue; } + /** * Sets the value(s) for status (draft | active | retired) * @@ -535,7 +580,20 @@ public class Profile extends BaseResource implements IResource { myExperimental = theValue; } - + + /** + * Sets the value for experimental (If for testing purposes, not real usage) + * + *

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

+ */ + public void setExperimental( Boolean theBoolean) { + myExperimental = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for date (Date for this version of the profile). * creating it if it does @@ -565,8 +623,9 @@ public class Profile extends BaseResource implements IResource { myDate = theValue; } + /** - * Sets the value(s) for date (Date for this version of the profile) + * Sets the value for date (Date for this version of the profile) * *

* Definition: @@ -576,6 +635,19 @@ public class Profile extends BaseResource implements IResource { public void setDateWithSecondsPrecision( Date theDate) { myDate = new DateTimeDt(theDate); } + + /** + * Sets the value for date (Date for this version of the profile) + * + *

+ * Definition: + * The date that this version of the profile was published + *

+ */ + public void setDate( Date theDate, TemporalPrecisionEnum thePrecision) { + myDate = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for requirements (Scope and Usage this profile is for). @@ -606,8 +678,9 @@ public class Profile extends BaseResource implements IResource { myRequirements = theValue; } + /** - * Sets the value(s) for requirements (Scope and Usage this profile is for) + * Sets the value for requirements (Scope and Usage this profile is for) * *

* Definition: @@ -617,6 +690,7 @@ public class Profile extends BaseResource implements IResource { public void setRequirements( String theString) { myRequirements = new StringDt(theString); } + /** * Gets the value(s) for fhirVersion (FHIR Version this profile targets). @@ -647,8 +721,9 @@ public class Profile extends BaseResource implements IResource { myFhirVersion = theValue; } + /** - * Sets the value(s) for fhirVersion (FHIR Version this profile targets) + * Sets the value for fhirVersion (FHIR Version this profile targets) * *

* Definition: @@ -658,6 +733,7 @@ public class Profile extends BaseResource implements IResource { public void setFhirVersion( String theId) { myFhirVersion = new IdDt(theId); } + /** * Gets the value(s) for mapping (External specification that the content is mapped to). @@ -688,6 +764,20 @@ public class Profile extends BaseResource implements IResource { myMapping = theValue; } + /** + * Adds and returns a new value for mapping (External specification that the content is mapped to) + * + *

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

+ */ + public Mapping addMapping() { + Mapping newType = new Mapping(); + getMapping().add(newType); + return newType; + } + /** * Gets the value(s) for structure (A constraint on a resource or a data type). @@ -718,6 +808,20 @@ public class Profile extends BaseResource implements IResource { myStructure = theValue; } + /** + * Adds and returns a new value for structure (A constraint on a resource or a data type) + * + *

+ * Definition: + * A constraint statement about what contents a resource or data type may have + *

+ */ + public Structure addStructure() { + Structure newType = new Structure(); + getStructure().add(newType); + return newType; + } + /** * Gets the value(s) for extensionDefn (Definition of an extension). @@ -748,6 +852,20 @@ public class Profile extends BaseResource implements IResource { myExtensionDefn = theValue; } + /** + * Adds and returns a new value for extensionDefn (Definition of an extension) + * + *

+ * Definition: + * An extension defined as part of the profile + *

+ */ + public ExtensionDefn addExtensionDefn() { + ExtensionDefn newType = new ExtensionDefn(); + getExtensionDefn().add(newType); + return newType; + } + /** * Gets the value(s) for query (Definition of a named query). @@ -778,6 +896,20 @@ public class Profile extends BaseResource implements IResource { myQuery = theValue; } + /** + * Adds and returns a new value for query (Definition of a named query) + * + *

+ * Definition: + * Definition of a named query and its parameters and their meaning + *

+ */ + public Query addQuery() { + Query newType = new Query(); + getQuery().add(newType); + return newType; + } + /** * Block class for child element: Profile.mapping (External specification that the content is mapped to) @@ -802,6 +934,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="comments", type=StringDt.class, order=3, min=0, max=1) private StringDt myComments; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentity, myUri, myName, myComments); + } + /** * Gets the value(s) for identity (Internal id when this mapping is used). * creating it if it does @@ -831,8 +969,9 @@ public class Profile extends BaseResource implements IResource { myIdentity = theValue; } + /** - * Sets the value(s) for identity (Internal id when this mapping is used) + * Sets the value for identity (Internal id when this mapping is used) * *

* Definition: @@ -842,6 +981,7 @@ public class Profile extends BaseResource implements IResource { public void setIdentity( String theId) { myIdentity = new IdDt(theId); } + /** * Gets the value(s) for uri (Identifies what this mapping refers to). @@ -872,8 +1012,9 @@ public class Profile extends BaseResource implements IResource { myUri = theValue; } + /** - * Sets the value(s) for uri (Identifies what this mapping refers to) + * Sets the value for uri (Identifies what this mapping refers to) * *

* Definition: @@ -883,6 +1024,7 @@ public class Profile extends BaseResource implements IResource { public void setUri( String theUri) { myUri = new UriDt(theUri); } + /** * Gets the value(s) for name (Names what this mapping refers to). @@ -913,8 +1055,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Names what this mapping refers to) + * Sets the value for name (Names what this mapping refers to) * *

* Definition: @@ -924,6 +1067,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for comments (Versions, Issues, Scope limitations etc). @@ -954,8 +1098,9 @@ public class Profile extends BaseResource implements IResource { myComments = theValue; } + /** - * Sets the value(s) for comments (Versions, Issues, Scope limitations etc) + * Sets the value for comments (Versions, Issues, Scope limitations etc) * *

* Definition: @@ -965,6 +1110,7 @@ public class Profile extends BaseResource implements IResource { public void setComments( String theString) { myComments = new StringDt(theString); } + } @@ -999,6 +1145,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="searchParam", order=5, min=0, max=Child.MAX_UNLIMITED) private List mySearchParam; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myType, myName, myPublish, myPurpose, myElement, mySearchParam); + } + /** * Gets the value(s) for type (The Resource or Data Type being described). * creating it if it does @@ -1028,6 +1180,7 @@ public class Profile extends BaseResource implements IResource { myType = theValue; } + /** * Sets the value(s) for type (The Resource or Data Type being described) * @@ -1070,8 +1223,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Name for this particular structure (reference target)) + * Sets the value for name (Name for this particular structure (reference target)) * *

* Definition: @@ -1081,6 +1235,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for publish (This definition is published (i.e. for validation)). @@ -1111,7 +1266,20 @@ public class Profile extends BaseResource implements IResource { myPublish = theValue; } - + + /** + * Sets the value for publish (This definition is published (i.e. for validation)) + * + *

+ * Definition: + * This definition of a profile on a structure is published as a formal statement. Some structural definitions might be defined purely for internal use within the profile, and not intended to be used outside that context + *

+ */ + public void setPublish( Boolean theBoolean) { + myPublish = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for purpose (Human summary: why describe this resource?). * creating it if it does @@ -1141,8 +1309,9 @@ public class Profile extends BaseResource implements IResource { myPurpose = theValue; } + /** - * Sets the value(s) for purpose (Human summary: why describe this resource?) + * Sets the value for purpose (Human summary: why describe this resource?) * *

* Definition: @@ -1152,6 +1321,7 @@ public class Profile extends BaseResource implements IResource { public void setPurpose( String theString) { myPurpose = new StringDt(theString); } + /** * Gets the value(s) for element (Definition of elements in the resource (if no profile)). @@ -1182,6 +1352,20 @@ public class Profile extends BaseResource implements IResource { myElement = theValue; } + /** + * Adds and returns a new value for element (Definition of elements in the resource (if no profile)) + * + *

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

+ */ + public StructureElement addElement() { + StructureElement newType = new StructureElement(); + getElement().add(newType); + return newType; + } + /** * Gets the value(s) for searchParam (Search params defined). @@ -1212,6 +1396,20 @@ public class Profile extends BaseResource implements IResource { mySearchParam = theValue; } + /** + * Adds and returns a new value for searchParam (Search params defined) + * + *

+ * Definition: + * Additional search parameters for implementations to support and/or make use of + *

+ */ + public StructureSearchParam addSearchParam() { + StructureSearchParam newType = new StructureSearchParam(); + getSearchParam().add(newType); + return newType; + } + } @@ -1242,6 +1440,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="definition", order=4, min=0, max=1) private StructureElementDefinition myDefinition; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myPath, myRepresentation, myName, mySlicing, myDefinition); + } + /** * Gets the value(s) for path (The path of the element (see the formal definitions)). * creating it if it does @@ -1271,8 +1475,9 @@ public class Profile extends BaseResource implements IResource { myPath = theValue; } + /** - * Sets the value(s) for path (The path of the element (see the formal definitions)) + * Sets the value for path (The path of the element (see the formal definitions)) * *

* Definition: @@ -1282,6 +1487,7 @@ public class Profile extends BaseResource implements IResource { public void setPath( String theString) { myPath = new StringDt(theString); } + /** * Gets the value(s) for representation (How this element is represented in instances). @@ -1312,6 +1518,7 @@ public class Profile extends BaseResource implements IResource { myRepresentation = theValue; } + /** * Add a value for representation (How this element is represented in instances) * @@ -1367,8 +1574,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Name for this particular element definition (reference target)) + * Sets the value for name (Name for this particular element definition (reference target)) * *

* Definition: @@ -1378,6 +1586,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for slicing (This element is sliced - slices follow). @@ -1408,6 +1617,7 @@ public class Profile extends BaseResource implements IResource { mySlicing = theValue; } + /** * Gets the value(s) for definition (More specific definition of the element ). @@ -1438,6 +1648,7 @@ public class Profile extends BaseResource implements IResource { myDefinition = theValue; } + } @@ -1462,6 +1673,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="rules", type=CodeDt.class, order=2, min=1, max=1) private BoundCodeDt myRules; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myDiscriminator, myOrdered, myRules); + } + /** * Gets the value(s) for discriminator (Element that used to distinguish the slices). * creating it if it does @@ -1491,8 +1708,9 @@ public class Profile extends BaseResource implements IResource { myDiscriminator = theValue; } + /** - * Sets the value(s) for discriminator (Element that used to distinguish the slices) + * Sets the value for discriminator (Element that used to distinguish the slices) * *

* Definition: @@ -1502,6 +1720,7 @@ public class Profile extends BaseResource implements IResource { public void setDiscriminator( String theId) { myDiscriminator = new IdDt(theId); } + /** * Gets the value(s) for ordered (If elements must be in same order as slices). @@ -1532,7 +1751,20 @@ public class Profile extends BaseResource implements IResource { myOrdered = theValue; } - + + /** + * Sets the value for ordered (If elements must be in same order as slices) + * + *

+ * Definition: + * If the matching elements have to occur in the same order as defined in the profile + *

+ */ + public void setOrdered( Boolean theBoolean) { + myOrdered = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for rules (closed | open | openAtEnd). * creating it if it does @@ -1562,6 +1794,7 @@ public class Profile extends BaseResource implements IResource { myRules = theValue; } + /** * Sets the value(s) for rules (closed | open | openAtEnd) * @@ -1644,6 +1877,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="mapping", order=17, min=0, max=Child.MAX_UNLIMITED) private List myMapping; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myShort, myFormal, myComments, myRequirements, mySynonym, myMin, myMax, myType, myNameReference, myValue, myExample, myMaxLength, myCondition, myConstraint, myMustSupport, myIsModifier, myBinding, myMapping); + } + /** * Gets the value(s) for short (Concise definition for xml presentation). * creating it if it does @@ -1673,8 +1912,9 @@ public class Profile extends BaseResource implements IResource { myShort = theValue; } + /** - * Sets the value(s) for short (Concise definition for xml presentation) + * Sets the value for short (Concise definition for xml presentation) * *

* Definition: @@ -1684,6 +1924,7 @@ public class Profile extends BaseResource implements IResource { public void setShort( String theString) { myShort = new StringDt(theString); } + /** * Gets the value(s) for formal (Full formal definition in human language). @@ -1714,8 +1955,9 @@ public class Profile extends BaseResource implements IResource { myFormal = theValue; } + /** - * Sets the value(s) for formal (Full formal definition in human language) + * Sets the value for formal (Full formal definition in human language) * *

* Definition: @@ -1725,6 +1967,7 @@ public class Profile extends BaseResource implements IResource { public void setFormal( String theString) { myFormal = new StringDt(theString); } + /** * Gets the value(s) for comments (Comments about the use of this element). @@ -1755,8 +1998,9 @@ public class Profile extends BaseResource implements IResource { myComments = theValue; } + /** - * Sets the value(s) for comments (Comments about the use of this element) + * Sets the value for comments (Comments about the use of this element) * *

* Definition: @@ -1766,6 +2010,7 @@ public class Profile extends BaseResource implements IResource { public void setComments( String theString) { myComments = new StringDt(theString); } + /** * Gets the value(s) for requirements (Why is this needed?). @@ -1796,8 +2041,9 @@ public class Profile extends BaseResource implements IResource { myRequirements = theValue; } + /** - * Sets the value(s) for requirements (Why is this needed?) + * Sets the value for requirements (Why is this needed?) * *

* Definition: @@ -1807,6 +2053,7 @@ public class Profile extends BaseResource implements IResource { public void setRequirements( String theString) { myRequirements = new StringDt(theString); } + /** * Gets the value(s) for synonym (Other names). @@ -1837,8 +2084,22 @@ public class Profile extends BaseResource implements IResource { mySynonym = theValue; } + /** + * Adds and returns a new value for synonym (Other names) + * + *

+ * Definition: + * Identifies additional names by which this element might also be known + *

+ */ + public StringDt addSynonym() { + StringDt newType = new StringDt(); + getSynonym().add(newType); + return newType; + } + /** - * Sets the value(s) for synonym (Other names) + * Adds a new value for synonym (Other names) * *

* Definition: @@ -1851,6 +2112,7 @@ public class Profile extends BaseResource implements IResource { } mySynonym.add(new StringDt(theString)); } + /** * Gets the value(s) for min (Minimum Cardinality). @@ -1881,7 +2143,20 @@ public class Profile extends BaseResource implements IResource { myMin = theValue; } - + + /** + * Sets the value for min (Minimum Cardinality) + * + *

+ * Definition: + * The minimum number of times this element SHALL appear in the instance + *

+ */ + public void setMin( Integer theInteger) { + myMin = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for max (Maximum Cardinality (a number or *)). * creating it if it does @@ -1911,8 +2186,9 @@ public class Profile extends BaseResource implements IResource { myMax = theValue; } + /** - * Sets the value(s) for max (Maximum Cardinality (a number or *)) + * Sets the value for max (Maximum Cardinality (a number or *)) * *

* Definition: @@ -1922,6 +2198,7 @@ public class Profile extends BaseResource implements IResource { public void setMax( String theString) { myMax = new StringDt(theString); } + /** * Gets the value(s) for type (Data type and Profile for this element). @@ -1952,6 +2229,20 @@ public class Profile extends BaseResource implements IResource { myType = theValue; } + /** + * Adds and returns a new value for type (Data type and Profile for this element) + * + *

+ * Definition: + * The data type or resource that the value of this element is permitted to be + *

+ */ + public StructureElementDefinitionType addType() { + StructureElementDefinitionType newType = new StructureElementDefinitionType(); + getType().add(newType); + return newType; + } + /** * Gets the value(s) for nameReference (To another element constraint (by element.name)). @@ -1982,8 +2273,9 @@ public class Profile extends BaseResource implements IResource { myNameReference = theValue; } + /** - * Sets the value(s) for nameReference (To another element constraint (by element.name)) + * Sets the value for nameReference (To another element constraint (by element.name)) * *

* Definition: @@ -1993,6 +2285,7 @@ public class Profile extends BaseResource implements IResource { public void setNameReference( String theString) { myNameReference = new StringDt(theString); } + /** * Gets the value(s) for value[x] (Fixed value: [as defined for a primitive type]). @@ -2020,6 +2313,7 @@ public class Profile extends BaseResource implements IResource { myValue = theValue; } + /** * Gets the value(s) for example[x] (Example value: [as defined for type]). @@ -2047,6 +2341,7 @@ public class Profile extends BaseResource implements IResource { myExample = theValue; } + /** * Gets the value(s) for maxLength (Length for strings). @@ -2077,7 +2372,20 @@ public class Profile extends BaseResource implements IResource { myMaxLength = theValue; } - + + /** + * Sets the value for maxLength (Length for strings) + * + *

+ * Definition: + * Indicates the shortest length that SHALL be supported by conformant instances without truncation + *

+ */ + public void setMaxLength( Integer theInteger) { + myMaxLength = new IntegerDt(theInteger); + } + + /** * Gets the value(s) for condition (Reference to invariant about presence). * creating it if it does @@ -2107,8 +2415,22 @@ public class Profile extends BaseResource implements IResource { myCondition = theValue; } + /** + * Adds and returns a new value for condition (Reference to invariant about presence) + * + *

+ * Definition: + * A reference to an invariant that may make additional statements about the cardinality or value in the instance + *

+ */ + public IdDt addCondition() { + IdDt newType = new IdDt(); + getCondition().add(newType); + return newType; + } + /** - * Sets the value(s) for condition (Reference to invariant about presence) + * Adds a new value for condition (Reference to invariant about presence) * *

* Definition: @@ -2121,6 +2443,7 @@ public class Profile extends BaseResource implements IResource { } myCondition.add(new IdDt(theId)); } + /** * Gets the value(s) for constraint (Condition that must evaluate to true). @@ -2151,6 +2474,20 @@ public class Profile extends BaseResource implements IResource { myConstraint = theValue; } + /** + * Adds and returns a new value for constraint (Condition that must evaluate to true) + * + *

+ * Definition: + * Formal constraints such as co-occurrence and other constraints that can be computationally evaluated within the context of the instance + *

+ */ + public StructureElementDefinitionConstraint addConstraint() { + StructureElementDefinitionConstraint newType = new StructureElementDefinitionConstraint(); + getConstraint().add(newType); + return newType; + } + /** * Gets the value(s) for mustSupport (If the element must supported). @@ -2181,7 +2518,20 @@ public class Profile extends BaseResource implements IResource { myMustSupport = theValue; } - + + /** + * Sets the value for mustSupport (If the element must supported) + * + *

+ * Definition: + * If true, conformant resource authors SHALL be capable of providing a value for the element and resource consumers SHALL be capable of extracting and doing something useful with the data element. If false, the element may be ignored and not supported + *

+ */ + public void setMustSupport( Boolean theBoolean) { + myMustSupport = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for isModifier (If this modifies the meaning of other elements). * creating it if it does @@ -2211,7 +2561,20 @@ public class Profile extends BaseResource implements IResource { myIsModifier = theValue; } - + + /** + * Sets the value for isModifier (If this modifies the meaning of other elements) + * + *

+ * Definition: + * If true, the value of this element affects the interpretation of the element or resource that contains it, and the value of the element cannot be ignored. Typically, this is used for status, negation and qualification codes. The effect of this is that the element cannot be ignored by systems: they SHALL either recognize the element and process it, and/or a pre-determination has been made that it is not relevant to their particular system. + *

+ */ + public void setIsModifier( Boolean theBoolean) { + myIsModifier = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for binding (ValueSet details if this is coded). * creating it if it does @@ -2241,6 +2604,7 @@ public class Profile extends BaseResource implements IResource { myBinding = theValue; } + /** * Gets the value(s) for mapping (Map element to another set of definitions). @@ -2271,6 +2635,20 @@ public class Profile extends BaseResource implements IResource { myMapping = theValue; } + /** + * Adds and returns a new value for mapping (Map element to another set of definitions) + * + *

+ * Definition: + * Identifies a concept from an external specification that roughly corresponds to this element + *

+ */ + public StructureElementDefinitionMapping addMapping() { + StructureElementDefinitionMapping newType = new StructureElementDefinitionMapping(); + getMapping().add(newType); + return newType; + } + } @@ -2295,6 +2673,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="aggregation", type=CodeDt.class, order=2, min=0, max=Child.MAX_UNLIMITED) private List> myAggregation; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myProfile, myAggregation); + } + /** * Gets the value(s) for code (Name of Data type or Resource). * creating it if it does @@ -2324,6 +2708,7 @@ public class Profile extends BaseResource implements IResource { myCode = theValue; } + /** * Sets the value(s) for code (Name of Data type or Resource) * @@ -2366,8 +2751,9 @@ public class Profile extends BaseResource implements IResource { myProfile = theValue; } + /** - * Sets the value(s) for profile (Profile.structure to apply) + * Sets the value for profile (Profile.structure to apply) * *

* Definition: @@ -2377,6 +2763,7 @@ public class Profile extends BaseResource implements IResource { public void setProfile( String theUri) { myProfile = new UriDt(theUri); } + /** * Gets the value(s) for aggregation (contained | referenced | bundled - how aggregated). @@ -2407,6 +2794,7 @@ public class Profile extends BaseResource implements IResource { myAggregation = theValue; } + /** * Add a value for aggregation (contained | referenced | bundled - how aggregated) * @@ -2463,6 +2851,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="xpath", type=StringDt.class, order=4, min=1, max=1) private StringDt myXpath; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myKey, myName, mySeverity, myHuman, myXpath); + } + /** * Gets the value(s) for key (Target of 'condition' reference above). * creating it if it does @@ -2492,8 +2886,9 @@ public class Profile extends BaseResource implements IResource { myKey = theValue; } + /** - * Sets the value(s) for key (Target of 'condition' reference above) + * Sets the value for key (Target of 'condition' reference above) * *

* Definition: @@ -2503,6 +2898,7 @@ public class Profile extends BaseResource implements IResource { public void setKey( String theId) { myKey = new IdDt(theId); } + /** * Gets the value(s) for name (Short human label). @@ -2533,8 +2929,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Short human label) + * Sets the value for name (Short human label) * *

* Definition: @@ -2544,6 +2941,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for severity (error | warning). @@ -2574,6 +2972,7 @@ public class Profile extends BaseResource implements IResource { mySeverity = theValue; } + /** * Sets the value(s) for severity (error | warning) * @@ -2616,8 +3015,9 @@ public class Profile extends BaseResource implements IResource { myHuman = theValue; } + /** - * Sets the value(s) for human (Human description of constraint) + * Sets the value for human (Human description of constraint) * *

* Definition: @@ -2627,6 +3027,7 @@ public class Profile extends BaseResource implements IResource { public void setHuman( String theString) { myHuman = new StringDt(theString); } + /** * Gets the value(s) for xpath (XPath expression of constraint). @@ -2657,8 +3058,9 @@ public class Profile extends BaseResource implements IResource { myXpath = theValue; } + /** - * Sets the value(s) for xpath (XPath expression of constraint) + * Sets the value for xpath (XPath expression of constraint) * *

* Definition: @@ -2668,6 +3070,7 @@ public class Profile extends BaseResource implements IResource { public void setXpath( String theString) { myXpath = new StringDt(theString); } + } @@ -2702,6 +3105,12 @@ public class Profile extends BaseResource implements IResource { })) private IDatatype myReference; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myIsExtensible, myConformance, myDescription, myReference); + } + /** * Gets the value(s) for name (Descriptive Name). * creating it if it does @@ -2731,8 +3140,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Descriptive Name) + * Sets the value for name (Descriptive Name) * *

* Definition: @@ -2742,6 +3152,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for isExtensible (Can additional codes be used?). @@ -2772,7 +3183,20 @@ public class Profile extends BaseResource implements IResource { myIsExtensible = theValue; } - + + /** + * Sets the value for isExtensible (Can additional codes be used?) + * + *

+ * Definition: + * If true, then conformant systems may use additional codes or (where the data type permits) text alone to convey concepts not covered by the set of codes identified in the binding. If false, then conformant systems are constrained to the provided codes alone + *

+ */ + public void setIsExtensible( Boolean theBoolean) { + myIsExtensible = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for conformance (required | preferred | example). * creating it if it does @@ -2802,6 +3226,7 @@ public class Profile extends BaseResource implements IResource { myConformance = theValue; } + /** * Sets the value(s) for conformance (required | preferred | example) * @@ -2844,8 +3269,9 @@ public class Profile extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Human explanation of the value set) + * Sets the value for description (Human explanation of the value set) * *

* Definition: @@ -2855,6 +3281,7 @@ public class Profile extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for reference[x] (Source of value set). @@ -2882,6 +3309,7 @@ public class Profile extends BaseResource implements IResource { myReference = theValue; } + } @@ -2904,6 +3332,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="map", type=StringDt.class, order=1, min=1, max=1) private StringDt myMap; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentity, myMap); + } + /** * Gets the value(s) for identity (Reference to mapping declaration). * creating it if it does @@ -2933,8 +3367,9 @@ public class Profile extends BaseResource implements IResource { myIdentity = theValue; } + /** - * Sets the value(s) for identity (Reference to mapping declaration) + * Sets the value for identity (Reference to mapping declaration) * *

* Definition: @@ -2944,6 +3379,7 @@ public class Profile extends BaseResource implements IResource { public void setIdentity( String theId) { myIdentity = new IdDt(theId); } + /** * Gets the value(s) for map (Details of the mapping). @@ -2974,8 +3410,9 @@ public class Profile extends BaseResource implements IResource { myMap = theValue; } + /** - * Sets the value(s) for map (Details of the mapping) + * Sets the value for map (Details of the mapping) * *

* Definition: @@ -2985,6 +3422,7 @@ public class Profile extends BaseResource implements IResource { public void setMap( String theString) { myMap = new StringDt(theString); } + } @@ -3018,6 +3456,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="target", type=CodeDt.class, order=4, min=0, max=Child.MAX_UNLIMITED) private List> myTarget; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myType, myDocumentation, myXpath, myTarget); + } + /** * Gets the value(s) for name (Name of search parameter). * creating it if it does @@ -3047,8 +3491,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Name of search parameter) + * Sets the value for name (Name of search parameter) * *

* Definition: @@ -3058,6 +3503,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for type (number | date | string | token | reference | composite | quantity). @@ -3088,6 +3534,7 @@ public class Profile extends BaseResource implements IResource { myType = theValue; } + /** * Sets the value(s) for type (number | date | string | token | reference | composite | quantity) * @@ -3130,8 +3577,9 @@ public class Profile extends BaseResource implements IResource { myDocumentation = theValue; } + /** - * Sets the value(s) for documentation (Contents and meaning of search parameter) + * Sets the value for documentation (Contents and meaning of search parameter) * *

* Definition: @@ -3141,6 +3589,7 @@ public class Profile extends BaseResource implements IResource { public void setDocumentation( String theString) { myDocumentation = new StringDt(theString); } + /** * Gets the value(s) for xpath (XPath that extracts the parameter set). @@ -3171,8 +3620,9 @@ public class Profile extends BaseResource implements IResource { myXpath = theValue; } + /** - * Sets the value(s) for xpath (XPath that extracts the parameter set) + * Sets the value for xpath (XPath that extracts the parameter set) * *

* Definition: @@ -3182,6 +3632,7 @@ public class Profile extends BaseResource implements IResource { public void setXpath( String theString) { myXpath = new StringDt(theString); } + /** * Gets the value(s) for target (Types of resource (if a resource reference)). @@ -3212,6 +3663,7 @@ public class Profile extends BaseResource implements IResource { myTarget = theValue; } + /** * Add a value for target (Types of resource (if a resource reference)) * @@ -3269,6 +3721,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="definition", type=StructureElementDefinition.class, order=4, min=1, max=1) private StructureElementDefinition myDefinition; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myDisplay, myContextType, myContext, myDefinition); + } + /** * Gets the value(s) for code (Identifies the extension in this profile). * creating it if it does @@ -3298,6 +3756,7 @@ public class Profile extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for display (Use this name when displaying the value). @@ -3328,8 +3787,9 @@ public class Profile extends BaseResource implements IResource { myDisplay = theValue; } + /** - * Sets the value(s) for display (Use this name when displaying the value) + * Sets the value for display (Use this name when displaying the value) * *

* Definition: @@ -3339,6 +3799,7 @@ public class Profile extends BaseResource implements IResource { public void setDisplay( String theString) { myDisplay = new StringDt(theString); } + /** * Gets the value(s) for contextType (resource | datatype | mapping | extension). @@ -3369,6 +3830,7 @@ public class Profile extends BaseResource implements IResource { myContextType = theValue; } + /** * Sets the value(s) for contextType (resource | datatype | mapping | extension) * @@ -3411,8 +3873,22 @@ public class Profile extends BaseResource implements IResource { myContext = theValue; } + /** + * Adds and returns a new value for context (Where the extension can be used in instances) + * + *

+ * 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; + } + /** - * Sets the value(s) for context (Where the extension can be used in instances) + * Adds a new value for context (Where the extension can be used in instances) * *

* Definition: @@ -3425,6 +3901,7 @@ public class Profile extends BaseResource implements IResource { } myContext.add(new StringDt(theString)); } + /** * Gets the value(s) for definition (Definition of the extension and its content). @@ -3455,6 +3932,7 @@ public class Profile extends BaseResource implements IResource { myDefinition = theValue; } + } @@ -3480,6 +3958,12 @@ public class Profile extends BaseResource implements IResource { @Child(name="parameter", type=StructureSearchParam.class, order=2, min=0, max=Child.MAX_UNLIMITED) private List myParameter; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myName, myDocumentation, myParameter); + } + /** * Gets the value(s) for name (Special named queries (_query=)). * creating it if it does @@ -3509,8 +3993,9 @@ public class Profile extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Special named queries (_query=)) + * Sets the value for name (Special named queries (_query=)) * *

* Definition: @@ -3520,6 +4005,7 @@ public class Profile extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for documentation (Describes the named query). @@ -3550,8 +4036,9 @@ public class Profile extends BaseResource implements IResource { myDocumentation = theValue; } + /** - * Sets the value(s) for documentation (Describes the named query) + * Sets the value for documentation (Describes the named query) * *

* Definition: @@ -3561,6 +4048,7 @@ public class Profile extends BaseResource implements IResource { public void setDocumentation( String theString) { myDocumentation = new StringDt(theString); } + /** * Gets the value(s) for parameter (Parameter for the named query). @@ -3591,6 +4079,20 @@ public class Profile extends BaseResource implements IResource { myParameter = theValue; } + /** + * Adds and returns a new value for parameter (Parameter for the named query) + * + *

+ * Definition: + * A parameter of a named query + *

+ */ + public StructureSearchParam addParameter() { + StructureSearchParam newType = new StructureSearchParam(); + getParameter().add(newType); + return newType; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java index 03434454f38..c8c75eb925f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Specimen.java @@ -84,6 +84,12 @@ public class Specimen extends BaseResource implements IResource { @Child(name="container", order=8, min=0, max=Child.MAX_UNLIMITED) private List myContainer; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myType, mySource, mySubject, myAccessionIdentifier, myReceivedTime, myCollection, myTreatment, myContainer); + } + /** * Gets the value(s) for identifier (External Identifier). * creating it if it does @@ -113,6 +119,20 @@ public class Specimen extends BaseResource implements IResource { myIdentifier = theValue; } + /** + * Adds and returns a new value for identifier (External Identifier) + * + *

+ * Definition: + * Id for specimen + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + /** * Gets the value(s) for type (Kind of material that forms the specimen). @@ -143,6 +163,7 @@ public class Specimen extends BaseResource implements IResource { myType = theValue; } + /** * Gets the value(s) for source (Parent of specimen). @@ -173,6 +194,20 @@ public class Specimen extends BaseResource implements IResource { mySource = theValue; } + /** + * Adds and returns a new value for source (Parent of specimen) + * + *

+ * Definition: + * Parent specimen from which the focal specimen was a component + *

+ */ + public Source addSource() { + Source newType = new Source(); + getSource().add(newType); + return newType; + } + /** * Gets the value(s) for subject (Where the specimen came from. This may be the patient(s) or from the environment or a device). @@ -200,6 +235,7 @@ public class Specimen extends BaseResource implements IResource { mySubject = theValue; } + /** * Gets the value(s) for accessionIdentifier (Identifier assigned by the lab). @@ -230,6 +266,7 @@ public class Specimen extends BaseResource implements IResource { myAccessionIdentifier = theValue; } + /** * Gets the value(s) for receivedTime (The time when specimen was received for processing). @@ -260,8 +297,9 @@ public class Specimen extends BaseResource implements IResource { myReceivedTime = theValue; } + /** - * Sets the value(s) for receivedTime (The time when specimen was received for processing) + * Sets the value for receivedTime (The time when specimen was received for processing) * *

* Definition: @@ -271,6 +309,19 @@ public class Specimen extends BaseResource implements IResource { public void setReceivedTimeWithSecondsPrecision( Date theDate) { myReceivedTime = new DateTimeDt(theDate); } + + /** + * Sets the value for receivedTime (The time when specimen was received for processing) + * + *

+ * Definition: + * Time when specimen was received for processing or testing + *

+ */ + public void setReceivedTime( Date theDate, TemporalPrecisionEnum thePrecision) { + myReceivedTime = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for collection (Collection details). @@ -301,6 +352,7 @@ public class Specimen extends BaseResource implements IResource { myCollection = theValue; } + /** * Gets the value(s) for treatment (Treatment and processing step details). @@ -331,6 +383,20 @@ public class Specimen extends BaseResource implements IResource { myTreatment = theValue; } + /** + * Adds and returns a new value for treatment (Treatment and processing step details) + * + *

+ * Definition: + * Details concerning treatment and processing steps for the specimen + *

+ */ + public Treatment addTreatment() { + Treatment newType = new Treatment(); + getTreatment().add(newType); + return newType; + } + /** * Gets the value(s) for container (Direct container of specimen (tube/slide, etc)). @@ -361,6 +427,20 @@ public class Specimen extends BaseResource implements IResource { myContainer = theValue; } + /** + * Adds and returns a new value for container (Direct container of specimen (tube/slide, etc)) + * + *

+ * Definition: + * The container holding the specimen. The recursive nature of containers; i.e. blood in tube in tray in rack is not addressed here. + *

+ */ + public Container addContainer() { + Container newType = new Container(); + getContainer().add(newType); + return newType; + } + /** * Block class for child element: Specimen.source (Parent of specimen) @@ -382,6 +462,12 @@ public class Specimen extends BaseResource implements IResource { }) private List myTarget; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myRelationship, myTarget); + } + /** * Gets the value(s) for relationship (parent | child). * creating it if it does @@ -411,6 +497,7 @@ public class Specimen extends BaseResource implements IResource { myRelationship = theValue; } + /** * Sets the value(s) for relationship (parent | child) * @@ -453,6 +540,7 @@ public class Specimen extends BaseResource implements IResource { myTarget = theValue; } + } @@ -493,6 +581,12 @@ public class Specimen extends BaseResource implements IResource { @Child(name="sourceSite", type=CodeableConceptDt.class, order=5, min=0, max=1) private CodeableConceptDt mySourceSite; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCollector, myComment, myCollected, myQuantity, myMethod, mySourceSite); + } + /** * Gets the value(s) for collector (Who collected the specimen). * creating it if it does @@ -522,6 +616,7 @@ public class Specimen extends BaseResource implements IResource { myCollector = theValue; } + /** * Gets the value(s) for comment (Collector comments). @@ -552,8 +647,22 @@ public class Specimen extends BaseResource implements IResource { myComment = theValue; } + /** + * Adds and returns a new value for comment (Collector comments) + * + *

+ * Definition: + * To communicate any details or issues encountered during the specimen collection procedure. + *

+ */ + public StringDt addComment() { + StringDt newType = new StringDt(); + getComment().add(newType); + return newType; + } + /** - * Sets the value(s) for comment (Collector comments) + * Adds a new value for comment (Collector comments) * *

* Definition: @@ -566,6 +675,7 @@ public class Specimen extends BaseResource implements IResource { } myComment.add(new StringDt(theString)); } + /** * Gets the value(s) for collected[x] (Collection time). @@ -593,6 +703,7 @@ public class Specimen extends BaseResource implements IResource { myCollected = theValue; } + /** * Gets the value(s) for quantity (The quantity of specimen collected). @@ -623,6 +734,7 @@ public class Specimen extends BaseResource implements IResource { myQuantity = theValue; } + /** * Gets the value(s) for method (Technique used to perform collection). @@ -653,6 +765,7 @@ public class Specimen extends BaseResource implements IResource { myMethod = theValue; } + /** * Gets the value(s) for sourceSite (Anatomical collection site). @@ -683,6 +796,7 @@ public class Specimen extends BaseResource implements IResource { mySourceSite = theValue; } + } @@ -711,6 +825,12 @@ public class Specimen extends BaseResource implements IResource { }) private List myAdditive; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myDescription, myProcedure, myAdditive); + } + /** * Gets the value(s) for description (Textual description of procedure). * creating it if it does @@ -740,8 +860,9 @@ public class Specimen extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Textual description of procedure) + * Sets the value for description (Textual description of procedure) * *

* Definition: @@ -751,6 +872,7 @@ public class Specimen extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for procedure (Indicates the treatment or processing step applied to the specimen). @@ -781,6 +903,7 @@ public class Specimen extends BaseResource implements IResource { myProcedure = theValue; } + /** * Gets the value(s) for additive (Material used in the processing step). @@ -811,6 +934,7 @@ public class Specimen extends BaseResource implements IResource { myAdditive = theValue; } + } @@ -848,6 +972,12 @@ public class Specimen extends BaseResource implements IResource { }) private ResourceReference myAdditive; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myDescription, myType, myCapacity, mySpecimenQuantity, myAdditive); + } + /** * Gets the value(s) for identifier (Id for the container). * creating it if it does @@ -877,6 +1007,20 @@ public class Specimen extends BaseResource implements IResource { myIdentifier = theValue; } + /** + * Adds and returns a new value for identifier (Id for the container) + * + *

+ * Definition: + * Id for container. There may be multiple; a manufacturer's bar code, lab assigned identifier, etc. The container ID may differ from the specimen id in some circumstances + *

+ */ + public IdentifierDt addIdentifier() { + IdentifierDt newType = new IdentifierDt(); + getIdentifier().add(newType); + return newType; + } + /** * Gets the value(s) for description (Textual description of the container). @@ -907,8 +1051,9 @@ public class Specimen extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Textual description of the container) + * Sets the value for description (Textual description of the container) * *

* Definition: @@ -918,6 +1063,7 @@ public class Specimen extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for type (Kind of container directly associated with specimen). @@ -948,6 +1094,7 @@ public class Specimen extends BaseResource implements IResource { myType = theValue; } + /** * Gets the value(s) for capacity (Container volume or size). @@ -978,6 +1125,7 @@ public class Specimen extends BaseResource implements IResource { myCapacity = theValue; } + /** * Gets the value(s) for specimenQuantity (Quantity of specimen within container). @@ -1008,6 +1156,7 @@ public class Specimen extends BaseResource implements IResource { mySpecimenQuantity = theValue; } + /** * Gets the value(s) for additive (Additive associated with container ). @@ -1038,6 +1187,7 @@ public class Specimen extends BaseResource implements IResource { myAdditive = theValue; } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java index 3a30000677b..fd9f00d2c38 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/Substance.java @@ -103,6 +103,12 @@ public class Substance extends BaseResource implements IResource { @Child(name="ingredient", order=3, min=0, max=Child.MAX_UNLIMITED) private List myIngredient; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myType, myDescription, myInstance, myIngredient); + } + /** * Gets the value(s) for type (What kind of substance this is). * creating it if it does @@ -132,6 +138,7 @@ public class Substance extends BaseResource implements IResource { myType = theValue; } + /** * Gets the value(s) for description (Textual description of the substance, comments). @@ -162,8 +169,9 @@ public class Substance extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Textual description of the substance, comments) + * Sets the value for description (Textual description of the substance, comments) * *

* Definition: @@ -173,6 +181,7 @@ public class Substance extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for instance (If this describes a specific package/container of the substance). @@ -203,6 +212,7 @@ public class Substance extends BaseResource implements IResource { myInstance = theValue; } + /** * Gets the value(s) for ingredient (Composition information about the substance). @@ -233,6 +243,20 @@ public class Substance extends BaseResource implements IResource { myIngredient = theValue; } + /** + * Adds and returns a new value for ingredient (Composition information about the substance) + * + *

+ * Definition: + * A substance can be composed of other substances + *

+ */ + public Ingredient addIngredient() { + Ingredient newType = new Ingredient(); + getIngredient().add(newType); + return newType; + } + /** * Block class for child element: Substance.instance (If this describes a specific package/container of the substance) @@ -254,6 +278,12 @@ public class Substance extends BaseResource implements IResource { @Child(name="quantity", type=QuantityDt.class, order=2, min=0, max=1) private QuantityDt myQuantity; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myExpiry, myQuantity); + } + /** * Gets the value(s) for identifier (Identifier of the package/container). * creating it if it does @@ -283,6 +313,7 @@ public class Substance extends BaseResource implements IResource { myIdentifier = theValue; } + /** * Gets the value(s) for expiry (When no longer valid to use). @@ -313,8 +344,9 @@ public class Substance extends BaseResource implements IResource { myExpiry = theValue; } + /** - * Sets the value(s) for expiry (When no longer valid to use) + * Sets the value for expiry (When no longer valid to use) * *

* Definition: @@ -324,6 +356,19 @@ public class Substance extends BaseResource implements IResource { public void setExpiryWithSecondsPrecision( Date theDate) { myExpiry = new DateTimeDt(theDate); } + + /** + * Sets the value for expiry (When no longer valid to use) + * + *

+ * Definition: + * When the substance is no longer valid to use. For some substances, a single arbitrary date is used for expiry. + *

+ */ + public void setExpiry( Date theDate, TemporalPrecisionEnum thePrecision) { + myExpiry = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for quantity (Amount of substance in the package). @@ -354,6 +399,7 @@ public class Substance extends BaseResource implements IResource { myQuantity = theValue; } + } @@ -379,6 +425,12 @@ public class Substance extends BaseResource implements IResource { }) private ResourceReference mySubstance; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myQuantity, mySubstance); + } + /** * Gets the value(s) for quantity (Optional amount (concentration)). * creating it if it does @@ -408,6 +460,7 @@ public class Substance extends BaseResource implements IResource { myQuantity = theValue; } + /** * Gets the value(s) for substance (A component of the substance). @@ -438,6 +491,7 @@ public class Substance extends BaseResource implements IResource { mySubstance = theValue; } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java index a0eaf71632c..54c2f92ce2b 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/dstu/resource/ValueSet.java @@ -193,6 +193,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="expansion", order=13, min=0, max=1) private Expansion myExpansion; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myVersion, myName, myPublisher, myTelecom, myDescription, myCopyright, myStatus, myExperimental, myExtensible, myDate, myDefine, myCompose, myExpansion); + } + /** * Gets the value(s) for identifier (Logical id to reference this value set). * creating it if it does @@ -222,8 +228,9 @@ public class ValueSet extends BaseResource implements IResource { myIdentifier = theValue; } + /** - * Sets the value(s) for identifier (Logical id to reference this value set) + * Sets the value for identifier (Logical id to reference this value set) * *

* Definition: @@ -233,6 +240,7 @@ public class ValueSet extends BaseResource implements IResource { public void setIdentifier( String theString) { myIdentifier = new StringDt(theString); } + /** * Gets the value(s) for version (Logical id for this version of the value set). @@ -263,8 +271,9 @@ public class ValueSet extends BaseResource implements IResource { myVersion = theValue; } + /** - * Sets the value(s) for version (Logical id for this version of the value set) + * Sets the value for version (Logical id for this version of the value set) * *

* Definition: @@ -274,6 +283,7 @@ public class ValueSet extends BaseResource implements IResource { public void setVersion( String theString) { myVersion = new StringDt(theString); } + /** * Gets the value(s) for name (Informal name for this value set). @@ -304,8 +314,9 @@ public class ValueSet extends BaseResource implements IResource { myName = theValue; } + /** - * Sets the value(s) for name (Informal name for this value set) + * Sets the value for name (Informal name for this value set) * *

* Definition: @@ -315,6 +326,7 @@ public class ValueSet extends BaseResource implements IResource { public void setName( String theString) { myName = new StringDt(theString); } + /** * Gets the value(s) for publisher (Name of the publisher (Organization or individual)). @@ -345,8 +357,9 @@ public class ValueSet extends BaseResource implements IResource { myPublisher = theValue; } + /** - * Sets the value(s) for publisher (Name of the publisher (Organization or individual)) + * Sets the value for publisher (Name of the publisher (Organization or individual)) * *

* Definition: @@ -356,6 +369,7 @@ public class ValueSet extends BaseResource implements IResource { public void setPublisher( String theString) { myPublisher = new StringDt(theString); } + /** * Gets the value(s) for telecom (Contact information of the publisher). @@ -386,6 +400,20 @@ public class ValueSet extends BaseResource implements IResource { myTelecom = theValue; } + /** + * Adds and returns a new value for telecom (Contact information of the publisher) + * + *

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

+ */ + public ContactDt addTelecom() { + ContactDt newType = new ContactDt(); + getTelecom().add(newType); + return newType; + } + /** * Gets the value(s) for description (Human language description of the value set). @@ -416,8 +444,9 @@ public class ValueSet extends BaseResource implements IResource { myDescription = theValue; } + /** - * Sets the value(s) for description (Human language description of the value set) + * Sets the value for description (Human language description of the value set) * *

* Definition: @@ -427,6 +456,7 @@ public class ValueSet extends BaseResource implements IResource { public void setDescription( String theString) { myDescription = new StringDt(theString); } + /** * Gets the value(s) for copyright (About the value set or its content). @@ -457,8 +487,9 @@ public class ValueSet extends BaseResource implements IResource { myCopyright = theValue; } + /** - * Sets the value(s) for copyright (About the value set or its content) + * Sets the value for copyright (About the value set or its content) * *

* Definition: @@ -468,6 +499,7 @@ public class ValueSet extends BaseResource implements IResource { public void setCopyright( String theString) { myCopyright = new StringDt(theString); } + /** * Gets the value(s) for status (draft | active | retired @@ -500,6 +532,7 @@ public class ValueSet extends BaseResource implements IResource { myStatus = theValue; } + /** * Sets the value(s) for status (draft | active | retired ) @@ -543,7 +576,20 @@ public class ValueSet extends BaseResource implements IResource { myExperimental = theValue; } - + + /** + * Sets the value for experimental (If for testing purposes, not real usage) + * + *

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

+ */ + public void setExperimental( Boolean theBoolean) { + myExperimental = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for extensible (Whether this is intended to be used with an extensible binding). * creating it if it does @@ -573,7 +619,20 @@ public class ValueSet extends BaseResource implements IResource { myExtensible = theValue; } - + + /** + * Sets the value for extensible (Whether this is intended to be used with an extensible binding) + * + *

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

+ */ + public void setExtensible( Boolean theBoolean) { + myExtensible = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for date (Date for given status). * creating it if it does @@ -603,8 +662,9 @@ public class ValueSet extends BaseResource implements IResource { myDate = theValue; } + /** - * Sets the value(s) for date (Date for given status) + * Sets the value for date (Date for given status) * *

* Definition: @@ -614,6 +674,19 @@ public class ValueSet extends BaseResource implements IResource { public void setDateWithSecondsPrecision( Date theDate) { myDate = new DateTimeDt(theDate); } + + /** + * Sets the value for date (Date for given status) + * + *

+ * Definition: + * The date that the value set status was last changed + *

+ */ + public void setDate( Date theDate, TemporalPrecisionEnum thePrecision) { + myDate = new DateTimeDt(theDate, thePrecision); + } + /** * Gets the value(s) for define (When value set defines its own codes). @@ -644,6 +717,7 @@ public class ValueSet extends BaseResource implements IResource { myDefine = theValue; } + /** * Gets the value(s) for compose (When value set includes codes from elsewhere). @@ -674,6 +748,7 @@ public class ValueSet extends BaseResource implements IResource { myCompose = theValue; } + /** * Gets the value(s) for expansion (When value set is an expansion). @@ -704,6 +779,7 @@ public class ValueSet extends BaseResource implements IResource { myExpansion = theValue; } + /** * Block class for child element: ValueSet.define (When value set defines its own codes) @@ -728,6 +804,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="concept", order=3, min=0, max=Child.MAX_UNLIMITED) private List myConcept; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCaseSensitive, myConcept); + } + /** * Gets the value(s) for system (URI to identify the code system). * creating it if it does @@ -757,8 +839,9 @@ public class ValueSet extends BaseResource implements IResource { mySystem = theValue; } + /** - * Sets the value(s) for system (URI to identify the code system) + * Sets the value for system (URI to identify the code system) * *

* Definition: @@ -768,6 +851,7 @@ public class ValueSet extends BaseResource implements IResource { public void setSystem( String theUri) { mySystem = new UriDt(theUri); } + /** * Gets the value(s) for version (Version of this system). @@ -798,8 +882,9 @@ public class ValueSet extends BaseResource implements IResource { myVersion = theValue; } + /** - * Sets the value(s) for version (Version of this system) + * Sets the value for version (Version of this system) * *

* Definition: @@ -809,6 +894,7 @@ public class ValueSet extends BaseResource implements IResource { public void setVersion( String theString) { myVersion = new StringDt(theString); } + /** * Gets the value(s) for caseSensitive (If code comparison is case sensitive). @@ -839,7 +925,20 @@ public class ValueSet extends BaseResource implements IResource { myCaseSensitive = theValue; } - + + /** + * Sets the value for caseSensitive (If code comparison is case sensitive) + * + *

+ * Definition: + * If code comparison is case sensitive when codes within this system are compared to each other + *

+ */ + public void setCaseSensitive( Boolean theBoolean) { + myCaseSensitive = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for concept (Concepts in the code system). * creating it if it does @@ -869,6 +968,20 @@ public class ValueSet extends BaseResource implements IResource { myConcept = theValue; } + /** + * Adds and returns a new value for concept (Concepts in the code system) + * + *

+ * Definition: + * + *

+ */ + public DefineConcept addConcept() { + DefineConcept newType = new DefineConcept(); + getConcept().add(newType); + return newType; + } + } @@ -899,6 +1012,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="concept", type=DefineConcept.class, order=4, min=0, max=Child.MAX_UNLIMITED) private List myConcept; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myCode, myAbstract, myDisplay, myDefinition, myConcept); + } + /** * Gets the value(s) for code (Code that identifies concept). * creating it if it does @@ -928,6 +1047,7 @@ public class ValueSet extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for abstract (If this code is not for use as a real concept). @@ -958,7 +1078,20 @@ public class ValueSet extends BaseResource implements IResource { myAbstract = theValue; } - + + /** + * Sets the value for abstract (If this code is not for use as a real concept) + * + *

+ * Definition: + * If this code is not for use as a real concept + *

+ */ + public void setAbstract( Boolean theBoolean) { + myAbstract = new BooleanDt(theBoolean); + } + + /** * Gets the value(s) for display (Text to Display to the user). * creating it if it does @@ -988,8 +1121,9 @@ public class ValueSet extends BaseResource implements IResource { myDisplay = theValue; } + /** - * Sets the value(s) for display (Text to Display to the user) + * Sets the value for display (Text to Display to the user) * *

* Definition: @@ -999,6 +1133,7 @@ public class ValueSet extends BaseResource implements IResource { public void setDisplay( String theString) { myDisplay = new StringDt(theString); } + /** * Gets the value(s) for definition (Formal Definition). @@ -1029,8 +1164,9 @@ public class ValueSet extends BaseResource implements IResource { myDefinition = theValue; } + /** - * Sets the value(s) for definition (Formal Definition) + * Sets the value for definition (Formal Definition) * *

* Definition: @@ -1040,6 +1176,7 @@ public class ValueSet extends BaseResource implements IResource { public void setDefinition( String theString) { myDefinition = new StringDt(theString); } + /** * Gets the value(s) for concept (Child Concepts (is-a / contains)). @@ -1070,6 +1207,20 @@ public class ValueSet extends BaseResource implements IResource { myConcept = theValue; } + /** + * Adds and returns a new value for concept (Child Concepts (is-a / contains)) + * + *

+ * Definition: + * + *

+ */ + public DefineConcept addConcept() { + DefineConcept newType = new DefineConcept(); + getConcept().add(newType); + return newType; + } + } @@ -1096,6 +1247,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="exclude", type=ComposeInclude.class, order=2, min=0, max=Child.MAX_UNLIMITED) private List myExclude; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myImport, myInclude, myExclude); + } + /** * Gets the value(s) for import (Import the contents of another value set). * creating it if it does @@ -1125,8 +1282,22 @@ public class ValueSet extends BaseResource implements IResource { myImport = theValue; } + /** + * Adds and returns a new value for import (Import the contents of another value set) + * + *

+ * Definition: + * Includes the contents of the referenced value set as a part of the contents of this value set + *

+ */ + public UriDt addImport() { + UriDt newType = new UriDt(); + getImport().add(newType); + return newType; + } + /** - * Sets the value(s) for import (Import the contents of another value set) + * Adds a new value for import (Import the contents of another value set) * *

* Definition: @@ -1139,6 +1310,7 @@ public class ValueSet extends BaseResource implements IResource { } myImport.add(new UriDt(theUri)); } + /** * Gets the value(s) for include (Include one or more codes from a code system). @@ -1169,6 +1341,20 @@ public class ValueSet extends BaseResource implements IResource { myInclude = theValue; } + /** + * Adds and returns a new value for include (Include one or more codes from a code system) + * + *

+ * Definition: + * Include one or more codes from a code system + *

+ */ + public ComposeInclude addInclude() { + ComposeInclude newType = new ComposeInclude(); + getInclude().add(newType); + return newType; + } + /** * Gets the value(s) for exclude (Explicitly exclude codes). @@ -1199,6 +1385,20 @@ public class ValueSet extends BaseResource implements IResource { myExclude = theValue; } + /** + * Adds and returns a new value for exclude (Explicitly exclude codes) + * + *

+ * Definition: + * Exclude one or more codes from the value set + *

+ */ + public ComposeInclude addExclude() { + ComposeInclude newType = new ComposeInclude(); + getExclude().add(newType); + return newType; + } + } @@ -1226,6 +1426,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="filter", order=3, min=0, max=Child.MAX_UNLIMITED) private List myFilter; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCode, myFilter); + } + /** * Gets the value(s) for system (The system the codes come from). * creating it if it does @@ -1255,8 +1461,9 @@ public class ValueSet extends BaseResource implements IResource { mySystem = theValue; } + /** - * Sets the value(s) for system (The system the codes come from) + * Sets the value for system (The system the codes come from) * *

* Definition: @@ -1266,6 +1473,7 @@ public class ValueSet extends BaseResource implements IResource { public void setSystem( String theUri) { mySystem = new UriDt(theUri); } + /** * Gets the value(s) for version (Specific version of the code system referred to). @@ -1296,8 +1504,9 @@ public class ValueSet extends BaseResource implements IResource { myVersion = theValue; } + /** - * Sets the value(s) for version (Specific version of the code system referred to) + * Sets the value for version (Specific version of the code system referred to) * *

* Definition: @@ -1307,6 +1516,7 @@ public class ValueSet extends BaseResource implements IResource { public void setVersion( String theString) { myVersion = new StringDt(theString); } + /** * Gets the value(s) for code (Code or concept from system). @@ -1337,6 +1547,20 @@ public class ValueSet extends BaseResource implements IResource { myCode = theValue; } + /** + * Adds and returns a new value for code (Code or concept from system) + * + *

+ * Definition: + * Specifies a code or concept to be included or excluded. The list of codes is considered ordered, though the order may not have any particular significance + *

+ */ + public CodeDt addCode() { + CodeDt newType = new CodeDt(); + getCode().add(newType); + return newType; + } + /** * Gets the value(s) for filter (Select codes/concepts by their properties (including relationships)). @@ -1367,6 +1591,20 @@ public class ValueSet extends BaseResource implements IResource { myFilter = theValue; } + /** + * Adds and returns a new value for filter (Select codes/concepts by their properties (including relationships)) + * + *

+ * 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; + } + } @@ -1391,6 +1629,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="value", type=CodeDt.class, order=2, min=1, max=1) private CodeDt myValue; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myProperty, myOp, myValue); + } + /** * Gets the value(s) for property (). * creating it if it does @@ -1420,6 +1664,7 @@ public class ValueSet extends BaseResource implements IResource { myProperty = theValue; } + /** * Gets the value(s) for op (= | is-a | is-not-a | regex | in | not in). @@ -1450,6 +1695,7 @@ public class ValueSet extends BaseResource implements IResource { myOp = theValue; } + /** * Sets the value(s) for op (= | is-a | is-not-a | regex | in | not in) * @@ -1492,6 +1738,7 @@ public class ValueSet extends BaseResource implements IResource { myValue = theValue; } + } @@ -1519,6 +1766,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="contains", order=2, min=0, max=Child.MAX_UNLIMITED) private List myContains; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myIdentifier, myTimestamp, myContains); + } + /** * Gets the value(s) for identifier (Uniquely identifies this expansion). * creating it if it does @@ -1548,6 +1801,7 @@ public class ValueSet extends BaseResource implements IResource { myIdentifier = theValue; } + /** * Gets the value(s) for timestamp (Time valueset expansion happened). @@ -1578,7 +1832,32 @@ public class ValueSet extends BaseResource implements IResource { myTimestamp = theValue; } - + + /** + * Sets the value for timestamp (Time valueset expansion happened) + * + *

+ * Definition: + * + *

+ */ + public void setTimestampWithMillisPrecision( Date theDate) { + myTimestamp = new InstantDt(theDate); + } + + /** + * Sets the value for timestamp (Time valueset expansion happened) + * + *

+ * Definition: + * + *

+ */ + public void setTimestamp( Date theDate, TemporalPrecisionEnum thePrecision) { + myTimestamp = new InstantDt(theDate, thePrecision); + } + + /** * Gets the value(s) for contains (Codes in the value set). * creating it if it does @@ -1608,6 +1887,20 @@ public class ValueSet extends BaseResource implements IResource { myContains = theValue; } + /** + * Adds and returns a new value for contains (Codes in the value set) + * + *

+ * Definition: + * + *

+ */ + public ExpansionContains addContains() { + ExpansionContains newType = new ExpansionContains(); + getContains().add(newType); + return newType; + } + } @@ -1635,6 +1928,12 @@ public class ValueSet extends BaseResource implements IResource { @Child(name="contains", type=ExpansionContains.class, order=3, min=0, max=Child.MAX_UNLIMITED) private List myContains; + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myCode, myDisplay, myContains); + } + /** * Gets the value(s) for system (System value for the code). * creating it if it does @@ -1664,8 +1963,9 @@ public class ValueSet extends BaseResource implements IResource { mySystem = theValue; } + /** - * Sets the value(s) for system (System value for the code) + * Sets the value for system (System value for the code) * *

* Definition: @@ -1675,6 +1975,7 @@ public class ValueSet extends BaseResource implements IResource { public void setSystem( String theUri) { mySystem = new UriDt(theUri); } + /** * Gets the value(s) for code (Code - if blank, this is not a choosable code). @@ -1705,6 +2006,7 @@ public class ValueSet extends BaseResource implements IResource { myCode = theValue; } + /** * Gets the value(s) for display (User display for the concept). @@ -1735,8 +2037,9 @@ public class ValueSet extends BaseResource implements IResource { myDisplay = theValue; } + /** - * Sets the value(s) for display (User display for the concept) + * Sets the value for display (User display for the concept) * *

* Definition: @@ -1746,6 +2049,7 @@ public class ValueSet extends BaseResource implements IResource { public void setDisplay( String theString) { myDisplay = new StringDt(theString); } + /** * Gets the value(s) for contains (Codes contained in this concept). @@ -1776,6 +2080,20 @@ public class ValueSet extends BaseResource implements IResource { myContains = theValue; } + /** + * Adds and returns a new value for contains (Codes contained in this concept) + * + *

+ * Definition: + * + *

+ */ + public ExpansionContains addContains() { + ExpansionContains newType = new ExpansionContains(); + getContains().add(newType); + return newType; + } + } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/Base64BinaryDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/Base64BinaryDt.java index 6543c718260..c91869a5900 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/Base64BinaryDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/Base64BinaryDt.java @@ -2,12 +2,12 @@ package ca.uhn.fhir.model.primitive; import org.apache.commons.codec.binary.Base64; -import ca.uhn.fhir.model.api.BaseElement; -import ca.uhn.fhir.model.api.IPrimitiveDatatype; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; @DatatypeDef(name = "base64Binary") -public class Base64BinaryDt extends BaseElement implements IPrimitiveDatatype { +public class Base64BinaryDt extends BasePrimitive { private byte[] myValue; @@ -17,12 +17,13 @@ public class Base64BinaryDt extends BaseElement implements IPrimitiveDatatype { +public abstract class BaseDateTimeDt extends BasePrimitive { private static final FastDateFormat ourYearFormat = FastDateFormat.getInstance("yyyy"); private static final FastDateFormat ourYearMonthDayFormat = FastDateFormat.getInstance("yyyy-MM-dd"); diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java index 0f0a8e20e4e..5df611e2bc3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/BooleanDt.java @@ -1,15 +1,31 @@ package ca.uhn.fhir.model.primitive; -import ca.uhn.fhir.model.api.BaseElement; -import ca.uhn.fhir.model.api.IPrimitiveDatatype; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name = "boolean") -public class BooleanDt extends BaseElement implements IPrimitiveDatatype { +public class BooleanDt extends BasePrimitive { private Boolean myValue; + /** + * Constructor + */ + public BooleanDt() { + super(); + } + + /** + * Constructor + */ + @SimpleSetter + public BooleanDt(@SimpleSetter.Parameter(name="theBoolean") Boolean theBoolean) { + setValue(theBoolean); + } + + @Override public void setValueAsString(String theValue) throws DataFormatException { if ("true".equals(theValue)) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java index a32d166d2a1..8c633177348 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/CodeDt.java @@ -1,12 +1,13 @@ package ca.uhn.fhir.model.primitive; import ca.uhn.fhir.model.api.BaseElement; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name = "code") -public class CodeDt extends BaseElement implements IPrimitiveDatatype, ICodedDatatype { +public class CodeDt extends BasePrimitive implements ICodedDatatype { private String myValue; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateDt.java index 00e583681bd..c4294797571 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateDt.java @@ -1,11 +1,48 @@ package ca.uhn.fhir.model.primitive; +import java.util.Date; + import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; @DatatypeDef(name = "date") public class DateDt extends BaseDateTimeDt { + /** + * The default precision for this type + */ + public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.DAY; + + /** + * Constructor + */ + public DateDt() { + super(); + } + + /** + * Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type + */ + @SimpleSetter(suffix="WithDayPrecision") + public DateDt(@SimpleSetter.Parameter(name = "theDate") Date theDate) { + setValue(theDate); + } + + /** + * Constructor which accepts a date value and a precision value. Valid precisions values for this type are: + *
    + *
  • {@link TemporalPrecisionEnum#YEAR} + *
  • {@link TemporalPrecisionEnum#MONTH} + *
  • {@link TemporalPrecisionEnum#DAY} + *
+ */ + @SimpleSetter + public DateDt(@SimpleSetter.Parameter(name = "theDate") Date theDate, @SimpleSetter.Parameter(name = "thePrecision") TemporalPrecisionEnum thePrecision) { + setValue(theDate); + setPrecision(thePrecision); + } + @Override boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) { switch (thePrecision) { @@ -18,5 +55,4 @@ public class DateDt extends BaseDateTimeDt { } } - } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateTimeDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateTimeDt.java index 5a49ed72e8c..93d6ffdb17f 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateTimeDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DateTimeDt.java @@ -10,19 +10,40 @@ import ca.uhn.fhir.model.api.annotation.SimpleSetter; public class DateTimeDt extends BaseDateTimeDt { /** - * Create a new DateTimeDt + * The default precision for this type + */ + public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.SECOND; + + /** + * Constructor */ public DateTimeDt() { super(); } + /** + * Constructor which accepts a date value and a precision value. Valid precisions values for this type are: + *
    + *
  • {@link TemporalPrecisionEnum#YEAR} + *
  • {@link TemporalPrecisionEnum#MONTH} + *
  • {@link TemporalPrecisionEnum#DAY} + *
  • {@link TemporalPrecisionEnum#SECOND} + *
  • {@link TemporalPrecisionEnum#MILLI} + *
+ */ + @SimpleSetter + public DateTimeDt(@SimpleSetter.Parameter(name = "theDate") Date theDate, @SimpleSetter.Parameter(name = "thePrecision") TemporalPrecisionEnum thePrecision) { + setValue(theDate); + setPrecision(thePrecision); + } + /** * Create a new DateTimeDt */ @SimpleSetter(suffix="WithSecondsPrecision") public DateTimeDt(@SimpleSetter.Parameter(name="theDate") Date theDate) { setValue(theDate); - setPrecision(TemporalPrecisionEnum.SECOND); + setPrecision(DEFAULT_PRECISION); } @Override diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java index 842c026c803..eb6a14c98b2 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/DecimalDt.java @@ -3,15 +3,48 @@ package ca.uhn.fhir.model.primitive; import java.math.BigDecimal; import ca.uhn.fhir.model.api.BaseElement; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name = "decimal") -public class DecimalDt extends BaseElement implements IPrimitiveDatatype { +public class DecimalDt extends BasePrimitive { private BigDecimal myValue; + /** + * Constructor + */ + public DecimalDt() { + super(); + } + + /** + * Constructor + */ + @SimpleSetter + public DecimalDt(@SimpleSetter.Parameter(name = "theValue") BigDecimal theValue) { + setValue(theValue); + } + + /** + * Constructor + */ + @SimpleSetter + public DecimalDt(@SimpleSetter.Parameter(name = "theValue") double theValue) { + setValue(new BigDecimal(theValue)); + } + + /** + * Constructor + */ + @SimpleSetter + public DecimalDt(@SimpleSetter.Parameter(name = "theValue") long theValue) { + setValue(new BigDecimal(theValue)); + } + @Override public void setValueAsString(String theValue) throws DataFormatException { if (theValue == null) { @@ -39,10 +72,16 @@ public class DecimalDt extends BaseElement implements IPrimitiveDatatype { +public class IdDt extends BasePrimitive { private String myValue; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/InstantDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/InstantDt.java index 4e0ed04eaa7..0888b1d10c7 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/InstantDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/InstantDt.java @@ -5,10 +5,45 @@ import java.util.TimeZone; import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; @DatatypeDef(name="instant") public class InstantDt extends BaseDateTimeDt { + /** + * The default precision for this type + */ + public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.MILLI; + + /** + * Constructor + */ + public InstantDt() { + super(); + } + + /** + * Constructor which accepts a date value and a precision value. Valid precisions values for this type are: + *
    + *
  • {@link TemporalPrecisionEnum#SECOND} + *
  • {@link TemporalPrecisionEnum#MILLI} + *
+ */ + @SimpleSetter + public InstantDt(@SimpleSetter.Parameter(name = "theDate") Date theDate, @SimpleSetter.Parameter(name = "thePrecision") TemporalPrecisionEnum thePrecision) { + setValue(theDate); + setPrecision(thePrecision); + } + + /** + * Create a new DateTimeDt + */ + @SimpleSetter(suffix="WithMillisPrecision") + public InstantDt(@SimpleSetter.Parameter(name="theDate") Date theDate) { + setValue(theDate); + setPrecision(DEFAULT_PRECISION); + } + @Override boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) { switch (thePrecision) { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java index e687b7773a5..eb1c1932470 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/IntegerDt.java @@ -1,19 +1,38 @@ package ca.uhn.fhir.model.primitive; import ca.uhn.fhir.model.api.BaseElement; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name="integer") -public class IntegerDt extends BaseElement implements IPrimitiveDatatype { +public class IntegerDt extends BasePrimitive { private Integer myValue; + /** + * Constructor + */ + public IntegerDt() { + // nothing + } + + /** + * Constructor + */ + @SimpleSetter + public IntegerDt(@SimpleSetter.Parameter(name = "theInteger") Integer theInteger) { + setValue(theInteger); + } + + @Override public Integer getValue() { return myValue; } + @Override public void setValue(Integer theValue) { myValue = theValue; } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/StringDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/StringDt.java index 3b22b54545b..79f80728467 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/StringDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/StringDt.java @@ -3,6 +3,7 @@ package ca.uhn.fhir.model.primitive; import org.apache.commons.lang3.StringUtils; import ca.uhn.fhir.model.api.BaseElement; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.IQueryParameterType; import ca.uhn.fhir.model.api.annotation.DatatypeDef; @@ -10,7 +11,7 @@ import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name = "string") -public class StringDt extends BaseElement implements IPrimitiveDatatype, IQueryParameterType { +public class StringDt extends BasePrimitive implements IQueryParameterType { private String myValue; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java index c070191234c..e3c10296ab7 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/UriDt.java @@ -6,13 +6,14 @@ import java.net.URISyntaxException; import org.apache.commons.lang3.StringUtils; import ca.uhn.fhir.model.api.BaseElement; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.IPrimitiveDatatype; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.model.api.annotation.SimpleSetter; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name = "uri") -public class UriDt extends BaseElement implements IPrimitiveDatatype { +public class UriDt extends BasePrimitive { private URI myValue; diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java index 424b28e20af..2f976b582a3 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java @@ -14,12 +14,12 @@ import javax.xml.stream.XMLStreamException; import javax.xml.stream.events.XMLEvent; import ca.uhn.fhir.context.ConfigurationException; -import ca.uhn.fhir.model.api.IPrimitiveDatatype; +import ca.uhn.fhir.model.api.BasePrimitive; import ca.uhn.fhir.model.api.annotation.DatatypeDef; import ca.uhn.fhir.parser.DataFormatException; @DatatypeDef(name = "xhtml") -public class XhtmlDt implements IPrimitiveDatatype> { +public class XhtmlDt extends BasePrimitive> { private List myValue; 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 34e8043bbd7..1e9ca060bbf 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 @@ -25,12 +25,16 @@ public interface IParser { Bundle parseBundle(Reader theReader); - Bundle parseBundle(String theXml) throws ConfigurationException, DataFormatException; + Bundle parseBundle(String theMessageString) throws ConfigurationException, DataFormatException; - IResource parseResource(String theXml) throws ConfigurationException, DataFormatException; + IResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException; IResource parseResource(Reader theReader) throws ConfigurationException, DataFormatException; IResource parseResource(XMLEventReader theStreamReader); + T parseResource(Class theResourceType, String theMessageString); + + IResource parseResource(Class theResourceType, Reader theReader); + } \ No newline at end of file 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 1d9517f9618..ca6c541a581 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 @@ -3,7 +3,6 @@ package ca.uhn.fhir.parser; import java.util.ArrayList; import java.util.List; -import javax.xml.namespace.QName; import javax.xml.stream.events.EndElement; import javax.xml.stream.events.StartElement; import javax.xml.stream.events.XMLEvent; @@ -37,10 +36,6 @@ import ca.uhn.fhir.model.primitive.XhtmlDt; class ParserState { - private static final QName ATOM_LINK_HREF_ATTRIBUTE = new QName("href"); - - private static final QName ATOM_LINK_REL_ATTRIBUTE = new QName("rel"); - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ParserState.class); private FhirContext myContext; private T myObject; @@ -106,9 +101,13 @@ class ParserState { return retVal; } - public static ParserState getPreResourceInstance(FhirContext theContext) throws DataFormatException { + /** + * @param theResourceType + * May be null + */ + public static ParserState getPreResourceInstance(Class theResourceType, FhirContext theContext) throws DataFormatException { ParserState retVal = new ParserState(theContext); - retVal.push(retVal.new PreResourceState()); + retVal.push(retVal.new PreResourceState(theResourceType)); return retVal; } @@ -683,9 +682,14 @@ class ParserState { private IResource myInstance; private BundleEntry myEntry; + private Class myResourceType; - public PreResourceState() { - // nothing + /** + * @param theResourceType + * May be null + */ + public PreResourceState(Class theResourceType) { + myResourceType = theResourceType; } public PreResourceState(BundleEntry theEntry) { @@ -699,9 +703,17 @@ class ParserState { @Override public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException { - BaseRuntimeElementDefinition definition = myContext.getNameToResourceDefinition().get(theLocalPart); - if (!(definition instanceof RuntimeResourceDefinition)) { - throw new DataFormatException("Element '" + theLocalPart + "' is not a resource, expected a resource at this position"); + BaseRuntimeElementDefinition definition; + if (myResourceType == null) { + definition = myContext.getResourceDefinition(theLocalPart); + if (!(definition instanceof RuntimeResourceDefinition)) { + throw new DataFormatException("Element '" + theLocalPart + "' is not a resource, expected a resource at this position"); + } + } else { + definition = myContext.getResourceDefinition(myResourceType); + if (!StringUtils.equals(theLocalPart, definition.getName())) { + throw new DataFormatException("Incorrect resource root element '" + theLocalPart + "', expected: '" + definition.getName() + "'"); + } } RuntimeResourceDefinition def = (RuntimeResourceDefinition) definition; 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 1d31e5b7e8d..cb25fcb31dc 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 @@ -213,7 +213,11 @@ public class XmlParser implements IParser { - private boolean encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition childDef, String theExtensionUrl) throws XMLStreamException, DataFormatException { + private void encodeChildElementToStreamWriter(XMLStreamWriter theEventWriter, IElement nextValue, String childName, BaseRuntimeElementDefinition childDef, String theExtensionUrl) throws XMLStreamException, DataFormatException { + if (nextValue.isEmpty()) { + return; + } + switch (childDef.getChildType()) { case PRIMITIVE_DATATYPE: { IPrimitiveDatatype pd = (IPrimitiveDatatype) nextValue; @@ -223,10 +227,8 @@ public class XmlParser implements IParser { theEventWriter.writeAttribute("value", value); encodeExtensionsIfPresent(theEventWriter, nextValue); theEventWriter.writeEndElement(); - return true; - } else { - return false; } + break; } case RESOURCE_BLOCK: case COMPOSITE_DATATYPE: { @@ -238,18 +240,16 @@ public class XmlParser implements IParser { encodeCompositeElementToStreamWriter(nextValue, theEventWriter, childCompositeDef); encodeExtensionsIfPresent(theEventWriter, nextValue); theEventWriter.writeEndElement(); - return true; + break; } case RESOURCE_REF: { ResourceReference ref = (ResourceReference) nextValue; - if (ref.hasContent()) { + if (!ref.isEmpty()) { theEventWriter.writeStartElement(childName); encodeResourceReferenceToStreamWriter(theEventWriter, ref); theEventWriter.writeEndElement(); - return true; - } else { - return false; } + break; } case RESOURCE: { throw new IllegalStateException(); // should not happen @@ -258,17 +258,14 @@ public class XmlParser implements IParser { XhtmlDt dt = (XhtmlDt) nextValue; if (dt.hasContent()) { encodeXhtml(dt, theEventWriter); - return true; - } else { - return false; } + break; } case UNDECL_EXT: { throw new IllegalStateException("should not happen"); } } - return false; } private void encodeCompositeElementChildrenToStreamWriter(IElement theElement, XMLStreamWriter theEventWriter, List children) throws XMLStreamException, DataFormatException { @@ -485,9 +482,8 @@ public class XmlParser implements IParser { * @see ca.uhn.fhir.parser.IParser#parseResource(java.lang.String) */ @Override - public IResource parseResource(String theXml) throws ConfigurationException, DataFormatException { - StringReader reader = new StringReader(theXml); - return parseResource(reader); + public IResource parseResource(String theMessageString) throws ConfigurationException, DataFormatException { + return parseResource(null, theMessageString); } /* (non-Javadoc) @@ -495,7 +491,11 @@ public class XmlParser implements IParser { */ @Override public IResource parseResource(XMLEventReader theStreamReader) { - ParserState parserState = ParserState.getPreResourceInstance(myContext); + return parseResource(null, theStreamReader); + } + + private IResource parseResource(Class theResourceType, XMLEventReader theStreamReader) { + ParserState parserState = ParserState.getPreResourceInstance(theResourceType, myContext); return doXmlLoop(theStreamReader, parserState); } @@ -547,6 +547,11 @@ public class XmlParser implements IParser { @Override public IResource parseResource(Reader theReader) throws ConfigurationException, DataFormatException { + return parseResource(null, theReader); + } + + @Override + public IResource parseResource(Class theResourceType, Reader theReader) { XMLEventReader streamReader; try { streamReader = myXmlInputFactory.createXMLEventReader(theReader); @@ -556,6 +561,13 @@ public class XmlParser implements IParser { throw new ConfigurationException("Failed to initialize STaX event factory", e); } - return parseResource(streamReader); + return parseResource(theResourceType, streamReader); + } + + @SuppressWarnings("unchecked") + @Override + public T parseResource(Class theResourceType, String theMessageString) { + StringReader reader = new StringReader(theMessageString); + return (T) parseResource(theResourceType, reader); } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java new file mode 100644 index 00000000000..690bf48108c --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/IRestfulClientFactory.java @@ -0,0 +1,33 @@ +package ca.uhn.fhir.rest.client; + +import org.apache.http.client.HttpClient; + +import ca.uhn.fhir.context.ConfigurationException; +import ca.uhn.fhir.rest.client.api.IRestfulClient; + +public interface IRestfulClientFactory { + + /** + * Instantiates a new client instance + * + * @param theClientType + * The client type, which is an interface type to be instantiated + * @param theServerBase + * The URL of the base for the restful FHIR server to connect to + * @return A newly created client + * @throws ConfigurationException + * If the interface type is not an interface + */ + public T newClient(Class theClientType, String theServerBase); + + + /** + * Sets the Apache HTTP client instance to be used by any new restful clients created by + * this factory. If set to null, which is the default, a new HTTP client with + * default settings will be created. + * + * @param theHttpClient An HTTP client instance to use, or null + */ + public void setHttpClient(HttpClient theHttpClient); + +} \ No newline at end of file diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java index d857bbe3c02..b3193af6288 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/RestfulClientFactory.java @@ -6,22 +6,18 @@ import java.lang.reflect.Proxy; import java.util.concurrent.TimeUnit; import org.apache.http.client.HttpClient; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.http.impl.conn.PoolingClientConnectionManager; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; -import org.apache.http.impl.conn.SchemeRegistryFactory; import ca.uhn.fhir.context.ConfigurationException; import ca.uhn.fhir.context.FhirContext; -import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.rest.client.api.IRestfulClient; import ca.uhn.fhir.rest.common.BaseMethodBinding; -public class RestfulClientFactory { +public class RestfulClientFactory implements IRestfulClientFactory { private FhirContext myContext; + private HttpClient myHttpClient; /** * Constructor @@ -33,6 +29,12 @@ public class RestfulClientFactory { myContext = theContext; } + @SuppressWarnings("unchecked") + private T instantiateProxy(Class theClientType, InvocationHandler theInvocationHandler) { + T proxy = (T) Proxy.newProxyInstance(RestfulClientFactory.class.getClassLoader(), new Class[] { theClientType }, theInvocationHandler); + return proxy; + } + /** * Instantiates a new client instance * @@ -44,17 +46,28 @@ public class RestfulClientFactory { * @throws ConfigurationException * If the interface type is not an interface */ + @Override public T newClient(Class theClientType, String theServerBase){ if (!theClientType.isInterface()) { throw new ConfigurationException(theClientType.getCanonicalName() + " is not an interface"); } - PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); - HttpClientBuilder builder = HttpClientBuilder.create(); - builder.setConnectionManager(connectionManager); - CloseableHttpClient client = builder.build(); + HttpClient client; + if (myHttpClient != null) { + client = myHttpClient; + }else { + PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS); + HttpClientBuilder builder = HttpClientBuilder.create(); + builder.setConnectionManager(connectionManager); + client = builder.build(); + } - ClientInvocationHandler theInvocationHandler = new ClientInvocationHandler(client, myContext, theServerBase); + String serverBase = theServerBase; + if (!serverBase.endsWith("/")) { + serverBase = serverBase + "/"; + } + + ClientInvocationHandler theInvocationHandler = new ClientInvocationHandler(client, myContext, serverBase); for (Method nextMethod : theClientType.getMethods()) { BaseMethodBinding binding = BaseMethodBinding.bindMethod(nextMethod); @@ -67,11 +80,16 @@ public class RestfulClientFactory { } - - @SuppressWarnings("unchecked") - private T instantiateProxy(Class theClientType, InvocationHandler theInvocationHandler) { - T proxy = (T) Proxy.newProxyInstance(RestfulClientFactory.class.getClassLoader(), new Class[] { theClientType }, theInvocationHandler); - return proxy; + /** + * Sets the Apache HTTP client instance to be used by any new restful clients created by + * this factory. If set to null, which is the default, a new HTTP client with + * default settings will be created. + * + * @param theHttpClient An HTTP client instance to use, or null + */ + @Override + public void setHttpClient(HttpClient theHttpClient) { + myHttpClient = theHttpClient; } } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/common/BaseMethodBinding.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/common/BaseMethodBinding.java index 33e6b1dc5d4..ae5f4ca659e 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/common/BaseMethodBinding.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/common/BaseMethodBinding.java @@ -51,7 +51,9 @@ public abstract class BaseMethodBinding { public static BaseMethodBinding bindMethod(Method theMethod) { Read read = theMethod.getAnnotation(Read.class); Search search = theMethod.getAnnotation(Search.class); - verifyExactlyOneValued(theMethod, read, search); + if (!verifyMethodHasZeroOrOneOperationAnnotation(theMethod, read, search)) { + return null; + } Class annotatedResourceType; if (read != null) { @@ -102,7 +104,7 @@ public abstract class BaseMethodBinding { // return sm; } - public static void verifyExactlyOneValued(Method theNextMethod, Object... theAnnotations) { + public static boolean verifyMethodHasZeroOrOneOperationAnnotation(Method theNextMethod, Object... theAnnotations) { Object obj1 = null; for (Object object : theAnnotations) { if (object != null) { @@ -116,8 +118,10 @@ public abstract class BaseMethodBinding { } } if (obj1 == null) { - throw new ConfigurationException("Method " + theNextMethod.getName() + " on type '" + theNextMethod.getDeclaringClass().getSimpleName() + " has no FHIR method annotations."); + return false; +// throw new ConfigurationException("Method '" + theNextMethod.getName() + "' on type '" + theNextMethod.getDeclaringClass().getSimpleName() + " has no FHIR method annotations."); } + return true; } protected static List toResourceList(Object response) throws InternalErrorException { diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java new file mode 100644 index 00000000000..d25740d3189 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ElementUtil.java @@ -0,0 +1,54 @@ +package ca.uhn.fhir.util; + +import java.util.List; + +import ca.uhn.fhir.model.api.IElement; + +public class ElementUtil { + + @SuppressWarnings("unchecked") + public static boolean isEmpty(Object... theElements) { + if (theElements ==null) { + return true; + } + for (int i = 0; i < theElements.length; i++) { + Object next = theElements[i]; + if (next instanceof List) { + if (!isEmpty((List)next)) { + return false; + } + } + if (next != null && !((IElement)next).isEmpty()) { + return false; + } + } + return true; + } + + public static boolean isEmpty(IElement... theElements) { + if (theElements ==null) { + return true; + } + for (int i = 0; i < theElements.length; i++) { + IElement next = theElements[i]; + if (next != null && !next.isEmpty()) { + return false; + } + } + return true; + } + + public static boolean isEmpty(List theElements) { + if (theElements ==null) { + return true; + } + for (int i = 0; i < theElements.size(); i++) { + IElement next = theElements.get(i); + if (next != null && !next.isEmpty()) { + return false; + } + } + return true; + } + +} diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/context/ResourceWithExtensionsA.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/context/ResourceWithExtensionsA.java index 519d18df7eb..38517f1842e 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/context/ResourceWithExtensionsA.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/context/ResourceWithExtensionsA.java @@ -89,6 +89,11 @@ public class ResourceWithExtensionsA implements IResource { @Extension(url = "http://bar/1/2") private List myBar12; + @Override + public boolean isEmpty() { + return false; // TODO: implement + } + public List getBar11() { return myBar11; } @@ -118,6 +123,11 @@ public class ResourceWithExtensionsA implements IResource { @Extension(url = "http://bar/1/2/2") private List myBar122; + @Override + public boolean isEmpty() { + return false; // TODO: implement + } + public List getBar121() { return myBar121; } @@ -136,4 +146,9 @@ public class ResourceWithExtensionsA implements IResource { } + @Override + public boolean isEmpty() { + return false; // TODO: implement + } + } \ No newline at end of file diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java index 971349ca58f..d7c884a6d05 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/parser/XmlParserTest.java @@ -22,6 +22,7 @@ import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.dstu.resource.Observation; import ca.uhn.fhir.model.dstu.resource.Patient; import ca.uhn.fhir.model.dstu.resource.ValueSet; +import ca.uhn.fhir.model.dstu.valueset.NarrativeStatusEnum; public class XmlParserTest { @@ -32,6 +33,9 @@ public class XmlParserTest { IParser p = new FhirContext(Patient.class).newXmlParser(); Bundle bundle = p.parseBundle(msg); + assertEquals("http://spark.furore.com/fhir/_snapshot?id=327d6bb9-83b0-4929-aa91-6dd9c41e587b&start=0&_count=20", bundle.getLinkSelf().getValue()); + assertEquals("Patient resource with id 3216379", bundle.getEntries().get(0).getTitle().getValue()); + } @Test @@ -112,6 +116,35 @@ public class XmlParserTest { assertEquals(summaryText.trim(), entry.getSummary().getValueAsString().trim()); } + @Test + public void testLoadAndAncodeMessage() throws SAXException, IOException { + + //@formatter:off + String msg = "" + + "
John Cardinal: 444333333
" + + "" + + "" + + "" + + "" + + "" + + "
" + + "
"; + //@formatter:on + + FhirContext ctx = new FhirContext(Patient.class); + Patient patient = ctx.newXmlParser().parseResource(Patient.class, msg); + + assertEquals(NarrativeStatusEnum.GENERATED, patient.getText().getStatus().getValueAsEnum()); + assertEquals("
John Cardinal: 444333333
", patient.getText().getDiv().getValueAsString()); + assertEquals("PRP1660", patient.getIdentifier().get(0).getValue().getValueAsString()); + + String encoded = ctx.newXmlParser().encodeResourceToString(patient); + + Diff d = new Diff(new StringReader(msg), new StringReader(encoded)); + assertTrue(d.toString(), d.identical()); + + } + @Test public void testLoadAndEncodeExtensions() throws ConfigurationException, DataFormatException, SAXException, IOException { FhirContext ctx = new FhirContext(ResourceWithExtensionsA.class); @@ -146,7 +179,6 @@ public class XmlParserTest { " \n" + " \n" + " \n" + ""; //@formatter:on @@ -181,7 +213,8 @@ public class XmlParserTest { FhirContext ctx = new FhirContext(Observation.class); IParser p = new XmlParser(ctx); - IResource resource = p.parseResource(IOUtils.toString(XmlParserTest.class.getResourceAsStream("/observation-example-eeg.xml"))); + String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/observation-example-eeg.xml")); + IResource resource = p.parseResource(string); String result = p.encodeResourceToString(resource); ourLog.info(result); diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java index 47644163384..196dd13089f 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java @@ -1,11 +1,76 @@ package ca.uhn.fhir.rest.client; +import static org.junit.Assert.assertEquals; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.StringReader; +import java.nio.charset.Charset; + +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.HttpUriRequest; +import org.apache.http.message.BasicHeader; +import org.apache.http.message.BasicStatusLine; +import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentCaptor; +import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs; + +import ca.uhn.fhir.context.FhirContext; +import ca.uhn.fhir.model.dstu.resource.Patient; +import ca.uhn.fhir.model.primitive.IdDt; +import ca.uhn.fhir.rest.server.Constants; public class ClientTest { + private HttpClient httpClient; + private HttpResponse httpResponse; + private FhirContext ctx; + private IRestfulClientFactory clientFactory; + + // atom-document-large.xml + + @Before + public void before() { + ctx = new FhirContext(Patient.class); + clientFactory = ctx.newRestfulClientFactory(); + + httpClient = mock(HttpClient.class, new ReturnsDeepStubs()); + clientFactory.setHttpClient(httpClient); + + httpResponse = mock(HttpResponse.class, new ReturnsDeepStubs()); + } + @Test - public void testClient() { + public void testRead() throws Exception { + + //@formatter:off + String msg = "" + + "
John Cardinal: 444333333
" + + "" + + "" + + "" + + "" + + "" + + "
" + + "
"; + //@formatter:on + + ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class); + when(httpClient.execute(capt.capture())).thenReturn(httpResponse); + when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP",1,1), 200, "OK")); + when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8")); + when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8"))); + + ITestClient client = clientFactory.newClient(ITestClient.class, "http://foo"); +// Patient response = client.findPatientByMrn(new IdentifierDt("urn:foo", "123")); + Patient response = client.getPatientById(new IdDt("111")); + + assertEquals("http://foo/Patient/111", capt.getValue().getURI().toString()); + assertEquals("PRP1660", response.getIdentifier().get(0).getValue().getValue()); } diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/Tester.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/Tester.java index 01168b0952f..2c118a5121b 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/Tester.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/client/Tester.java @@ -13,14 +13,14 @@ public class Tester { try { FhirContext ctx = new FhirContext(Patient.class); - RestfulClientFactory factory = ctx.newClientFactory(); + IRestfulClientFactory factory = ctx.newRestfulClientFactory(); ITestClient client = factory.newClient(ITestClient.class, "http://spark.furore.com/fhir/"); -// Patient patient = client.getPatientById(new IdDt("1")); -// System.out.println(ctx.newXmlParser().encodeResourceToString(patient)); + Patient patient = client.getPatientById(new IdDt("1")); + System.out.println(ctx.newXmlParser().encodeResourceToString(patient)); - Patient patient2 = client.findPatientByMrn(new IdentifierDt("http://orionhealth.com/mrn", "PRP1660")); - System.out.println(ctx.newXmlParser().encodeResourceToString(patient2)); +// Patient patient2 = client.findPatientByMrn(new IdentifierDt("http://orionhealth.com/mrn", "PRP1660")); +// System.out.println(ctx.newXmlParser().encodeResourceToString(patient2)); } catch (NonFhirResponseException e) { e.printStackTrace(); diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/DummyPatientResourceProvider.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/DummyPatientResourceProvider.java index a046e1dc43b..453bbf21c1c 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/DummyPatientResourceProvider.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/DummyPatientResourceProvider.java @@ -52,7 +52,7 @@ public class DummyPatientResourceProvider implements IResourceProvider { } @Search(Patient.class) - public Patient getPatient(@Required(name = "identifier") IdentifierDt theIdentifier) { + public Patient getPatient(@Required(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier) { for (Patient next : myIdToPatient.values()) { for (IdentifierDt nextId : next.getIdentifier()) { if (nextId.matchesSystemAndValue(theIdentifier)) { diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java index 205feb6584e..191493c954e 100644 --- a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java +++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/server/ResourceMethodTest.java @@ -38,7 +38,7 @@ public class ResourceMethodTest { inputParams.add("firstName"); inputParams.add("lastName"); - assertEquals(false, rm.matches("ResName", null, null, inputParams)); // False + assertEquals(false, rm.matches("Patient", null, null, inputParams)); // False } @Test @@ -53,7 +53,7 @@ public class ResourceMethodTest { Set inputParams = new HashSet(); inputParams.add("mrn"); - assertEquals(true, rm.matches("ResName", null, null, inputParams)); // True + assertEquals(true, rm.matches("Patient", null, null, inputParams)); // True } @Test @@ -70,7 +70,7 @@ public class ResourceMethodTest { inputParams.add("firstName"); inputParams.add("mrn"); - assertEquals(true, rm.matches("ResName", null, null, inputParams)); // True + assertEquals(true, rm.matches("Patient", null, null, inputParams)); // True } @Test @@ -88,7 +88,7 @@ public class ResourceMethodTest { inputParams.add("lastName"); inputParams.add("mrn"); - assertEquals(true, rm.matches("ResName", null, null, inputParams)); // True + assertEquals(true, rm.matches("Patient", null, null, inputParams)); // True } @Test @@ -107,6 +107,6 @@ public class ResourceMethodTest { inputParams.add("mrn"); inputParams.add("foo"); - assertEquals(false, rm.matches("ResName", null, null, inputParams)); // False + assertEquals(false, rm.matches("Patient", null, null, inputParams)); // False } } diff --git a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/BaseStructureParser.java b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/BaseStructureParser.java index 6773ce7446a..d9e263c22f2 100644 --- a/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/BaseStructureParser.java +++ b/hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/BaseStructureParser.java @@ -85,7 +85,11 @@ public abstract class BaseStructureParser { Class[] paramTypes = nextConstructor.getParameterTypes(); for (int i = 0; i < paramTypes.length; i++) { Parameter p = new Parameter(); - p.setDatatype(paramTypes[0].getSimpleName()); + if (paramTypes[i].getCanonicalName().startsWith("java.math")) { + p.setDatatype(paramTypes[i].getCanonicalName()); + }else { + p.setDatatype(paramTypes[i].getSimpleName()); + } p.setParameter(findAnnotation(childDt, paramAnn[i], SimpleSetter.Parameter.class).name()); ss.getParameters().add(p); } diff --git a/hapi-tinder-plugin/src/main/resources/vm/dt_composite.vm b/hapi-tinder-plugin/src/main/resources/vm/dt_composite.vm index e8c5246f411..242a633b667 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/dt_composite.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/dt_composite.vm @@ -24,10 +24,7 @@ import ${packageBase}.resource.*; *

*/ @DatatypeDef(name="${className}") -public class ${className}Dt extends BaseElement implements ICompositeDatatype -#if ( ${className} == "Identifier" ) -, IQueryParameter -#end +public class ${className}Dt extends BaseElement implements ICompositeDatatype #{if}( ${className} == "Identifier" ), IQueryParameterType #{end} { ######################### diff --git a/hapi-tinder-plugin/src/main/resources/vm/templates.vm b/hapi-tinder-plugin/src/main/resources/vm/templates.vm index f037fb10848..959dfec00d3 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/templates.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/templates.vm @@ -36,6 +36,12 @@ ################################################################## #macro ( childAccessors $childElements ) + + @Override + public boolean isEmpty() { + return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( #{foreach}($child in $childElements) ${child.variableName}#{if}($foreach.hasNext), #{end}#{end}); + } + #foreach ( $child in $childElements ) /** * Gets the value(s) for ${child.elementName} (${child.shortName}). @@ -157,6 +163,7 @@ ${child.variableName} = new ${ss.datatype}(#{foreach}($param in $ss.parameters)${param.parameter}#{if}( $foreach.hasNext ), #{end}#{end}); } #end + #end ##foreach-child-in-simplesetters #end