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