001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import org.hl7.fhir.r4.model.Enumerations.*;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.DatatypeDef;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * A signature along with supporting context. The signature may be a digital signature that is cryptographic in nature, or some other signature acceptable to the domain. This other signature may be as simple as a graphical image representing a hand-written signature, or a signature ceremony Different signature approaches have different utilities.
050 */
051@DatatypeDef(name="Signature")
052public class Signature extends Type implements ICompositeType {
053
054    /**
055     * An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.
056     */
057    @Child(name = "type", type = {Coding.class}, order=0, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
058    @Description(shortDefinition="Indication of the reason the entity signed the object(s)", formalDefinition="An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document." )
059    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/signature-type")
060    protected List<Coding> type;
061
062    /**
063     * When the digital signature was signed.
064     */
065    @Child(name = "when", type = {InstantType.class}, order=1, min=1, max=1, modifier=false, summary=true)
066    @Description(shortDefinition="When the signature was created", formalDefinition="When the digital signature was signed." )
067    protected InstantType when;
068
069    /**
070     * A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).
071     */
072    @Child(name = "who", type = {Practitioner.class, PractitionerRole.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=2, min=1, max=1, modifier=false, summary=true)
073    @Description(shortDefinition="Who signed", formalDefinition="A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key)." )
074    protected Reference who;
075
076    /**
077     * The actual object that is the target of the reference (A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).)
078     */
079    protected Resource whoTarget;
080
081    /**
082     * A reference to an application-usable description of the identity that is represented by the signature.
083     */
084    @Child(name = "onBehalfOf", type = {Practitioner.class, PractitionerRole.class, RelatedPerson.class, Patient.class, Device.class, Organization.class}, order=3, min=0, max=1, modifier=false, summary=true)
085    @Description(shortDefinition="The party represented", formalDefinition="A reference to an application-usable description of the identity that is represented by the signature." )
086    protected Reference onBehalfOf;
087
088    /**
089     * The actual object that is the target of the reference (A reference to an application-usable description of the identity that is represented by the signature.)
090     */
091    protected Resource onBehalfOfTarget;
092
093    /**
094     * A mime type that indicates the technical format of the target resources signed by the signature.
095     */
096    @Child(name = "targetFormat", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=false)
097    @Description(shortDefinition="The technical format of the signed resources", formalDefinition="A mime type that indicates the technical format of the target resources signed by the signature." )
098    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
099    protected CodeType targetFormat;
100
101    /**
102     * A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.
103     */
104    @Child(name = "sigFormat", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
105    @Description(shortDefinition="The technical format of the signature", formalDefinition="A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc." )
106    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
107    protected CodeType sigFormat;
108
109    /**
110     * The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.
111     */
112    @Child(name = "data", type = {Base64BinaryType.class}, order=6, min=0, max=1, modifier=false, summary=false)
113    @Description(shortDefinition="The actual signature content (XML DigSig. JWS, picture, etc.)", formalDefinition="The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty." )
114    protected Base64BinaryType data;
115
116    private static final long serialVersionUID = 1587325823L;
117
118  /**
119   * Constructor
120   */
121    public Signature() {
122      super();
123    }
124
125  /**
126   * Constructor
127   */
128    public Signature(InstantType when, Reference who) {
129      super();
130      this.when = when;
131      this.who = who;
132    }
133
134    /**
135     * @return {@link #type} (An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.)
136     */
137    public List<Coding> getType() { 
138      if (this.type == null)
139        this.type = new ArrayList<Coding>();
140      return this.type;
141    }
142
143    /**
144     * @return Returns a reference to <code>this</code> for easy method chaining
145     */
146    public Signature setType(List<Coding> theType) { 
147      this.type = theType;
148      return this;
149    }
150
151    public boolean hasType() { 
152      if (this.type == null)
153        return false;
154      for (Coding item : this.type)
155        if (!item.isEmpty())
156          return true;
157      return false;
158    }
159
160    public Coding addType() { //3
161      Coding t = new Coding();
162      if (this.type == null)
163        this.type = new ArrayList<Coding>();
164      this.type.add(t);
165      return t;
166    }
167
168    public Signature addType(Coding t) { //3
169      if (t == null)
170        return this;
171      if (this.type == null)
172        this.type = new ArrayList<Coding>();
173      this.type.add(t);
174      return this;
175    }
176
177    /**
178     * @return The first repetition of repeating field {@link #type}, creating it if it does not already exist
179     */
180    public Coding getTypeFirstRep() { 
181      if (getType().isEmpty()) {
182        addType();
183      }
184      return getType().get(0);
185    }
186
187    /**
188     * @return {@link #when} (When the digital signature was signed.). This is the underlying object with id, value and extensions. The accessor "getWhen" gives direct access to the value
189     */
190    public InstantType getWhenElement() { 
191      if (this.when == null)
192        if (Configuration.errorOnAutoCreate())
193          throw new Error("Attempt to auto-create Signature.when");
194        else if (Configuration.doAutoCreate())
195          this.when = new InstantType(); // bb
196      return this.when;
197    }
198
199    public boolean hasWhenElement() { 
200      return this.when != null && !this.when.isEmpty();
201    }
202
203    public boolean hasWhen() { 
204      return this.when != null && !this.when.isEmpty();
205    }
206
207    /**
208     * @param value {@link #when} (When the digital signature was signed.). This is the underlying object with id, value and extensions. The accessor "getWhen" gives direct access to the value
209     */
210    public Signature setWhenElement(InstantType value) { 
211      this.when = value;
212      return this;
213    }
214
215    /**
216     * @return When the digital signature was signed.
217     */
218    public Date getWhen() { 
219      return this.when == null ? null : this.when.getValue();
220    }
221
222    /**
223     * @param value When the digital signature was signed.
224     */
225    public Signature setWhen(Date value) { 
226        if (this.when == null)
227          this.when = new InstantType();
228        this.when.setValue(value);
229      return this;
230    }
231
232    /**
233     * @return {@link #who} (A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).)
234     */
235    public Reference getWho() { 
236      if (this.who == null)
237        if (Configuration.errorOnAutoCreate())
238          throw new Error("Attempt to auto-create Signature.who");
239        else if (Configuration.doAutoCreate())
240          this.who = new Reference(); // cc
241      return this.who;
242    }
243
244    public boolean hasWho() { 
245      return this.who != null && !this.who.isEmpty();
246    }
247
248    /**
249     * @param value {@link #who} (A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).)
250     */
251    public Signature setWho(Reference value) { 
252      this.who = value;
253      return this;
254    }
255
256    /**
257     * @return {@link #who} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).)
258     */
259    public Resource getWhoTarget() { 
260      return this.whoTarget;
261    }
262
263    /**
264     * @param value {@link #who} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).)
265     */
266    public Signature setWhoTarget(Resource value) { 
267      this.whoTarget = value;
268      return this;
269    }
270
271    /**
272     * @return {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.)
273     */
274    public Reference getOnBehalfOf() { 
275      if (this.onBehalfOf == null)
276        if (Configuration.errorOnAutoCreate())
277          throw new Error("Attempt to auto-create Signature.onBehalfOf");
278        else if (Configuration.doAutoCreate())
279          this.onBehalfOf = new Reference(); // cc
280      return this.onBehalfOf;
281    }
282
283    public boolean hasOnBehalfOf() { 
284      return this.onBehalfOf != null && !this.onBehalfOf.isEmpty();
285    }
286
287    /**
288     * @param value {@link #onBehalfOf} (A reference to an application-usable description of the identity that is represented by the signature.)
289     */
290    public Signature setOnBehalfOf(Reference value) { 
291      this.onBehalfOf = value;
292      return this;
293    }
294
295    /**
296     * @return {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that is represented by the signature.)
297     */
298    public Resource getOnBehalfOfTarget() { 
299      return this.onBehalfOfTarget;
300    }
301
302    /**
303     * @param value {@link #onBehalfOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to an application-usable description of the identity that is represented by the signature.)
304     */
305    public Signature setOnBehalfOfTarget(Resource value) { 
306      this.onBehalfOfTarget = value;
307      return this;
308    }
309
310    /**
311     * @return {@link #targetFormat} (A mime type that indicates the technical format of the target resources signed by the signature.). This is the underlying object with id, value and extensions. The accessor "getTargetFormat" gives direct access to the value
312     */
313    public CodeType getTargetFormatElement() { 
314      if (this.targetFormat == null)
315        if (Configuration.errorOnAutoCreate())
316          throw new Error("Attempt to auto-create Signature.targetFormat");
317        else if (Configuration.doAutoCreate())
318          this.targetFormat = new CodeType(); // bb
319      return this.targetFormat;
320    }
321
322    public boolean hasTargetFormatElement() { 
323      return this.targetFormat != null && !this.targetFormat.isEmpty();
324    }
325
326    public boolean hasTargetFormat() { 
327      return this.targetFormat != null && !this.targetFormat.isEmpty();
328    }
329
330    /**
331     * @param value {@link #targetFormat} (A mime type that indicates the technical format of the target resources signed by the signature.). This is the underlying object with id, value and extensions. The accessor "getTargetFormat" gives direct access to the value
332     */
333    public Signature setTargetFormatElement(CodeType value) { 
334      this.targetFormat = value;
335      return this;
336    }
337
338    /**
339     * @return A mime type that indicates the technical format of the target resources signed by the signature.
340     */
341    public String getTargetFormat() { 
342      return this.targetFormat == null ? null : this.targetFormat.getValue();
343    }
344
345    /**
346     * @param value A mime type that indicates the technical format of the target resources signed by the signature.
347     */
348    public Signature setTargetFormat(String value) { 
349      if (Utilities.noString(value))
350        this.targetFormat = null;
351      else {
352        if (this.targetFormat == null)
353          this.targetFormat = new CodeType();
354        this.targetFormat.setValue(value);
355      }
356      return this;
357    }
358
359    /**
360     * @return {@link #sigFormat} (A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.). This is the underlying object with id, value and extensions. The accessor "getSigFormat" gives direct access to the value
361     */
362    public CodeType getSigFormatElement() { 
363      if (this.sigFormat == null)
364        if (Configuration.errorOnAutoCreate())
365          throw new Error("Attempt to auto-create Signature.sigFormat");
366        else if (Configuration.doAutoCreate())
367          this.sigFormat = new CodeType(); // bb
368      return this.sigFormat;
369    }
370
371    public boolean hasSigFormatElement() { 
372      return this.sigFormat != null && !this.sigFormat.isEmpty();
373    }
374
375    public boolean hasSigFormat() { 
376      return this.sigFormat != null && !this.sigFormat.isEmpty();
377    }
378
379    /**
380     * @param value {@link #sigFormat} (A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.). This is the underlying object with id, value and extensions. The accessor "getSigFormat" gives direct access to the value
381     */
382    public Signature setSigFormatElement(CodeType value) { 
383      this.sigFormat = value;
384      return this;
385    }
386
387    /**
388     * @return A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.
389     */
390    public String getSigFormat() { 
391      return this.sigFormat == null ? null : this.sigFormat.getValue();
392    }
393
394    /**
395     * @param value A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.
396     */
397    public Signature setSigFormat(String value) { 
398      if (Utilities.noString(value))
399        this.sigFormat = null;
400      else {
401        if (this.sigFormat == null)
402          this.sigFormat = new CodeType();
403        this.sigFormat.setValue(value);
404      }
405      return this;
406    }
407
408    /**
409     * @return {@link #data} (The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
410     */
411    public Base64BinaryType getDataElement() { 
412      if (this.data == null)
413        if (Configuration.errorOnAutoCreate())
414          throw new Error("Attempt to auto-create Signature.data");
415        else if (Configuration.doAutoCreate())
416          this.data = new Base64BinaryType(); // bb
417      return this.data;
418    }
419
420    public boolean hasDataElement() { 
421      return this.data != null && !this.data.isEmpty();
422    }
423
424    public boolean hasData() { 
425      return this.data != null && !this.data.isEmpty();
426    }
427
428    /**
429     * @param value {@link #data} (The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
430     */
431    public Signature setDataElement(Base64BinaryType value) { 
432      this.data = value;
433      return this;
434    }
435
436    /**
437     * @return The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.
438     */
439    public byte[] getData() { 
440      return this.data == null ? null : this.data.getValue();
441    }
442
443    /**
444     * @param value The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.
445     */
446    public Signature setData(byte[] value) { 
447      if (value == null)
448        this.data = null;
449      else {
450        if (this.data == null)
451          this.data = new Base64BinaryType();
452        this.data.setValue(value);
453      }
454      return this;
455    }
456
457      protected void listChildren(List<Property> children) {
458        super.listChildren(children);
459        children.add(new Property("type", "Coding", "An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.", 0, java.lang.Integer.MAX_VALUE, type));
460        children.add(new Property("when", "instant", "When the digital signature was signed.", 0, 1, when));
461        children.add(new Property("who", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).", 0, 1, who));
462        children.add(new Property("onBehalfOf", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf));
463        children.add(new Property("targetFormat", "code", "A mime type that indicates the technical format of the target resources signed by the signature.", 0, 1, targetFormat));
464        children.add(new Property("sigFormat", "code", "A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.", 0, 1, sigFormat));
465        children.add(new Property("data", "base64Binary", "The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.", 0, 1, data));
466      }
467
468      @Override
469      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
470        switch (_hash) {
471        case 3575610: /*type*/  return new Property("type", "Coding", "An indication of the reason that the entity signed this document. This may be explicitly included as part of the signature information and can be used when determining accountability for various actions concerning the document.", 0, java.lang.Integer.MAX_VALUE, type);
472        case 3648314: /*when*/  return new Property("when", "instant", "When the digital signature was signed.", 0, 1, when);
473        case 117694: /*who*/  return new Property("who", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that signed  (e.g. the signature used their private key).", 0, 1, who);
474        case -14402964: /*onBehalfOf*/  return new Property("onBehalfOf", "Reference(Practitioner|PractitionerRole|RelatedPerson|Patient|Device|Organization)", "A reference to an application-usable description of the identity that is represented by the signature.", 0, 1, onBehalfOf);
475        case -917363480: /*targetFormat*/  return new Property("targetFormat", "code", "A mime type that indicates the technical format of the target resources signed by the signature.", 0, 1, targetFormat);
476        case -58720216: /*sigFormat*/  return new Property("sigFormat", "code", "A mime type that indicates the technical format of the signature. Important mime types are application/signature+xml for X ML DigSig, application/jose for JWS, and image/* for a graphical image of a signature, etc.", 0, 1, sigFormat);
477        case 3076010: /*data*/  return new Property("data", "base64Binary", "The base64 encoding of the Signature content. When signature is not recorded electronically this element would be empty.", 0, 1, data);
478        default: return super.getNamedProperty(_hash, _name, _checkValid);
479        }
480
481      }
482
483      @Override
484      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
485        switch (hash) {
486        case 3575610: /*type*/ return this.type == null ? new Base[0] : this.type.toArray(new Base[this.type.size()]); // Coding
487        case 3648314: /*when*/ return this.when == null ? new Base[0] : new Base[] {this.when}; // InstantType
488        case 117694: /*who*/ return this.who == null ? new Base[0] : new Base[] {this.who}; // Reference
489        case -14402964: /*onBehalfOf*/ return this.onBehalfOf == null ? new Base[0] : new Base[] {this.onBehalfOf}; // Reference
490        case -917363480: /*targetFormat*/ return this.targetFormat == null ? new Base[0] : new Base[] {this.targetFormat}; // CodeType
491        case -58720216: /*sigFormat*/ return this.sigFormat == null ? new Base[0] : new Base[] {this.sigFormat}; // CodeType
492        case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // Base64BinaryType
493        default: return super.getProperty(hash, name, checkValid);
494        }
495
496      }
497
498      @Override
499      public Base setProperty(int hash, String name, Base value) throws FHIRException {
500        switch (hash) {
501        case 3575610: // type
502          this.getType().add(castToCoding(value)); // Coding
503          return value;
504        case 3648314: // when
505          this.when = castToInstant(value); // InstantType
506          return value;
507        case 117694: // who
508          this.who = castToReference(value); // Reference
509          return value;
510        case -14402964: // onBehalfOf
511          this.onBehalfOf = castToReference(value); // Reference
512          return value;
513        case -917363480: // targetFormat
514          this.targetFormat = castToCode(value); // CodeType
515          return value;
516        case -58720216: // sigFormat
517          this.sigFormat = castToCode(value); // CodeType
518          return value;
519        case 3076010: // data
520          this.data = castToBase64Binary(value); // Base64BinaryType
521          return value;
522        default: return super.setProperty(hash, name, value);
523        }
524
525      }
526
527      @Override
528      public Base setProperty(String name, Base value) throws FHIRException {
529        if (name.equals("type")) {
530          this.getType().add(castToCoding(value));
531        } else if (name.equals("when")) {
532          this.when = castToInstant(value); // InstantType
533        } else if (name.equals("who")) {
534          this.who = castToReference(value); // Reference
535        } else if (name.equals("onBehalfOf")) {
536          this.onBehalfOf = castToReference(value); // Reference
537        } else if (name.equals("targetFormat")) {
538          this.targetFormat = castToCode(value); // CodeType
539        } else if (name.equals("sigFormat")) {
540          this.sigFormat = castToCode(value); // CodeType
541        } else if (name.equals("data")) {
542          this.data = castToBase64Binary(value); // Base64BinaryType
543        } else
544          return super.setProperty(name, value);
545        return value;
546      }
547
548      @Override
549      public Base makeProperty(int hash, String name) throws FHIRException {
550        switch (hash) {
551        case 3575610:  return addType(); 
552        case 3648314:  return getWhenElement();
553        case 117694:  return getWho(); 
554        case -14402964:  return getOnBehalfOf(); 
555        case -917363480:  return getTargetFormatElement();
556        case -58720216:  return getSigFormatElement();
557        case 3076010:  return getDataElement();
558        default: return super.makeProperty(hash, name);
559        }
560
561      }
562
563      @Override
564      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
565        switch (hash) {
566        case 3575610: /*type*/ return new String[] {"Coding"};
567        case 3648314: /*when*/ return new String[] {"instant"};
568        case 117694: /*who*/ return new String[] {"Reference"};
569        case -14402964: /*onBehalfOf*/ return new String[] {"Reference"};
570        case -917363480: /*targetFormat*/ return new String[] {"code"};
571        case -58720216: /*sigFormat*/ return new String[] {"code"};
572        case 3076010: /*data*/ return new String[] {"base64Binary"};
573        default: return super.getTypesForProperty(hash, name);
574        }
575
576      }
577
578      @Override
579      public Base addChild(String name) throws FHIRException {
580        if (name.equals("type")) {
581          return addType();
582        }
583        else if (name.equals("when")) {
584          throw new FHIRException("Cannot call addChild on a primitive type Signature.when");
585        }
586        else if (name.equals("who")) {
587          this.who = new Reference();
588          return this.who;
589        }
590        else if (name.equals("onBehalfOf")) {
591          this.onBehalfOf = new Reference();
592          return this.onBehalfOf;
593        }
594        else if (name.equals("targetFormat")) {
595          throw new FHIRException("Cannot call addChild on a primitive type Signature.targetFormat");
596        }
597        else if (name.equals("sigFormat")) {
598          throw new FHIRException("Cannot call addChild on a primitive type Signature.sigFormat");
599        }
600        else if (name.equals("data")) {
601          throw new FHIRException("Cannot call addChild on a primitive type Signature.data");
602        }
603        else
604          return super.addChild(name);
605      }
606
607  public String fhirType() {
608    return "Signature";
609
610  }
611
612      public Signature copy() {
613        Signature dst = new Signature();
614        copyValues(dst);
615        return dst;
616      }
617
618      public void copyValues(Signature dst) {
619        super.copyValues(dst);
620        if (type != null) {
621          dst.type = new ArrayList<Coding>();
622          for (Coding i : type)
623            dst.type.add(i.copy());
624        };
625        dst.when = when == null ? null : when.copy();
626        dst.who = who == null ? null : who.copy();
627        dst.onBehalfOf = onBehalfOf == null ? null : onBehalfOf.copy();
628        dst.targetFormat = targetFormat == null ? null : targetFormat.copy();
629        dst.sigFormat = sigFormat == null ? null : sigFormat.copy();
630        dst.data = data == null ? null : data.copy();
631      }
632
633      protected Signature typedCopy() {
634        return copy();
635      }
636
637      @Override
638      public boolean equalsDeep(Base other_) {
639        if (!super.equalsDeep(other_))
640          return false;
641        if (!(other_ instanceof Signature))
642          return false;
643        Signature o = (Signature) other_;
644        return compareDeep(type, o.type, true) && compareDeep(when, o.when, true) && compareDeep(who, o.who, true)
645           && compareDeep(onBehalfOf, o.onBehalfOf, true) && compareDeep(targetFormat, o.targetFormat, true)
646           && compareDeep(sigFormat, o.sigFormat, true) && compareDeep(data, o.data, true);
647      }
648
649      @Override
650      public boolean equalsShallow(Base other_) {
651        if (!super.equalsShallow(other_))
652          return false;
653        if (!(other_ instanceof Signature))
654          return false;
655        Signature o = (Signature) other_;
656        return compareValues(when, o.when, true) && compareValues(targetFormat, o.targetFormat, true) && compareValues(sigFormat, o.sigFormat, true)
657           && compareValues(data, o.data, true);
658      }
659
660      public boolean isEmpty() {
661        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, when, who, onBehalfOf
662          , targetFormat, sigFormat, data);
663      }
664
665
666}