001package org.hl7.fhir.dstu2.model;
002
003
004
005
006/*
007  Copyright (c) 2011+, HL7, Inc.
008  All rights reserved.
009  
010  Redistribution and use in source and binary forms, with or without modification, 
011  are permitted provided that the following conditions are met:
012  
013   * Redistributions of source code must retain the above copyright notice, this 
014     list of conditions and the following disclaimer.
015   * Redistributions in binary form must reproduce the above copyright notice, 
016     this list of conditions and the following disclaimer in the documentation 
017     and/or other materials provided with the distribution.
018   * Neither the name of HL7 nor the names of its contributors may be used to 
019     endorse or promote products derived from this software without specific 
020     prior written permission.
021  
022  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
023  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
024  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
025  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
026  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
027  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
028  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
029  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
030  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
031  POSSIBILITY OF SUCH DAMAGE.
032  
033*/
034
035// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
036import java.util.ArrayList;
037import java.util.Date;
038import java.util.List;
039
040import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatus;
041import org.hl7.fhir.dstu2.model.Enumerations.ConformanceResourceStatusEnumFactory;
042import org.hl7.fhir.dstu2.model.Enumerations.SearchParamType;
043import org.hl7.fhir.dstu2.model.Enumerations.SearchParamTypeEnumFactory;
044import ca.uhn.fhir.model.api.annotation.Block;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.Description;
047import ca.uhn.fhir.model.api.annotation.ResourceDef;
048import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
049import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
050import org.hl7.fhir.exceptions.FHIRException;
051import org.hl7.fhir.utilities.Utilities;
052/**
053 * A search parameter that defines a named search item that can be used to search/filter on a resource.
054 */
055@ResourceDef(name="SearchParameter", profile="http://hl7.org/fhir/Profile/SearchParameter")
056public class SearchParameter extends DomainResource {
057
058    public enum XPathUsageType {
059        /**
060         * The search parameter is derived directly from the selected nodes based on the type definitions.
061         */
062        NORMAL, 
063        /**
064         * The search parameter is derived by a phonetic transform from the selected nodes.
065         */
066        PHONETIC, 
067        /**
068         * The search parameter is based on a spatial transform of the selected nodes.
069         */
070        NEARBY, 
071        /**
072         * The search parameter is based on a spatial transform of the selected nodes, using physical distance from the middle.
073         */
074        DISTANCE, 
075        /**
076         * The interpretation of the xpath statement is unknown (and can't be automated).
077         */
078        OTHER, 
079        /**
080         * added to help the parsers
081         */
082        NULL;
083        public static XPathUsageType fromCode(String codeString) throws FHIRException {
084            if (codeString == null || "".equals(codeString))
085                return null;
086        if ("normal".equals(codeString))
087          return NORMAL;
088        if ("phonetic".equals(codeString))
089          return PHONETIC;
090        if ("nearby".equals(codeString))
091          return NEARBY;
092        if ("distance".equals(codeString))
093          return DISTANCE;
094        if ("other".equals(codeString))
095          return OTHER;
096        throw new FHIRException("Unknown XPathUsageType code '"+codeString+"'");
097        }
098        public String toCode() {
099          switch (this) {
100            case NORMAL: return "normal";
101            case PHONETIC: return "phonetic";
102            case NEARBY: return "nearby";
103            case DISTANCE: return "distance";
104            case OTHER: return "other";
105            case NULL: return null;
106            default: return "?";
107          }
108        }
109        public String getSystem() {
110          switch (this) {
111            case NORMAL: return "http://hl7.org/fhir/search-xpath-usage";
112            case PHONETIC: return "http://hl7.org/fhir/search-xpath-usage";
113            case NEARBY: return "http://hl7.org/fhir/search-xpath-usage";
114            case DISTANCE: return "http://hl7.org/fhir/search-xpath-usage";
115            case OTHER: return "http://hl7.org/fhir/search-xpath-usage";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120        public String getDefinition() {
121          switch (this) {
122            case NORMAL: return "The search parameter is derived directly from the selected nodes based on the type definitions.";
123            case PHONETIC: return "The search parameter is derived by a phonetic transform from the selected nodes.";
124            case NEARBY: return "The search parameter is based on a spatial transform of the selected nodes.";
125            case DISTANCE: return "The search parameter is based on a spatial transform of the selected nodes, using physical distance from the middle.";
126            case OTHER: return "The interpretation of the xpath statement is unknown (and can't be automated).";
127            case NULL: return null;
128            default: return "?";
129          }
130        }
131        public String getDisplay() {
132          switch (this) {
133            case NORMAL: return "Normal";
134            case PHONETIC: return "Phonetic";
135            case NEARBY: return "Nearby";
136            case DISTANCE: return "Distance";
137            case OTHER: return "Other";
138            case NULL: return null;
139            default: return "?";
140          }
141        }
142    }
143
144  public static class XPathUsageTypeEnumFactory implements EnumFactory<XPathUsageType> {
145    public XPathUsageType fromCode(String codeString) throws IllegalArgumentException {
146      if (codeString == null || "".equals(codeString))
147            if (codeString == null || "".equals(codeString))
148                return null;
149        if ("normal".equals(codeString))
150          return XPathUsageType.NORMAL;
151        if ("phonetic".equals(codeString))
152          return XPathUsageType.PHONETIC;
153        if ("nearby".equals(codeString))
154          return XPathUsageType.NEARBY;
155        if ("distance".equals(codeString))
156          return XPathUsageType.DISTANCE;
157        if ("other".equals(codeString))
158          return XPathUsageType.OTHER;
159        throw new IllegalArgumentException("Unknown XPathUsageType code '"+codeString+"'");
160        }
161        public Enumeration<XPathUsageType> fromType(Base code) throws FHIRException {
162          if (code == null || code.isEmpty())
163            return null;
164          String codeString = ((PrimitiveType) code).asStringValue();
165          if (codeString == null || "".equals(codeString))
166            return null;
167        if ("normal".equals(codeString))
168          return new Enumeration<XPathUsageType>(this, XPathUsageType.NORMAL);
169        if ("phonetic".equals(codeString))
170          return new Enumeration<XPathUsageType>(this, XPathUsageType.PHONETIC);
171        if ("nearby".equals(codeString))
172          return new Enumeration<XPathUsageType>(this, XPathUsageType.NEARBY);
173        if ("distance".equals(codeString))
174          return new Enumeration<XPathUsageType>(this, XPathUsageType.DISTANCE);
175        if ("other".equals(codeString))
176          return new Enumeration<XPathUsageType>(this, XPathUsageType.OTHER);
177        throw new FHIRException("Unknown XPathUsageType code '"+codeString+"'");
178        }
179    public String toCode(XPathUsageType code) {
180      if (code == XPathUsageType.NORMAL)
181        return "normal";
182      if (code == XPathUsageType.PHONETIC)
183        return "phonetic";
184      if (code == XPathUsageType.NEARBY)
185        return "nearby";
186      if (code == XPathUsageType.DISTANCE)
187        return "distance";
188      if (code == XPathUsageType.OTHER)
189        return "other";
190      return "?";
191      }
192    }
193
194    @Block()
195    public static class SearchParameterContactComponent extends BackboneElement implements IBaseBackboneElement {
196        /**
197         * The name of an individual to contact regarding the search parameter.
198         */
199        @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
200        @Description(shortDefinition="Name of a individual to contact", formalDefinition="The name of an individual to contact regarding the search parameter." )
201        protected StringType name;
202
203        /**
204         * Contact details for individual (if a name was provided) or the publisher.
205         */
206        @Child(name = "telecom", type = {ContactPoint.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
207        @Description(shortDefinition="Contact details for individual or publisher", formalDefinition="Contact details for individual (if a name was provided) or the publisher." )
208        protected List<ContactPoint> telecom;
209
210        private static final long serialVersionUID = -1179697803L;
211
212    /*
213     * Constructor
214     */
215      public SearchParameterContactComponent() {
216        super();
217      }
218
219        /**
220         * @return {@link #name} (The name of an individual to contact regarding the search parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
221         */
222        public StringType getNameElement() { 
223          if (this.name == null)
224            if (Configuration.errorOnAutoCreate())
225              throw new Error("Attempt to auto-create SearchParameterContactComponent.name");
226            else if (Configuration.doAutoCreate())
227              this.name = new StringType(); // bb
228          return this.name;
229        }
230
231        public boolean hasNameElement() { 
232          return this.name != null && !this.name.isEmpty();
233        }
234
235        public boolean hasName() { 
236          return this.name != null && !this.name.isEmpty();
237        }
238
239        /**
240         * @param value {@link #name} (The name of an individual to contact regarding the search parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
241         */
242        public SearchParameterContactComponent setNameElement(StringType value) { 
243          this.name = value;
244          return this;
245        }
246
247        /**
248         * @return The name of an individual to contact regarding the search parameter.
249         */
250        public String getName() { 
251          return this.name == null ? null : this.name.getValue();
252        }
253
254        /**
255         * @param value The name of an individual to contact regarding the search parameter.
256         */
257        public SearchParameterContactComponent setName(String value) { 
258          if (Utilities.noString(value))
259            this.name = null;
260          else {
261            if (this.name == null)
262              this.name = new StringType();
263            this.name.setValue(value);
264          }
265          return this;
266        }
267
268        /**
269         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
270         */
271        public List<ContactPoint> getTelecom() { 
272          if (this.telecom == null)
273            this.telecom = new ArrayList<ContactPoint>();
274          return this.telecom;
275        }
276
277        public boolean hasTelecom() { 
278          if (this.telecom == null)
279            return false;
280          for (ContactPoint item : this.telecom)
281            if (!item.isEmpty())
282              return true;
283          return false;
284        }
285
286        /**
287         * @return {@link #telecom} (Contact details for individual (if a name was provided) or the publisher.)
288         */
289    // syntactic sugar
290        public ContactPoint addTelecom() { //3
291          ContactPoint t = new ContactPoint();
292          if (this.telecom == null)
293            this.telecom = new ArrayList<ContactPoint>();
294          this.telecom.add(t);
295          return t;
296        }
297
298    // syntactic sugar
299        public SearchParameterContactComponent addTelecom(ContactPoint t) { //3
300          if (t == null)
301            return this;
302          if (this.telecom == null)
303            this.telecom = new ArrayList<ContactPoint>();
304          this.telecom.add(t);
305          return this;
306        }
307
308        protected void listChildren(List<Property> childrenList) {
309          super.listChildren(childrenList);
310          childrenList.add(new Property("name", "string", "The name of an individual to contact regarding the search parameter.", 0, java.lang.Integer.MAX_VALUE, name));
311          childrenList.add(new Property("telecom", "ContactPoint", "Contact details for individual (if a name was provided) or the publisher.", 0, java.lang.Integer.MAX_VALUE, telecom));
312        }
313
314      @Override
315      public void setProperty(String name, Base value) throws FHIRException {
316        if (name.equals("name"))
317          this.name = castToString(value); // StringType
318        else if (name.equals("telecom"))
319          this.getTelecom().add(castToContactPoint(value));
320        else
321          super.setProperty(name, value);
322      }
323
324      @Override
325      public Base addChild(String name) throws FHIRException {
326        if (name.equals("name")) {
327          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.name");
328        }
329        else if (name.equals("telecom")) {
330          return addTelecom();
331        }
332        else
333          return super.addChild(name);
334      }
335
336      public SearchParameterContactComponent copy() {
337        SearchParameterContactComponent dst = new SearchParameterContactComponent();
338        copyValues(dst);
339        dst.name = name == null ? null : name.copy();
340        if (telecom != null) {
341          dst.telecom = new ArrayList<ContactPoint>();
342          for (ContactPoint i : telecom)
343            dst.telecom.add(i.copy());
344        };
345        return dst;
346      }
347
348      @Override
349      public boolean equalsDeep(Base other) {
350        if (!super.equalsDeep(other))
351          return false;
352        if (!(other instanceof SearchParameterContactComponent))
353          return false;
354        SearchParameterContactComponent o = (SearchParameterContactComponent) other;
355        return compareDeep(name, o.name, true) && compareDeep(telecom, o.telecom, true);
356      }
357
358      @Override
359      public boolean equalsShallow(Base other) {
360        if (!super.equalsShallow(other))
361          return false;
362        if (!(other instanceof SearchParameterContactComponent))
363          return false;
364        SearchParameterContactComponent o = (SearchParameterContactComponent) other;
365        return compareValues(name, o.name, true);
366      }
367
368      public boolean isEmpty() {
369        return super.isEmpty() && (name == null || name.isEmpty()) && (telecom == null || telecom.isEmpty())
370          ;
371      }
372
373  public String fhirType() {
374    return "SearchParameter.contact";
375
376  }
377
378  }
379
380    /**
381     * An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published.
382     */
383    @Child(name = "url", type = {UriType.class}, order=0, min=1, max=1, modifier=false, summary=true)
384    @Description(shortDefinition="Absolute URL used to reference this search parameter", formalDefinition="An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published." )
385    protected UriType url;
386
387    /**
388     * A free text natural language name identifying the search parameter.
389     */
390    @Child(name = "name", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
391    @Description(shortDefinition="Informal name for this search parameter", formalDefinition="A free text natural language name identifying the search parameter." )
392    protected StringType name;
393
394    /**
395     * The status of this search parameter definition.
396     */
397    @Child(name = "status", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
398    @Description(shortDefinition="draft | active | retired", formalDefinition="The status of this search parameter definition." )
399    protected Enumeration<ConformanceResourceStatus> status;
400
401    /**
402     * A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
403     */
404    @Child(name = "experimental", type = {BooleanType.class}, order=3, min=0, max=1, modifier=false, summary=true)
405    @Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
406    protected BooleanType experimental;
407
408    /**
409     * The name of the individual or organization that published the search parameter.
410     */
411    @Child(name = "publisher", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
412    @Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the search parameter." )
413    protected StringType publisher;
414
415    /**
416     * Contacts to assist a user in finding and communicating with the publisher.
417     */
418    @Child(name = "contact", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
419    @Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
420    protected List<SearchParameterContactComponent> contact;
421
422    /**
423     * The date  (and optionally time) when the search parameter 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 search parameter changes.
424     */
425    @Child(name = "date", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
426    @Description(shortDefinition="Publication Date(/time)", formalDefinition="The date  (and optionally time) when the search parameter 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 search parameter changes." )
427    protected DateTimeType date;
428
429    /**
430     * The Scope and Usage that this search parameter was created to meet.
431     */
432    @Child(name = "requirements", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
433    @Description(shortDefinition="Why this search parameter is defined", formalDefinition="The Scope and Usage that this search parameter was created to meet." )
434    protected StringType requirements;
435
436    /**
437     * The code used in the URL or the parameter name in a parameters resource for this search parameter.
438     */
439    @Child(name = "code", type = {CodeType.class}, order=8, min=1, max=1, modifier=false, summary=true)
440    @Description(shortDefinition="Code used in URL", formalDefinition="The code used in the URL or the parameter name in a parameters resource for this search parameter." )
441    protected CodeType code;
442
443    /**
444     * The base resource type that this search parameter refers to.
445     */
446    @Child(name = "base", type = {CodeType.class}, order=9, min=1, max=1, modifier=false, summary=true)
447    @Description(shortDefinition="The resource type this search parameter applies to", formalDefinition="The base resource type that this search parameter refers to." )
448    protected CodeType base;
449
450    /**
451     * The type of value a search parameter refers to, and how the content is interpreted.
452     */
453    @Child(name = "type", type = {CodeType.class}, order=10, min=1, max=1, modifier=false, summary=true)
454    @Description(shortDefinition="number | date | string | token | reference | composite | quantity | uri", formalDefinition="The type of value a search parameter refers to, and how the content is interpreted." )
455    protected Enumeration<SearchParamType> type;
456
457    /**
458     * A description of the search parameters and how it used.
459     */
460    @Child(name = "description", type = {StringType.class}, order=11, min=1, max=1, modifier=false, summary=true)
461    @Description(shortDefinition="Documentation for  search parameter", formalDefinition="A description of the search parameters and how it used." )
462    protected StringType description;
463
464    /**
465     * An XPath expression that returns a set of elements for the search parameter.
466     */
467    @Child(name = "xpath", type = {StringType.class}, order=12, min=0, max=1, modifier=false, summary=false)
468    @Description(shortDefinition="XPath that extracts the values", formalDefinition="An XPath expression that returns a set of elements for the search parameter." )
469    protected StringType xpath;
470
471    /**
472     * How the search parameter relates to the set of elements returned by evaluating the xpath query.
473     */
474    @Child(name = "xpathUsage", type = {CodeType.class}, order=13, min=0, max=1, modifier=false, summary=false)
475    @Description(shortDefinition="normal | phonetic | nearby | distance | other", formalDefinition="How the search parameter relates to the set of elements returned by evaluating the xpath query." )
476    protected Enumeration<XPathUsageType> xpathUsage;
477
478    /**
479     * Types of resource (if a resource is referenced).
480     */
481    @Child(name = "target", type = {CodeType.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
482    @Description(shortDefinition="Types of resource (if a resource reference)", formalDefinition="Types of resource (if a resource is referenced)." )
483    protected List<CodeType> target;
484
485    private static final long serialVersionUID = -742596414L;
486
487  /*
488   * Constructor
489   */
490    public SearchParameter() {
491      super();
492    }
493
494  /*
495   * Constructor
496   */
497    public SearchParameter(UriType url, StringType name, CodeType code, CodeType base, Enumeration<SearchParamType> type, StringType description) {
498      super();
499      this.url = url;
500      this.name = name;
501      this.code = code;
502      this.base = base;
503      this.type = type;
504      this.description = description;
505    }
506
507    /**
508     * @return {@link #url} (An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
509     */
510    public UriType getUrlElement() { 
511      if (this.url == null)
512        if (Configuration.errorOnAutoCreate())
513          throw new Error("Attempt to auto-create SearchParameter.url");
514        else if (Configuration.doAutoCreate())
515          this.url = new UriType(); // bb
516      return this.url;
517    }
518
519    public boolean hasUrlElement() { 
520      return this.url != null && !this.url.isEmpty();
521    }
522
523    public boolean hasUrl() { 
524      return this.url != null && !this.url.isEmpty();
525    }
526
527    /**
528     * @param value {@link #url} (An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
529     */
530    public SearchParameter setUrlElement(UriType value) { 
531      this.url = value;
532      return this;
533    }
534
535    /**
536     * @return An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published.
537     */
538    public String getUrl() { 
539      return this.url == null ? null : this.url.getValue();
540    }
541
542    /**
543     * @param value An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published.
544     */
545    public SearchParameter setUrl(String value) { 
546        if (this.url == null)
547          this.url = new UriType();
548        this.url.setValue(value);
549      return this;
550    }
551
552    /**
553     * @return {@link #name} (A free text natural language name identifying the search parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
554     */
555    public StringType getNameElement() { 
556      if (this.name == null)
557        if (Configuration.errorOnAutoCreate())
558          throw new Error("Attempt to auto-create SearchParameter.name");
559        else if (Configuration.doAutoCreate())
560          this.name = new StringType(); // bb
561      return this.name;
562    }
563
564    public boolean hasNameElement() { 
565      return this.name != null && !this.name.isEmpty();
566    }
567
568    public boolean hasName() { 
569      return this.name != null && !this.name.isEmpty();
570    }
571
572    /**
573     * @param value {@link #name} (A free text natural language name identifying the search parameter.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
574     */
575    public SearchParameter setNameElement(StringType value) { 
576      this.name = value;
577      return this;
578    }
579
580    /**
581     * @return A free text natural language name identifying the search parameter.
582     */
583    public String getName() { 
584      return this.name == null ? null : this.name.getValue();
585    }
586
587    /**
588     * @param value A free text natural language name identifying the search parameter.
589     */
590    public SearchParameter setName(String value) { 
591        if (this.name == null)
592          this.name = new StringType();
593        this.name.setValue(value);
594      return this;
595    }
596
597    /**
598     * @return {@link #status} (The status of this search parameter definition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
599     */
600    public Enumeration<ConformanceResourceStatus> getStatusElement() { 
601      if (this.status == null)
602        if (Configuration.errorOnAutoCreate())
603          throw new Error("Attempt to auto-create SearchParameter.status");
604        else if (Configuration.doAutoCreate())
605          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
606      return this.status;
607    }
608
609    public boolean hasStatusElement() { 
610      return this.status != null && !this.status.isEmpty();
611    }
612
613    public boolean hasStatus() { 
614      return this.status != null && !this.status.isEmpty();
615    }
616
617    /**
618     * @param value {@link #status} (The status of this search parameter definition.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
619     */
620    public SearchParameter setStatusElement(Enumeration<ConformanceResourceStatus> value) { 
621      this.status = value;
622      return this;
623    }
624
625    /**
626     * @return The status of this search parameter definition.
627     */
628    public ConformanceResourceStatus getStatus() { 
629      return this.status == null ? null : this.status.getValue();
630    }
631
632    /**
633     * @param value The status of this search parameter definition.
634     */
635    public SearchParameter setStatus(ConformanceResourceStatus value) { 
636      if (value == null)
637        this.status = null;
638      else {
639        if (this.status == null)
640          this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
641        this.status.setValue(value);
642      }
643      return this;
644    }
645
646    /**
647     * @return {@link #experimental} (A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
648     */
649    public BooleanType getExperimentalElement() { 
650      if (this.experimental == null)
651        if (Configuration.errorOnAutoCreate())
652          throw new Error("Attempt to auto-create SearchParameter.experimental");
653        else if (Configuration.doAutoCreate())
654          this.experimental = new BooleanType(); // bb
655      return this.experimental;
656    }
657
658    public boolean hasExperimentalElement() { 
659      return this.experimental != null && !this.experimental.isEmpty();
660    }
661
662    public boolean hasExperimental() { 
663      return this.experimental != null && !this.experimental.isEmpty();
664    }
665
666    /**
667     * @param value {@link #experimental} (A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
668     */
669    public SearchParameter setExperimentalElement(BooleanType value) { 
670      this.experimental = value;
671      return this;
672    }
673
674    /**
675     * @return A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
676     */
677    public boolean getExperimental() { 
678      return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
679    }
680
681    /**
682     * @param value A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
683     */
684    public SearchParameter setExperimental(boolean value) { 
685        if (this.experimental == null)
686          this.experimental = new BooleanType();
687        this.experimental.setValue(value);
688      return this;
689    }
690
691    /**
692     * @return {@link #publisher} (The name of the individual or organization that published the search parameter.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
693     */
694    public StringType getPublisherElement() { 
695      if (this.publisher == null)
696        if (Configuration.errorOnAutoCreate())
697          throw new Error("Attempt to auto-create SearchParameter.publisher");
698        else if (Configuration.doAutoCreate())
699          this.publisher = new StringType(); // bb
700      return this.publisher;
701    }
702
703    public boolean hasPublisherElement() { 
704      return this.publisher != null && !this.publisher.isEmpty();
705    }
706
707    public boolean hasPublisher() { 
708      return this.publisher != null && !this.publisher.isEmpty();
709    }
710
711    /**
712     * @param value {@link #publisher} (The name of the individual or organization that published the search parameter.). This is the underlying object with id, value and extensions. The accessor "getPublisher" gives direct access to the value
713     */
714    public SearchParameter setPublisherElement(StringType value) { 
715      this.publisher = value;
716      return this;
717    }
718
719    /**
720     * @return The name of the individual or organization that published the search parameter.
721     */
722    public String getPublisher() { 
723      return this.publisher == null ? null : this.publisher.getValue();
724    }
725
726    /**
727     * @param value The name of the individual or organization that published the search parameter.
728     */
729    public SearchParameter setPublisher(String value) { 
730      if (Utilities.noString(value))
731        this.publisher = null;
732      else {
733        if (this.publisher == null)
734          this.publisher = new StringType();
735        this.publisher.setValue(value);
736      }
737      return this;
738    }
739
740    /**
741     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
742     */
743    public List<SearchParameterContactComponent> getContact() { 
744      if (this.contact == null)
745        this.contact = new ArrayList<SearchParameterContactComponent>();
746      return this.contact;
747    }
748
749    public boolean hasContact() { 
750      if (this.contact == null)
751        return false;
752      for (SearchParameterContactComponent item : this.contact)
753        if (!item.isEmpty())
754          return true;
755      return false;
756    }
757
758    /**
759     * @return {@link #contact} (Contacts to assist a user in finding and communicating with the publisher.)
760     */
761    // syntactic sugar
762    public SearchParameterContactComponent addContact() { //3
763      SearchParameterContactComponent t = new SearchParameterContactComponent();
764      if (this.contact == null)
765        this.contact = new ArrayList<SearchParameterContactComponent>();
766      this.contact.add(t);
767      return t;
768    }
769
770    // syntactic sugar
771    public SearchParameter addContact(SearchParameterContactComponent t) { //3
772      if (t == null)
773        return this;
774      if (this.contact == null)
775        this.contact = new ArrayList<SearchParameterContactComponent>();
776      this.contact.add(t);
777      return this;
778    }
779
780    /**
781     * @return {@link #date} (The date  (and optionally time) when the search parameter 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 search parameter changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
782     */
783    public DateTimeType getDateElement() { 
784      if (this.date == null)
785        if (Configuration.errorOnAutoCreate())
786          throw new Error("Attempt to auto-create SearchParameter.date");
787        else if (Configuration.doAutoCreate())
788          this.date = new DateTimeType(); // bb
789      return this.date;
790    }
791
792    public boolean hasDateElement() { 
793      return this.date != null && !this.date.isEmpty();
794    }
795
796    public boolean hasDate() { 
797      return this.date != null && !this.date.isEmpty();
798    }
799
800    /**
801     * @param value {@link #date} (The date  (and optionally time) when the search parameter 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 search parameter changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
802     */
803    public SearchParameter setDateElement(DateTimeType value) { 
804      this.date = value;
805      return this;
806    }
807
808    /**
809     * @return The date  (and optionally time) when the search parameter 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 search parameter changes.
810     */
811    public Date getDate() { 
812      return this.date == null ? null : this.date.getValue();
813    }
814
815    /**
816     * @param value The date  (and optionally time) when the search parameter 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 search parameter changes.
817     */
818    public SearchParameter setDate(Date value) { 
819      if (value == null)
820        this.date = null;
821      else {
822        if (this.date == null)
823          this.date = new DateTimeType();
824        this.date.setValue(value);
825      }
826      return this;
827    }
828
829    /**
830     * @return {@link #requirements} (The Scope and Usage that this search parameter was created to meet.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
831     */
832    public StringType getRequirementsElement() { 
833      if (this.requirements == null)
834        if (Configuration.errorOnAutoCreate())
835          throw new Error("Attempt to auto-create SearchParameter.requirements");
836        else if (Configuration.doAutoCreate())
837          this.requirements = new StringType(); // bb
838      return this.requirements;
839    }
840
841    public boolean hasRequirementsElement() { 
842      return this.requirements != null && !this.requirements.isEmpty();
843    }
844
845    public boolean hasRequirements() { 
846      return this.requirements != null && !this.requirements.isEmpty();
847    }
848
849    /**
850     * @param value {@link #requirements} (The Scope and Usage that this search parameter was created to meet.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
851     */
852    public SearchParameter setRequirementsElement(StringType value) { 
853      this.requirements = value;
854      return this;
855    }
856
857    /**
858     * @return The Scope and Usage that this search parameter was created to meet.
859     */
860    public String getRequirements() { 
861      return this.requirements == null ? null : this.requirements.getValue();
862    }
863
864    /**
865     * @param value The Scope and Usage that this search parameter was created to meet.
866     */
867    public SearchParameter setRequirements(String value) { 
868      if (Utilities.noString(value))
869        this.requirements = null;
870      else {
871        if (this.requirements == null)
872          this.requirements = new StringType();
873        this.requirements.setValue(value);
874      }
875      return this;
876    }
877
878    /**
879     * @return {@link #code} (The code used in the URL or the parameter name in a parameters resource for this search parameter.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
880     */
881    public CodeType getCodeElement() { 
882      if (this.code == null)
883        if (Configuration.errorOnAutoCreate())
884          throw new Error("Attempt to auto-create SearchParameter.code");
885        else if (Configuration.doAutoCreate())
886          this.code = new CodeType(); // bb
887      return this.code;
888    }
889
890    public boolean hasCodeElement() { 
891      return this.code != null && !this.code.isEmpty();
892    }
893
894    public boolean hasCode() { 
895      return this.code != null && !this.code.isEmpty();
896    }
897
898    /**
899     * @param value {@link #code} (The code used in the URL or the parameter name in a parameters resource for this search parameter.). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
900     */
901    public SearchParameter setCodeElement(CodeType value) { 
902      this.code = value;
903      return this;
904    }
905
906    /**
907     * @return The code used in the URL or the parameter name in a parameters resource for this search parameter.
908     */
909    public String getCode() { 
910      return this.code == null ? null : this.code.getValue();
911    }
912
913    /**
914     * @param value The code used in the URL or the parameter name in a parameters resource for this search parameter.
915     */
916    public SearchParameter setCode(String value) { 
917        if (this.code == null)
918          this.code = new CodeType();
919        this.code.setValue(value);
920      return this;
921    }
922
923    /**
924     * @return {@link #base} (The base resource type that this search parameter refers to.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
925     */
926    public CodeType getBaseElement() { 
927      if (this.base == null)
928        if (Configuration.errorOnAutoCreate())
929          throw new Error("Attempt to auto-create SearchParameter.base");
930        else if (Configuration.doAutoCreate())
931          this.base = new CodeType(); // bb
932      return this.base;
933    }
934
935    public boolean hasBaseElement() { 
936      return this.base != null && !this.base.isEmpty();
937    }
938
939    public boolean hasBase() { 
940      return this.base != null && !this.base.isEmpty();
941    }
942
943    /**
944     * @param value {@link #base} (The base resource type that this search parameter refers to.). This is the underlying object with id, value and extensions. The accessor "getBase" gives direct access to the value
945     */
946    public SearchParameter setBaseElement(CodeType value) { 
947      this.base = value;
948      return this;
949    }
950
951    /**
952     * @return The base resource type that this search parameter refers to.
953     */
954    public String getBase() { 
955      return this.base == null ? null : this.base.getValue();
956    }
957
958    /**
959     * @param value The base resource type that this search parameter refers to.
960     */
961    public SearchParameter setBase(String value) { 
962        if (this.base == null)
963          this.base = new CodeType();
964        this.base.setValue(value);
965      return this;
966    }
967
968    /**
969     * @return {@link #type} (The type of value a search parameter refers to, and how the content is interpreted.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
970     */
971    public Enumeration<SearchParamType> getTypeElement() { 
972      if (this.type == null)
973        if (Configuration.errorOnAutoCreate())
974          throw new Error("Attempt to auto-create SearchParameter.type");
975        else if (Configuration.doAutoCreate())
976          this.type = new Enumeration<SearchParamType>(new SearchParamTypeEnumFactory()); // bb
977      return this.type;
978    }
979
980    public boolean hasTypeElement() { 
981      return this.type != null && !this.type.isEmpty();
982    }
983
984    public boolean hasType() { 
985      return this.type != null && !this.type.isEmpty();
986    }
987
988    /**
989     * @param value {@link #type} (The type of value a search parameter refers to, and how the content is interpreted.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
990     */
991    public SearchParameter setTypeElement(Enumeration<SearchParamType> value) { 
992      this.type = value;
993      return this;
994    }
995
996    /**
997     * @return The type of value a search parameter refers to, and how the content is interpreted.
998     */
999    public SearchParamType getType() { 
1000      return this.type == null ? null : this.type.getValue();
1001    }
1002
1003    /**
1004     * @param value The type of value a search parameter refers to, and how the content is interpreted.
1005     */
1006    public SearchParameter setType(SearchParamType value) { 
1007        if (this.type == null)
1008          this.type = new Enumeration<SearchParamType>(new SearchParamTypeEnumFactory());
1009        this.type.setValue(value);
1010      return this;
1011    }
1012
1013    /**
1014     * @return {@link #description} (A description of the search parameters and how it used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1015     */
1016    public StringType getDescriptionElement() { 
1017      if (this.description == null)
1018        if (Configuration.errorOnAutoCreate())
1019          throw new Error("Attempt to auto-create SearchParameter.description");
1020        else if (Configuration.doAutoCreate())
1021          this.description = new StringType(); // bb
1022      return this.description;
1023    }
1024
1025    public boolean hasDescriptionElement() { 
1026      return this.description != null && !this.description.isEmpty();
1027    }
1028
1029    public boolean hasDescription() { 
1030      return this.description != null && !this.description.isEmpty();
1031    }
1032
1033    /**
1034     * @param value {@link #description} (A description of the search parameters and how it used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
1035     */
1036    public SearchParameter setDescriptionElement(StringType value) { 
1037      this.description = value;
1038      return this;
1039    }
1040
1041    /**
1042     * @return A description of the search parameters and how it used.
1043     */
1044    public String getDescription() { 
1045      return this.description == null ? null : this.description.getValue();
1046    }
1047
1048    /**
1049     * @param value A description of the search parameters and how it used.
1050     */
1051    public SearchParameter setDescription(String value) { 
1052        if (this.description == null)
1053          this.description = new StringType();
1054        this.description.setValue(value);
1055      return this;
1056    }
1057
1058    /**
1059     * @return {@link #xpath} (An XPath expression that returns a set of elements for the search parameter.). This is the underlying object with id, value and extensions. The accessor "getXpath" gives direct access to the value
1060     */
1061    public StringType getXpathElement() { 
1062      if (this.xpath == null)
1063        if (Configuration.errorOnAutoCreate())
1064          throw new Error("Attempt to auto-create SearchParameter.xpath");
1065        else if (Configuration.doAutoCreate())
1066          this.xpath = new StringType(); // bb
1067      return this.xpath;
1068    }
1069
1070    public boolean hasXpathElement() { 
1071      return this.xpath != null && !this.xpath.isEmpty();
1072    }
1073
1074    public boolean hasXpath() { 
1075      return this.xpath != null && !this.xpath.isEmpty();
1076    }
1077
1078    /**
1079     * @param value {@link #xpath} (An XPath expression that returns a set of elements for the search parameter.). This is the underlying object with id, value and extensions. The accessor "getXpath" gives direct access to the value
1080     */
1081    public SearchParameter setXpathElement(StringType value) { 
1082      this.xpath = value;
1083      return this;
1084    }
1085
1086    /**
1087     * @return An XPath expression that returns a set of elements for the search parameter.
1088     */
1089    public String getXpath() { 
1090      return this.xpath == null ? null : this.xpath.getValue();
1091    }
1092
1093    /**
1094     * @param value An XPath expression that returns a set of elements for the search parameter.
1095     */
1096    public SearchParameter setXpath(String value) { 
1097      if (Utilities.noString(value))
1098        this.xpath = null;
1099      else {
1100        if (this.xpath == null)
1101          this.xpath = new StringType();
1102        this.xpath.setValue(value);
1103      }
1104      return this;
1105    }
1106
1107    /**
1108     * @return {@link #xpathUsage} (How the search parameter relates to the set of elements returned by evaluating the xpath query.). This is the underlying object with id, value and extensions. The accessor "getXpathUsage" gives direct access to the value
1109     */
1110    public Enumeration<XPathUsageType> getXpathUsageElement() { 
1111      if (this.xpathUsage == null)
1112        if (Configuration.errorOnAutoCreate())
1113          throw new Error("Attempt to auto-create SearchParameter.xpathUsage");
1114        else if (Configuration.doAutoCreate())
1115          this.xpathUsage = new Enumeration<XPathUsageType>(new XPathUsageTypeEnumFactory()); // bb
1116      return this.xpathUsage;
1117    }
1118
1119    public boolean hasXpathUsageElement() { 
1120      return this.xpathUsage != null && !this.xpathUsage.isEmpty();
1121    }
1122
1123    public boolean hasXpathUsage() { 
1124      return this.xpathUsage != null && !this.xpathUsage.isEmpty();
1125    }
1126
1127    /**
1128     * @param value {@link #xpathUsage} (How the search parameter relates to the set of elements returned by evaluating the xpath query.). This is the underlying object with id, value and extensions. The accessor "getXpathUsage" gives direct access to the value
1129     */
1130    public SearchParameter setXpathUsageElement(Enumeration<XPathUsageType> value) { 
1131      this.xpathUsage = value;
1132      return this;
1133    }
1134
1135    /**
1136     * @return How the search parameter relates to the set of elements returned by evaluating the xpath query.
1137     */
1138    public XPathUsageType getXpathUsage() { 
1139      return this.xpathUsage == null ? null : this.xpathUsage.getValue();
1140    }
1141
1142    /**
1143     * @param value How the search parameter relates to the set of elements returned by evaluating the xpath query.
1144     */
1145    public SearchParameter setXpathUsage(XPathUsageType value) { 
1146      if (value == null)
1147        this.xpathUsage = null;
1148      else {
1149        if (this.xpathUsage == null)
1150          this.xpathUsage = new Enumeration<XPathUsageType>(new XPathUsageTypeEnumFactory());
1151        this.xpathUsage.setValue(value);
1152      }
1153      return this;
1154    }
1155
1156    /**
1157     * @return {@link #target} (Types of resource (if a resource is referenced).)
1158     */
1159    public List<CodeType> getTarget() { 
1160      if (this.target == null)
1161        this.target = new ArrayList<CodeType>();
1162      return this.target;
1163    }
1164
1165    public boolean hasTarget() { 
1166      if (this.target == null)
1167        return false;
1168      for (CodeType item : this.target)
1169        if (!item.isEmpty())
1170          return true;
1171      return false;
1172    }
1173
1174    /**
1175     * @return {@link #target} (Types of resource (if a resource is referenced).)
1176     */
1177    // syntactic sugar
1178    public CodeType addTargetElement() {//2 
1179      CodeType t = new CodeType();
1180      if (this.target == null)
1181        this.target = new ArrayList<CodeType>();
1182      this.target.add(t);
1183      return t;
1184    }
1185
1186    /**
1187     * @param value {@link #target} (Types of resource (if a resource is referenced).)
1188     */
1189    public SearchParameter addTarget(String value) { //1
1190      CodeType t = new CodeType();
1191      t.setValue(value);
1192      if (this.target == null)
1193        this.target = new ArrayList<CodeType>();
1194      this.target.add(t);
1195      return this;
1196    }
1197
1198    /**
1199     * @param value {@link #target} (Types of resource (if a resource is referenced).)
1200     */
1201    public boolean hasTarget(String value) { 
1202      if (this.target == null)
1203        return false;
1204      for (CodeType v : this.target)
1205        if (v.equals(value)) // code
1206          return true;
1207      return false;
1208    }
1209
1210      protected void listChildren(List<Property> childrenList) {
1211        super.listChildren(childrenList);
1212        childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this search parameter 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 search parameter is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
1213        childrenList.add(new Property("name", "string", "A free text natural language name identifying the search parameter.", 0, java.lang.Integer.MAX_VALUE, name));
1214        childrenList.add(new Property("status", "code", "The status of this search parameter definition.", 0, java.lang.Integer.MAX_VALUE, status));
1215        childrenList.add(new Property("experimental", "boolean", "A flag to indicate that this search parameter definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
1216        childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the search parameter.", 0, java.lang.Integer.MAX_VALUE, publisher));
1217        childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
1218        childrenList.add(new Property("date", "dateTime", "The date  (and optionally time) when the search parameter 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 search parameter changes.", 0, java.lang.Integer.MAX_VALUE, date));
1219        childrenList.add(new Property("requirements", "string", "The Scope and Usage that this search parameter was created to meet.", 0, java.lang.Integer.MAX_VALUE, requirements));
1220        childrenList.add(new Property("code", "code", "The code used in the URL or the parameter name in a parameters resource for this search parameter.", 0, java.lang.Integer.MAX_VALUE, code));
1221        childrenList.add(new Property("base", "code", "The base resource type that this search parameter refers to.", 0, java.lang.Integer.MAX_VALUE, base));
1222        childrenList.add(new Property("type", "code", "The type of value a search parameter refers to, and how the content is interpreted.", 0, java.lang.Integer.MAX_VALUE, type));
1223        childrenList.add(new Property("description", "string", "A description of the search parameters and how it used.", 0, java.lang.Integer.MAX_VALUE, description));
1224        childrenList.add(new Property("xpath", "string", "An XPath expression that returns a set of elements for the search parameter.", 0, java.lang.Integer.MAX_VALUE, xpath));
1225        childrenList.add(new Property("xpathUsage", "code", "How the search parameter relates to the set of elements returned by evaluating the xpath query.", 0, java.lang.Integer.MAX_VALUE, xpathUsage));
1226        childrenList.add(new Property("target", "code", "Types of resource (if a resource is referenced).", 0, java.lang.Integer.MAX_VALUE, target));
1227      }
1228
1229      @Override
1230      public void setProperty(String name, Base value) throws FHIRException {
1231        if (name.equals("url"))
1232          this.url = castToUri(value); // UriType
1233        else if (name.equals("name"))
1234          this.name = castToString(value); // StringType
1235        else if (name.equals("status"))
1236          this.status = new ConformanceResourceStatusEnumFactory().fromType(value); // Enumeration<ConformanceResourceStatus>
1237        else if (name.equals("experimental"))
1238          this.experimental = castToBoolean(value); // BooleanType
1239        else if (name.equals("publisher"))
1240          this.publisher = castToString(value); // StringType
1241        else if (name.equals("contact"))
1242          this.getContact().add((SearchParameterContactComponent) value);
1243        else if (name.equals("date"))
1244          this.date = castToDateTime(value); // DateTimeType
1245        else if (name.equals("requirements"))
1246          this.requirements = castToString(value); // StringType
1247        else if (name.equals("code"))
1248          this.code = castToCode(value); // CodeType
1249        else if (name.equals("base"))
1250          this.base = castToCode(value); // CodeType
1251        else if (name.equals("type"))
1252          this.type = new SearchParamTypeEnumFactory().fromType(value); // Enumeration<SearchParamType>
1253        else if (name.equals("description"))
1254          this.description = castToString(value); // StringType
1255        else if (name.equals("xpath"))
1256          this.xpath = castToString(value); // StringType
1257        else if (name.equals("xpathUsage"))
1258          this.xpathUsage = new XPathUsageTypeEnumFactory().fromType(value); // Enumeration<XPathUsageType>
1259        else if (name.equals("target"))
1260          this.getTarget().add(castToCode(value));
1261        else
1262          super.setProperty(name, value);
1263      }
1264
1265      @Override
1266      public Base addChild(String name) throws FHIRException {
1267        if (name.equals("url")) {
1268          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.url");
1269        }
1270        else if (name.equals("name")) {
1271          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.name");
1272        }
1273        else if (name.equals("status")) {
1274          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.status");
1275        }
1276        else if (name.equals("experimental")) {
1277          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.experimental");
1278        }
1279        else if (name.equals("publisher")) {
1280          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.publisher");
1281        }
1282        else if (name.equals("contact")) {
1283          return addContact();
1284        }
1285        else if (name.equals("date")) {
1286          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.date");
1287        }
1288        else if (name.equals("requirements")) {
1289          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.requirements");
1290        }
1291        else if (name.equals("code")) {
1292          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.code");
1293        }
1294        else if (name.equals("base")) {
1295          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.base");
1296        }
1297        else if (name.equals("type")) {
1298          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.type");
1299        }
1300        else if (name.equals("description")) {
1301          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.description");
1302        }
1303        else if (name.equals("xpath")) {
1304          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.xpath");
1305        }
1306        else if (name.equals("xpathUsage")) {
1307          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.xpathUsage");
1308        }
1309        else if (name.equals("target")) {
1310          throw new FHIRException("Cannot call addChild on a primitive type SearchParameter.target");
1311        }
1312        else
1313          return super.addChild(name);
1314      }
1315
1316  public String fhirType() {
1317    return "SearchParameter";
1318
1319  }
1320
1321      public SearchParameter copy() {
1322        SearchParameter dst = new SearchParameter();
1323        copyValues(dst);
1324        dst.url = url == null ? null : url.copy();
1325        dst.name = name == null ? null : name.copy();
1326        dst.status = status == null ? null : status.copy();
1327        dst.experimental = experimental == null ? null : experimental.copy();
1328        dst.publisher = publisher == null ? null : publisher.copy();
1329        if (contact != null) {
1330          dst.contact = new ArrayList<SearchParameterContactComponent>();
1331          for (SearchParameterContactComponent i : contact)
1332            dst.contact.add(i.copy());
1333        };
1334        dst.date = date == null ? null : date.copy();
1335        dst.requirements = requirements == null ? null : requirements.copy();
1336        dst.code = code == null ? null : code.copy();
1337        dst.base = base == null ? null : base.copy();
1338        dst.type = type == null ? null : type.copy();
1339        dst.description = description == null ? null : description.copy();
1340        dst.xpath = xpath == null ? null : xpath.copy();
1341        dst.xpathUsage = xpathUsage == null ? null : xpathUsage.copy();
1342        if (target != null) {
1343          dst.target = new ArrayList<CodeType>();
1344          for (CodeType i : target)
1345            dst.target.add(i.copy());
1346        };
1347        return dst;
1348      }
1349
1350      protected SearchParameter typedCopy() {
1351        return copy();
1352      }
1353
1354      @Override
1355      public boolean equalsDeep(Base other) {
1356        if (!super.equalsDeep(other))
1357          return false;
1358        if (!(other instanceof SearchParameter))
1359          return false;
1360        SearchParameter o = (SearchParameter) other;
1361        return compareDeep(url, o.url, true) && compareDeep(name, o.name, true) && compareDeep(status, o.status, true)
1362           && compareDeep(experimental, o.experimental, true) && compareDeep(publisher, o.publisher, true)
1363           && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true) && compareDeep(requirements, o.requirements, true)
1364           && compareDeep(code, o.code, true) && compareDeep(base, o.base, true) && compareDeep(type, o.type, true)
1365           && compareDeep(description, o.description, true) && compareDeep(xpath, o.xpath, true) && compareDeep(xpathUsage, o.xpathUsage, true)
1366           && compareDeep(target, o.target, true);
1367      }
1368
1369      @Override
1370      public boolean equalsShallow(Base other) {
1371        if (!super.equalsShallow(other))
1372          return false;
1373        if (!(other instanceof SearchParameter))
1374          return false;
1375        SearchParameter o = (SearchParameter) other;
1376        return compareValues(url, o.url, true) && compareValues(name, o.name, true) && compareValues(status, o.status, true)
1377           && compareValues(experimental, o.experimental, true) && compareValues(publisher, o.publisher, true)
1378           && compareValues(date, o.date, true) && compareValues(requirements, o.requirements, true) && compareValues(code, o.code, true)
1379           && compareValues(base, o.base, true) && compareValues(type, o.type, true) && compareValues(description, o.description, true)
1380           && compareValues(xpath, o.xpath, true) && compareValues(xpathUsage, o.xpathUsage, true) && compareValues(target, o.target, true)
1381          ;
1382      }
1383
1384      public boolean isEmpty() {
1385        return super.isEmpty() && (url == null || url.isEmpty()) && (name == null || name.isEmpty())
1386           && (status == null || status.isEmpty()) && (experimental == null || experimental.isEmpty())
1387           && (publisher == null || publisher.isEmpty()) && (contact == null || contact.isEmpty()) && (date == null || date.isEmpty())
1388           && (requirements == null || requirements.isEmpty()) && (code == null || code.isEmpty()) && (base == null || base.isEmpty())
1389           && (type == null || type.isEmpty()) && (description == null || description.isEmpty()) && (xpath == null || xpath.isEmpty())
1390           && (xpathUsage == null || xpathUsage.isEmpty()) && (target == null || target.isEmpty());
1391      }
1392
1393  @Override
1394  public ResourceType getResourceType() {
1395    return ResourceType.SearchParameter;
1396   }
1397
1398  @SearchParamDefinition(name="code", path="SearchParameter.code", description="Code used in URL", type="token" )
1399  public static final String SP_CODE = "code";
1400  @SearchParamDefinition(name="name", path="SearchParameter.name", description="Informal name for this search parameter", type="string" )
1401  public static final String SP_NAME = "name";
1402  @SearchParamDefinition(name="description", path="SearchParameter.description", description="Documentation for  search parameter", type="string" )
1403  public static final String SP_DESCRIPTION = "description";
1404  @SearchParamDefinition(name="type", path="SearchParameter.type", description="number | date | string | token | reference | composite | quantity | uri", type="token" )
1405  public static final String SP_TYPE = "type";
1406  @SearchParamDefinition(name="url", path="SearchParameter.url", description="Absolute URL used to reference this search parameter", type="uri" )
1407  public static final String SP_URL = "url";
1408  @SearchParamDefinition(name="base", path="SearchParameter.base", description="The resource type this search parameter applies to", type="token" )
1409  public static final String SP_BASE = "base";
1410  @SearchParamDefinition(name="target", path="SearchParameter.target", description="Types of resource (if a resource reference)", type="token" )
1411  public static final String SP_TARGET = "target";
1412
1413}