001package org.hl7.fhir.r4.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
033import java.util.ArrayList;
034import java.util.List;
035
036import org.hl7.fhir.exceptions.FHIRException;
037import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
038import org.hl7.fhir.utilities.Utilities;
039
040import ca.uhn.fhir.model.api.annotation.Block;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.ResourceDef;
044import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
045
046/**
047 * The header for a message exchange that is either requesting or responding to
048 * an action. The reference(s) that are the subject of the action as well as
049 * other information related to the action are typically transmitted in a bundle
050 * in which the MessageHeader resource instance is the first resource in the
051 * bundle.
052 */
053@ResourceDef(name = "MessageHeader", profile = "http://hl7.org/fhir/StructureDefinition/MessageHeader")
054public class MessageHeader extends DomainResource {
055
056  public enum ResponseType {
057    /**
058     * The message was accepted and processed without error.
059     */
060    OK,
061    /**
062     * Some internal unexpected error occurred - wait and try again. Note - this is
063     * usually used for things like database unavailable, which may be expected to
064     * resolve, though human intervention may be required.
065     */
066    TRANSIENTERROR,
067    /**
068     * The message was rejected because of a problem with the content. There is no
069     * point in re-sending without change. The response narrative SHALL describe the
070     * issue.
071     */
072    FATALERROR,
073    /**
074     * added to help the parsers with the generic types
075     */
076    NULL;
077
078    public static ResponseType fromCode(String codeString) throws FHIRException {
079      if (codeString == null || "".equals(codeString))
080        return null;
081      if ("ok".equals(codeString))
082        return OK;
083      if ("transient-error".equals(codeString))
084        return TRANSIENTERROR;
085      if ("fatal-error".equals(codeString))
086        return FATALERROR;
087      if (Configuration.isAcceptInvalidEnums())
088        return null;
089      else
090        throw new FHIRException("Unknown ResponseType code '" + codeString + "'");
091    }
092
093    public String toCode() {
094      switch (this) {
095      case OK:
096        return "ok";
097      case TRANSIENTERROR:
098        return "transient-error";
099      case FATALERROR:
100        return "fatal-error";
101      case NULL:
102        return null;
103      default:
104        return "?";
105      }
106    }
107
108    public String getSystem() {
109      switch (this) {
110      case OK:
111        return "http://hl7.org/fhir/response-code";
112      case TRANSIENTERROR:
113        return "http://hl7.org/fhir/response-code";
114      case FATALERROR:
115        return "http://hl7.org/fhir/response-code";
116      case NULL:
117        return null;
118      default:
119        return "?";
120      }
121    }
122
123    public String getDefinition() {
124      switch (this) {
125      case OK:
126        return "The message was accepted and processed without error.";
127      case TRANSIENTERROR:
128        return "Some internal unexpected error occurred - wait and try again. Note - this is usually used for things like database unavailable, which may be expected to resolve, though human intervention may be required.";
129      case FATALERROR:
130        return "The message was rejected because of a problem with the content. There is no point in re-sending without change. The response narrative SHALL describe the issue.";
131      case NULL:
132        return null;
133      default:
134        return "?";
135      }
136    }
137
138    public String getDisplay() {
139      switch (this) {
140      case OK:
141        return "OK";
142      case TRANSIENTERROR:
143        return "Transient Error";
144      case FATALERROR:
145        return "Fatal Error";
146      case NULL:
147        return null;
148      default:
149        return "?";
150      }
151    }
152  }
153
154  public static class ResponseTypeEnumFactory implements EnumFactory<ResponseType> {
155    public ResponseType fromCode(String codeString) throws IllegalArgumentException {
156      if (codeString == null || "".equals(codeString))
157        if (codeString == null || "".equals(codeString))
158          return null;
159      if ("ok".equals(codeString))
160        return ResponseType.OK;
161      if ("transient-error".equals(codeString))
162        return ResponseType.TRANSIENTERROR;
163      if ("fatal-error".equals(codeString))
164        return ResponseType.FATALERROR;
165      throw new IllegalArgumentException("Unknown ResponseType code '" + codeString + "'");
166    }
167
168    public Enumeration<ResponseType> fromType(PrimitiveType<?> code) throws FHIRException {
169      if (code == null)
170        return null;
171      if (code.isEmpty())
172        return new Enumeration<ResponseType>(this, ResponseType.NULL, code);
173      String codeString = code.asStringValue();
174      if (codeString == null || "".equals(codeString))
175        return new Enumeration<ResponseType>(this, ResponseType.NULL, code);
176      if ("ok".equals(codeString))
177        return new Enumeration<ResponseType>(this, ResponseType.OK, code);
178      if ("transient-error".equals(codeString))
179        return new Enumeration<ResponseType>(this, ResponseType.TRANSIENTERROR, code);
180      if ("fatal-error".equals(codeString))
181        return new Enumeration<ResponseType>(this, ResponseType.FATALERROR, code);
182      throw new FHIRException("Unknown ResponseType code '" + codeString + "'");
183    }
184
185    public String toCode(ResponseType code) {
186      if (code == ResponseType.OK)
187        return "ok";
188      if (code == ResponseType.TRANSIENTERROR)
189        return "transient-error";
190      if (code == ResponseType.FATALERROR)
191        return "fatal-error";
192      return "?";
193    }
194
195    public String toSystem(ResponseType code) {
196      return code.getSystem();
197    }
198  }
199
200  @Block()
201  public static class MessageDestinationComponent extends BackboneElement implements IBaseBackboneElement {
202    /**
203     * Human-readable name for the target system.
204     */
205    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
206    @Description(shortDefinition = "Name of system", formalDefinition = "Human-readable name for the target system.")
207    protected StringType name;
208
209    /**
210     * Identifies the target end system in situations where the initial message
211     * transmission is to an intermediary system.
212     */
213    @Child(name = "target", type = { Device.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
214    @Description(shortDefinition = "Particular delivery destination within the destination", formalDefinition = "Identifies the target end system in situations where the initial message transmission is to an intermediary system.")
215    protected Reference target;
216
217    /**
218     * The actual object that is the target of the reference (Identifies the target
219     * end system in situations where the initial message transmission is to an
220     * intermediary system.)
221     */
222    protected Device targetTarget;
223
224    /**
225     * Indicates where the message should be routed to.
226     */
227    @Child(name = "endpoint", type = { UrlType.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
228    @Description(shortDefinition = "Actual destination address or id", formalDefinition = "Indicates where the message should be routed to.")
229    protected UrlType endpoint;
230
231    /**
232     * Allows data conveyed by a message to be addressed to a particular person or
233     * department when routing to a specific application isn't sufficient.
234     */
235    @Child(name = "receiver", type = { Practitioner.class, PractitionerRole.class,
236        Organization.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
237    @Description(shortDefinition = "Intended \"real-world\" recipient for the data", formalDefinition = "Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.")
238    protected Reference receiver;
239
240    /**
241     * The actual object that is the target of the reference (Allows data conveyed
242     * by a message to be addressed to a particular person or department when
243     * routing to a specific application isn't sufficient.)
244     */
245    protected Resource receiverTarget;
246
247    private static final long serialVersionUID = 611064500L;
248
249    /**
250     * Constructor
251     */
252    public MessageDestinationComponent() {
253      super();
254    }
255
256    /**
257     * Constructor
258     */
259    public MessageDestinationComponent(UrlType endpoint) {
260      super();
261      this.endpoint = endpoint;
262    }
263
264    /**
265     * @return {@link #name} (Human-readable name for the target system.). This is
266     *         the underlying object with id, value and extensions. The accessor
267     *         "getName" gives direct access to the value
268     */
269    public StringType getNameElement() {
270      if (this.name == null)
271        if (Configuration.errorOnAutoCreate())
272          throw new Error("Attempt to auto-create MessageDestinationComponent.name");
273        else if (Configuration.doAutoCreate())
274          this.name = new StringType(); // bb
275      return this.name;
276    }
277
278    public boolean hasNameElement() {
279      return this.name != null && !this.name.isEmpty();
280    }
281
282    public boolean hasName() {
283      return this.name != null && !this.name.isEmpty();
284    }
285
286    /**
287     * @param value {@link #name} (Human-readable name for the target system.). This
288     *              is the underlying object with id, value and extensions. The
289     *              accessor "getName" gives direct access to the value
290     */
291    public MessageDestinationComponent setNameElement(StringType value) {
292      this.name = value;
293      return this;
294    }
295
296    /**
297     * @return Human-readable name for the target system.
298     */
299    public String getName() {
300      return this.name == null ? null : this.name.getValue();
301    }
302
303    /**
304     * @param value Human-readable name for the target system.
305     */
306    public MessageDestinationComponent setName(String value) {
307      if (Utilities.noString(value))
308        this.name = null;
309      else {
310        if (this.name == null)
311          this.name = new StringType();
312        this.name.setValue(value);
313      }
314      return this;
315    }
316
317    /**
318     * @return {@link #target} (Identifies the target end system in situations where
319     *         the initial message transmission is to an intermediary system.)
320     */
321    public Reference getTarget() {
322      if (this.target == null)
323        if (Configuration.errorOnAutoCreate())
324          throw new Error("Attempt to auto-create MessageDestinationComponent.target");
325        else if (Configuration.doAutoCreate())
326          this.target = new Reference(); // cc
327      return this.target;
328    }
329
330    public boolean hasTarget() {
331      return this.target != null && !this.target.isEmpty();
332    }
333
334    /**
335     * @param value {@link #target} (Identifies the target end system in situations
336     *              where the initial message transmission is to an intermediary
337     *              system.)
338     */
339    public MessageDestinationComponent setTarget(Reference value) {
340      this.target = value;
341      return this;
342    }
343
344    /**
345     * @return {@link #target} The actual object that is the target of the
346     *         reference. The reference library doesn't populate this, but you can
347     *         use it to hold the resource if you resolve it. (Identifies the target
348     *         end system in situations where the initial message transmission is to
349     *         an intermediary system.)
350     */
351    public Device getTargetTarget() {
352      if (this.targetTarget == null)
353        if (Configuration.errorOnAutoCreate())
354          throw new Error("Attempt to auto-create MessageDestinationComponent.target");
355        else if (Configuration.doAutoCreate())
356          this.targetTarget = new Device(); // aa
357      return this.targetTarget;
358    }
359
360    /**
361     * @param value {@link #target} The actual object that is the target of the
362     *              reference. The reference library doesn't use these, but you can
363     *              use it to hold the resource if you resolve it. (Identifies the
364     *              target end system in situations where the initial message
365     *              transmission is to an intermediary system.)
366     */
367    public MessageDestinationComponent setTargetTarget(Device value) {
368      this.targetTarget = value;
369      return this;
370    }
371
372    /**
373     * @return {@link #endpoint} (Indicates where the message should be routed to.).
374     *         This is the underlying object with id, value and extensions. The
375     *         accessor "getEndpoint" gives direct access to the value
376     */
377    public UrlType getEndpointElement() {
378      if (this.endpoint == null)
379        if (Configuration.errorOnAutoCreate())
380          throw new Error("Attempt to auto-create MessageDestinationComponent.endpoint");
381        else if (Configuration.doAutoCreate())
382          this.endpoint = new UrlType(); // bb
383      return this.endpoint;
384    }
385
386    public boolean hasEndpointElement() {
387      return this.endpoint != null && !this.endpoint.isEmpty();
388    }
389
390    public boolean hasEndpoint() {
391      return this.endpoint != null && !this.endpoint.isEmpty();
392    }
393
394    /**
395     * @param value {@link #endpoint} (Indicates where the message should be routed
396     *              to.). This is the underlying object with id, value and
397     *              extensions. The accessor "getEndpoint" gives direct access to
398     *              the value
399     */
400    public MessageDestinationComponent setEndpointElement(UrlType value) {
401      this.endpoint = value;
402      return this;
403    }
404
405    /**
406     * @return Indicates where the message should be routed to.
407     */
408    public String getEndpoint() {
409      return this.endpoint == null ? null : this.endpoint.getValue();
410    }
411
412    /**
413     * @param value Indicates where the message should be routed to.
414     */
415    public MessageDestinationComponent setEndpoint(String value) {
416      if (this.endpoint == null)
417        this.endpoint = new UrlType();
418      this.endpoint.setValue(value);
419      return this;
420    }
421
422    /**
423     * @return {@link #receiver} (Allows data conveyed by a message to be addressed
424     *         to a particular person or department when routing to a specific
425     *         application isn't sufficient.)
426     */
427    public Reference getReceiver() {
428      if (this.receiver == null)
429        if (Configuration.errorOnAutoCreate())
430          throw new Error("Attempt to auto-create MessageDestinationComponent.receiver");
431        else if (Configuration.doAutoCreate())
432          this.receiver = new Reference(); // cc
433      return this.receiver;
434    }
435
436    public boolean hasReceiver() {
437      return this.receiver != null && !this.receiver.isEmpty();
438    }
439
440    /**
441     * @param value {@link #receiver} (Allows data conveyed by a message to be
442     *              addressed to a particular person or department when routing to a
443     *              specific application isn't sufficient.)
444     */
445    public MessageDestinationComponent setReceiver(Reference value) {
446      this.receiver = value;
447      return this;
448    }
449
450    /**
451     * @return {@link #receiver} The actual object that is the target of the
452     *         reference. The reference library doesn't populate this, but you can
453     *         use it to hold the resource if you resolve it. (Allows data conveyed
454     *         by a message to be addressed to a particular person or department
455     *         when routing to a specific application isn't sufficient.)
456     */
457    public Resource getReceiverTarget() {
458      return this.receiverTarget;
459    }
460
461    /**
462     * @param value {@link #receiver} The actual object that is the target of the
463     *              reference. The reference library doesn't use these, but you can
464     *              use it to hold the resource if you resolve it. (Allows data
465     *              conveyed by a message to be addressed to a particular person or
466     *              department when routing to a specific application isn't
467     *              sufficient.)
468     */
469    public MessageDestinationComponent setReceiverTarget(Resource value) {
470      this.receiverTarget = value;
471      return this;
472    }
473
474    protected void listChildren(List<Property> children) {
475      super.listChildren(children);
476      children.add(new Property("name", "string", "Human-readable name for the target system.", 0, 1, name));
477      children.add(new Property("target", "Reference(Device)",
478          "Identifies the target end system in situations where the initial message transmission is to an intermediary system.",
479          0, 1, target));
480      children.add(new Property("endpoint", "url", "Indicates where the message should be routed to.", 0, 1, endpoint));
481      children.add(new Property("receiver", "Reference(Practitioner|PractitionerRole|Organization)",
482          "Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.",
483          0, 1, receiver));
484    }
485
486    @Override
487    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
488      switch (_hash) {
489      case 3373707:
490        /* name */ return new Property("name", "string", "Human-readable name for the target system.", 0, 1, name);
491      case -880905839:
492        /* target */ return new Property("target", "Reference(Device)",
493            "Identifies the target end system in situations where the initial message transmission is to an intermediary system.",
494            0, 1, target);
495      case 1741102485:
496        /* endpoint */ return new Property("endpoint", "url", "Indicates where the message should be routed to.", 0, 1,
497            endpoint);
498      case -808719889:
499        /* receiver */ return new Property("receiver", "Reference(Practitioner|PractitionerRole|Organization)",
500            "Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.",
501            0, 1, receiver);
502      default:
503        return super.getNamedProperty(_hash, _name, _checkValid);
504      }
505
506    }
507
508    @Override
509    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
510      switch (hash) {
511      case 3373707:
512        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
513      case -880905839:
514        /* target */ return this.target == null ? new Base[0] : new Base[] { this.target }; // Reference
515      case 1741102485:
516        /* endpoint */ return this.endpoint == null ? new Base[0] : new Base[] { this.endpoint }; // UrlType
517      case -808719889:
518        /* receiver */ return this.receiver == null ? new Base[0] : new Base[] { this.receiver }; // Reference
519      default:
520        return super.getProperty(hash, name, checkValid);
521      }
522
523    }
524
525    @Override
526    public Base setProperty(int hash, String name, Base value) throws FHIRException {
527      switch (hash) {
528      case 3373707: // name
529        this.name = castToString(value); // StringType
530        return value;
531      case -880905839: // target
532        this.target = castToReference(value); // Reference
533        return value;
534      case 1741102485: // endpoint
535        this.endpoint = castToUrl(value); // UrlType
536        return value;
537      case -808719889: // receiver
538        this.receiver = castToReference(value); // Reference
539        return value;
540      default:
541        return super.setProperty(hash, name, value);
542      }
543
544    }
545
546    @Override
547    public Base setProperty(String name, Base value) throws FHIRException {
548      if (name.equals("name")) {
549        this.name = castToString(value); // StringType
550      } else if (name.equals("target")) {
551        this.target = castToReference(value); // Reference
552      } else if (name.equals("endpoint")) {
553        this.endpoint = castToUrl(value); // UrlType
554      } else if (name.equals("receiver")) {
555        this.receiver = castToReference(value); // Reference
556      } else
557        return super.setProperty(name, value);
558      return value;
559    }
560
561  @Override
562  public void removeChild(String name, Base value) throws FHIRException {
563      if (name.equals("name")) {
564        this.name = null;
565      } else if (name.equals("target")) {
566        this.target = null;
567      } else if (name.equals("endpoint")) {
568        this.endpoint = null;
569      } else if (name.equals("receiver")) {
570        this.receiver = null;
571      } else
572        super.removeChild(name, value);
573      
574    }
575
576    @Override
577    public Base makeProperty(int hash, String name) throws FHIRException {
578      switch (hash) {
579      case 3373707:
580        return getNameElement();
581      case -880905839:
582        return getTarget();
583      case 1741102485:
584        return getEndpointElement();
585      case -808719889:
586        return getReceiver();
587      default:
588        return super.makeProperty(hash, name);
589      }
590
591    }
592
593    @Override
594    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
595      switch (hash) {
596      case 3373707:
597        /* name */ return new String[] { "string" };
598      case -880905839:
599        /* target */ return new String[] { "Reference" };
600      case 1741102485:
601        /* endpoint */ return new String[] { "url" };
602      case -808719889:
603        /* receiver */ return new String[] { "Reference" };
604      default:
605        return super.getTypesForProperty(hash, name);
606      }
607
608    }
609
610    @Override
611    public Base addChild(String name) throws FHIRException {
612      if (name.equals("name")) {
613        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.name");
614      } else if (name.equals("target")) {
615        this.target = new Reference();
616        return this.target;
617      } else if (name.equals("endpoint")) {
618        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.endpoint");
619      } else if (name.equals("receiver")) {
620        this.receiver = new Reference();
621        return this.receiver;
622      } else
623        return super.addChild(name);
624    }
625
626    public MessageDestinationComponent copy() {
627      MessageDestinationComponent dst = new MessageDestinationComponent();
628      copyValues(dst);
629      return dst;
630    }
631
632    public void copyValues(MessageDestinationComponent dst) {
633      super.copyValues(dst);
634      dst.name = name == null ? null : name.copy();
635      dst.target = target == null ? null : target.copy();
636      dst.endpoint = endpoint == null ? null : endpoint.copy();
637      dst.receiver = receiver == null ? null : receiver.copy();
638    }
639
640    @Override
641    public boolean equalsDeep(Base other_) {
642      if (!super.equalsDeep(other_))
643        return false;
644      if (!(other_ instanceof MessageDestinationComponent))
645        return false;
646      MessageDestinationComponent o = (MessageDestinationComponent) other_;
647      return compareDeep(name, o.name, true) && compareDeep(target, o.target, true)
648          && compareDeep(endpoint, o.endpoint, true) && compareDeep(receiver, o.receiver, true);
649    }
650
651    @Override
652    public boolean equalsShallow(Base other_) {
653      if (!super.equalsShallow(other_))
654        return false;
655      if (!(other_ instanceof MessageDestinationComponent))
656        return false;
657      MessageDestinationComponent o = (MessageDestinationComponent) other_;
658      return compareValues(name, o.name, true) && compareValues(endpoint, o.endpoint, true);
659    }
660
661    public boolean isEmpty() {
662      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, target, endpoint, receiver);
663    }
664
665    public String fhirType() {
666      return "MessageHeader.destination";
667
668    }
669
670  }
671
672  @Block()
673  public static class MessageSourceComponent extends BackboneElement implements IBaseBackboneElement {
674    /**
675     * Human-readable name for the source system.
676     */
677    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
678    @Description(shortDefinition = "Name of system", formalDefinition = "Human-readable name for the source system.")
679    protected StringType name;
680
681    /**
682     * May include configuration or other information useful in debugging.
683     */
684    @Child(name = "software", type = {
685        StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
686    @Description(shortDefinition = "Name of software running the system", formalDefinition = "May include configuration or other information useful in debugging.")
687    protected StringType software;
688
689    /**
690     * Can convey versions of multiple systems in situations where a message passes
691     * through multiple hands.
692     */
693    @Child(name = "version", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
694    @Description(shortDefinition = "Version of software running", formalDefinition = "Can convey versions of multiple systems in situations where a message passes through multiple hands.")
695    protected StringType version;
696
697    /**
698     * An e-mail, phone, website or other contact point to use to resolve issues
699     * with message communications.
700     */
701    @Child(name = "contact", type = {
702        ContactPoint.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
703    @Description(shortDefinition = "Human contact for problems", formalDefinition = "An e-mail, phone, website or other contact point to use to resolve issues with message communications.")
704    protected ContactPoint contact;
705
706    /**
707     * Identifies the routing target to send acknowledgements to.
708     */
709    @Child(name = "endpoint", type = { UrlType.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
710    @Description(shortDefinition = "Actual message source address or id", formalDefinition = "Identifies the routing target to send acknowledgements to.")
711    protected UrlType endpoint;
712
713    private static final long serialVersionUID = -350916401L;
714
715    /**
716     * Constructor
717     */
718    public MessageSourceComponent() {
719      super();
720    }
721
722    /**
723     * Constructor
724     */
725    public MessageSourceComponent(UrlType endpoint) {
726      super();
727      this.endpoint = endpoint;
728    }
729
730    /**
731     * @return {@link #name} (Human-readable name for the source system.). This is
732     *         the underlying object with id, value and extensions. The accessor
733     *         "getName" gives direct access to the value
734     */
735    public StringType getNameElement() {
736      if (this.name == null)
737        if (Configuration.errorOnAutoCreate())
738          throw new Error("Attempt to auto-create MessageSourceComponent.name");
739        else if (Configuration.doAutoCreate())
740          this.name = new StringType(); // bb
741      return this.name;
742    }
743
744    public boolean hasNameElement() {
745      return this.name != null && !this.name.isEmpty();
746    }
747
748    public boolean hasName() {
749      return this.name != null && !this.name.isEmpty();
750    }
751
752    /**
753     * @param value {@link #name} (Human-readable name for the source system.). This
754     *              is the underlying object with id, value and extensions. The
755     *              accessor "getName" gives direct access to the value
756     */
757    public MessageSourceComponent setNameElement(StringType value) {
758      this.name = value;
759      return this;
760    }
761
762    /**
763     * @return Human-readable name for the source system.
764     */
765    public String getName() {
766      return this.name == null ? null : this.name.getValue();
767    }
768
769    /**
770     * @param value Human-readable name for the source system.
771     */
772    public MessageSourceComponent setName(String value) {
773      if (Utilities.noString(value))
774        this.name = null;
775      else {
776        if (this.name == null)
777          this.name = new StringType();
778        this.name.setValue(value);
779      }
780      return this;
781    }
782
783    /**
784     * @return {@link #software} (May include configuration or other information
785     *         useful in debugging.). This is the underlying object with id, value
786     *         and extensions. The accessor "getSoftware" gives direct access to the
787     *         value
788     */
789    public StringType getSoftwareElement() {
790      if (this.software == null)
791        if (Configuration.errorOnAutoCreate())
792          throw new Error("Attempt to auto-create MessageSourceComponent.software");
793        else if (Configuration.doAutoCreate())
794          this.software = new StringType(); // bb
795      return this.software;
796    }
797
798    public boolean hasSoftwareElement() {
799      return this.software != null && !this.software.isEmpty();
800    }
801
802    public boolean hasSoftware() {
803      return this.software != null && !this.software.isEmpty();
804    }
805
806    /**
807     * @param value {@link #software} (May include configuration or other
808     *              information useful in debugging.). This is the underlying object
809     *              with id, value and extensions. The accessor "getSoftware" gives
810     *              direct access to the value
811     */
812    public MessageSourceComponent setSoftwareElement(StringType value) {
813      this.software = value;
814      return this;
815    }
816
817    /**
818     * @return May include configuration or other information useful in debugging.
819     */
820    public String getSoftware() {
821      return this.software == null ? null : this.software.getValue();
822    }
823
824    /**
825     * @param value May include configuration or other information useful in
826     *              debugging.
827     */
828    public MessageSourceComponent setSoftware(String value) {
829      if (Utilities.noString(value))
830        this.software = null;
831      else {
832        if (this.software == null)
833          this.software = new StringType();
834        this.software.setValue(value);
835      }
836      return this;
837    }
838
839    /**
840     * @return {@link #version} (Can convey versions of multiple systems in
841     *         situations where a message passes through multiple hands.). This is
842     *         the underlying object with id, value and extensions. The accessor
843     *         "getVersion" gives direct access to the value
844     */
845    public StringType getVersionElement() {
846      if (this.version == null)
847        if (Configuration.errorOnAutoCreate())
848          throw new Error("Attempt to auto-create MessageSourceComponent.version");
849        else if (Configuration.doAutoCreate())
850          this.version = new StringType(); // bb
851      return this.version;
852    }
853
854    public boolean hasVersionElement() {
855      return this.version != null && !this.version.isEmpty();
856    }
857
858    public boolean hasVersion() {
859      return this.version != null && !this.version.isEmpty();
860    }
861
862    /**
863     * @param value {@link #version} (Can convey versions of multiple systems in
864     *              situations where a message passes through multiple hands.). This
865     *              is the underlying object with id, value and extensions. The
866     *              accessor "getVersion" gives direct access to the value
867     */
868    public MessageSourceComponent setVersionElement(StringType value) {
869      this.version = value;
870      return this;
871    }
872
873    /**
874     * @return Can convey versions of multiple systems in situations where a message
875     *         passes through multiple hands.
876     */
877    public String getVersion() {
878      return this.version == null ? null : this.version.getValue();
879    }
880
881    /**
882     * @param value Can convey versions of multiple systems in situations where a
883     *              message passes through multiple hands.
884     */
885    public MessageSourceComponent setVersion(String value) {
886      if (Utilities.noString(value))
887        this.version = null;
888      else {
889        if (this.version == null)
890          this.version = new StringType();
891        this.version.setValue(value);
892      }
893      return this;
894    }
895
896    /**
897     * @return {@link #contact} (An e-mail, phone, website or other contact point to
898     *         use to resolve issues with message communications.)
899     */
900    public ContactPoint getContact() {
901      if (this.contact == null)
902        if (Configuration.errorOnAutoCreate())
903          throw new Error("Attempt to auto-create MessageSourceComponent.contact");
904        else if (Configuration.doAutoCreate())
905          this.contact = new ContactPoint(); // cc
906      return this.contact;
907    }
908
909    public boolean hasContact() {
910      return this.contact != null && !this.contact.isEmpty();
911    }
912
913    /**
914     * @param value {@link #contact} (An e-mail, phone, website or other contact
915     *              point to use to resolve issues with message communications.)
916     */
917    public MessageSourceComponent setContact(ContactPoint value) {
918      this.contact = value;
919      return this;
920    }
921
922    /**
923     * @return {@link #endpoint} (Identifies the routing target to send
924     *         acknowledgements to.). This is the underlying object with id, value
925     *         and extensions. The accessor "getEndpoint" gives direct access to the
926     *         value
927     */
928    public UrlType getEndpointElement() {
929      if (this.endpoint == null)
930        if (Configuration.errorOnAutoCreate())
931          throw new Error("Attempt to auto-create MessageSourceComponent.endpoint");
932        else if (Configuration.doAutoCreate())
933          this.endpoint = new UrlType(); // bb
934      return this.endpoint;
935    }
936
937    public boolean hasEndpointElement() {
938      return this.endpoint != null && !this.endpoint.isEmpty();
939    }
940
941    public boolean hasEndpoint() {
942      return this.endpoint != null && !this.endpoint.isEmpty();
943    }
944
945    /**
946     * @param value {@link #endpoint} (Identifies the routing target to send
947     *              acknowledgements to.). This is the underlying object with id,
948     *              value and extensions. The accessor "getEndpoint" gives direct
949     *              access to the value
950     */
951    public MessageSourceComponent setEndpointElement(UrlType value) {
952      this.endpoint = value;
953      return this;
954    }
955
956    /**
957     * @return Identifies the routing target to send acknowledgements to.
958     */
959    public String getEndpoint() {
960      return this.endpoint == null ? null : this.endpoint.getValue();
961    }
962
963    /**
964     * @param value Identifies the routing target to send acknowledgements to.
965     */
966    public MessageSourceComponent setEndpoint(String value) {
967      if (this.endpoint == null)
968        this.endpoint = new UrlType();
969      this.endpoint.setValue(value);
970      return this;
971    }
972
973    protected void listChildren(List<Property> children) {
974      super.listChildren(children);
975      children.add(new Property("name", "string", "Human-readable name for the source system.", 0, 1, name));
976      children.add(new Property("software", "string",
977          "May include configuration or other information useful in debugging.", 0, 1, software));
978      children.add(new Property("version", "string",
979          "Can convey versions of multiple systems in situations where a message passes through multiple hands.", 0, 1,
980          version));
981      children.add(new Property("contact", "ContactPoint",
982          "An e-mail, phone, website or other contact point to use to resolve issues with message communications.", 0,
983          1, contact));
984      children.add(new Property("endpoint", "url", "Identifies the routing target to send acknowledgements to.", 0, 1,
985          endpoint));
986    }
987
988    @Override
989    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
990      switch (_hash) {
991      case 3373707:
992        /* name */ return new Property("name", "string", "Human-readable name for the source system.", 0, 1, name);
993      case 1319330215:
994        /* software */ return new Property("software", "string",
995            "May include configuration or other information useful in debugging.", 0, 1, software);
996      case 351608024:
997        /* version */ return new Property("version", "string",
998            "Can convey versions of multiple systems in situations where a message passes through multiple hands.", 0,
999            1, version);
1000      case 951526432:
1001        /* contact */ return new Property("contact", "ContactPoint",
1002            "An e-mail, phone, website or other contact point to use to resolve issues with message communications.", 0,
1003            1, contact);
1004      case 1741102485:
1005        /* endpoint */ return new Property("endpoint", "url",
1006            "Identifies the routing target to send acknowledgements to.", 0, 1, endpoint);
1007      default:
1008        return super.getNamedProperty(_hash, _name, _checkValid);
1009      }
1010
1011    }
1012
1013    @Override
1014    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1015      switch (hash) {
1016      case 3373707:
1017        /* name */ return this.name == null ? new Base[0] : new Base[] { this.name }; // StringType
1018      case 1319330215:
1019        /* software */ return this.software == null ? new Base[0] : new Base[] { this.software }; // StringType
1020      case 351608024:
1021        /* version */ return this.version == null ? new Base[0] : new Base[] { this.version }; // StringType
1022      case 951526432:
1023        /* contact */ return this.contact == null ? new Base[0] : new Base[] { this.contact }; // ContactPoint
1024      case 1741102485:
1025        /* endpoint */ return this.endpoint == null ? new Base[0] : new Base[] { this.endpoint }; // UrlType
1026      default:
1027        return super.getProperty(hash, name, checkValid);
1028      }
1029
1030    }
1031
1032    @Override
1033    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1034      switch (hash) {
1035      case 3373707: // name
1036        this.name = castToString(value); // StringType
1037        return value;
1038      case 1319330215: // software
1039        this.software = castToString(value); // StringType
1040        return value;
1041      case 351608024: // version
1042        this.version = castToString(value); // StringType
1043        return value;
1044      case 951526432: // contact
1045        this.contact = castToContactPoint(value); // ContactPoint
1046        return value;
1047      case 1741102485: // endpoint
1048        this.endpoint = castToUrl(value); // UrlType
1049        return value;
1050      default:
1051        return super.setProperty(hash, name, value);
1052      }
1053
1054    }
1055
1056    @Override
1057    public Base setProperty(String name, Base value) throws FHIRException {
1058      if (name.equals("name")) {
1059        this.name = castToString(value); // StringType
1060      } else if (name.equals("software")) {
1061        this.software = castToString(value); // StringType
1062      } else if (name.equals("version")) {
1063        this.version = castToString(value); // StringType
1064      } else if (name.equals("contact")) {
1065        this.contact = castToContactPoint(value); // ContactPoint
1066      } else if (name.equals("endpoint")) {
1067        this.endpoint = castToUrl(value); // UrlType
1068      } else
1069        return super.setProperty(name, value);
1070      return value;
1071    }
1072
1073  @Override
1074  public void removeChild(String name, Base value) throws FHIRException {
1075      if (name.equals("name")) {
1076        this.name = null;
1077      } else if (name.equals("software")) {
1078        this.software = null;
1079      } else if (name.equals("version")) {
1080        this.version = null;
1081      } else if (name.equals("contact")) {
1082        this.contact = null;
1083      } else if (name.equals("endpoint")) {
1084        this.endpoint = null;
1085      } else
1086        super.removeChild(name, value);
1087      
1088    }
1089
1090    @Override
1091    public Base makeProperty(int hash, String name) throws FHIRException {
1092      switch (hash) {
1093      case 3373707:
1094        return getNameElement();
1095      case 1319330215:
1096        return getSoftwareElement();
1097      case 351608024:
1098        return getVersionElement();
1099      case 951526432:
1100        return getContact();
1101      case 1741102485:
1102        return getEndpointElement();
1103      default:
1104        return super.makeProperty(hash, name);
1105      }
1106
1107    }
1108
1109    @Override
1110    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1111      switch (hash) {
1112      case 3373707:
1113        /* name */ return new String[] { "string" };
1114      case 1319330215:
1115        /* software */ return new String[] { "string" };
1116      case 351608024:
1117        /* version */ return new String[] { "string" };
1118      case 951526432:
1119        /* contact */ return new String[] { "ContactPoint" };
1120      case 1741102485:
1121        /* endpoint */ return new String[] { "url" };
1122      default:
1123        return super.getTypesForProperty(hash, name);
1124      }
1125
1126    }
1127
1128    @Override
1129    public Base addChild(String name) throws FHIRException {
1130      if (name.equals("name")) {
1131        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.name");
1132      } else if (name.equals("software")) {
1133        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.software");
1134      } else if (name.equals("version")) {
1135        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.version");
1136      } else if (name.equals("contact")) {
1137        this.contact = new ContactPoint();
1138        return this.contact;
1139      } else if (name.equals("endpoint")) {
1140        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.endpoint");
1141      } else
1142        return super.addChild(name);
1143    }
1144
1145    public MessageSourceComponent copy() {
1146      MessageSourceComponent dst = new MessageSourceComponent();
1147      copyValues(dst);
1148      return dst;
1149    }
1150
1151    public void copyValues(MessageSourceComponent dst) {
1152      super.copyValues(dst);
1153      dst.name = name == null ? null : name.copy();
1154      dst.software = software == null ? null : software.copy();
1155      dst.version = version == null ? null : version.copy();
1156      dst.contact = contact == null ? null : contact.copy();
1157      dst.endpoint = endpoint == null ? null : endpoint.copy();
1158    }
1159
1160    @Override
1161    public boolean equalsDeep(Base other_) {
1162      if (!super.equalsDeep(other_))
1163        return false;
1164      if (!(other_ instanceof MessageSourceComponent))
1165        return false;
1166      MessageSourceComponent o = (MessageSourceComponent) other_;
1167      return compareDeep(name, o.name, true) && compareDeep(software, o.software, true)
1168          && compareDeep(version, o.version, true) && compareDeep(contact, o.contact, true)
1169          && compareDeep(endpoint, o.endpoint, true);
1170    }
1171
1172    @Override
1173    public boolean equalsShallow(Base other_) {
1174      if (!super.equalsShallow(other_))
1175        return false;
1176      if (!(other_ instanceof MessageSourceComponent))
1177        return false;
1178      MessageSourceComponent o = (MessageSourceComponent) other_;
1179      return compareValues(name, o.name, true) && compareValues(software, o.software, true)
1180          && compareValues(version, o.version, true) && compareValues(endpoint, o.endpoint, true);
1181    }
1182
1183    public boolean isEmpty() {
1184      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(name, software, version, contact, endpoint);
1185    }
1186
1187    public String fhirType() {
1188      return "MessageHeader.source";
1189
1190    }
1191
1192  }
1193
1194  @Block()
1195  public static class MessageHeaderResponseComponent extends BackboneElement implements IBaseBackboneElement {
1196    /**
1197     * The MessageHeader.id of the message to which this message is a response.
1198     */
1199    @Child(name = "identifier", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
1200    @Description(shortDefinition = "Id of original message", formalDefinition = "The MessageHeader.id of the message to which this message is a response.")
1201    protected IdType identifier;
1202
1203    /**
1204     * Code that identifies the type of response to the message - whether it was
1205     * successful or not, and whether it should be resent or not.
1206     */
1207    @Child(name = "code", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
1208    @Description(shortDefinition = "ok | transient-error | fatal-error", formalDefinition = "Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.")
1209    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/response-code")
1210    protected Enumeration<ResponseType> code;
1211
1212    /**
1213     * Full details of any issues found in the message.
1214     */
1215    @Child(name = "details", type = {
1216        OperationOutcome.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1217    @Description(shortDefinition = "Specific list of hints/warnings/errors", formalDefinition = "Full details of any issues found in the message.")
1218    protected Reference details;
1219
1220    /**
1221     * The actual object that is the target of the reference (Full details of any
1222     * issues found in the message.)
1223     */
1224    protected OperationOutcome detailsTarget;
1225
1226    private static final long serialVersionUID = -1008716838L;
1227
1228    /**
1229     * Constructor
1230     */
1231    public MessageHeaderResponseComponent() {
1232      super();
1233    }
1234
1235    /**
1236     * Constructor
1237     */
1238    public MessageHeaderResponseComponent(IdType identifier, Enumeration<ResponseType> code) {
1239      super();
1240      this.identifier = identifier;
1241      this.code = code;
1242    }
1243
1244    /**
1245     * @return {@link #identifier} (The MessageHeader.id of the message to which
1246     *         this message is a response.). This is the underlying object with id,
1247     *         value and extensions. The accessor "getIdentifier" gives direct
1248     *         access to the value
1249     */
1250    public IdType getIdentifierElement() {
1251      if (this.identifier == null)
1252        if (Configuration.errorOnAutoCreate())
1253          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.identifier");
1254        else if (Configuration.doAutoCreate())
1255          this.identifier = new IdType(); // bb
1256      return this.identifier;
1257    }
1258
1259    public boolean hasIdentifierElement() {
1260      return this.identifier != null && !this.identifier.isEmpty();
1261    }
1262
1263    public boolean hasIdentifier() {
1264      return this.identifier != null && !this.identifier.isEmpty();
1265    }
1266
1267    /**
1268     * @param value {@link #identifier} (The MessageHeader.id of the message to
1269     *              which this message is a response.). This is the underlying
1270     *              object with id, value and extensions. The accessor
1271     *              "getIdentifier" gives direct access to the value
1272     */
1273    public MessageHeaderResponseComponent setIdentifierElement(IdType value) {
1274      this.identifier = value;
1275      return this;
1276    }
1277
1278    /**
1279     * @return The MessageHeader.id of the message to which this message is a
1280     *         response.
1281     */
1282    public String getIdentifier() {
1283      return this.identifier == null ? null : this.identifier.getValue();
1284    }
1285
1286    /**
1287     * @param value The MessageHeader.id of the message to which this message is a
1288     *              response.
1289     */
1290    public MessageHeaderResponseComponent setIdentifier(String value) {
1291      if (this.identifier == null)
1292        this.identifier = new IdType();
1293      this.identifier.setValue(value);
1294      return this;
1295    }
1296
1297    /**
1298     * @return {@link #code} (Code that identifies the type of response to the
1299     *         message - whether it was successful or not, and whether it should be
1300     *         resent or not.). This is the underlying object with id, value and
1301     *         extensions. The accessor "getCode" gives direct access to the value
1302     */
1303    public Enumeration<ResponseType> getCodeElement() {
1304      if (this.code == null)
1305        if (Configuration.errorOnAutoCreate())
1306          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.code");
1307        else if (Configuration.doAutoCreate())
1308          this.code = new Enumeration<ResponseType>(new ResponseTypeEnumFactory()); // bb
1309      return this.code;
1310    }
1311
1312    public boolean hasCodeElement() {
1313      return this.code != null && !this.code.isEmpty();
1314    }
1315
1316    public boolean hasCode() {
1317      return this.code != null && !this.code.isEmpty();
1318    }
1319
1320    /**
1321     * @param value {@link #code} (Code that identifies the type of response to the
1322     *              message - whether it was successful or not, and whether it
1323     *              should be resent or not.). This is the underlying object with
1324     *              id, value and extensions. The accessor "getCode" gives direct
1325     *              access to the value
1326     */
1327    public MessageHeaderResponseComponent setCodeElement(Enumeration<ResponseType> value) {
1328      this.code = value;
1329      return this;
1330    }
1331
1332    /**
1333     * @return Code that identifies the type of response to the message - whether it
1334     *         was successful or not, and whether it should be resent or not.
1335     */
1336    public ResponseType getCode() {
1337      return this.code == null ? null : this.code.getValue();
1338    }
1339
1340    /**
1341     * @param value Code that identifies the type of response to the message -
1342     *              whether it was successful or not, and whether it should be
1343     *              resent or not.
1344     */
1345    public MessageHeaderResponseComponent setCode(ResponseType value) {
1346      if (this.code == null)
1347        this.code = new Enumeration<ResponseType>(new ResponseTypeEnumFactory());
1348      this.code.setValue(value);
1349      return this;
1350    }
1351
1352    /**
1353     * @return {@link #details} (Full details of any issues found in the message.)
1354     */
1355    public Reference getDetails() {
1356      if (this.details == null)
1357        if (Configuration.errorOnAutoCreate())
1358          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.details");
1359        else if (Configuration.doAutoCreate())
1360          this.details = new Reference(); // cc
1361      return this.details;
1362    }
1363
1364    public boolean hasDetails() {
1365      return this.details != null && !this.details.isEmpty();
1366    }
1367
1368    /**
1369     * @param value {@link #details} (Full details of any issues found in the
1370     *              message.)
1371     */
1372    public MessageHeaderResponseComponent setDetails(Reference value) {
1373      this.details = value;
1374      return this;
1375    }
1376
1377    /**
1378     * @return {@link #details} The actual object that is the target of the
1379     *         reference. The reference library doesn't populate this, but you can
1380     *         use it to hold the resource if you resolve it. (Full details of any
1381     *         issues found in the message.)
1382     */
1383    public OperationOutcome getDetailsTarget() {
1384      if (this.detailsTarget == null)
1385        if (Configuration.errorOnAutoCreate())
1386          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.details");
1387        else if (Configuration.doAutoCreate())
1388          this.detailsTarget = new OperationOutcome(); // aa
1389      return this.detailsTarget;
1390    }
1391
1392    /**
1393     * @param value {@link #details} The actual object that is the target of the
1394     *              reference. The reference library doesn't use these, but you can
1395     *              use it to hold the resource if you resolve it. (Full details of
1396     *              any issues found in the message.)
1397     */
1398    public MessageHeaderResponseComponent setDetailsTarget(OperationOutcome value) {
1399      this.detailsTarget = value;
1400      return this;
1401    }
1402
1403    protected void listChildren(List<Property> children) {
1404      super.listChildren(children);
1405      children.add(new Property("identifier", "id",
1406          "The MessageHeader.id of the message to which this message is a response.", 0, 1, identifier));
1407      children.add(new Property("code", "code",
1408          "Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.",
1409          0, 1, code));
1410      children.add(new Property("details", "Reference(OperationOutcome)",
1411          "Full details of any issues found in the message.", 0, 1, details));
1412    }
1413
1414    @Override
1415    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1416      switch (_hash) {
1417      case -1618432855:
1418        /* identifier */ return new Property("identifier", "id",
1419            "The MessageHeader.id of the message to which this message is a response.", 0, 1, identifier);
1420      case 3059181:
1421        /* code */ return new Property("code", "code",
1422            "Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.",
1423            0, 1, code);
1424      case 1557721666:
1425        /* details */ return new Property("details", "Reference(OperationOutcome)",
1426            "Full details of any issues found in the message.", 0, 1, details);
1427      default:
1428        return super.getNamedProperty(_hash, _name, _checkValid);
1429      }
1430
1431    }
1432
1433    @Override
1434    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1435      switch (hash) {
1436      case -1618432855:
1437        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // IdType
1438      case 3059181:
1439        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // Enumeration<ResponseType>
1440      case 1557721666:
1441        /* details */ return this.details == null ? new Base[0] : new Base[] { this.details }; // Reference
1442      default:
1443        return super.getProperty(hash, name, checkValid);
1444      }
1445
1446    }
1447
1448    @Override
1449    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1450      switch (hash) {
1451      case -1618432855: // identifier
1452        this.identifier = castToId(value); // IdType
1453        return value;
1454      case 3059181: // code
1455        value = new ResponseTypeEnumFactory().fromType(castToCode(value));
1456        this.code = (Enumeration) value; // Enumeration<ResponseType>
1457        return value;
1458      case 1557721666: // details
1459        this.details = castToReference(value); // Reference
1460        return value;
1461      default:
1462        return super.setProperty(hash, name, value);
1463      }
1464
1465    }
1466
1467    @Override
1468    public Base setProperty(String name, Base value) throws FHIRException {
1469      if (name.equals("identifier")) {
1470        this.identifier = castToId(value); // IdType
1471      } else if (name.equals("code")) {
1472        value = new ResponseTypeEnumFactory().fromType(castToCode(value));
1473        this.code = (Enumeration) value; // Enumeration<ResponseType>
1474      } else if (name.equals("details")) {
1475        this.details = castToReference(value); // Reference
1476      } else
1477        return super.setProperty(name, value);
1478      return value;
1479    }
1480
1481  @Override
1482  public void removeChild(String name, Base value) throws FHIRException {
1483      if (name.equals("identifier")) {
1484        this.identifier = null;
1485      } else if (name.equals("code")) {
1486        this.code = null;
1487      } else if (name.equals("details")) {
1488        this.details = null;
1489      } else
1490        super.removeChild(name, value);
1491      
1492    }
1493
1494    @Override
1495    public Base makeProperty(int hash, String name) throws FHIRException {
1496      switch (hash) {
1497      case -1618432855:
1498        return getIdentifierElement();
1499      case 3059181:
1500        return getCodeElement();
1501      case 1557721666:
1502        return getDetails();
1503      default:
1504        return super.makeProperty(hash, name);
1505      }
1506
1507    }
1508
1509    @Override
1510    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1511      switch (hash) {
1512      case -1618432855:
1513        /* identifier */ return new String[] { "id" };
1514      case 3059181:
1515        /* code */ return new String[] { "code" };
1516      case 1557721666:
1517        /* details */ return new String[] { "Reference" };
1518      default:
1519        return super.getTypesForProperty(hash, name);
1520      }
1521
1522    }
1523
1524    @Override
1525    public Base addChild(String name) throws FHIRException {
1526      if (name.equals("identifier")) {
1527        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.identifier");
1528      } else if (name.equals("code")) {
1529        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.code");
1530      } else if (name.equals("details")) {
1531        this.details = new Reference();
1532        return this.details;
1533      } else
1534        return super.addChild(name);
1535    }
1536
1537    public MessageHeaderResponseComponent copy() {
1538      MessageHeaderResponseComponent dst = new MessageHeaderResponseComponent();
1539      copyValues(dst);
1540      return dst;
1541    }
1542
1543    public void copyValues(MessageHeaderResponseComponent dst) {
1544      super.copyValues(dst);
1545      dst.identifier = identifier == null ? null : identifier.copy();
1546      dst.code = code == null ? null : code.copy();
1547      dst.details = details == null ? null : details.copy();
1548    }
1549
1550    @Override
1551    public boolean equalsDeep(Base other_) {
1552      if (!super.equalsDeep(other_))
1553        return false;
1554      if (!(other_ instanceof MessageHeaderResponseComponent))
1555        return false;
1556      MessageHeaderResponseComponent o = (MessageHeaderResponseComponent) other_;
1557      return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true)
1558          && compareDeep(details, o.details, true);
1559    }
1560
1561    @Override
1562    public boolean equalsShallow(Base other_) {
1563      if (!super.equalsShallow(other_))
1564        return false;
1565      if (!(other_ instanceof MessageHeaderResponseComponent))
1566        return false;
1567      MessageHeaderResponseComponent o = (MessageHeaderResponseComponent) other_;
1568      return compareValues(identifier, o.identifier, true) && compareValues(code, o.code, true);
1569    }
1570
1571    public boolean isEmpty() {
1572      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, code, details);
1573    }
1574
1575    public String fhirType() {
1576      return "MessageHeader.response";
1577
1578    }
1579
1580  }
1581
1582  /**
1583   * Code that identifies the event this message represents and connects it with
1584   * its definition. Events defined as part of the FHIR specification have the
1585   * system value "http://terminology.hl7.org/CodeSystem/message-events".
1586   * Alternatively uri to the EventDefinition.
1587   */
1588  @Child(name = "event", type = { Coding.class,
1589      UriType.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
1590  @Description(shortDefinition = "Code for the event this message represents or link to event definition", formalDefinition = "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://terminology.hl7.org/CodeSystem/message-events\".  Alternatively uri to the EventDefinition.")
1591  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/message-events")
1592  protected Type event;
1593
1594  /**
1595   * The destination application which the message is intended for.
1596   */
1597  @Child(name = "destination", type = {}, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1598  @Description(shortDefinition = "Message destination application(s)", formalDefinition = "The destination application which the message is intended for.")
1599  protected List<MessageDestinationComponent> destination;
1600
1601  /**
1602   * Identifies the sending system to allow the use of a trust relationship.
1603   */
1604  @Child(name = "sender", type = { Practitioner.class, PractitionerRole.class,
1605      Organization.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
1606  @Description(shortDefinition = "Real world sender of the message", formalDefinition = "Identifies the sending system to allow the use of a trust relationship.")
1607  protected Reference sender;
1608
1609  /**
1610   * The actual object that is the target of the reference (Identifies the sending
1611   * system to allow the use of a trust relationship.)
1612   */
1613  protected Resource senderTarget;
1614
1615  /**
1616   * The person or device that performed the data entry leading to this message.
1617   * When there is more than one candidate, pick the most proximal to the message.
1618   * Can provide other enterers in extensions.
1619   */
1620  @Child(name = "enterer", type = { Practitioner.class,
1621      PractitionerRole.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
1622  @Description(shortDefinition = "The source of the data entry", formalDefinition = "The person or device that performed the data entry leading to this message. When there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.")
1623  protected Reference enterer;
1624
1625  /**
1626   * The actual object that is the target of the reference (The person or device
1627   * that performed the data entry leading to this message. When there is more
1628   * than one candidate, pick the most proximal to the message. Can provide other
1629   * enterers in extensions.)
1630   */
1631  protected Resource entererTarget;
1632
1633  /**
1634   * The logical author of the message - the person or device that decided the
1635   * described event should happen. When there is more than one candidate, pick
1636   * the most proximal to the MessageHeader. Can provide other authors in
1637   * extensions.
1638   */
1639  @Child(name = "author", type = { Practitioner.class,
1640      PractitionerRole.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
1641  @Description(shortDefinition = "The source of the decision", formalDefinition = "The logical author of the message - the person or device that decided the described event should happen. When there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.")
1642  protected Reference author;
1643
1644  /**
1645   * The actual object that is the target of the reference (The logical author of
1646   * the message - the person or device that decided the described event should
1647   * happen. When there is more than one candidate, pick the most proximal to the
1648   * MessageHeader. Can provide other authors in extensions.)
1649   */
1650  protected Resource authorTarget;
1651
1652  /**
1653   * The source application from which this message originated.
1654   */
1655  @Child(name = "source", type = {}, order = 5, min = 1, max = 1, modifier = false, summary = true)
1656  @Description(shortDefinition = "Message source application", formalDefinition = "The source application from which this message originated.")
1657  protected MessageSourceComponent source;
1658
1659  /**
1660   * The person or organization that accepts overall responsibility for the
1661   * contents of the message. The implication is that the message event happened
1662   * under the policies of the responsible party.
1663   */
1664  @Child(name = "responsible", type = { Practitioner.class, PractitionerRole.class,
1665      Organization.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1666  @Description(shortDefinition = "Final responsibility for event", formalDefinition = "The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.")
1667  protected Reference responsible;
1668
1669  /**
1670   * The actual object that is the target of the reference (The person or
1671   * organization that accepts overall responsibility for the contents of the
1672   * message. The implication is that the message event happened under the
1673   * policies of the responsible party.)
1674   */
1675  protected Resource responsibleTarget;
1676
1677  /**
1678   * Coded indication of the cause for the event - indicates a reason for the
1679   * occurrence of the event that is a focus of this message.
1680   */
1681  @Child(name = "reason", type = {
1682      CodeableConcept.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1683  @Description(shortDefinition = "Cause of event", formalDefinition = "Coded indication of the cause for the event - indicates  a reason for the occurrence of the event that is a focus of this message.")
1684  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/message-reason-encounter")
1685  protected CodeableConcept reason;
1686
1687  /**
1688   * Information about the message that this message is a response to. Only
1689   * present if this message is a response.
1690   */
1691  @Child(name = "response", type = {}, order = 8, min = 0, max = 1, modifier = false, summary = true)
1692  @Description(shortDefinition = "If this is a reply to prior message", formalDefinition = "Information about the message that this message is a response to.  Only present if this message is a response.")
1693  protected MessageHeaderResponseComponent response;
1694
1695  /**
1696   * The actual data of the message - a reference to the root/focus class of the
1697   * event.
1698   */
1699  @Child(name = "focus", type = {
1700      Reference.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1701  @Description(shortDefinition = "The actual content of the message", formalDefinition = "The actual data of the message - a reference to the root/focus class of the event.")
1702  protected List<Reference> focus;
1703  /**
1704   * The actual objects that are the target of the reference (The actual data of
1705   * the message - a reference to the root/focus class of the event.)
1706   */
1707  protected List<Resource> focusTarget;
1708
1709  /**
1710   * Permanent link to the MessageDefinition for this message.
1711   */
1712  @Child(name = "definition", type = {
1713      CanonicalType.class }, order = 10, min = 0, max = 1, modifier = false, summary = true)
1714  @Description(shortDefinition = "Link to the definition for this message", formalDefinition = "Permanent link to the MessageDefinition for this message.")
1715  protected CanonicalType definition;
1716
1717  private static final long serialVersionUID = -1039408819L;
1718
1719  /**
1720   * Constructor
1721   */
1722  public MessageHeader() {
1723    super();
1724  }
1725
1726  /**
1727   * Constructor
1728   */
1729  public MessageHeader(Type event, MessageSourceComponent source) {
1730    super();
1731    this.event = event;
1732    this.source = source;
1733  }
1734
1735  /**
1736   * @return {@link #event} (Code that identifies the event this message
1737   *         represents and connects it with its definition. Events defined as
1738   *         part of the FHIR specification have the system value
1739   *         "http://terminology.hl7.org/CodeSystem/message-events". Alternatively
1740   *         uri to the EventDefinition.)
1741   */
1742  public Type getEvent() {
1743    return this.event;
1744  }
1745
1746  /**
1747   * @return {@link #event} (Code that identifies the event this message
1748   *         represents and connects it with its definition. Events defined as
1749   *         part of the FHIR specification have the system value
1750   *         "http://terminology.hl7.org/CodeSystem/message-events". Alternatively
1751   *         uri to the EventDefinition.)
1752   */
1753  public Coding getEventCoding() throws FHIRException {
1754    if (this.event == null)
1755      this.event = new Coding();
1756    if (!(this.event instanceof Coding))
1757      throw new FHIRException(
1758          "Type mismatch: the type Coding was expected, but " + this.event.getClass().getName() + " was encountered");
1759    return (Coding) this.event;
1760  }
1761
1762  public boolean hasEventCoding() {
1763    return this != null && this.event instanceof Coding;
1764  }
1765
1766  /**
1767   * @return {@link #event} (Code that identifies the event this message
1768   *         represents and connects it with its definition. Events defined as
1769   *         part of the FHIR specification have the system value
1770   *         "http://terminology.hl7.org/CodeSystem/message-events". Alternatively
1771   *         uri to the EventDefinition.)
1772   */
1773  public UriType getEventUriType() throws FHIRException {
1774    if (this.event == null)
1775      this.event = new UriType();
1776    if (!(this.event instanceof UriType))
1777      throw new FHIRException(
1778          "Type mismatch: the type UriType was expected, but " + this.event.getClass().getName() + " was encountered");
1779    return (UriType) this.event;
1780  }
1781
1782  public boolean hasEventUriType() {
1783    return this != null && this.event instanceof UriType;
1784  }
1785
1786  public boolean hasEvent() {
1787    return this.event != null && !this.event.isEmpty();
1788  }
1789
1790  /**
1791   * @param value {@link #event} (Code that identifies the event this message
1792   *              represents and connects it with its definition. Events defined
1793   *              as part of the FHIR specification have the system value
1794   *              "http://terminology.hl7.org/CodeSystem/message-events".
1795   *              Alternatively uri to the EventDefinition.)
1796   */
1797  public MessageHeader setEvent(Type value) {
1798    if (value != null && !(value instanceof Coding || value instanceof UriType))
1799      throw new Error("Not the right type for MessageHeader.event[x]: " + value.fhirType());
1800    this.event = value;
1801    return this;
1802  }
1803
1804  /**
1805   * @return {@link #destination} (The destination application which the message
1806   *         is intended for.)
1807   */
1808  public List<MessageDestinationComponent> getDestination() {
1809    if (this.destination == null)
1810      this.destination = new ArrayList<MessageDestinationComponent>();
1811    return this.destination;
1812  }
1813
1814  /**
1815   * @return Returns a reference to <code>this</code> for easy method chaining
1816   */
1817  public MessageHeader setDestination(List<MessageDestinationComponent> theDestination) {
1818    this.destination = theDestination;
1819    return this;
1820  }
1821
1822  public boolean hasDestination() {
1823    if (this.destination == null)
1824      return false;
1825    for (MessageDestinationComponent item : this.destination)
1826      if (!item.isEmpty())
1827        return true;
1828    return false;
1829  }
1830
1831  public MessageDestinationComponent addDestination() { // 3
1832    MessageDestinationComponent t = new MessageDestinationComponent();
1833    if (this.destination == null)
1834      this.destination = new ArrayList<MessageDestinationComponent>();
1835    this.destination.add(t);
1836    return t;
1837  }
1838
1839  public MessageHeader addDestination(MessageDestinationComponent t) { // 3
1840    if (t == null)
1841      return this;
1842    if (this.destination == null)
1843      this.destination = new ArrayList<MessageDestinationComponent>();
1844    this.destination.add(t);
1845    return this;
1846  }
1847
1848  /**
1849   * @return The first repetition of repeating field {@link #destination},
1850   *         creating it if it does not already exist
1851   */
1852  public MessageDestinationComponent getDestinationFirstRep() {
1853    if (getDestination().isEmpty()) {
1854      addDestination();
1855    }
1856    return getDestination().get(0);
1857  }
1858
1859  /**
1860   * @return {@link #sender} (Identifies the sending system to allow the use of a
1861   *         trust relationship.)
1862   */
1863  public Reference getSender() {
1864    if (this.sender == null)
1865      if (Configuration.errorOnAutoCreate())
1866        throw new Error("Attempt to auto-create MessageHeader.sender");
1867      else if (Configuration.doAutoCreate())
1868        this.sender = new Reference(); // cc
1869    return this.sender;
1870  }
1871
1872  public boolean hasSender() {
1873    return this.sender != null && !this.sender.isEmpty();
1874  }
1875
1876  /**
1877   * @param value {@link #sender} (Identifies the sending system to allow the use
1878   *              of a trust relationship.)
1879   */
1880  public MessageHeader setSender(Reference value) {
1881    this.sender = value;
1882    return this;
1883  }
1884
1885  /**
1886   * @return {@link #sender} The actual object that is the target of the
1887   *         reference. The reference library doesn't populate this, but you can
1888   *         use it to hold the resource if you resolve it. (Identifies the
1889   *         sending system to allow the use of a trust relationship.)
1890   */
1891  public Resource getSenderTarget() {
1892    return this.senderTarget;
1893  }
1894
1895  /**
1896   * @param value {@link #sender} The actual object that is the target of the
1897   *              reference. The reference library doesn't use these, but you can
1898   *              use it to hold the resource if you resolve it. (Identifies the
1899   *              sending system to allow the use of a trust relationship.)
1900   */
1901  public MessageHeader setSenderTarget(Resource value) {
1902    this.senderTarget = value;
1903    return this;
1904  }
1905
1906  /**
1907   * @return {@link #enterer} (The person or device that performed the data entry
1908   *         leading to this message. When there is more than one candidate, pick
1909   *         the most proximal to the message. Can provide other enterers in
1910   *         extensions.)
1911   */
1912  public Reference getEnterer() {
1913    if (this.enterer == null)
1914      if (Configuration.errorOnAutoCreate())
1915        throw new Error("Attempt to auto-create MessageHeader.enterer");
1916      else if (Configuration.doAutoCreate())
1917        this.enterer = new Reference(); // cc
1918    return this.enterer;
1919  }
1920
1921  public boolean hasEnterer() {
1922    return this.enterer != null && !this.enterer.isEmpty();
1923  }
1924
1925  /**
1926   * @param value {@link #enterer} (The person or device that performed the data
1927   *              entry leading to this message. When there is more than one
1928   *              candidate, pick the most proximal to the message. Can provide
1929   *              other enterers in extensions.)
1930   */
1931  public MessageHeader setEnterer(Reference value) {
1932    this.enterer = value;
1933    return this;
1934  }
1935
1936  /**
1937   * @return {@link #enterer} The actual object that is the target of the
1938   *         reference. The reference library doesn't populate this, but you can
1939   *         use it to hold the resource if you resolve it. (The person or device
1940   *         that performed the data entry leading to this message. When there is
1941   *         more than one candidate, pick the most proximal to the message. Can
1942   *         provide other enterers in extensions.)
1943   */
1944  public Resource getEntererTarget() {
1945    return this.entererTarget;
1946  }
1947
1948  /**
1949   * @param value {@link #enterer} The actual object that is the target of the
1950   *              reference. The reference library doesn't use these, but you can
1951   *              use it to hold the resource if you resolve it. (The person or
1952   *              device that performed the data entry leading to this message.
1953   *              When there is more than one candidate, pick the most proximal to
1954   *              the message. Can provide other enterers in extensions.)
1955   */
1956  public MessageHeader setEntererTarget(Resource value) {
1957    this.entererTarget = value;
1958    return this;
1959  }
1960
1961  /**
1962   * @return {@link #author} (The logical author of the message - the person or
1963   *         device that decided the described event should happen. When there is
1964   *         more than one candidate, pick the most proximal to the MessageHeader.
1965   *         Can provide other authors in extensions.)
1966   */
1967  public Reference getAuthor() {
1968    if (this.author == null)
1969      if (Configuration.errorOnAutoCreate())
1970        throw new Error("Attempt to auto-create MessageHeader.author");
1971      else if (Configuration.doAutoCreate())
1972        this.author = new Reference(); // cc
1973    return this.author;
1974  }
1975
1976  public boolean hasAuthor() {
1977    return this.author != null && !this.author.isEmpty();
1978  }
1979
1980  /**
1981   * @param value {@link #author} (The logical author of the message - the person
1982   *              or device that decided the described event should happen. When
1983   *              there is more than one candidate, pick the most proximal to the
1984   *              MessageHeader. Can provide other authors in extensions.)
1985   */
1986  public MessageHeader setAuthor(Reference value) {
1987    this.author = value;
1988    return this;
1989  }
1990
1991  /**
1992   * @return {@link #author} The actual object that is the target of the
1993   *         reference. The reference library doesn't populate this, but you can
1994   *         use it to hold the resource if you resolve it. (The logical author of
1995   *         the message - the person or device that decided the described event
1996   *         should happen. When there is more than one candidate, pick the most
1997   *         proximal to the MessageHeader. Can provide other authors in
1998   *         extensions.)
1999   */
2000  public Resource getAuthorTarget() {
2001    return this.authorTarget;
2002  }
2003
2004  /**
2005   * @param value {@link #author} The actual object that is the target of the
2006   *              reference. The reference library doesn't use these, but you can
2007   *              use it to hold the resource if you resolve it. (The logical
2008   *              author of the message - the person or device that decided the
2009   *              described event should happen. When there is more than one
2010   *              candidate, pick the most proximal to the MessageHeader. Can
2011   *              provide other authors in extensions.)
2012   */
2013  public MessageHeader setAuthorTarget(Resource value) {
2014    this.authorTarget = value;
2015    return this;
2016  }
2017
2018  /**
2019   * @return {@link #source} (The source application from which this message
2020   *         originated.)
2021   */
2022  public MessageSourceComponent getSource() {
2023    if (this.source == null)
2024      if (Configuration.errorOnAutoCreate())
2025        throw new Error("Attempt to auto-create MessageHeader.source");
2026      else if (Configuration.doAutoCreate())
2027        this.source = new MessageSourceComponent(); // cc
2028    return this.source;
2029  }
2030
2031  public boolean hasSource() {
2032    return this.source != null && !this.source.isEmpty();
2033  }
2034
2035  /**
2036   * @param value {@link #source} (The source application from which this message
2037   *              originated.)
2038   */
2039  public MessageHeader setSource(MessageSourceComponent value) {
2040    this.source = value;
2041    return this;
2042  }
2043
2044  /**
2045   * @return {@link #responsible} (The person or organization that accepts overall
2046   *         responsibility for the contents of the message. The implication is
2047   *         that the message event happened under the policies of the responsible
2048   *         party.)
2049   */
2050  public Reference getResponsible() {
2051    if (this.responsible == null)
2052      if (Configuration.errorOnAutoCreate())
2053        throw new Error("Attempt to auto-create MessageHeader.responsible");
2054      else if (Configuration.doAutoCreate())
2055        this.responsible = new Reference(); // cc
2056    return this.responsible;
2057  }
2058
2059  public boolean hasResponsible() {
2060    return this.responsible != null && !this.responsible.isEmpty();
2061  }
2062
2063  /**
2064   * @param value {@link #responsible} (The person or organization that accepts
2065   *              overall responsibility for the contents of the message. The
2066   *              implication is that the message event happened under the
2067   *              policies of the responsible party.)
2068   */
2069  public MessageHeader setResponsible(Reference value) {
2070    this.responsible = value;
2071    return this;
2072  }
2073
2074  /**
2075   * @return {@link #responsible} The actual object that is the target of the
2076   *         reference. The reference library doesn't populate this, but you can
2077   *         use it to hold the resource if you resolve it. (The person or
2078   *         organization that accepts overall responsibility for the contents of
2079   *         the message. The implication is that the message event happened under
2080   *         the policies of the responsible party.)
2081   */
2082  public Resource getResponsibleTarget() {
2083    return this.responsibleTarget;
2084  }
2085
2086  /**
2087   * @param value {@link #responsible} The actual object that is the target of the
2088   *              reference. The reference library doesn't use these, but you can
2089   *              use it to hold the resource if you resolve it. (The person or
2090   *              organization that accepts overall responsibility for the
2091   *              contents of the message. The implication is that the message
2092   *              event happened under the policies of the responsible party.)
2093   */
2094  public MessageHeader setResponsibleTarget(Resource value) {
2095    this.responsibleTarget = value;
2096    return this;
2097  }
2098
2099  /**
2100   * @return {@link #reason} (Coded indication of the cause for the event -
2101   *         indicates a reason for the occurrence of the event that is a focus of
2102   *         this message.)
2103   */
2104  public CodeableConcept getReason() {
2105    if (this.reason == null)
2106      if (Configuration.errorOnAutoCreate())
2107        throw new Error("Attempt to auto-create MessageHeader.reason");
2108      else if (Configuration.doAutoCreate())
2109        this.reason = new CodeableConcept(); // cc
2110    return this.reason;
2111  }
2112
2113  public boolean hasReason() {
2114    return this.reason != null && !this.reason.isEmpty();
2115  }
2116
2117  /**
2118   * @param value {@link #reason} (Coded indication of the cause for the event -
2119   *              indicates a reason for the occurrence of the event that is a
2120   *              focus of this message.)
2121   */
2122  public MessageHeader setReason(CodeableConcept value) {
2123    this.reason = value;
2124    return this;
2125  }
2126
2127  /**
2128   * @return {@link #response} (Information about the message that this message is
2129   *         a response to. Only present if this message is a response.)
2130   */
2131  public MessageHeaderResponseComponent getResponse() {
2132    if (this.response == null)
2133      if (Configuration.errorOnAutoCreate())
2134        throw new Error("Attempt to auto-create MessageHeader.response");
2135      else if (Configuration.doAutoCreate())
2136        this.response = new MessageHeaderResponseComponent(); // cc
2137    return this.response;
2138  }
2139
2140  public boolean hasResponse() {
2141    return this.response != null && !this.response.isEmpty();
2142  }
2143
2144  /**
2145   * @param value {@link #response} (Information about the message that this
2146   *              message is a response to. Only present if this message is a
2147   *              response.)
2148   */
2149  public MessageHeader setResponse(MessageHeaderResponseComponent value) {
2150    this.response = value;
2151    return this;
2152  }
2153
2154  /**
2155   * @return {@link #focus} (The actual data of the message - a reference to the
2156   *         root/focus class of the event.)
2157   */
2158  public List<Reference> getFocus() {
2159    if (this.focus == null)
2160      this.focus = new ArrayList<Reference>();
2161    return this.focus;
2162  }
2163
2164  /**
2165   * @return Returns a reference to <code>this</code> for easy method chaining
2166   */
2167  public MessageHeader setFocus(List<Reference> theFocus) {
2168    this.focus = theFocus;
2169    return this;
2170  }
2171
2172  public boolean hasFocus() {
2173    if (this.focus == null)
2174      return false;
2175    for (Reference item : this.focus)
2176      if (!item.isEmpty())
2177        return true;
2178    return false;
2179  }
2180
2181  public Reference addFocus() { // 3
2182    Reference t = new Reference();
2183    if (this.focus == null)
2184      this.focus = new ArrayList<Reference>();
2185    this.focus.add(t);
2186    return t;
2187  }
2188
2189  public MessageHeader addFocus(Reference t) { // 3
2190    if (t == null)
2191      return this;
2192    if (this.focus == null)
2193      this.focus = new ArrayList<Reference>();
2194    this.focus.add(t);
2195    return this;
2196  }
2197
2198  /**
2199   * @return The first repetition of repeating field {@link #focus}, creating it
2200   *         if it does not already exist
2201   */
2202  public Reference getFocusFirstRep() {
2203    if (getFocus().isEmpty()) {
2204      addFocus();
2205    }
2206    return getFocus().get(0);
2207  }
2208
2209  /**
2210   * @deprecated Use Reference#setResource(IBaseResource) instead
2211   */
2212  @Deprecated
2213  public List<Resource> getFocusTarget() {
2214    if (this.focusTarget == null)
2215      this.focusTarget = new ArrayList<Resource>();
2216    return this.focusTarget;
2217  }
2218
2219  /**
2220   * @return {@link #definition} (Permanent link to the MessageDefinition for this
2221   *         message.). This is the underlying object with id, value and
2222   *         extensions. The accessor "getDefinition" gives direct access to the
2223   *         value
2224   */
2225  public CanonicalType getDefinitionElement() {
2226    if (this.definition == null)
2227      if (Configuration.errorOnAutoCreate())
2228        throw new Error("Attempt to auto-create MessageHeader.definition");
2229      else if (Configuration.doAutoCreate())
2230        this.definition = new CanonicalType(); // bb
2231    return this.definition;
2232  }
2233
2234  public boolean hasDefinitionElement() {
2235    return this.definition != null && !this.definition.isEmpty();
2236  }
2237
2238  public boolean hasDefinition() {
2239    return this.definition != null && !this.definition.isEmpty();
2240  }
2241
2242  /**
2243   * @param value {@link #definition} (Permanent link to the MessageDefinition for
2244   *              this message.). This is the underlying object with id, value and
2245   *              extensions. The accessor "getDefinition" gives direct access to
2246   *              the value
2247   */
2248  public MessageHeader setDefinitionElement(CanonicalType value) {
2249    this.definition = value;
2250    return this;
2251  }
2252
2253  /**
2254   * @return Permanent link to the MessageDefinition for this message.
2255   */
2256  public String getDefinition() {
2257    return this.definition == null ? null : this.definition.getValue();
2258  }
2259
2260  /**
2261   * @param value Permanent link to the MessageDefinition for this message.
2262   */
2263  public MessageHeader setDefinition(String value) {
2264    if (Utilities.noString(value))
2265      this.definition = null;
2266    else {
2267      if (this.definition == null)
2268        this.definition = new CanonicalType();
2269      this.definition.setValue(value);
2270    }
2271    return this;
2272  }
2273
2274  protected void listChildren(List<Property> children) {
2275    super.listChildren(children);
2276    children.add(new Property("event[x]", "Coding|uri",
2277        "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://terminology.hl7.org/CodeSystem/message-events\".  Alternatively uri to the EventDefinition.",
2278        0, 1, event));
2279    children.add(new Property("destination", "", "The destination application which the message is intended for.", 0,
2280        java.lang.Integer.MAX_VALUE, destination));
2281    children.add(new Property("sender", "Reference(Practitioner|PractitionerRole|Organization)",
2282        "Identifies the sending system to allow the use of a trust relationship.", 0, 1, sender));
2283    children.add(new Property("enterer", "Reference(Practitioner|PractitionerRole)",
2284        "The person or device that performed the data entry leading to this message. When there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.",
2285        0, 1, enterer));
2286    children.add(new Property("author", "Reference(Practitioner|PractitionerRole)",
2287        "The logical author of the message - the person or device that decided the described event should happen. When there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.",
2288        0, 1, author));
2289    children
2290        .add(new Property("source", "", "The source application from which this message originated.", 0, 1, source));
2291    children.add(new Property("responsible", "Reference(Practitioner|PractitionerRole|Organization)",
2292        "The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.",
2293        0, 1, responsible));
2294    children.add(new Property("reason", "CodeableConcept",
2295        "Coded indication of the cause for the event - indicates  a reason for the occurrence of the event that is a focus of this message.",
2296        0, 1, reason));
2297    children.add(new Property("response", "",
2298        "Information about the message that this message is a response to.  Only present if this message is a response.",
2299        0, 1, response));
2300    children.add(new Property("focus", "Reference(Any)",
2301        "The actual data of the message - a reference to the root/focus class of the event.", 0,
2302        java.lang.Integer.MAX_VALUE, focus));
2303    children.add(new Property("definition", "canonical(MessageDefinition)",
2304        "Permanent link to the MessageDefinition for this message.", 0, 1, definition));
2305  }
2306
2307  @Override
2308  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2309    switch (_hash) {
2310    case 278115238:
2311      /* event[x] */ return new Property("event[x]", "Coding|uri",
2312          "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://terminology.hl7.org/CodeSystem/message-events\".  Alternatively uri to the EventDefinition.",
2313          0, 1, event);
2314    case 96891546:
2315      /* event */ return new Property("event[x]", "Coding|uri",
2316          "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://terminology.hl7.org/CodeSystem/message-events\".  Alternatively uri to the EventDefinition.",
2317          0, 1, event);
2318    case -355957084:
2319      /* eventCoding */ return new Property("event[x]", "Coding|uri",
2320          "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://terminology.hl7.org/CodeSystem/message-events\".  Alternatively uri to the EventDefinition.",
2321          0, 1, event);
2322    case 278109298:
2323      /* eventUri */ return new Property("event[x]", "Coding|uri",
2324          "Code that identifies the event this message represents and connects it with its definition. Events defined as part of the FHIR specification have the system value \"http://terminology.hl7.org/CodeSystem/message-events\".  Alternatively uri to the EventDefinition.",
2325          0, 1, event);
2326    case -1429847026:
2327      /* destination */ return new Property("destination", "",
2328          "The destination application which the message is intended for.", 0, java.lang.Integer.MAX_VALUE,
2329          destination);
2330    case -905962955:
2331      /* sender */ return new Property("sender", "Reference(Practitioner|PractitionerRole|Organization)",
2332          "Identifies the sending system to allow the use of a trust relationship.", 0, 1, sender);
2333    case -1591951995:
2334      /* enterer */ return new Property("enterer", "Reference(Practitioner|PractitionerRole)",
2335          "The person or device that performed the data entry leading to this message. When there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.",
2336          0, 1, enterer);
2337    case -1406328437:
2338      /* author */ return new Property("author", "Reference(Practitioner|PractitionerRole)",
2339          "The logical author of the message - the person or device that decided the described event should happen. When there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.",
2340          0, 1, author);
2341    case -896505829:
2342      /* source */ return new Property("source", "", "The source application from which this message originated.", 0, 1,
2343          source);
2344    case 1847674614:
2345      /* responsible */ return new Property("responsible", "Reference(Practitioner|PractitionerRole|Organization)",
2346          "The person or organization that accepts overall responsibility for the contents of the message. The implication is that the message event happened under the policies of the responsible party.",
2347          0, 1, responsible);
2348    case -934964668:
2349      /* reason */ return new Property("reason", "CodeableConcept",
2350          "Coded indication of the cause for the event - indicates  a reason for the occurrence of the event that is a focus of this message.",
2351          0, 1, reason);
2352    case -340323263:
2353      /* response */ return new Property("response", "",
2354          "Information about the message that this message is a response to.  Only present if this message is a response.",
2355          0, 1, response);
2356    case 97604824:
2357      /* focus */ return new Property("focus", "Reference(Any)",
2358          "The actual data of the message - a reference to the root/focus class of the event.", 0,
2359          java.lang.Integer.MAX_VALUE, focus);
2360    case -1014418093:
2361      /* definition */ return new Property("definition", "canonical(MessageDefinition)",
2362          "Permanent link to the MessageDefinition for this message.", 0, 1, definition);
2363    default:
2364      return super.getNamedProperty(_hash, _name, _checkValid);
2365    }
2366
2367  }
2368
2369  @Override
2370  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2371    switch (hash) {
2372    case 96891546:
2373      /* event */ return this.event == null ? new Base[0] : new Base[] { this.event }; // Type
2374    case -1429847026:
2375      /* destination */ return this.destination == null ? new Base[0]
2376          : this.destination.toArray(new Base[this.destination.size()]); // MessageDestinationComponent
2377    case -905962955:
2378      /* sender */ return this.sender == null ? new Base[0] : new Base[] { this.sender }; // Reference
2379    case -1591951995:
2380      /* enterer */ return this.enterer == null ? new Base[0] : new Base[] { this.enterer }; // Reference
2381    case -1406328437:
2382      /* author */ return this.author == null ? new Base[0] : new Base[] { this.author }; // Reference
2383    case -896505829:
2384      /* source */ return this.source == null ? new Base[0] : new Base[] { this.source }; // MessageSourceComponent
2385    case 1847674614:
2386      /* responsible */ return this.responsible == null ? new Base[0] : new Base[] { this.responsible }; // Reference
2387    case -934964668:
2388      /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
2389    case -340323263:
2390      /* response */ return this.response == null ? new Base[0] : new Base[] { this.response }; // MessageHeaderResponseComponent
2391    case 97604824:
2392      /* focus */ return this.focus == null ? new Base[0] : this.focus.toArray(new Base[this.focus.size()]); // Reference
2393    case -1014418093:
2394      /* definition */ return this.definition == null ? new Base[0] : new Base[] { this.definition }; // CanonicalType
2395    default:
2396      return super.getProperty(hash, name, checkValid);
2397    }
2398
2399  }
2400
2401  @Override
2402  public Base setProperty(int hash, String name, Base value) throws FHIRException {
2403    switch (hash) {
2404    case 96891546: // event
2405      this.event = castToType(value); // Type
2406      return value;
2407    case -1429847026: // destination
2408      this.getDestination().add((MessageDestinationComponent) value); // MessageDestinationComponent
2409      return value;
2410    case -905962955: // sender
2411      this.sender = castToReference(value); // Reference
2412      return value;
2413    case -1591951995: // enterer
2414      this.enterer = castToReference(value); // Reference
2415      return value;
2416    case -1406328437: // author
2417      this.author = castToReference(value); // Reference
2418      return value;
2419    case -896505829: // source
2420      this.source = (MessageSourceComponent) value; // MessageSourceComponent
2421      return value;
2422    case 1847674614: // responsible
2423      this.responsible = castToReference(value); // Reference
2424      return value;
2425    case -934964668: // reason
2426      this.reason = castToCodeableConcept(value); // CodeableConcept
2427      return value;
2428    case -340323263: // response
2429      this.response = (MessageHeaderResponseComponent) value; // MessageHeaderResponseComponent
2430      return value;
2431    case 97604824: // focus
2432      this.getFocus().add(castToReference(value)); // Reference
2433      return value;
2434    case -1014418093: // definition
2435      this.definition = castToCanonical(value); // CanonicalType
2436      return value;
2437    default:
2438      return super.setProperty(hash, name, value);
2439    }
2440
2441  }
2442
2443  @Override
2444  public Base setProperty(String name, Base value) throws FHIRException {
2445    if (name.equals("event[x]")) {
2446      this.event = castToType(value); // Type
2447    } else if (name.equals("destination")) {
2448      this.getDestination().add((MessageDestinationComponent) value);
2449    } else if (name.equals("sender")) {
2450      this.sender = castToReference(value); // Reference
2451    } else if (name.equals("enterer")) {
2452      this.enterer = castToReference(value); // Reference
2453    } else if (name.equals("author")) {
2454      this.author = castToReference(value); // Reference
2455    } else if (name.equals("source")) {
2456      this.source = (MessageSourceComponent) value; // MessageSourceComponent
2457    } else if (name.equals("responsible")) {
2458      this.responsible = castToReference(value); // Reference
2459    } else if (name.equals("reason")) {
2460      this.reason = castToCodeableConcept(value); // CodeableConcept
2461    } else if (name.equals("response")) {
2462      this.response = (MessageHeaderResponseComponent) value; // MessageHeaderResponseComponent
2463    } else if (name.equals("focus")) {
2464      this.getFocus().add(castToReference(value));
2465    } else if (name.equals("definition")) {
2466      this.definition = castToCanonical(value); // CanonicalType
2467    } else
2468      return super.setProperty(name, value);
2469    return value;
2470  }
2471
2472  @Override
2473  public void removeChild(String name, Base value) throws FHIRException {
2474    if (name.equals("event[x]")) {
2475      this.event = null;
2476    } else if (name.equals("destination")) {
2477      this.getDestination().remove((MessageDestinationComponent) value);
2478    } else if (name.equals("sender")) {
2479      this.sender = null;
2480    } else if (name.equals("enterer")) {
2481      this.enterer = null;
2482    } else if (name.equals("author")) {
2483      this.author = null;
2484    } else if (name.equals("source")) {
2485      this.source = (MessageSourceComponent) value; // MessageSourceComponent
2486    } else if (name.equals("responsible")) {
2487      this.responsible = null;
2488    } else if (name.equals("reason")) {
2489      this.reason = null;
2490    } else if (name.equals("response")) {
2491      this.response = (MessageHeaderResponseComponent) value; // MessageHeaderResponseComponent
2492    } else if (name.equals("focus")) {
2493      this.getFocus().remove(castToReference(value));
2494    } else if (name.equals("definition")) {
2495      this.definition = null;
2496    } else
2497      super.removeChild(name, value);
2498    
2499  }
2500
2501  @Override
2502  public Base makeProperty(int hash, String name) throws FHIRException {
2503    switch (hash) {
2504    case 278115238:
2505      return getEvent();
2506    case 96891546:
2507      return getEvent();
2508    case -1429847026:
2509      return addDestination();
2510    case -905962955:
2511      return getSender();
2512    case -1591951995:
2513      return getEnterer();
2514    case -1406328437:
2515      return getAuthor();
2516    case -896505829:
2517      return getSource();
2518    case 1847674614:
2519      return getResponsible();
2520    case -934964668:
2521      return getReason();
2522    case -340323263:
2523      return getResponse();
2524    case 97604824:
2525      return addFocus();
2526    case -1014418093:
2527      return getDefinitionElement();
2528    default:
2529      return super.makeProperty(hash, name);
2530    }
2531
2532  }
2533
2534  @Override
2535  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2536    switch (hash) {
2537    case 96891546:
2538      /* event */ return new String[] { "Coding", "uri" };
2539    case -1429847026:
2540      /* destination */ return new String[] {};
2541    case -905962955:
2542      /* sender */ return new String[] { "Reference" };
2543    case -1591951995:
2544      /* enterer */ return new String[] { "Reference" };
2545    case -1406328437:
2546      /* author */ return new String[] { "Reference" };
2547    case -896505829:
2548      /* source */ return new String[] {};
2549    case 1847674614:
2550      /* responsible */ return new String[] { "Reference" };
2551    case -934964668:
2552      /* reason */ return new String[] { "CodeableConcept" };
2553    case -340323263:
2554      /* response */ return new String[] {};
2555    case 97604824:
2556      /* focus */ return new String[] { "Reference" };
2557    case -1014418093:
2558      /* definition */ return new String[] { "canonical" };
2559    default:
2560      return super.getTypesForProperty(hash, name);
2561    }
2562
2563  }
2564
2565  @Override
2566  public Base addChild(String name) throws FHIRException {
2567    if (name.equals("eventCoding")) {
2568      this.event = new Coding();
2569      return this.event;
2570    } else if (name.equals("eventUri")) {
2571      this.event = new UriType();
2572      return this.event;
2573    } else if (name.equals("destination")) {
2574      return addDestination();
2575    } else if (name.equals("sender")) {
2576      this.sender = new Reference();
2577      return this.sender;
2578    } else if (name.equals("enterer")) {
2579      this.enterer = new Reference();
2580      return this.enterer;
2581    } else if (name.equals("author")) {
2582      this.author = new Reference();
2583      return this.author;
2584    } else if (name.equals("source")) {
2585      this.source = new MessageSourceComponent();
2586      return this.source;
2587    } else if (name.equals("responsible")) {
2588      this.responsible = new Reference();
2589      return this.responsible;
2590    } else if (name.equals("reason")) {
2591      this.reason = new CodeableConcept();
2592      return this.reason;
2593    } else if (name.equals("response")) {
2594      this.response = new MessageHeaderResponseComponent();
2595      return this.response;
2596    } else if (name.equals("focus")) {
2597      return addFocus();
2598    } else if (name.equals("definition")) {
2599      throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.definition");
2600    } else
2601      return super.addChild(name);
2602  }
2603
2604  public String fhirType() {
2605    return "MessageHeader";
2606
2607  }
2608
2609  public MessageHeader copy() {
2610    MessageHeader dst = new MessageHeader();
2611    copyValues(dst);
2612    return dst;
2613  }
2614
2615  public void copyValues(MessageHeader dst) {
2616    super.copyValues(dst);
2617    dst.event = event == null ? null : event.copy();
2618    if (destination != null) {
2619      dst.destination = new ArrayList<MessageDestinationComponent>();
2620      for (MessageDestinationComponent i : destination)
2621        dst.destination.add(i.copy());
2622    }
2623    ;
2624    dst.sender = sender == null ? null : sender.copy();
2625    dst.enterer = enterer == null ? null : enterer.copy();
2626    dst.author = author == null ? null : author.copy();
2627    dst.source = source == null ? null : source.copy();
2628    dst.responsible = responsible == null ? null : responsible.copy();
2629    dst.reason = reason == null ? null : reason.copy();
2630    dst.response = response == null ? null : response.copy();
2631    if (focus != null) {
2632      dst.focus = new ArrayList<Reference>();
2633      for (Reference i : focus)
2634        dst.focus.add(i.copy());
2635    }
2636    ;
2637    dst.definition = definition == null ? null : definition.copy();
2638  }
2639
2640  protected MessageHeader typedCopy() {
2641    return copy();
2642  }
2643
2644  @Override
2645  public boolean equalsDeep(Base other_) {
2646    if (!super.equalsDeep(other_))
2647      return false;
2648    if (!(other_ instanceof MessageHeader))
2649      return false;
2650    MessageHeader o = (MessageHeader) other_;
2651    return compareDeep(event, o.event, true) && compareDeep(destination, o.destination, true)
2652        && compareDeep(sender, o.sender, true) && compareDeep(enterer, o.enterer, true)
2653        && compareDeep(author, o.author, true) && compareDeep(source, o.source, true)
2654        && compareDeep(responsible, o.responsible, true) && compareDeep(reason, o.reason, true)
2655        && compareDeep(response, o.response, true) && compareDeep(focus, o.focus, true)
2656        && compareDeep(definition, o.definition, true);
2657  }
2658
2659  @Override
2660  public boolean equalsShallow(Base other_) {
2661    if (!super.equalsShallow(other_))
2662      return false;
2663    if (!(other_ instanceof MessageHeader))
2664      return false;
2665    MessageHeader o = (MessageHeader) other_;
2666    return true;
2667  }
2668
2669  public boolean isEmpty() {
2670    return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(event, destination, sender, enterer, author, source,
2671        responsible, reason, response, focus, definition);
2672  }
2673
2674  @Override
2675  public ResourceType getResourceType() {
2676    return ResourceType.MessageHeader;
2677  }
2678
2679  /**
2680   * Search parameter: <b>code</b>
2681   * <p>
2682   * Description: <b>ok | transient-error | fatal-error</b><br>
2683   * Type: <b>token</b><br>
2684   * Path: <b>MessageHeader.response.code</b><br>
2685   * </p>
2686   */
2687  @SearchParamDefinition(name = "code", path = "MessageHeader.response.code", description = "ok | transient-error | fatal-error", type = "token")
2688  public static final String SP_CODE = "code";
2689  /**
2690   * <b>Fluent Client</b> search parameter constant for <b>code</b>
2691   * <p>
2692   * Description: <b>ok | transient-error | fatal-error</b><br>
2693   * Type: <b>token</b><br>
2694   * Path: <b>MessageHeader.response.code</b><br>
2695   * </p>
2696   */
2697  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(
2698      SP_CODE);
2699
2700  /**
2701   * Search parameter: <b>receiver</b>
2702   * <p>
2703   * Description: <b>Intended "real-world" recipient for the data</b><br>
2704   * Type: <b>reference</b><br>
2705   * Path: <b>MessageHeader.destination.receiver</b><br>
2706   * </p>
2707   */
2708  @SearchParamDefinition(name = "receiver", path = "MessageHeader.destination.receiver", description = "Intended \"real-world\" recipient for the data", type = "reference", providesMembershipIn = {
2709      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
2710          Practitioner.class, PractitionerRole.class })
2711  public static final String SP_RECEIVER = "receiver";
2712  /**
2713   * <b>Fluent Client</b> search parameter constant for <b>receiver</b>
2714   * <p>
2715   * Description: <b>Intended "real-world" recipient for the data</b><br>
2716   * Type: <b>reference</b><br>
2717   * Path: <b>MessageHeader.destination.receiver</b><br>
2718   * </p>
2719   */
2720  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RECEIVER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2721      SP_RECEIVER);
2722
2723  /**
2724   * Constant for fluent queries to be used to add include statements. Specifies
2725   * the path value of "<b>MessageHeader:receiver</b>".
2726   */
2727  public static final ca.uhn.fhir.model.api.Include INCLUDE_RECEIVER = new ca.uhn.fhir.model.api.Include(
2728      "MessageHeader:receiver").toLocked();
2729
2730  /**
2731   * Search parameter: <b>author</b>
2732   * <p>
2733   * Description: <b>The source of the decision</b><br>
2734   * Type: <b>reference</b><br>
2735   * Path: <b>MessageHeader.author</b><br>
2736   * </p>
2737   */
2738  @SearchParamDefinition(name = "author", path = "MessageHeader.author", description = "The source of the decision", type = "reference", providesMembershipIn = {
2739      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
2740          PractitionerRole.class })
2741  public static final String SP_AUTHOR = "author";
2742  /**
2743   * <b>Fluent Client</b> search parameter constant for <b>author</b>
2744   * <p>
2745   * Description: <b>The source of the decision</b><br>
2746   * Type: <b>reference</b><br>
2747   * Path: <b>MessageHeader.author</b><br>
2748   * </p>
2749   */
2750  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2751      SP_AUTHOR);
2752
2753  /**
2754   * Constant for fluent queries to be used to add include statements. Specifies
2755   * the path value of "<b>MessageHeader:author</b>".
2756   */
2757  public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include(
2758      "MessageHeader:author").toLocked();
2759
2760  /**
2761   * Search parameter: <b>destination</b>
2762   * <p>
2763   * Description: <b>Name of system</b><br>
2764   * Type: <b>string</b><br>
2765   * Path: <b>MessageHeader.destination.name</b><br>
2766   * </p>
2767   */
2768  @SearchParamDefinition(name = "destination", path = "MessageHeader.destination.name", description = "Name of system", type = "string")
2769  public static final String SP_DESTINATION = "destination";
2770  /**
2771   * <b>Fluent Client</b> search parameter constant for <b>destination</b>
2772   * <p>
2773   * Description: <b>Name of system</b><br>
2774   * Type: <b>string</b><br>
2775   * Path: <b>MessageHeader.destination.name</b><br>
2776   * </p>
2777   */
2778  public static final ca.uhn.fhir.rest.gclient.StringClientParam DESTINATION = new ca.uhn.fhir.rest.gclient.StringClientParam(
2779      SP_DESTINATION);
2780
2781  /**
2782   * Search parameter: <b>focus</b>
2783   * <p>
2784   * Description: <b>The actual content of the message</b><br>
2785   * Type: <b>reference</b><br>
2786   * Path: <b>MessageHeader.focus</b><br>
2787   * </p>
2788   */
2789  @SearchParamDefinition(name = "focus", path = "MessageHeader.focus", description = "The actual content of the message", type = "reference")
2790  public static final String SP_FOCUS = "focus";
2791  /**
2792   * <b>Fluent Client</b> search parameter constant for <b>focus</b>
2793   * <p>
2794   * Description: <b>The actual content of the message</b><br>
2795   * Type: <b>reference</b><br>
2796   * Path: <b>MessageHeader.focus</b><br>
2797   * </p>
2798   */
2799  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam FOCUS = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2800      SP_FOCUS);
2801
2802  /**
2803   * Constant for fluent queries to be used to add include statements. Specifies
2804   * the path value of "<b>MessageHeader:focus</b>".
2805   */
2806  public static final ca.uhn.fhir.model.api.Include INCLUDE_FOCUS = new ca.uhn.fhir.model.api.Include(
2807      "MessageHeader:focus").toLocked();
2808
2809  /**
2810   * Search parameter: <b>source</b>
2811   * <p>
2812   * Description: <b>Name of system</b><br>
2813   * Type: <b>string</b><br>
2814   * Path: <b>MessageHeader.source.name</b><br>
2815   * </p>
2816   */
2817  @SearchParamDefinition(name = "source", path = "MessageHeader.source.name", description = "Name of system", type = "string")
2818  public static final String SP_SOURCE = "source";
2819  /**
2820   * <b>Fluent Client</b> search parameter constant for <b>source</b>
2821   * <p>
2822   * Description: <b>Name of system</b><br>
2823   * Type: <b>string</b><br>
2824   * Path: <b>MessageHeader.source.name</b><br>
2825   * </p>
2826   */
2827  public static final ca.uhn.fhir.rest.gclient.StringClientParam SOURCE = new ca.uhn.fhir.rest.gclient.StringClientParam(
2828      SP_SOURCE);
2829
2830  /**
2831   * Search parameter: <b>target</b>
2832   * <p>
2833   * Description: <b>Particular delivery destination within the
2834   * destination</b><br>
2835   * Type: <b>reference</b><br>
2836   * Path: <b>MessageHeader.destination.target</b><br>
2837   * </p>
2838   */
2839  @SearchParamDefinition(name = "target", path = "MessageHeader.destination.target", description = "Particular delivery destination within the destination", type = "reference", providesMembershipIn = {
2840      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Device") }, target = { Device.class })
2841  public static final String SP_TARGET = "target";
2842  /**
2843   * <b>Fluent Client</b> search parameter constant for <b>target</b>
2844   * <p>
2845   * Description: <b>Particular delivery destination within the
2846   * destination</b><br>
2847   * Type: <b>reference</b><br>
2848   * Path: <b>MessageHeader.destination.target</b><br>
2849   * </p>
2850   */
2851  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam TARGET = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2852      SP_TARGET);
2853
2854  /**
2855   * Constant for fluent queries to be used to add include statements. Specifies
2856   * the path value of "<b>MessageHeader:target</b>".
2857   */
2858  public static final ca.uhn.fhir.model.api.Include INCLUDE_TARGET = new ca.uhn.fhir.model.api.Include(
2859      "MessageHeader:target").toLocked();
2860
2861  /**
2862   * Search parameter: <b>destination-uri</b>
2863   * <p>
2864   * Description: <b>Actual destination address or id</b><br>
2865   * Type: <b>uri</b><br>
2866   * Path: <b>MessageHeader.destination.endpoint</b><br>
2867   * </p>
2868   */
2869  @SearchParamDefinition(name = "destination-uri", path = "MessageHeader.destination.endpoint", description = "Actual destination address or id", type = "uri")
2870  public static final String SP_DESTINATION_URI = "destination-uri";
2871  /**
2872   * <b>Fluent Client</b> search parameter constant for <b>destination-uri</b>
2873   * <p>
2874   * Description: <b>Actual destination address or id</b><br>
2875   * Type: <b>uri</b><br>
2876   * Path: <b>MessageHeader.destination.endpoint</b><br>
2877   * </p>
2878   */
2879  public static final ca.uhn.fhir.rest.gclient.UriClientParam DESTINATION_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(
2880      SP_DESTINATION_URI);
2881
2882  /**
2883   * Search parameter: <b>source-uri</b>
2884   * <p>
2885   * Description: <b>Actual message source address or id</b><br>
2886   * Type: <b>uri</b><br>
2887   * Path: <b>MessageHeader.source.endpoint</b><br>
2888   * </p>
2889   */
2890  @SearchParamDefinition(name = "source-uri", path = "MessageHeader.source.endpoint", description = "Actual message source address or id", type = "uri")
2891  public static final String SP_SOURCE_URI = "source-uri";
2892  /**
2893   * <b>Fluent Client</b> search parameter constant for <b>source-uri</b>
2894   * <p>
2895   * Description: <b>Actual message source address or id</b><br>
2896   * Type: <b>uri</b><br>
2897   * Path: <b>MessageHeader.source.endpoint</b><br>
2898   * </p>
2899   */
2900  public static final ca.uhn.fhir.rest.gclient.UriClientParam SOURCE_URI = new ca.uhn.fhir.rest.gclient.UriClientParam(
2901      SP_SOURCE_URI);
2902
2903  /**
2904   * Search parameter: <b>sender</b>
2905   * <p>
2906   * Description: <b>Real world sender of the message</b><br>
2907   * Type: <b>reference</b><br>
2908   * Path: <b>MessageHeader.sender</b><br>
2909   * </p>
2910   */
2911  @SearchParamDefinition(name = "sender", path = "MessageHeader.sender", description = "Real world sender of the message", type = "reference", target = {
2912      Organization.class, Practitioner.class, PractitionerRole.class })
2913  public static final String SP_SENDER = "sender";
2914  /**
2915   * <b>Fluent Client</b> search parameter constant for <b>sender</b>
2916   * <p>
2917   * Description: <b>Real world sender of the message</b><br>
2918   * Type: <b>reference</b><br>
2919   * Path: <b>MessageHeader.sender</b><br>
2920   * </p>
2921   */
2922  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SENDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2923      SP_SENDER);
2924
2925  /**
2926   * Constant for fluent queries to be used to add include statements. Specifies
2927   * the path value of "<b>MessageHeader:sender</b>".
2928   */
2929  public static final ca.uhn.fhir.model.api.Include INCLUDE_SENDER = new ca.uhn.fhir.model.api.Include(
2930      "MessageHeader:sender").toLocked();
2931
2932  /**
2933   * Search parameter: <b>responsible</b>
2934   * <p>
2935   * Description: <b>Final responsibility for event</b><br>
2936   * Type: <b>reference</b><br>
2937   * Path: <b>MessageHeader.responsible</b><br>
2938   * </p>
2939   */
2940  @SearchParamDefinition(name = "responsible", path = "MessageHeader.responsible", description = "Final responsibility for event", type = "reference", providesMembershipIn = {
2941      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Organization.class,
2942          Practitioner.class, PractitionerRole.class })
2943  public static final String SP_RESPONSIBLE = "responsible";
2944  /**
2945   * <b>Fluent Client</b> search parameter constant for <b>responsible</b>
2946   * <p>
2947   * Description: <b>Final responsibility for event</b><br>
2948   * Type: <b>reference</b><br>
2949   * Path: <b>MessageHeader.responsible</b><br>
2950   * </p>
2951   */
2952  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam RESPONSIBLE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2953      SP_RESPONSIBLE);
2954
2955  /**
2956   * Constant for fluent queries to be used to add include statements. Specifies
2957   * the path value of "<b>MessageHeader:responsible</b>".
2958   */
2959  public static final ca.uhn.fhir.model.api.Include INCLUDE_RESPONSIBLE = new ca.uhn.fhir.model.api.Include(
2960      "MessageHeader:responsible").toLocked();
2961
2962  /**
2963   * Search parameter: <b>enterer</b>
2964   * <p>
2965   * Description: <b>The source of the data entry</b><br>
2966   * Type: <b>reference</b><br>
2967   * Path: <b>MessageHeader.enterer</b><br>
2968   * </p>
2969   */
2970  @SearchParamDefinition(name = "enterer", path = "MessageHeader.enterer", description = "The source of the data entry", type = "reference", providesMembershipIn = {
2971      @ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner") }, target = { Practitioner.class,
2972          PractitionerRole.class })
2973  public static final String SP_ENTERER = "enterer";
2974  /**
2975   * <b>Fluent Client</b> search parameter constant for <b>enterer</b>
2976   * <p>
2977   * Description: <b>The source of the data entry</b><br>
2978   * Type: <b>reference</b><br>
2979   * Path: <b>MessageHeader.enterer</b><br>
2980   * </p>
2981   */
2982  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENTERER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(
2983      SP_ENTERER);
2984
2985  /**
2986   * Constant for fluent queries to be used to add include statements. Specifies
2987   * the path value of "<b>MessageHeader:enterer</b>".
2988   */
2989  public static final ca.uhn.fhir.model.api.Include INCLUDE_ENTERER = new ca.uhn.fhir.model.api.Include(
2990      "MessageHeader:enterer").toLocked();
2991
2992  /**
2993   * Search parameter: <b>response-id</b>
2994   * <p>
2995   * Description: <b>Id of original message</b><br>
2996   * Type: <b>token</b><br>
2997   * Path: <b>MessageHeader.response.identifier</b><br>
2998   * </p>
2999   */
3000  @SearchParamDefinition(name = "response-id", path = "MessageHeader.response.identifier", description = "Id of original message", type = "token")
3001  public static final String SP_RESPONSE_ID = "response-id";
3002  /**
3003   * <b>Fluent Client</b> search parameter constant for <b>response-id</b>
3004   * <p>
3005   * Description: <b>Id of original message</b><br>
3006   * Type: <b>token</b><br>
3007   * Path: <b>MessageHeader.response.identifier</b><br>
3008   * </p>
3009   */
3010  public static final ca.uhn.fhir.rest.gclient.TokenClientParam RESPONSE_ID = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3011      SP_RESPONSE_ID);
3012
3013  /**
3014   * Search parameter: <b>event</b>
3015   * <p>
3016   * Description: <b>Code for the event this message represents or link to event
3017   * definition</b><br>
3018   * Type: <b>token</b><br>
3019   * Path: <b>MessageHeader.event[x]</b><br>
3020   * </p>
3021   */
3022  @SearchParamDefinition(name = "event", path = "MessageHeader.event", description = "Code for the event this message represents or link to event definition", type = "token")
3023  public static final String SP_EVENT = "event";
3024  /**
3025   * <b>Fluent Client</b> search parameter constant for <b>event</b>
3026   * <p>
3027   * Description: <b>Code for the event this message represents or link to event
3028   * definition</b><br>
3029   * Type: <b>token</b><br>
3030   * Path: <b>MessageHeader.event[x]</b><br>
3031   * </p>
3032   */
3033  public static final ca.uhn.fhir.rest.gclient.TokenClientParam EVENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(
3034      SP_EVENT);
3035
3036}