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