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