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