001package org.hl7.fhir.dstu2.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.dstu2.model.Enumerations.BindingStrength;
038import org.hl7.fhir.dstu2.model.Enumerations.BindingStrengthEnumFactory;
039import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus;
040import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory;
041import ca.uhn.fhir.model.api.annotation.Block;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.ResourceDef;
045import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
046import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
047import org.hl7.fhir.exceptions.FHIRException;
048import org.hl7.fhir.utilities.Utilities;
049
050/**
051 * A formal computable definition of an operation (on the RESTful interface) or
052 * a named query (using the search interaction).
053 */
054@ResourceDef(name = "OperationDefinition", profile = "http://hl7.org/fhir/Profile/OperationDefinition")
055public class OperationDefinition extends DomainResource {
056
057  public enum OperationKind {
058    /**
059     * This operation is invoked as an operation.
060     */
061    OPERATION,
062    /**
063     * This operation is a named query, invoked using the search mechanism.
064     */
065    QUERY,
066    /**
067     * added to help the parsers
068     */
069    NULL;
070
071    public static OperationKind fromCode(String codeString) throws FHIRException {
072      if (codeString == null || "".equals(codeString))
073        return null;
074      if ("operation".equals(codeString))
075        return OPERATION;
076      if ("query".equals(codeString))
077        return QUERY;
078      throw new FHIRException("Unknown OperationKind code '" + codeString + "'");
079    }
080
081    public String toCode() {
082      switch (this) {
083      case OPERATION:
084        return "operation";
085      case QUERY:
086        return "query";
087      case NULL:
088        return null;
089      default:
090        return "?";
091      }
092    }
093
094    public String getSystem() {
095      switch (this) {
096      case OPERATION:
097        return "http://hl7.org/fhir/operation-kind";
098      case QUERY:
099        return "http://hl7.org/fhir/operation-kind";
100      case NULL:
101        return null;
102      default:
103        return "?";
104      }
105    }
106
107    public String getDefinition() {
108      switch (this) {
109      case OPERATION:
110        return "This operation is invoked as an operation.";
111      case QUERY:
112        return "This operation is a named query, invoked using the search mechanism.";
113      case NULL:
114        return null;
115      default:
116        return "?";
117      }
118    }
119
120    public String getDisplay() {
121      switch (this) {
122      case OPERATION:
123        return "Operation";
124      case QUERY:
125        return "Query";
126      case NULL:
127        return null;
128      default:
129        return "?";
130      }
131    }
132  }
133
134  public static class OperationKindEnumFactory implements EnumFactory<OperationKind> {
135    public OperationKind fromCode(String codeString) throws IllegalArgumentException {
136      if (codeString == null || "".equals(codeString))
137        if (codeString == null || "".equals(codeString))
138          return null;
139      if ("operation".equals(codeString))
140        return OperationKind.OPERATION;
141      if ("query".equals(codeString))
142        return OperationKind.QUERY;
143      throw new IllegalArgumentException("Unknown OperationKind code '" + codeString + "'");
144    }
145
146    public Enumeration<OperationKind> fromType(Base code) throws FHIRException {
147      if (code == null || code.isEmpty())
148        return null;
149      String codeString = ((PrimitiveType) code).asStringValue();
150      if (codeString == null || "".equals(codeString))
151        return null;
152      if ("operation".equals(codeString))
153        return new Enumeration<OperationKind>(this, OperationKind.OPERATION);
154      if ("query".equals(codeString))
155        return new Enumeration<OperationKind>(this, OperationKind.QUERY);
156      throw new FHIRException("Unknown OperationKind code '" + codeString + "'");
157    }
158
159    public String toCode(OperationKind code) {
160      if (code == OperationKind.OPERATION)
161        return "operation";
162      if (code == OperationKind.QUERY)
163        return "query";
164      return "?";
165    }
166  }
167
168  public enum OperationParameterUse {
169    /**
170     * This is an input parameter.
171     */
172    IN,
173    /**
174     * This is an output parameter.
175     */
176    OUT,
177    /**
178     * added to help the parsers
179     */
180    NULL;
181
182    public static OperationParameterUse fromCode(String codeString) throws FHIRException {
183      if (codeString == null || "".equals(codeString))
184        return null;
185      if ("in".equals(codeString))
186        return IN;
187      if ("out".equals(codeString))
188        return OUT;
189      throw new FHIRException("Unknown OperationParameterUse code '" + codeString + "'");
190    }
191
192    public String toCode() {
193      switch (this) {
194      case IN:
195        return "in";
196      case OUT:
197        return "out";
198      case NULL:
199        return null;
200      default:
201        return "?";
202      }
203    }
204
205    public String getSystem() {
206      switch (this) {
207      case IN:
208        return "http://hl7.org/fhir/operation-parameter-use";
209      case OUT:
210        return "http://hl7.org/fhir/operation-parameter-use";
211      case NULL:
212        return null;
213      default:
214        return "?";
215      }
216    }
217
218    public String getDefinition() {
219      switch (this) {
220      case IN:
221        return "This is an input parameter.";
222      case OUT:
223        return "This is an output parameter.";
224      case NULL:
225        return null;
226      default:
227        return "?";
228      }
229    }
230
231    public String getDisplay() {
232      switch (this) {
233      case IN:
234        return "In";
235      case OUT:
236        return "Out";
237      case NULL:
238        return null;
239      default:
240        return "?";
241      }
242    }
243  }
244
245  public static class OperationParameterUseEnumFactory implements EnumFactory<OperationParameterUse> {
246    public OperationParameterUse fromCode(String codeString) throws IllegalArgumentException {
247      if (codeString == null || "".equals(codeString))
248        if (codeString == null || "".equals(codeString))
249          return null;
250      if ("in".equals(codeString))
251        return OperationParameterUse.IN;
252      if ("out".equals(codeString))
253        return OperationParameterUse.OUT;
254      throw new IllegalArgumentException("Unknown OperationParameterUse code '" + codeString + "'");
255    }
256
257    public Enumeration<OperationParameterUse> fromType(Base code) throws FHIRException {
258      if (code == null || code.isEmpty())
259        return null;
260      String codeString = ((PrimitiveType) code).asStringValue();
261      if (codeString == null || "".equals(codeString))
262        return null;
263      if ("in".equals(codeString))
264        return new Enumeration<OperationParameterUse>(this, OperationParameterUse.IN);
265      if ("out".equals(codeString))
266        return new Enumeration<OperationParameterUse>(this, OperationParameterUse.OUT);
267      throw new FHIRException("Unknown OperationParameterUse code '" + codeString + "'");
268    }
269
270    public String toCode(OperationParameterUse code) {
271      if (code == OperationParameterUse.IN)
272        return "in";
273      if (code == OperationParameterUse.OUT)
274        return "out";
275      return "?";
276    }
277  }
278
279  @Block()
280  public static class OperationDefinitionContactComponent extends BackboneElement implements IBaseBackboneElement {
281    /**
282     * The name of an individual to contact regarding the operation definition.
283     */
284    @Child(name = "name", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = true)
285    @Description(shortDefinition = "Name of a individual to contact", formalDefinition = "The name of an individual to contact regarding the operation definition.")
286    protected StringType name;
287
288    /**
289     * Contact details for individual (if a name was provided) or the publisher.
290     */
291    @Child(name = "telecom", type = {
292        ContactPoint.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
293    @Description(shortDefinition = "Contact details for individual or publisher", formalDefinition = "Contact details for individual (if a name was provided) or the publisher.")
294    protected List<ContactPoint> telecom;
295
296    private static final long serialVersionUID = -1179697803L;
297
298    /*
299     * Constructor
300     */
301    public OperationDefinitionContactComponent() {
302      super();
303    }
304
305    /**
306     * @return {@link #name} (The name of an individual to contact regarding the
307     *         operation definition.). This is the underlying object with id, value
308     *         and extensions. The accessor "getName" gives direct access to the
309     *         value
310     */
311    public StringType getNameElement() {
312      if (this.name == null)
313        if (Configuration.errorOnAutoCreate())
314          throw new Error("Attempt to auto-create OperationDefinitionContactComponent.name");
315        else if (Configuration.doAutoCreate())
316          this.name = new StringType(); // bb
317      return this.name;
318    }
319
320    public boolean hasNameElement() {
321      return this.name != null && !this.name.isEmpty();
322    }
323
324    public boolean hasName() {
325      return this.name != null && !this.name.isEmpty();
326    }
327
328    /**
329     * @param value {@link #name} (The name of an individual to contact regarding
330     *              the operation definition.). This is the underlying object with
331     *              id, value and extensions. The accessor "getName" gives direct
332     *              access to the value
333     */
334    public OperationDefinitionContactComponent setNameElement(StringType value) {
335      this.name = value;
336      return this;
337    }
338
339    /**
340     * @return The name of an individual to contact regarding the operation
341     *         definition.
342     */
343    public String getName() {
344      return this.name == null ? null : this.name.getValue();
345    }
346
347    /**
348     * @param value The name of an individual to contact regarding the operation
349     *              definition.
350     */
351    public OperationDefinitionContactComponent setName(String value) {
352      if (Utilities.noString(value))
353        this.name = null;
354      else {
355        if (this.name == null)
356          this.name = new StringType();
357        this.name.setValue(value);
358      }
359      return this;
360    }
361
362    /**
363     * @return {@link #telecom} (Contact details for individual (if a name was
364     *         provided) or the publisher.)
365     */
366    public List<ContactPoint> getTelecom() {
367      if (this.telecom == null)
368        this.telecom = new ArrayList<ContactPoint>();
369      return this.telecom;
370    }
371
372    public boolean hasTelecom() {
373      if (this.telecom == null)
374        return false;
375      for (ContactPoint item : this.telecom)
376        if (!item.isEmpty())
377          return true;
378      return false;
379    }
380
381    /**
382     * @return {@link #telecom} (Contact details for individual (if a name was
383     *         provided) or the publisher.)
384     */
385    // syntactic sugar
386    public ContactPoint addTelecom() { // 3
387      ContactPoint t = new ContactPoint();
388      if (this.telecom == null)
389        this.telecom = new ArrayList<ContactPoint>();
390      this.telecom.add(t);
391      return t;
392    }
393
394    // syntactic sugar
395    public OperationDefinitionContactComponent addTelecom(ContactPoint t) { // 3
396      if (t == null)
397        return this;
398      if (this.telecom == null)
399        this.telecom = new ArrayList<ContactPoint>();
400      this.telecom.add(t);
401      return this;
402    }
403
404    protected void listChildren(List<Property> childrenList) {
405      super.listChildren(childrenList);
406      childrenList.add(
407          new Property("name", "string", "The name of an individual to contact regarding the operation definition.", 0,
408              java.lang.Integer.MAX_VALUE, name));
409      childrenList.add(new Property("telecom", "ContactPoint",
410          "Contact details for individual (if a name was provided) or the publisher.", 0, java.lang.Integer.MAX_VALUE,
411          telecom));
412    }
413
414    @Override
415    public void setProperty(String name, Base value) throws FHIRException {
416      if (name.equals("name"))
417        this.name = castToString(value); // StringType
418      else if (name.equals("telecom"))
419        this.getTelecom().add(castToContactPoint(value));
420      else
421        super.setProperty(name, value);
422    }
423
424    @Override
425    public Base addChild(String name) throws FHIRException {
426      if (name.equals("name")) {
427        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.name");
428      } else if (name.equals("telecom")) {
429        return addTelecom();
430      } else
431        return super.addChild(name);
432    }
433
434    public OperationDefinitionContactComponent copy() {
435      OperationDefinitionContactComponent dst = new OperationDefinitionContactComponent();
436      copyValues(dst);
437      dst.name = name == null ? null : name.copy();
438      if (telecom != null) {
439        dst.telecom = new ArrayList<ContactPoint>();
440        for (ContactPoint i : telecom)
441          dst.telecom.add(i.copy());
442      }
443      ;
444      return dst;
445    }
446
447    @Override
448    public boolean equalsDeep(Base other) {
449      if (!super.equalsDeep(other))
450        return false;
451      if (!(other instanceof OperationDefinitionContactComponent))
452        return false;
453      OperationDefinitionContactComponent o = (OperationDefinitionContactComponent) other;
454      return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
455    }
456
457    @Override
458    public boolean equalsShallow(Base other) {
459      if (!super.equalsShallow(other))
460        return false;
461      if (!(other instanceof OperationDefinitionContactComponent))
462        return false;
463      OperationDefinitionContactComponent o = (OperationDefinitionContactComponent) other;
464      return compareValues(name, o.name, true);
465    }
466
467    public boolean isEmpty() {
468      return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty());
469    }
470
471    public String fhirType() {
472      return "OperationDefinition.contact";
473
474    }
475
476  }
477
478  @Block()
479  public static class OperationDefinitionParameterComponent extends BackboneElement implements IBaseBackboneElement {
480    /**
481     * The name of used to identify the parameter.
482     */
483    @Child(name = "name", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
484    @Description(shortDefinition = "Name in Parameters.parameter.name or in URL", formalDefinition = "The name of used to identify the parameter.")
485    protected CodeType name;
486
487    /**
488     * Whether this is an input or an output parameter.
489     */
490    @Child(name = "use", type = { CodeType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
491    @Description(shortDefinition = "in | out", formalDefinition = "Whether this is an input or an output parameter.")
492    protected Enumeration<OperationParameterUse> use;
493
494    /**
495     * The minimum number of times this parameter SHALL appear in the request or
496     * response.
497     */
498    @Child(name = "min", type = { IntegerType.class }, order = 3, min = 1, max = 1, modifier = false, summary = false)
499    @Description(shortDefinition = "Minimum Cardinality", formalDefinition = "The minimum number of times this parameter SHALL appear in the request or response.")
500    protected IntegerType min;
501
502    /**
503     * The maximum number of times this element is permitted to appear in the
504     * request or response.
505     */
506    @Child(name = "max", type = { StringType.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
507    @Description(shortDefinition = "Maximum Cardinality (a number or *)", formalDefinition = "The maximum number of times this element is permitted to appear in the request or response.")
508    protected StringType max;
509
510    /**
511     * Describes the meaning or use of this parameter.
512     */
513    @Child(name = "documentation", type = {
514        StringType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
515    @Description(shortDefinition = "Description of meaning/use", formalDefinition = "Describes the meaning or use of this parameter.")
516    protected StringType documentation;
517
518    /**
519     * The type for this parameter.
520     */
521    @Child(name = "type", type = { CodeType.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
522    @Description(shortDefinition = "What type this parameter has", formalDefinition = "The type for this parameter.")
523    protected CodeType type;
524
525    /**
526     * A profile the specifies the rules that this parameter must conform to.
527     */
528    @Child(name = "profile", type = {
529        StructureDefinition.class }, order = 7, min = 0, max = 1, modifier = false, summary = false)
530    @Description(shortDefinition = "Profile on the type", formalDefinition = "A profile the specifies the rules that this parameter must conform to.")
531    protected Reference profile;
532
533    /**
534     * The actual object that is the target of the reference (A profile the
535     * specifies the rules that this parameter must conform to.)
536     */
537    protected StructureDefinition profileTarget;
538
539    /**
540     * Binds to a value set if this parameter is coded (code, Coding,
541     * CodeableConcept).
542     */
543    @Child(name = "binding", type = {}, order = 8, min = 0, max = 1, modifier = false, summary = false)
544    @Description(shortDefinition = "ValueSet details if this is coded", formalDefinition = "Binds to a value set if this parameter is coded (code, Coding, CodeableConcept).")
545    protected OperationDefinitionParameterBindingComponent binding;
546
547    /**
548     * The parts of a Tuple Parameter.
549     */
550    @Child(name = "part", type = {
551        OperationDefinitionParameterComponent.class }, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
552    @Description(shortDefinition = "Parts of a Tuple Parameter", formalDefinition = "The parts of a Tuple Parameter.")
553    protected List<OperationDefinitionParameterComponent> part;
554
555    private static final long serialVersionUID = -1514145741L;
556
557    /*
558     * Constructor
559     */
560    public OperationDefinitionParameterComponent() {
561      super();
562    }
563
564    /*
565     * Constructor
566     */
567    public OperationDefinitionParameterComponent(CodeType name, Enumeration<OperationParameterUse> use, IntegerType min,
568        StringType max) {
569      super();
570      this.name = name;
571      this.use = use;
572      this.min = min;
573      this.max = max;
574    }
575
576    /**
577     * @return {@link #name} (The name of used to identify the parameter.). This is
578     *         the underlying object with id, value and extensions. The accessor
579     *         "getName" gives direct access to the value
580     */
581    public CodeType getNameElement() {
582      if (this.name == null)
583        if (Configuration.errorOnAutoCreate())
584          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.name");
585        else if (Configuration.doAutoCreate())
586          this.name = new CodeType(); // bb
587      return this.name;
588    }
589
590    public boolean hasNameElement() {
591      return this.name != null && !this.name.isEmpty();
592    }
593
594    public boolean hasName() {
595      return this.name != null && !this.name.isEmpty();
596    }
597
598    /**
599     * @param value {@link #name} (The name of used to identify the parameter.).
600     *              This is the underlying object with id, value and extensions. The
601     *              accessor "getName" gives direct access to the value
602     */
603    public OperationDefinitionParameterComponent setNameElement(CodeType value) {
604      this.name = value;
605      return this;
606    }
607
608    /**
609     * @return The name of used to identify the parameter.
610     */
611    public String getName() {
612      return this.name == null ? null : this.name.getValue();
613    }
614
615    /**
616     * @param value The name of used to identify the parameter.
617     */
618    public OperationDefinitionParameterComponent setName(String value) {
619      if (this.name == null)
620        this.name = new CodeType();
621      this.name.setValue(value);
622      return this;
623    }
624
625    /**
626     * @return {@link #use} (Whether this is an input or an output parameter.). This
627     *         is the underlying object with id, value and extensions. The accessor
628     *         "getUse" gives direct access to the value
629     */
630    public Enumeration<OperationParameterUse> getUseElement() {
631      if (this.use == null)
632        if (Configuration.errorOnAutoCreate())
633          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.use");
634        else if (Configuration.doAutoCreate())
635          this.use = new Enumeration<OperationParameterUse>(new OperationParameterUseEnumFactory()); // bb
636      return this.use;
637    }
638
639    public boolean hasUseElement() {
640      return this.use != null && !this.use.isEmpty();
641    }
642
643    public boolean hasUse() {
644      return this.use != null && !this.use.isEmpty();
645    }
646
647    /**
648     * @param value {@link #use} (Whether this is an input or an output parameter.).
649     *              This is the underlying object with id, value and extensions. The
650     *              accessor "getUse" gives direct access to the value
651     */
652    public OperationDefinitionParameterComponent setUseElement(Enumeration<OperationParameterUse> value) {
653      this.use = value;
654      return this;
655    }
656
657    /**
658     * @return Whether this is an input or an output parameter.
659     */
660    public OperationParameterUse getUse() {
661      return this.use == null ? null : this.use.getValue();
662    }
663
664    /**
665     * @param value Whether this is an input or an output parameter.
666     */
667    public OperationDefinitionParameterComponent setUse(OperationParameterUse value) {
668      if (this.use == null)
669        this.use = new Enumeration<OperationParameterUse>(new OperationParameterUseEnumFactory());
670      this.use.setValue(value);
671      return this;
672    }
673
674    /**
675     * @return {@link #min} (The minimum number of times this parameter SHALL appear
676     *         in the request or response.). This is the underlying object with id,
677     *         value and extensions. The accessor "getMin" gives direct access to
678     *         the value
679     */
680    public IntegerType getMinElement() {
681      if (this.min == null)
682        if (Configuration.errorOnAutoCreate())
683          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.min");
684        else if (Configuration.doAutoCreate())
685          this.min = new IntegerType(); // bb
686      return this.min;
687    }
688
689    public boolean hasMinElement() {
690      return this.min != null && !this.min.isEmpty();
691    }
692
693    public boolean hasMin() {
694      return this.min != null && !this.min.isEmpty();
695    }
696
697    /**
698     * @param value {@link #min} (The minimum number of times this parameter SHALL
699     *              appear in the request or response.). This is the underlying
700     *              object with id, value and extensions. The accessor "getMin"
701     *              gives direct access to the value
702     */
703    public OperationDefinitionParameterComponent setMinElement(IntegerType value) {
704      this.min = value;
705      return this;
706    }
707
708    /**
709     * @return The minimum number of times this parameter SHALL appear in the
710     *         request or response.
711     */
712    public int getMin() {
713      return this.min == null || this.min.isEmpty() ? 0 : this.min.getValue();
714    }
715
716    /**
717     * @param value The minimum number of times this parameter SHALL appear in the
718     *              request or response.
719     */
720    public OperationDefinitionParameterComponent setMin(int value) {
721      if (this.min == null)
722        this.min = new IntegerType();
723      this.min.setValue(value);
724      return this;
725    }
726
727    /**
728     * @return {@link #max} (The maximum number of times this element is permitted
729     *         to appear in the request or response.). This is the underlying object
730     *         with id, value and extensions. The accessor "getMax" gives direct
731     *         access to the value
732     */
733    public StringType getMaxElement() {
734      if (this.max == null)
735        if (Configuration.errorOnAutoCreate())
736          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.max");
737        else if (Configuration.doAutoCreate())
738          this.max = new StringType(); // bb
739      return this.max;
740    }
741
742    public boolean hasMaxElement() {
743      return this.max != null && !this.max.isEmpty();
744    }
745
746    public boolean hasMax() {
747      return this.max != null && !this.max.isEmpty();
748    }
749
750    /**
751     * @param value {@link #max} (The maximum number of times this element is
752     *              permitted to appear in the request or response.). This is the
753     *              underlying object with id, value and extensions. The accessor
754     *              "getMax" gives direct access to the value
755     */
756    public OperationDefinitionParameterComponent setMaxElement(StringType value) {
757      this.max = value;
758      return this;
759    }
760
761    /**
762     * @return The maximum number of times this element is permitted to appear in
763     *         the request or response.
764     */
765    public String getMax() {
766      return this.max == null ? null : this.max.getValue();
767    }
768
769    /**
770     * @param value The maximum number of times this element is permitted to appear
771     *              in the request or response.
772     */
773    public OperationDefinitionParameterComponent setMax(String value) {
774      if (this.max == null)
775        this.max = new StringType();
776      this.max.setValue(value);
777      return this;
778    }
779
780    /**
781     * @return {@link #documentation} (Describes the meaning or use of this
782     *         parameter.). This is the underlying object with id, value and
783     *         extensions. The accessor "getDocumentation" gives direct access to
784     *         the value
785     */
786    public StringType getDocumentationElement() {
787      if (this.documentation == null)
788        if (Configuration.errorOnAutoCreate())
789          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.documentation");
790        else if (Configuration.doAutoCreate())
791          this.documentation = new StringType(); // bb
792      return this.documentation;
793    }
794
795    public boolean hasDocumentationElement() {
796      return this.documentation != null && !this.documentation.isEmpty();
797    }
798
799    public boolean hasDocumentation() {
800      return this.documentation != null && !this.documentation.isEmpty();
801    }
802
803    /**
804     * @param value {@link #documentation} (Describes the meaning or use of this
805     *              parameter.). This is the underlying object with id, value and
806     *              extensions. The accessor "getDocumentation" gives direct access
807     *              to the value
808     */
809    public OperationDefinitionParameterComponent setDocumentationElement(StringType value) {
810      this.documentation = value;
811      return this;
812    }
813
814    /**
815     * @return Describes the meaning or use of this parameter.
816     */
817    public String getDocumentation() {
818      return this.documentation == null ? null : this.documentation.getValue();
819    }
820
821    /**
822     * @param value Describes the meaning or use of this parameter.
823     */
824    public OperationDefinitionParameterComponent setDocumentation(String value) {
825      if (Utilities.noString(value))
826        this.documentation = null;
827      else {
828        if (this.documentation == null)
829          this.documentation = new StringType();
830        this.documentation.setValue(value);
831      }
832      return this;
833    }
834
835    /**
836     * @return {@link #type} (The type for this parameter.). This is the underlying
837     *         object with id, value and extensions. The accessor "getType" gives
838     *         direct access to the value
839     */
840    public CodeType getTypeElement() {
841      if (this.type == null)
842        if (Configuration.errorOnAutoCreate())
843          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.type");
844        else if (Configuration.doAutoCreate())
845          this.type = new CodeType(); // bb
846      return this.type;
847    }
848
849    public boolean hasTypeElement() {
850      return this.type != null && !this.type.isEmpty();
851    }
852
853    public boolean hasType() {
854      return this.type != null && !this.type.isEmpty();
855    }
856
857    /**
858     * @param value {@link #type} (The type for this parameter.). This is the
859     *              underlying object with id, value and extensions. The accessor
860     *              "getType" gives direct access to the value
861     */
862    public OperationDefinitionParameterComponent setTypeElement(CodeType value) {
863      this.type = value;
864      return this;
865    }
866
867    /**
868     * @return The type for this parameter.
869     */
870    public String getType() {
871      return this.type == null ? null : this.type.getValue();
872    }
873
874    /**
875     * @param value The type for this parameter.
876     */
877    public OperationDefinitionParameterComponent setType(String value) {
878      if (Utilities.noString(value))
879        this.type = null;
880      else {
881        if (this.type == null)
882          this.type = new CodeType();
883        this.type.setValue(value);
884      }
885      return this;
886    }
887
888    /**
889     * @return {@link #profile} (A profile the specifies the rules that this
890     *         parameter must conform to.)
891     */
892    public Reference getProfile() {
893      if (this.profile == null)
894        if (Configuration.errorOnAutoCreate())
895          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.profile");
896        else if (Configuration.doAutoCreate())
897          this.profile = new Reference(); // cc
898      return this.profile;
899    }
900
901    public boolean hasProfile() {
902      return this.profile != null && !this.profile.isEmpty();
903    }
904
905    /**
906     * @param value {@link #profile} (A profile the specifies the rules that this
907     *              parameter must conform to.)
908     */
909    public OperationDefinitionParameterComponent setProfile(Reference value) {
910      this.profile = value;
911      return this;
912    }
913
914    /**
915     * @return {@link #profile} The actual object that is the target of the
916     *         reference. The reference library doesn't populate this, but you can
917     *         use it to hold the resource if you resolve it. (A profile the
918     *         specifies the rules that this parameter must conform to.)
919     */
920    public StructureDefinition getProfileTarget() {
921      if (this.profileTarget == null)
922        if (Configuration.errorOnAutoCreate())
923          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.profile");
924        else if (Configuration.doAutoCreate())
925          this.profileTarget = new StructureDefinition(); // aa
926      return this.profileTarget;
927    }
928
929    /**
930     * @param value {@link #profile} The actual object that is the target of the
931     *              reference. The reference library doesn't use these, but you can
932     *              use it to hold the resource if you resolve it. (A profile the
933     *              specifies the rules that this parameter must conform to.)
934     */
935    public OperationDefinitionParameterComponent setProfileTarget(StructureDefinition value) {
936      this.profileTarget = value;
937      return this;
938    }
939
940    /**
941     * @return {@link #binding} (Binds to a value set if this parameter is coded
942     *         (code, Coding, CodeableConcept).)
943     */
944    public OperationDefinitionParameterBindingComponent getBinding() {
945      if (this.binding == null)
946        if (Configuration.errorOnAutoCreate())
947          throw new Error("Attempt to auto-create OperationDefinitionParameterComponent.binding");
948        else if (Configuration.doAutoCreate())
949          this.binding = new OperationDefinitionParameterBindingComponent(); // cc
950      return this.binding;
951    }
952
953    public boolean hasBinding() {
954      return this.binding != null && !this.binding.isEmpty();
955    }
956
957    /**
958     * @param value {@link #binding} (Binds to a value set if this parameter is
959     *              coded (code, Coding, CodeableConcept).)
960     */
961    public OperationDefinitionParameterComponent setBinding(OperationDefinitionParameterBindingComponent value) {
962      this.binding = value;
963      return this;
964    }
965
966    /**
967     * @return {@link #part} (The parts of a Tuple Parameter.)
968     */
969    public List<OperationDefinitionParameterComponent> getPart() {
970      if (this.part == null)
971        this.part = new ArrayList<OperationDefinitionParameterComponent>();
972      return this.part;
973    }
974
975    public boolean hasPart() {
976      if (this.part == null)
977        return false;
978      for (OperationDefinitionParameterComponent item : this.part)
979        if (!item.isEmpty())
980          return true;
981      return false;
982    }
983
984    /**
985     * @return {@link #part} (The parts of a Tuple Parameter.)
986     */
987    // syntactic sugar
988    public OperationDefinitionParameterComponent addPart() { // 3
989      OperationDefinitionParameterComponent t = new OperationDefinitionParameterComponent();
990      if (this.part == null)
991        this.part = new ArrayList<OperationDefinitionParameterComponent>();
992      this.part.add(t);
993      return t;
994    }
995
996    // syntactic sugar
997    public OperationDefinitionParameterComponent addPart(OperationDefinitionParameterComponent t) { // 3
998      if (t == null)
999        return this;
1000      if (this.part == null)
1001        this.part = new ArrayList<OperationDefinitionParameterComponent>();
1002      this.part.add(t);
1003      return this;
1004    }
1005
1006    protected void listChildren(List<Property> childrenList) {
1007      super.listChildren(childrenList);
1008      childrenList.add(new Property("name", "code", "The name of used to identify the parameter.", 0,
1009          java.lang.Integer.MAX_VALUE, name));
1010      childrenList.add(new Property("use", "code", "Whether this is an input or an output parameter.", 0,
1011          java.lang.Integer.MAX_VALUE, use));
1012      childrenList.add(new Property("min", "integer",
1013          "The minimum number of times this parameter SHALL appear in the request or response.", 0,
1014          java.lang.Integer.MAX_VALUE, min));
1015      childrenList.add(new Property("max", "string",
1016          "The maximum number of times this element is permitted to appear in the request or response.", 0,
1017          java.lang.Integer.MAX_VALUE, max));
1018      childrenList.add(new Property("documentation", "string", "Describes the meaning or use of this parameter.", 0,
1019          java.lang.Integer.MAX_VALUE, documentation));
1020      childrenList
1021          .add(new Property("type", "code", "The type for this parameter.", 0, java.lang.Integer.MAX_VALUE, type));
1022      childrenList.add(new Property("profile", "Reference(StructureDefinition)",
1023          "A profile the specifies the rules that this parameter must conform to.", 0, java.lang.Integer.MAX_VALUE,
1024          profile));
1025      childrenList.add(new Property("binding", "",
1026          "Binds to a value set if this parameter is coded (code, Coding, CodeableConcept).", 0,
1027          java.lang.Integer.MAX_VALUE, binding));
1028      childrenList.add(new Property("part", "@OperationDefinition.parameter", "The parts of a Tuple Parameter.", 0,
1029          java.lang.Integer.MAX_VALUE, part));
1030    }
1031
1032    @Override
1033    public void setProperty(String name, Base value) throws FHIRException {
1034      if (name.equals("name"))
1035        this.name = castToCode(value); // CodeType
1036      else if (name.equals("use"))
1037        this.use = new OperationParameterUseEnumFactory().fromType(value); // Enumeration<OperationParameterUse>
1038      else if (name.equals("min"))
1039        this.min = castToInteger(value); // IntegerType
1040      else if (name.equals("max"))
1041        this.max = castToString(value); // StringType
1042      else if (name.equals("documentation"))
1043        this.documentation = castToString(value); // StringType
1044      else if (name.equals("type"))
1045        this.type = castToCode(value); // CodeType
1046      else if (name.equals("profile"))
1047        this.profile = castToReference(value); // Reference
1048      else if (name.equals("binding"))
1049        this.binding = (OperationDefinitionParameterBindingComponent) value; // OperationDefinitionParameterBindingComponent
1050      else if (name.equals("part"))
1051        this.getPart().add((OperationDefinitionParameterComponent) value);
1052      else
1053        super.setProperty(name, value);
1054    }
1055
1056    @Override
1057    public Base addChild(String name) throws FHIRException {
1058      if (name.equals("name")) {
1059        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.name");
1060      } else if (name.equals("use")) {
1061        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.use");
1062      } else if (name.equals("min")) {
1063        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.min");
1064      } else if (name.equals("max")) {
1065        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.max");
1066      } else if (name.equals("documentation")) {
1067        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.documentation");
1068      } else if (name.equals("type")) {
1069        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.type");
1070      } else if (name.equals("profile")) {
1071        this.profile = new Reference();
1072        return this.profile;
1073      } else if (name.equals("binding")) {
1074        this.binding = new OperationDefinitionParameterBindingComponent();
1075        return this.binding;
1076      } else if (name.equals("part")) {
1077        return addPart();
1078      } else
1079        return super.addChild(name);
1080    }
1081
1082    public OperationDefinitionParameterComponent copy() {
1083      OperationDefinitionParameterComponent dst = new OperationDefinitionParameterComponent();
1084      copyValues(dst);
1085      dst.name = name == null ? null : name.copy();
1086      dst.use = use == null ? null : use.copy();
1087      dst.min = min == null ? null : min.copy();
1088      dst.max = max == null ? null : max.copy();
1089      dst.documentation = documentation == null ? null : documentation.copy();
1090      dst.type = type == null ? null : type.copy();
1091      dst.profile = profile == null ? null : profile.copy();
1092      dst.binding = binding == null ? null : binding.copy();
1093      if (part != null) {
1094        dst.part = new ArrayList<OperationDefinitionParameterComponent>();
1095        for (OperationDefinitionParameterComponent i : part)
1096          dst.part.add(i.copy());
1097      }
1098      ;
1099      return dst;
1100    }
1101
1102    @Override
1103    public boolean equalsDeep(Base other) {
1104      if (!super.equalsDeep(other))
1105        return false;
1106      if (!(other instanceof OperationDefinitionParameterComponent))
1107        return false;
1108      OperationDefinitionParameterComponent o = (OperationDefinitionParameterComponent) other;
1109      return compareDeep(name, o.name, true) && compareDeep(use, o.use, true) && compareDeep(min, o.min, true)
1110          && compareDeep(max, o.max, true) && compareDeep(documentation, o.documentation, true)
1111          && compareDeep(type, o.type, true) && compareDeep(profile, o.profile, true)
1112          && compareDeep(binding, o.binding, true) && compareDeep(part, o.part, true);
1113    }
1114
1115    @Override
1116    public boolean equalsShallow(Base other) {
1117      if (!super.equalsShallow(other))
1118        return false;
1119      if (!(other instanceof OperationDefinitionParameterComponent))
1120        return false;
1121      OperationDefinitionParameterComponent o = (OperationDefinitionParameterComponent) other;
1122      return compareValues(name, o.name, true) && compareValues(use, o.use, true) && compareValues(min, o.min, true)
1123          && compareValues(max, o.max, true) && compareValues(documentation, o.documentation, true)
1124          && compareValues(type, o.type, true);
1125    }
1126
1127    public boolean isEmpty() {
1128      return super.isEmpty() && (name == null || name.isEmpty()) && (use == null || use.isEmpty())
1129          && (min == null || min.isEmpty()) && (max == null || max.isEmpty())
1130          && (documentation == null || documentation.isEmpty()) && (type == null || type.isEmpty())
1131          && (profile == null || profile.isEmpty()) && (binding == null || binding.isEmpty())
1132          && (part == null || part.isEmpty());
1133    }
1134
1135    public String fhirType() {
1136      return "OperationDefinition.parameter";
1137
1138    }
1139
1140  }
1141
1142  @Block()
1143  public static class OperationDefinitionParameterBindingComponent extends BackboneElement
1144      implements IBaseBackboneElement {
1145    /**
1146     * Indicates the degree of conformance expectations associated with this binding
1147     * - that is, the degree to which the provided value set must be adhered to in
1148     * the instances.
1149     */
1150    @Child(name = "strength", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1151    @Description(shortDefinition = "required | extensible | preferred | example", formalDefinition = "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.")
1152    protected Enumeration<BindingStrength> strength;
1153
1154    /**
1155     * Points to the value set or external definition (e.g. implicit value set) that
1156     * identifies the set of codes to be used.
1157     */
1158    @Child(name = "valueSet", type = { UriType.class,
1159        ValueSet.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1160    @Description(shortDefinition = "Source of value set", formalDefinition = "Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.")
1161    protected Type valueSet;
1162
1163    private static final long serialVersionUID = 857140521L;
1164
1165    /*
1166     * Constructor
1167     */
1168    public OperationDefinitionParameterBindingComponent() {
1169      super();
1170    }
1171
1172    /*
1173     * Constructor
1174     */
1175    public OperationDefinitionParameterBindingComponent(Enumeration<BindingStrength> strength, Type valueSet) {
1176      super();
1177      this.strength = strength;
1178      this.valueSet = valueSet;
1179    }
1180
1181    /**
1182     * @return {@link #strength} (Indicates the degree of conformance expectations
1183     *         associated with this binding - that is, the degree to which the
1184     *         provided value set must be adhered to in the instances.). This is the
1185     *         underlying object with id, value and extensions. The accessor
1186     *         "getStrength" gives direct access to the value
1187     */
1188    public Enumeration<BindingStrength> getStrengthElement() {
1189      if (this.strength == null)
1190        if (Configuration.errorOnAutoCreate())
1191          throw new Error("Attempt to auto-create OperationDefinitionParameterBindingComponent.strength");
1192        else if (Configuration.doAutoCreate())
1193          this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory()); // bb
1194      return this.strength;
1195    }
1196
1197    public boolean hasStrengthElement() {
1198      return this.strength != null && !this.strength.isEmpty();
1199    }
1200
1201    public boolean hasStrength() {
1202      return this.strength != null && !this.strength.isEmpty();
1203    }
1204
1205    /**
1206     * @param value {@link #strength} (Indicates the degree of conformance
1207     *              expectations associated with this binding - that is, the degree
1208     *              to which the provided value set must be adhered to in the
1209     *              instances.). This is the underlying object with id, value and
1210     *              extensions. The accessor "getStrength" gives direct access to
1211     *              the value
1212     */
1213    public OperationDefinitionParameterBindingComponent setStrengthElement(Enumeration<BindingStrength> value) {
1214      this.strength = value;
1215      return this;
1216    }
1217
1218    /**
1219     * @return Indicates the degree of conformance expectations associated with this
1220     *         binding - that is, the degree to which the provided value set must be
1221     *         adhered to in the instances.
1222     */
1223    public BindingStrength getStrength() {
1224      return this.strength == null ? null : this.strength.getValue();
1225    }
1226
1227    /**
1228     * @param value Indicates the degree of conformance expectations associated with
1229     *              this binding - that is, the degree to which the provided value
1230     *              set must be adhered to in the instances.
1231     */
1232    public OperationDefinitionParameterBindingComponent setStrength(BindingStrength value) {
1233      if (this.strength == null)
1234        this.strength = new Enumeration<BindingStrength>(new BindingStrengthEnumFactory());
1235      this.strength.setValue(value);
1236      return this;
1237    }
1238
1239    /**
1240     * @return {@link #valueSet} (Points to the value set or external definition
1241     *         (e.g. implicit value set) that identifies the set of codes to be
1242     *         used.)
1243     */
1244    public Type getValueSet() {
1245      return this.valueSet;
1246    }
1247
1248    /**
1249     * @return {@link #valueSet} (Points to the value set or external definition
1250     *         (e.g. implicit value set) that identifies the set of codes to be
1251     *         used.)
1252     */
1253    public UriType getValueSetUriType() throws FHIRException {
1254      if (!(this.valueSet instanceof UriType))
1255        throw new FHIRException("Type mismatch: the type UriType was expected, but "
1256            + this.valueSet.getClass().getName() + " was encountered");
1257      return (UriType) this.valueSet;
1258    }
1259
1260    public boolean hasValueSetUriType() {
1261      return this.valueSet instanceof UriType;
1262    }
1263
1264    /**
1265     * @return {@link #valueSet} (Points to the value set or external definition
1266     *         (e.g. implicit value set) that identifies the set of codes to be
1267     *         used.)
1268     */
1269    public Reference getValueSetReference() throws FHIRException {
1270      if (!(this.valueSet instanceof Reference))
1271        throw new FHIRException("Type mismatch: the type Reference was expected, but "
1272            + this.valueSet.getClass().getName() + " was encountered");
1273      return (Reference) this.valueSet;
1274    }
1275
1276    public boolean hasValueSetReference() {
1277      return this.valueSet instanceof Reference;
1278    }
1279
1280    public boolean hasValueSet() {
1281      return this.valueSet != null && !this.valueSet.isEmpty();
1282    }
1283
1284    /**
1285     * @param value {@link #valueSet} (Points to the value set or external
1286     *              definition (e.g. implicit value set) that identifies the set of
1287     *              codes to be used.)
1288     */
1289    public OperationDefinitionParameterBindingComponent setValueSet(Type value) {
1290      this.valueSet = value;
1291      return this;
1292    }
1293
1294    protected void listChildren(List<Property> childrenList) {
1295      super.listChildren(childrenList);
1296      childrenList.add(new Property("strength", "code",
1297          "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.",
1298          0, java.lang.Integer.MAX_VALUE, strength));
1299      childrenList.add(new Property("valueSet[x]", "uri|Reference(ValueSet)",
1300          "Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.",
1301          0, java.lang.Integer.MAX_VALUE, valueSet));
1302    }
1303
1304    @Override
1305    public void setProperty(String name, Base value) throws FHIRException {
1306      if (name.equals("strength"))
1307        this.strength = new BindingStrengthEnumFactory().fromType(value); // Enumeration<BindingStrength>
1308      else if (name.equals("valueSet[x]"))
1309        this.valueSet = (Type) value; // Type
1310      else
1311        super.setProperty(name, value);
1312    }
1313
1314    @Override
1315    public Base addChild(String name) throws FHIRException {
1316      if (name.equals("strength")) {
1317        throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.strength");
1318      } else if (name.equals("valueSetUri")) {
1319        this.valueSet = new UriType();
1320        return this.valueSet;
1321      } else if (name.equals("valueSetReference")) {
1322        this.valueSet = new Reference();
1323        return this.valueSet;
1324      } else
1325        return super.addChild(name);
1326    }
1327
1328    public OperationDefinitionParameterBindingComponent copy() {
1329      OperationDefinitionParameterBindingComponent dst = new OperationDefinitionParameterBindingComponent();
1330      copyValues(dst);
1331      dst.strength = strength == null ? null : strength.copy();
1332      dst.valueSet = valueSet == null ? null : valueSet.copy();
1333      return dst;
1334    }
1335
1336    @Override
1337    public boolean equalsDeep(Base other) {
1338      if (!super.equalsDeep(other))
1339        return false;
1340      if (!(other instanceof OperationDefinitionParameterBindingComponent))
1341        return false;
1342      OperationDefinitionParameterBindingComponent o = (OperationDefinitionParameterBindingComponent) other;
1343      return compareDeep(strength, o.strength, true) && compareDeep(valueSet, o.valueSet, true);
1344    }
1345
1346    @Override
1347    public boolean equalsShallow(Base other) {
1348      if (!super.equalsShallow(other))
1349        return false;
1350      if (!(other instanceof OperationDefinitionParameterBindingComponent))
1351        return false;
1352      OperationDefinitionParameterBindingComponent o = (OperationDefinitionParameterBindingComponent) other;
1353      return compareValues(strength, o.strength, true);
1354    }
1355
1356    public boolean isEmpty() {
1357      return super.isEmpty() && (strength == null || strength.isEmpty()) && (valueSet == null || valueSet.isEmpty());
1358    }
1359
1360    public String fhirType() {
1361      return "OperationDefinition.parameter.binding";
1362
1363    }
1364
1365  }
1366
1367  /**
1368   * An absolute URL that is used to identify this operation definition when it is
1369   * referenced in a specification, model, design or an instance. This SHALL be a
1370   * URL, SHOULD be globally unique, and SHOULD be an address at which this
1371   * operation definition is (or will be) published.
1372   */
1373  @Child(name = "url", type = { UriType.class }, order = 0, min = 0, max = 1, modifier = false, summary = false)
1374  @Description(shortDefinition = "Logical URL to reference this operation definition", formalDefinition = "An absolute URL that is used to identify this operation definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this operation definition is (or will be) published.")
1375  protected UriType url;
1376
1377  /**
1378   * The identifier that is used to identify this version of the profile when it
1379   * is referenced in a specification, model, design or instance. This is an
1380   * arbitrary value managed by the profile author manually and the value should
1381   * be a timestamp.
1382   */
1383  @Child(name = "version", type = { StringType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
1384  @Description(shortDefinition = "Logical id for this version of the operation definition", formalDefinition = "The identifier that is used to identify this version of the profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.")
1385  protected StringType version;
1386
1387  /**
1388   * A free text natural language name identifying the operation.
1389   */
1390  @Child(name = "name", type = { StringType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
1391  @Description(shortDefinition = "Informal name for this operation", formalDefinition = "A free text natural language name identifying the operation.")
1392  protected StringType name;
1393
1394  /**
1395   * The status of the profile.
1396   */
1397  @Child(name = "status", type = { CodeType.class }, order = 3, min = 1, max = 1, modifier = true, summary = false)
1398  @Description(shortDefinition = "draft | active | retired", formalDefinition = "The status of the profile.")
1399  protected Enumeration<ConformanceResourceStatus> status;
1400
1401  /**
1402   * Whether this is an operation or a named query.
1403   */
1404  @Child(name = "kind", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
1405  @Description(shortDefinition = "operation | query", formalDefinition = "Whether this is an operation or a named query.")
1406  protected Enumeration<OperationKind> kind;
1407
1408  /**
1409   * This profile was authored for testing purposes (or
1410   * education/evaluation/marketing), and is not intended to be used for genuine
1411   * usage.
1412   */
1413  @Child(name = "experimental", type = {
1414      BooleanType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
1415  @Description(shortDefinition = "If for testing purposes, not real usage", formalDefinition = "This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.")
1416  protected BooleanType experimental;
1417
1418  /**
1419   * The name of the individual or organization that published the operation
1420   * definition.
1421   */
1422  @Child(name = "publisher", type = { StringType.class }, order = 6, min = 0, max = 1, modifier = false, summary = true)
1423  @Description(shortDefinition = "Name of the publisher (Organization or individual)", formalDefinition = "The name of the individual or organization that published the operation definition.")
1424  protected StringType publisher;
1425
1426  /**
1427   * Contacts to assist a user in finding and communicating with the publisher.
1428   */
1429  @Child(name = "contact", type = {}, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
1430  @Description(shortDefinition = "Contact details of the publisher", formalDefinition = "Contacts to assist a user in finding and communicating with the publisher.")
1431  protected List<OperationDefinitionContactComponent> contact;
1432
1433  /**
1434   * The date this version of the operation definition was published. The date
1435   * must change when the business version changes, if it does, and it must change
1436   * if the status code changes. In addition, it should change when the
1437   * substantive content of the Operation Definition changes.
1438   */
1439  @Child(name = "date", type = { DateTimeType.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
1440  @Description(shortDefinition = "Date for this version of the operation definition", formalDefinition = "The date this version of the operation definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the Operation Definition changes.")
1441  protected DateTimeType date;
1442
1443  /**
1444   * A free text natural language description of the profile and its use.
1445   */
1446  @Child(name = "description", type = {
1447      StringType.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
1448  @Description(shortDefinition = "Natural language description of the operation", formalDefinition = "A free text natural language description of the profile and its use.")
1449  protected StringType description;
1450
1451  /**
1452   * Explains why this operation definition is needed and why it's been
1453   * constrained as it has.
1454   */
1455  @Child(name = "requirements", type = {
1456      StringType.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
1457  @Description(shortDefinition = "Why is this needed?", formalDefinition = "Explains why this operation definition is needed and why it's been constrained as it has.")
1458  protected StringType requirements;
1459
1460  /**
1461   * Operations that are idempotent (see [HTTP specification definition of
1462   * idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)) may be
1463   * invoked by performing an HTTP GET operation instead of a POST.
1464   */
1465  @Child(name = "idempotent", type = {
1466      BooleanType.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
1467  @Description(shortDefinition = "Whether content is unchanged by operation", formalDefinition = "Operations that are idempotent (see [HTTP specification definition of idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)) may be invoked by performing an HTTP GET operation instead of a POST.")
1468  protected BooleanType idempotent;
1469
1470  /**
1471   * The name used to invoke the operation.
1472   */
1473  @Child(name = "code", type = { CodeType.class }, order = 12, min = 1, max = 1, modifier = false, summary = false)
1474  @Description(shortDefinition = "Name used to invoke the operation", formalDefinition = "The name used to invoke the operation.")
1475  protected CodeType code;
1476
1477  /**
1478   * Additional information about how to use this operation or named query.
1479   */
1480  @Child(name = "notes", type = { StringType.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
1481  @Description(shortDefinition = "Additional information about use", formalDefinition = "Additional information about how to use this operation or named query.")
1482  protected StringType notes;
1483
1484  /**
1485   * Indicates that this operation definition is a constraining profile on the
1486   * base.
1487   */
1488  @Child(name = "base", type = {
1489      OperationDefinition.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
1490  @Description(shortDefinition = "Marks this as a profile of the base", formalDefinition = "Indicates that this operation definition is a constraining profile on the base.")
1491  protected Reference base;
1492
1493  /**
1494   * The actual object that is the target of the reference (Indicates that this
1495   * operation definition is a constraining profile on the base.)
1496   */
1497  protected OperationDefinition baseTarget;
1498
1499  /**
1500   * Indicates whether this operation or named query can be invoked at the system
1501   * level (e.g. without needing to choose a resource type for the context).
1502   */
1503  @Child(name = "system", type = { BooleanType.class }, order = 15, min = 1, max = 1, modifier = false, summary = false)
1504  @Description(shortDefinition = "Invoke at the system level?", formalDefinition = "Indicates whether this operation or named query can be invoked at the system level (e.g. without needing to choose a resource type for the context).")
1505  protected BooleanType system;
1506
1507  /**
1508   * Indicates whether this operation or named query can be invoked at the
1509   * resource type level for any given resource type level (e.g. without needing
1510   * to choose a resource type for the context).
1511   */
1512  @Child(name = "type", type = {
1513      CodeType.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1514  @Description(shortDefinition = "Invoke at resource level for these type", formalDefinition = "Indicates whether this operation or named query can be invoked at the resource type level for any given resource type level (e.g. without needing to choose a resource type for the context).")
1515  protected List<CodeType> type;
1516
1517  /**
1518   * Indicates whether this operation can be invoked on a particular instance of
1519   * one of the given types.
1520   */
1521  @Child(name = "instance", type = {
1522      BooleanType.class }, order = 17, min = 1, max = 1, modifier = false, summary = false)
1523  @Description(shortDefinition = "Invoke on an instance?", formalDefinition = "Indicates whether this operation can be invoked on a particular instance of one of the given types.")
1524  protected BooleanType instance;
1525
1526  /**
1527   * The parameters for the operation/query.
1528   */
1529  @Child(name = "parameter", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1530  @Description(shortDefinition = "Parameters for the operation/query", formalDefinition = "The parameters for the operation/query.")
1531  protected List<OperationDefinitionParameterComponent> parameter;
1532
1533  private static final long serialVersionUID = 148203484L;
1534
1535  /*
1536   * Constructor
1537   */
1538  public OperationDefinition() {
1539    super();
1540  }
1541
1542  /*
1543   * Constructor
1544   */
1545  public OperationDefinition(StringType name, Enumeration<ConformanceResourceStatus> status,
1546      Enumeration<OperationKind> kind, CodeType code, BooleanType system, BooleanType instance) {
1547    super();
1548    this.name = name;
1549    this.status = status;
1550    this.kind = kind;
1551    this.code = code;
1552    this.system = system;
1553    this.instance = instance;
1554  }
1555
1556  /**
1557   * @return {@link #url} (An absolute URL that is used to identify this operation
1558   *         definition when it is referenced in a specification, model, design or
1559   *         an instance. This SHALL be a URL, SHOULD be globally unique, and
1560   *         SHOULD be an address at which this operation definition is (or will
1561   *         be) published.). This is the underlying object with id, value and
1562   *         extensions. The accessor "getUrl" gives direct access to the value
1563   */
1564  public UriType getUrlElement() {
1565    if (this.url == null)
1566      if (Configuration.errorOnAutoCreate())
1567        throw new Error("Attempt to auto-create OperationDefinition.url");
1568      else if (Configuration.doAutoCreate())
1569        this.url = new UriType(); // bb
1570    return this.url;
1571  }
1572
1573  public boolean hasUrlElement() {
1574    return this.url != null && !this.url.isEmpty();
1575  }
1576
1577  public boolean hasUrl() {
1578    return this.url != null && !this.url.isEmpty();
1579  }
1580
1581  /**
1582   * @param value {@link #url} (An absolute URL that is used to identify this
1583   *              operation definition when it is referenced in a specification,
1584   *              model, design or an instance. This SHALL be a URL, SHOULD be
1585   *              globally unique, and SHOULD be an address at which this
1586   *              operation definition is (or will be) published.). This is the
1587   *              underlying object with id, value and extensions. The accessor
1588   *              "getUrl" gives direct access to the value
1589   */
1590  public OperationDefinition setUrlElement(UriType value) {
1591    this.url = value;
1592    return this;
1593  }
1594
1595  /**
1596   * @return An absolute URL that is used to identify this operation definition
1597   *         when it is referenced in a specification, model, design or an
1598   *         instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD
1599   *         be an address at which this operation definition is (or will be)
1600   *         published.
1601   */
1602  public String getUrl() {
1603    return this.url == null ? null : this.url.getValue();
1604  }
1605
1606  /**
1607   * @param value An absolute URL that is used to identify this operation
1608   *              definition when it is referenced in a specification, model,
1609   *              design or an instance. This SHALL be a URL, SHOULD be globally
1610   *              unique, and SHOULD be an address at which this operation
1611   *              definition is (or will be) published.
1612   */
1613  public OperationDefinition setUrl(String value) {
1614    if (Utilities.noString(value))
1615      this.url = null;
1616    else {
1617      if (this.url == null)
1618        this.url = new UriType();
1619      this.url.setValue(value);
1620    }
1621    return this;
1622  }
1623
1624  /**
1625   * @return {@link #version} (The identifier that is used to identify this
1626   *         version of the profile when it is referenced in a specification,
1627   *         model, design or instance. This is an arbitrary value managed by the
1628   *         profile author manually and the value should be a timestamp.). This
1629   *         is the underlying object with id, value and extensions. The accessor
1630   *         "getVersion" gives direct access to the value
1631   */
1632  public StringType getVersionElement() {
1633    if (this.version == null)
1634      if (Configuration.errorOnAutoCreate())
1635        throw new Error("Attempt to auto-create OperationDefinition.version");
1636      else if (Configuration.doAutoCreate())
1637        this.version = new StringType(); // bb
1638    return this.version;
1639  }
1640
1641  public boolean hasVersionElement() {
1642    return this.version != null && !this.version.isEmpty();
1643  }
1644
1645  public boolean hasVersion() {
1646    return this.version != null && !this.version.isEmpty();
1647  }
1648
1649  /**
1650   * @param value {@link #version} (The identifier that is used to identify this
1651   *              version of the profile when it is referenced in a specification,
1652   *              model, design or instance. This is an arbitrary value managed by
1653   *              the profile author manually and the value should be a
1654   *              timestamp.). This is the underlying object with id, value and
1655   *              extensions. The accessor "getVersion" gives direct access to the
1656   *              value
1657   */
1658  public OperationDefinition setVersionElement(StringType value) {
1659    this.version = value;
1660    return this;
1661  }
1662
1663  /**
1664   * @return The identifier that is used to identify this version of the profile
1665   *         when it is referenced in a specification, model, design or instance.
1666   *         This is an arbitrary value managed by the profile author manually and
1667   *         the value should be a timestamp.
1668   */
1669  public String getVersion() {
1670    return this.version == null ? null : this.version.getValue();
1671  }
1672
1673  /**
1674   * @param value The identifier that is used to identify this version of the
1675   *              profile when it is referenced in a specification, model, design
1676   *              or instance. This is an arbitrary value managed by the profile
1677   *              author manually and the value should be a timestamp.
1678   */
1679  public OperationDefinition setVersion(String value) {
1680    if (Utilities.noString(value))
1681      this.version = null;
1682    else {
1683      if (this.version == null)
1684        this.version = new StringType();
1685      this.version.setValue(value);
1686    }
1687    return this;
1688  }
1689
1690  /**
1691   * @return {@link #name} (A free text natural language name identifying the
1692   *         operation.). This is the underlying object with id, value and
1693   *         extensions. The accessor "getName" gives direct access to the value
1694   */
1695  public StringType getNameElement() {
1696    if (this.name == null)
1697      if (Configuration.errorOnAutoCreate())
1698        throw new Error("Attempt to auto-create OperationDefinition.name");
1699      else if (Configuration.doAutoCreate())
1700        this.name = new StringType(); // bb
1701    return this.name;
1702  }
1703
1704  public boolean hasNameElement() {
1705    return this.name != null && !this.name.isEmpty();
1706  }
1707
1708  public boolean hasName() {
1709    return this.name != null && !this.name.isEmpty();
1710  }
1711
1712  /**
1713   * @param value {@link #name} (A free text natural language name identifying the
1714   *              operation.). This is the underlying object with id, value and
1715   *              extensions. The accessor "getName" gives direct access to the
1716   *              value
1717   */
1718  public OperationDefinition setNameElement(StringType value) {
1719    this.name = value;
1720    return this;
1721  }
1722
1723  /**
1724   * @return A free text natural language name identifying the operation.
1725   */
1726  public String getName() {
1727    return this.name == null ? null : this.name.getValue();
1728  }
1729
1730  /**
1731   * @param value A free text natural language name identifying the operation.
1732   */
1733  public OperationDefinition setName(String value) {
1734    if (this.name == null)
1735      this.name = new StringType();
1736    this.name.setValue(value);
1737    return this;
1738  }
1739
1740  /**
1741   * @return {@link #status} (The status of the profile.). This is the underlying
1742   *         object with id, value and extensions. The accessor "getStatus" gives
1743   *         direct access to the value
1744   */
1745  public Enumeration<ConformanceResourceStatus> getStatusElement() {
1746    if (this.status == null)
1747      if (Configuration.errorOnAutoCreate())
1748        throw new Error("Attempt to auto-create OperationDefinition.status");
1749      else if (Configuration.doAutoCreate())
1750        this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
1751    return this.status;
1752  }
1753
1754  public boolean hasStatusElement() {
1755    return this.status != null && !this.status.isEmpty();
1756  }
1757
1758  public boolean hasStatus() {
1759    return this.status != null && !this.status.isEmpty();
1760  }
1761
1762  /**
1763   * @param value {@link #status} (The status of the profile.). This is the
1764   *              underlying object with id, value and extensions. The accessor
1765   *              "getStatus" gives direct access to the value
1766   */
1767  public OperationDefinition setStatusElement(Enumeration<ConformanceResourceStatus> value) {
1768    this.status = value;
1769    return this;
1770  }
1771
1772  /**
1773   * @return The status of the profile.
1774   */
1775  public ConformanceResourceStatus getStatus() {
1776    return this.status == null ? null : this.status.getValue();
1777  }
1778
1779  /**
1780   * @param value The status of the profile.
1781   */
1782  public OperationDefinition setStatus(ConformanceResourceStatus value) {
1783    if (this.status == null)
1784      this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
1785    this.status.setValue(value);
1786    return this;
1787  }
1788
1789  /**
1790   * @return {@link #kind} (Whether this is an operation or a named query.). This
1791   *         is the underlying object with id, value and extensions. The accessor
1792   *         "getKind" gives direct access to the value
1793   */
1794  public Enumeration<OperationKind> getKindElement() {
1795    if (this.kind == null)
1796      if (Configuration.errorOnAutoCreate())
1797        throw new Error("Attempt to auto-create OperationDefinition.kind");
1798      else if (Configuration.doAutoCreate())
1799        this.kind = new Enumeration<OperationKind>(new OperationKindEnumFactory()); // bb
1800    return this.kind;
1801  }
1802
1803  public boolean hasKindElement() {
1804    return this.kind != null && !this.kind.isEmpty();
1805  }
1806
1807  public boolean hasKind() {
1808    return this.kind != null && !this.kind.isEmpty();
1809  }
1810
1811  /**
1812   * @param value {@link #kind} (Whether this is an operation or a named query.).
1813   *              This is the underlying object with id, value and extensions. The
1814   *              accessor "getKind" gives direct access to the value
1815   */
1816  public OperationDefinition setKindElement(Enumeration<OperationKind> value) {
1817    this.kind = value;
1818    return this;
1819  }
1820
1821  /**
1822   * @return Whether this is an operation or a named query.
1823   */
1824  public OperationKind getKind() {
1825    return this.kind == null ? null : this.kind.getValue();
1826  }
1827
1828  /**
1829   * @param value Whether this is an operation or a named query.
1830   */
1831  public OperationDefinition setKind(OperationKind value) {
1832    if (this.kind == null)
1833      this.kind = new Enumeration<OperationKind>(new OperationKindEnumFactory());
1834    this.kind.setValue(value);
1835    return this;
1836  }
1837
1838  /**
1839   * @return {@link #experimental} (This profile was authored for testing purposes
1840   *         (or education/evaluation/marketing), and is not intended to be used
1841   *         for genuine usage.). This is the underlying object with id, value and
1842   *         extensions. The accessor "getExperimental" gives direct access to the
1843   *         value
1844   */
1845  public BooleanType getExperimentalElement() {
1846    if (this.experimental == null)
1847      if (Configuration.errorOnAutoCreate())
1848        throw new Error("Attempt to auto-create OperationDefinition.experimental");
1849      else if (Configuration.doAutoCreate())
1850        this.experimental = new BooleanType(); // bb
1851    return this.experimental;
1852  }
1853
1854  public boolean hasExperimentalElement() {
1855    return this.experimental != null && !this.experimental.isEmpty();
1856  }
1857
1858  public boolean hasExperimental() {
1859    return this.experimental != null && !this.experimental.isEmpty();
1860  }
1861
1862  /**
1863   * @param value {@link #experimental} (This profile was authored for testing
1864   *              purposes (or education/evaluation/marketing), and is not
1865   *              intended to be used for genuine usage.). This is the underlying
1866   *              object with id, value and extensions. The accessor
1867   *              "getExperimental" gives direct access to the value
1868   */
1869  public OperationDefinition setExperimentalElement(BooleanType value) {
1870    this.experimental = value;
1871    return this;
1872  }
1873
1874  /**
1875   * @return This profile was authored for testing purposes (or
1876   *         education/evaluation/marketing), and is not intended to be used for
1877   *         genuine usage.
1878   */
1879  public boolean getExperimental() {
1880    return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
1881  }
1882
1883  /**
1884   * @param value This profile was authored for testing purposes (or
1885   *              education/evaluation/marketing), and is not intended to be used
1886   *              for genuine usage.
1887   */
1888  public OperationDefinition setExperimental(boolean value) {
1889    if (this.experimental == null)
1890      this.experimental = new BooleanType();
1891    this.experimental.setValue(value);
1892    return this;
1893  }
1894
1895  /**
1896   * @return {@link #publisher} (The name of the individual or organization that
1897   *         published the operation definition.). This is the underlying object
1898   *         with id, value and extensions. The accessor "getPublisher" gives
1899   *         direct access to the value
1900   */
1901  public StringType getPublisherElement() {
1902    if (this.publisher == null)
1903      if (Configuration.errorOnAutoCreate())
1904        throw new Error("Attempt to auto-create OperationDefinition.publisher");
1905      else if (Configuration.doAutoCreate())
1906        this.publisher = new StringType(); // bb
1907    return this.publisher;
1908  }
1909
1910  public boolean hasPublisherElement() {
1911    return this.publisher != null && !this.publisher.isEmpty();
1912  }
1913
1914  public boolean hasPublisher() {
1915    return this.publisher != null && !this.publisher.isEmpty();
1916  }
1917
1918  /**
1919   * @param value {@link #publisher} (The name of the individual or organization
1920   *              that published the operation definition.). This is the
1921   *              underlying object with id, value and extensions. The accessor
1922   *              "getPublisher" gives direct access to the value
1923   */
1924  public OperationDefinition setPublisherElement(StringType value) {
1925    this.publisher = value;
1926    return this;
1927  }
1928
1929  /**
1930   * @return The name of the individual or organization that published the
1931   *         operation definition.
1932   */
1933  public String getPublisher() {
1934    return this.publisher == null ? null : this.publisher.getValue();
1935  }
1936
1937  /**
1938   * @param value The name of the individual or organization that published the
1939   *              operation definition.
1940   */
1941  public OperationDefinition setPublisher(String value) {
1942    if (Utilities.noString(value))
1943      this.publisher = null;
1944    else {
1945      if (this.publisher == null)
1946        this.publisher = new StringType();
1947      this.publisher.setValue(value);
1948    }
1949    return this;
1950  }
1951
1952  /**
1953   * @return {@link #contact} (Contacts to assist a user in finding and
1954   *         communicating with the publisher.)
1955   */
1956  public List<OperationDefinitionContactComponent> getContact() {
1957    if (this.contact == null)
1958      this.contact = new ArrayList<OperationDefinitionContactComponent>();
1959    return this.contact;
1960  }
1961
1962  public boolean hasContact() {
1963    if (this.contact == null)
1964      return false;
1965    for (OperationDefinitionContactComponent item : this.contact)
1966      if (!item.isEmpty())
1967        return true;
1968    return false;
1969  }
1970
1971  /**
1972   * @return {@link #contact} (Contacts to assist a user in finding and
1973   *         communicating with the publisher.)
1974   */
1975  // syntactic sugar
1976  public OperationDefinitionContactComponent addContact() { // 3
1977    OperationDefinitionContactComponent t = new OperationDefinitionContactComponent();
1978    if (this.contact == null)
1979      this.contact = new ArrayList<OperationDefinitionContactComponent>();
1980    this.contact.add(t);
1981    return t;
1982  }
1983
1984  // syntactic sugar
1985  public OperationDefinition addContact(OperationDefinitionContactComponent t) { // 3
1986    if (t == null)
1987      return this;
1988    if (this.contact == null)
1989      this.contact = new ArrayList<OperationDefinitionContactComponent>();
1990    this.contact.add(t);
1991    return this;
1992  }
1993
1994  /**
1995   * @return {@link #date} (The date this version of the operation definition was
1996   *         published. The date must change when the business version changes, if
1997   *         it does, and it must change if the status code changes. In addition,
1998   *         it should change when the substantive content of the Operation
1999   *         Definition changes.). This is the underlying object with id, value
2000   *         and extensions. The accessor "getDate" gives direct access to the
2001   *         value
2002   */
2003  public DateTimeType getDateElement() {
2004    if (this.date == null)
2005      if (Configuration.errorOnAutoCreate())
2006        throw new Error("Attempt to auto-create OperationDefinition.date");
2007      else if (Configuration.doAutoCreate())
2008        this.date = new DateTimeType(); // bb
2009    return this.date;
2010  }
2011
2012  public boolean hasDateElement() {
2013    return this.date != null && !this.date.isEmpty();
2014  }
2015
2016  public boolean hasDate() {
2017    return this.date != null && !this.date.isEmpty();
2018  }
2019
2020  /**
2021   * @param value {@link #date} (The date this version of the operation definition
2022   *              was published. The date must change when the business version
2023   *              changes, if it does, and it must change if the status code
2024   *              changes. In addition, it should change when the substantive
2025   *              content of the Operation Definition changes.). This is the
2026   *              underlying object with id, value and extensions. The accessor
2027   *              "getDate" gives direct access to the value
2028   */
2029  public OperationDefinition setDateElement(DateTimeType value) {
2030    this.date = value;
2031    return this;
2032  }
2033
2034  /**
2035   * @return The date this version of the operation definition was published. The
2036   *         date must change when the business version changes, if it does, and
2037   *         it must change if the status code changes. In addition, it should
2038   *         change when the substantive content of the Operation Definition
2039   *         changes.
2040   */
2041  public Date getDate() {
2042    return this.date == null ? null : this.date.getValue();
2043  }
2044
2045  /**
2046   * @param value The date this version of the operation definition was published.
2047   *              The date must change when the business version changes, if it
2048   *              does, and it must change if the status code changes. In
2049   *              addition, it should change when the substantive content of the
2050   *              Operation Definition changes.
2051   */
2052  public OperationDefinition setDate(Date value) {
2053    if (value == null)
2054      this.date = null;
2055    else {
2056      if (this.date == null)
2057        this.date = new DateTimeType();
2058      this.date.setValue(value);
2059    }
2060    return this;
2061  }
2062
2063  /**
2064   * @return {@link #description} (A free text natural language description of the
2065   *         profile and its use.). This is the underlying object with id, value
2066   *         and extensions. The accessor "getDescription" gives direct access to
2067   *         the value
2068   */
2069  public StringType getDescriptionElement() {
2070    if (this.description == null)
2071      if (Configuration.errorOnAutoCreate())
2072        throw new Error("Attempt to auto-create OperationDefinition.description");
2073      else if (Configuration.doAutoCreate())
2074        this.description = new StringType(); // bb
2075    return this.description;
2076  }
2077
2078  public boolean hasDescriptionElement() {
2079    return this.description != null && !this.description.isEmpty();
2080  }
2081
2082  public boolean hasDescription() {
2083    return this.description != null && !this.description.isEmpty();
2084  }
2085
2086  /**
2087   * @param value {@link #description} (A free text natural language description
2088   *              of the profile and its use.). This is the underlying object with
2089   *              id, value and extensions. The accessor "getDescription" gives
2090   *              direct access to the value
2091   */
2092  public OperationDefinition setDescriptionElement(StringType value) {
2093    this.description = value;
2094    return this;
2095  }
2096
2097  /**
2098   * @return A free text natural language description of the profile and its use.
2099   */
2100  public String getDescription() {
2101    return this.description == null ? null : this.description.getValue();
2102  }
2103
2104  /**
2105   * @param value A free text natural language description of the profile and its
2106   *              use.
2107   */
2108  public OperationDefinition setDescription(String value) {
2109    if (Utilities.noString(value))
2110      this.description = null;
2111    else {
2112      if (this.description == null)
2113        this.description = new StringType();
2114      this.description.setValue(value);
2115    }
2116    return this;
2117  }
2118
2119  /**
2120   * @return {@link #requirements} (Explains why this operation definition is
2121   *         needed and why it's been constrained as it has.). This is the
2122   *         underlying object with id, value and extensions. The accessor
2123   *         "getRequirements" gives direct access to the value
2124   */
2125  public StringType getRequirementsElement() {
2126    if (this.requirements == null)
2127      if (Configuration.errorOnAutoCreate())
2128        throw new Error("Attempt to auto-create OperationDefinition.requirements");
2129      else if (Configuration.doAutoCreate())
2130        this.requirements = new StringType(); // bb
2131    return this.requirements;
2132  }
2133
2134  public boolean hasRequirementsElement() {
2135    return this.requirements != null && !this.requirements.isEmpty();
2136  }
2137
2138  public boolean hasRequirements() {
2139    return this.requirements != null && !this.requirements.isEmpty();
2140  }
2141
2142  /**
2143   * @param value {@link #requirements} (Explains why this operation definition is
2144   *              needed and why it's been constrained as it has.). This is the
2145   *              underlying object with id, value and extensions. The accessor
2146   *              "getRequirements" gives direct access to the value
2147   */
2148  public OperationDefinition setRequirementsElement(StringType value) {
2149    this.requirements = value;
2150    return this;
2151  }
2152
2153  /**
2154   * @return Explains why this operation definition is needed and why it's been
2155   *         constrained as it has.
2156   */
2157  public String getRequirements() {
2158    return this.requirements == null ? null : this.requirements.getValue();
2159  }
2160
2161  /**
2162   * @param value Explains why this operation definition is needed and why it's
2163   *              been constrained as it has.
2164   */
2165  public OperationDefinition setRequirements(String value) {
2166    if (Utilities.noString(value))
2167      this.requirements = null;
2168    else {
2169      if (this.requirements == null)
2170        this.requirements = new StringType();
2171      this.requirements.setValue(value);
2172    }
2173    return this;
2174  }
2175
2176  /**
2177   * @return {@link #idempotent} (Operations that are idempotent (see [HTTP
2178   *         specification definition of
2179   *         idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html))
2180   *         may be invoked by performing an HTTP GET operation instead of a
2181   *         POST.). This is the underlying object with id, value and extensions.
2182   *         The accessor "getIdempotent" gives direct access to the value
2183   */
2184  public BooleanType getIdempotentElement() {
2185    if (this.idempotent == null)
2186      if (Configuration.errorOnAutoCreate())
2187        throw new Error("Attempt to auto-create OperationDefinition.idempotent");
2188      else if (Configuration.doAutoCreate())
2189        this.idempotent = new BooleanType(); // bb
2190    return this.idempotent;
2191  }
2192
2193  public boolean hasIdempotentElement() {
2194    return this.idempotent != null && !this.idempotent.isEmpty();
2195  }
2196
2197  public boolean hasIdempotent() {
2198    return this.idempotent != null && !this.idempotent.isEmpty();
2199  }
2200
2201  /**
2202   * @param value {@link #idempotent} (Operations that are idempotent (see [HTTP
2203   *              specification definition of
2204   *              idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html))
2205   *              may be invoked by performing an HTTP GET operation instead of a
2206   *              POST.). This is the underlying object with id, value and
2207   *              extensions. The accessor "getIdempotent" gives direct access to
2208   *              the value
2209   */
2210  public OperationDefinition setIdempotentElement(BooleanType value) {
2211    this.idempotent = value;
2212    return this;
2213  }
2214
2215  /**
2216   * @return Operations that are idempotent (see [HTTP specification definition of
2217   *         idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html))
2218   *         may be invoked by performing an HTTP GET operation instead of a POST.
2219   */
2220  public boolean getIdempotent() {
2221    return this.idempotent == null || this.idempotent.isEmpty() ? false : this.idempotent.getValue();
2222  }
2223
2224  /**
2225   * @param value Operations that are idempotent (see [HTTP specification
2226   *              definition of
2227   *              idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html))
2228   *              may be invoked by performing an HTTP GET operation instead of a
2229   *              POST.
2230   */
2231  public OperationDefinition setIdempotent(boolean value) {
2232    if (this.idempotent == null)
2233      this.idempotent = new BooleanType();
2234    this.idempotent.setValue(value);
2235    return this;
2236  }
2237
2238  /**
2239   * @return {@link #code} (The name used to invoke the operation.). This is the
2240   *         underlying object with id, value and extensions. The accessor
2241   *         "getCode" gives direct access to the value
2242   */
2243  public CodeType getCodeElement() {
2244    if (this.code == null)
2245      if (Configuration.errorOnAutoCreate())
2246        throw new Error("Attempt to auto-create OperationDefinition.code");
2247      else if (Configuration.doAutoCreate())
2248        this.code = new CodeType(); // bb
2249    return this.code;
2250  }
2251
2252  public boolean hasCodeElement() {
2253    return this.code != null && !this.code.isEmpty();
2254  }
2255
2256  public boolean hasCode() {
2257    return this.code != null && !this.code.isEmpty();
2258  }
2259
2260  /**
2261   * @param value {@link #code} (The name used to invoke the operation.). This is
2262   *              the underlying object with id, value and extensions. The
2263   *              accessor "getCode" gives direct access to the value
2264   */
2265  public OperationDefinition setCodeElement(CodeType value) {
2266    this.code = value;
2267    return this;
2268  }
2269
2270  /**
2271   * @return The name used to invoke the operation.
2272   */
2273  public String getCode() {
2274    return this.code == null ? null : this.code.getValue();
2275  }
2276
2277  /**
2278   * @param value The name used to invoke the operation.
2279   */
2280  public OperationDefinition setCode(String value) {
2281    if (this.code == null)
2282      this.code = new CodeType();
2283    this.code.setValue(value);
2284    return this;
2285  }
2286
2287  /**
2288   * @return {@link #notes} (Additional information about how to use this
2289   *         operation or named query.). This is the underlying object with id,
2290   *         value and extensions. The accessor "getNotes" gives direct access to
2291   *         the value
2292   */
2293  public StringType getNotesElement() {
2294    if (this.notes == null)
2295      if (Configuration.errorOnAutoCreate())
2296        throw new Error("Attempt to auto-create OperationDefinition.notes");
2297      else if (Configuration.doAutoCreate())
2298        this.notes = new StringType(); // bb
2299    return this.notes;
2300  }
2301
2302  public boolean hasNotesElement() {
2303    return this.notes != null && !this.notes.isEmpty();
2304  }
2305
2306  public boolean hasNotes() {
2307    return this.notes != null && !this.notes.isEmpty();
2308  }
2309
2310  /**
2311   * @param value {@link #notes} (Additional information about how to use this
2312   *              operation or named query.). This is the underlying object with
2313   *              id, value and extensions. The accessor "getNotes" gives direct
2314   *              access to the value
2315   */
2316  public OperationDefinition setNotesElement(StringType value) {
2317    this.notes = value;
2318    return this;
2319  }
2320
2321  /**
2322   * @return Additional information about how to use this operation or named
2323   *         query.
2324   */
2325  public String getNotes() {
2326    return this.notes == null ? null : this.notes.getValue();
2327  }
2328
2329  /**
2330   * @param value Additional information about how to use this operation or named
2331   *              query.
2332   */
2333  public OperationDefinition setNotes(String value) {
2334    if (Utilities.noString(value))
2335      this.notes = null;
2336    else {
2337      if (this.notes == null)
2338        this.notes = new StringType();
2339      this.notes.setValue(value);
2340    }
2341    return this;
2342  }
2343
2344  /**
2345   * @return {@link #base} (Indicates that this operation definition is a
2346   *         constraining profile on the base.)
2347   */
2348  public Reference getBase() {
2349    if (this.base == null)
2350      if (Configuration.errorOnAutoCreate())
2351        throw new Error("Attempt to auto-create OperationDefinition.base");
2352      else if (Configuration.doAutoCreate())
2353        this.base = new Reference(); // cc
2354    return this.base;
2355  }
2356
2357  public boolean hasBase() {
2358    return this.base != null && !this.base.isEmpty();
2359  }
2360
2361  /**
2362   * @param value {@link #base} (Indicates that this operation definition is a
2363   *              constraining profile on the base.)
2364   */
2365  public OperationDefinition setBase(Reference value) {
2366    this.base = value;
2367    return this;
2368  }
2369
2370  /**
2371   * @return {@link #base} The actual object that is the target of the reference.
2372   *         The reference library doesn't populate this, but you can use it to
2373   *         hold the resource if you resolve it. (Indicates that this operation
2374   *         definition is a constraining profile on the base.)
2375   */
2376  public OperationDefinition getBaseTarget() {
2377    if (this.baseTarget == null)
2378      if (Configuration.errorOnAutoCreate())
2379        throw new Error("Attempt to auto-create OperationDefinition.base");
2380      else if (Configuration.doAutoCreate())
2381        this.baseTarget = new OperationDefinition(); // aa
2382    return this.baseTarget;
2383  }
2384
2385  /**
2386   * @param value {@link #base} The actual object that is the target of the
2387   *              reference. The reference library doesn't use these, but you can
2388   *              use it to hold the resource if you resolve it. (Indicates that
2389   *              this operation definition is a constraining profile on the
2390   *              base.)
2391   */
2392  public OperationDefinition setBaseTarget(OperationDefinition value) {
2393    this.baseTarget = value;
2394    return this;
2395  }
2396
2397  /**
2398   * @return {@link #system} (Indicates whether this operation or named query can
2399   *         be invoked at the system level (e.g. without needing to choose a
2400   *         resource type for the context).). This is the underlying object with
2401   *         id, value and extensions. The accessor "getSystem" gives direct
2402   *         access to the value
2403   */
2404  public BooleanType getSystemElement() {
2405    if (this.system == null)
2406      if (Configuration.errorOnAutoCreate())
2407        throw new Error("Attempt to auto-create OperationDefinition.system");
2408      else if (Configuration.doAutoCreate())
2409        this.system = new BooleanType(); // bb
2410    return this.system;
2411  }
2412
2413  public boolean hasSystemElement() {
2414    return this.system != null && !this.system.isEmpty();
2415  }
2416
2417  public boolean hasSystem() {
2418    return this.system != null && !this.system.isEmpty();
2419  }
2420
2421  /**
2422   * @param value {@link #system} (Indicates whether this operation or named query
2423   *              can be invoked at the system level (e.g. without needing to
2424   *              choose a resource type for the context).). This is the
2425   *              underlying object with id, value and extensions. The accessor
2426   *              "getSystem" gives direct access to the value
2427   */
2428  public OperationDefinition setSystemElement(BooleanType value) {
2429    this.system = value;
2430    return this;
2431  }
2432
2433  /**
2434   * @return Indicates whether this operation or named query can be invoked at the
2435   *         system level (e.g. without needing to choose a resource type for the
2436   *         context).
2437   */
2438  public boolean getSystem() {
2439    return this.system == null || this.system.isEmpty() ? false : this.system.getValue();
2440  }
2441
2442  /**
2443   * @param value Indicates whether this operation or named query can be invoked
2444   *              at the system level (e.g. without needing to choose a resource
2445   *              type for the context).
2446   */
2447  public OperationDefinition setSystem(boolean value) {
2448    if (this.system == null)
2449      this.system = new BooleanType();
2450    this.system.setValue(value);
2451    return this;
2452  }
2453
2454  /**
2455   * @return {@link #type} (Indicates whether this operation or named query can be
2456   *         invoked at the resource type level for any given resource type level
2457   *         (e.g. without needing to choose a resource type for the context).)
2458   */
2459  public List<CodeType> getType() {
2460    if (this.type == null)
2461      this.type = new ArrayList<CodeType>();
2462    return this.type;
2463  }
2464
2465  public boolean hasType() {
2466    if (this.type == null)
2467      return false;
2468    for (CodeType item : this.type)
2469      if (!item.isEmpty())
2470        return true;
2471    return false;
2472  }
2473
2474  /**
2475   * @return {@link #type} (Indicates whether this operation or named query can be
2476   *         invoked at the resource type level for any given resource type level
2477   *         (e.g. without needing to choose a resource type for the context).)
2478   */
2479  // syntactic sugar
2480  public CodeType addTypeElement() {// 2
2481    CodeType t = new CodeType();
2482    if (this.type == null)
2483      this.type = new ArrayList<CodeType>();
2484    this.type.add(t);
2485    return t;
2486  }
2487
2488  /**
2489   * @param value {@link #type} (Indicates whether this operation or named query
2490   *              can be invoked at the resource type level for any given resource
2491   *              type level (e.g. without needing to choose a resource type for
2492   *              the context).)
2493   */
2494  public OperationDefinition addType(String value) { // 1
2495    CodeType t = new CodeType();
2496    t.setValue(value);
2497    if (this.type == null)
2498      this.type = new ArrayList<CodeType>();
2499    this.type.add(t);
2500    return this;
2501  }
2502
2503  /**
2504   * @param value {@link #type} (Indicates whether this operation or named query
2505   *              can be invoked at the resource type level for any given resource
2506   *              type level (e.g. without needing to choose a resource type for
2507   *              the context).)
2508   */
2509  public boolean hasType(String value) {
2510    if (this.type == null)
2511      return false;
2512    for (CodeType v : this.type)
2513      if (v.equals(value)) // code
2514        return true;
2515    return false;
2516  }
2517
2518  /**
2519   * @return {@link #instance} (Indicates whether this operation can be invoked on
2520   *         a particular instance of one of the given types.). This is the
2521   *         underlying object with id, value and extensions. The accessor
2522   *         "getInstance" gives direct access to the value
2523   */
2524  public BooleanType getInstanceElement() {
2525    if (this.instance == null)
2526      if (Configuration.errorOnAutoCreate())
2527        throw new Error("Attempt to auto-create OperationDefinition.instance");
2528      else if (Configuration.doAutoCreate())
2529        this.instance = new BooleanType(); // bb
2530    return this.instance;
2531  }
2532
2533  public boolean hasInstanceElement() {
2534    return this.instance != null && !this.instance.isEmpty();
2535  }
2536
2537  public boolean hasInstance() {
2538    return this.instance != null && !this.instance.isEmpty();
2539  }
2540
2541  /**
2542   * @param value {@link #instance} (Indicates whether this operation can be
2543   *              invoked on a particular instance of one of the given types.).
2544   *              This is the underlying object with id, value and extensions. The
2545   *              accessor "getInstance" gives direct access to the value
2546   */
2547  public OperationDefinition setInstanceElement(BooleanType value) {
2548    this.instance = value;
2549    return this;
2550  }
2551
2552  /**
2553   * @return Indicates whether this operation can be invoked on a particular
2554   *         instance of one of the given types.
2555   */
2556  public boolean getInstance() {
2557    return this.instance == null || this.instance.isEmpty() ? false : this.instance.getValue();
2558  }
2559
2560  /**
2561   * @param value Indicates whether this operation can be invoked on a particular
2562   *              instance of one of the given types.
2563   */
2564  public OperationDefinition setInstance(boolean value) {
2565    if (this.instance == null)
2566      this.instance = new BooleanType();
2567    this.instance.setValue(value);
2568    return this;
2569  }
2570
2571  /**
2572   * @return {@link #parameter} (The parameters for the operation/query.)
2573   */
2574  public List<OperationDefinitionParameterComponent> getParameter() {
2575    if (this.parameter == null)
2576      this.parameter = new ArrayList<OperationDefinitionParameterComponent>();
2577    return this.parameter;
2578  }
2579
2580  public boolean hasParameter() {
2581    if (this.parameter == null)
2582      return false;
2583    for (OperationDefinitionParameterComponent item : this.parameter)
2584      if (!item.isEmpty())
2585        return true;
2586    return false;
2587  }
2588
2589  /**
2590   * @return {@link #parameter} (The parameters for the operation/query.)
2591   */
2592  // syntactic sugar
2593  public OperationDefinitionParameterComponent addParameter() { // 3
2594    OperationDefinitionParameterComponent t = new OperationDefinitionParameterComponent();
2595    if (this.parameter == null)
2596      this.parameter = new ArrayList<OperationDefinitionParameterComponent>();
2597    this.parameter.add(t);
2598    return t;
2599  }
2600
2601  // syntactic sugar
2602  public OperationDefinition addParameter(OperationDefinitionParameterComponent t) { // 3
2603    if (t == null)
2604      return this;
2605    if (this.parameter == null)
2606      this.parameter = new ArrayList<OperationDefinitionParameterComponent>();
2607    this.parameter.add(t);
2608    return this;
2609  }
2610
2611  protected void listChildren(List<Property> childrenList) {
2612    super.listChildren(childrenList);
2613    childrenList.add(new Property("url", "uri",
2614        "An absolute URL that is used to identify this operation definition when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this operation definition is (or will be) published.",
2615        0, java.lang.Integer.MAX_VALUE, url));
2616    childrenList.add(new Property("version", "string",
2617        "The identifier that is used to identify this version of the profile when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.",
2618        0, java.lang.Integer.MAX_VALUE, version));
2619    childrenList.add(new Property("name", "string", "A free text natural language name identifying the operation.", 0,
2620        java.lang.Integer.MAX_VALUE, name));
2621    childrenList
2622        .add(new Property("status", "code", "The status of the profile.", 0, java.lang.Integer.MAX_VALUE, status));
2623    childrenList.add(new Property("kind", "code", "Whether this is an operation or a named query.", 0,
2624        java.lang.Integer.MAX_VALUE, kind));
2625    childrenList.add(new Property("experimental", "boolean",
2626        "This profile was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.",
2627        0, java.lang.Integer.MAX_VALUE, experimental));
2628    childrenList.add(new Property("publisher", "string",
2629        "The name of the individual or organization that published the operation definition.", 0,
2630        java.lang.Integer.MAX_VALUE, publisher));
2631    childrenList
2632        .add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.",
2633            0, java.lang.Integer.MAX_VALUE, contact));
2634    childrenList.add(new Property("date", "dateTime",
2635        "The date this version of the operation definition was published. The date must change when the business version changes, if it does, and it must change if the status code changes. In addition, it should change when the substantive content of the Operation Definition changes.",
2636        0, java.lang.Integer.MAX_VALUE, date));
2637    childrenList.add(
2638        new Property("description", "string", "A free text natural language description of the profile and its use.", 0,
2639            java.lang.Integer.MAX_VALUE, description));
2640    childrenList.add(new Property("requirements", "string",
2641        "Explains why this operation definition is needed and why it's been constrained as it has.", 0,
2642        java.lang.Integer.MAX_VALUE, requirements));
2643    childrenList.add(new Property("idempotent", "boolean",
2644        "Operations that are idempotent (see [HTTP specification definition of idempotent](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html)) may be invoked by performing an HTTP GET operation instead of a POST.",
2645        0, java.lang.Integer.MAX_VALUE, idempotent));
2646    childrenList.add(
2647        new Property("code", "code", "The name used to invoke the operation.", 0, java.lang.Integer.MAX_VALUE, code));
2648    childrenList
2649        .add(new Property("notes", "string", "Additional information about how to use this operation or named query.",
2650            0, java.lang.Integer.MAX_VALUE, notes));
2651    childrenList.add(new Property("base", "Reference(OperationDefinition)",
2652        "Indicates that this operation definition is a constraining profile on the base.", 0,
2653        java.lang.Integer.MAX_VALUE, base));
2654    childrenList.add(new Property("system", "boolean",
2655        "Indicates whether this operation or named query can be invoked at the system level (e.g. without needing to choose a resource type for the context).",
2656        0, java.lang.Integer.MAX_VALUE, system));
2657    childrenList.add(new Property("type", "code",
2658        "Indicates whether this operation or named query can be invoked at the resource type level for any given resource type level (e.g. without needing to choose a resource type for the context).",
2659        0, java.lang.Integer.MAX_VALUE, type));
2660    childrenList.add(new Property("instance", "boolean",
2661        "Indicates whether this operation can be invoked on a particular instance of one of the given types.", 0,
2662        java.lang.Integer.MAX_VALUE, instance));
2663    childrenList.add(new Property("parameter", "", "The parameters for the operation/query.", 0,
2664        java.lang.Integer.MAX_VALUE, parameter));
2665  }
2666
2667  @Override
2668  public void setProperty(String name, Base value) throws FHIRException {
2669    if (name.equals("url"))
2670      this.url = castToUri(value); // UriType
2671    else if (name.equals("version"))
2672      this.version = castToString(value); // StringType
2673    else if (name.equals("name"))
2674      this.name = castToString(value); // StringType
2675    else if (name.equals("status"))
2676      this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
2677    else if (name.equals("kind"))
2678      this.kind = new OperationKindEnumFactory().fromType(value); // Enumeration<OperationKind>
2679    else if (name.equals("experimental"))
2680      this.experimental = castToBoolean(value); // BooleanType
2681    else if (name.equals("publisher"))
2682      this.publisher = castToString(value); // StringType
2683    else if (name.equals("contact"))
2684      this.getContact().add((OperationDefinitionContactComponent) value);
2685    else if (name.equals("date"))
2686      this.date = castToDateTime(value); // DateTimeType
2687    else if (name.equals("description"))
2688      this.description = castToString(value); // StringType
2689    else if (name.equals("requirements"))
2690      this.requirements = castToString(value); // StringType
2691    else if (name.equals("idempotent"))
2692      this.idempotent = castToBoolean(value); // BooleanType
2693    else if (name.equals("code"))
2694      this.code = castToCode(value); // CodeType
2695    else if (name.equals("notes"))
2696      this.notes = castToString(value); // StringType
2697    else if (name.equals("base"))
2698      this.base = castToReference(value); // Reference
2699    else if (name.equals("system"))
2700      this.system = castToBoolean(value); // BooleanType
2701    else if (name.equals("type"))
2702      this.getType().add(castToCode(value));
2703    else if (name.equals("instance"))
2704      this.instance = castToBoolean(value); // BooleanType
2705    else if (name.equals("parameter"))
2706      this.getParameter().add((OperationDefinitionParameterComponent) value);
2707    else
2708      super.setProperty(name, value);
2709  }
2710
2711  @Override
2712  public Base addChild(String name) throws FHIRException {
2713    if (name.equals("url")) {
2714      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.url");
2715    } else if (name.equals("version")) {
2716      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.version");
2717    } else if (name.equals("name")) {
2718      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.name");
2719    } else if (name.equals("status")) {
2720      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.status");
2721    } else if (name.equals("kind")) {
2722      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.kind");
2723    } else if (name.equals("experimental")) {
2724      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.experimental");
2725    } else if (name.equals("publisher")) {
2726      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.publisher");
2727    } else if (name.equals("contact")) {
2728      return addContact();
2729    } else if (name.equals("date")) {
2730      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.date");
2731    } else if (name.equals("description")) {
2732      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.description");
2733    } else if (name.equals("requirements")) {
2734      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.requirements");
2735    } else if (name.equals("idempotent")) {
2736      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.idempotent");
2737    } else if (name.equals("code")) {
2738      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.code");
2739    } else if (name.equals("notes")) {
2740      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.notes");
2741    } else if (name.equals("base")) {
2742      this.base = new Reference();
2743      return this.base;
2744    } else if (name.equals("system")) {
2745      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.system");
2746    } else if (name.equals("type")) {
2747      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.type");
2748    } else if (name.equals("instance")) {
2749      throw new FHIRException("Cannot call addChild on a singleton property OperationDefinition.instance");
2750    } else if (name.equals("parameter")) {
2751      return addParameter();
2752    } else
2753      return super.addChild(name);
2754  }
2755
2756  public String fhirType() {
2757    return "OperationDefinition";
2758
2759  }
2760
2761  public OperationDefinition copy() {
2762    OperationDefinition dst = new OperationDefinition();
2763    copyValues(dst);
2764    dst.url = url == null ? null : url.copy();
2765    dst.version = version == null ? null : version.copy();
2766    dst.name = name == null ? null : name.copy();
2767    dst.status = status == null ? null : status.copy();
2768    dst.kind = kind == null ? null : kind.copy();
2769    dst.experimental = experimental == null ? null : experimental.copy();
2770    dst.publisher = publisher == null ? null : publisher.copy();
2771    if (contact != null) {
2772      dst.contact = new ArrayList<OperationDefinitionContactComponent>();
2773      for (OperationDefinitionContactComponent i : contact)
2774        dst.contact.add(i.copy());
2775    }
2776    ;
2777    dst.date = date == null ? null : date.copy();
2778    dst.description = description == null ? null : description.copy();
2779    dst.requirements = requirements == null ? null : requirements.copy();
2780    dst.idempotent = idempotent == null ? null : idempotent.copy();
2781    dst.code = code == null ? null : code.copy();
2782    dst.notes = notes == null ? null : notes.copy();
2783    dst.base = base == null ? null : base.copy();
2784    dst.system = system == null ? null : system.copy();
2785    if (type != null) {
2786      dst.type = new ArrayList<CodeType>();
2787      for (CodeType i : type)
2788        dst.type.add(i.copy());
2789    }
2790    ;
2791    dst.instance = instance == null ? null : instance.copy();
2792    if (parameter != null) {
2793      dst.parameter = new ArrayList<OperationDefinitionParameterComponent>();
2794      for (OperationDefinitionParameterComponent i : parameter)
2795        dst.parameter.add(i.copy());
2796    }
2797    ;
2798    return dst;
2799  }
2800
2801  protected OperationDefinition typedCopy() {
2802    return copy();
2803  }
2804
2805  @Override
2806  public boolean equalsDeep(Base other) {
2807    if (!super.equalsDeep(other))
2808      return false;
2809    if (!(other instanceof OperationDefinition))
2810      return false;
2811    OperationDefinition o = (OperationDefinition) other;
2812    return compareDeep(url, o.url, true) && compareDeep(version, o.version, true) && compareDeep(name, o.name, true)
2813        && compareDeep(status, o.status, true) && compareDeep(kind, o.kind, true)
2814        && compareDeep(experimental, o.experimental, true) && compareDeep(publisher, o.publisher, true)
2815        && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true)
2816        && compareDeep(description, o.description, true) && compareDeep(requirements, o.requirements, true)
2817        && compareDeep(idempotent, o.idempotent, true) && compareDeep(code, o.code, true)
2818        && compareDeep(notes, o.notes, true) && compareDeep(base, o.base, true) && compareDeep(system, o.system, true)
2819        && compareDeep(type, o.type, true) && compareDeep(instance, o.instance, true)
2820        && compareDeep(parameter, o.parameter, true);
2821  }
2822
2823  @Override
2824  public boolean equalsShallow(Base other) {
2825    if (!super.equalsShallow(other))
2826      return false;
2827    if (!(other instanceof OperationDefinition))
2828      return false;
2829    OperationDefinition o = (OperationDefinition) other;
2830    return compareValues(url, o.url, true) && compareValues(version, o.version, true)
2831        && compareValues(name, o.name, true) && compareValues(status, o.status, true)
2832        && compareValues(kind, o.kind, true) && compareValues(experimental, o.experimental, true)
2833        && compareValues(publisher, o.publisher, true) && compareValues(date, o.date, true)
2834        && compareValues(description, o.description, true) && compareValues(requirements, o.requirements, true)
2835        && compareValues(idempotent, o.idempotent, true) && compareValues(code, o.code, true)
2836        && compareValues(notes, o.notes, true) && compareValues(system, o.system, true)
2837        && compareValues(type, o.type, true) && compareValues(instance, o.instance, true);
2838  }
2839
2840  public boolean isEmpty() {
2841    return super.isEmpty() && (url == null || url.isEmpty()) && (version == null || version.isEmpty())
2842        && (name == null || name.isEmpty()) && (status == null || status.isEmpty()) && (kind == null || kind.isEmpty())
2843        && (experimental == null || experimental.isEmpty()) && (publisher == null || publisher.isEmpty())
2844        && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty())
2845        && (description == null || description.isEmpty()) && (requirements == null || requirements.isEmpty())
2846        && (idempotent == null || idempotent.isEmpty()) && (code == null || code.isEmpty())
2847        && (notes == null || notes.isEmpty()) && (base == null || base.isEmpty())
2848        && (system == null || system.isEmpty()) && (type == null || type.isEmpty())
2849        && (instance == null || instance.isEmpty()) && (parameter == null || parameter.isEmpty());
2850  }
2851
2852  @Override
2853  public ResourceType getResourceType() {
2854    return ResourceType.OperationDefinition;
2855  }
2856
2857  @SearchParamDefinition(name = "date", path = "OperationDefinition.date", description = "Date for this version of the operation definition", type = "date")
2858  public static final String SP_DATE = "date";
2859  @SearchParamDefinition(name = "code", path = "OperationDefinition.code", description = "Name used to invoke the operation", type = "token")
2860  public static final String SP_CODE = "code";
2861  @SearchParamDefinition(name = "instance", path = "OperationDefinition.instance", description = "Invoke on an instance?", type = "token")
2862  public static final String SP_INSTANCE = "instance";
2863  @SearchParamDefinition(name = "kind", path = "OperationDefinition.kind", description = "operation | query", type = "token")
2864  public static final String SP_KIND = "kind";
2865  @SearchParamDefinition(name = "profile", path = "OperationDefinition.parameter.profile", description = "Profile on the type", type = "reference")
2866  public static final String SP_PROFILE = "profile";
2867  @SearchParamDefinition(name = "type", path = "OperationDefinition.type", description = "Invoke at resource level for these type", type = "token")
2868  public static final String SP_TYPE = "type";
2869  @SearchParamDefinition(name = "version", path = "OperationDefinition.version", description = "Logical id for this version of the operation definition", type = "token")
2870  public static final String SP_VERSION = "version";
2871  @SearchParamDefinition(name = "url", path = "OperationDefinition.url", description = "Logical URL to reference this operation definition", type = "uri")
2872  public static final String SP_URL = "url";
2873  @SearchParamDefinition(name = "system", path = "OperationDefinition.system", description = "Invoke at the system level?", type = "token")
2874  public static final String SP_SYSTEM = "system";
2875  @SearchParamDefinition(name = "name", path = "OperationDefinition.name", description = "Informal name for this operation", type = "string")
2876  public static final String SP_NAME = "name";
2877  @SearchParamDefinition(name = "publisher", path = "OperationDefinition.publisher", description = "Name of the publisher (Organization or individual)", type = "string")
2878  public static final String SP_PUBLISHER = "publisher";
2879  @SearchParamDefinition(name = "status", path = "OperationDefinition.status", description = "draft | active | retired", type = "token")
2880  public static final String SP_STATUS = "status";
2881  @SearchParamDefinition(name = "base", path = "OperationDefinition.base", description = "Marks this as a profile of the base", type = "reference")
2882  public static final String SP_BASE = "base";
2883
2884}