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