001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046/**
047 * Defines the characteristics of a message that can be shared between systems, including the type of event that initiates the message, the content to be transmitted and what response(s), if any, are permitted.
048 */
049@ResourceDef(name="MessageDefinition", profile="http://hl7.org/fhir/Profile/MessageDefinition")
050@ChildOrder(names={"url", "identifier", "version", "name", "title", "status", "experimental", "date", "publisher", "contact", "description", "useContext", "jurisdiction", "purpose", "copyright", "base", "parent", "replaces", "event", "category", "focus", "responseRequired", "allowedResponse"})
051public class MessageDefinition extends MetadataResource {
052
053    public enum MessageSignificanceCategory {
054        /**
055         * The message represents/requests a change that should not be processed more than once; e.g., making a booking for an appointment.
056         */
057        CONSEQUENCE, 
058        /**
059         * The message represents a response to query for current information. Retrospective processing is wrong and/or wasteful.
060         */
061        CURRENCY, 
062        /**
063         * The content is not necessarily intended to be current, and it can be reprocessed, though there may be version issues created by processing old notifications.
064         */
065        NOTIFICATION, 
066        /**
067         * added to help the parsers with the generic types
068         */
069        NULL;
070        public static MessageSignificanceCategory fromCode(String codeString) throws FHIRException {
071            if (codeString == null || "".equals(codeString))
072                return null;
073        if ("Consequence".equals(codeString))
074          return CONSEQUENCE;
075        if ("Currency".equals(codeString))
076          return CURRENCY;
077        if ("Notification".equals(codeString))
078          return NOTIFICATION;
079        if (Configuration.isAcceptInvalidEnums())
080          return null;
081        else
082          throw new FHIRException("Unknown MessageSignificanceCategory code '"+codeString+"'");
083        }
084        public String toCode() {
085          switch (this) {
086            case CONSEQUENCE: return "Consequence";
087            case CURRENCY: return "Currency";
088            case NOTIFICATION: return "Notification";
089            default: return "?";
090          }
091        }
092        public String getSystem() {
093          switch (this) {
094            case CONSEQUENCE: return "http://hl7.org/fhir/message-significance-category";
095            case CURRENCY: return "http://hl7.org/fhir/message-significance-category";
096            case NOTIFICATION: return "http://hl7.org/fhir/message-significance-category";
097            default: return "?";
098          }
099        }
100        public String getDefinition() {
101          switch (this) {
102            case CONSEQUENCE: return "The message represents/requests a change that should not be processed more than once; e.g., making a booking for an appointment.";
103            case CURRENCY: return "The message represents a response to query for current information. Retrospective processing is wrong and/or wasteful.";
104            case NOTIFICATION: return "The content is not necessarily intended to be current, and it can be reprocessed, though there may be version issues created by processing old notifications.";
105            default: return "?";
106          }
107        }
108        public String getDisplay() {
109          switch (this) {
110            case CONSEQUENCE: return "Consequence";
111            case CURRENCY: return "Currency";
112            case NOTIFICATION: return "Notification";
113            default: return "?";
114          }
115        }
116    }
117
118  public static class MessageSignificanceCategoryEnumFactory implements EnumFactory<MessageSignificanceCategory> {
119    public MessageSignificanceCategory fromCode(String codeString) throws IllegalArgumentException {
120      if (codeString == null || "".equals(codeString))
121            if (codeString == null || "".equals(codeString))
122                return null;
123        if ("Consequence".equals(codeString))
124          return MessageSignificanceCategory.CONSEQUENCE;
125        if ("Currency".equals(codeString))
126          return MessageSignificanceCategory.CURRENCY;
127        if ("Notification".equals(codeString))
128          return MessageSignificanceCategory.NOTIFICATION;
129        throw new IllegalArgumentException("Unknown MessageSignificanceCategory code '"+codeString+"'");
130        }
131        public Enumeration<MessageSignificanceCategory> fromType(Base code) throws FHIRException {
132          if (code == null)
133            return null;
134          if (code.isEmpty())
135            return new Enumeration<MessageSignificanceCategory>(this);
136          String codeString = ((PrimitiveType) code).asStringValue();
137          if (codeString == null || "".equals(codeString))
138            return null;
139        if ("Consequence".equals(codeString))
140          return new Enumeration<MessageSignificanceCategory>(this, MessageSignificanceCategory.CONSEQUENCE);
141        if ("Currency".equals(codeString))
142          return new Enumeration<MessageSignificanceCategory>(this, MessageSignificanceCategory.CURRENCY);
143        if ("Notification".equals(codeString))
144          return new Enumeration<MessageSignificanceCategory>(this, MessageSignificanceCategory.NOTIFICATION);
145        throw new FHIRException("Unknown MessageSignificanceCategory code '"+codeString+"'");
146        }
147    public String toCode(MessageSignificanceCategory code) {
148      if (code == MessageSignificanceCategory.CONSEQUENCE)
149        return "Consequence";
150      if (code == MessageSignificanceCategory.CURRENCY)
151        return "Currency";
152      if (code == MessageSignificanceCategory.NOTIFICATION)
153        return "Notification";
154      return "?";
155      }
156    public String toSystem(MessageSignificanceCategory code) {
157      return code.getSystem();
158      }
159    }
160
161    @Block()
162    public static class MessageDefinitionFocusComponent extends BackboneElement implements IBaseBackboneElement {
163        /**
164         * The kind of resource that must be the focus for this message.
165         */
166        @Child(name = "code", type = {CodeType.class}, order=1, min=1, max=1, modifier=false, summary=true)
167        @Description(shortDefinition="Type of resource", formalDefinition="The kind of resource that must be the focus for this message." )
168        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/resource-types")
169        protected CodeType code;
170
171        /**
172         * A profile that reflects constraints for the focal resource (and potentially for related resources).
173         */
174        @Child(name = "profile", type = {StructureDefinition.class}, order=2, min=0, max=1, modifier=false, summary=false)
175        @Description(shortDefinition="Profile that must be adhered to by focus", formalDefinition="A profile that reflects constraints for the focal resource (and potentially for related resources)." )
176        protected Reference profile;
177
178        /**
179         * The actual object that is the target of the reference (A profile that reflects constraints for the focal resource (and potentially for related resources).)
180         */
181        protected StructureDefinition profileTarget;
182
183        /**
184         * Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.
185         */
186        @Child(name = "min", type = {UnsignedIntType.class}, order=3, min=0, max=1, modifier=false, summary=false)
187        @Description(shortDefinition="Minimum number of focuses of this type", formalDefinition="Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition." )
188        protected UnsignedIntType min;
189
190        /**
191         * Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.
192         */
193        @Child(name = "max", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
194        @Description(shortDefinition="Maximum number of focuses of this type", formalDefinition="Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition." )
195        protected StringType max;
196
197        private static final long serialVersionUID = 35658543L;
198
199    /**
200     * Constructor
201     */
202      public MessageDefinitionFocusComponent() {
203        super();
204      }
205
206    /**
207     * Constructor
208     */
209      public MessageDefinitionFocusComponent(CodeType code) {
210        super();
211        this.code = code;
212      }
213
214        /**
215         * @return {@link #code} (The kind of resource that must be the focus for this message.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
216         */
217        public CodeType getCodeElement() { 
218          if (this.code == null)
219            if (Configuration.errorOnAutoCreate())
220              throw new Error("Attempt to auto-create MessageDefinitionFocusComponent.code");
221            else if (Configuration.doAutoCreate())
222              this.code = new CodeType(); // bb
223          return this.code;
224        }
225
226        public boolean hasCodeElement() { 
227          return this.code != null && !this.code.isEmpty();
228        }
229
230        public boolean hasCode() { 
231          return this.code != null && !this.code.isEmpty();
232        }
233
234        /**
235         * @param value {@link #code} (The kind of resource that must be the focus for this message.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
236         */
237        public MessageDefinitionFocusComponent setCodeElement(CodeType value) { 
238          this.code = value;
239          return this;
240        }
241
242        /**
243         * @return The kind of resource that must be the focus for this message.
244         */
245        public String getCode() { 
246          return this.code == null ? null : this.code.getValue();
247        }
248
249        /**
250         * @param value The kind of resource that must be the focus for this message.
251         */
252        public MessageDefinitionFocusComponent setCode(String value) { 
253            if (this.code == null)
254              this.code = new CodeType();
255            this.code.setValue(value);
256          return this;
257        }
258
259        /**
260         * @return {@link #profile} (A profile that reflects constraints for the focal resource (and potentially for related resources).)
261         */
262        public Reference getProfile() { 
263          if (this.profile == null)
264            if (Configuration.errorOnAutoCreate())
265              throw new Error("Attempt to auto-create MessageDefinitionFocusComponent.profile");
266            else if (Configuration.doAutoCreate())
267              this.profile = new Reference(); // cc
268          return this.profile;
269        }
270
271        public boolean hasProfile() { 
272          return this.profile != null && !this.profile.isEmpty();
273        }
274
275        /**
276         * @param value {@link #profile} (A profile that reflects constraints for the focal resource (and potentially for related resources).)
277         */
278        public MessageDefinitionFocusComponent setProfile(Reference value) { 
279          this.profile = value;
280          return this;
281        }
282
283        /**
284         * @return {@link #profile} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A profile that reflects constraints for the focal resource (and potentially for related resources).)
285         */
286        public StructureDefinition getProfileTarget() { 
287          if (this.profileTarget == null)
288            if (Configuration.errorOnAutoCreate())
289              throw new Error("Attempt to auto-create MessageDefinitionFocusComponent.profile");
290            else if (Configuration.doAutoCreate())
291              this.profileTarget = new StructureDefinition(); // aa
292          return this.profileTarget;
293        }
294
295        /**
296         * @param value {@link #profile} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A profile that reflects constraints for the focal resource (and potentially for related resources).)
297         */
298        public MessageDefinitionFocusComponent setProfileTarget(StructureDefinition value) { 
299          this.profileTarget = value;
300          return this;
301        }
302
303        /**
304         * @return {@link #min} (Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
305         */
306        public UnsignedIntType getMinElement() { 
307          if (this.min == null)
308            if (Configuration.errorOnAutoCreate())
309              throw new Error("Attempt to auto-create MessageDefinitionFocusComponent.min");
310            else if (Configuration.doAutoCreate())
311              this.min = new UnsignedIntType(); // bb
312          return this.min;
313        }
314
315        public boolean hasMinElement() { 
316          return this.min != null && !this.min.isEmpty();
317        }
318
319        public boolean hasMin() { 
320          return this.min != null && !this.min.isEmpty();
321        }
322
323        /**
324         * @param value {@link #min} (Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.). This is the underlying object with id, value and extensions. The accessor "getMin" gives direct access to the value
325         */
326        public MessageDefinitionFocusComponent setMinElement(UnsignedIntType value) { 
327          this.min = value;
328          return this;
329        }
330
331        /**
332         * @return Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.
333         */
334        public int getMin() { 
335          return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
336        }
337
338        /**
339         * @param value Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.
340         */
341        public MessageDefinitionFocusComponent setMin(int value) { 
342            if (this.min == null)
343              this.min = new UnsignedIntType();
344            this.min.setValue(value);
345          return this;
346        }
347
348        /**
349         * @return {@link #max} (Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
350         */
351        public StringType getMaxElement() { 
352          if (this.max == null)
353            if (Configuration.errorOnAutoCreate())
354              throw new Error("Attempt to auto-create MessageDefinitionFocusComponent.max");
355            else if (Configuration.doAutoCreate())
356              this.max = new StringType(); // bb
357          return this.max;
358        }
359
360        public boolean hasMaxElement() { 
361          return this.max != null && !this.max.isEmpty();
362        }
363
364        public boolean hasMax() { 
365          return this.max != null && !this.max.isEmpty();
366        }
367
368        /**
369         * @param value {@link #max} (Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.). This is the underlying object with id, value and extensions. The accessor "getMax" gives direct access to the value
370         */
371        public MessageDefinitionFocusComponent setMaxElement(StringType value) { 
372          this.max = value;
373          return this;
374        }
375
376        /**
377         * @return Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.
378         */
379        public String getMax() { 
380          return this.max == null ? null : this.max.getValue();
381        }
382
383        /**
384         * @param value Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.
385         */
386        public MessageDefinitionFocusComponent setMax(String value) { 
387          if (Utilities.noString(value))
388            this.max = null;
389          else {
390            if (this.max == null)
391              this.max = new StringType();
392            this.max.setValue(value);
393          }
394          return this;
395        }
396
397        protected void listChildren(List<Property> childrenList) {
398          super.listChildren(childrenList);
399          childrenList.add(new Property("code", "code", "The kind of resource that must be the focus for this message.", 0, java.lang.Integer.MAX_VALUE, code));
400          childrenList.add(new Property("profile", "Reference(StructureDefinition)", "A profile that reflects constraints for the focal resource (and potentially for related resources).", 0, java.lang.Integer.MAX_VALUE, profile));
401          childrenList.add(new Property("min", "unsignedInt", "Identifies the minimum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.", 0, java.lang.Integer.MAX_VALUE, min));
402          childrenList.add(new Property("max", "string", "Identifies the maximum number of resources of this type that must be pointed to by a message in order for it to be valid against this MessageDefinition.", 0, java.lang.Integer.MAX_VALUE, max));
403        }
404
405      @Override
406      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
407        switch (hash) {
408        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
409        case -309425751: /*profile*/ return this.profile == null ? new Base[0] : new Base[] {this.profile}; // Reference
410        case 108114: /*min*/ return this.min == null ? new Base[0] : new Base[] {this.min}; // UnsignedIntType
411        case 107876: /*max*/ return this.max == null ? new Base[0] : new Base[] {this.max}; // StringType
412        default: return super.getProperty(hash, name, checkValid);
413        }
414
415      }
416
417      @Override
418      public Base setProperty(int hash, String name, Base value) throws FHIRException {
419        switch (hash) {
420        case 3059181: // code
421          this.code = castToCode(value); // CodeType
422          return value;
423        case -309425751: // profile
424          this.profile = castToReference(value); // Reference
425          return value;
426        case 108114: // min
427          this.min = castToUnsignedInt(value); // UnsignedIntType
428          return value;
429        case 107876: // max
430          this.max = castToString(value); // StringType
431          return value;
432        default: return super.setProperty(hash, name, value);
433        }
434
435      }
436
437      @Override
438      public Base setProperty(String name, Base value) throws FHIRException {
439        if (name.equals("code")) {
440          this.code = castToCode(value); // CodeType
441        } else if (name.equals("profile")) {
442          this.profile = castToReference(value); // Reference
443        } else if (name.equals("min")) {
444          this.min = castToUnsignedInt(value); // UnsignedIntType
445        } else if (name.equals("max")) {
446          this.max = castToString(value); // StringType
447        } else
448          return super.setProperty(name, value);
449        return value;
450      }
451
452      @Override
453      public Base makeProperty(int hash, String name) throws FHIRException {
454        switch (hash) {
455        case 3059181:  return getCodeElement();
456        case -309425751:  return getProfile(); 
457        case 108114:  return getMinElement();
458        case 107876:  return getMaxElement();
459        default: return super.makeProperty(hash, name);
460        }
461
462      }
463
464      @Override
465      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
466        switch (hash) {
467        case 3059181: /*code*/ return new String[] {"code"};
468        case -309425751: /*profile*/ return new String[] {"Reference"};
469        case 108114: /*min*/ return new String[] {"unsignedInt"};
470        case 107876: /*max*/ return new String[] {"string"};
471        default: return super.getTypesForProperty(hash, name);
472        }
473
474      }
475
476      @Override
477      public Base addChild(String name) throws FHIRException {
478        if (name.equals("code")) {
479          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.code");
480        }
481        else if (name.equals("profile")) {
482          this.profile = new Reference();
483          return this.profile;
484        }
485        else if (name.equals("min")) {
486          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.min");
487        }
488        else if (name.equals("max")) {
489          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.max");
490        }
491        else
492          return super.addChild(name);
493      }
494
495      public MessageDefinitionFocusComponent copy() {
496        MessageDefinitionFocusComponent dst = new MessageDefinitionFocusComponent();
497        copyValues(dst);
498        dst.code = code == null ? null : code.copy();
499        dst.profile = profile == null ? null : profile.copy();
500        dst.min = min == null ? null : min.copy();
501        dst.max = max == null ? null : max.copy();
502        return dst;
503      }
504
505      @Override
506      public boolean equalsDeep(Base other) {
507        if (!super.equalsDeep(other))
508          return false;
509        if (!(other instanceof MessageDefinitionFocusComponent))
510          return false;
511        MessageDefinitionFocusComponent o = (MessageDefinitionFocusComponent) other;
512        return compareDeep(code, o.code, true) && compareDeep(profile, o.profile, true) && compareDeep(min, o.min, true)
513           && compareDeep(max, o.max, true);
514      }
515
516      @Override
517      public boolean equalsShallow(Base other) {
518        if (!super.equalsShallow(other))
519          return false;
520        if (!(other instanceof MessageDefinitionFocusComponent))
521          return false;
522        MessageDefinitionFocusComponent o = (MessageDefinitionFocusComponent) other;
523        return compareValues(code, o.code, true) && compareValues(min, o.min, true) && compareValues(max, o.max, true)
524          ;
525      }
526
527      public boolean isEmpty() {
528        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(code, profile, min, max
529          );
530      }
531
532  public String fhirType() {
533    return "MessageDefinition.focus";
534
535  }
536
537  }
538
539    @Block()
540    public static class MessageDefinitionAllowedResponseComponent extends BackboneElement implements IBaseBackboneElement {
541        /**
542         * A reference to the message definition that must be adhered to by this supported response.
543         */
544        @Child(name = "message", type = {MessageDefinition.class}, order=1, min=1, max=1, modifier=false, summary=false)
545        @Description(shortDefinition="Reference to allowed message definition response", formalDefinition="A reference to the message definition that must be adhered to by this supported response." )
546        protected Reference message;
547
548        /**
549         * The actual object that is the target of the reference (A reference to the message definition that must be adhered to by this supported response.)
550         */
551        protected MessageDefinition messageTarget;
552
553        /**
554         * Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).
555         */
556        @Child(name = "situation", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
557        @Description(shortDefinition="When should this response be used", formalDefinition="Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses)." )
558        protected MarkdownType situation;
559
560        private static final long serialVersionUID = 825230127L;
561
562    /**
563     * Constructor
564     */
565      public MessageDefinitionAllowedResponseComponent() {
566        super();
567      }
568
569    /**
570     * Constructor
571     */
572      public MessageDefinitionAllowedResponseComponent(Reference message) {
573        super();
574        this.message = message;
575      }
576
577        /**
578         * @return {@link #message} (A reference to the message definition that must be adhered to by this supported response.)
579         */
580        public Reference getMessage() { 
581          if (this.message == null)
582            if (Configuration.errorOnAutoCreate())
583              throw new Error("Attempt to auto-create MessageDefinitionAllowedResponseComponent.message");
584            else if (Configuration.doAutoCreate())
585              this.message = new Reference(); // cc
586          return this.message;
587        }
588
589        public boolean hasMessage() { 
590          return this.message != null && !this.message.isEmpty();
591        }
592
593        /**
594         * @param value {@link #message} (A reference to the message definition that must be adhered to by this supported response.)
595         */
596        public MessageDefinitionAllowedResponseComponent setMessage(Reference value) { 
597          this.message = value;
598          return this;
599        }
600
601        /**
602         * @return {@link #message} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to the message definition that must be adhered to by this supported response.)
603         */
604        public MessageDefinition getMessageTarget() { 
605          if (this.messageTarget == null)
606            if (Configuration.errorOnAutoCreate())
607              throw new Error("Attempt to auto-create MessageDefinitionAllowedResponseComponent.message");
608            else if (Configuration.doAutoCreate())
609              this.messageTarget = new MessageDefinition(); // aa
610          return this.messageTarget;
611        }
612
613        /**
614         * @param value {@link #message} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to the message definition that must be adhered to by this supported response.)
615         */
616        public MessageDefinitionAllowedResponseComponent setMessageTarget(MessageDefinition value) { 
617          this.messageTarget = value;
618          return this;
619        }
620
621        /**
622         * @return {@link #situation} (Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).). This is the underlying object with id, value and extensions. The accessor "getSituation" gives direct access to the value
623         */
624        public MarkdownType getSituationElement() { 
625          if (this.situation == null)
626            if (Configuration.errorOnAutoCreate())
627              throw new Error("Attempt to auto-create MessageDefinitionAllowedResponseComponent.situation");
628            else if (Configuration.doAutoCreate())
629              this.situation = new MarkdownType(); // bb
630          return this.situation;
631        }
632
633        public boolean hasSituationElement() { 
634          return this.situation != null && !this.situation.isEmpty();
635        }
636
637        public boolean hasSituation() { 
638          return this.situation != null && !this.situation.isEmpty();
639        }
640
641        /**
642         * @param value {@link #situation} (Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).). This is the underlying object with id, value and extensions. The accessor "getSituation" gives direct access to the value
643         */
644        public MessageDefinitionAllowedResponseComponent setSituationElement(MarkdownType value) { 
645          this.situation = value;
646          return this;
647        }
648
649        /**
650         * @return Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).
651         */
652        public String getSituation() { 
653          return this.situation == null ? null : this.situation.getValue();
654        }
655
656        /**
657         * @param value Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).
658         */
659        public MessageDefinitionAllowedResponseComponent setSituation(String value) { 
660          if (value == null)
661            this.situation = null;
662          else {
663            if (this.situation == null)
664              this.situation = new MarkdownType();
665            this.situation.setValue(value);
666          }
667          return this;
668        }
669
670        protected void listChildren(List<Property> childrenList) {
671          super.listChildren(childrenList);
672          childrenList.add(new Property("message", "Reference(MessageDefinition)", "A reference to the message definition that must be adhered to by this supported response.", 0, java.lang.Integer.MAX_VALUE, message));
673          childrenList.add(new Property("situation", "markdown", "Provides a description of the circumstances in which this response should be used (as opposed to one of the alternative responses).", 0, java.lang.Integer.MAX_VALUE, situation));
674        }
675
676      @Override
677      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
678        switch (hash) {
679        case 954925063: /*message*/ return this.message == null ? new Base[0] : new Base[] {this.message}; // Reference
680        case -73377282: /*situation*/ return this.situation == null ? new Base[0] : new Base[] {this.situation}; // MarkdownType
681        default: return super.getProperty(hash, name, checkValid);
682        }
683
684      }
685
686      @Override
687      public Base setProperty(int hash, String name, Base value) throws FHIRException {
688        switch (hash) {
689        case 954925063: // message
690          this.message = castToReference(value); // Reference
691          return value;
692        case -73377282: // situation
693          this.situation = castToMarkdown(value); // MarkdownType
694          return value;
695        default: return super.setProperty(hash, name, value);
696        }
697
698      }
699
700      @Override
701      public Base setProperty(String name, Base value) throws FHIRException {
702        if (name.equals("message")) {
703          this.message = castToReference(value); // Reference
704        } else if (name.equals("situation")) {
705          this.situation = castToMarkdown(value); // MarkdownType
706        } else
707          return super.setProperty(name, value);
708        return value;
709      }
710
711      @Override
712      public Base makeProperty(int hash, String name) throws FHIRException {
713        switch (hash) {
714        case 954925063:  return getMessage(); 
715        case -73377282:  return getSituationElement();
716        default: return super.makeProperty(hash, name);
717        }
718
719      }
720
721      @Override
722      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
723        switch (hash) {
724        case 954925063: /*message*/ return new String[] {"Reference"};
725        case -73377282: /*situation*/ return new String[] {"markdown"};
726        default: return super.getTypesForProperty(hash, name);
727        }
728
729      }
730
731      @Override
732      public Base addChild(String name) throws FHIRException {
733        if (name.equals("message")) {
734          this.message = new Reference();
735          return this.message;
736        }
737        else if (name.equals("situation")) {
738          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.situation");
739        }
740        else
741          return super.addChild(name);
742      }
743
744      public MessageDefinitionAllowedResponseComponent copy() {
745        MessageDefinitionAllowedResponseComponent dst = new MessageDefinitionAllowedResponseComponent();
746        copyValues(dst);
747        dst.message = message == null ? null : message.copy();
748        dst.situation = situation == null ? null : situation.copy();
749        return dst;
750      }
751
752      @Override
753      public boolean equalsDeep(Base other) {
754        if (!super.equalsDeep(other))
755          return false;
756        if (!(other instanceof MessageDefinitionAllowedResponseComponent))
757          return false;
758        MessageDefinitionAllowedResponseComponent o = (MessageDefinitionAllowedResponseComponent) other;
759        return compareDeep(message, o.message, true) && compareDeep(situation, o.situation, true);
760      }
761
762      @Override
763      public boolean equalsShallow(Base other) {
764        if (!super.equalsShallow(other))
765          return false;
766        if (!(other instanceof MessageDefinitionAllowedResponseComponent))
767          return false;
768        MessageDefinitionAllowedResponseComponent o = (MessageDefinitionAllowedResponseComponent) other;
769        return compareValues(situation, o.situation, true);
770      }
771
772      public boolean isEmpty() {
773        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(message, situation);
774      }
775
776  public String fhirType() {
777    return "MessageDefinition.allowedResponse";
778
779  }
780
781  }
782
783    /**
784     * A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance.
785     */
786    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
787    @Description(shortDefinition="Additional identifier for the message definition", formalDefinition="A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance." )
788    protected Identifier identifier;
789
790    /**
791     * Explaination of why this message definition is needed and why it has been designed as it has.
792     */
793    @Child(name = "purpose", type = {MarkdownType.class}, order=1, min=0, max=1, modifier=false, summary=true)
794    @Description(shortDefinition="Why this message definition is defined", formalDefinition="Explaination of why this message definition is needed and why it has been designed as it has." )
795    protected MarkdownType purpose;
796
797    /**
798     * A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.
799     */
800    @Child(name = "copyright", type = {MarkdownType.class}, order=2, min=0, max=1, modifier=false, summary=false)
801    @Description(shortDefinition="Use and/or publishing restrictions", formalDefinition="A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition." )
802    protected MarkdownType copyright;
803
804    /**
805     * The MessageDefinition that is the basis for the contents of this resource.
806     */
807    @Child(name = "base", type = {MessageDefinition.class}, order=3, min=0, max=1, modifier=false, summary=true)
808    @Description(shortDefinition="Definition this one is based on", formalDefinition="The MessageDefinition that is the basis for the contents of this resource." )
809    protected Reference base;
810
811    /**
812     * The actual object that is the target of the reference (The MessageDefinition that is the basis for the contents of this resource.)
813     */
814    protected MessageDefinition baseTarget;
815
816    /**
817     * Identifies a protocol or workflow that this MessageDefinition represents a step in.
818     */
819    @Child(name = "parent", type = {ActivityDefinition.class, PlanDefinition.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
820    @Description(shortDefinition="Protocol/workflow this is part of", formalDefinition="Identifies a protocol or workflow that this MessageDefinition represents a step in." )
821    protected List<Reference> parent;
822    /**
823     * The actual objects that are the target of the reference (Identifies a protocol or workflow that this MessageDefinition represents a step in.)
824     */
825    protected List<Resource> parentTarget;
826
827
828    /**
829     * A MessageDefinition that is superseded by this definition.
830     */
831    @Child(name = "replaces", type = {MessageDefinition.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
832    @Description(shortDefinition="Takes the place of", formalDefinition="A MessageDefinition that is superseded by this definition." )
833    protected List<Reference> replaces;
834    /**
835     * The actual objects that are the target of the reference (A MessageDefinition that is superseded by this definition.)
836     */
837    protected List<MessageDefinition> replacesTarget;
838
839
840    /**
841     * A coded identifier of a supported messaging event.
842     */
843    @Child(name = "event", type = {Coding.class}, order=6, min=1, max=1, modifier=false, summary=true)
844    @Description(shortDefinition="Event type", formalDefinition="A coded identifier of a supported messaging event." )
845    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/message-events")
846    protected Coding event;
847
848    /**
849     * The impact of the content of the message.
850     */
851    @Child(name = "category", type = {CodeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
852    @Description(shortDefinition="Consequence | Currency | Notification", formalDefinition="The impact of the content of the message." )
853    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/message-significance-category")
854    protected Enumeration<MessageSignificanceCategory> category;
855
856    /**
857     * Identifies the resource (or resources) that are being addressed by the event.  For example, the Encounter for an admit message or two Account records for a merge.
858     */
859    @Child(name = "focus", type = {}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
860    @Description(shortDefinition="Resource(s) that are the subject of the event", formalDefinition="Identifies the resource (or resources) that are being addressed by the event.  For example, the Encounter for an admit message or two Account records for a merge." )
861    protected List<MessageDefinitionFocusComponent> focus;
862
863    /**
864     * Indicates whether a response is required for this message.
865     */
866    @Child(name = "responseRequired", type = {BooleanType.class}, order=9, min=0, max=1, modifier=false, summary=false)
867    @Description(shortDefinition="Is a response required?", formalDefinition="Indicates whether a response is required for this message." )
868    protected BooleanType responseRequired;
869
870    /**
871     * Indicates what types of messages may be sent as an application-level response to this message.
872     */
873    @Child(name = "allowedResponse", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
874    @Description(shortDefinition="Responses to this message", formalDefinition="Indicates what types of messages may be sent as an application-level response to this message." )
875    protected List<MessageDefinitionAllowedResponseComponent> allowedResponse;
876
877    private static final long serialVersionUID = -219916580L;
878
879  /**
880   * Constructor
881   */
882    public MessageDefinition() {
883      super();
884    }
885
886  /**
887   * Constructor
888   */
889    public MessageDefinition(Enumeration<PublicationStatus> status, DateTimeType date, Coding event) {
890      super();
891      this.status = status;
892      this.date = date;
893      this.event = event;
894    }
895
896    /**
897     * @return {@link #url} (An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
898     */
899    public UriType getUrlElement() { 
900      if (this.url == null)
901        if (Configuration.errorOnAutoCreate())
902          throw new Error("Attempt to auto-create MessageDefinition.url");
903        else if (Configuration.doAutoCreate())
904          this.url = new UriType(); // bb
905      return this.url;
906    }
907
908    public boolean hasUrlElement() { 
909      return this.url != null && !this.url.isEmpty();
910    }
911
912    public boolean hasUrl() { 
913      return this.url != null && !this.url.isEmpty();
914    }
915
916    /**
917     * @param value {@link #url} (An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
918     */
919    public MessageDefinition setUrlElement(UriType value) { 
920      this.url = value;
921      return this;
922    }
923
924    /**
925     * @return An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).
926     */
927    public String getUrl() { 
928      return this.url == null ? null : this.url.getValue();
929    }
930
931    /**
932     * @param value An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).
933     */
934    public MessageDefinition setUrl(String value) { 
935      if (Utilities.noString(value))
936        this.url = null;
937      else {
938        if (this.url == null)
939          this.url = new UriType();
940        this.url.setValue(value);
941      }
942      return this;
943    }
944
945    /**
946     * @return {@link #identifier} (A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance.)
947     */
948    public Identifier getIdentifier() { 
949      if (this.identifier == null)
950        if (Configuration.errorOnAutoCreate())
951          throw new Error("Attempt to auto-create MessageDefinition.identifier");
952        else if (Configuration.doAutoCreate())
953          this.identifier = new Identifier(); // cc
954      return this.identifier;
955    }
956
957    public boolean hasIdentifier() { 
958      return this.identifier != null && !this.identifier.isEmpty();
959    }
960
961    /**
962     * @param value {@link #identifier} (A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance.)
963     */
964    public MessageDefinition setIdentifier(Identifier value) { 
965      this.identifier = value;
966      return this;
967    }
968
969    /**
970     * @return {@link #version} (The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
971     */
972    public StringType getVersionElement() { 
973      if (this.version == null)
974        if (Configuration.errorOnAutoCreate())
975          throw new Error("Attempt to auto-create MessageDefinition.version");
976        else if (Configuration.doAutoCreate())
977          this.version = new StringType(); // bb
978      return this.version;
979    }
980
981    public boolean hasVersionElement() { 
982      return this.version != null && !this.version.isEmpty();
983    }
984
985    public boolean hasVersion() { 
986      return this.version != null && !this.version.isEmpty();
987    }
988
989    /**
990     * @param value {@link #version} (The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
991     */
992    public MessageDefinition setVersionElement(StringType value) { 
993      this.version = value;
994      return this;
995    }
996
997    /**
998     * @return The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
999     */
1000    public String getVersion() { 
1001      return this.version == null ? null : this.version.getValue();
1002    }
1003
1004    /**
1005     * @param value The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.
1006     */
1007    public MessageDefinition setVersion(String value) { 
1008      if (Utilities.noString(value))
1009        this.version = null;
1010      else {
1011        if (this.version == null)
1012          this.version = new StringType();
1013        this.version.setValue(value);
1014      }
1015      return this;
1016    }
1017
1018    /**
1019     * @return {@link #name} (A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1020     */
1021    public StringType getNameElement() { 
1022      if (this.name == null)
1023        if (Configuration.errorOnAutoCreate())
1024          throw new Error("Attempt to auto-create MessageDefinition.name");
1025        else if (Configuration.doAutoCreate())
1026          this.name = new StringType(); // bb
1027      return this.name;
1028    }
1029
1030    public boolean hasNameElement() { 
1031      return this.name != null && !this.name.isEmpty();
1032    }
1033
1034    public boolean hasName() { 
1035      return this.name != null && !this.name.isEmpty();
1036    }
1037
1038    /**
1039     * @param value {@link #name} (A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
1040     */
1041    public MessageDefinition setNameElement(StringType value) { 
1042      this.name = value;
1043      return this;
1044    }
1045
1046    /**
1047     * @return A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
1048     */
1049    public String getName() { 
1050      return this.name == null ? null : this.name.getValue();
1051    }
1052
1053    /**
1054     * @param value A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.
1055     */
1056    public MessageDefinition setName(String value) { 
1057      if (Utilities.noString(value))
1058        this.name = null;
1059      else {
1060        if (this.name == null)
1061          this.name = new StringType();
1062        this.name.setValue(value);
1063      }
1064      return this;
1065    }
1066
1067    /**
1068     * @return {@link #title} (A short, descriptive, user-friendly title for the message definition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1069     */
1070    public StringType getTitleElement() { 
1071      if (this.title == null)
1072        if (Configuration.errorOnAutoCreate())
1073          throw new Error("Attempt to auto-create MessageDefinition.title");
1074        else if (Configuration.doAutoCreate())
1075          this.title = new StringType(); // bb
1076      return this.title;
1077    }
1078
1079    public boolean hasTitleElement() { 
1080      return this.title != null && !this.title.isEmpty();
1081    }
1082
1083    public boolean hasTitle() { 
1084      return this.title != null && !this.title.isEmpty();
1085    }
1086
1087    /**
1088     * @param value {@link #title} (A short, descriptive, user-friendly title for the message definition.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
1089     */
1090    public MessageDefinition setTitleElement(StringType value) { 
1091      this.title = value;
1092      return this;
1093    }
1094
1095    /**
1096     * @return A short, descriptive, user-friendly title for the message definition.
1097     */
1098    public String getTitle() { 
1099      return this.title == null ? null : this.title.getValue();
1100    }
1101
1102    /**
1103     * @param value A short, descriptive, user-friendly title for the message definition.
1104     */
1105    public MessageDefinition setTitle(String value) { 
1106      if (Utilities.noString(value))
1107        this.title = null;
1108      else {
1109        if (this.title == null)
1110          this.title = new StringType();
1111        this.title.setValue(value);
1112      }
1113      return this;
1114    }
1115
1116    /**
1117     * @return {@link #status} (The status of this message definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1118     */
1119    public Enumeration<PublicationStatus> getStatusElement() { 
1120      if (this.status == null)
1121        if (Configuration.errorOnAutoCreate())
1122          throw new Error("Attempt to auto-create MessageDefinition.status");
1123        else if (Configuration.doAutoCreate())
1124          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory()); // bb
1125      return this.status;
1126    }
1127
1128    public boolean hasStatusElement() { 
1129      return this.status != null && !this.status.isEmpty();
1130    }
1131
1132    public boolean hasStatus() { 
1133      return this.status != null && !this.status.isEmpty();
1134    }
1135
1136    /**
1137     * @param value {@link #status} (The status of this message definition. Enables tracking the life-cycle of the content.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
1138     */
1139    public MessageDefinition setStatusElement(Enumeration<PublicationStatus> value) { 
1140      this.status = value;
1141      return this;
1142    }
1143
1144    /**
1145     * @return The status of this message definition. Enables tracking the life-cycle of the content.
1146     */
1147    public PublicationStatus getStatus() { 
1148      return this.status == null ? null : this.status.getValue();
1149    }
1150
1151    /**
1152     * @param value The status of this message definition. Enables tracking the life-cycle of the content.
1153     */
1154    public MessageDefinition setStatus(PublicationStatus value) { 
1155        if (this.status == null)
1156          this.status = new Enumeration<PublicationStatus>(new PublicationStatusEnumFactory());
1157        this.status.setValue(value);
1158      return this;
1159    }
1160
1161    /**
1162     * @return {@link #experimental} (A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1163     */
1164    public BooleanType getExperimentalElement() { 
1165      if (this.experimental == null)
1166        if (Configuration.errorOnAutoCreate())
1167          throw new Error("Attempt to auto-create MessageDefinition.experimental");
1168        else if (Configuration.doAutoCreate())
1169          this.experimental = new BooleanType(); // bb
1170      return this.experimental;
1171    }
1172
1173    public boolean hasExperimentalElement() { 
1174      return this.experimental != null && !this.experimental.isEmpty();
1175    }
1176
1177    public boolean hasExperimental() { 
1178      return this.experimental != null && !this.experimental.isEmpty();
1179    }
1180
1181    /**
1182     * @param value {@link #experimental} (A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
1183     */
1184    public MessageDefinition setExperimentalElement(BooleanType value) { 
1185      this.experimental = value;
1186      return this;
1187    }
1188
1189    /**
1190     * @return A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1191     */
1192    public boolean getExperimental() { 
1193      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1194    }
1195
1196    /**
1197     * @param value A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
1198     */
1199    public MessageDefinition setExperimental(boolean value) { 
1200        if (this.experimental == null)
1201          this.experimental = new BooleanType();
1202        this.experimental.setValue(value);
1203      return this;
1204    }
1205
1206    /**
1207     * @return {@link #date} (The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1208     */
1209    public DateTimeType getDateElement() { 
1210      if (this.date == null)
1211        if (Configuration.errorOnAutoCreate())
1212          throw new Error("Attempt to auto-create MessageDefinition.date");
1213        else if (Configuration.doAutoCreate())
1214          this.date = new DateTimeType(); // bb
1215      return this.date;
1216    }
1217
1218    public boolean hasDateElement() { 
1219      return this.date != null && !this.date.isEmpty();
1220    }
1221
1222    public boolean hasDate() { 
1223      return this.date != null && !this.date.isEmpty();
1224    }
1225
1226    /**
1227     * @param value {@link #date} (The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
1228     */
1229    public MessageDefinition setDateElement(DateTimeType value) { 
1230      this.date = value;
1231      return this;
1232    }
1233
1234    /**
1235     * @return The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.
1236     */
1237    public Date getDate() { 
1238      return this.date == null ? null : this.date.getValue();
1239    }
1240
1241    /**
1242     * @param value The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.
1243     */
1244    public MessageDefinition setDate(Date value) { 
1245        if (this.date == null)
1246          this.date = new DateTimeType();
1247        this.date.setValue(value);
1248      return this;
1249    }
1250
1251    /**
1252     * @return {@link #publisher} (The name of the individual or organization that published the message definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1253     */
1254    public StringType getPublisherElement() { 
1255      if (this.publisher == null)
1256        if (Configuration.errorOnAutoCreate())
1257          throw new Error("Attempt to auto-create MessageDefinition.publisher");
1258        else if (Configuration.doAutoCreate())
1259          this.publisher = new StringType(); // bb
1260      return this.publisher;
1261    }
1262
1263    public boolean hasPublisherElement() { 
1264      return this.publisher != null && !this.publisher.isEmpty();
1265    }
1266
1267    public boolean hasPublisher() { 
1268      return this.publisher != null && !this.publisher.isEmpty();
1269    }
1270
1271    /**
1272     * @param value {@link #publisher} (The name of the individual or organization that published the message definition.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
1273     */
1274    public MessageDefinition setPublisherElement(StringType value) { 
1275      this.publisher = value;
1276      return this;
1277    }
1278
1279    /**
1280     * @return The name of the individual or organization that published the message definition.
1281     */
1282    public String getPublisher() { 
1283      return this.publisher == null ? null : this.publisher.getValue();
1284    }
1285
1286    /**
1287     * @param value The name of the individual or organization that published the message definition.
1288     */
1289    public MessageDefinition setPublisher(String value) { 
1290      if (Utilities.noString(value))
1291        this.publisher = null;
1292      else {
1293        if (this.publisher == null)
1294          this.publisher = new StringType();
1295        this.publisher.setValue(value);
1296      }
1297      return this;
1298    }
1299
1300    /**
1301     * @return {@link #contact} (Contact details to assist a user in finding and communicating with the publisher.)
1302     */
1303    public List<ContactDetail> getContact() { 
1304      if (this.contact == null)
1305        this.contact = new ArrayList<ContactDetail>();
1306      return this.contact;
1307    }
1308
1309    /**
1310     * @return Returns a reference to <code>this</code> for easy method chaining
1311     */
1312    public MessageDefinition setContact(List<ContactDetail> theContact) { 
1313      this.contact = theContact;
1314      return this;
1315    }
1316
1317    public boolean hasContact() { 
1318      if (this.contact == null)
1319        return false;
1320      for (ContactDetail item : this.contact)
1321        if (!item.isEmpty())
1322          return true;
1323      return false;
1324    }
1325
1326    public ContactDetail addContact() { //3
1327      ContactDetail t = new ContactDetail();
1328      if (this.contact == null)
1329        this.contact = new ArrayList<ContactDetail>();
1330      this.contact.add(t);
1331      return t;
1332    }
1333
1334    public MessageDefinition addContact(ContactDetail t) { //3
1335      if (t == null)
1336        return this;
1337      if (this.contact == null)
1338        this.contact = new ArrayList<ContactDetail>();
1339      this.contact.add(t);
1340      return this;
1341    }
1342
1343    /**
1344     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist
1345     */
1346    public ContactDetail getContactFirstRep() { 
1347      if (getContact().isEmpty()) {
1348        addContact();
1349      }
1350      return getContact().get(0);
1351    }
1352
1353    /**
1354     * @return {@link #description} (A free text natural language description of the message definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1355     */
1356    public MarkdownType getDescriptionElement() { 
1357      if (this.description == null)
1358        if (Configuration.errorOnAutoCreate())
1359          throw new Error("Attempt to auto-create MessageDefinition.description");
1360        else if (Configuration.doAutoCreate())
1361          this.description = new MarkdownType(); // bb
1362      return this.description;
1363    }
1364
1365    public boolean hasDescriptionElement() { 
1366      return this.description != null && !this.description.isEmpty();
1367    }
1368
1369    public boolean hasDescription() { 
1370      return this.description != null && !this.description.isEmpty();
1371    }
1372
1373    /**
1374     * @param value {@link #description} (A free text natural language description of the message definition from a consumer's perspective.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1375     */
1376    public MessageDefinition setDescriptionElement(MarkdownType value) { 
1377      this.description = value;
1378      return this;
1379    }
1380
1381    /**
1382     * @return A free text natural language description of the message definition from a consumer's perspective.
1383     */
1384    public String getDescription() { 
1385      return this.description == null ? null : this.description.getValue();
1386    }
1387
1388    /**
1389     * @param value A free text natural language description of the message definition from a consumer's perspective.
1390     */
1391    public MessageDefinition setDescription(String value) { 
1392      if (value == null)
1393        this.description = null;
1394      else {
1395        if (this.description == null)
1396          this.description = new MarkdownType();
1397        this.description.setValue(value);
1398      }
1399      return this;
1400    }
1401
1402    /**
1403     * @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate message definition instances.)
1404     */
1405    public List<UsageContext> getUseContext() { 
1406      if (this.useContext == null)
1407        this.useContext = new ArrayList<UsageContext>();
1408      return this.useContext;
1409    }
1410
1411    /**
1412     * @return Returns a reference to <code>this</code> for easy method chaining
1413     */
1414    public MessageDefinition setUseContext(List<UsageContext> theUseContext) { 
1415      this.useContext = theUseContext;
1416      return this;
1417    }
1418
1419    public boolean hasUseContext() { 
1420      if (this.useContext == null)
1421        return false;
1422      for (UsageContext item : this.useContext)
1423        if (!item.isEmpty())
1424          return true;
1425      return false;
1426    }
1427
1428    public UsageContext addUseContext() { //3
1429      UsageContext t = new UsageContext();
1430      if (this.useContext == null)
1431        this.useContext = new ArrayList<UsageContext>();
1432      this.useContext.add(t);
1433      return t;
1434    }
1435
1436    public MessageDefinition addUseContext(UsageContext t) { //3
1437      if (t == null)
1438        return this;
1439      if (this.useContext == null)
1440        this.useContext = new ArrayList<UsageContext>();
1441      this.useContext.add(t);
1442      return this;
1443    }
1444
1445    /**
1446     * @return The first repetition of repeating field {@link #useContext}, creating it if it does not already exist
1447     */
1448    public UsageContext getUseContextFirstRep() { 
1449      if (getUseContext().isEmpty()) {
1450        addUseContext();
1451      }
1452      return getUseContext().get(0);
1453    }
1454
1455    /**
1456     * @return {@link #jurisdiction} (A legal or geographic region in which the message definition is intended to be used.)
1457     */
1458    public List<CodeableConcept> getJurisdiction() { 
1459      if (this.jurisdiction == null)
1460        this.jurisdiction = new ArrayList<CodeableConcept>();
1461      return this.jurisdiction;
1462    }
1463
1464    /**
1465     * @return Returns a reference to <code>this</code> for easy method chaining
1466     */
1467    public MessageDefinition setJurisdiction(List<CodeableConcept> theJurisdiction) { 
1468      this.jurisdiction = theJurisdiction;
1469      return this;
1470    }
1471
1472    public boolean hasJurisdiction() { 
1473      if (this.jurisdiction == null)
1474        return false;
1475      for (CodeableConcept item : this.jurisdiction)
1476        if (!item.isEmpty())
1477          return true;
1478      return false;
1479    }
1480
1481    public CodeableConcept addJurisdiction() { //3
1482      CodeableConcept t = new CodeableConcept();
1483      if (this.jurisdiction == null)
1484        this.jurisdiction = new ArrayList<CodeableConcept>();
1485      this.jurisdiction.add(t);
1486      return t;
1487    }
1488
1489    public MessageDefinition addJurisdiction(CodeableConcept t) { //3
1490      if (t == null)
1491        return this;
1492      if (this.jurisdiction == null)
1493        this.jurisdiction = new ArrayList<CodeableConcept>();
1494      this.jurisdiction.add(t);
1495      return this;
1496    }
1497
1498    /**
1499     * @return The first repetition of repeating field {@link #jurisdiction}, creating it if it does not already exist
1500     */
1501    public CodeableConcept getJurisdictionFirstRep() { 
1502      if (getJurisdiction().isEmpty()) {
1503        addJurisdiction();
1504      }
1505      return getJurisdiction().get(0);
1506    }
1507
1508    /**
1509     * @return {@link #purpose} (Explaination of why this message definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
1510     */
1511    public MarkdownType getPurposeElement() { 
1512      if (this.purpose == null)
1513        if (Configuration.errorOnAutoCreate())
1514          throw new Error("Attempt to auto-create MessageDefinition.purpose");
1515        else if (Configuration.doAutoCreate())
1516          this.purpose = new MarkdownType(); // bb
1517      return this.purpose;
1518    }
1519
1520    public boolean hasPurposeElement() { 
1521      return this.purpose != null && !this.purpose.isEmpty();
1522    }
1523
1524    public boolean hasPurpose() { 
1525      return this.purpose != null && !this.purpose.isEmpty();
1526    }
1527
1528    /**
1529     * @param value {@link #purpose} (Explaination of why this message definition is needed and why it has been designed as it has.). This is the underlying object with id, value and extensions. The accessor "getPurpose" gives direct access to the value
1530     */
1531    public MessageDefinition setPurposeElement(MarkdownType value) { 
1532      this.purpose = value;
1533      return this;
1534    }
1535
1536    /**
1537     * @return Explaination of why this message definition is needed and why it has been designed as it has.
1538     */
1539    public String getPurpose() { 
1540      return this.purpose == null ? null : this.purpose.getValue();
1541    }
1542
1543    /**
1544     * @param value Explaination of why this message definition is needed and why it has been designed as it has.
1545     */
1546    public MessageDefinition setPurpose(String value) { 
1547      if (value == null)
1548        this.purpose = null;
1549      else {
1550        if (this.purpose == null)
1551          this.purpose = new MarkdownType();
1552        this.purpose.setValue(value);
1553      }
1554      return this;
1555    }
1556
1557    /**
1558     * @return {@link #copyright} (A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1559     */
1560    public MarkdownType getCopyrightElement() { 
1561      if (this.copyright == null)
1562        if (Configuration.errorOnAutoCreate())
1563          throw new Error("Attempt to auto-create MessageDefinition.copyright");
1564        else if (Configuration.doAutoCreate())
1565          this.copyright = new MarkdownType(); // bb
1566      return this.copyright;
1567    }
1568
1569    public boolean hasCopyrightElement() { 
1570      return this.copyright != null && !this.copyright.isEmpty();
1571    }
1572
1573    public boolean hasCopyright() { 
1574      return this.copyright != null && !this.copyright.isEmpty();
1575    }
1576
1577    /**
1578     * @param value {@link #copyright} (A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
1579     */
1580    public MessageDefinition setCopyrightElement(MarkdownType value) { 
1581      this.copyright = value;
1582      return this;
1583    }
1584
1585    /**
1586     * @return A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.
1587     */
1588    public String getCopyright() { 
1589      return this.copyright == null ? null : this.copyright.getValue();
1590    }
1591
1592    /**
1593     * @param value A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.
1594     */
1595    public MessageDefinition setCopyright(String value) { 
1596      if (value == null)
1597        this.copyright = null;
1598      else {
1599        if (this.copyright == null)
1600          this.copyright = new MarkdownType();
1601        this.copyright.setValue(value);
1602      }
1603      return this;
1604    }
1605
1606    /**
1607     * @return {@link #base} (The MessageDefinition that is the basis for the contents of this resource.)
1608     */
1609    public Reference getBase() { 
1610      if (this.base == null)
1611        if (Configuration.errorOnAutoCreate())
1612          throw new Error("Attempt to auto-create MessageDefinition.base");
1613        else if (Configuration.doAutoCreate())
1614          this.base = new Reference(); // cc
1615      return this.base;
1616    }
1617
1618    public boolean hasBase() { 
1619      return this.base != null && !this.base.isEmpty();
1620    }
1621
1622    /**
1623     * @param value {@link #base} (The MessageDefinition that is the basis for the contents of this resource.)
1624     */
1625    public MessageDefinition setBase(Reference value) { 
1626      this.base = value;
1627      return this;
1628    }
1629
1630    /**
1631     * @return {@link #base} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The MessageDefinition that is the basis for the contents of this resource.)
1632     */
1633    public MessageDefinition getBaseTarget() { 
1634      if (this.baseTarget == null)
1635        if (Configuration.errorOnAutoCreate())
1636          throw new Error("Attempt to auto-create MessageDefinition.base");
1637        else if (Configuration.doAutoCreate())
1638          this.baseTarget = new MessageDefinition(); // aa
1639      return this.baseTarget;
1640    }
1641
1642    /**
1643     * @param value {@link #base} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The MessageDefinition that is the basis for the contents of this resource.)
1644     */
1645    public MessageDefinition setBaseTarget(MessageDefinition value) { 
1646      this.baseTarget = value;
1647      return this;
1648    }
1649
1650    /**
1651     * @return {@link #parent} (Identifies a protocol or workflow that this MessageDefinition represents a step in.)
1652     */
1653    public List<Reference> getParent() { 
1654      if (this.parent == null)
1655        this.parent = new ArrayList<Reference>();
1656      return this.parent;
1657    }
1658
1659    /**
1660     * @return Returns a reference to <code>this</code> for easy method chaining
1661     */
1662    public MessageDefinition setParent(List<Reference> theParent) { 
1663      this.parent = theParent;
1664      return this;
1665    }
1666
1667    public boolean hasParent() { 
1668      if (this.parent == null)
1669        return false;
1670      for (Reference item : this.parent)
1671        if (!item.isEmpty())
1672          return true;
1673      return false;
1674    }
1675
1676    public Reference addParent() { //3
1677      Reference t = new Reference();
1678      if (this.parent == null)
1679        this.parent = new ArrayList<Reference>();
1680      this.parent.add(t);
1681      return t;
1682    }
1683
1684    public MessageDefinition addParent(Reference t) { //3
1685      if (t == null)
1686        return this;
1687      if (this.parent == null)
1688        this.parent = new ArrayList<Reference>();
1689      this.parent.add(t);
1690      return this;
1691    }
1692
1693    /**
1694     * @return The first repetition of repeating field {@link #parent}, creating it if it does not already exist
1695     */
1696    public Reference getParentFirstRep() { 
1697      if (getParent().isEmpty()) {
1698        addParent();
1699      }
1700      return getParent().get(0);
1701    }
1702
1703    /**
1704     * @deprecated Use Reference#setResource(IBaseResource) instead
1705     */
1706    @Deprecated
1707    public List<Resource> getParentTarget() { 
1708      if (this.parentTarget == null)
1709        this.parentTarget = new ArrayList<Resource>();
1710      return this.parentTarget;
1711    }
1712
1713    /**
1714     * @return {@link #replaces} (A MessageDefinition that is superseded by this definition.)
1715     */
1716    public List<Reference> getReplaces() { 
1717      if (this.replaces == null)
1718        this.replaces = new ArrayList<Reference>();
1719      return this.replaces;
1720    }
1721
1722    /**
1723     * @return Returns a reference to <code>this</code> for easy method chaining
1724     */
1725    public MessageDefinition setReplaces(List<Reference> theReplaces) { 
1726      this.replaces = theReplaces;
1727      return this;
1728    }
1729
1730    public boolean hasReplaces() { 
1731      if (this.replaces == null)
1732        return false;
1733      for (Reference item : this.replaces)
1734        if (!item.isEmpty())
1735          return true;
1736      return false;
1737    }
1738
1739    public Reference addReplaces() { //3
1740      Reference t = new Reference();
1741      if (this.replaces == null)
1742        this.replaces = new ArrayList<Reference>();
1743      this.replaces.add(t);
1744      return t;
1745    }
1746
1747    public MessageDefinition addReplaces(Reference t) { //3
1748      if (t == null)
1749        return this;
1750      if (this.replaces == null)
1751        this.replaces = new ArrayList<Reference>();
1752      this.replaces.add(t);
1753      return this;
1754    }
1755
1756    /**
1757     * @return The first repetition of repeating field {@link #replaces}, creating it if it does not already exist
1758     */
1759    public Reference getReplacesFirstRep() { 
1760      if (getReplaces().isEmpty()) {
1761        addReplaces();
1762      }
1763      return getReplaces().get(0);
1764    }
1765
1766    /**
1767     * @deprecated Use Reference#setResource(IBaseResource) instead
1768     */
1769    @Deprecated
1770    public List<MessageDefinition> getReplacesTarget() { 
1771      if (this.replacesTarget == null)
1772        this.replacesTarget = new ArrayList<MessageDefinition>();
1773      return this.replacesTarget;
1774    }
1775
1776    /**
1777     * @deprecated Use Reference#setResource(IBaseResource) instead
1778     */
1779    @Deprecated
1780    public MessageDefinition addReplacesTarget() { 
1781      MessageDefinition r = new MessageDefinition();
1782      if (this.replacesTarget == null)
1783        this.replacesTarget = new ArrayList<MessageDefinition>();
1784      this.replacesTarget.add(r);
1785      return r;
1786    }
1787
1788    /**
1789     * @return {@link #event} (A coded identifier of a supported messaging event.)
1790     */
1791    public Coding getEvent() { 
1792      if (this.event == null)
1793        if (Configuration.errorOnAutoCreate())
1794          throw new Error("Attempt to auto-create MessageDefinition.event");
1795        else if (Configuration.doAutoCreate())
1796          this.event = new Coding(); // cc
1797      return this.event;
1798    }
1799
1800    public boolean hasEvent() { 
1801      return this.event != null && !this.event.isEmpty();
1802    }
1803
1804    /**
1805     * @param value {@link #event} (A coded identifier of a supported messaging event.)
1806     */
1807    public MessageDefinition setEvent(Coding value) { 
1808      this.event = value;
1809      return this;
1810    }
1811
1812    /**
1813     * @return {@link #category} (The impact of the content of the message.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1814     */
1815    public Enumeration<MessageSignificanceCategory> getCategoryElement() { 
1816      if (this.category == null)
1817        if (Configuration.errorOnAutoCreate())
1818          throw new Error("Attempt to auto-create MessageDefinition.category");
1819        else if (Configuration.doAutoCreate())
1820          this.category = new Enumeration<MessageSignificanceCategory>(new MessageSignificanceCategoryEnumFactory()); // bb
1821      return this.category;
1822    }
1823
1824    public boolean hasCategoryElement() { 
1825      return this.category != null && !this.category.isEmpty();
1826    }
1827
1828    public boolean hasCategory() { 
1829      return this.category != null && !this.category.isEmpty();
1830    }
1831
1832    /**
1833     * @param value {@link #category} (The impact of the content of the message.). This is the underlying object with id, value and extensions. The accessor "getCategory" gives direct access to the value
1834     */
1835    public MessageDefinition setCategoryElement(Enumeration<MessageSignificanceCategory> value) { 
1836      this.category = value;
1837      return this;
1838    }
1839
1840    /**
1841     * @return The impact of the content of the message.
1842     */
1843    public MessageSignificanceCategory getCategory() { 
1844      return this.category == null ? null : this.category.getValue();
1845    }
1846
1847    /**
1848     * @param value The impact of the content of the message.
1849     */
1850    public MessageDefinition setCategory(MessageSignificanceCategory value) { 
1851      if (value == null)
1852        this.category = null;
1853      else {
1854        if (this.category == null)
1855          this.category = new Enumeration<MessageSignificanceCategory>(new MessageSignificanceCategoryEnumFactory());
1856        this.category.setValue(value);
1857      }
1858      return this;
1859    }
1860
1861    /**
1862     * @return {@link #focus} (Identifies the resource (or resources) that are being addressed by the event.  For example, the Encounter for an admit message or two Account records for a merge.)
1863     */
1864    public List<MessageDefinitionFocusComponent> getFocus() { 
1865      if (this.focus == null)
1866        this.focus = new ArrayList<MessageDefinitionFocusComponent>();
1867      return this.focus;
1868    }
1869
1870    /**
1871     * @return Returns a reference to <code>this</code> for easy method chaining
1872     */
1873    public MessageDefinition setFocus(List<MessageDefinitionFocusComponent> theFocus) { 
1874      this.focus = theFocus;
1875      return this;
1876    }
1877
1878    public boolean hasFocus() { 
1879      if (this.focus == null)
1880        return false;
1881      for (MessageDefinitionFocusComponent item : this.focus)
1882        if (!item.isEmpty())
1883          return true;
1884      return false;
1885    }
1886
1887    public MessageDefinitionFocusComponent addFocus() { //3
1888      MessageDefinitionFocusComponent t = new MessageDefinitionFocusComponent();
1889      if (this.focus == null)
1890        this.focus = new ArrayList<MessageDefinitionFocusComponent>();
1891      this.focus.add(t);
1892      return t;
1893    }
1894
1895    public MessageDefinition addFocus(MessageDefinitionFocusComponent t) { //3
1896      if (t == null)
1897        return this;
1898      if (this.focus == null)
1899        this.focus = new ArrayList<MessageDefinitionFocusComponent>();
1900      this.focus.add(t);
1901      return this;
1902    }
1903
1904    /**
1905     * @return The first repetition of repeating field {@link #focus}, creating it if it does not already exist
1906     */
1907    public MessageDefinitionFocusComponent getFocusFirstRep() { 
1908      if (getFocus().isEmpty()) {
1909        addFocus();
1910      }
1911      return getFocus().get(0);
1912    }
1913
1914    /**
1915     * @return {@link #responseRequired} (Indicates whether a response is required for this message.). This is the underlying object with id, value and extensions. The accessor "getResponseRequired" gives direct access to the value
1916     */
1917    public BooleanType getResponseRequiredElement() { 
1918      if (this.responseRequired == null)
1919        if (Configuration.errorOnAutoCreate())
1920          throw new Error("Attempt to auto-create MessageDefinition.responseRequired");
1921        else if (Configuration.doAutoCreate())
1922          this.responseRequired = new BooleanType(); // bb
1923      return this.responseRequired;
1924    }
1925
1926    public boolean hasResponseRequiredElement() { 
1927      return this.responseRequired != null && !this.responseRequired.isEmpty();
1928    }
1929
1930    public boolean hasResponseRequired() { 
1931      return this.responseRequired != null && !this.responseRequired.isEmpty();
1932    }
1933
1934    /**
1935     * @param value {@link #responseRequired} (Indicates whether a response is required for this message.). This is the underlying object with id, value and extensions. The accessor "getResponseRequired" gives direct access to the value
1936     */
1937    public MessageDefinition setResponseRequiredElement(BooleanType value) { 
1938      this.responseRequired = value;
1939      return this;
1940    }
1941
1942    /**
1943     * @return Indicates whether a response is required for this message.
1944     */
1945    public boolean getResponseRequired() { 
1946      return this.responseRequired == null || this.responseRequired.isEmpty() ? false : this.responseRequired.getValue();
1947    }
1948
1949    /**
1950     * @param value Indicates whether a response is required for this message.
1951     */
1952    public MessageDefinition setResponseRequired(boolean value) { 
1953        if (this.responseRequired == null)
1954          this.responseRequired = new BooleanType();
1955        this.responseRequired.setValue(value);
1956      return this;
1957    }
1958
1959    /**
1960     * @return {@link #allowedResponse} (Indicates what types of messages may be sent as an application-level response to this message.)
1961     */
1962    public List<MessageDefinitionAllowedResponseComponent> getAllowedResponse() { 
1963      if (this.allowedResponse == null)
1964        this.allowedResponse = new ArrayList<MessageDefinitionAllowedResponseComponent>();
1965      return this.allowedResponse;
1966    }
1967
1968    /**
1969     * @return Returns a reference to <code>this</code> for easy method chaining
1970     */
1971    public MessageDefinition setAllowedResponse(List<MessageDefinitionAllowedResponseComponent> theAllowedResponse) { 
1972      this.allowedResponse = theAllowedResponse;
1973      return this;
1974    }
1975
1976    public boolean hasAllowedResponse() { 
1977      if (this.allowedResponse == null)
1978        return false;
1979      for (MessageDefinitionAllowedResponseComponent item : this.allowedResponse)
1980        if (!item.isEmpty())
1981          return true;
1982      return false;
1983    }
1984
1985    public MessageDefinitionAllowedResponseComponent addAllowedResponse() { //3
1986      MessageDefinitionAllowedResponseComponent t = new MessageDefinitionAllowedResponseComponent();
1987      if (this.allowedResponse == null)
1988        this.allowedResponse = new ArrayList<MessageDefinitionAllowedResponseComponent>();
1989      this.allowedResponse.add(t);
1990      return t;
1991    }
1992
1993    public MessageDefinition addAllowedResponse(MessageDefinitionAllowedResponseComponent t) { //3
1994      if (t == null)
1995        return this;
1996      if (this.allowedResponse == null)
1997        this.allowedResponse = new ArrayList<MessageDefinitionAllowedResponseComponent>();
1998      this.allowedResponse.add(t);
1999      return this;
2000    }
2001
2002    /**
2003     * @return The first repetition of repeating field {@link #allowedResponse}, creating it if it does not already exist
2004     */
2005    public MessageDefinitionAllowedResponseComponent getAllowedResponseFirstRep() { 
2006      if (getAllowedResponse().isEmpty()) {
2007        addAllowedResponse();
2008      }
2009      return getAllowedResponse().get(0);
2010    }
2011
2012      protected void listChildren(List<Property> childrenList) {
2013        super.listChildren(childrenList);
2014        childrenList.add(new Property("url", "uri", "An absolute URI that is used to identify this message definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this message definition is (or will be) published. The URL SHOULD include the major version of the message definition. For more information see [Technical and Business Versions](resource.html#versions).", 0, java.lang.Integer.MAX_VALUE, url));
2015        childrenList.add(new Property("identifier", "Identifier", "A formal identifier that is used to identify this message definition when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
2016        childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the message definition when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the message definition author and is not expected to be globally unique. For example, it might be a timestamp (e.g. yyyymmdd) if a managed version is not available. There is also no expectation that versions can be placed in a lexicographical sequence.", 0, java.lang.Integer.MAX_VALUE, version));
2017        childrenList.add(new Property("name", "string", "A natural language name identifying the message definition. This name should be usable as an identifier for the module by machine processing applications such as code generation.", 0, java.lang.Integer.MAX_VALUE, name));
2018        childrenList.add(new Property("title", "string", "A short, descriptive, user-friendly title for the message definition.", 0, java.lang.Integer.MAX_VALUE, title));
2019        childrenList.add(new Property("status", "code", "The status of this message definition. Enables tracking the life-cycle of the content.", 0, java.lang.Integer.MAX_VALUE, status));
2020        childrenList.add(new Property("experimental", "boolean", "A boolean value to indicate that this message definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
2021        childrenList.add(new Property("date", "dateTime", "The date  (and optionally time) when the message definition was published. The date must change if and when the business version changes and it must change if the status code changes. In addition, it should change when the substantive content of the message definition changes.", 0, java.lang.Integer.MAX_VALUE, date));
2022        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the message definition.", 0, java.lang.Integer.MAX_VALUE, publisher));
2023        childrenList.add(new Property("contact", "ContactDetail", "Contact details to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
2024        childrenList.add(new Property("description", "markdown", "A free text natural language description of the message definition from a consumer's perspective.", 0, java.lang.Integer.MAX_VALUE, description));
2025        childrenList.add(new Property("useContext", "UsageContext", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching for appropriate message definition instances.", 0, java.lang.Integer.MAX_VALUE, useContext));
2026        childrenList.add(new Property("jurisdiction", "CodeableConcept", "A legal or geographic region in which the message definition is intended to be used.", 0, java.lang.Integer.MAX_VALUE, jurisdiction));
2027        childrenList.add(new Property("purpose", "markdown", "Explaination of why this message definition is needed and why it has been designed as it has.", 0, java.lang.Integer.MAX_VALUE, purpose));
2028        childrenList.add(new Property("copyright", "markdown", "A copyright statement relating to the message definition and/or its contents. Copyright statements are generally legal restrictions on the use and publishing of the message definition.", 0, java.lang.Integer.MAX_VALUE, copyright));
2029        childrenList.add(new Property("base", "Reference(MessageDefinition)", "The MessageDefinition that is the basis for the contents of this resource.", 0, java.lang.Integer.MAX_VALUE, base));
2030        childrenList.add(new Property("parent", "Reference(ActivityDefinition|PlanDefinition)", "Identifies a protocol or workflow that this MessageDefinition represents a step in.", 0, java.lang.Integer.MAX_VALUE, parent));
2031        childrenList.add(new Property("replaces", "Reference(MessageDefinition)", "A MessageDefinition that is superseded by this definition.", 0, java.lang.Integer.MAX_VALUE, replaces));
2032        childrenList.add(new Property("event", "Coding", "A coded identifier of a supported messaging event.", 0, java.lang.Integer.MAX_VALUE, event));
2033        childrenList.add(new Property("category", "code", "The impact of the content of the message.", 0, java.lang.Integer.MAX_VALUE, category));
2034        childrenList.add(new Property("focus", "", "Identifies the resource (or resources) that are being addressed by the event.  For example, the Encounter for an admit message or two Account records for a merge.", 0, java.lang.Integer.MAX_VALUE, focus));
2035        childrenList.add(new Property("responseRequired", "boolean", "Indicates whether a response is required for this message.", 0, java.lang.Integer.MAX_VALUE, responseRequired));
2036        childrenList.add(new Property("allowedResponse", "", "Indicates what types of messages may be sent as an application-level response to this message.", 0, java.lang.Integer.MAX_VALUE, allowedResponse));
2037      }
2038
2039      @Override
2040      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2041        switch (hash) {
2042        case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
2043        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
2044        case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
2045        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
2046        case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
2047        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<PublicationStatus>
2048        case -404562712: /*experimental*/ return this.experimental == null ? new Base[0] : new Base[] {this.experimental}; // BooleanType
2049        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateTimeType
2050        case 1447404028: /*publisher*/ return this.publisher == null ? new Base[0] : new Base[] {this.publisher}; // StringType
2051        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactDetail
2052        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // MarkdownType
2053        case -669707736: /*useContext*/ return this.useContext == null ? new Base[0] : this.useContext.toArray(new Base[this.useContext.size()]); // UsageContext
2054        case -507075711: /*jurisdiction*/ return this.jurisdiction == null ? new Base[0] : this.jurisdiction.toArray(new Base[this.jurisdiction.size()]); // CodeableConcept
2055        case -220463842: /*purpose*/ return this.purpose == null ? new Base[0] : new Base[] {this.purpose}; // MarkdownType
2056        case 1522889671: /*copyright*/ return this.copyright == null ? new Base[0] : new Base[] {this.copyright}; // MarkdownType
2057        case 3016401: /*base*/ return this.base == null ? new Base[0] : new Base[] {this.base}; // Reference
2058        case -995424086: /*parent*/ return this.parent == null ? new Base[0] : this.parent.toArray(new Base[this.parent.size()]); // Reference
2059        case -430332865: /*replaces*/ return this.replaces == null ? new Base[0] : this.replaces.toArray(new Base[this.replaces.size()]); // Reference
2060        case 96891546: /*event*/ return this.event == null ? new Base[0] : new Base[] {this.event}; // Coding
2061        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // Enumeration<MessageSignificanceCategory>
2062        case 97604824: /*focus*/ return this.focus == null ? new Base[0] : this.focus.toArray(new Base[this.focus.size()]); // MessageDefinitionFocusComponent
2063        case 791597824: /*responseRequired*/ return this.responseRequired == null ? new Base[0] : new Base[] {this.responseRequired}; // BooleanType
2064        case -1130933751: /*allowedResponse*/ return this.allowedResponse == null ? new Base[0] : this.allowedResponse.toArray(new Base[this.allowedResponse.size()]); // MessageDefinitionAllowedResponseComponent
2065        default: return super.getProperty(hash, name, checkValid);
2066        }
2067
2068      }
2069
2070      @Override
2071      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2072        switch (hash) {
2073        case 116079: // url
2074          this.url = castToUri(value); // UriType
2075          return value;
2076        case -1618432855: // identifier
2077          this.identifier = castToIdentifier(value); // Identifier
2078          return value;
2079        case 351608024: // version
2080          this.version = castToString(value); // StringType
2081          return value;
2082        case 3373707: // name
2083          this.name = castToString(value); // StringType
2084          return value;
2085        case 110371416: // title
2086          this.title = castToString(value); // StringType
2087          return value;
2088        case -892481550: // status
2089          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
2090          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2091          return value;
2092        case -404562712: // experimental
2093          this.experimental = castToBoolean(value); // BooleanType
2094          return value;
2095        case 3076014: // date
2096          this.date = castToDateTime(value); // DateTimeType
2097          return value;
2098        case 1447404028: // publisher
2099          this.publisher = castToString(value); // StringType
2100          return value;
2101        case 951526432: // contact
2102          this.getContact().add(castToContactDetail(value)); // ContactDetail
2103          return value;
2104        case -1724546052: // description
2105          this.description = castToMarkdown(value); // MarkdownType
2106          return value;
2107        case -669707736: // useContext
2108          this.getUseContext().add(castToUsageContext(value)); // UsageContext
2109          return value;
2110        case -507075711: // jurisdiction
2111          this.getJurisdiction().add(castToCodeableConcept(value)); // CodeableConcept
2112          return value;
2113        case -220463842: // purpose
2114          this.purpose = castToMarkdown(value); // MarkdownType
2115          return value;
2116        case 1522889671: // copyright
2117          this.copyright = castToMarkdown(value); // MarkdownType
2118          return value;
2119        case 3016401: // base
2120          this.base = castToReference(value); // Reference
2121          return value;
2122        case -995424086: // parent
2123          this.getParent().add(castToReference(value)); // Reference
2124          return value;
2125        case -430332865: // replaces
2126          this.getReplaces().add(castToReference(value)); // Reference
2127          return value;
2128        case 96891546: // event
2129          this.event = castToCoding(value); // Coding
2130          return value;
2131        case 50511102: // category
2132          value = new MessageSignificanceCategoryEnumFactory().fromType(castToCode(value));
2133          this.category = (Enumeration) value; // Enumeration<MessageSignificanceCategory>
2134          return value;
2135        case 97604824: // focus
2136          this.getFocus().add((MessageDefinitionFocusComponent) value); // MessageDefinitionFocusComponent
2137          return value;
2138        case 791597824: // responseRequired
2139          this.responseRequired = castToBoolean(value); // BooleanType
2140          return value;
2141        case -1130933751: // allowedResponse
2142          this.getAllowedResponse().add((MessageDefinitionAllowedResponseComponent) value); // MessageDefinitionAllowedResponseComponent
2143          return value;
2144        default: return super.setProperty(hash, name, value);
2145        }
2146
2147      }
2148
2149      @Override
2150      public Base setProperty(String name, Base value) throws FHIRException {
2151        if (name.equals("url")) {
2152          this.url = castToUri(value); // UriType
2153        } else if (name.equals("identifier")) {
2154          this.identifier = castToIdentifier(value); // Identifier
2155        } else if (name.equals("version")) {
2156          this.version = castToString(value); // StringType
2157        } else if (name.equals("name")) {
2158          this.name = castToString(value); // StringType
2159        } else if (name.equals("title")) {
2160          this.title = castToString(value); // StringType
2161        } else if (name.equals("status")) {
2162          value = new PublicationStatusEnumFactory().fromType(castToCode(value));
2163          this.status = (Enumeration) value; // Enumeration<PublicationStatus>
2164        } else if (name.equals("experimental")) {
2165          this.experimental = castToBoolean(value); // BooleanType
2166        } else if (name.equals("date")) {
2167          this.date = castToDateTime(value); // DateTimeType
2168        } else if (name.equals("publisher")) {
2169          this.publisher = castToString(value); // StringType
2170        } else if (name.equals("contact")) {
2171          this.getContact().add(castToContactDetail(value));
2172        } else if (name.equals("description")) {
2173          this.description = castToMarkdown(value); // MarkdownType
2174        } else if (name.equals("useContext")) {
2175          this.getUseContext().add(castToUsageContext(value));
2176        } else if (name.equals("jurisdiction")) {
2177          this.getJurisdiction().add(castToCodeableConcept(value));
2178        } else if (name.equals("purpose")) {
2179          this.purpose = castToMarkdown(value); // MarkdownType
2180        } else if (name.equals("copyright")) {
2181          this.copyright = castToMarkdown(value); // MarkdownType
2182        } else if (name.equals("base")) {
2183          this.base = castToReference(value); // Reference
2184        } else if (name.equals("parent")) {
2185          this.getParent().add(castToReference(value));
2186        } else if (name.equals("replaces")) {
2187          this.getReplaces().add(castToReference(value));
2188        } else if (name.equals("event")) {
2189          this.event = castToCoding(value); // Coding
2190        } else if (name.equals("category")) {
2191          value = new MessageSignificanceCategoryEnumFactory().fromType(castToCode(value));
2192          this.category = (Enumeration) value; // Enumeration<MessageSignificanceCategory>
2193        } else if (name.equals("focus")) {
2194          this.getFocus().add((MessageDefinitionFocusComponent) value);
2195        } else if (name.equals("responseRequired")) {
2196          this.responseRequired = castToBoolean(value); // BooleanType
2197        } else if (name.equals("allowedResponse")) {
2198          this.getAllowedResponse().add((MessageDefinitionAllowedResponseComponent) value);
2199        } else
2200          return super.setProperty(name, value);
2201        return value;
2202      }
2203
2204      @Override
2205      public Base makeProperty(int hash, String name) throws FHIRException {
2206        switch (hash) {
2207        case 116079:  return getUrlElement();
2208        case -1618432855:  return getIdentifier(); 
2209        case 351608024:  return getVersionElement();
2210        case 3373707:  return getNameElement();
2211        case 110371416:  return getTitleElement();
2212        case -892481550:  return getStatusElement();
2213        case -404562712:  return getExperimentalElement();
2214        case 3076014:  return getDateElement();
2215        case 1447404028:  return getPublisherElement();
2216        case 951526432:  return addContact(); 
2217        case -1724546052:  return getDescriptionElement();
2218        case -669707736:  return addUseContext(); 
2219        case -507075711:  return addJurisdiction(); 
2220        case -220463842:  return getPurposeElement();
2221        case 1522889671:  return getCopyrightElement();
2222        case 3016401:  return getBase(); 
2223        case -995424086:  return addParent(); 
2224        case -430332865:  return addReplaces(); 
2225        case 96891546:  return getEvent(); 
2226        case 50511102:  return getCategoryElement();
2227        case 97604824:  return addFocus(); 
2228        case 791597824:  return getResponseRequiredElement();
2229        case -1130933751:  return addAllowedResponse(); 
2230        default: return super.makeProperty(hash, name);
2231        }
2232
2233      }
2234
2235      @Override
2236      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2237        switch (hash) {
2238        case 116079: /*url*/ return new String[] {"uri"};
2239        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
2240        case 351608024: /*version*/ return new String[] {"string"};
2241        case 3373707: /*name*/ return new String[] {"string"};
2242        case 110371416: /*title*/ return new String[] {"string"};
2243        case -892481550: /*status*/ return new String[] {"code"};
2244        case -404562712: /*experimental*/ return new String[] {"boolean"};
2245        case 3076014: /*date*/ return new String[] {"dateTime"};
2246        case 1447404028: /*publisher*/ return new String[] {"string"};
2247        case 951526432: /*contact*/ return new String[] {"ContactDetail"};
2248        case -1724546052: /*description*/ return new String[] {"markdown"};
2249        case -669707736: /*useContext*/ return new String[] {"UsageContext"};
2250        case -507075711: /*jurisdiction*/ return new String[] {"CodeableConcept"};
2251        case -220463842: /*purpose*/ return new String[] {"markdown"};
2252        case 1522889671: /*copyright*/ return new String[] {"markdown"};
2253        case 3016401: /*base*/ return new String[] {"Reference"};
2254        case -995424086: /*parent*/ return new String[] {"Reference"};
2255        case -430332865: /*replaces*/ return new String[] {"Reference"};
2256        case 96891546: /*event*/ return new String[] {"Coding"};
2257        case 50511102: /*category*/ return new String[] {"code"};
2258        case 97604824: /*focus*/ return new String[] {};
2259        case 791597824: /*responseRequired*/ return new String[] {"boolean"};
2260        case -1130933751: /*allowedResponse*/ return new String[] {};
2261        default: return super.getTypesForProperty(hash, name);
2262        }
2263
2264      }
2265
2266      @Override
2267      public Base addChild(String name) throws FHIRException {
2268        if (name.equals("url")) {
2269          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.url");
2270        }
2271        else if (name.equals("identifier")) {
2272          this.identifier = new Identifier();
2273          return this.identifier;
2274        }
2275        else if (name.equals("version")) {
2276          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.version");
2277        }
2278        else if (name.equals("name")) {
2279          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.name");
2280        }
2281        else if (name.equals("title")) {
2282          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.title");
2283        }
2284        else if (name.equals("status")) {
2285          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.status");
2286        }
2287        else if (name.equals("experimental")) {
2288          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.experimental");
2289        }
2290        else if (name.equals("date")) {
2291          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.date");
2292        }
2293        else if (name.equals("publisher")) {
2294          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.publisher");
2295        }
2296        else if (name.equals("contact")) {
2297          return addContact();
2298        }
2299        else if (name.equals("description")) {
2300          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.description");
2301        }
2302        else if (name.equals("useContext")) {
2303          return addUseContext();
2304        }
2305        else if (name.equals("jurisdiction")) {
2306          return addJurisdiction();
2307        }
2308        else if (name.equals("purpose")) {
2309          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.purpose");
2310        }
2311        else if (name.equals("copyright")) {
2312          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.copyright");
2313        }
2314        else if (name.equals("base")) {
2315          this.base = new Reference();
2316          return this.base;
2317        }
2318        else if (name.equals("parent")) {
2319          return addParent();
2320        }
2321        else if (name.equals("replaces")) {
2322          return addReplaces();
2323        }
2324        else if (name.equals("event")) {
2325          this.event = new Coding();
2326          return this.event;
2327        }
2328        else if (name.equals("category")) {
2329          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.category");
2330        }
2331        else if (name.equals("focus")) {
2332          return addFocus();
2333        }
2334        else if (name.equals("responseRequired")) {
2335          throw new FHIRException("Cannot call addChild on a primitive type MessageDefinition.responseRequired");
2336        }
2337        else if (name.equals("allowedResponse")) {
2338          return addAllowedResponse();
2339        }
2340        else
2341          return super.addChild(name);
2342      }
2343
2344  public String fhirType() {
2345    return "MessageDefinition";
2346
2347  }
2348
2349      public MessageDefinition copy() {
2350        MessageDefinition dst = new MessageDefinition();
2351        copyValues(dst);
2352        dst.url = url == null ? null : url.copy();
2353        dst.identifier = identifier == null ? null : identifier.copy();
2354        dst.version = version == null ? null : version.copy();
2355        dst.name = name == null ? null : name.copy();
2356        dst.title = title == null ? null : title.copy();
2357        dst.status = status == null ? null : status.copy();
2358        dst.experimental = experimental == null ? null : experimental.copy();
2359        dst.date = date == null ? null : date.copy();
2360        dst.publisher = publisher == null ? null : publisher.copy();
2361        if (contact != null) {
2362          dst.contact = new ArrayList<ContactDetail>();
2363          for (ContactDetail i : contact)
2364            dst.contact.add(i.copy());
2365        };
2366        dst.description = description == null ? null : description.copy();
2367        if (useContext != null) {
2368          dst.useContext = new ArrayList<UsageContext>();
2369          for (UsageContext i : useContext)
2370            dst.useContext.add(i.copy());
2371        };
2372        if (jurisdiction != null) {
2373          dst.jurisdiction = new ArrayList<CodeableConcept>();
2374          for (CodeableConcept i : jurisdiction)
2375            dst.jurisdiction.add(i.copy());
2376        };
2377        dst.purpose = purpose == null ? null : purpose.copy();
2378        dst.copyright = copyright == null ? null : copyright.copy();
2379        dst.base = base == null ? null : base.copy();
2380        if (parent != null) {
2381          dst.parent = new ArrayList<Reference>();
2382          for (Reference i : parent)
2383            dst.parent.add(i.copy());
2384        };
2385        if (replaces != null) {
2386          dst.replaces = new ArrayList<Reference>();
2387          for (Reference i : replaces)
2388            dst.replaces.add(i.copy());
2389        };
2390        dst.event = event == null ? null : event.copy();
2391        dst.category = category == null ? null : category.copy();
2392        if (focus != null) {
2393          dst.focus = new ArrayList<MessageDefinitionFocusComponent>();
2394          for (MessageDefinitionFocusComponent i : focus)
2395            dst.focus.add(i.copy());
2396        };
2397        dst.responseRequired = responseRequired == null ? null : responseRequired.copy();
2398        if (allowedResponse != null) {
2399          dst.allowedResponse = new ArrayList<MessageDefinitionAllowedResponseComponent>();
2400          for (MessageDefinitionAllowedResponseComponent i : allowedResponse)
2401            dst.allowedResponse.add(i.copy());
2402        };
2403        return dst;
2404      }
2405
2406      protected MessageDefinition typedCopy() {
2407        return copy();
2408      }
2409
2410      @Override
2411      public boolean equalsDeep(Base other) {
2412        if (!super.equalsDeep(other))
2413          return false;
2414        if (!(other instanceof MessageDefinition))
2415          return false;
2416        MessageDefinition o = (MessageDefinition) other;
2417        return compareDeep(identifier, o.identifier, true) && compareDeep(purpose, o.purpose, true) && compareDeep(copyright, o.copyright, true)
2418           && compareDeep(base, o.base, true) && compareDeep(parent, o.parent, true) && compareDeep(replaces, o.replaces, true)
2419           && compareDeep(event, o.event, true) && compareDeep(category, o.category, true) && compareDeep(focus, o.focus, true)
2420           && compareDeep(responseRequired, o.responseRequired, true) && compareDeep(allowedResponse, o.allowedResponse, true)
2421          ;
2422      }
2423
2424      @Override
2425      public boolean equalsShallow(Base other) {
2426        if (!super.equalsShallow(other))
2427          return false;
2428        if (!(other instanceof MessageDefinition))
2429          return false;
2430        MessageDefinition o = (MessageDefinition) other;
2431        return compareValues(purpose, o.purpose, true) && compareValues(copyright, o.copyright, true) && compareValues(category, o.category, true)
2432           && compareValues(responseRequired, o.responseRequired, true);
2433      }
2434
2435      public boolean isEmpty() {
2436        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, purpose, copyright
2437          , base, parent, replaces, event, category, focus, responseRequired, allowedResponse
2438          );
2439      }
2440
2441  @Override
2442  public ResourceType getResourceType() {
2443    return ResourceType.MessageDefinition;
2444   }
2445
2446 /**
2447   * Search parameter: <b>date</b>
2448   * <p>
2449   * Description: <b>The message definition publication date</b><br>
2450   * Type: <b>date</b><br>
2451   * Path: <b>MessageDefinition.date</b><br>
2452   * </p>
2453   */
2454  @SearchParamDefinition(name="date", path="MessageDefinition.date", description="The message definition publication date", type="date" )
2455  public static final String SP_DATE = "date";
2456 /**
2457   * <b>Fluent Client</b> search parameter constant for <b>date</b>
2458   * <p>
2459   * Description: <b>The message definition publication date</b><br>
2460   * Type: <b>date</b><br>
2461   * Path: <b>MessageDefinition.date</b><br>
2462   * </p>
2463   */
2464  public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE);
2465
2466 /**
2467   * Search parameter: <b>identifier</b>
2468   * <p>
2469   * Description: <b>External identifier for the message definition</b><br>
2470   * Type: <b>token</b><br>
2471   * Path: <b>MessageDefinition.identifier</b><br>
2472   * </p>
2473   */
2474  @SearchParamDefinition(name="identifier", path="MessageDefinition.identifier", description="External identifier for the message definition", type="token" )
2475  public static final String SP_IDENTIFIER = "identifier";
2476 /**
2477   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
2478   * <p>
2479   * Description: <b>External identifier for the message definition</b><br>
2480   * Type: <b>token</b><br>
2481   * Path: <b>MessageDefinition.identifier</b><br>
2482   * </p>
2483   */
2484  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
2485
2486 /**
2487   * Search parameter: <b>jurisdiction</b>
2488   * <p>
2489   * Description: <b>Intended jurisdiction for the message definition</b><br>
2490   * Type: <b>token</b><br>
2491   * Path: <b>MessageDefinition.jurisdiction</b><br>
2492   * </p>
2493   */
2494  @SearchParamDefinition(name="jurisdiction", path="MessageDefinition.jurisdiction", description="Intended jurisdiction for the message definition", type="token" )
2495  public static final String SP_JURISDICTION = "jurisdiction";
2496 /**
2497   * <b>Fluent Client</b> search parameter constant for <b>jurisdiction</b>
2498   * <p>
2499   * Description: <b>Intended jurisdiction for the message definition</b><br>
2500   * Type: <b>token</b><br>
2501   * Path: <b>MessageDefinition.jurisdiction</b><br>
2502   * </p>
2503   */
2504  public static final ca.uhn.fhir.rest.gclient.TokenClientParam JURISDICTION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_JURISDICTION);
2505
2506 /**
2507   * Search parameter: <b>description</b>
2508   * <p>
2509   * Description: <b>The description of the message definition</b><br>
2510   * Type: <b>string</b><br>
2511   * Path: <b>MessageDefinition.description</b><br>
2512   * </p>
2513   */
2514  @SearchParamDefinition(name="description", path="MessageDefinition.description", description="The description of the message definition", type="string" )
2515  public static final String SP_DESCRIPTION = "description";
2516 /**
2517   * <b>Fluent Client</b> search parameter constant for <b>description</b>
2518   * <p>
2519   * Description: <b>The description of the message definition</b><br>
2520   * Type: <b>string</b><br>
2521   * Path: <b>MessageDefinition.description</b><br>
2522   * </p>
2523   */
2524  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
2525
2526 /**
2527   * Search parameter: <b>focus</b>
2528   * <p>
2529   * Description: <b>A resource that is a permitted focus of the message</b><br>
2530   * Type: <b>token</b><br>
2531   * Path: <b>MessageDefinition.focus.code</b><br>
2532   * </p>
2533   */
2534  @SearchParamDefinition(name="focus", path="MessageDefinition.focus.code", description="A resource that is a permitted focus of the message", type="token" )
2535  public static final String SP_FOCUS = "focus";
2536 /**
2537   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
2538   * <p>
2539   * Description: <b>A resource that is a permitted focus of the message</b><br>
2540   * Type: <b>token</b><br>
2541   * Path: <b>MessageDefinition.focus.code</b><br>
2542   * </p>
2543   */
2544  public static final ca.uhn.fhir.rest.gclient.TokenClientParam FOCUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_FOCUS);
2545
2546 /**
2547   * Search parameter: <b>title</b>
2548   * <p>
2549   * Description: <b>The human-friendly name of the message definition</b><br>
2550   * Type: <b>string</b><br>
2551   * Path: <b>MessageDefinition.title</b><br>
2552   * </p>
2553   */
2554  @SearchParamDefinition(name="title", path="MessageDefinition.title", description="The human-friendly name of the message definition", type="string" )
2555  public static final String SP_TITLE = "title";
2556 /**
2557   * <b>Fluent Client</b> search parameter constant for <b>title</b>
2558   * <p>
2559   * Description: <b>The human-friendly name of the message definition</b><br>
2560   * Type: <b>string</b><br>
2561   * Path: <b>MessageDefinition.title</b><br>
2562   * </p>
2563   */
2564  public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
2565
2566 /**
2567   * Search parameter: <b>version</b>
2568   * <p>
2569   * Description: <b>The business version of the message definition</b><br>
2570   * Type: <b>token</b><br>
2571   * Path: <b>MessageDefinition.version</b><br>
2572   * </p>
2573   */
2574  @SearchParamDefinition(name="version", path="MessageDefinition.version", description="The business version of the message definition", type="token" )
2575  public static final String SP_VERSION = "version";
2576 /**
2577   * <b>Fluent Client</b> search parameter constant for <b>version</b>
2578   * <p>
2579   * Description: <b>The business version of the message definition</b><br>
2580   * Type: <b>token</b><br>
2581   * Path: <b>MessageDefinition.version</b><br>
2582   * </p>
2583   */
2584  public static final ca.uhn.fhir.rest.gclient.TokenClientParam VERSION = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_VERSION);
2585
2586 /**
2587   * Search parameter: <b>url</b>
2588   * <p>
2589   * Description: <b>The uri that identifies the message definition</b><br>
2590   * Type: <b>uri</b><br>
2591   * Path: <b>MessageDefinition.url</b><br>
2592   * </p>
2593   */
2594  @SearchParamDefinition(name="url", path="MessageDefinition.url", description="The uri that identifies the message definition", type="uri" )
2595  public static final String SP_URL = "url";
2596 /**
2597   * <b>Fluent Client</b> search parameter constant for <b>url</b>
2598   * <p>
2599   * Description: <b>The uri that identifies the message definition</b><br>
2600   * Type: <b>uri</b><br>
2601   * Path: <b>MessageDefinition.url</b><br>
2602   * </p>
2603   */
2604  public static final ca.uhn.fhir.rest.gclient.UriClientParam URL = new ca.uhn.fhir.rest.gclient.UriClientParam(SP_URL);
2605
2606 /**
2607   * Search parameter: <b>name</b>
2608   * <p>
2609   * Description: <b>Computationally friendly name of the message definition</b><br>
2610   * Type: <b>string</b><br>
2611   * Path: <b>MessageDefinition.name</b><br>
2612   * </p>
2613   */
2614  @SearchParamDefinition(name="name", path="MessageDefinition.name", description="Computationally friendly name of the message definition", type="string" )
2615  public static final String SP_NAME = "name";
2616 /**
2617   * <b>Fluent Client</b> search parameter constant for <b>name</b>
2618   * <p>
2619   * Description: <b>Computationally friendly name of the message definition</b><br>
2620   * Type: <b>string</b><br>
2621   * Path: <b>MessageDefinition.name</b><br>
2622   * </p>
2623   */
2624  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
2625
2626 /**
2627   * Search parameter: <b>publisher</b>
2628   * <p>
2629   * Description: <b>Name of the publisher of the message definition</b><br>
2630   * Type: <b>string</b><br>
2631   * Path: <b>MessageDefinition.publisher</b><br>
2632   * </p>
2633   */
2634  @SearchParamDefinition(name="publisher", path="MessageDefinition.publisher", description="Name of the publisher of the message definition", type="string" )
2635  public static final String SP_PUBLISHER = "publisher";
2636 /**
2637   * <b>Fluent Client</b> search parameter constant for <b>publisher</b>
2638   * <p>
2639   * Description: <b>Name of the publisher of the message definition</b><br>
2640   * Type: <b>string</b><br>
2641   * Path: <b>MessageDefinition.publisher</b><br>
2642   * </p>
2643   */
2644  public static final ca.uhn.fhir.rest.gclient.StringClientParam PUBLISHER = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_PUBLISHER);
2645
2646 /**
2647   * Search parameter: <b>event</b>
2648   * <p>
2649   * Description: <b>The event that triggers the message</b><br>
2650   * Type: <b>token</b><br>
2651   * Path: <b>MessageDefinition.event</b><br>
2652   * </p>
2653   */
2654  @SearchParamDefinition(name="event", path="MessageDefinition.event", description="The event that triggers the message", type="token" )
2655  public static final String SP_EVENT = "event";
2656 /**
2657   * <b>Fluent Client</b> search parameter constant for <b>event</b>
2658   * <p>
2659   * Description: <b>The event that triggers the message</b><br>
2660   * Type: <b>token</b><br>
2661   * Path: <b>MessageDefinition.event</b><br>
2662   * </p>
2663   */
2664  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EVENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_EVENT);
2665
2666 /**
2667   * Search parameter: <b>category</b>
2668   * <p>
2669   * Description: <b>The behavior associated with the message</b><br>
2670   * Type: <b>token</b><br>
2671   * Path: <b>MessageDefinition.category</b><br>
2672   * </p>
2673   */
2674  @SearchParamDefinition(name="category", path="MessageDefinition.category", description="The behavior associated with the message", type="token" )
2675  public static final String SP_CATEGORY = "category";
2676 /**
2677   * <b>Fluent Client</b> search parameter constant for <b>category</b>
2678   * <p>
2679   * Description: <b>The behavior associated with the message</b><br>
2680   * Type: <b>token</b><br>
2681   * Path: <b>MessageDefinition.category</b><br>
2682   * </p>
2683   */
2684  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY);
2685
2686 /**
2687   * Search parameter: <b>status</b>
2688   * <p>
2689   * Description: <b>The current status of the message definition</b><br>
2690   * Type: <b>token</b><br>
2691   * Path: <b>MessageDefinition.status</b><br>
2692   * </p>
2693   */
2694  @SearchParamDefinition(name="status", path="MessageDefinition.status", description="The current status of the message definition", type="token" )
2695  public static final String SP_STATUS = "status";
2696 /**
2697   * <b>Fluent Client</b> search parameter constant for <b>status</b>
2698   * <p>
2699   * Description: <b>The current status of the message definition</b><br>
2700   * Type: <b>token</b><br>
2701   * Path: <b>MessageDefinition.status</b><br>
2702   * </p>
2703   */
2704  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
2705
2706
2707}
2708