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