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