001package org.hl7.fhir.r5.openehr;
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 Thu, Mar 23, 2023 19:59+1100 for FHIR v5.0.0
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.openehr.Enumerations.*;
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.r5.model.*;
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 * 
050 */
051@DatatypeDef(name="Annotations")
052public class Annotations extends LogicalBase implements ICompositeType {
053
054    /**
055     * 
056     */
057    @Child(name = "comment", type = {StringType.class}, order=0, min=0, max=1, modifier=false, summary=false)
058    @Description(shortDefinition="todo", formalDefinition="" )
059    protected StringType comment;
060
061    /**
062     * 
063     */
064    @Child(name = "fhir_mapping", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=false)
065    @Description(shortDefinition="todo", formalDefinition="" )
066    protected StringType fhir_mapping;
067
068    /**
069     * 
070     */
071    @Child(name = "vset_description", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=false)
072    @Description(shortDefinition="todo", formalDefinition="" )
073    protected StringType vset_description;
074
075    /**
076     * 
077     */
078    @Child(name = "hl7v2_mapping", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
079    @Description(shortDefinition="todo", formalDefinition="" )
080    protected StringType hl7v2_mapping;
081
082    /**
083     * 
084     */
085    @Child(name = "visibleInView", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
086    @Description(shortDefinition="todo", formalDefinition="" )
087    protected StringType visibleInView;
088
089    private static final long serialVersionUID = 1193300325L;
090
091  /**
092   * Constructor
093   */
094    public Annotations() {
095      super();
096    }
097
098    /**
099     * @return {@link #comment} (). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
100     */
101    public StringType getCommentElement() { 
102      if (this.comment == null)
103        if (Configuration.errorOnAutoCreate())
104          throw new Error("Attempt to auto-create Annotations.comment");
105        else if (Configuration.doAutoCreate())
106          this.comment = new StringType(); // bb
107      return this.comment;
108    }
109
110    public boolean hasCommentElement() { 
111      return this.comment != null && !this.comment.isEmpty();
112    }
113
114    public boolean hasComment() { 
115      return this.comment != null && !this.comment.isEmpty();
116    }
117
118    /**
119     * @param value {@link #comment} (). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
120     */
121    public Annotations setCommentElement(StringType value) { 
122      this.comment = value;
123      return this;
124    }
125
126    /**
127     * @return 
128     */
129    public String getComment() { 
130      return this.comment == null ? null : this.comment.getValue();
131    }
132
133    /**
134     * @param value 
135     */
136    public Annotations setComment(String value) { 
137      if (Utilities.noString(value))
138        this.comment = null;
139      else {
140        if (this.comment == null)
141          this.comment = new StringType();
142        this.comment.setValue(value);
143      }
144      return this;
145    }
146
147    /**
148     * @return {@link #fhir_mapping} (). This is the underlying object with id, value and extensions. The accessor "getFhir_mapping" gives direct access to the value
149     */
150    public StringType getFhir_mappingElement() { 
151      if (this.fhir_mapping == null)
152        if (Configuration.errorOnAutoCreate())
153          throw new Error("Attempt to auto-create Annotations.fhir_mapping");
154        else if (Configuration.doAutoCreate())
155          this.fhir_mapping = new StringType(); // bb
156      return this.fhir_mapping;
157    }
158
159    public boolean hasFhir_mappingElement() { 
160      return this.fhir_mapping != null && !this.fhir_mapping.isEmpty();
161    }
162
163    public boolean hasFhir_mapping() { 
164      return this.fhir_mapping != null && !this.fhir_mapping.isEmpty();
165    }
166
167    /**
168     * @param value {@link #fhir_mapping} (). This is the underlying object with id, value and extensions. The accessor "getFhir_mapping" gives direct access to the value
169     */
170    public Annotations setFhir_mappingElement(StringType value) { 
171      this.fhir_mapping = value;
172      return this;
173    }
174
175    /**
176     * @return 
177     */
178    public String getFhir_mapping() { 
179      return this.fhir_mapping == null ? null : this.fhir_mapping.getValue();
180    }
181
182    /**
183     * @param value 
184     */
185    public Annotations setFhir_mapping(String value) { 
186      if (Utilities.noString(value))
187        this.fhir_mapping = null;
188      else {
189        if (this.fhir_mapping == null)
190          this.fhir_mapping = new StringType();
191        this.fhir_mapping.setValue(value);
192      }
193      return this;
194    }
195
196    /**
197     * @return {@link #vset_description} (). This is the underlying object with id, value and extensions. The accessor "getVset_description" gives direct access to the value
198     */
199    public StringType getVset_descriptionElement() { 
200      if (this.vset_description == null)
201        if (Configuration.errorOnAutoCreate())
202          throw new Error("Attempt to auto-create Annotations.vset_description");
203        else if (Configuration.doAutoCreate())
204          this.vset_description = new StringType(); // bb
205      return this.vset_description;
206    }
207
208    public boolean hasVset_descriptionElement() { 
209      return this.vset_description != null && !this.vset_description.isEmpty();
210    }
211
212    public boolean hasVset_description() { 
213      return this.vset_description != null && !this.vset_description.isEmpty();
214    }
215
216    /**
217     * @param value {@link #vset_description} (). This is the underlying object with id, value and extensions. The accessor "getVset_description" gives direct access to the value
218     */
219    public Annotations setVset_descriptionElement(StringType value) { 
220      this.vset_description = value;
221      return this;
222    }
223
224    /**
225     * @return 
226     */
227    public String getVset_description() { 
228      return this.vset_description == null ? null : this.vset_description.getValue();
229    }
230
231    /**
232     * @param value 
233     */
234    public Annotations setVset_description(String value) { 
235      if (Utilities.noString(value))
236        this.vset_description = null;
237      else {
238        if (this.vset_description == null)
239          this.vset_description = new StringType();
240        this.vset_description.setValue(value);
241      }
242      return this;
243    }
244
245    /**
246     * @return {@link #hl7v2_mapping} (). This is the underlying object with id, value and extensions. The accessor "getHl7v2_mapping" gives direct access to the value
247     */
248    public StringType getHl7v2_mappingElement() { 
249      if (this.hl7v2_mapping == null)
250        if (Configuration.errorOnAutoCreate())
251          throw new Error("Attempt to auto-create Annotations.hl7v2_mapping");
252        else if (Configuration.doAutoCreate())
253          this.hl7v2_mapping = new StringType(); // bb
254      return this.hl7v2_mapping;
255    }
256
257    public boolean hasHl7v2_mappingElement() { 
258      return this.hl7v2_mapping != null && !this.hl7v2_mapping.isEmpty();
259    }
260
261    public boolean hasHl7v2_mapping() { 
262      return this.hl7v2_mapping != null && !this.hl7v2_mapping.isEmpty();
263    }
264
265    /**
266     * @param value {@link #hl7v2_mapping} (). This is the underlying object with id, value and extensions. The accessor "getHl7v2_mapping" gives direct access to the value
267     */
268    public Annotations setHl7v2_mappingElement(StringType value) { 
269      this.hl7v2_mapping = value;
270      return this;
271    }
272
273    /**
274     * @return 
275     */
276    public String getHl7v2_mapping() { 
277      return this.hl7v2_mapping == null ? null : this.hl7v2_mapping.getValue();
278    }
279
280    /**
281     * @param value 
282     */
283    public Annotations setHl7v2_mapping(String value) { 
284      if (Utilities.noString(value))
285        this.hl7v2_mapping = null;
286      else {
287        if (this.hl7v2_mapping == null)
288          this.hl7v2_mapping = new StringType();
289        this.hl7v2_mapping.setValue(value);
290      }
291      return this;
292    }
293
294    /**
295     * @return {@link #visibleInView} (). This is the underlying object with id, value and extensions. The accessor "getVisibleInView" gives direct access to the value
296     */
297    public StringType getVisibleInViewElement() { 
298      if (this.visibleInView == null)
299        if (Configuration.errorOnAutoCreate())
300          throw new Error("Attempt to auto-create Annotations.visibleInView");
301        else if (Configuration.doAutoCreate())
302          this.visibleInView = new StringType(); // bb
303      return this.visibleInView;
304    }
305
306    public boolean hasVisibleInViewElement() { 
307      return this.visibleInView != null && !this.visibleInView.isEmpty();
308    }
309
310    public boolean hasVisibleInView() { 
311      return this.visibleInView != null && !this.visibleInView.isEmpty();
312    }
313
314    /**
315     * @param value {@link #visibleInView} (). This is the underlying object with id, value and extensions. The accessor "getVisibleInView" gives direct access to the value
316     */
317    public Annotations setVisibleInViewElement(StringType value) { 
318      this.visibleInView = value;
319      return this;
320    }
321
322    /**
323     * @return 
324     */
325    public String getVisibleInView() { 
326      return this.visibleInView == null ? null : this.visibleInView.getValue();
327    }
328
329    /**
330     * @param value 
331     */
332    public Annotations setVisibleInView(String value) { 
333      if (Utilities.noString(value))
334        this.visibleInView = null;
335      else {
336        if (this.visibleInView == null)
337          this.visibleInView = new StringType();
338        this.visibleInView.setValue(value);
339      }
340      return this;
341    }
342
343      protected void listChildren(List<Property> children) {
344        super.listChildren(children);
345        children.add(new Property("comment", "string", "", 0, 1, comment));
346        children.add(new Property("fhir_mapping", "string", "", 0, 1, fhir_mapping));
347        children.add(new Property("vset_description", "string", "", 0, 1, vset_description));
348        children.add(new Property("hl7v2_mapping", "string", "", 0, 1, hl7v2_mapping));
349        children.add(new Property("visibleInView", "string", "", 0, 1, visibleInView));
350      }
351
352      @Override
353      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
354        switch (_hash) {
355        case 950398559: /*comment*/  return new Property("comment", "string", "", 0, 1, comment);
356        case -2067458566: /*fhir_mapping*/  return new Property("fhir_mapping", "string", "", 0, 1, fhir_mapping);
357        case -87138199: /*vset_description*/  return new Property("vset_description", "string", "", 0, 1, vset_description);
358        case 1862427134: /*hl7v2_mapping*/  return new Property("hl7v2_mapping", "string", "", 0, 1, hl7v2_mapping);
359        case 602726524: /*visibleInView*/  return new Property("visibleInView", "string", "", 0, 1, visibleInView);
360        default: return super.getNamedProperty(_hash, _name, _checkValid);
361        }
362
363      }
364
365      @Override
366      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
367        switch (hash) {
368        case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
369        case -2067458566: /*fhir_mapping*/ return this.fhir_mapping == null ? new Base[0] : new Base[] {this.fhir_mapping}; // StringType
370        case -87138199: /*vset_description*/ return this.vset_description == null ? new Base[0] : new Base[] {this.vset_description}; // StringType
371        case 1862427134: /*hl7v2_mapping*/ return this.hl7v2_mapping == null ? new Base[0] : new Base[] {this.hl7v2_mapping}; // StringType
372        case 602726524: /*visibleInView*/ return this.visibleInView == null ? new Base[0] : new Base[] {this.visibleInView}; // StringType
373        default: return super.getProperty(hash, name, checkValid);
374        }
375
376      }
377
378      @Override
379      public Base setProperty(int hash, String name, Base value) throws FHIRException {
380        switch (hash) {
381        case 950398559: // comment
382          this.comment = TypeConvertor.castToString(value); // StringType
383          return value;
384        case -2067458566: // fhir_mapping
385          this.fhir_mapping = TypeConvertor.castToString(value); // StringType
386          return value;
387        case -87138199: // vset_description
388          this.vset_description = TypeConvertor.castToString(value); // StringType
389          return value;
390        case 1862427134: // hl7v2_mapping
391          this.hl7v2_mapping = TypeConvertor.castToString(value); // StringType
392          return value;
393        case 602726524: // visibleInView
394          this.visibleInView = TypeConvertor.castToString(value); // StringType
395          return value;
396        default: return super.setProperty(hash, name, value);
397        }
398
399      }
400
401      @Override
402      public Base setProperty(String name, Base value) throws FHIRException {
403        if (name.equals("comment")) {
404          this.comment = TypeConvertor.castToString(value); // StringType
405        } else if (name.equals("fhir_mapping")) {
406          this.fhir_mapping = TypeConvertor.castToString(value); // StringType
407        } else if (name.equals("vset_description")) {
408          this.vset_description = TypeConvertor.castToString(value); // StringType
409        } else if (name.equals("hl7v2_mapping")) {
410          this.hl7v2_mapping = TypeConvertor.castToString(value); // StringType
411        } else if (name.equals("visibleInView")) {
412          this.visibleInView = TypeConvertor.castToString(value); // StringType
413        } else
414          return super.setProperty(name, value);
415        return value;
416      }
417
418      @Override
419      public Base makeProperty(int hash, String name) throws FHIRException {
420        switch (hash) {
421        case 950398559:  return getCommentElement();
422        case -2067458566:  return getFhir_mappingElement();
423        case -87138199:  return getVset_descriptionElement();
424        case 1862427134:  return getHl7v2_mappingElement();
425        case 602726524:  return getVisibleInViewElement();
426        default: return super.makeProperty(hash, name);
427        }
428
429      }
430
431      @Override
432      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
433        switch (hash) {
434        case 950398559: /*comment*/ return new String[] {"string"};
435        case -2067458566: /*fhir_mapping*/ return new String[] {"string"};
436        case -87138199: /*vset_description*/ return new String[] {"string"};
437        case 1862427134: /*hl7v2_mapping*/ return new String[] {"string"};
438        case 602726524: /*visibleInView*/ return new String[] {"string"};
439        default: return super.getTypesForProperty(hash, name);
440        }
441
442      }
443
444      @Override
445      public Base addChild(String name) throws FHIRException {
446        if (name.equals("comment")) {
447          throw new FHIRException("Cannot call addChild on a singleton property Annotations.comment");
448        }
449        else if (name.equals("fhir_mapping")) {
450          throw new FHIRException("Cannot call addChild on a singleton property Annotations.fhir_mapping");
451        }
452        else if (name.equals("vset_description")) {
453          throw new FHIRException("Cannot call addChild on a singleton property Annotations.vset_description");
454        }
455        else if (name.equals("hl7v2_mapping")) {
456          throw new FHIRException("Cannot call addChild on a singleton property Annotations.hl7v2_mapping");
457        }
458        else if (name.equals("visibleInView")) {
459          throw new FHIRException("Cannot call addChild on a singleton property Annotations.visibleInView");
460        }
461        else
462          return super.addChild(name);
463      }
464
465  public String fhirType() {
466    return "Annotations";
467
468  }
469
470      public Annotations copy() {
471        Annotations dst = new Annotations();
472        copyValues(dst);
473        return dst;
474      }
475
476      public void copyValues(Annotations dst) {
477        super.copyValues(dst);
478        dst.comment = comment == null ? null : comment.copy();
479        dst.fhir_mapping = fhir_mapping == null ? null : fhir_mapping.copy();
480        dst.vset_description = vset_description == null ? null : vset_description.copy();
481        dst.hl7v2_mapping = hl7v2_mapping == null ? null : hl7v2_mapping.copy();
482        dst.visibleInView = visibleInView == null ? null : visibleInView.copy();
483      }
484
485      protected Annotations typedCopy() {
486        return copy();
487      }
488
489      @Override
490      public boolean equalsDeep(Base other_) {
491        if (!super.equalsDeep(other_))
492          return false;
493        if (!(other_ instanceof Annotations))
494          return false;
495        Annotations o = (Annotations) other_;
496        return compareDeep(comment, o.comment, true) && compareDeep(fhir_mapping, o.fhir_mapping, true)
497           && compareDeep(vset_description, o.vset_description, true) && compareDeep(hl7v2_mapping, o.hl7v2_mapping, true)
498           && compareDeep(visibleInView, o.visibleInView, true);
499      }
500
501      @Override
502      public boolean equalsShallow(Base other_) {
503        if (!super.equalsShallow(other_))
504          return false;
505        if (!(other_ instanceof Annotations))
506          return false;
507        Annotations o = (Annotations) other_;
508        return compareValues(comment, o.comment, true) && compareValues(fhir_mapping, o.fhir_mapping, true)
509           && compareValues(vset_description, o.vset_description, true) && compareValues(hl7v2_mapping, o.hl7v2_mapping, true)
510           && compareValues(visibleInView, o.visibleInView, true);
511      }
512
513      public boolean isEmpty() {
514        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(comment, fhir_mapping, vset_description
515          , hl7v2_mapping, visibleInView);
516      }
517
518
519}
520