001
002
003
004
005
006
007
008
009
010
011
012
013
014
015
016
017package ca.uhn.fhir.model.dstu2.composite;
018
019import java.net.URI;
020import java.math.BigDecimal;
021import org.apache.commons.lang3.StringUtils;
022import java.util.*;
023import ca.uhn.fhir.model.api.*;
024import ca.uhn.fhir.model.primitive.*;
025import ca.uhn.fhir.model.api.annotation.*;
026import ca.uhn.fhir.model.base.composite.*;
027
028import ca.uhn.fhir.model.dstu2.valueset.AddressTypeEnum;
029import ca.uhn.fhir.model.dstu2.valueset.AddressUseEnum;
030import ca.uhn.fhir.model.dstu2.valueset.AggregationModeEnum;
031import ca.uhn.fhir.model.dstu2.valueset.BindingStrengthEnum;
032import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
033import ca.uhn.fhir.model.dstu2.composite.CodingDt;
034import ca.uhn.fhir.model.dstu2.valueset.ConstraintSeverityEnum;
035import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
036import ca.uhn.fhir.model.dstu2.valueset.ContactPointUseEnum;
037import ca.uhn.fhir.model.dstu2.resource.Device;
038import ca.uhn.fhir.model.dstu2.valueset.EventTimingEnum;
039import ca.uhn.fhir.model.dstu2.valueset.IdentifierTypeCodesEnum;
040import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
041import ca.uhn.fhir.model.dstu2.valueset.NameUseEnum;
042import ca.uhn.fhir.model.dstu2.resource.Organization;
043import ca.uhn.fhir.model.dstu2.resource.Patient;
044import ca.uhn.fhir.model.dstu2.composite.PeriodDt;
045import ca.uhn.fhir.model.dstu2.resource.Practitioner;
046import ca.uhn.fhir.model.dstu2.valueset.PropertyRepresentationEnum;
047import ca.uhn.fhir.model.dstu2.valueset.QuantityComparatorEnum;
048import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
049import ca.uhn.fhir.model.dstu2.composite.RangeDt;
050import ca.uhn.fhir.model.dstu2.resource.RelatedPerson;
051import ca.uhn.fhir.model.dstu2.valueset.SignatureTypeCodesEnum;
052import ca.uhn.fhir.model.dstu2.valueset.SlicingRulesEnum;
053import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
054import ca.uhn.fhir.model.dstu2.valueset.TimingAbbreviationEnum;
055import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum;
056import ca.uhn.fhir.model.dstu2.resource.ValueSet;
057import ca.uhn.fhir.model.dstu2.composite.BoundCodeableConceptDt;
058import ca.uhn.fhir.model.dstu2.composite.DurationDt;
059import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
060import ca.uhn.fhir.model.dstu2.composite.SimpleQuantityDt;
061import ca.uhn.fhir.model.primitive.Base64BinaryDt;
062import ca.uhn.fhir.model.primitive.BooleanDt;
063import ca.uhn.fhir.model.primitive.BoundCodeDt;
064import ca.uhn.fhir.model.primitive.CodeDt;
065import ca.uhn.fhir.model.primitive.DateTimeDt;
066import ca.uhn.fhir.model.primitive.DecimalDt;
067import ca.uhn.fhir.model.primitive.IdDt;
068import ca.uhn.fhir.model.primitive.InstantDt;
069import ca.uhn.fhir.model.primitive.IntegerDt;
070import ca.uhn.fhir.model.primitive.MarkdownDt;
071import ca.uhn.fhir.model.primitive.PositiveIntDt;
072import ca.uhn.fhir.model.primitive.StringDt;
073import ca.uhn.fhir.model.primitive.UnsignedIntDt;
074import ca.uhn.fhir.model.primitive.UriDt;
075
076/**
077 * HAPI/FHIR <b>MetaDt</b> Datatype
078 * ()
079 *
080 * <p>
081 * <b>Definition:</b>
082 * The metadata about a resource. This is content in the resource that is maintained by the infrastructure. Changes to the content may not always be associated with version changes to the resource
083 * </p> 
084 *
085 * <p>
086 * <b>Requirements:</b>
087 * 
088 * </p> 
089 */
090@DatatypeDef(name="Meta") 
091public class MetaDt
092        extends  BaseIdentifiableElement         implements ICompositeDatatype, org.hl7.fhir.instance.model.api.IBaseMetaType {
093
094        /**
095         * Constructor
096         */
097        public MetaDt() {
098                // nothing
099        }
100
101        @Override
102        public MetaDt setLastUpdated(Date theHeaderDateValue) {
103                return setLastUpdated(theHeaderDateValue, TemporalPrecisionEnum.SECOND);
104        }
105
106        /**
107         * Returns the first tag (if any) that has the given system and code, or returns
108         * <code>null</code> if none
109         */
110        public CodingDt getTag(String theSystem, String theCode) {
111                for (CodingDt next : getTag()) {
112                        if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
113                                return next;
114                        }
115                }
116                return null;
117        }
118
119        /**
120         * Returns the first security label (if any) that has the given system and code, or returns
121         * <code>null</code> if none
122         */
123        public CodingDt getSecurity(String theSystem, String theCode) {
124                for (CodingDt next : getTag()) {
125                        if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) {
126                                return next;
127                        }
128                }
129                return null;
130        }  
131
132
133        @Child(name="versionId", type=IdDt.class, order=0, min=0, max=1, summary=true, modifier=false)  
134        @Description(
135                shortDefinition="",
136                formalDefinition="The version specific identifier, as it appears in the version portion of the URL. This values changes when the resource is created, updated, or deleted"
137        )
138        private IdDt myVersionId;
139        
140        @Child(name="lastUpdated", type=InstantDt.class, order=1, min=0, max=1, summary=true, modifier=false)   
141        @Description(
142                shortDefinition="",
143                formalDefinition="When the resource last changed - e.g. when the version changed"
144        )
145        private InstantDt myLastUpdated;
146        
147        @Child(name="profile", type=UriDt.class, order=2, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false) 
148        @Description(
149                shortDefinition="",
150                formalDefinition="A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]"
151        )
152        private java.util.List<UriDt> myProfile;
153        
154        @Child(name="security", type=CodingDt.class, order=3, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)     
155        @Description(
156                shortDefinition="",
157                formalDefinition="Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure"
158        )
159        private java.util.List<CodingDt> mySecurity;
160        
161        @Child(name="tag", type=CodingDt.class, order=4, min=0, max=Child.MAX_UNLIMITED, summary=true, modifier=false)  
162        @Description(
163                shortDefinition="",
164                formalDefinition="Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource"
165        )
166        private java.util.List<CodingDt> myTag;
167        
168
169        @Override
170        public boolean isEmpty() {
171                return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(  myVersionId,  myLastUpdated,  myProfile,  mySecurity,  myTag);
172        }
173        
174        @Override
175        public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
176                return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myVersionId, myLastUpdated, myProfile, mySecurity, myTag);
177        }
178
179        /**
180         * Gets the value(s) for <b>versionId</b> ().
181         * creating it if it does
182         * not exist. Will not return <code>null</code>.
183         *
184     * <p>
185     * <b>Definition:</b>
186     * The version specific identifier, as it appears in the version portion of the URL. This values changes when the resource is created, updated, or deleted
187     * </p> 
188         */
189        public IdDt getVersionIdElement() {  
190                if (myVersionId == null) {
191                        myVersionId = new IdDt();
192                }
193                return myVersionId;
194        }
195
196        
197        /**
198         * Gets the value(s) for <b>versionId</b> ().
199         * creating it if it does
200         * not exist. This method may return <code>null</code>.
201         *
202     * <p>
203     * <b>Definition:</b>
204     * The version specific identifier, as it appears in the version portion of the URL. This values changes when the resource is created, updated, or deleted
205     * </p> 
206         */
207        public String getVersionId() {  
208                return getVersionIdElement().getValue();
209        }
210
211        /**
212         * Sets the value(s) for <b>versionId</b> ()
213         *
214     * <p>
215     * <b>Definition:</b>
216     * The version specific identifier, as it appears in the version portion of the URL. This values changes when the resource is created, updated, or deleted
217     * </p> 
218         */
219        public MetaDt setVersionId(IdDt theValue) {
220                myVersionId = theValue;
221                return this;
222        }
223        
224        
225
226        /**
227         * Sets the value for <b>versionId</b> ()
228         *
229     * <p>
230     * <b>Definition:</b>
231     * The version specific identifier, as it appears in the version portion of the URL. This values changes when the resource is created, updated, or deleted
232     * </p> 
233         */
234        public MetaDt setVersionId( String theId) {
235                myVersionId = new IdDt(theId); 
236                return this; 
237        }
238
239 
240        /**
241         * Gets the value(s) for <b>lastUpdated</b> ().
242         * creating it if it does
243         * not exist. Will not return <code>null</code>.
244         *
245     * <p>
246     * <b>Definition:</b>
247     * When the resource last changed - e.g. when the version changed
248     * </p> 
249         */
250        public InstantDt getLastUpdatedElement() {  
251                if (myLastUpdated == null) {
252                        myLastUpdated = new InstantDt();
253                }
254                return myLastUpdated;
255        }
256
257        
258        /**
259         * Gets the value(s) for <b>lastUpdated</b> ().
260         * creating it if it does
261         * not exist. This method may return <code>null</code>.
262         *
263     * <p>
264     * <b>Definition:</b>
265     * When the resource last changed - e.g. when the version changed
266     * </p> 
267         */
268        public Date getLastUpdated() {  
269                return getLastUpdatedElement().getValue();
270        }
271
272        /**
273         * Sets the value(s) for <b>lastUpdated</b> ()
274         *
275     * <p>
276     * <b>Definition:</b>
277     * When the resource last changed - e.g. when the version changed
278     * </p> 
279         */
280        public MetaDt setLastUpdated(InstantDt theValue) {
281                myLastUpdated = theValue;
282                return this;
283        }
284        
285        
286
287        /**
288         * Sets the value for <b>lastUpdated</b> ()
289         *
290     * <p>
291     * <b>Definition:</b>
292     * When the resource last changed - e.g. when the version changed
293     * </p> 
294         */
295        public MetaDt setLastUpdatedWithMillisPrecision( Date theDate) {
296                myLastUpdated = new InstantDt(theDate); 
297                return this; 
298        }
299
300        /**
301         * Sets the value for <b>lastUpdated</b> ()
302         *
303     * <p>
304     * <b>Definition:</b>
305     * When the resource last changed - e.g. when the version changed
306     * </p> 
307         */
308        public MetaDt setLastUpdated( Date theDate,  TemporalPrecisionEnum thePrecision) {
309                myLastUpdated = new InstantDt(theDate, thePrecision); 
310                return this; 
311        }
312
313 
314        /**
315         * Gets the value(s) for <b>profile</b> ().
316         * creating it if it does
317         * not exist. Will not return <code>null</code>.
318         *
319     * <p>
320     * <b>Definition:</b>
321     * A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]
322     * </p> 
323         */
324        public java.util.List<UriDt> getProfile() {  
325                if (myProfile == null) {
326                        myProfile = new java.util.ArrayList<UriDt>();
327                }
328                return myProfile;
329        }
330
331        /**
332         * Sets the value(s) for <b>profile</b> ()
333         *
334     * <p>
335     * <b>Definition:</b>
336     * A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]
337     * </p> 
338         */
339        public MetaDt setProfile(java.util.List<UriDt> theValue) {
340                myProfile = theValue;
341                return this;
342        }
343        
344        
345
346        /**
347         * Adds and returns a new value for <b>profile</b> ()
348         *
349     * <p>
350     * <b>Definition:</b>
351     * A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]
352     * </p> 
353         */
354        public UriDt addProfile() {
355                UriDt newType = new UriDt();
356                getProfile().add(newType);
357                return newType; 
358        }
359
360        /**
361         * Adds a given new value for <b>profile</b> ()
362         *
363         * <p>
364         * <b>Definition:</b>
365         * A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]
366         * </p>
367         * @param theValue The profile to add (must not be <code>null</code>)
368         */
369        public MetaDt addProfile(UriDt theValue) {
370                if (theValue == null) {
371                        throw new NullPointerException("theValue must not be null");
372                }
373                getProfile().add(theValue);
374                return this;
375        }
376
377        /**
378         * Gets the first repetition for <b>profile</b> (),
379         * creating it if it does not already exist.
380         *
381     * <p>
382     * <b>Definition:</b>
383     * A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]
384     * </p> 
385         */
386        public UriDt getProfileFirstRep() {
387                if (getProfile().isEmpty()) {
388                        return addProfile();
389                }
390                return getProfile().get(0); 
391        }
392        /**
393         * Adds a new value for <b>profile</b> ()
394         *
395     * <p>
396     * <b>Definition:</b>
397     * A list of profiles [[[StructureDefinition]]]s that this resource claims to conform to. The URL is a reference to [[[StructureDefinition.url]]]
398     * </p> 
399     *
400     * @return Returns a reference to this object, to allow for simple chaining.
401         */
402        public MetaDt addProfile( String theUri) {
403                if (myProfile == null) {
404                        myProfile = new java.util.ArrayList<UriDt>();
405                }
406                myProfile.add(new UriDt(theUri));
407                return this; 
408        }
409
410 
411        /**
412         * Gets the value(s) for <b>security</b> ().
413         * creating it if it does
414         * not exist. Will not return <code>null</code>.
415         *
416     * <p>
417     * <b>Definition:</b>
418     * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure
419     * </p> 
420         */
421        public java.util.List<CodingDt> getSecurity() {  
422                if (mySecurity == null) {
423                        mySecurity = new java.util.ArrayList<CodingDt>();
424                }
425                return mySecurity;
426        }
427
428        /**
429         * Sets the value(s) for <b>security</b> ()
430         *
431     * <p>
432     * <b>Definition:</b>
433     * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure
434     * </p> 
435         */
436        public MetaDt setSecurity(java.util.List<CodingDt> theValue) {
437                mySecurity = theValue;
438                return this;
439        }
440        
441        
442
443        /**
444         * Adds and returns a new value for <b>security</b> ()
445         *
446     * <p>
447     * <b>Definition:</b>
448     * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure
449     * </p> 
450         */
451        public CodingDt addSecurity() {
452                CodingDt newType = new CodingDt();
453                getSecurity().add(newType);
454                return newType; 
455        }
456
457        /**
458         * Adds a given new value for <b>security</b> ()
459         *
460         * <p>
461         * <b>Definition:</b>
462         * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure
463         * </p>
464         * @param theValue The security to add (must not be <code>null</code>)
465         */
466        public MetaDt addSecurity(CodingDt theValue) {
467                if (theValue == null) {
468                        throw new NullPointerException("theValue must not be null");
469                }
470                getSecurity().add(theValue);
471                return this;
472        }
473
474        /**
475         * Gets the first repetition for <b>security</b> (),
476         * creating it if it does not already exist.
477         *
478     * <p>
479     * <b>Definition:</b>
480     * Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure
481     * </p> 
482         */
483        public CodingDt getSecurityFirstRep() {
484                if (getSecurity().isEmpty()) {
485                        return addSecurity();
486                }
487                return getSecurity().get(0); 
488        }
489  
490        /**
491         * Gets the value(s) for <b>tag</b> ().
492         * creating it if it does
493         * not exist. Will not return <code>null</code>.
494         *
495     * <p>
496     * <b>Definition:</b>
497     * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource
498     * </p> 
499         */
500        public java.util.List<CodingDt> getTag() {  
501                if (myTag == null) {
502                        myTag = new java.util.ArrayList<CodingDt>();
503                }
504                return myTag;
505        }
506
507        /**
508         * Sets the value(s) for <b>tag</b> ()
509         *
510     * <p>
511     * <b>Definition:</b>
512     * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource
513     * </p> 
514         */
515        public MetaDt setTag(java.util.List<CodingDt> theValue) {
516                myTag = theValue;
517                return this;
518        }
519        
520        
521
522        /**
523         * Adds and returns a new value for <b>tag</b> ()
524         *
525     * <p>
526     * <b>Definition:</b>
527     * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource
528     * </p> 
529         */
530        public CodingDt addTag() {
531                CodingDt newType = new CodingDt();
532                getTag().add(newType);
533                return newType; 
534        }
535
536        /**
537         * Adds a given new value for <b>tag</b> ()
538         *
539         * <p>
540         * <b>Definition:</b>
541         * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource
542         * </p>
543         * @param theValue The tag to add (must not be <code>null</code>)
544         */
545        public MetaDt addTag(CodingDt theValue) {
546                if (theValue == null) {
547                        throw new NullPointerException("theValue must not be null");
548                }
549                getTag().add(theValue);
550                return this;
551        }
552
553        /**
554         * Gets the first repetition for <b>tag</b> (),
555         * creating it if it does not already exist.
556         *
557     * <p>
558     * <b>Definition:</b>
559     * Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource
560     * </p> 
561         */
562        public CodingDt getTagFirstRep() {
563                if (getTag().isEmpty()) {
564                        return addTag();
565                }
566                return getTag().get(0); 
567        }
568  
569
570
571}