001package org.hl7.fhir.dstu2.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 Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import ca.uhn.fhir.model.api.annotation.Block;
038import ca.uhn.fhir.model.api.annotation.Child;
039import ca.uhn.fhir.model.api.annotation.Description;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043import org.hl7.fhir.exceptions.FHIRException;
044import org.hl7.fhir.utilities.Utilities;
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/Profile/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 some content in it. There is no point in
069     * re-sending without change. The response narrative SHALL describe the issue.
070     */
071    FATALERROR,
072    /**
073     * added to help the parsers
074     */
075    NULL;
076
077    public static ResponseType fromCode(String codeString) throws FHIRException {
078      if (codeString == null || "".equals(codeString))
079        return null;
080      if ("ok".equals(codeString))
081        return OK;
082      if ("transient-error".equals(codeString))
083        return TRANSIENTERROR;
084      if ("fatal-error".equals(codeString))
085        return FATALERROR;
086      throw new FHIRException("Unknown ResponseType code '" + codeString + "'");
087    }
088
089    public String toCode() {
090      switch (this) {
091      case OK:
092        return "ok";
093      case TRANSIENTERROR:
094        return "transient-error";
095      case FATALERROR:
096        return "fatal-error";
097      case NULL:
098        return null;
099      default:
100        return "?";
101      }
102    }
103
104    public String getSystem() {
105      switch (this) {
106      case OK:
107        return "http://hl7.org/fhir/response-code";
108      case TRANSIENTERROR:
109        return "http://hl7.org/fhir/response-code";
110      case FATALERROR:
111        return "http://hl7.org/fhir/response-code";
112      case NULL:
113        return null;
114      default:
115        return "?";
116      }
117    }
118
119    public String getDefinition() {
120      switch (this) {
121      case OK:
122        return "The message was accepted and processed without error.";
123      case TRANSIENTERROR:
124        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.";
125      case FATALERROR:
126        return "The message was rejected because of some content in it. There is no point in re-sending without change. The response narrative SHALL describe the issue.";
127      case NULL:
128        return null;
129      default:
130        return "?";
131      }
132    }
133
134    public String getDisplay() {
135      switch (this) {
136      case OK:
137        return "OK";
138      case TRANSIENTERROR:
139        return "Transient Error";
140      case FATALERROR:
141        return "Fatal Error";
142      case NULL:
143        return null;
144      default:
145        return "?";
146      }
147    }
148  }
149
150  public static class ResponseTypeEnumFactory implements EnumFactory<ResponseType> {
151    public ResponseType fromCode(String codeString) throws IllegalArgumentException {
152      if (codeString == null || "".equals(codeString))
153        if (codeString == null || "".equals(codeString))
154          return null;
155      if ("ok".equals(codeString))
156        return ResponseType.OK;
157      if ("transient-error".equals(codeString))
158        return ResponseType.TRANSIENTERROR;
159      if ("fatal-error".equals(codeString))
160        return ResponseType.FATALERROR;
161      throw new IllegalArgumentException("Unknown ResponseType code '" + codeString + "'");
162    }
163
164    public Enumeration<ResponseType> fromType(Base code) throws FHIRException {
165      if (code == null || code.isEmpty())
166        return null;
167      String codeString = ((PrimitiveType) code).asStringValue();
168      if (codeString == null || "".equals(codeString))
169        return null;
170      if ("ok".equals(codeString))
171        return new Enumeration<ResponseType>(this, ResponseType.OK);
172      if ("transient-error".equals(codeString))
173        return new Enumeration<ResponseType>(this, ResponseType.TRANSIENTERROR);
174      if ("fatal-error".equals(codeString))
175        return new Enumeration<ResponseType>(this, ResponseType.FATALERROR);
176      throw new FHIRException("Unknown ResponseType code '" + codeString + "'");
177    }
178
179    public String toCode(ResponseType code) {
180      if (code == ResponseType.OK)
181        return "ok";
182      if (code == ResponseType.TRANSIENTERROR)
183        return "transient-error";
184      if (code == ResponseType.FATALERROR)
185        return "fatal-error";
186      return "?";
187    }
188  }
189
190  @Block()
191  public static class MessageHeaderResponseComponent extends BackboneElement implements IBaseBackboneElement {
192    /**
193     * The id of the message that this message is a response to.
194     */
195    @Child(name = "identifier", type = { IdType.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
196    @Description(shortDefinition = "Id of original message", formalDefinition = "The id of the message that this message is a response to.")
197    protected IdType identifier;
198
199    /**
200     * Code that identifies the type of response to the message - whether it was
201     * successful or not, and whether it should be resent or not.
202     */
203    @Child(name = "code", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = true, summary = true)
204    @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.")
205    protected Enumeration<ResponseType> code;
206
207    /**
208     * Full details of any issues found in the message.
209     */
210    @Child(name = "details", type = {
211        OperationOutcome.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
212    @Description(shortDefinition = "Specific list of hints/warnings/errors", formalDefinition = "Full details of any issues found in the message.")
213    protected Reference details;
214
215    /**
216     * The actual object that is the target of the reference (Full details of any
217     * issues found in the message.)
218     */
219    protected OperationOutcome detailsTarget;
220
221    private static final long serialVersionUID = -1008716838L;
222
223    /*
224     * Constructor
225     */
226    public MessageHeaderResponseComponent() {
227      super();
228    }
229
230    /*
231     * Constructor
232     */
233    public MessageHeaderResponseComponent(IdType identifier, Enumeration<ResponseType> code) {
234      super();
235      this.identifier = identifier;
236      this.code = code;
237    }
238
239    /**
240     * @return {@link #identifier} (The id of the message that this message is a
241     *         response to.). This is the underlying object with id, value and
242     *         extensions. The accessor "getIdentifier" gives direct access to the
243     *         value
244     */
245    public IdType getIdentifierElement() {
246      if (this.identifier == null)
247        if (Configuration.errorOnAutoCreate())
248          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.identifier");
249        else if (Configuration.doAutoCreate())
250          this.identifier = new IdType(); // bb
251      return this.identifier;
252    }
253
254    public boolean hasIdentifierElement() {
255      return this.identifier != null && !this.identifier.isEmpty();
256    }
257
258    public boolean hasIdentifier() {
259      return this.identifier != null && !this.identifier.isEmpty();
260    }
261
262    /**
263     * @param value {@link #identifier} (The id of the message that this message is
264     *              a response to.). This is the underlying object with id, value
265     *              and extensions. The accessor "getIdentifier" gives direct access
266     *              to the value
267     */
268    public MessageHeaderResponseComponent setIdentifierElement(IdType value) {
269      this.identifier = value;
270      return this;
271    }
272
273    /**
274     * @return The id of the message that this message is a response to.
275     */
276    public String getIdentifier() {
277      return this.identifier == null ? null : this.identifier.getValue();
278    }
279
280    /**
281     * @param value The id of the message that this message is a response to.
282     */
283    public MessageHeaderResponseComponent setIdentifier(String value) {
284      if (this.identifier == null)
285        this.identifier = new IdType();
286      this.identifier.setValue(value);
287      return this;
288    }
289
290    /**
291     * @return {@link #code} (Code that identifies the type of response to the
292     *         message - whether it was successful or not, and whether it should be
293     *         resent or not.). This is the underlying object with id, value and
294     *         extensions. The accessor "getCode" gives direct access to the value
295     */
296    public Enumeration<ResponseType> getCodeElement() {
297      if (this.code == null)
298        if (Configuration.errorOnAutoCreate())
299          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.code");
300        else if (Configuration.doAutoCreate())
301          this.code = new Enumeration<ResponseType>(new ResponseTypeEnumFactory()); // bb
302      return this.code;
303    }
304
305    public boolean hasCodeElement() {
306      return this.code != null && !this.code.isEmpty();
307    }
308
309    public boolean hasCode() {
310      return this.code != null && !this.code.isEmpty();
311    }
312
313    /**
314     * @param value {@link #code} (Code that identifies the type of response to the
315     *              message - whether it was successful or not, and whether it
316     *              should be resent or not.). This is the underlying object with
317     *              id, value and extensions. The accessor "getCode" gives direct
318     *              access to the value
319     */
320    public MessageHeaderResponseComponent setCodeElement(Enumeration<ResponseType> value) {
321      this.code = value;
322      return this;
323    }
324
325    /**
326     * @return Code that identifies the type of response to the message - whether it
327     *         was successful or not, and whether it should be resent or not.
328     */
329    public ResponseType getCode() {
330      return this.code == null ? null : this.code.getValue();
331    }
332
333    /**
334     * @param value Code that identifies the type of response to the message -
335     *              whether it was successful or not, and whether it should be
336     *              resent or not.
337     */
338    public MessageHeaderResponseComponent setCode(ResponseType value) {
339      if (this.code == null)
340        this.code = new Enumeration<ResponseType>(new ResponseTypeEnumFactory());
341      this.code.setValue(value);
342      return this;
343    }
344
345    /**
346     * @return {@link #details} (Full details of any issues found in the message.)
347     */
348    public Reference getDetails() {
349      if (this.details == null)
350        if (Configuration.errorOnAutoCreate())
351          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.details");
352        else if (Configuration.doAutoCreate())
353          this.details = new Reference(); // cc
354      return this.details;
355    }
356
357    public boolean hasDetails() {
358      return this.details != null && !this.details.isEmpty();
359    }
360
361    /**
362     * @param value {@link #details} (Full details of any issues found in the
363     *              message.)
364     */
365    public MessageHeaderResponseComponent setDetails(Reference value) {
366      this.details = value;
367      return this;
368    }
369
370    /**
371     * @return {@link #details} The actual object that is the target of the
372     *         reference. The reference library doesn't populate this, but you can
373     *         use it to hold the resource if you resolve it. (Full details of any
374     *         issues found in the message.)
375     */
376    public OperationOutcome getDetailsTarget() {
377      if (this.detailsTarget == null)
378        if (Configuration.errorOnAutoCreate())
379          throw new Error("Attempt to auto-create MessageHeaderResponseComponent.details");
380        else if (Configuration.doAutoCreate())
381          this.detailsTarget = new OperationOutcome(); // aa
382      return this.detailsTarget;
383    }
384
385    /**
386     * @param value {@link #details} The actual object that is the target of the
387     *              reference. The reference library doesn't use these, but you can
388     *              use it to hold the resource if you resolve it. (Full details of
389     *              any issues found in the message.)
390     */
391    public MessageHeaderResponseComponent setDetailsTarget(OperationOutcome value) {
392      this.detailsTarget = value;
393      return this;
394    }
395
396    protected void listChildren(List<Property> childrenList) {
397      super.listChildren(childrenList);
398      childrenList.add(new Property("identifier", "id", "The id of the message that this message is a response to.", 0,
399          java.lang.Integer.MAX_VALUE, identifier));
400      childrenList.add(new Property("code", "code",
401          "Code that identifies the type of response to the message - whether it was successful or not, and whether it should be resent or not.",
402          0, java.lang.Integer.MAX_VALUE, code));
403      childrenList.add(new Property("details", "Reference(OperationOutcome)",
404          "Full details of any issues found in the message.", 0, java.lang.Integer.MAX_VALUE, details));
405    }
406
407    @Override
408    public void setProperty(String name, Base value) throws FHIRException {
409      if (name.equals("identifier"))
410        this.identifier = castToId(value); // IdType
411      else if (name.equals("code"))
412        this.code = new ResponseTypeEnumFactory().fromType(value); // Enumeration<ResponseType>
413      else if (name.equals("details"))
414        this.details = castToReference(value); // Reference
415      else
416        super.setProperty(name, value);
417    }
418
419    @Override
420    public Base addChild(String name) throws FHIRException {
421      if (name.equals("identifier")) {
422        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.identifier");
423      } else if (name.equals("code")) {
424        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.code");
425      } else if (name.equals("details")) {
426        this.details = new Reference();
427        return this.details;
428      } else
429        return super.addChild(name);
430    }
431
432    public MessageHeaderResponseComponent copy() {
433      MessageHeaderResponseComponent dst = new MessageHeaderResponseComponent();
434      copyValues(dst);
435      dst.identifier = identifier == null ? null : identifier.copy();
436      dst.code = code == null ? null : code.copy();
437      dst.details = details == null ? null : details.copy();
438      return dst;
439    }
440
441    @Override
442    public boolean equalsDeep(Base other) {
443      if (!super.equalsDeep(other))
444        return false;
445      if (!(other instanceof MessageHeaderResponseComponent))
446        return false;
447      MessageHeaderResponseComponent o = (MessageHeaderResponseComponent) other;
448      return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true)
449          && compareDeep(details, o.details, true);
450    }
451
452    @Override
453    public boolean equalsShallow(Base other) {
454      if (!super.equalsShallow(other))
455        return false;
456      if (!(other instanceof MessageHeaderResponseComponent))
457        return false;
458      MessageHeaderResponseComponent o = (MessageHeaderResponseComponent) other;
459      return compareValues(identifier, o.identifier, true) && compareValues(code, o.code, true);
460    }
461
462    public boolean isEmpty() {
463      return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty())
464          && (details == null || details.isEmpty());
465    }
466
467    public String fhirType() {
468      return "MessageHeader.response";
469
470    }
471
472  }
473
474  @Block()
475  public static class MessageSourceComponent extends BackboneElement implements IBaseBackboneElement {
476    /**
477     * Human-readable name for the source system.
478     */
479    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
480    @Description(shortDefinition = "Name of system", formalDefinition = "Human-readable name for the source system.")
481    protected StringType name;
482
483    /**
484     * May include configuration or other information useful in debugging.
485     */
486    @Child(name = "software", type = {
487        StringType.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
488    @Description(shortDefinition = "Name of software running the system", formalDefinition = "May include configuration or other information useful in debugging.")
489    protected StringType software;
490
491    /**
492     * Can convey versions of multiple systems in situations where a message passes
493     * through multiple hands.
494     */
495    @Child(name = "version", type = { StringType.class }, order = 3, min = 0, max = 1, modifier = false, summary = true)
496    @Description(shortDefinition = "Version of software running", formalDefinition = "Can convey versions of multiple systems in situations where a message passes through multiple hands.")
497    protected StringType version;
498
499    /**
500     * An e-mail, phone, website or other contact point to use to resolve issues
501     * with message communications.
502     */
503    @Child(name = "contact", type = {
504        ContactPoint.class }, order = 4, min = 0, max = 1, modifier = false, summary = true)
505    @Description(shortDefinition = "Human contact for problems", formalDefinition = "An e-mail, phone, website or other contact point to use to resolve issues with message communications.")
506    protected ContactPoint contact;
507
508    /**
509     * Identifies the routing target to send acknowledgements to.
510     */
511    @Child(name = "endpoint", type = { UriType.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
512    @Description(shortDefinition = "Actual message source address or id", formalDefinition = "Identifies the routing target to send acknowledgements to.")
513    protected UriType endpoint;
514
515    private static final long serialVersionUID = -115878196L;
516
517    /*
518     * Constructor
519     */
520    public MessageSourceComponent() {
521      super();
522    }
523
524    /*
525     * Constructor
526     */
527    public MessageSourceComponent(UriType endpoint) {
528      super();
529      this.endpoint = endpoint;
530    }
531
532    /**
533     * @return {@link #name} (Human-readable name for the source system.). This is
534     *         the underlying object with id, value and extensions. The accessor
535     *         "getName" gives direct access to the value
536     */
537    public StringType getNameElement() {
538      if (this.name == null)
539        if (Configuration.errorOnAutoCreate())
540          throw new Error("Attempt to auto-create MessageSourceComponent.name");
541        else if (Configuration.doAutoCreate())
542          this.name = new StringType(); // bb
543      return this.name;
544    }
545
546    public boolean hasNameElement() {
547      return this.name != null && !this.name.isEmpty();
548    }
549
550    public boolean hasName() {
551      return this.name != null && !this.name.isEmpty();
552    }
553
554    /**
555     * @param value {@link #name} (Human-readable name for the source system.). This
556     *              is the underlying object with id, value and extensions. The
557     *              accessor "getName" gives direct access to the value
558     */
559    public MessageSourceComponent setNameElement(StringType value) {
560      this.name = value;
561      return this;
562    }
563
564    /**
565     * @return Human-readable name for the source system.
566     */
567    public String getName() {
568      return this.name == null ? null : this.name.getValue();
569    }
570
571    /**
572     * @param value Human-readable name for the source system.
573     */
574    public MessageSourceComponent setName(String value) {
575      if (Utilities.noString(value))
576        this.name = null;
577      else {
578        if (this.name == null)
579          this.name = new StringType();
580        this.name.setValue(value);
581      }
582      return this;
583    }
584
585    /**
586     * @return {@link #software} (May include configuration or other information
587     *         useful in debugging.). This is the underlying object with id, value
588     *         and extensions. The accessor "getSoftware" gives direct access to the
589     *         value
590     */
591    public StringType getSoftwareElement() {
592      if (this.software == null)
593        if (Configuration.errorOnAutoCreate())
594          throw new Error("Attempt to auto-create MessageSourceComponent.software");
595        else if (Configuration.doAutoCreate())
596          this.software = new StringType(); // bb
597      return this.software;
598    }
599
600    public boolean hasSoftwareElement() {
601      return this.software != null && !this.software.isEmpty();
602    }
603
604    public boolean hasSoftware() {
605      return this.software != null && !this.software.isEmpty();
606    }
607
608    /**
609     * @param value {@link #software} (May include configuration or other
610     *              information useful in debugging.). This is the underlying object
611     *              with id, value and extensions. The accessor "getSoftware" gives
612     *              direct access to the value
613     */
614    public MessageSourceComponent setSoftwareElement(StringType value) {
615      this.software = value;
616      return this;
617    }
618
619    /**
620     * @return May include configuration or other information useful in debugging.
621     */
622    public String getSoftware() {
623      return this.software == null ? null : this.software.getValue();
624    }
625
626    /**
627     * @param value May include configuration or other information useful in
628     *              debugging.
629     */
630    public MessageSourceComponent setSoftware(String value) {
631      if (Utilities.noString(value))
632        this.software = null;
633      else {
634        if (this.software == null)
635          this.software = new StringType();
636        this.software.setValue(value);
637      }
638      return this;
639    }
640
641    /**
642     * @return {@link #version} (Can convey versions of multiple systems in
643     *         situations where a message passes through multiple hands.). This is
644     *         the underlying object with id, value and extensions. The accessor
645     *         "getVersion" gives direct access to the value
646     */
647    public StringType getVersionElement() {
648      if (this.version == null)
649        if (Configuration.errorOnAutoCreate())
650          throw new Error("Attempt to auto-create MessageSourceComponent.version");
651        else if (Configuration.doAutoCreate())
652          this.version = new StringType(); // bb
653      return this.version;
654    }
655
656    public boolean hasVersionElement() {
657      return this.version != null && !this.version.isEmpty();
658    }
659
660    public boolean hasVersion() {
661      return this.version != null && !this.version.isEmpty();
662    }
663
664    /**
665     * @param value {@link #version} (Can convey versions of multiple systems in
666     *              situations where a message passes through multiple hands.). This
667     *              is the underlying object with id, value and extensions. The
668     *              accessor "getVersion" gives direct access to the value
669     */
670    public MessageSourceComponent setVersionElement(StringType value) {
671      this.version = value;
672      return this;
673    }
674
675    /**
676     * @return Can convey versions of multiple systems in situations where a message
677     *         passes through multiple hands.
678     */
679    public String getVersion() {
680      return this.version == null ? null : this.version.getValue();
681    }
682
683    /**
684     * @param value Can convey versions of multiple systems in situations where a
685     *              message passes through multiple hands.
686     */
687    public MessageSourceComponent setVersion(String value) {
688      if (Utilities.noString(value))
689        this.version = null;
690      else {
691        if (this.version == null)
692          this.version = new StringType();
693        this.version.setValue(value);
694      }
695      return this;
696    }
697
698    /**
699     * @return {@link #contact} (An e-mail, phone, website or other contact point to
700     *         use to resolve issues with message communications.)
701     */
702    public ContactPoint getContact() {
703      if (this.contact == null)
704        if (Configuration.errorOnAutoCreate())
705          throw new Error("Attempt to auto-create MessageSourceComponent.contact");
706        else if (Configuration.doAutoCreate())
707          this.contact = new ContactPoint(); // cc
708      return this.contact;
709    }
710
711    public boolean hasContact() {
712      return this.contact != null && !this.contact.isEmpty();
713    }
714
715    /**
716     * @param value {@link #contact} (An e-mail, phone, website or other contact
717     *              point to use to resolve issues with message communications.)
718     */
719    public MessageSourceComponent setContact(ContactPoint value) {
720      this.contact = value;
721      return this;
722    }
723
724    /**
725     * @return {@link #endpoint} (Identifies the routing target to send
726     *         acknowledgements to.). This is the underlying object with id, value
727     *         and extensions. The accessor "getEndpoint" gives direct access to the
728     *         value
729     */
730    public UriType getEndpointElement() {
731      if (this.endpoint == null)
732        if (Configuration.errorOnAutoCreate())
733          throw new Error("Attempt to auto-create MessageSourceComponent.endpoint");
734        else if (Configuration.doAutoCreate())
735          this.endpoint = new UriType(); // bb
736      return this.endpoint;
737    }
738
739    public boolean hasEndpointElement() {
740      return this.endpoint != null && !this.endpoint.isEmpty();
741    }
742
743    public boolean hasEndpoint() {
744      return this.endpoint != null && !this.endpoint.isEmpty();
745    }
746
747    /**
748     * @param value {@link #endpoint} (Identifies the routing target to send
749     *              acknowledgements to.). This is the underlying object with id,
750     *              value and extensions. The accessor "getEndpoint" gives direct
751     *              access to the value
752     */
753    public MessageSourceComponent setEndpointElement(UriType value) {
754      this.endpoint = value;
755      return this;
756    }
757
758    /**
759     * @return Identifies the routing target to send acknowledgements to.
760     */
761    public String getEndpoint() {
762      return this.endpoint == null ? null : this.endpoint.getValue();
763    }
764
765    /**
766     * @param value Identifies the routing target to send acknowledgements to.
767     */
768    public MessageSourceComponent setEndpoint(String value) {
769      if (this.endpoint == null)
770        this.endpoint = new UriType();
771      this.endpoint.setValue(value);
772      return this;
773    }
774
775    protected void listChildren(List<Property> childrenList) {
776      super.listChildren(childrenList);
777      childrenList.add(new Property("name", "string", "Human-readable name for the source system.", 0,
778          java.lang.Integer.MAX_VALUE, name));
779      childrenList
780          .add(new Property("software", "string", "May include configuration or other information useful in debugging.",
781              0, java.lang.Integer.MAX_VALUE, software));
782      childrenList.add(new Property("version", "string",
783          "Can convey versions of multiple systems in situations where a message passes through multiple hands.", 0,
784          java.lang.Integer.MAX_VALUE, version));
785      childrenList.add(new Property("contact", "ContactPoint",
786          "An e-mail, phone, website or other contact point to use to resolve issues with message communications.", 0,
787          java.lang.Integer.MAX_VALUE, contact));
788      childrenList.add(new Property("endpoint", "uri", "Identifies the routing target to send acknowledgements to.", 0,
789          java.lang.Integer.MAX_VALUE, endpoint));
790    }
791
792    @Override
793    public void setProperty(String name, Base value) throws FHIRException {
794      if (name.equals("name"))
795        this.name = castToString(value); // StringType
796      else if (name.equals("software"))
797        this.software = castToString(value); // StringType
798      else if (name.equals("version"))
799        this.version = castToString(value); // StringType
800      else if (name.equals("contact"))
801        this.contact = castToContactPoint(value); // ContactPoint
802      else if (name.equals("endpoint"))
803        this.endpoint = castToUri(value); // UriType
804      else
805        super.setProperty(name, value);
806    }
807
808    @Override
809    public Base addChild(String name) throws FHIRException {
810      if (name.equals("name")) {
811        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.name");
812      } else if (name.equals("software")) {
813        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.software");
814      } else if (name.equals("version")) {
815        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.version");
816      } else if (name.equals("contact")) {
817        this.contact = new ContactPoint();
818        return this.contact;
819      } else if (name.equals("endpoint")) {
820        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.endpoint");
821      } else
822        return super.addChild(name);
823    }
824
825    public MessageSourceComponent copy() {
826      MessageSourceComponent dst = new MessageSourceComponent();
827      copyValues(dst);
828      dst.name = name == null ? null : name.copy();
829      dst.software = software == null ? null : software.copy();
830      dst.version = version == null ? null : version.copy();
831      dst.contact = contact == null ? null : contact.copy();
832      dst.endpoint = endpoint == null ? null : endpoint.copy();
833      return dst;
834    }
835
836    @Override
837    public boolean equalsDeep(Base other) {
838      if (!super.equalsDeep(other))
839        return false;
840      if (!(other instanceof MessageSourceComponent))
841        return false;
842      MessageSourceComponent o = (MessageSourceComponent) other;
843      return compareDeep(name, o.name, true) && compareDeep(software, o.software, true)
844          && compareDeep(version, o.version, true) && compareDeep(contact, o.contact, true)
845          && compareDeep(endpoint, o.endpoint, true);
846    }
847
848    @Override
849    public boolean equalsShallow(Base other) {
850      if (!super.equalsShallow(other))
851        return false;
852      if (!(other instanceof MessageSourceComponent))
853        return false;
854      MessageSourceComponent o = (MessageSourceComponent) other;
855      return compareValues(name, o.name, true) && compareValues(software, o.software, true)
856          && compareValues(version, o.version, true) && compareValues(endpoint, o.endpoint, true);
857    }
858
859    public boolean isEmpty() {
860      return super.isEmpty() && (name == null || name.isEmpty()) && (software == null || software.isEmpty())
861          && (version == null || version.isEmpty()) && (contact == null || contact.isEmpty())
862          && (endpoint == null || endpoint.isEmpty());
863    }
864
865    public String fhirType() {
866      return "MessageHeader.source";
867
868    }
869
870  }
871
872  @Block()
873  public static class MessageDestinationComponent extends BackboneElement implements IBaseBackboneElement {
874    /**
875     * Human-readable name for the target system.
876     */
877    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
878    @Description(shortDefinition = "Name of system", formalDefinition = "Human-readable name for the target system.")
879    protected StringType name;
880
881    /**
882     * Identifies the target end system in situations where the initial message
883     * transmission is to an intermediary system.
884     */
885    @Child(name = "target", type = { Device.class }, order = 2, min = 0, max = 1, modifier = false, summary = true)
886    @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.")
887    protected Reference target;
888
889    /**
890     * The actual object that is the target of the reference (Identifies the target
891     * end system in situations where the initial message transmission is to an
892     * intermediary system.)
893     */
894    protected Device targetTarget;
895
896    /**
897     * Indicates where the message should be routed to.
898     */
899    @Child(name = "endpoint", type = { UriType.class }, order = 3, min = 1, max = 1, modifier = false, summary = true)
900    @Description(shortDefinition = "Actual destination address or id", formalDefinition = "Indicates where the message should be routed to.")
901    protected UriType endpoint;
902
903    private static final long serialVersionUID = -2097633309L;
904
905    /*
906     * Constructor
907     */
908    public MessageDestinationComponent() {
909      super();
910    }
911
912    /*
913     * Constructor
914     */
915    public MessageDestinationComponent(UriType endpoint) {
916      super();
917      this.endpoint = endpoint;
918    }
919
920    /**
921     * @return {@link #name} (Human-readable name for the target system.). This is
922     *         the underlying object with id, value and extensions. The accessor
923     *         "getName" gives direct access to the value
924     */
925    public StringType getNameElement() {
926      if (this.name == null)
927        if (Configuration.errorOnAutoCreate())
928          throw new Error("Attempt to auto-create MessageDestinationComponent.name");
929        else if (Configuration.doAutoCreate())
930          this.name = new StringType(); // bb
931      return this.name;
932    }
933
934    public boolean hasNameElement() {
935      return this.name != null && !this.name.isEmpty();
936    }
937
938    public boolean hasName() {
939      return this.name != null && !this.name.isEmpty();
940    }
941
942    /**
943     * @param value {@link #name} (Human-readable name for the target system.). This
944     *              is the underlying object with id, value and extensions. The
945     *              accessor "getName" gives direct access to the value
946     */
947    public MessageDestinationComponent setNameElement(StringType value) {
948      this.name = value;
949      return this;
950    }
951
952    /**
953     * @return Human-readable name for the target system.
954     */
955    public String getName() {
956      return this.name == null ? null : this.name.getValue();
957    }
958
959    /**
960     * @param value Human-readable name for the target system.
961     */
962    public MessageDestinationComponent setName(String value) {
963      if (Utilities.noString(value))
964        this.name = null;
965      else {
966        if (this.name == null)
967          this.name = new StringType();
968        this.name.setValue(value);
969      }
970      return this;
971    }
972
973    /**
974     * @return {@link #target} (Identifies the target end system in situations where
975     *         the initial message transmission is to an intermediary system.)
976     */
977    public Reference getTarget() {
978      if (this.target == null)
979        if (Configuration.errorOnAutoCreate())
980          throw new Error("Attempt to auto-create MessageDestinationComponent.target");
981        else if (Configuration.doAutoCreate())
982          this.target = new Reference(); // cc
983      return this.target;
984    }
985
986    public boolean hasTarget() {
987      return this.target != null && !this.target.isEmpty();
988    }
989
990    /**
991     * @param value {@link #target} (Identifies the target end system in situations
992     *              where the initial message transmission is to an intermediary
993     *              system.)
994     */
995    public MessageDestinationComponent setTarget(Reference value) {
996      this.target = value;
997      return this;
998    }
999
1000    /**
1001     * @return {@link #target} The actual object that is the target of the
1002     *         reference. The reference library doesn't populate this, but you can
1003     *         use it to hold the resource if you resolve it. (Identifies the target
1004     *         end system in situations where the initial message transmission is to
1005     *         an intermediary system.)
1006     */
1007    public Device getTargetTarget() {
1008      if (this.targetTarget == null)
1009        if (Configuration.errorOnAutoCreate())
1010          throw new Error("Attempt to auto-create MessageDestinationComponent.target");
1011        else if (Configuration.doAutoCreate())
1012          this.targetTarget = new Device(); // aa
1013      return this.targetTarget;
1014    }
1015
1016    /**
1017     * @param value {@link #target} The actual object that is the target of the
1018     *              reference. The reference library doesn't use these, but you can
1019     *              use it to hold the resource if you resolve it. (Identifies the
1020     *              target end system in situations where the initial message
1021     *              transmission is to an intermediary system.)
1022     */
1023    public MessageDestinationComponent setTargetTarget(Device value) {
1024      this.targetTarget = value;
1025      return this;
1026    }
1027
1028    /**
1029     * @return {@link #endpoint} (Indicates where the message should be routed to.).
1030     *         This is the underlying object with id, value and extensions. The
1031     *         accessor "getEndpoint" gives direct access to the value
1032     */
1033    public UriType getEndpointElement() {
1034      if (this.endpoint == null)
1035        if (Configuration.errorOnAutoCreate())
1036          throw new Error("Attempt to auto-create MessageDestinationComponent.endpoint");
1037        else if (Configuration.doAutoCreate())
1038          this.endpoint = new UriType(); // bb
1039      return this.endpoint;
1040    }
1041
1042    public boolean hasEndpointElement() {
1043      return this.endpoint != null && !this.endpoint.isEmpty();
1044    }
1045
1046    public boolean hasEndpoint() {
1047      return this.endpoint != null && !this.endpoint.isEmpty();
1048    }
1049
1050    /**
1051     * @param value {@link #endpoint} (Indicates where the message should be routed
1052     *              to.). This is the underlying object with id, value and
1053     *              extensions. The accessor "getEndpoint" gives direct access to
1054     *              the value
1055     */
1056    public MessageDestinationComponent setEndpointElement(UriType value) {
1057      this.endpoint = value;
1058      return this;
1059    }
1060
1061    /**
1062     * @return Indicates where the message should be routed to.
1063     */
1064    public String getEndpoint() {
1065      return this.endpoint == null ? null : this.endpoint.getValue();
1066    }
1067
1068    /**
1069     * @param value Indicates where the message should be routed to.
1070     */
1071    public MessageDestinationComponent setEndpoint(String value) {
1072      if (this.endpoint == null)
1073        this.endpoint = new UriType();
1074      this.endpoint.setValue(value);
1075      return this;
1076    }
1077
1078    protected void listChildren(List<Property> childrenList) {
1079      super.listChildren(childrenList);
1080      childrenList.add(new Property("name", "string", "Human-readable name for the target system.", 0,
1081          java.lang.Integer.MAX_VALUE, name));
1082      childrenList.add(new Property("target", "Reference(Device)",
1083          "Identifies the target end system in situations where the initial message transmission is to an intermediary system.",
1084          0, java.lang.Integer.MAX_VALUE, target));
1085      childrenList.add(new Property("endpoint", "uri", "Indicates where the message should be routed to.", 0,
1086          java.lang.Integer.MAX_VALUE, endpoint));
1087    }
1088
1089    @Override
1090    public void setProperty(String name, Base value) throws FHIRException {
1091      if (name.equals("name"))
1092        this.name = castToString(value); // StringType
1093      else if (name.equals("target"))
1094        this.target = castToReference(value); // Reference
1095      else if (name.equals("endpoint"))
1096        this.endpoint = castToUri(value); // UriType
1097      else
1098        super.setProperty(name, value);
1099    }
1100
1101    @Override
1102    public Base addChild(String name) throws FHIRException {
1103      if (name.equals("name")) {
1104        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.name");
1105      } else if (name.equals("target")) {
1106        this.target = new Reference();
1107        return this.target;
1108      } else if (name.equals("endpoint")) {
1109        throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.endpoint");
1110      } else
1111        return super.addChild(name);
1112    }
1113
1114    public MessageDestinationComponent copy() {
1115      MessageDestinationComponent dst = new MessageDestinationComponent();
1116      copyValues(dst);
1117      dst.name = name == null ? null : name.copy();
1118      dst.target = target == null ? null : target.copy();
1119      dst.endpoint = endpoint == null ? null : endpoint.copy();
1120      return dst;
1121    }
1122
1123    @Override
1124    public boolean equalsDeep(Base other) {
1125      if (!super.equalsDeep(other))
1126        return false;
1127      if (!(other instanceof MessageDestinationComponent))
1128        return false;
1129      MessageDestinationComponent o = (MessageDestinationComponent) other;
1130      return compareDeep(name, o.name, true) && compareDeep(target, o.target, true)
1131          && compareDeep(endpoint, o.endpoint, true);
1132    }
1133
1134    @Override
1135    public boolean equalsShallow(Base other) {
1136      if (!super.equalsShallow(other))
1137        return false;
1138      if (!(other instanceof MessageDestinationComponent))
1139        return false;
1140      MessageDestinationComponent o = (MessageDestinationComponent) other;
1141      return compareValues(name, o.name, true) && compareValues(endpoint, o.endpoint, true);
1142    }
1143
1144    public boolean isEmpty() {
1145      return super.isEmpty() && (name == null || name.isEmpty()) && (target == null || target.isEmpty())
1146          && (endpoint == null || endpoint.isEmpty());
1147    }
1148
1149    public String fhirType() {
1150      return "MessageHeader.destination";
1151
1152    }
1153
1154  }
1155
1156  /**
1157   * The time that the message was sent.
1158   */
1159  @Child(name = "timestamp", type = {
1160      InstantType.class }, order = 0, min = 1, max = 1, modifier = false, summary = true)
1161  @Description(shortDefinition = "Time that the message was sent", formalDefinition = "The time that the message was sent.")
1162  protected InstantType timestamp;
1163
1164  /**
1165   * Code that identifies the event this message represents and connects it with
1166   * its definition. Events defined as part of the FHIR specification have the
1167   * system value "http://hl7.org/fhir/message-events".
1168   */
1169  @Child(name = "event", type = { Coding.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
1170  @Description(shortDefinition = "Code for the event this message represents", 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://hl7.org/fhir/message-events\".")
1171  protected Coding event;
1172
1173  /**
1174   * Information about the message that this message is a response to. Only
1175   * present if this message is a response.
1176   */
1177  @Child(name = "response", type = {}, order = 2, min = 0, max = 1, modifier = true, summary = true)
1178  @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.")
1179  protected MessageHeaderResponseComponent response;
1180
1181  /**
1182   * The source application from which this message originated.
1183   */
1184  @Child(name = "source", type = {}, order = 3, min = 1, max = 1, modifier = false, summary = true)
1185  @Description(shortDefinition = "Message Source Application", formalDefinition = "The source application from which this message originated.")
1186  protected MessageSourceComponent source;
1187
1188  /**
1189   * The destination application which the message is intended for.
1190   */
1191  @Child(name = "destination", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1192  @Description(shortDefinition = "Message Destination Application(s)", formalDefinition = "The destination application which the message is intended for.")
1193  protected List<MessageDestinationComponent> destination;
1194
1195  /**
1196   * The person or device that performed the data entry leading to this message.
1197   * Where there is more than one candidate, pick the most proximal to the
1198   * message. Can provide other enterers in extensions.
1199   */
1200  @Child(name = "enterer", type = { Practitioner.class }, order = 5, min = 0, max = 1, modifier = false, summary = true)
1201  @Description(shortDefinition = "The source of the data entry", formalDefinition = "The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.")
1202  protected Reference enterer;
1203
1204  /**
1205   * The actual object that is the target of the reference (The person or device
1206   * that performed the data entry leading to this message. Where there is more
1207   * than one candidate, pick the most proximal to the message. Can provide other
1208   * enterers in extensions.)
1209   */
1210  protected Practitioner entererTarget;
1211
1212  /**
1213   * The logical author of the message - the person or device that decided the
1214   * described event should happen. Where there is more than one candidate, pick
1215   * the most proximal to the MessageHeader. Can provide other authors in
1216   * extensions.
1217   */
1218  @Child(name = "author", type = { Practitioner.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1219  @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. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.")
1220  protected Reference author;
1221
1222  /**
1223   * The actual object that is the target of the reference (The logical author of
1224   * the message - the person or device that decided the described event should
1225   * happen. Where there is more than one candidate, pick the most proximal to the
1226   * MessageHeader. Can provide other authors in extensions.)
1227   */
1228  protected Practitioner authorTarget;
1229
1230  /**
1231   * Allows data conveyed by a message to be addressed to a particular person or
1232   * department when routing to a specific application isn't sufficient.
1233   */
1234  @Child(name = "receiver", type = { Practitioner.class,
1235      Organization.class }, order = 7, min = 0, max = 1, modifier = false, summary = true)
1236  @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.")
1237  protected Reference receiver;
1238
1239  /**
1240   * The actual object that is the target of the reference (Allows data conveyed
1241   * by a message to be addressed to a particular person or department when
1242   * routing to a specific application isn't sufficient.)
1243   */
1244  protected Resource receiverTarget;
1245
1246  /**
1247   * The person or organization that accepts overall responsibility for the
1248   * contents of the message. The implication is that the message event happened
1249   * under the policies of the responsible party.
1250   */
1251  @Child(name = "responsible", type = { Practitioner.class,
1252      Organization.class }, order = 8, min = 0, max = 1, modifier = false, summary = true)
1253  @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.")
1254  protected Reference responsible;
1255
1256  /**
1257   * The actual object that is the target of the reference (The person or
1258   * organization that accepts overall responsibility for the contents of the
1259   * message. The implication is that the message event happened under the
1260   * policies of the responsible party.)
1261   */
1262  protected Resource responsibleTarget;
1263
1264  /**
1265   * Coded indication of the cause for the event - indicates a reason for the
1266   * occurrence of the event that is a focus of this message.
1267   */
1268  @Child(name = "reason", type = {
1269      CodeableConcept.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
1270  @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.")
1271  protected CodeableConcept reason;
1272
1273  /**
1274   * The actual data of the message - a reference to the root/focus class of the
1275   * event.
1276   */
1277  @Child(name = "data", type = {}, order = 10, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1278  @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.")
1279  protected List<Reference> data;
1280  /**
1281   * The actual objects that are the target of the reference (The actual data of
1282   * the message - a reference to the root/focus class of the event.)
1283   */
1284  protected List<Resource> dataTarget;
1285
1286  private static final long serialVersionUID = 1429728517L;
1287
1288  /*
1289   * Constructor
1290   */
1291  public MessageHeader() {
1292    super();
1293  }
1294
1295  /*
1296   * Constructor
1297   */
1298  public MessageHeader(InstantType timestamp, Coding event, MessageSourceComponent source) {
1299    super();
1300    this.timestamp = timestamp;
1301    this.event = event;
1302    this.source = source;
1303  }
1304
1305  /**
1306   * @return {@link #timestamp} (The time that the message was sent.). This is the
1307   *         underlying object with id, value and extensions. The accessor
1308   *         "getTimestamp" gives direct access to the value
1309   */
1310  public InstantType getTimestampElement() {
1311    if (this.timestamp == null)
1312      if (Configuration.errorOnAutoCreate())
1313        throw new Error("Attempt to auto-create MessageHeader.timestamp");
1314      else if (Configuration.doAutoCreate())
1315        this.timestamp = new InstantType(); // bb
1316    return this.timestamp;
1317  }
1318
1319  public boolean hasTimestampElement() {
1320    return this.timestamp != null && !this.timestamp.isEmpty();
1321  }
1322
1323  public boolean hasTimestamp() {
1324    return this.timestamp != null && !this.timestamp.isEmpty();
1325  }
1326
1327  /**
1328   * @param value {@link #timestamp} (The time that the message was sent.). This
1329   *              is the underlying object with id, value and extensions. The
1330   *              accessor "getTimestamp" gives direct access to the value
1331   */
1332  public MessageHeader setTimestampElement(InstantType value) {
1333    this.timestamp = value;
1334    return this;
1335  }
1336
1337  /**
1338   * @return The time that the message was sent.
1339   */
1340  public Date getTimestamp() {
1341    return this.timestamp == null ? null : this.timestamp.getValue();
1342  }
1343
1344  /**
1345   * @param value The time that the message was sent.
1346   */
1347  public MessageHeader setTimestamp(Date value) {
1348    if (this.timestamp == null)
1349      this.timestamp = new InstantType();
1350    this.timestamp.setValue(value);
1351    return this;
1352  }
1353
1354  /**
1355   * @return {@link #event} (Code that identifies the event this message
1356   *         represents and connects it with its definition. Events defined as
1357   *         part of the FHIR specification have the system value
1358   *         "http://hl7.org/fhir/message-events".)
1359   */
1360  public Coding getEvent() {
1361    if (this.event == null)
1362      if (Configuration.errorOnAutoCreate())
1363        throw new Error("Attempt to auto-create MessageHeader.event");
1364      else if (Configuration.doAutoCreate())
1365        this.event = new Coding(); // cc
1366    return this.event;
1367  }
1368
1369  public boolean hasEvent() {
1370    return this.event != null && !this.event.isEmpty();
1371  }
1372
1373  /**
1374   * @param value {@link #event} (Code that identifies the event this message
1375   *              represents and connects it with its definition. Events defined
1376   *              as part of the FHIR specification have the system value
1377   *              "http://hl7.org/fhir/message-events".)
1378   */
1379  public MessageHeader setEvent(Coding value) {
1380    this.event = value;
1381    return this;
1382  }
1383
1384  /**
1385   * @return {@link #response} (Information about the message that this message is
1386   *         a response to. Only present if this message is a response.)
1387   */
1388  public MessageHeaderResponseComponent getResponse() {
1389    if (this.response == null)
1390      if (Configuration.errorOnAutoCreate())
1391        throw new Error("Attempt to auto-create MessageHeader.response");
1392      else if (Configuration.doAutoCreate())
1393        this.response = new MessageHeaderResponseComponent(); // cc
1394    return this.response;
1395  }
1396
1397  public boolean hasResponse() {
1398    return this.response != null && !this.response.isEmpty();
1399  }
1400
1401  /**
1402   * @param value {@link #response} (Information about the message that this
1403   *              message is a response to. Only present if this message is a
1404   *              response.)
1405   */
1406  public MessageHeader setResponse(MessageHeaderResponseComponent value) {
1407    this.response = value;
1408    return this;
1409  }
1410
1411  /**
1412   * @return {@link #source} (The source application from which this message
1413   *         originated.)
1414   */
1415  public MessageSourceComponent getSource() {
1416    if (this.source == null)
1417      if (Configuration.errorOnAutoCreate())
1418        throw new Error("Attempt to auto-create MessageHeader.source");
1419      else if (Configuration.doAutoCreate())
1420        this.source = new MessageSourceComponent(); // cc
1421    return this.source;
1422  }
1423
1424  public boolean hasSource() {
1425    return this.source != null && !this.source.isEmpty();
1426  }
1427
1428  /**
1429   * @param value {@link #source} (The source application from which this message
1430   *              originated.)
1431   */
1432  public MessageHeader setSource(MessageSourceComponent value) {
1433    this.source = value;
1434    return this;
1435  }
1436
1437  /**
1438   * @return {@link #destination} (The destination application which the message
1439   *         is intended for.)
1440   */
1441  public List<MessageDestinationComponent> getDestination() {
1442    if (this.destination == null)
1443      this.destination = new ArrayList<MessageDestinationComponent>();
1444    return this.destination;
1445  }
1446
1447  public boolean hasDestination() {
1448    if (this.destination == null)
1449      return false;
1450    for (MessageDestinationComponent item : this.destination)
1451      if (!item.isEmpty())
1452        return true;
1453    return false;
1454  }
1455
1456  /**
1457   * @return {@link #destination} (The destination application which the message
1458   *         is intended for.)
1459   */
1460  // syntactic sugar
1461  public MessageDestinationComponent addDestination() { // 3
1462    MessageDestinationComponent t = new MessageDestinationComponent();
1463    if (this.destination == null)
1464      this.destination = new ArrayList<MessageDestinationComponent>();
1465    this.destination.add(t);
1466    return t;
1467  }
1468
1469  // syntactic sugar
1470  public MessageHeader addDestination(MessageDestinationComponent t) { // 3
1471    if (t == null)
1472      return this;
1473    if (this.destination == null)
1474      this.destination = new ArrayList<MessageDestinationComponent>();
1475    this.destination.add(t);
1476    return this;
1477  }
1478
1479  /**
1480   * @return {@link #enterer} (The person or device that performed the data entry
1481   *         leading to this message. Where there is more than one candidate, pick
1482   *         the most proximal to the message. Can provide other enterers in
1483   *         extensions.)
1484   */
1485  public Reference getEnterer() {
1486    if (this.enterer == null)
1487      if (Configuration.errorOnAutoCreate())
1488        throw new Error("Attempt to auto-create MessageHeader.enterer");
1489      else if (Configuration.doAutoCreate())
1490        this.enterer = new Reference(); // cc
1491    return this.enterer;
1492  }
1493
1494  public boolean hasEnterer() {
1495    return this.enterer != null && !this.enterer.isEmpty();
1496  }
1497
1498  /**
1499   * @param value {@link #enterer} (The person or device that performed the data
1500   *              entry leading to this message. Where there is more than one
1501   *              candidate, pick the most proximal to the message. Can provide
1502   *              other enterers in extensions.)
1503   */
1504  public MessageHeader setEnterer(Reference value) {
1505    this.enterer = value;
1506    return this;
1507  }
1508
1509  /**
1510   * @return {@link #enterer} The actual object that is the target of the
1511   *         reference. The reference library doesn't populate this, but you can
1512   *         use it to hold the resource if you resolve it. (The person or device
1513   *         that performed the data entry leading to this message. Where there is
1514   *         more than one candidate, pick the most proximal to the message. Can
1515   *         provide other enterers in extensions.)
1516   */
1517  public Practitioner getEntererTarget() {
1518    if (this.entererTarget == null)
1519      if (Configuration.errorOnAutoCreate())
1520        throw new Error("Attempt to auto-create MessageHeader.enterer");
1521      else if (Configuration.doAutoCreate())
1522        this.entererTarget = new Practitioner(); // aa
1523    return this.entererTarget;
1524  }
1525
1526  /**
1527   * @param value {@link #enterer} The actual object that is the target of the
1528   *              reference. The reference library doesn't use these, but you can
1529   *              use it to hold the resource if you resolve it. (The person or
1530   *              device that performed the data entry leading to this message.
1531   *              Where there is more than one candidate, pick the most proximal
1532   *              to the message. Can provide other enterers in extensions.)
1533   */
1534  public MessageHeader setEntererTarget(Practitioner value) {
1535    this.entererTarget = value;
1536    return this;
1537  }
1538
1539  /**
1540   * @return {@link #author} (The logical author of the message - the person or
1541   *         device that decided the described event should happen. Where there is
1542   *         more than one candidate, pick the most proximal to the MessageHeader.
1543   *         Can provide other authors in extensions.)
1544   */
1545  public Reference getAuthor() {
1546    if (this.author == null)
1547      if (Configuration.errorOnAutoCreate())
1548        throw new Error("Attempt to auto-create MessageHeader.author");
1549      else if (Configuration.doAutoCreate())
1550        this.author = new Reference(); // cc
1551    return this.author;
1552  }
1553
1554  public boolean hasAuthor() {
1555    return this.author != null && !this.author.isEmpty();
1556  }
1557
1558  /**
1559   * @param value {@link #author} (The logical author of the message - the person
1560   *              or device that decided the described event should happen. Where
1561   *              there is more than one candidate, pick the most proximal to the
1562   *              MessageHeader. Can provide other authors in extensions.)
1563   */
1564  public MessageHeader setAuthor(Reference value) {
1565    this.author = value;
1566    return this;
1567  }
1568
1569  /**
1570   * @return {@link #author} The actual object that is the target of the
1571   *         reference. The reference library doesn't populate this, but you can
1572   *         use it to hold the resource if you resolve it. (The logical author of
1573   *         the message - the person or device that decided the described event
1574   *         should happen. Where there is more than one candidate, pick the most
1575   *         proximal to the MessageHeader. Can provide other authors in
1576   *         extensions.)
1577   */
1578  public Practitioner getAuthorTarget() {
1579    if (this.authorTarget == null)
1580      if (Configuration.errorOnAutoCreate())
1581        throw new Error("Attempt to auto-create MessageHeader.author");
1582      else if (Configuration.doAutoCreate())
1583        this.authorTarget = new Practitioner(); // aa
1584    return this.authorTarget;
1585  }
1586
1587  /**
1588   * @param value {@link #author} The actual object that is the target of the
1589   *              reference. The reference library doesn't use these, but you can
1590   *              use it to hold the resource if you resolve it. (The logical
1591   *              author of the message - the person or device that decided the
1592   *              described event should happen. Where there is more than one
1593   *              candidate, pick the most proximal to the MessageHeader. Can
1594   *              provide other authors in extensions.)
1595   */
1596  public MessageHeader setAuthorTarget(Practitioner value) {
1597    this.authorTarget = value;
1598    return this;
1599  }
1600
1601  /**
1602   * @return {@link #receiver} (Allows data conveyed by a message to be addressed
1603   *         to a particular person or department when routing to a specific
1604   *         application isn't sufficient.)
1605   */
1606  public Reference getReceiver() {
1607    if (this.receiver == null)
1608      if (Configuration.errorOnAutoCreate())
1609        throw new Error("Attempt to auto-create MessageHeader.receiver");
1610      else if (Configuration.doAutoCreate())
1611        this.receiver = new Reference(); // cc
1612    return this.receiver;
1613  }
1614
1615  public boolean hasReceiver() {
1616    return this.receiver != null && !this.receiver.isEmpty();
1617  }
1618
1619  /**
1620   * @param value {@link #receiver} (Allows data conveyed by a message to be
1621   *              addressed to a particular person or department when routing to a
1622   *              specific application isn't sufficient.)
1623   */
1624  public MessageHeader setReceiver(Reference value) {
1625    this.receiver = value;
1626    return this;
1627  }
1628
1629  /**
1630   * @return {@link #receiver} The actual object that is the target of the
1631   *         reference. The reference library doesn't populate this, but you can
1632   *         use it to hold the resource if you resolve it. (Allows data conveyed
1633   *         by a message to be addressed to a particular person or department
1634   *         when routing to a specific application isn't sufficient.)
1635   */
1636  public Resource getReceiverTarget() {
1637    return this.receiverTarget;
1638  }
1639
1640  /**
1641   * @param value {@link #receiver} The actual object that is the target of the
1642   *              reference. The reference library doesn't use these, but you can
1643   *              use it to hold the resource if you resolve it. (Allows data
1644   *              conveyed by a message to be addressed to a particular person or
1645   *              department when routing to a specific application isn't
1646   *              sufficient.)
1647   */
1648  public MessageHeader setReceiverTarget(Resource value) {
1649    this.receiverTarget = value;
1650    return this;
1651  }
1652
1653  /**
1654   * @return {@link #responsible} (The person or organization that accepts overall
1655   *         responsibility for the contents of the message. The implication is
1656   *         that the message event happened under the policies of the responsible
1657   *         party.)
1658   */
1659  public Reference getResponsible() {
1660    if (this.responsible == null)
1661      if (Configuration.errorOnAutoCreate())
1662        throw new Error("Attempt to auto-create MessageHeader.responsible");
1663      else if (Configuration.doAutoCreate())
1664        this.responsible = new Reference(); // cc
1665    return this.responsible;
1666  }
1667
1668  public boolean hasResponsible() {
1669    return this.responsible != null && !this.responsible.isEmpty();
1670  }
1671
1672  /**
1673   * @param value {@link #responsible} (The person or organization that accepts
1674   *              overall responsibility for the contents of the message. The
1675   *              implication is that the message event happened under the
1676   *              policies of the responsible party.)
1677   */
1678  public MessageHeader setResponsible(Reference value) {
1679    this.responsible = value;
1680    return this;
1681  }
1682
1683  /**
1684   * @return {@link #responsible} The actual object that is the target of the
1685   *         reference. The reference library doesn't populate this, but you can
1686   *         use it to hold the resource if you resolve it. (The person or
1687   *         organization that accepts overall responsibility for the contents of
1688   *         the message. The implication is that the message event happened under
1689   *         the policies of the responsible party.)
1690   */
1691  public Resource getResponsibleTarget() {
1692    return this.responsibleTarget;
1693  }
1694
1695  /**
1696   * @param value {@link #responsible} The actual object that is the target of the
1697   *              reference. The reference library doesn't use these, but you can
1698   *              use it to hold the resource if you resolve it. (The person or
1699   *              organization that accepts overall responsibility for the
1700   *              contents of the message. The implication is that the message
1701   *              event happened under the policies of the responsible party.)
1702   */
1703  public MessageHeader setResponsibleTarget(Resource value) {
1704    this.responsibleTarget = value;
1705    return this;
1706  }
1707
1708  /**
1709   * @return {@link #reason} (Coded indication of the cause for the event -
1710   *         indicates a reason for the occurrence of the event that is a focus of
1711   *         this message.)
1712   */
1713  public CodeableConcept getReason() {
1714    if (this.reason == null)
1715      if (Configuration.errorOnAutoCreate())
1716        throw new Error("Attempt to auto-create MessageHeader.reason");
1717      else if (Configuration.doAutoCreate())
1718        this.reason = new CodeableConcept(); // cc
1719    return this.reason;
1720  }
1721
1722  public boolean hasReason() {
1723    return this.reason != null && !this.reason.isEmpty();
1724  }
1725
1726  /**
1727   * @param value {@link #reason} (Coded indication of the cause for the event -
1728   *              indicates a reason for the occurrence of the event that is a
1729   *              focus of this message.)
1730   */
1731  public MessageHeader setReason(CodeableConcept value) {
1732    this.reason = value;
1733    return this;
1734  }
1735
1736  /**
1737   * @return {@link #data} (The actual data of the message - a reference to the
1738   *         root/focus class of the event.)
1739   */
1740  public List<Reference> getData() {
1741    if (this.data == null)
1742      this.data = new ArrayList<Reference>();
1743    return this.data;
1744  }
1745
1746  public boolean hasData() {
1747    if (this.data == null)
1748      return false;
1749    for (Reference item : this.data)
1750      if (!item.isEmpty())
1751        return true;
1752    return false;
1753  }
1754
1755  /**
1756   * @return {@link #data} (The actual data of the message - a reference to the
1757   *         root/focus class of the event.)
1758   */
1759  // syntactic sugar
1760  public Reference addData() { // 3
1761    Reference t = new Reference();
1762    if (this.data == null)
1763      this.data = new ArrayList<Reference>();
1764    this.data.add(t);
1765    return t;
1766  }
1767
1768  // syntactic sugar
1769  public MessageHeader addData(Reference t) { // 3
1770    if (t == null)
1771      return this;
1772    if (this.data == null)
1773      this.data = new ArrayList<Reference>();
1774    this.data.add(t);
1775    return this;
1776  }
1777
1778  /**
1779   * @return {@link #data} (The actual objects that are the target of the
1780   *         reference. The reference library doesn't populate this, but you can
1781   *         use this to hold the resources if you resolvethemt. The actual data
1782   *         of the message - a reference to the root/focus class of the event.)
1783   */
1784  public List<Resource> getDataTarget() {
1785    if (this.dataTarget == null)
1786      this.dataTarget = new ArrayList<Resource>();
1787    return this.dataTarget;
1788  }
1789
1790  protected void listChildren(List<Property> childrenList) {
1791    super.listChildren(childrenList);
1792    childrenList.add(new Property("timestamp", "instant", "The time that the message was sent.", 0,
1793        java.lang.Integer.MAX_VALUE, timestamp));
1794    childrenList.add(new Property("event", "Coding",
1795        "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://hl7.org/fhir/message-events\".",
1796        0, java.lang.Integer.MAX_VALUE, event));
1797    childrenList.add(new Property("response", "",
1798        "Information about the message that this message is a response to.  Only present if this message is a response.",
1799        0, java.lang.Integer.MAX_VALUE, response));
1800    childrenList.add(new Property("source", "", "The source application from which this message originated.", 0,
1801        java.lang.Integer.MAX_VALUE, source));
1802    childrenList.add(new Property("destination", "", "The destination application which the message is intended for.",
1803        0, java.lang.Integer.MAX_VALUE, destination));
1804    childrenList.add(new Property("enterer", "Reference(Practitioner)",
1805        "The person or device that performed the data entry leading to this message. Where there is more than one candidate, pick the most proximal to the message. Can provide other enterers in extensions.",
1806        0, java.lang.Integer.MAX_VALUE, enterer));
1807    childrenList.add(new Property("author", "Reference(Practitioner)",
1808        "The logical author of the message - the person or device that decided the described event should happen. Where there is more than one candidate, pick the most proximal to the MessageHeader. Can provide other authors in extensions.",
1809        0, java.lang.Integer.MAX_VALUE, author));
1810    childrenList.add(new Property("receiver", "Reference(Practitioner|Organization)",
1811        "Allows data conveyed by a message to be addressed to a particular person or department when routing to a specific application isn't sufficient.",
1812        0, java.lang.Integer.MAX_VALUE, receiver));
1813    childrenList.add(new Property("responsible", "Reference(Practitioner|Organization)",
1814        "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.",
1815        0, java.lang.Integer.MAX_VALUE, responsible));
1816    childrenList.add(new Property("reason", "CodeableConcept",
1817        "Coded indication of the cause for the event - indicates  a reason for the occurrence of the event that is a focus of this message.",
1818        0, java.lang.Integer.MAX_VALUE, reason));
1819    childrenList.add(new Property("data", "Reference(Any)",
1820        "The actual data of the message - a reference to the root/focus class of the event.", 0,
1821        java.lang.Integer.MAX_VALUE, data));
1822  }
1823
1824  @Override
1825  public void setProperty(String name, Base value) throws FHIRException {
1826    if (name.equals("timestamp"))
1827      this.timestamp = castToInstant(value); // InstantType
1828    else if (name.equals("event"))
1829      this.event = castToCoding(value); // Coding
1830    else if (name.equals("response"))
1831      this.response = (MessageHeaderResponseComponent) value; // MessageHeaderResponseComponent
1832    else if (name.equals("source"))
1833      this.source = (MessageSourceComponent) value; // MessageSourceComponent
1834    else if (name.equals("destination"))
1835      this.getDestination().add((MessageDestinationComponent) value);
1836    else if (name.equals("enterer"))
1837      this.enterer = castToReference(value); // Reference
1838    else if (name.equals("author"))
1839      this.author = castToReference(value); // Reference
1840    else if (name.equals("receiver"))
1841      this.receiver = castToReference(value); // Reference
1842    else if (name.equals("responsible"))
1843      this.responsible = castToReference(value); // Reference
1844    else if (name.equals("reason"))
1845      this.reason = castToCodeableConcept(value); // CodeableConcept
1846    else if (name.equals("data"))
1847      this.getData().add(castToReference(value));
1848    else
1849      super.setProperty(name, value);
1850  }
1851
1852  @Override
1853  public Base addChild(String name) throws FHIRException {
1854    if (name.equals("timestamp")) {
1855      throw new FHIRException("Cannot call addChild on a singleton property MessageHeader.timestamp");
1856    } else if (name.equals("event")) {
1857      this.event = new Coding();
1858      return this.event;
1859    } else if (name.equals("response")) {
1860      this.response = new MessageHeaderResponseComponent();
1861      return this.response;
1862    } else if (name.equals("source")) {
1863      this.source = new MessageSourceComponent();
1864      return this.source;
1865    } else if (name.equals("destination")) {
1866      return addDestination();
1867    } else if (name.equals("enterer")) {
1868      this.enterer = new Reference();
1869      return this.enterer;
1870    } else if (name.equals("author")) {
1871      this.author = new Reference();
1872      return this.author;
1873    } else if (name.equals("receiver")) {
1874      this.receiver = new Reference();
1875      return this.receiver;
1876    } else if (name.equals("responsible")) {
1877      this.responsible = new Reference();
1878      return this.responsible;
1879    } else if (name.equals("reason")) {
1880      this.reason = new CodeableConcept();
1881      return this.reason;
1882    } else if (name.equals("data")) {
1883      return addData();
1884    } else
1885      return super.addChild(name);
1886  }
1887
1888  public String fhirType() {
1889    return "MessageHeader";
1890
1891  }
1892
1893  public MessageHeader copy() {
1894    MessageHeader dst = new MessageHeader();
1895    copyValues(dst);
1896    dst.timestamp = timestamp == null ? null : timestamp.copy();
1897    dst.event = event == null ? null : event.copy();
1898    dst.response = response == null ? null : response.copy();
1899    dst.source = source == null ? null : source.copy();
1900    if (destination != null) {
1901      dst.destination = new ArrayList<MessageDestinationComponent>();
1902      for (MessageDestinationComponent i : destination)
1903        dst.destination.add(i.copy());
1904    }
1905    ;
1906    dst.enterer = enterer == null ? null : enterer.copy();
1907    dst.author = author == null ? null : author.copy();
1908    dst.receiver = receiver == null ? null : receiver.copy();
1909    dst.responsible = responsible == null ? null : responsible.copy();
1910    dst.reason = reason == null ? null : reason.copy();
1911    if (data != null) {
1912      dst.data = new ArrayList<Reference>();
1913      for (Reference i : data)
1914        dst.data.add(i.copy());
1915    }
1916    ;
1917    return dst;
1918  }
1919
1920  protected MessageHeader typedCopy() {
1921    return copy();
1922  }
1923
1924  @Override
1925  public boolean equalsDeep(Base other) {
1926    if (!super.equalsDeep(other))
1927      return false;
1928    if (!(other instanceof MessageHeader))
1929      return false;
1930    MessageHeader o = (MessageHeader) other;
1931    return compareDeep(timestamp, o.timestamp, true) && compareDeep(event, o.event, true)
1932        && compareDeep(response, o.response, true) && compareDeep(source, o.source, true)
1933        && compareDeep(destination, o.destination, true) && compareDeep(enterer, o.enterer, true)
1934        && compareDeep(author, o.author, true) && compareDeep(receiver, o.receiver, true)
1935        && compareDeep(responsible, o.responsible, true) && compareDeep(reason, o.reason, true)
1936        && compareDeep(data, o.data, true);
1937  }
1938
1939  @Override
1940  public boolean equalsShallow(Base other) {
1941    if (!super.equalsShallow(other))
1942      return false;
1943    if (!(other instanceof MessageHeader))
1944      return false;
1945    MessageHeader o = (MessageHeader) other;
1946    return compareValues(timestamp, o.timestamp, true);
1947  }
1948
1949  public boolean isEmpty() {
1950    return super.isEmpty() && (timestamp == null || timestamp.isEmpty()) && (event == null || event.isEmpty())
1951        && (response == null || response.isEmpty()) && (source == null || source.isEmpty())
1952        && (destination == null || destination.isEmpty()) && (enterer == null || enterer.isEmpty())
1953        && (author == null || author.isEmpty()) && (receiver == null || receiver.isEmpty())
1954        && (responsible == null || responsible.isEmpty()) && (reason == null || reason.isEmpty())
1955        && (data == null || data.isEmpty());
1956  }
1957
1958  @Override
1959  public ResourceType getResourceType() {
1960    return ResourceType.MessageHeader;
1961  }
1962
1963  @SearchParamDefinition(name = "code", path = "MessageHeader.response.code", description = "ok | transient-error | fatal-error", type = "token")
1964  public static final String SP_CODE = "code";
1965  @SearchParamDefinition(name = "data", path = "MessageHeader.data", description = "The actual content of the message", type = "reference")
1966  public static final String SP_DATA = "data";
1967  @SearchParamDefinition(name = "receiver", path = "MessageHeader.receiver", description = "Intended \"real-world\" recipient for the data", type = "reference")
1968  public static final String SP_RECEIVER = "receiver";
1969  @SearchParamDefinition(name = "author", path = "MessageHeader.author", description = "The source of the decision", type = "reference")
1970  public static final String SP_AUTHOR = "author";
1971  @SearchParamDefinition(name = "destination", path = "MessageHeader.destination.name", description = "Name of system", type = "string")
1972  public static final String SP_DESTINATION = "destination";
1973  @SearchParamDefinition(name = "source", path = "MessageHeader.source.name", description = "Name of system", type = "string")
1974  public static final String SP_SOURCE = "source";
1975  @SearchParamDefinition(name = "target", path = "MessageHeader.destination.target", description = "Particular delivery destination within the destination", type = "reference")
1976  public static final String SP_TARGET = "target";
1977  @SearchParamDefinition(name = "destination-uri", path = "MessageHeader.destination.endpoint", description = "Actual destination address or id", type = "uri")
1978  public static final String SP_DESTINATIONURI = "destination-uri";
1979  @SearchParamDefinition(name = "source-uri", path = "MessageHeader.source.endpoint", description = "Actual message source address or id", type = "uri")
1980  public static final String SP_SOURCEURI = "source-uri";
1981  @SearchParamDefinition(name = "responsible", path = "MessageHeader.responsible", description = "Final responsibility for event", type = "reference")
1982  public static final String SP_RESPONSIBLE = "responsible";
1983  @SearchParamDefinition(name = "response-id", path = "MessageHeader.response.identifier", description = "Id of original message", type = "token")
1984  public static final String SP_RESPONSEID = "response-id";
1985  @SearchParamDefinition(name = "enterer", path = "MessageHeader.enterer", description = "The source of the data entry", type = "reference")
1986  public static final String SP_ENTERER = "enterer";
1987  @SearchParamDefinition(name = "event", path = "MessageHeader.event", description = "Code for the event this message represents", type = "token")
1988  public static final String SP_EVENT = "event";
1989  @SearchParamDefinition(name = "timestamp", path = "MessageHeader.timestamp", description = "Time that the message was sent", type = "date")
1990  public static final String SP_TIMESTAMP = "timestamp";
1991
1992}