001package org.hl7.fhir.dstu2016may.model;
002
003
004
005
006import java.math.BigDecimal;
007
008/*
009  Copyright (c) 2011+, HL7, Inc.
010  All rights reserved.
011  
012  Redistribution and use in source and binary forms, with or without modification, 
013  are permitted provided that the following conditions are met:
014  
015   * Redistributions of source code must retain the above copyright notice, this 
016     list of conditions and the following disclaimer.
017   * Redistributions in binary form must reproduce the above copyright notice, 
018     this list of conditions and the following disclaimer in the documentation 
019     and/or other materials provided with the distribution.
020   * Neither the name of HL7 nor the names of its contributors may be used to 
021     endorse or promote products derived from this software without specific 
022     prior written permission.
023  
024  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
025  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
026  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
027  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
028  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
029  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
030  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
031  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
032  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
033  POSSIBILITY OF SUCH DAMAGE.
034  
035*/
036
037// Generated on Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
038import java.util.ArrayList;
039import java.util.List;
040
041import org.hl7.fhir.exceptions.FHIRException;
042import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
043import org.hl7.fhir.utilities.Utilities;
044
045import ca.uhn.fhir.model.api.annotation.Block;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.ResourceDef;
049import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
050/**
051 * Details and position information for a physical place where services are provided  and resources and participants may be stored, found, contained or accommodated.
052 */
053@ResourceDef(name="Location", profile="http://hl7.org/fhir/Profile/Location")
054public class Location extends DomainResource {
055
056    public enum LocationStatus {
057        /**
058         * The location is operational.
059         */
060        ACTIVE, 
061        /**
062         * The location is temporarily closed.
063         */
064        SUSPENDED, 
065        /**
066         * The location is no longer used.
067         */
068        INACTIVE, 
069        /**
070         * added to help the parsers
071         */
072        NULL;
073        public static LocationStatus fromCode(String codeString) throws FHIRException {
074            if (codeString == null || "".equals(codeString))
075                return null;
076        if ("active".equals(codeString))
077          return ACTIVE;
078        if ("suspended".equals(codeString))
079          return SUSPENDED;
080        if ("inactive".equals(codeString))
081          return INACTIVE;
082        throw new FHIRException("Unknown LocationStatus code '"+codeString+"'");
083        }
084        public String toCode() {
085          switch (this) {
086            case ACTIVE: return "active";
087            case SUSPENDED: return "suspended";
088            case INACTIVE: return "inactive";
089            case NULL: return null;
090            default: return "?";
091          }
092        }
093        public String getSystem() {
094          switch (this) {
095            case ACTIVE: return "http://hl7.org/fhir/location-status";
096            case SUSPENDED: return "http://hl7.org/fhir/location-status";
097            case INACTIVE: return "http://hl7.org/fhir/location-status";
098            case NULL: return null;
099            default: return "?";
100          }
101        }
102        public String getDefinition() {
103          switch (this) {
104            case ACTIVE: return "The location is operational.";
105            case SUSPENDED: return "The location is temporarily closed.";
106            case INACTIVE: return "The location is no longer used.";
107            case NULL: return null;
108            default: return "?";
109          }
110        }
111        public String getDisplay() {
112          switch (this) {
113            case ACTIVE: return "Active";
114            case SUSPENDED: return "Suspended";
115            case INACTIVE: return "Inactive";
116            case NULL: return null;
117            default: return "?";
118          }
119        }
120    }
121
122  public static class LocationStatusEnumFactory implements EnumFactory<LocationStatus> {
123    public LocationStatus fromCode(String codeString) throws IllegalArgumentException {
124      if (codeString == null || "".equals(codeString))
125            if (codeString == null || "".equals(codeString))
126                return null;
127        if ("active".equals(codeString))
128          return LocationStatus.ACTIVE;
129        if ("suspended".equals(codeString))
130          return LocationStatus.SUSPENDED;
131        if ("inactive".equals(codeString))
132          return LocationStatus.INACTIVE;
133        throw new IllegalArgumentException("Unknown LocationStatus code '"+codeString+"'");
134        }
135        public Enumeration<LocationStatus> fromType(Base code) throws FHIRException {
136          if (code == null || code.isEmpty())
137            return null;
138          String codeString = ((PrimitiveType) code).asStringValue();
139          if (codeString == null || "".equals(codeString))
140            return null;
141        if ("active".equals(codeString))
142          return new Enumeration<LocationStatus>(this, LocationStatus.ACTIVE);
143        if ("suspended".equals(codeString))
144          return new Enumeration<LocationStatus>(this, LocationStatus.SUSPENDED);
145        if ("inactive".equals(codeString))
146          return new Enumeration<LocationStatus>(this, LocationStatus.INACTIVE);
147        throw new FHIRException("Unknown LocationStatus code '"+codeString+"'");
148        }
149    public String toCode(LocationStatus code) {
150      if (code == LocationStatus.ACTIVE)
151        return "active";
152      if (code == LocationStatus.SUSPENDED)
153        return "suspended";
154      if (code == LocationStatus.INACTIVE)
155        return "inactive";
156      return "?";
157      }
158    public String toSystem(LocationStatus code) {
159      return code.getSystem();
160      }
161    }
162
163    public enum LocationMode {
164        /**
165         * The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A).
166         */
167        INSTANCE, 
168        /**
169         * The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could be constrained within a specific boundary (such as organization, or parent location, address etc.).
170         */
171        KIND, 
172        /**
173         * added to help the parsers
174         */
175        NULL;
176        public static LocationMode fromCode(String codeString) throws FHIRException {
177            if (codeString == null || "".equals(codeString))
178                return null;
179        if ("instance".equals(codeString))
180          return INSTANCE;
181        if ("kind".equals(codeString))
182          return KIND;
183        throw new FHIRException("Unknown LocationMode code '"+codeString+"'");
184        }
185        public String toCode() {
186          switch (this) {
187            case INSTANCE: return "instance";
188            case KIND: return "kind";
189            case NULL: return null;
190            default: return "?";
191          }
192        }
193        public String getSystem() {
194          switch (this) {
195            case INSTANCE: return "http://hl7.org/fhir/location-mode";
196            case KIND: return "http://hl7.org/fhir/location-mode";
197            case NULL: return null;
198            default: return "?";
199          }
200        }
201        public String getDefinition() {
202          switch (this) {
203            case INSTANCE: return "The Location resource represents a specific instance of a location (e.g. Operating Theatre 1A).";
204            case KIND: return "The Location represents a class of locations (e.g. Any Operating Theatre) although this class of locations could be constrained within a specific boundary (such as organization, or parent location, address etc.).";
205            case NULL: return null;
206            default: return "?";
207          }
208        }
209        public String getDisplay() {
210          switch (this) {
211            case INSTANCE: return "Instance";
212            case KIND: return "Kind";
213            case NULL: return null;
214            default: return "?";
215          }
216        }
217    }
218
219  public static class LocationModeEnumFactory implements EnumFactory<LocationMode> {
220    public LocationMode fromCode(String codeString) throws IllegalArgumentException {
221      if (codeString == null || "".equals(codeString))
222            if (codeString == null || "".equals(codeString))
223                return null;
224        if ("instance".equals(codeString))
225          return LocationMode.INSTANCE;
226        if ("kind".equals(codeString))
227          return LocationMode.KIND;
228        throw new IllegalArgumentException("Unknown LocationMode code '"+codeString+"'");
229        }
230        public Enumeration<LocationMode> fromType(Base code) throws FHIRException {
231          if (code == null || code.isEmpty())
232            return null;
233          String codeString = ((PrimitiveType) code).asStringValue();
234          if (codeString == null || "".equals(codeString))
235            return null;
236        if ("instance".equals(codeString))
237          return new Enumeration<LocationMode>(this, LocationMode.INSTANCE);
238        if ("kind".equals(codeString))
239          return new Enumeration<LocationMode>(this, LocationMode.KIND);
240        throw new FHIRException("Unknown LocationMode code '"+codeString+"'");
241        }
242    public String toCode(LocationMode code) {
243      if (code == LocationMode.INSTANCE)
244        return "instance";
245      if (code == LocationMode.KIND)
246        return "kind";
247      return "?";
248      }
249    public String toSystem(LocationMode code) {
250      return code.getSystem();
251      }
252    }
253
254    @Block()
255    public static class LocationPositionComponent extends BackboneElement implements IBaseBackboneElement {
256        /**
257         * Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
258         */
259        @Child(name = "longitude", type = {DecimalType.class}, order=1, min=1, max=1, modifier=false, summary=false)
260        @Description(shortDefinition="Longitude with WGS84 datum", formalDefinition="Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below)." )
261        protected DecimalType longitude;
262
263        /**
264         * Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
265         */
266        @Child(name = "latitude", type = {DecimalType.class}, order=2, min=1, max=1, modifier=false, summary=false)
267        @Description(shortDefinition="Latitude with WGS84 datum", formalDefinition="Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below)." )
268        protected DecimalType latitude;
269
270        /**
271         * Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
272         */
273        @Child(name = "altitude", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=false)
274        @Description(shortDefinition="Altitude with WGS84 datum", formalDefinition="Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below)." )
275        protected DecimalType altitude;
276
277        private static final long serialVersionUID = -74276134L;
278
279    /**
280     * Constructor
281     */
282      public LocationPositionComponent() {
283        super();
284      }
285
286    /**
287     * Constructor
288     */
289      public LocationPositionComponent(DecimalType longitude, DecimalType latitude) {
290        super();
291        this.longitude = longitude;
292        this.latitude = latitude;
293      }
294
295        /**
296         * @return {@link #longitude} (Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLongitude" gives direct access to the value
297         */
298        public DecimalType getLongitudeElement() { 
299          if (this.longitude == null)
300            if (Configuration.errorOnAutoCreate())
301              throw new Error("Attempt to auto-create LocationPositionComponent.longitude");
302            else if (Configuration.doAutoCreate())
303              this.longitude = new DecimalType(); // bb
304          return this.longitude;
305        }
306
307        public boolean hasLongitudeElement() { 
308          return this.longitude != null && !this.longitude.isEmpty();
309        }
310
311        public boolean hasLongitude() { 
312          return this.longitude != null && !this.longitude.isEmpty();
313        }
314
315        /**
316         * @param value {@link #longitude} (Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLongitude" gives direct access to the value
317         */
318        public LocationPositionComponent setLongitudeElement(DecimalType value) { 
319          this.longitude = value;
320          return this;
321        }
322
323        /**
324         * @return Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
325         */
326        public BigDecimal getLongitude() { 
327          return this.longitude == null ? null : this.longitude.getValue();
328        }
329
330        /**
331         * @param value Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
332         */
333        public LocationPositionComponent setLongitude(BigDecimal value) { 
334            if (this.longitude == null)
335              this.longitude = new DecimalType();
336            this.longitude.setValue(value);
337          return this;
338        }
339
340        /**
341         * @param value Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
342         */
343        public LocationPositionComponent setLongitude(long value) { 
344              this.longitude = new DecimalType();
345            this.longitude.setValue(value);
346          return this;
347        }
348
349        /**
350         * @param value Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).
351         */
352        public LocationPositionComponent setLongitude(double value) { 
353              this.longitude = new DecimalType();
354            this.longitude.setValue(value);
355          return this;
356        }
357
358        /**
359         * @return {@link #latitude} (Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLatitude" gives direct access to the value
360         */
361        public DecimalType getLatitudeElement() { 
362          if (this.latitude == null)
363            if (Configuration.errorOnAutoCreate())
364              throw new Error("Attempt to auto-create LocationPositionComponent.latitude");
365            else if (Configuration.doAutoCreate())
366              this.latitude = new DecimalType(); // bb
367          return this.latitude;
368        }
369
370        public boolean hasLatitudeElement() { 
371          return this.latitude != null && !this.latitude.isEmpty();
372        }
373
374        public boolean hasLatitude() { 
375          return this.latitude != null && !this.latitude.isEmpty();
376        }
377
378        /**
379         * @param value {@link #latitude} (Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getLatitude" gives direct access to the value
380         */
381        public LocationPositionComponent setLatitudeElement(DecimalType value) { 
382          this.latitude = value;
383          return this;
384        }
385
386        /**
387         * @return Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
388         */
389        public BigDecimal getLatitude() { 
390          return this.latitude == null ? null : this.latitude.getValue();
391        }
392
393        /**
394         * @param value Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
395         */
396        public LocationPositionComponent setLatitude(BigDecimal value) { 
397            if (this.latitude == null)
398              this.latitude = new DecimalType();
399            this.latitude.setValue(value);
400          return this;
401        }
402
403        /**
404         * @param value Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
405         */
406        public LocationPositionComponent setLatitude(long value) { 
407              this.latitude = new DecimalType();
408            this.latitude.setValue(value);
409          return this;
410        }
411
412        /**
413         * @param value Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).
414         */
415        public LocationPositionComponent setLatitude(double value) { 
416              this.latitude = new DecimalType();
417            this.latitude.setValue(value);
418          return this;
419        }
420
421        /**
422         * @return {@link #altitude} (Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getAltitude" gives direct access to the value
423         */
424        public DecimalType getAltitudeElement() { 
425          if (this.altitude == null)
426            if (Configuration.errorOnAutoCreate())
427              throw new Error("Attempt to auto-create LocationPositionComponent.altitude");
428            else if (Configuration.doAutoCreate())
429              this.altitude = new DecimalType(); // bb
430          return this.altitude;
431        }
432
433        public boolean hasAltitudeElement() { 
434          return this.altitude != null && !this.altitude.isEmpty();
435        }
436
437        public boolean hasAltitude() { 
438          return this.altitude != null && !this.altitude.isEmpty();
439        }
440
441        /**
442         * @param value {@link #altitude} (Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).). This is the underlying object with id, value and extensions. The accessor "getAltitude" gives direct access to the value
443         */
444        public LocationPositionComponent setAltitudeElement(DecimalType value) { 
445          this.altitude = value;
446          return this;
447        }
448
449        /**
450         * @return Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
451         */
452        public BigDecimal getAltitude() { 
453          return this.altitude == null ? null : this.altitude.getValue();
454        }
455
456        /**
457         * @param value Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
458         */
459        public LocationPositionComponent setAltitude(BigDecimal value) { 
460          if (value == null)
461            this.altitude = null;
462          else {
463            if (this.altitude == null)
464              this.altitude = new DecimalType();
465            this.altitude.setValue(value);
466          }
467          return this;
468        }
469
470        /**
471         * @param value Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
472         */
473        public LocationPositionComponent setAltitude(long value) { 
474              this.altitude = new DecimalType();
475            this.altitude.setValue(value);
476          return this;
477        }
478
479        /**
480         * @param value Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).
481         */
482        public LocationPositionComponent setAltitude(double value) { 
483              this.altitude = new DecimalType();
484            this.altitude.setValue(value);
485          return this;
486        }
487
488        protected void listChildren(List<Property> childrenList) {
489          super.listChildren(childrenList);
490          childrenList.add(new Property("longitude", "decimal", "Longitude. The value domain and the interpretation are the same as for the text of the longitude element in KML (see notes below).", 0, java.lang.Integer.MAX_VALUE, longitude));
491          childrenList.add(new Property("latitude", "decimal", "Latitude. The value domain and the interpretation are the same as for the text of the latitude element in KML (see notes below).", 0, java.lang.Integer.MAX_VALUE, latitude));
492          childrenList.add(new Property("altitude", "decimal", "Altitude. The value domain and the interpretation are the same as for the text of the altitude element in KML (see notes below).", 0, java.lang.Integer.MAX_VALUE, altitude));
493        }
494
495      @Override
496      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
497        switch (hash) {
498        case 137365935: /*longitude*/ return this.longitude == null ? new Base[0] : new Base[] {this.longitude}; // DecimalType
499        case -1439978388: /*latitude*/ return this.latitude == null ? new Base[0] : new Base[] {this.latitude}; // DecimalType
500        case 2036550306: /*altitude*/ return this.altitude == null ? new Base[0] : new Base[] {this.altitude}; // DecimalType
501        default: return super.getProperty(hash, name, checkValid);
502        }
503
504      }
505
506      @Override
507      public void setProperty(int hash, String name, Base value) throws FHIRException {
508        switch (hash) {
509        case 137365935: // longitude
510          this.longitude = castToDecimal(value); // DecimalType
511          break;
512        case -1439978388: // latitude
513          this.latitude = castToDecimal(value); // DecimalType
514          break;
515        case 2036550306: // altitude
516          this.altitude = castToDecimal(value); // DecimalType
517          break;
518        default: super.setProperty(hash, name, value);
519        }
520
521      }
522
523      @Override
524      public void setProperty(String name, Base value) throws FHIRException {
525        if (name.equals("longitude"))
526          this.longitude = castToDecimal(value); // DecimalType
527        else if (name.equals("latitude"))
528          this.latitude = castToDecimal(value); // DecimalType
529        else if (name.equals("altitude"))
530          this.altitude = castToDecimal(value); // DecimalType
531        else
532          super.setProperty(name, value);
533      }
534
535      @Override
536      public Base makeProperty(int hash, String name) throws FHIRException {
537        switch (hash) {
538        case 137365935: throw new FHIRException("Cannot make property longitude as it is not a complex type"); // DecimalType
539        case -1439978388: throw new FHIRException("Cannot make property latitude as it is not a complex type"); // DecimalType
540        case 2036550306: throw new FHIRException("Cannot make property altitude as it is not a complex type"); // DecimalType
541        default: return super.makeProperty(hash, name);
542        }
543
544      }
545
546      @Override
547      public Base addChild(String name) throws FHIRException {
548        if (name.equals("longitude")) {
549          throw new FHIRException("Cannot call addChild on a primitive type Location.longitude");
550        }
551        else if (name.equals("latitude")) {
552          throw new FHIRException("Cannot call addChild on a primitive type Location.latitude");
553        }
554        else if (name.equals("altitude")) {
555          throw new FHIRException("Cannot call addChild on a primitive type Location.altitude");
556        }
557        else
558          return super.addChild(name);
559      }
560
561      public LocationPositionComponent copy() {
562        LocationPositionComponent dst = new LocationPositionComponent();
563        copyValues(dst);
564        dst.longitude = longitude == null ? null : longitude.copy();
565        dst.latitude = latitude == null ? null : latitude.copy();
566        dst.altitude = altitude == null ? null : altitude.copy();
567        return dst;
568      }
569
570      @Override
571      public boolean equalsDeep(Base other) {
572        if (!super.equalsDeep(other))
573          return false;
574        if (!(other instanceof LocationPositionComponent))
575          return false;
576        LocationPositionComponent o = (LocationPositionComponent) other;
577        return compareDeep(longitude, o.longitude, true) && compareDeep(latitude, o.latitude, true) && compareDeep(altitude, o.altitude, true)
578          ;
579      }
580
581      @Override
582      public boolean equalsShallow(Base other) {
583        if (!super.equalsShallow(other))
584          return false;
585        if (!(other instanceof LocationPositionComponent))
586          return false;
587        LocationPositionComponent o = (LocationPositionComponent) other;
588        return compareValues(longitude, o.longitude, true) && compareValues(latitude, o.latitude, true) && compareValues(altitude, o.altitude, true)
589          ;
590      }
591
592      public boolean isEmpty() {
593        return super.isEmpty() && (longitude == null || longitude.isEmpty()) && (latitude == null || latitude.isEmpty())
594           && (altitude == null || altitude.isEmpty());
595      }
596
597  public String fhirType() {
598    return "Location.position";
599
600  }
601
602  }
603
604    /**
605     * Unique code or number identifying the location to its users.
606     */
607    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
608    @Description(shortDefinition="Unique code or number identifying the location to its users", formalDefinition="Unique code or number identifying the location to its users." )
609    protected List<Identifier> identifier;
610
611    /**
612     * active | suspended | inactive.
613     */
614    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
615    @Description(shortDefinition="active | suspended | inactive", formalDefinition="active | suspended | inactive." )
616    protected Enumeration<LocationStatus> status;
617
618    /**
619     * Name of the location as used by humans. Does not need to be unique.
620     */
621    @Child(name = "name", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
622    @Description(shortDefinition="Name of the location as used by humans", formalDefinition="Name of the location as used by humans. Does not need to be unique." )
623    protected StringType name;
624
625    /**
626     * Description of the Location, which helps in finding or referencing the place.
627     */
628    @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
629    @Description(shortDefinition="Additional details about the location that could be displayed as further information to identify the location beyond its name", formalDefinition="Description of the Location, which helps in finding or referencing the place." )
630    protected StringType description;
631
632    /**
633     * Indicates whether a resource instance represents a specific location or a class of locations.
634     */
635    @Child(name = "mode", type = {CodeType.class}, order=4, min=0, max=1, modifier=true, summary=true)
636    @Description(shortDefinition="instance | kind", formalDefinition="Indicates whether a resource instance represents a specific location or a class of locations." )
637    protected Enumeration<LocationMode> mode;
638
639    /**
640     * Indicates the type of function performed at the location.
641     */
642    @Child(name = "type", type = {CodeableConcept.class}, order=5, min=0, max=1, modifier=false, summary=true)
643    @Description(shortDefinition="Type of function performed", formalDefinition="Indicates the type of function performed at the location." )
644    protected CodeableConcept type;
645
646    /**
647     * The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.
648     */
649    @Child(name = "telecom", type = {ContactPoint.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
650    @Description(shortDefinition="Contact details of the location", formalDefinition="The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites." )
651    protected List<ContactPoint> telecom;
652
653    /**
654     * Physical location.
655     */
656    @Child(name = "address", type = {Address.class}, order=7, min=0, max=1, modifier=false, summary=false)
657    @Description(shortDefinition="Physical location", formalDefinition="Physical location." )
658    protected Address address;
659
660    /**
661     * Physical form of the location, e.g. building, room, vehicle, road.
662     */
663    @Child(name = "physicalType", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=true)
664    @Description(shortDefinition="Physical form of the location", formalDefinition="Physical form of the location, e.g. building, room, vehicle, road." )
665    protected CodeableConcept physicalType;
666
667    /**
668     * The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).
669     */
670    @Child(name = "position", type = {}, order=9, min=0, max=1, modifier=false, summary=false)
671    @Description(shortDefinition="The absolute geographic location", formalDefinition="The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML)." )
672    protected LocationPositionComponent position;
673
674    /**
675     * The organization responsible for the provisioning and upkeep of the location.
676     */
677    @Child(name = "managingOrganization", type = {Organization.class}, order=10, min=0, max=1, modifier=false, summary=true)
678    @Description(shortDefinition="Organization responsible for provisioning and upkeep", formalDefinition="The organization responsible for the provisioning and upkeep of the location." )
679    protected Reference managingOrganization;
680
681    /**
682     * The actual object that is the target of the reference (The organization responsible for the provisioning and upkeep of the location.)
683     */
684    protected Organization managingOrganizationTarget;
685
686    /**
687     * Another Location which this Location is physically part of.
688     */
689    @Child(name = "partOf", type = {Location.class}, order=11, min=0, max=1, modifier=false, summary=false)
690    @Description(shortDefinition="Another Location this one is physically part of", formalDefinition="Another Location which this Location is physically part of." )
691    protected Reference partOf;
692
693    /**
694     * The actual object that is the target of the reference (Another Location which this Location is physically part of.)
695     */
696    protected Location partOfTarget;
697
698    private static final long serialVersionUID = -2100435761L;
699
700  /**
701   * Constructor
702   */
703    public Location() {
704      super();
705    }
706
707    /**
708     * @return {@link #identifier} (Unique code or number identifying the location to its users.)
709     */
710    public List<Identifier> getIdentifier() { 
711      if (this.identifier == null)
712        this.identifier = new ArrayList<Identifier>();
713      return this.identifier;
714    }
715
716    public boolean hasIdentifier() { 
717      if (this.identifier == null)
718        return false;
719      for (Identifier item : this.identifier)
720        if (!item.isEmpty())
721          return true;
722      return false;
723    }
724
725    /**
726     * @return {@link #identifier} (Unique code or number identifying the location to its users.)
727     */
728    // syntactic sugar
729    public Identifier addIdentifier() { //3
730      Identifier t = new Identifier();
731      if (this.identifier == null)
732        this.identifier = new ArrayList<Identifier>();
733      this.identifier.add(t);
734      return t;
735    }
736
737    // syntactic sugar
738    public Location addIdentifier(Identifier t) { //3
739      if (t == null)
740        return this;
741      if (this.identifier == null)
742        this.identifier = new ArrayList<Identifier>();
743      this.identifier.add(t);
744      return this;
745    }
746
747    /**
748     * @return {@link #status} (active | suspended | inactive.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
749     */
750    public Enumeration<LocationStatus> getStatusElement() { 
751      if (this.status == null)
752        if (Configuration.errorOnAutoCreate())
753          throw new Error("Attempt to auto-create Location.status");
754        else if (Configuration.doAutoCreate())
755          this.status = new Enumeration<LocationStatus>(new LocationStatusEnumFactory()); // bb
756      return this.status;
757    }
758
759    public boolean hasStatusElement() { 
760      return this.status != null && !this.status.isEmpty();
761    }
762
763    public boolean hasStatus() { 
764      return this.status != null && !this.status.isEmpty();
765    }
766
767    /**
768     * @param value {@link #status} (active | suspended | inactive.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
769     */
770    public Location setStatusElement(Enumeration<LocationStatus> value) { 
771      this.status = value;
772      return this;
773    }
774
775    /**
776     * @return active | suspended | inactive.
777     */
778    public LocationStatus getStatus() { 
779      return this.status == null ? null : this.status.getValue();
780    }
781
782    /**
783     * @param value active | suspended | inactive.
784     */
785    public Location setStatus(LocationStatus value) { 
786      if (value == null)
787        this.status = null;
788      else {
789        if (this.status == null)
790          this.status = new Enumeration<LocationStatus>(new LocationStatusEnumFactory());
791        this.status.setValue(value);
792      }
793      return this;
794    }
795
796    /**
797     * @return {@link #name} (Name of the location as used by humans. Does not need to be unique.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
798     */
799    public StringType getNameElement() { 
800      if (this.name == null)
801        if (Configuration.errorOnAutoCreate())
802          throw new Error("Attempt to auto-create Location.name");
803        else if (Configuration.doAutoCreate())
804          this.name = new StringType(); // bb
805      return this.name;
806    }
807
808    public boolean hasNameElement() { 
809      return this.name != null && !this.name.isEmpty();
810    }
811
812    public boolean hasName() { 
813      return this.name != null && !this.name.isEmpty();
814    }
815
816    /**
817     * @param value {@link #name} (Name of the location as used by humans. Does not need to be unique.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
818     */
819    public Location setNameElement(StringType value) { 
820      this.name = value;
821      return this;
822    }
823
824    /**
825     * @return Name of the location as used by humans. Does not need to be unique.
826     */
827    public String getName() { 
828      return this.name == null ? null : this.name.getValue();
829    }
830
831    /**
832     * @param value Name of the location as used by humans. Does not need to be unique.
833     */
834    public Location setName(String value) { 
835      if (Utilities.noString(value))
836        this.name = null;
837      else {
838        if (this.name == null)
839          this.name = new StringType();
840        this.name.setValue(value);
841      }
842      return this;
843    }
844
845    /**
846     * @return {@link #description} (Description of the Location, which helps in finding or referencing the place.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
847     */
848    public StringType getDescriptionElement() { 
849      if (this.description == null)
850        if (Configuration.errorOnAutoCreate())
851          throw new Error("Attempt to auto-create Location.description");
852        else if (Configuration.doAutoCreate())
853          this.description = new StringType(); // bb
854      return this.description;
855    }
856
857    public boolean hasDescriptionElement() { 
858      return this.description != null && !this.description.isEmpty();
859    }
860
861    public boolean hasDescription() { 
862      return this.description != null && !this.description.isEmpty();
863    }
864
865    /**
866     * @param value {@link #description} (Description of the Location, which helps in finding or referencing the place.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
867     */
868    public Location setDescriptionElement(StringType value) { 
869      this.description = value;
870      return this;
871    }
872
873    /**
874     * @return Description of the Location, which helps in finding or referencing the place.
875     */
876    public String getDescription() { 
877      return this.description == null ? null : this.description.getValue();
878    }
879
880    /**
881     * @param value Description of the Location, which helps in finding or referencing the place.
882     */
883    public Location setDescription(String value) { 
884      if (Utilities.noString(value))
885        this.description = null;
886      else {
887        if (this.description == null)
888          this.description = new StringType();
889        this.description.setValue(value);
890      }
891      return this;
892    }
893
894    /**
895     * @return {@link #mode} (Indicates whether a resource instance represents a specific location or a class of locations.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
896     */
897    public Enumeration<LocationMode> getModeElement() { 
898      if (this.mode == null)
899        if (Configuration.errorOnAutoCreate())
900          throw new Error("Attempt to auto-create Location.mode");
901        else if (Configuration.doAutoCreate())
902          this.mode = new Enumeration<LocationMode>(new LocationModeEnumFactory()); // bb
903      return this.mode;
904    }
905
906    public boolean hasModeElement() { 
907      return this.mode != null && !this.mode.isEmpty();
908    }
909
910    public boolean hasMode() { 
911      return this.mode != null && !this.mode.isEmpty();
912    }
913
914    /**
915     * @param value {@link #mode} (Indicates whether a resource instance represents a specific location or a class of locations.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
916     */
917    public Location setModeElement(Enumeration<LocationMode> value) { 
918      this.mode = value;
919      return this;
920    }
921
922    /**
923     * @return Indicates whether a resource instance represents a specific location or a class of locations.
924     */
925    public LocationMode getMode() { 
926      return this.mode == null ? null : this.mode.getValue();
927    }
928
929    /**
930     * @param value Indicates whether a resource instance represents a specific location or a class of locations.
931     */
932    public Location setMode(LocationMode value) { 
933      if (value == null)
934        this.mode = null;
935      else {
936        if (this.mode == null)
937          this.mode = new Enumeration<LocationMode>(new LocationModeEnumFactory());
938        this.mode.setValue(value);
939      }
940      return this;
941    }
942
943    /**
944     * @return {@link #type} (Indicates the type of function performed at the location.)
945     */
946    public CodeableConcept getType() { 
947      if (this.type == null)
948        if (Configuration.errorOnAutoCreate())
949          throw new Error("Attempt to auto-create Location.type");
950        else if (Configuration.doAutoCreate())
951          this.type = new CodeableConcept(); // cc
952      return this.type;
953    }
954
955    public boolean hasType() { 
956      return this.type != null && !this.type.isEmpty();
957    }
958
959    /**
960     * @param value {@link #type} (Indicates the type of function performed at the location.)
961     */
962    public Location setType(CodeableConcept value) { 
963      this.type = value;
964      return this;
965    }
966
967    /**
968     * @return {@link #telecom} (The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.)
969     */
970    public List<ContactPoint> getTelecom() { 
971      if (this.telecom == null)
972        this.telecom = new ArrayList<ContactPoint>();
973      return this.telecom;
974    }
975
976    public boolean hasTelecom() { 
977      if (this.telecom == null)
978        return false;
979      for (ContactPoint item : this.telecom)
980        if (!item.isEmpty())
981          return true;
982      return false;
983    }
984
985    /**
986     * @return {@link #telecom} (The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.)
987     */
988    // syntactic sugar
989    public ContactPoint addTelecom() { //3
990      ContactPoint t = new ContactPoint();
991      if (this.telecom == null)
992        this.telecom = new ArrayList<ContactPoint>();
993      this.telecom.add(t);
994      return t;
995    }
996
997    // syntactic sugar
998    public Location addTelecom(ContactPoint t) { //3
999      if (t == null)
1000        return this;
1001      if (this.telecom == null)
1002        this.telecom = new ArrayList<ContactPoint>();
1003      this.telecom.add(t);
1004      return this;
1005    }
1006
1007    /**
1008     * @return {@link #address} (Physical location.)
1009     */
1010    public Address getAddress() { 
1011      if (this.address == null)
1012        if (Configuration.errorOnAutoCreate())
1013          throw new Error("Attempt to auto-create Location.address");
1014        else if (Configuration.doAutoCreate())
1015          this.address = new Address(); // cc
1016      return this.address;
1017    }
1018
1019    public boolean hasAddress() { 
1020      return this.address != null && !this.address.isEmpty();
1021    }
1022
1023    /**
1024     * @param value {@link #address} (Physical location.)
1025     */
1026    public Location setAddress(Address value) { 
1027      this.address = value;
1028      return this;
1029    }
1030
1031    /**
1032     * @return {@link #physicalType} (Physical form of the location, e.g. building, room, vehicle, road.)
1033     */
1034    public CodeableConcept getPhysicalType() { 
1035      if (this.physicalType == null)
1036        if (Configuration.errorOnAutoCreate())
1037          throw new Error("Attempt to auto-create Location.physicalType");
1038        else if (Configuration.doAutoCreate())
1039          this.physicalType = new CodeableConcept(); // cc
1040      return this.physicalType;
1041    }
1042
1043    public boolean hasPhysicalType() { 
1044      return this.physicalType != null && !this.physicalType.isEmpty();
1045    }
1046
1047    /**
1048     * @param value {@link #physicalType} (Physical form of the location, e.g. building, room, vehicle, road.)
1049     */
1050    public Location setPhysicalType(CodeableConcept value) { 
1051      this.physicalType = value;
1052      return this;
1053    }
1054
1055    /**
1056     * @return {@link #position} (The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).)
1057     */
1058    public LocationPositionComponent getPosition() { 
1059      if (this.position == null)
1060        if (Configuration.errorOnAutoCreate())
1061          throw new Error("Attempt to auto-create Location.position");
1062        else if (Configuration.doAutoCreate())
1063          this.position = new LocationPositionComponent(); // cc
1064      return this.position;
1065    }
1066
1067    public boolean hasPosition() { 
1068      return this.position != null && !this.position.isEmpty();
1069    }
1070
1071    /**
1072     * @param value {@link #position} (The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).)
1073     */
1074    public Location setPosition(LocationPositionComponent value) { 
1075      this.position = value;
1076      return this;
1077    }
1078
1079    /**
1080     * @return {@link #managingOrganization} (The organization responsible for the provisioning and upkeep of the location.)
1081     */
1082    public Reference getManagingOrganization() { 
1083      if (this.managingOrganization == null)
1084        if (Configuration.errorOnAutoCreate())
1085          throw new Error("Attempt to auto-create Location.managingOrganization");
1086        else if (Configuration.doAutoCreate())
1087          this.managingOrganization = new Reference(); // cc
1088      return this.managingOrganization;
1089    }
1090
1091    public boolean hasManagingOrganization() { 
1092      return this.managingOrganization != null && !this.managingOrganization.isEmpty();
1093    }
1094
1095    /**
1096     * @param value {@link #managingOrganization} (The organization responsible for the provisioning and upkeep of the location.)
1097     */
1098    public Location setManagingOrganization(Reference value) { 
1099      this.managingOrganization = value;
1100      return this;
1101    }
1102
1103    /**
1104     * @return {@link #managingOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization responsible for the provisioning and upkeep of the location.)
1105     */
1106    public Organization getManagingOrganizationTarget() { 
1107      if (this.managingOrganizationTarget == null)
1108        if (Configuration.errorOnAutoCreate())
1109          throw new Error("Attempt to auto-create Location.managingOrganization");
1110        else if (Configuration.doAutoCreate())
1111          this.managingOrganizationTarget = new Organization(); // aa
1112      return this.managingOrganizationTarget;
1113    }
1114
1115    /**
1116     * @param value {@link #managingOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization responsible for the provisioning and upkeep of the location.)
1117     */
1118    public Location setManagingOrganizationTarget(Organization value) { 
1119      this.managingOrganizationTarget = value;
1120      return this;
1121    }
1122
1123    /**
1124     * @return {@link #partOf} (Another Location which this Location is physically part of.)
1125     */
1126    public Reference getPartOf() { 
1127      if (this.partOf == null)
1128        if (Configuration.errorOnAutoCreate())
1129          throw new Error("Attempt to auto-create Location.partOf");
1130        else if (Configuration.doAutoCreate())
1131          this.partOf = new Reference(); // cc
1132      return this.partOf;
1133    }
1134
1135    public boolean hasPartOf() { 
1136      return this.partOf != null && !this.partOf.isEmpty();
1137    }
1138
1139    /**
1140     * @param value {@link #partOf} (Another Location which this Location is physically part of.)
1141     */
1142    public Location setPartOf(Reference value) { 
1143      this.partOf = value;
1144      return this;
1145    }
1146
1147    /**
1148     * @return {@link #partOf} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Another Location which this Location is physically part of.)
1149     */
1150    public Location getPartOfTarget() { 
1151      if (this.partOfTarget == null)
1152        if (Configuration.errorOnAutoCreate())
1153          throw new Error("Attempt to auto-create Location.partOf");
1154        else if (Configuration.doAutoCreate())
1155          this.partOfTarget = new Location(); // aa
1156      return this.partOfTarget;
1157    }
1158
1159    /**
1160     * @param value {@link #partOf} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Another Location which this Location is physically part of.)
1161     */
1162    public Location setPartOfTarget(Location value) { 
1163      this.partOfTarget = value;
1164      return this;
1165    }
1166
1167      protected void listChildren(List<Property> childrenList) {
1168        super.listChildren(childrenList);
1169        childrenList.add(new Property("identifier", "Identifier", "Unique code or number identifying the location to its users.", 0, java.lang.Integer.MAX_VALUE, identifier));
1170        childrenList.add(new Property("status", "code", "active | suspended | inactive.", 0, java.lang.Integer.MAX_VALUE, status));
1171        childrenList.add(new Property("name", "string", "Name of the location as used by humans. Does not need to be unique.", 0, java.lang.Integer.MAX_VALUE, name));
1172        childrenList.add(new Property("description", "string", "Description of the Location, which helps in finding or referencing the place.", 0, java.lang.Integer.MAX_VALUE, description));
1173        childrenList.add(new Property("mode", "code", "Indicates whether a resource instance represents a specific location or a class of locations.", 0, java.lang.Integer.MAX_VALUE, mode));
1174        childrenList.add(new Property("type", "CodeableConcept", "Indicates the type of function performed at the location.", 0, java.lang.Integer.MAX_VALUE, type));
1175        childrenList.add(new Property("telecom", "ContactPoint", "The contact details of communication devices available at the location. This can include phone numbers, fax numbers, mobile numbers, email addresses and web sites.", 0, java.lang.Integer.MAX_VALUE, telecom));
1176        childrenList.add(new Property("address", "Address", "Physical location.", 0, java.lang.Integer.MAX_VALUE, address));
1177        childrenList.add(new Property("physicalType", "CodeableConcept", "Physical form of the location, e.g. building, room, vehicle, road.", 0, java.lang.Integer.MAX_VALUE, physicalType));
1178        childrenList.add(new Property("position", "", "The absolute geographic location of the Location, expressed using the WGS84 datum (This is the same co-ordinate system used in KML).", 0, java.lang.Integer.MAX_VALUE, position));
1179        childrenList.add(new Property("managingOrganization", "Reference(Organization)", "The organization responsible for the provisioning and upkeep of the location.", 0, java.lang.Integer.MAX_VALUE, managingOrganization));
1180        childrenList.add(new Property("partOf", "Reference(Location)", "Another Location which this Location is physically part of.", 0, java.lang.Integer.MAX_VALUE, partOf));
1181      }
1182
1183      @Override
1184      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1185        switch (hash) {
1186        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
1187        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<LocationStatus>
1188        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
1189        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
1190        case 3357091: /*mode*/ return this.mode == null ? new Base[0] : new Base[] {this.mode}; // Enumeration<LocationMode>
1191        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
1192        case -1429363305: /*telecom*/ return this.telecom == null ? new Base[0] : this.telecom.toArray(new Base[this.telecom.size()]); // ContactPoint
1193        case -1147692044: /*address*/ return this.address == null ? new Base[0] : new Base[] {this.address}; // Address
1194        case -1474715471: /*physicalType*/ return this.physicalType == null ? new Base[0] : new Base[] {this.physicalType}; // CodeableConcept
1195        case 747804969: /*position*/ return this.position == null ? new Base[0] : new Base[] {this.position}; // LocationPositionComponent
1196        case -2058947787: /*managingOrganization*/ return this.managingOrganization == null ? new Base[0] : new Base[] {this.managingOrganization}; // Reference
1197        case -995410646: /*partOf*/ return this.partOf == null ? new Base[0] : new Base[] {this.partOf}; // Reference
1198        default: return super.getProperty(hash, name, checkValid);
1199        }
1200
1201      }
1202
1203      @Override
1204      public void setProperty(int hash, String name, Base value) throws FHIRException {
1205        switch (hash) {
1206        case -1618432855: // identifier
1207          this.getIdentifier().add(castToIdentifier(value)); // Identifier
1208          break;
1209        case -892481550: // status
1210          this.status = new LocationStatusEnumFactory().fromType(value); // Enumeration<LocationStatus>
1211          break;
1212        case 3373707: // name
1213          this.name = castToString(value); // StringType
1214          break;
1215        case -1724546052: // description
1216          this.description = castToString(value); // StringType
1217          break;
1218        case 3357091: // mode
1219          this.mode = new LocationModeEnumFactory().fromType(value); // Enumeration<LocationMode>
1220          break;
1221        case 3575610: // type
1222          this.type = castToCodeableConcept(value); // CodeableConcept
1223          break;
1224        case -1429363305: // telecom
1225          this.getTelecom().add(castToContactPoint(value)); // ContactPoint
1226          break;
1227        case -1147692044: // address
1228          this.address = castToAddress(value); // Address
1229          break;
1230        case -1474715471: // physicalType
1231          this.physicalType = castToCodeableConcept(value); // CodeableConcept
1232          break;
1233        case 747804969: // position
1234          this.position = (LocationPositionComponent) value; // LocationPositionComponent
1235          break;
1236        case -2058947787: // managingOrganization
1237          this.managingOrganization = castToReference(value); // Reference
1238          break;
1239        case -995410646: // partOf
1240          this.partOf = castToReference(value); // Reference
1241          break;
1242        default: super.setProperty(hash, name, value);
1243        }
1244
1245      }
1246
1247      @Override
1248      public void setProperty(String name, Base value) throws FHIRException {
1249        if (name.equals("identifier"))
1250          this.getIdentifier().add(castToIdentifier(value));
1251        else if (name.equals("status"))
1252          this.status = new LocationStatusEnumFactory().fromType(value); // Enumeration<LocationStatus>
1253        else if (name.equals("name"))
1254          this.name = castToString(value); // StringType
1255        else if (name.equals("description"))
1256          this.description = castToString(value); // StringType
1257        else if (name.equals("mode"))
1258          this.mode = new LocationModeEnumFactory().fromType(value); // Enumeration<LocationMode>
1259        else if (name.equals("type"))
1260          this.type = castToCodeableConcept(value); // CodeableConcept
1261        else if (name.equals("telecom"))
1262          this.getTelecom().add(castToContactPoint(value));
1263        else if (name.equals("address"))
1264          this.address = castToAddress(value); // Address
1265        else if (name.equals("physicalType"))
1266          this.physicalType = castToCodeableConcept(value); // CodeableConcept
1267        else if (name.equals("position"))
1268          this.position = (LocationPositionComponent) value; // LocationPositionComponent
1269        else if (name.equals("managingOrganization"))
1270          this.managingOrganization = castToReference(value); // Reference
1271        else if (name.equals("partOf"))
1272          this.partOf = castToReference(value); // Reference
1273        else
1274          super.setProperty(name, value);
1275      }
1276
1277      @Override
1278      public Base makeProperty(int hash, String name) throws FHIRException {
1279        switch (hash) {
1280        case -1618432855:  return addIdentifier(); // Identifier
1281        case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration<LocationStatus>
1282        case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
1283        case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
1284        case 3357091: throw new FHIRException("Cannot make property mode as it is not a complex type"); // Enumeration<LocationMode>
1285        case 3575610:  return getType(); // CodeableConcept
1286        case -1429363305:  return addTelecom(); // ContactPoint
1287        case -1147692044:  return getAddress(); // Address
1288        case -1474715471:  return getPhysicalType(); // CodeableConcept
1289        case 747804969:  return getPosition(); // LocationPositionComponent
1290        case -2058947787:  return getManagingOrganization(); // Reference
1291        case -995410646:  return getPartOf(); // Reference
1292        default: return super.makeProperty(hash, name);
1293        }
1294
1295      }
1296
1297      @Override
1298      public Base addChild(String name) throws FHIRException {
1299        if (name.equals("identifier")) {
1300          return addIdentifier();
1301        }
1302        else if (name.equals("status")) {
1303          throw new FHIRException("Cannot call addChild on a primitive type Location.status");
1304        }
1305        else if (name.equals("name")) {
1306          throw new FHIRException("Cannot call addChild on a primitive type Location.name");
1307        }
1308        else if (name.equals("description")) {
1309          throw new FHIRException("Cannot call addChild on a primitive type Location.description");
1310        }
1311        else if (name.equals("mode")) {
1312          throw new FHIRException("Cannot call addChild on a primitive type Location.mode");
1313        }
1314        else if (name.equals("type")) {
1315          this.type = new CodeableConcept();
1316          return this.type;
1317        }
1318        else if (name.equals("telecom")) {
1319          return addTelecom();
1320        }
1321        else if (name.equals("address")) {
1322          this.address = new Address();
1323          return this.address;
1324        }
1325        else if (name.equals("physicalType")) {
1326          this.physicalType = new CodeableConcept();
1327          return this.physicalType;
1328        }
1329        else if (name.equals("position")) {
1330          this.position = new LocationPositionComponent();
1331          return this.position;
1332        }
1333        else if (name.equals("managingOrganization")) {
1334          this.managingOrganization = new Reference();
1335          return this.managingOrganization;
1336        }
1337        else if (name.equals("partOf")) {
1338          this.partOf = new Reference();
1339          return this.partOf;
1340        }
1341        else
1342          return super.addChild(name);
1343      }
1344
1345  public String fhirType() {
1346    return "Location";
1347
1348  }
1349
1350      public Location copy() {
1351        Location dst = new Location();
1352        copyValues(dst);
1353        if (identifier != null) {
1354          dst.identifier = new ArrayList<Identifier>();
1355          for (Identifier i : identifier)
1356            dst.identifier.add(i.copy());
1357        };
1358        dst.status = status == null ? null : status.copy();
1359        dst.name = name == null ? null : name.copy();
1360        dst.description = description == null ? null : description.copy();
1361        dst.mode = mode == null ? null : mode.copy();
1362        dst.type = type == null ? null : type.copy();
1363        if (telecom != null) {
1364          dst.telecom = new ArrayList<ContactPoint>();
1365          for (ContactPoint i : telecom)
1366            dst.telecom.add(i.copy());
1367        };
1368        dst.address = address == null ? null : address.copy();
1369        dst.physicalType = physicalType == null ? null : physicalType.copy();
1370        dst.position = position == null ? null : position.copy();
1371        dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
1372        dst.partOf = partOf == null ? null : partOf.copy();
1373        return dst;
1374      }
1375
1376      protected Location typedCopy() {
1377        return copy();
1378      }
1379
1380      @Override
1381      public boolean equalsDeep(Base other) {
1382        if (!super.equalsDeep(other))
1383          return false;
1384        if (!(other instanceof Location))
1385          return false;
1386        Location o = (Location) other;
1387        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(name, o.name, true)
1388           && compareDeep(description, o.description, true) && compareDeep(mode, o.mode, true) && compareDeep(type, o.type, true)
1389           && compareDeep(telecom, o.telecom, true) && compareDeep(address, o.address, true) && compareDeep(physicalType, o.physicalType, true)
1390           && compareDeep(position, o.position, true) && compareDeep(managingOrganization, o.managingOrganization, true)
1391           && compareDeep(partOf, o.partOf, true);
1392      }
1393
1394      @Override
1395      public boolean equalsShallow(Base other) {
1396        if (!super.equalsShallow(other))
1397          return false;
1398        if (!(other instanceof Location))
1399          return false;
1400        Location o = (Location) other;
1401        return compareValues(status, o.status, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
1402           && compareValues(mode, o.mode, true);
1403      }
1404
1405      public boolean isEmpty() {
1406        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (status == null || status.isEmpty())
1407           && (name == null || name.isEmpty()) && (description == null || description.isEmpty()) && (mode == null || mode.isEmpty())
1408           && (type == null || type.isEmpty()) && (telecom == null || telecom.isEmpty()) && (address == null || address.isEmpty())
1409           && (physicalType == null || physicalType.isEmpty()) && (position == null || position.isEmpty())
1410           && (managingOrganization == null || managingOrganization.isEmpty()) && (partOf == null || partOf.isEmpty())
1411          ;
1412      }
1413
1414  @Override
1415  public ResourceType getResourceType() {
1416    return ResourceType.Location;
1417   }
1418
1419 /**
1420   * Search parameter: <b>organization</b>
1421   * <p>
1422   * Description: <b>Searches for locations that are managed by the provided organization</b><br>
1423   * Type: <b>reference</b><br>
1424   * Path: <b>Location.managingOrganization</b><br>
1425   * </p>
1426   */
1427  @SearchParamDefinition(name="organization", path="Location.managingOrganization", description="Searches for locations that are managed by the provided organization", type="reference" )
1428  public static final String SP_ORGANIZATION = "organization";
1429 /**
1430   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1431   * <p>
1432   * Description: <b>Searches for locations that are managed by the provided organization</b><br>
1433   * Type: <b>reference</b><br>
1434   * Path: <b>Location.managingOrganization</b><br>
1435   * </p>
1436   */
1437  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1438
1439/**
1440   * Constant for fluent queries to be used to add include statements. Specifies
1441   * the path value of "<b>Location:organization</b>".
1442   */
1443  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Location:organization").toLocked();
1444
1445 /**
1446   * Search parameter: <b>address-state</b>
1447   * <p>
1448   * Description: <b>A state specified in an address</b><br>
1449   * Type: <b>string</b><br>
1450   * Path: <b>Location.address.state</b><br>
1451   * </p>
1452   */
1453  @SearchParamDefinition(name="address-state", path="Location.address.state", description="A state specified in an address", type="string" )
1454  public static final String SP_ADDRESS_STATE = "address-state";
1455 /**
1456   * <b>Fluent Client</b> search parameter constant for <b>address-state</b>
1457   * <p>
1458   * Description: <b>A state specified in an address</b><br>
1459   * Type: <b>string</b><br>
1460   * Path: <b>Location.address.state</b><br>
1461   * </p>
1462   */
1463  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_STATE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_STATE);
1464
1465 /**
1466   * Search parameter: <b>address-city</b>
1467   * <p>
1468   * Description: <b>A city specified in an address</b><br>
1469   * Type: <b>string</b><br>
1470   * Path: <b>Location.address.city</b><br>
1471   * </p>
1472   */
1473  @SearchParamDefinition(name="address-city", path="Location.address.city", description="A city specified in an address", type="string" )
1474  public static final String SP_ADDRESS_CITY = "address-city";
1475 /**
1476   * <b>Fluent Client</b> search parameter constant for <b>address-city</b>
1477   * <p>
1478   * Description: <b>A city specified in an address</b><br>
1479   * Type: <b>string</b><br>
1480   * Path: <b>Location.address.city</b><br>
1481   * </p>
1482   */
1483  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_CITY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_CITY);
1484
1485 /**
1486   * Search parameter: <b>near</b>
1487   * <p>
1488   * Description: <b>The coordinates expressed as [lat],[long] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)</b><br>
1489   * Type: <b>token</b><br>
1490   * Path: <b>Location.position</b><br>
1491   * </p>
1492   */
1493  @SearchParamDefinition(name="near", path="Location.position", description="The coordinates expressed as [lat],[long] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)", type="token" )
1494  public static final String SP_NEAR = "near";
1495 /**
1496   * <b>Fluent Client</b> search parameter constant for <b>near</b>
1497   * <p>
1498   * Description: <b>The coordinates expressed as [lat],[long] (using the WGS84 datum, see notes) to find locations near to (servers may search using a square rather than a circle for efficiency)</b><br>
1499   * Type: <b>token</b><br>
1500   * Path: <b>Location.position</b><br>
1501   * </p>
1502   */
1503  public static final ca.uhn.fhir.rest.gclient.TokenClientParam NEAR = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_NEAR);
1504
1505 /**
1506   * Search parameter: <b>partof</b>
1507   * <p>
1508   * Description: <b>The location of which this location is a part</b><br>
1509   * Type: <b>reference</b><br>
1510   * Path: <b>Location.partOf</b><br>
1511   * </p>
1512   */
1513  @SearchParamDefinition(name="partof", path="Location.partOf", description="The location of which this location is a part", type="reference" )
1514  public static final String SP_PARTOF = "partof";
1515 /**
1516   * <b>Fluent Client</b> search parameter constant for <b>partof</b>
1517   * <p>
1518   * Description: <b>The location of which this location is a part</b><br>
1519   * Type: <b>reference</b><br>
1520   * Path: <b>Location.partOf</b><br>
1521   * </p>
1522   */
1523  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PARTOF = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PARTOF);
1524
1525/**
1526   * Constant for fluent queries to be used to add include statements. Specifies
1527   * the path value of "<b>Location:partof</b>".
1528   */
1529  public static final ca.uhn.fhir.model.api.Include INCLUDE_PARTOF = new ca.uhn.fhir.model.api.Include("Location:partof").toLocked();
1530
1531 /**
1532   * Search parameter: <b>status</b>
1533   * <p>
1534   * Description: <b>Searches for locations with a specific kind of status</b><br>
1535   * Type: <b>token</b><br>
1536   * Path: <b>Location.status</b><br>
1537   * </p>
1538   */
1539  @SearchParamDefinition(name="status", path="Location.status", description="Searches for locations with a specific kind of status", type="token" )
1540  public static final String SP_STATUS = "status";
1541 /**
1542   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1543   * <p>
1544   * Description: <b>Searches for locations with a specific kind of status</b><br>
1545   * Type: <b>token</b><br>
1546   * Path: <b>Location.status</b><br>
1547   * </p>
1548   */
1549  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1550
1551 /**
1552   * Search parameter: <b>address</b>
1553   * <p>
1554   * Description: <b>A (part of the) address of the location</b><br>
1555   * Type: <b>string</b><br>
1556   * Path: <b>Location.address</b><br>
1557   * </p>
1558   */
1559  @SearchParamDefinition(name="address", path="Location.address", description="A (part of the) address of the location", type="string" )
1560  public static final String SP_ADDRESS = "address";
1561 /**
1562   * <b>Fluent Client</b> search parameter constant for <b>address</b>
1563   * <p>
1564   * Description: <b>A (part of the) address of the location</b><br>
1565   * Type: <b>string</b><br>
1566   * Path: <b>Location.address</b><br>
1567   * </p>
1568   */
1569  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS);
1570
1571 /**
1572   * Search parameter: <b>address-use</b>
1573   * <p>
1574   * Description: <b>A use code specified in an address</b><br>
1575   * Type: <b>token</b><br>
1576   * Path: <b>Location.address.use</b><br>
1577   * </p>
1578   */
1579  @SearchParamDefinition(name="address-use", path="Location.address.use", description="A use code specified in an address", type="token" )
1580  public static final String SP_ADDRESS_USE = "address-use";
1581 /**
1582   * <b>Fluent Client</b> search parameter constant for <b>address-use</b>
1583   * <p>
1584   * Description: <b>A use code specified in an address</b><br>
1585   * Type: <b>token</b><br>
1586   * Path: <b>Location.address.use</b><br>
1587   * </p>
1588   */
1589  public static final ca.uhn.fhir.rest.gclient.TokenClientParam ADDRESS_USE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_ADDRESS_USE);
1590
1591 /**
1592   * Search parameter: <b>name</b>
1593   * <p>
1594   * Description: <b>A (portion of the) name of the location</b><br>
1595   * Type: <b>string</b><br>
1596   * Path: <b>Location.name</b><br>
1597   * </p>
1598   */
1599  @SearchParamDefinition(name="name", path="Location.name", description="A (portion of the) name of the location", type="string" )
1600  public static final String SP_NAME = "name";
1601 /**
1602   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1603   * <p>
1604   * Description: <b>A (portion of the) name of the location</b><br>
1605   * Type: <b>string</b><br>
1606   * Path: <b>Location.name</b><br>
1607   * </p>
1608   */
1609  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
1610
1611 /**
1612   * Search parameter: <b>address-country</b>
1613   * <p>
1614   * Description: <b>A country specified in an address</b><br>
1615   * Type: <b>string</b><br>
1616   * Path: <b>Location.address.country</b><br>
1617   * </p>
1618   */
1619  @SearchParamDefinition(name="address-country", path="Location.address.country", description="A country specified in an address", type="string" )
1620  public static final String SP_ADDRESS_COUNTRY = "address-country";
1621 /**
1622   * <b>Fluent Client</b> search parameter constant for <b>address-country</b>
1623   * <p>
1624   * Description: <b>A country specified in an address</b><br>
1625   * Type: <b>string</b><br>
1626   * Path: <b>Location.address.country</b><br>
1627   * </p>
1628   */
1629  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_COUNTRY = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_COUNTRY);
1630
1631 /**
1632   * Search parameter: <b>near-distance</b>
1633   * <p>
1634   * Description: <b>A distance quantity to limit the near search to locations within a specific distance</b><br>
1635   * Type: <b>token</b><br>
1636   * Path: <b>Location.position</b><br>
1637   * </p>
1638   */
1639  @SearchParamDefinition(name="near-distance", path="Location.position", description="A distance quantity to limit the near search to locations within a specific distance", type="token" )
1640  public static final String SP_NEAR_DISTANCE = "near-distance";
1641 /**
1642   * <b>Fluent Client</b> search parameter constant for <b>near-distance</b>
1643   * <p>
1644   * Description: <b>A distance quantity to limit the near search to locations within a specific distance</b><br>
1645   * Type: <b>token</b><br>
1646   * Path: <b>Location.position</b><br>
1647   * </p>
1648   */
1649  public static final ca.uhn.fhir.rest.gclient.TokenClientParam NEAR_DISTANCE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_NEAR_DISTANCE);
1650
1651 /**
1652   * Search parameter: <b>type</b>
1653   * <p>
1654   * Description: <b>A code for the type of location</b><br>
1655   * Type: <b>token</b><br>
1656   * Path: <b>Location.type</b><br>
1657   * </p>
1658   */
1659  @SearchParamDefinition(name="type", path="Location.type", description="A code for the type of location", type="token" )
1660  public static final String SP_TYPE = "type";
1661 /**
1662   * <b>Fluent Client</b> search parameter constant for <b>type</b>
1663   * <p>
1664   * Description: <b>A code for the type of location</b><br>
1665   * Type: <b>token</b><br>
1666   * Path: <b>Location.type</b><br>
1667   * </p>
1668   */
1669  public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
1670
1671 /**
1672   * Search parameter: <b>identifier</b>
1673   * <p>
1674   * Description: <b>Unique code or number identifying the location to its users</b><br>
1675   * Type: <b>token</b><br>
1676   * Path: <b>Location.identifier</b><br>
1677   * </p>
1678   */
1679  @SearchParamDefinition(name="identifier", path="Location.identifier", description="Unique code or number identifying the location to its users", type="token" )
1680  public static final String SP_IDENTIFIER = "identifier";
1681 /**
1682   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1683   * <p>
1684   * Description: <b>Unique code or number identifying the location to its users</b><br>
1685   * Type: <b>token</b><br>
1686   * Path: <b>Location.identifier</b><br>
1687   * </p>
1688   */
1689  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1690
1691 /**
1692   * Search parameter: <b>address-postalcode</b>
1693   * <p>
1694   * Description: <b>A postal code specified in an address</b><br>
1695   * Type: <b>string</b><br>
1696   * Path: <b>Location.address.postalCode</b><br>
1697   * </p>
1698   */
1699  @SearchParamDefinition(name="address-postalcode", path="Location.address.postalCode", description="A postal code specified in an address", type="string" )
1700  public static final String SP_ADDRESS_POSTALCODE = "address-postalcode";
1701 /**
1702   * <b>Fluent Client</b> search parameter constant for <b>address-postalcode</b>
1703   * <p>
1704   * Description: <b>A postal code specified in an address</b><br>
1705   * Type: <b>string</b><br>
1706   * Path: <b>Location.address.postalCode</b><br>
1707   * </p>
1708   */
1709  public static final ca.uhn.fhir.rest.gclient.StringClientParam ADDRESS_POSTALCODE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_ADDRESS_POSTALCODE);
1710
1711
1712}