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