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