001package org.hl7.fhir.r5.model;
002
003
004/*
005  Copyright (c) 2011+, HL7, Inc.
006  All rights reserved.
007  
008  Redistribution and use in source and binary forms, with or without modification, \
009  are permitted provided that the following conditions are met:
010  
011   * Redistributions of source code must retain the above copyright notice, this \
012     list of conditions and the following disclaimer.
013   * Redistributions in binary form must reproduce the above copyright notice, \
014     this list of conditions and the following disclaimer in the documentation \
015     and/or other materials provided with the distribution.
016   * Neither the name of HL7 nor the names of its contributors may be used to 
017     endorse or promote products derived from this software without specific 
018     prior written permission.
019  
020  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND \
021  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED \
022  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. \
023  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, \
024  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT \
025  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR \
026  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, \
027  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \
028  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \
029  POSSIBILITY OF SUCH DAMAGE.
030  */
031
032// Generated on Tue, Dec 13, 2022 17:53+1100 for FHIR vcurrent
033
034import java.util.ArrayList;
035import java.util.Date;
036import java.util.List;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.r5.model.Enumerations.*;
039import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
040import org.hl7.fhir.exceptions.FHIRException;
041import org.hl7.fhir.instance.model.api.ICompositeType;
042import ca.uhn.fhir.model.api.annotation.ResourceDef;
043import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
044import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
045import ca.uhn.fhir.model.api.annotation.Child;
046import ca.uhn.fhir.model.api.annotation.ChildOrder;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.Block;
049
050/**
051 * The technical details of an endpoint that can be used for electronic services, such as for web services providing XDS.b, a REST endpoint for another FHIR server, or a s/Mime email address. This may include any security context information.
052 */
053@ResourceDef(name="Endpoint", profile="http://hl7.org/fhir/StructureDefinition/Endpoint")
054public class Endpoint extends DomainResource {
055
056    public enum EndpointStatus {
057        /**
058         * This endpoint is expected to be active and can be used.
059         */
060        ACTIVE, 
061        /**
062         * This endpoint is temporarily unavailable.
063         */
064        SUSPENDED, 
065        /**
066         * This endpoint has exceeded connectivity thresholds and is considered in an error state and should no longer be attempted to connect to until corrective action is taken.
067         */
068        ERROR, 
069        /**
070         * This endpoint is no longer to be used.
071         */
072        OFF, 
073        /**
074         * This instance should not have been part of this patient's medical record.
075         */
076        ENTEREDINERROR, 
077        /**
078         * added to help the parsers with the generic types
079         */
080        NULL;
081        public static EndpointStatus fromCode(String codeString) throws FHIRException {
082            if (codeString == null || "".equals(codeString))
083                return null;
084        if ("active".equals(codeString))
085          return ACTIVE;
086        if ("suspended".equals(codeString))
087          return SUSPENDED;
088        if ("error".equals(codeString))
089          return ERROR;
090        if ("off".equals(codeString))
091          return OFF;
092        if ("entered-in-error".equals(codeString))
093          return ENTEREDINERROR;
094        if (Configuration.isAcceptInvalidEnums())
095          return null;
096        else
097          throw new FHIRException("Unknown EndpointStatus code '"+codeString+"'");
098        }
099        public String toCode() {
100          switch (this) {
101            case ACTIVE: return "active";
102            case SUSPENDED: return "suspended";
103            case ERROR: return "error";
104            case OFF: return "off";
105            case ENTEREDINERROR: return "entered-in-error";
106            case NULL: return null;
107            default: return "?";
108          }
109        }
110        public String getSystem() {
111          switch (this) {
112            case ACTIVE: return "http://hl7.org/fhir/endpoint-status";
113            case SUSPENDED: return "http://hl7.org/fhir/endpoint-status";
114            case ERROR: return "http://hl7.org/fhir/endpoint-status";
115            case OFF: return "http://hl7.org/fhir/endpoint-status";
116            case ENTEREDINERROR: return "http://hl7.org/fhir/endpoint-status";
117            case NULL: return null;
118            default: return "?";
119          }
120        }
121        public String getDefinition() {
122          switch (this) {
123            case ACTIVE: return "This endpoint is expected to be active and can be used.";
124            case SUSPENDED: return "This endpoint is temporarily unavailable.";
125            case ERROR: return "This endpoint has exceeded connectivity thresholds and is considered in an error state and should no longer be attempted to connect to until corrective action is taken.";
126            case OFF: return "This endpoint is no longer to be used.";
127            case ENTEREDINERROR: return "This instance should not have been part of this patient's medical record.";
128            case NULL: return null;
129            default: return "?";
130          }
131        }
132        public String getDisplay() {
133          switch (this) {
134            case ACTIVE: return "Active";
135            case SUSPENDED: return "Suspended";
136            case ERROR: return "Error";
137            case OFF: return "Off";
138            case ENTEREDINERROR: return "Entered in error";
139            case NULL: return null;
140            default: return "?";
141          }
142        }
143    }
144
145  public static class EndpointStatusEnumFactory implements EnumFactory<EndpointStatus> {
146    public EndpointStatus fromCode(String codeString) throws IllegalArgumentException {
147      if (codeString == null || "".equals(codeString))
148            if (codeString == null || "".equals(codeString))
149                return null;
150        if ("active".equals(codeString))
151          return EndpointStatus.ACTIVE;
152        if ("suspended".equals(codeString))
153          return EndpointStatus.SUSPENDED;
154        if ("error".equals(codeString))
155          return EndpointStatus.ERROR;
156        if ("off".equals(codeString))
157          return EndpointStatus.OFF;
158        if ("entered-in-error".equals(codeString))
159          return EndpointStatus.ENTEREDINERROR;
160        throw new IllegalArgumentException("Unknown EndpointStatus code '"+codeString+"'");
161        }
162        public Enumeration<EndpointStatus> fromType(PrimitiveType<?> code) throws FHIRException {
163          if (code == null)
164            return null;
165          if (code.isEmpty())
166            return new Enumeration<EndpointStatus>(this, EndpointStatus.NULL, code);
167          String codeString = ((PrimitiveType) code).asStringValue();
168          if (codeString == null || "".equals(codeString))
169            return new Enumeration<EndpointStatus>(this, EndpointStatus.NULL, code);
170        if ("active".equals(codeString))
171          return new Enumeration<EndpointStatus>(this, EndpointStatus.ACTIVE, code);
172        if ("suspended".equals(codeString))
173          return new Enumeration<EndpointStatus>(this, EndpointStatus.SUSPENDED, code);
174        if ("error".equals(codeString))
175          return new Enumeration<EndpointStatus>(this, EndpointStatus.ERROR, code);
176        if ("off".equals(codeString))
177          return new Enumeration<EndpointStatus>(this, EndpointStatus.OFF, code);
178        if ("entered-in-error".equals(codeString))
179          return new Enumeration<EndpointStatus>(this, EndpointStatus.ENTEREDINERROR, code);
180        throw new FHIRException("Unknown EndpointStatus code '"+codeString+"'");
181        }
182    public String toCode(EndpointStatus code) {
183      if (code == EndpointStatus.ACTIVE)
184        return "active";
185      if (code == EndpointStatus.SUSPENDED)
186        return "suspended";
187      if (code == EndpointStatus.ERROR)
188        return "error";
189      if (code == EndpointStatus.OFF)
190        return "off";
191      if (code == EndpointStatus.ENTEREDINERROR)
192        return "entered-in-error";
193      return "?";
194      }
195    public String toSystem(EndpointStatus code) {
196      return code.getSystem();
197      }
198    }
199
200    /**
201     * Identifier for the organization that is used to identify the endpoint across multiple disparate systems.
202     */
203    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
204    @Description(shortDefinition="Identifies this endpoint across multiple systems", formalDefinition="Identifier for the organization that is used to identify the endpoint across multiple disparate systems." )
205    protected List<Identifier> identifier;
206
207    /**
208     * The endpoint status represents the general expected availability of an endpoint.
209     */
210    @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true)
211    @Description(shortDefinition="active | suspended | error | off | entered-in-error | test", formalDefinition="The endpoint status represents the general expected availability of an endpoint." )
212    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/endpoint-status")
213    protected Enumeration<EndpointStatus> status;
214
215    /**
216     * A coded value that represents the technical details of the usage of this endpoint, such as what WSDLs should be used in what way. (e.g. XDS.b/DICOM/cds-hook).
217     */
218    @Child(name = "connectionType", type = {CodeableConcept.class}, order=2, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
219    @Description(shortDefinition="Protocol/Profile/Standard to be used with this endpoint connection", formalDefinition="A coded value that represents the technical details of the usage of this endpoint, such as what WSDLs should be used in what way. (e.g. XDS.b/DICOM/cds-hook)." )
220    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/endpoint-connection-type")
221    protected List<CodeableConcept> connectionType;
222
223    /**
224     * A friendly name that this endpoint can be referred to with.
225     */
226    @Child(name = "name", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
227    @Description(shortDefinition="A name that this endpoint can be identified by", formalDefinition="A friendly name that this endpoint can be referred to with." )
228    protected StringType name;
229
230    /**
231     * The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).
232     */
233    @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
234    @Description(shortDefinition="Additional details about the endpoint that could be displayed as further information to identify the description beyond its name", formalDefinition="The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose)." )
235    protected StringType description;
236
237    /**
238     * The type of environment(s) exposed at this endpoint (dev, prod, test, etc).
239     */
240    @Child(name = "environmentType", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
241    @Description(shortDefinition="The type of environment(s) exposed at this endpoint", formalDefinition="The type of environment(s) exposed at this endpoint (dev, prod, test, etc)." )
242    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/endpoint-environment")
243    protected List<CodeableConcept> environmentType;
244
245    /**
246     * The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization associated with the data).
247     */
248    @Child(name = "managingOrganization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
249    @Description(shortDefinition="Organization that manages this endpoint (might not be the organization that exposes the endpoint)", formalDefinition="The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization associated with the data)." )
250    protected Reference managingOrganization;
251
252    /**
253     * Contact details for a human to contact about the endpoint. The primary use of this for system administrator troubleshooting.
254     */
255    @Child(name = "contact", type = {ContactPoint.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
256    @Description(shortDefinition="Contact details for source (e.g. troubleshooting)", formalDefinition="Contact details for a human to contact about the endpoint. The primary use of this for system administrator troubleshooting." )
257    protected List<ContactPoint> contact;
258
259    /**
260     * The interval during which the endpoint is expected to be operational.
261     */
262    @Child(name = "period", type = {Period.class}, order=8, min=0, max=1, modifier=false, summary=true)
263    @Description(shortDefinition="Interval the endpoint is expected to be operational", formalDefinition="The interval during which the endpoint is expected to be operational." )
264    protected Period period;
265
266    /**
267     * The payload type describes the acceptable content that can be communicated on the endpoint.
268     */
269    @Child(name = "payloadType", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
270    @Description(shortDefinition="The type of content that may be used at this endpoint (e.g. XDS Discharge summaries)", formalDefinition="The payload type describes the acceptable content that can be communicated on the endpoint." )
271    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/endpoint-payload-type")
272    protected List<CodeableConcept> payloadType;
273
274    /**
275     * The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).
276     */
277    @Child(name = "payloadMimeType", type = {CodeType.class}, order=10, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
278    @Description(shortDefinition="Mimetype to send. If not specified, the content could be anything (including no payload, if the connectionType defined this)", formalDefinition="The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType)." )
279    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/mimetypes")
280    protected List<CodeType> payloadMimeType;
281
282    /**
283     * The uri that describes the actual end-point to connect to.
284     */
285    @Child(name = "address", type = {UrlType.class}, order=11, min=1, max=1, modifier=false, summary=true)
286    @Description(shortDefinition="The technical base address for connecting to this endpoint", formalDefinition="The uri that describes the actual end-point to connect to." )
287    protected UrlType address;
288
289    /**
290     * Additional headers / information to send as part of the notification.
291     */
292    @Child(name = "header", type = {StringType.class}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
293    @Description(shortDefinition="Usage depends on the channel type", formalDefinition="Additional headers / information to send as part of the notification." )
294    protected List<StringType> header;
295
296    private static final long serialVersionUID = -775722791L;
297
298  /**
299   * Constructor
300   */
301    public Endpoint() {
302      super();
303    }
304
305  /**
306   * Constructor
307   */
308    public Endpoint(EndpointStatus status, CodeableConcept connectionType, String address) {
309      super();
310      this.setStatus(status);
311      this.addConnectionType(connectionType);
312      this.setAddress(address);
313    }
314
315    /**
316     * @return {@link #identifier} (Identifier for the organization that is used to identify the endpoint across multiple disparate systems.)
317     */
318    public List<Identifier> getIdentifier() { 
319      if (this.identifier == null)
320        this.identifier = new ArrayList<Identifier>();
321      return this.identifier;
322    }
323
324    /**
325     * @return Returns a reference to <code>this</code> for easy method chaining
326     */
327    public Endpoint setIdentifier(List<Identifier> theIdentifier) { 
328      this.identifier = theIdentifier;
329      return this;
330    }
331
332    public boolean hasIdentifier() { 
333      if (this.identifier == null)
334        return false;
335      for (Identifier item : this.identifier)
336        if (!item.isEmpty())
337          return true;
338      return false;
339    }
340
341    public Identifier addIdentifier() { //3
342      Identifier t = new Identifier();
343      if (this.identifier == null)
344        this.identifier = new ArrayList<Identifier>();
345      this.identifier.add(t);
346      return t;
347    }
348
349    public Endpoint addIdentifier(Identifier t) { //3
350      if (t == null)
351        return this;
352      if (this.identifier == null)
353        this.identifier = new ArrayList<Identifier>();
354      this.identifier.add(t);
355      return this;
356    }
357
358    /**
359     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist {3}
360     */
361    public Identifier getIdentifierFirstRep() { 
362      if (getIdentifier().isEmpty()) {
363        addIdentifier();
364      }
365      return getIdentifier().get(0);
366    }
367
368    /**
369     * @return {@link #status} (The endpoint status represents the general expected availability of an endpoint.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
370     */
371    public Enumeration<EndpointStatus> getStatusElement() { 
372      if (this.status == null)
373        if (Configuration.errorOnAutoCreate())
374          throw new Error("Attempt to auto-create Endpoint.status");
375        else if (Configuration.doAutoCreate())
376          this.status = new Enumeration<EndpointStatus>(new EndpointStatusEnumFactory()); // bb
377      return this.status;
378    }
379
380    public boolean hasStatusElement() { 
381      return this.status != null && !this.status.isEmpty();
382    }
383
384    public boolean hasStatus() { 
385      return this.status != null && !this.status.isEmpty();
386    }
387
388    /**
389     * @param value {@link #status} (The endpoint status represents the general expected availability of an endpoint.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
390     */
391    public Endpoint setStatusElement(Enumeration<EndpointStatus> value) { 
392      this.status = value;
393      return this;
394    }
395
396    /**
397     * @return The endpoint status represents the general expected availability of an endpoint.
398     */
399    public EndpointStatus getStatus() { 
400      return this.status == null ? null : this.status.getValue();
401    }
402
403    /**
404     * @param value The endpoint status represents the general expected availability of an endpoint.
405     */
406    public Endpoint setStatus(EndpointStatus value) { 
407        if (this.status == null)
408          this.status = new Enumeration<EndpointStatus>(new EndpointStatusEnumFactory());
409        this.status.setValue(value);
410      return this;
411    }
412
413    /**
414     * @return {@link #connectionType} (A coded value that represents the technical details of the usage of this endpoint, such as what WSDLs should be used in what way. (e.g. XDS.b/DICOM/cds-hook).)
415     */
416    public List<CodeableConcept> getConnectionType() { 
417      if (this.connectionType == null)
418        this.connectionType = new ArrayList<CodeableConcept>();
419      return this.connectionType;
420    }
421
422    /**
423     * @return Returns a reference to <code>this</code> for easy method chaining
424     */
425    public Endpoint setConnectionType(List<CodeableConcept> theConnectionType) { 
426      this.connectionType = theConnectionType;
427      return this;
428    }
429
430    public boolean hasConnectionType() { 
431      if (this.connectionType == null)
432        return false;
433      for (CodeableConcept item : this.connectionType)
434        if (!item.isEmpty())
435          return true;
436      return false;
437    }
438
439    public CodeableConcept addConnectionType() { //3
440      CodeableConcept t = new CodeableConcept();
441      if (this.connectionType == null)
442        this.connectionType = new ArrayList<CodeableConcept>();
443      this.connectionType.add(t);
444      return t;
445    }
446
447    public Endpoint addConnectionType(CodeableConcept t) { //3
448      if (t == null)
449        return this;
450      if (this.connectionType == null)
451        this.connectionType = new ArrayList<CodeableConcept>();
452      this.connectionType.add(t);
453      return this;
454    }
455
456    /**
457     * @return The first repetition of repeating field {@link #connectionType}, creating it if it does not already exist {3}
458     */
459    public CodeableConcept getConnectionTypeFirstRep() { 
460      if (getConnectionType().isEmpty()) {
461        addConnectionType();
462      }
463      return getConnectionType().get(0);
464    }
465
466    /**
467     * @return {@link #name} (A friendly name that this endpoint can be referred to with.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
468     */
469    public StringType getNameElement() { 
470      if (this.name == null)
471        if (Configuration.errorOnAutoCreate())
472          throw new Error("Attempt to auto-create Endpoint.name");
473        else if (Configuration.doAutoCreate())
474          this.name = new StringType(); // bb
475      return this.name;
476    }
477
478    public boolean hasNameElement() { 
479      return this.name != null && !this.name.isEmpty();
480    }
481
482    public boolean hasName() { 
483      return this.name != null && !this.name.isEmpty();
484    }
485
486    /**
487     * @param value {@link #name} (A friendly name that this endpoint can be referred to with.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
488     */
489    public Endpoint setNameElement(StringType value) { 
490      this.name = value;
491      return this;
492    }
493
494    /**
495     * @return A friendly name that this endpoint can be referred to with.
496     */
497    public String getName() { 
498      return this.name == null ? null : this.name.getValue();
499    }
500
501    /**
502     * @param value A friendly name that this endpoint can be referred to with.
503     */
504    public Endpoint setName(String value) { 
505      if (Utilities.noString(value))
506        this.name = null;
507      else {
508        if (this.name == null)
509          this.name = new StringType();
510        this.name.setValue(value);
511      }
512      return this;
513    }
514
515    /**
516     * @return {@link #description} (The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
517     */
518    public StringType getDescriptionElement() { 
519      if (this.description == null)
520        if (Configuration.errorOnAutoCreate())
521          throw new Error("Attempt to auto-create Endpoint.description");
522        else if (Configuration.doAutoCreate())
523          this.description = new StringType(); // bb
524      return this.description;
525    }
526
527    public boolean hasDescriptionElement() { 
528      return this.description != null && !this.description.isEmpty();
529    }
530
531    public boolean hasDescription() { 
532      return this.description != null && !this.description.isEmpty();
533    }
534
535    /**
536     * @param value {@link #description} (The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
537     */
538    public Endpoint setDescriptionElement(StringType value) { 
539      this.description = value;
540      return this;
541    }
542
543    /**
544     * @return The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).
545     */
546    public String getDescription() { 
547      return this.description == null ? null : this.description.getValue();
548    }
549
550    /**
551     * @param value The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).
552     */
553    public Endpoint setDescription(String value) { 
554      if (Utilities.noString(value))
555        this.description = null;
556      else {
557        if (this.description == null)
558          this.description = new StringType();
559        this.description.setValue(value);
560      }
561      return this;
562    }
563
564    /**
565     * @return {@link #environmentType} (The type of environment(s) exposed at this endpoint (dev, prod, test, etc).)
566     */
567    public List<CodeableConcept> getEnvironmentType() { 
568      if (this.environmentType == null)
569        this.environmentType = new ArrayList<CodeableConcept>();
570      return this.environmentType;
571    }
572
573    /**
574     * @return Returns a reference to <code>this</code> for easy method chaining
575     */
576    public Endpoint setEnvironmentType(List<CodeableConcept> theEnvironmentType) { 
577      this.environmentType = theEnvironmentType;
578      return this;
579    }
580
581    public boolean hasEnvironmentType() { 
582      if (this.environmentType == null)
583        return false;
584      for (CodeableConcept item : this.environmentType)
585        if (!item.isEmpty())
586          return true;
587      return false;
588    }
589
590    public CodeableConcept addEnvironmentType() { //3
591      CodeableConcept t = new CodeableConcept();
592      if (this.environmentType == null)
593        this.environmentType = new ArrayList<CodeableConcept>();
594      this.environmentType.add(t);
595      return t;
596    }
597
598    public Endpoint addEnvironmentType(CodeableConcept t) { //3
599      if (t == null)
600        return this;
601      if (this.environmentType == null)
602        this.environmentType = new ArrayList<CodeableConcept>();
603      this.environmentType.add(t);
604      return this;
605    }
606
607    /**
608     * @return The first repetition of repeating field {@link #environmentType}, creating it if it does not already exist {3}
609     */
610    public CodeableConcept getEnvironmentTypeFirstRep() { 
611      if (getEnvironmentType().isEmpty()) {
612        addEnvironmentType();
613      }
614      return getEnvironmentType().get(0);
615    }
616
617    /**
618     * @return {@link #managingOrganization} (The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization associated with the data).)
619     */
620    public Reference getManagingOrganization() { 
621      if (this.managingOrganization == null)
622        if (Configuration.errorOnAutoCreate())
623          throw new Error("Attempt to auto-create Endpoint.managingOrganization");
624        else if (Configuration.doAutoCreate())
625          this.managingOrganization = new Reference(); // cc
626      return this.managingOrganization;
627    }
628
629    public boolean hasManagingOrganization() { 
630      return this.managingOrganization != null && !this.managingOrganization.isEmpty();
631    }
632
633    /**
634     * @param value {@link #managingOrganization} (The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization associated with the data).)
635     */
636    public Endpoint setManagingOrganization(Reference value) { 
637      this.managingOrganization = value;
638      return this;
639    }
640
641    /**
642     * @return {@link #contact} (Contact details for a human to contact about the endpoint. The primary use of this for system administrator troubleshooting.)
643     */
644    public List<ContactPoint> getContact() { 
645      if (this.contact == null)
646        this.contact = new ArrayList<ContactPoint>();
647      return this.contact;
648    }
649
650    /**
651     * @return Returns a reference to <code>this</code> for easy method chaining
652     */
653    public Endpoint setContact(List<ContactPoint> theContact) { 
654      this.contact = theContact;
655      return this;
656    }
657
658    public boolean hasContact() { 
659      if (this.contact == null)
660        return false;
661      for (ContactPoint item : this.contact)
662        if (!item.isEmpty())
663          return true;
664      return false;
665    }
666
667    public ContactPoint addContact() { //3
668      ContactPoint t = new ContactPoint();
669      if (this.contact == null)
670        this.contact = new ArrayList<ContactPoint>();
671      this.contact.add(t);
672      return t;
673    }
674
675    public Endpoint addContact(ContactPoint t) { //3
676      if (t == null)
677        return this;
678      if (this.contact == null)
679        this.contact = new ArrayList<ContactPoint>();
680      this.contact.add(t);
681      return this;
682    }
683
684    /**
685     * @return The first repetition of repeating field {@link #contact}, creating it if it does not already exist {3}
686     */
687    public ContactPoint getContactFirstRep() { 
688      if (getContact().isEmpty()) {
689        addContact();
690      }
691      return getContact().get(0);
692    }
693
694    /**
695     * @return {@link #period} (The interval during which the endpoint is expected to be operational.)
696     */
697    public Period getPeriod() { 
698      if (this.period == null)
699        if (Configuration.errorOnAutoCreate())
700          throw new Error("Attempt to auto-create Endpoint.period");
701        else if (Configuration.doAutoCreate())
702          this.period = new Period(); // cc
703      return this.period;
704    }
705
706    public boolean hasPeriod() { 
707      return this.period != null && !this.period.isEmpty();
708    }
709
710    /**
711     * @param value {@link #period} (The interval during which the endpoint is expected to be operational.)
712     */
713    public Endpoint setPeriod(Period value) { 
714      this.period = value;
715      return this;
716    }
717
718    /**
719     * @return {@link #payloadType} (The payload type describes the acceptable content that can be communicated on the endpoint.)
720     */
721    public List<CodeableConcept> getPayloadType() { 
722      if (this.payloadType == null)
723        this.payloadType = new ArrayList<CodeableConcept>();
724      return this.payloadType;
725    }
726
727    /**
728     * @return Returns a reference to <code>this</code> for easy method chaining
729     */
730    public Endpoint setPayloadType(List<CodeableConcept> thePayloadType) { 
731      this.payloadType = thePayloadType;
732      return this;
733    }
734
735    public boolean hasPayloadType() { 
736      if (this.payloadType == null)
737        return false;
738      for (CodeableConcept item : this.payloadType)
739        if (!item.isEmpty())
740          return true;
741      return false;
742    }
743
744    public CodeableConcept addPayloadType() { //3
745      CodeableConcept t = new CodeableConcept();
746      if (this.payloadType == null)
747        this.payloadType = new ArrayList<CodeableConcept>();
748      this.payloadType.add(t);
749      return t;
750    }
751
752    public Endpoint addPayloadType(CodeableConcept t) { //3
753      if (t == null)
754        return this;
755      if (this.payloadType == null)
756        this.payloadType = new ArrayList<CodeableConcept>();
757      this.payloadType.add(t);
758      return this;
759    }
760
761    /**
762     * @return The first repetition of repeating field {@link #payloadType}, creating it if it does not already exist {3}
763     */
764    public CodeableConcept getPayloadTypeFirstRep() { 
765      if (getPayloadType().isEmpty()) {
766        addPayloadType();
767      }
768      return getPayloadType().get(0);
769    }
770
771    /**
772     * @return {@link #payloadMimeType} (The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).)
773     */
774    public List<CodeType> getPayloadMimeType() { 
775      if (this.payloadMimeType == null)
776        this.payloadMimeType = new ArrayList<CodeType>();
777      return this.payloadMimeType;
778    }
779
780    /**
781     * @return Returns a reference to <code>this</code> for easy method chaining
782     */
783    public Endpoint setPayloadMimeType(List<CodeType> thePayloadMimeType) { 
784      this.payloadMimeType = thePayloadMimeType;
785      return this;
786    }
787
788    public boolean hasPayloadMimeType() { 
789      if (this.payloadMimeType == null)
790        return false;
791      for (CodeType item : this.payloadMimeType)
792        if (!item.isEmpty())
793          return true;
794      return false;
795    }
796
797    /**
798     * @return {@link #payloadMimeType} (The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).)
799     */
800    public CodeType addPayloadMimeTypeElement() {//2 
801      CodeType t = new CodeType();
802      if (this.payloadMimeType == null)
803        this.payloadMimeType = new ArrayList<CodeType>();
804      this.payloadMimeType.add(t);
805      return t;
806    }
807
808    /**
809     * @param value {@link #payloadMimeType} (The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).)
810     */
811    public Endpoint addPayloadMimeType(String value) { //1
812      CodeType t = new CodeType();
813      t.setValue(value);
814      if (this.payloadMimeType == null)
815        this.payloadMimeType = new ArrayList<CodeType>();
816      this.payloadMimeType.add(t);
817      return this;
818    }
819
820    /**
821     * @param value {@link #payloadMimeType} (The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).)
822     */
823    public boolean hasPayloadMimeType(String value) { 
824      if (this.payloadMimeType == null)
825        return false;
826      for (CodeType v : this.payloadMimeType)
827        if (v.getValue().equals(value)) // code
828          return true;
829      return false;
830    }
831
832    /**
833     * @return {@link #address} (The uri that describes the actual end-point to connect to.). This is the underlying object with id, value and extensions. The accessor "getAddress" gives direct access to the value
834     */
835    public UrlType getAddressElement() { 
836      if (this.address == null)
837        if (Configuration.errorOnAutoCreate())
838          throw new Error("Attempt to auto-create Endpoint.address");
839        else if (Configuration.doAutoCreate())
840          this.address = new UrlType(); // bb
841      return this.address;
842    }
843
844    public boolean hasAddressElement() { 
845      return this.address != null && !this.address.isEmpty();
846    }
847
848    public boolean hasAddress() { 
849      return this.address != null && !this.address.isEmpty();
850    }
851
852    /**
853     * @param value {@link #address} (The uri that describes the actual end-point to connect to.). This is the underlying object with id, value and extensions. The accessor "getAddress" gives direct access to the value
854     */
855    public Endpoint setAddressElement(UrlType value) { 
856      this.address = value;
857      return this;
858    }
859
860    /**
861     * @return The uri that describes the actual end-point to connect to.
862     */
863    public String getAddress() { 
864      return this.address == null ? null : this.address.getValue();
865    }
866
867    /**
868     * @param value The uri that describes the actual end-point to connect to.
869     */
870    public Endpoint setAddress(String value) { 
871        if (this.address == null)
872          this.address = new UrlType();
873        this.address.setValue(value);
874      return this;
875    }
876
877    /**
878     * @return {@link #header} (Additional headers / information to send as part of the notification.)
879     */
880    public List<StringType> getHeader() { 
881      if (this.header == null)
882        this.header = new ArrayList<StringType>();
883      return this.header;
884    }
885
886    /**
887     * @return Returns a reference to <code>this</code> for easy method chaining
888     */
889    public Endpoint setHeader(List<StringType> theHeader) { 
890      this.header = theHeader;
891      return this;
892    }
893
894    public boolean hasHeader() { 
895      if (this.header == null)
896        return false;
897      for (StringType item : this.header)
898        if (!item.isEmpty())
899          return true;
900      return false;
901    }
902
903    /**
904     * @return {@link #header} (Additional headers / information to send as part of the notification.)
905     */
906    public StringType addHeaderElement() {//2 
907      StringType t = new StringType();
908      if (this.header == null)
909        this.header = new ArrayList<StringType>();
910      this.header.add(t);
911      return t;
912    }
913
914    /**
915     * @param value {@link #header} (Additional headers / information to send as part of the notification.)
916     */
917    public Endpoint addHeader(String value) { //1
918      StringType t = new StringType();
919      t.setValue(value);
920      if (this.header == null)
921        this.header = new ArrayList<StringType>();
922      this.header.add(t);
923      return this;
924    }
925
926    /**
927     * @param value {@link #header} (Additional headers / information to send as part of the notification.)
928     */
929    public boolean hasHeader(String value) { 
930      if (this.header == null)
931        return false;
932      for (StringType v : this.header)
933        if (v.getValue().equals(value)) // string
934          return true;
935      return false;
936    }
937
938      protected void listChildren(List<Property> children) {
939        super.listChildren(children);
940        children.add(new Property("identifier", "Identifier", "Identifier for the organization that is used to identify the endpoint across multiple disparate systems.", 0, java.lang.Integer.MAX_VALUE, identifier));
941        children.add(new Property("status", "code", "The endpoint status represents the general expected availability of an endpoint.", 0, 1, status));
942        children.add(new Property("connectionType", "CodeableConcept", "A coded value that represents the technical details of the usage of this endpoint, such as what WSDLs should be used in what way. (e.g. XDS.b/DICOM/cds-hook).", 0, java.lang.Integer.MAX_VALUE, connectionType));
943        children.add(new Property("name", "string", "A friendly name that this endpoint can be referred to with.", 0, 1, name));
944        children.add(new Property("description", "string", "The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).", 0, 1, description));
945        children.add(new Property("environmentType", "CodeableConcept", "The type of environment(s) exposed at this endpoint (dev, prod, test, etc).", 0, java.lang.Integer.MAX_VALUE, environmentType));
946        children.add(new Property("managingOrganization", "Reference(Organization)", "The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization associated with the data).", 0, 1, managingOrganization));
947        children.add(new Property("contact", "ContactPoint", "Contact details for a human to contact about the endpoint. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact));
948        children.add(new Property("period", "Period", "The interval during which the endpoint is expected to be operational.", 0, 1, period));
949        children.add(new Property("payloadType", "CodeableConcept", "The payload type describes the acceptable content that can be communicated on the endpoint.", 0, java.lang.Integer.MAX_VALUE, payloadType));
950        children.add(new Property("payloadMimeType", "code", "The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).", 0, java.lang.Integer.MAX_VALUE, payloadMimeType));
951        children.add(new Property("address", "url", "The uri that describes the actual end-point to connect to.", 0, 1, address));
952        children.add(new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header));
953      }
954
955      @Override
956      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
957        switch (_hash) {
958        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "Identifier for the organization that is used to identify the endpoint across multiple disparate systems.", 0, java.lang.Integer.MAX_VALUE, identifier);
959        case -892481550: /*status*/  return new Property("status", "code", "The endpoint status represents the general expected availability of an endpoint.", 0, 1, status);
960        case 1270211384: /*connectionType*/  return new Property("connectionType", "CodeableConcept", "A coded value that represents the technical details of the usage of this endpoint, such as what WSDLs should be used in what way. (e.g. XDS.b/DICOM/cds-hook).", 0, java.lang.Integer.MAX_VALUE, connectionType);
961        case 3373707: /*name*/  return new Property("name", "string", "A friendly name that this endpoint can be referred to with.", 0, 1, name);
962        case -1724546052: /*description*/  return new Property("description", "string", "The description of the endpoint and what it is for (typically used as supplemental information in an endpoint directory describing it's usage/purpose).", 0, 1, description);
963        case 1680602093: /*environmentType*/  return new Property("environmentType", "CodeableConcept", "The type of environment(s) exposed at this endpoint (dev, prod, test, etc).", 0, java.lang.Integer.MAX_VALUE, environmentType);
964        case -2058947787: /*managingOrganization*/  return new Property("managingOrganization", "Reference(Organization)", "The organization that manages this endpoint (even if technically another organization is hosting this in the cloud, it is the organization associated with the data).", 0, 1, managingOrganization);
965        case 951526432: /*contact*/  return new Property("contact", "ContactPoint", "Contact details for a human to contact about the endpoint. The primary use of this for system administrator troubleshooting.", 0, java.lang.Integer.MAX_VALUE, contact);
966        case -991726143: /*period*/  return new Property("period", "Period", "The interval during which the endpoint is expected to be operational.", 0, 1, period);
967        case 909929960: /*payloadType*/  return new Property("payloadType", "CodeableConcept", "The payload type describes the acceptable content that can be communicated on the endpoint.", 0, java.lang.Integer.MAX_VALUE, payloadType);
968        case -1702836932: /*payloadMimeType*/  return new Property("payloadMimeType", "code", "The mime type to send the payload in - e.g. application/fhir+xml, application/fhir+json. If the mime type is not specified, then the sender could send any content (including no content depending on the connectionType).", 0, java.lang.Integer.MAX_VALUE, payloadMimeType);
969        case -1147692044: /*address*/  return new Property("address", "url", "The uri that describes the actual end-point to connect to.", 0, 1, address);
970        case -1221270899: /*header*/  return new Property("header", "string", "Additional headers / information to send as part of the notification.", 0, java.lang.Integer.MAX_VALUE, header);
971        default: return super.getNamedProperty(_hash, _name, _checkValid);
972        }
973
974      }
975
976      @Override
977      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
978        switch (hash) {
979        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
980        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EndpointStatus>
981        case 1270211384: /*connectionType*/ return this.connectionType == null ? new Base[0] : this.connectionType.toArray(new Base[this.connectionType.size()]); // CodeableConcept
982        case 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
983        case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
984        case 1680602093: /*environmentType*/ return this.environmentType == null ? new Base[0] : this.environmentType.toArray(new Base[this.environmentType.size()]); // CodeableConcept
985        case -2058947787: /*managingOrganization*/ return this.managingOrganization == null ? new Base[0] : new Base[] {this.managingOrganization}; // Reference
986        case 951526432: /*contact*/ return this.contact == null ? new Base[0] : this.contact.toArray(new Base[this.contact.size()]); // ContactPoint
987        case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
988        case 909929960: /*payloadType*/ return this.payloadType == null ? new Base[0] : this.payloadType.toArray(new Base[this.payloadType.size()]); // CodeableConcept
989        case -1702836932: /*payloadMimeType*/ return this.payloadMimeType == null ? new Base[0] : this.payloadMimeType.toArray(new Base[this.payloadMimeType.size()]); // CodeType
990        case -1147692044: /*address*/ return this.address == null ? new Base[0] : new Base[] {this.address}; // UrlType
991        case -1221270899: /*header*/ return this.header == null ? new Base[0] : this.header.toArray(new Base[this.header.size()]); // StringType
992        default: return super.getProperty(hash, name, checkValid);
993        }
994
995      }
996
997      @Override
998      public Base setProperty(int hash, String name, Base value) throws FHIRException {
999        switch (hash) {
1000        case -1618432855: // identifier
1001          this.getIdentifier().add(TypeConvertor.castToIdentifier(value)); // Identifier
1002          return value;
1003        case -892481550: // status
1004          value = new EndpointStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1005          this.status = (Enumeration) value; // Enumeration<EndpointStatus>
1006          return value;
1007        case 1270211384: // connectionType
1008          this.getConnectionType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1009          return value;
1010        case 3373707: // name
1011          this.name = TypeConvertor.castToString(value); // StringType
1012          return value;
1013        case -1724546052: // description
1014          this.description = TypeConvertor.castToString(value); // StringType
1015          return value;
1016        case 1680602093: // environmentType
1017          this.getEnvironmentType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1018          return value;
1019        case -2058947787: // managingOrganization
1020          this.managingOrganization = TypeConvertor.castToReference(value); // Reference
1021          return value;
1022        case 951526432: // contact
1023          this.getContact().add(TypeConvertor.castToContactPoint(value)); // ContactPoint
1024          return value;
1025        case -991726143: // period
1026          this.period = TypeConvertor.castToPeriod(value); // Period
1027          return value;
1028        case 909929960: // payloadType
1029          this.getPayloadType().add(TypeConvertor.castToCodeableConcept(value)); // CodeableConcept
1030          return value;
1031        case -1702836932: // payloadMimeType
1032          this.getPayloadMimeType().add(TypeConvertor.castToCode(value)); // CodeType
1033          return value;
1034        case -1147692044: // address
1035          this.address = TypeConvertor.castToUrl(value); // UrlType
1036          return value;
1037        case -1221270899: // header
1038          this.getHeader().add(TypeConvertor.castToString(value)); // StringType
1039          return value;
1040        default: return super.setProperty(hash, name, value);
1041        }
1042
1043      }
1044
1045      @Override
1046      public Base setProperty(String name, Base value) throws FHIRException {
1047        if (name.equals("identifier")) {
1048          this.getIdentifier().add(TypeConvertor.castToIdentifier(value));
1049        } else if (name.equals("status")) {
1050          value = new EndpointStatusEnumFactory().fromType(TypeConvertor.castToCode(value));
1051          this.status = (Enumeration) value; // Enumeration<EndpointStatus>
1052        } else if (name.equals("connectionType")) {
1053          this.getConnectionType().add(TypeConvertor.castToCodeableConcept(value));
1054        } else if (name.equals("name")) {
1055          this.name = TypeConvertor.castToString(value); // StringType
1056        } else if (name.equals("description")) {
1057          this.description = TypeConvertor.castToString(value); // StringType
1058        } else if (name.equals("environmentType")) {
1059          this.getEnvironmentType().add(TypeConvertor.castToCodeableConcept(value));
1060        } else if (name.equals("managingOrganization")) {
1061          this.managingOrganization = TypeConvertor.castToReference(value); // Reference
1062        } else if (name.equals("contact")) {
1063          this.getContact().add(TypeConvertor.castToContactPoint(value));
1064        } else if (name.equals("period")) {
1065          this.period = TypeConvertor.castToPeriod(value); // Period
1066        } else if (name.equals("payloadType")) {
1067          this.getPayloadType().add(TypeConvertor.castToCodeableConcept(value));
1068        } else if (name.equals("payloadMimeType")) {
1069          this.getPayloadMimeType().add(TypeConvertor.castToCode(value));
1070        } else if (name.equals("address")) {
1071          this.address = TypeConvertor.castToUrl(value); // UrlType
1072        } else if (name.equals("header")) {
1073          this.getHeader().add(TypeConvertor.castToString(value));
1074        } else
1075          return super.setProperty(name, value);
1076        return value;
1077      }
1078
1079      @Override
1080      public Base makeProperty(int hash, String name) throws FHIRException {
1081        switch (hash) {
1082        case -1618432855:  return addIdentifier(); 
1083        case -892481550:  return getStatusElement();
1084        case 1270211384:  return addConnectionType(); 
1085        case 3373707:  return getNameElement();
1086        case -1724546052:  return getDescriptionElement();
1087        case 1680602093:  return addEnvironmentType(); 
1088        case -2058947787:  return getManagingOrganization();
1089        case 951526432:  return addContact(); 
1090        case -991726143:  return getPeriod();
1091        case 909929960:  return addPayloadType(); 
1092        case -1702836932:  return addPayloadMimeTypeElement();
1093        case -1147692044:  return getAddressElement();
1094        case -1221270899:  return addHeaderElement();
1095        default: return super.makeProperty(hash, name);
1096        }
1097
1098      }
1099
1100      @Override
1101      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1102        switch (hash) {
1103        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
1104        case -892481550: /*status*/ return new String[] {"code"};
1105        case 1270211384: /*connectionType*/ return new String[] {"CodeableConcept"};
1106        case 3373707: /*name*/ return new String[] {"string"};
1107        case -1724546052: /*description*/ return new String[] {"string"};
1108        case 1680602093: /*environmentType*/ return new String[] {"CodeableConcept"};
1109        case -2058947787: /*managingOrganization*/ return new String[] {"Reference"};
1110        case 951526432: /*contact*/ return new String[] {"ContactPoint"};
1111        case -991726143: /*period*/ return new String[] {"Period"};
1112        case 909929960: /*payloadType*/ return new String[] {"CodeableConcept"};
1113        case -1702836932: /*payloadMimeType*/ return new String[] {"code"};
1114        case -1147692044: /*address*/ return new String[] {"url"};
1115        case -1221270899: /*header*/ return new String[] {"string"};
1116        default: return super.getTypesForProperty(hash, name);
1117        }
1118
1119      }
1120
1121      @Override
1122      public Base addChild(String name) throws FHIRException {
1123        if (name.equals("identifier")) {
1124          return addIdentifier();
1125        }
1126        else if (name.equals("status")) {
1127          throw new FHIRException("Cannot call addChild on a primitive type Endpoint.status");
1128        }
1129        else if (name.equals("connectionType")) {
1130          return addConnectionType();
1131        }
1132        else if (name.equals("name")) {
1133          throw new FHIRException("Cannot call addChild on a primitive type Endpoint.name");
1134        }
1135        else if (name.equals("description")) {
1136          throw new FHIRException("Cannot call addChild on a primitive type Endpoint.description");
1137        }
1138        else if (name.equals("environmentType")) {
1139          return addEnvironmentType();
1140        }
1141        else if (name.equals("managingOrganization")) {
1142          this.managingOrganization = new Reference();
1143          return this.managingOrganization;
1144        }
1145        else if (name.equals("contact")) {
1146          return addContact();
1147        }
1148        else if (name.equals("period")) {
1149          this.period = new Period();
1150          return this.period;
1151        }
1152        else if (name.equals("payloadType")) {
1153          return addPayloadType();
1154        }
1155        else if (name.equals("payloadMimeType")) {
1156          throw new FHIRException("Cannot call addChild on a primitive type Endpoint.payloadMimeType");
1157        }
1158        else if (name.equals("address")) {
1159          throw new FHIRException("Cannot call addChild on a primitive type Endpoint.address");
1160        }
1161        else if (name.equals("header")) {
1162          throw new FHIRException("Cannot call addChild on a primitive type Endpoint.header");
1163        }
1164        else
1165          return super.addChild(name);
1166      }
1167
1168  public String fhirType() {
1169    return "Endpoint";
1170
1171  }
1172
1173      public Endpoint copy() {
1174        Endpoint dst = new Endpoint();
1175        copyValues(dst);
1176        return dst;
1177      }
1178
1179      public void copyValues(Endpoint dst) {
1180        super.copyValues(dst);
1181        if (identifier != null) {
1182          dst.identifier = new ArrayList<Identifier>();
1183          for (Identifier i : identifier)
1184            dst.identifier.add(i.copy());
1185        };
1186        dst.status = status == null ? null : status.copy();
1187        if (connectionType != null) {
1188          dst.connectionType = new ArrayList<CodeableConcept>();
1189          for (CodeableConcept i : connectionType)
1190            dst.connectionType.add(i.copy());
1191        };
1192        dst.name = name == null ? null : name.copy();
1193        dst.description = description == null ? null : description.copy();
1194        if (environmentType != null) {
1195          dst.environmentType = new ArrayList<CodeableConcept>();
1196          for (CodeableConcept i : environmentType)
1197            dst.environmentType.add(i.copy());
1198        };
1199        dst.managingOrganization = managingOrganization == null ? null : managingOrganization.copy();
1200        if (contact != null) {
1201          dst.contact = new ArrayList<ContactPoint>();
1202          for (ContactPoint i : contact)
1203            dst.contact.add(i.copy());
1204        };
1205        dst.period = period == null ? null : period.copy();
1206        if (payloadType != null) {
1207          dst.payloadType = new ArrayList<CodeableConcept>();
1208          for (CodeableConcept i : payloadType)
1209            dst.payloadType.add(i.copy());
1210        };
1211        if (payloadMimeType != null) {
1212          dst.payloadMimeType = new ArrayList<CodeType>();
1213          for (CodeType i : payloadMimeType)
1214            dst.payloadMimeType.add(i.copy());
1215        };
1216        dst.address = address == null ? null : address.copy();
1217        if (header != null) {
1218          dst.header = new ArrayList<StringType>();
1219          for (StringType i : header)
1220            dst.header.add(i.copy());
1221        };
1222      }
1223
1224      protected Endpoint typedCopy() {
1225        return copy();
1226      }
1227
1228      @Override
1229      public boolean equalsDeep(Base other_) {
1230        if (!super.equalsDeep(other_))
1231          return false;
1232        if (!(other_ instanceof Endpoint))
1233          return false;
1234        Endpoint o = (Endpoint) other_;
1235        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(connectionType, o.connectionType, true)
1236           && compareDeep(name, o.name, true) && compareDeep(description, o.description, true) && compareDeep(environmentType, o.environmentType, true)
1237           && compareDeep(managingOrganization, o.managingOrganization, true) && compareDeep(contact, o.contact, true)
1238           && compareDeep(period, o.period, true) && compareDeep(payloadType, o.payloadType, true) && compareDeep(payloadMimeType, o.payloadMimeType, true)
1239           && compareDeep(address, o.address, true) && compareDeep(header, o.header, true);
1240      }
1241
1242      @Override
1243      public boolean equalsShallow(Base other_) {
1244        if (!super.equalsShallow(other_))
1245          return false;
1246        if (!(other_ instanceof Endpoint))
1247          return false;
1248        Endpoint o = (Endpoint) other_;
1249        return compareValues(status, o.status, true) && compareValues(name, o.name, true) && compareValues(description, o.description, true)
1250           && compareValues(payloadMimeType, o.payloadMimeType, true) && compareValues(address, o.address, true)
1251           && compareValues(header, o.header, true);
1252      }
1253
1254      public boolean isEmpty() {
1255        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, connectionType
1256          , name, description, environmentType, managingOrganization, contact, period, payloadType
1257          , payloadMimeType, address, header);
1258      }
1259
1260  @Override
1261  public ResourceType getResourceType() {
1262    return ResourceType.Endpoint;
1263   }
1264
1265 /**
1266   * Search parameter: <b>connection-type</b>
1267   * <p>
1268   * Description: <b>Protocol/Profile/Standard to be used with this endpoint connection</b><br>
1269   * Type: <b>token</b><br>
1270   * Path: <b>Endpoint.connectionType</b><br>
1271   * </p>
1272   */
1273  @SearchParamDefinition(name="connection-type", path="Endpoint.connectionType", description="Protocol/Profile/Standard to be used with this endpoint connection", type="token" )
1274  public static final String SP_CONNECTION_TYPE = "connection-type";
1275 /**
1276   * <b>Fluent Client</b> search parameter constant for <b>connection-type</b>
1277   * <p>
1278   * Description: <b>Protocol/Profile/Standard to be used with this endpoint connection</b><br>
1279   * Type: <b>token</b><br>
1280   * Path: <b>Endpoint.connectionType</b><br>
1281   * </p>
1282   */
1283  public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONNECTION_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONNECTION_TYPE);
1284
1285 /**
1286   * Search parameter: <b>identifier</b>
1287   * <p>
1288   * Description: <b>Identifies this endpoint across multiple systems</b><br>
1289   * Type: <b>token</b><br>
1290   * Path: <b>Endpoint.identifier</b><br>
1291   * </p>
1292   */
1293  @SearchParamDefinition(name="identifier", path="Endpoint.identifier", description="Identifies this endpoint across multiple systems", type="token" )
1294  public static final String SP_IDENTIFIER = "identifier";
1295 /**
1296   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
1297   * <p>
1298   * Description: <b>Identifies this endpoint across multiple systems</b><br>
1299   * Type: <b>token</b><br>
1300   * Path: <b>Endpoint.identifier</b><br>
1301   * </p>
1302   */
1303  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
1304
1305 /**
1306   * Search parameter: <b>name</b>
1307   * <p>
1308   * Description: <b>A name that this endpoint can be identified by</b><br>
1309   * Type: <b>string</b><br>
1310   * Path: <b>Endpoint.name</b><br>
1311   * </p>
1312   */
1313  @SearchParamDefinition(name="name", path="Endpoint.name", description="A name that this endpoint can be identified by", type="string" )
1314  public static final String SP_NAME = "name";
1315 /**
1316   * <b>Fluent Client</b> search parameter constant for <b>name</b>
1317   * <p>
1318   * Description: <b>A name that this endpoint can be identified by</b><br>
1319   * Type: <b>string</b><br>
1320   * Path: <b>Endpoint.name</b><br>
1321   * </p>
1322   */
1323  public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
1324
1325 /**
1326   * Search parameter: <b>organization</b>
1327   * <p>
1328   * Description: <b>The organization that is managing the endpoint</b><br>
1329   * Type: <b>reference</b><br>
1330   * Path: <b>Endpoint.managingOrganization</b><br>
1331   * </p>
1332   */
1333  @SearchParamDefinition(name="organization", path="Endpoint.managingOrganization", description="The organization that is managing the endpoint", type="reference", target={Organization.class } )
1334  public static final String SP_ORGANIZATION = "organization";
1335 /**
1336   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
1337   * <p>
1338   * Description: <b>The organization that is managing the endpoint</b><br>
1339   * Type: <b>reference</b><br>
1340   * Path: <b>Endpoint.managingOrganization</b><br>
1341   * </p>
1342   */
1343  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
1344
1345/**
1346   * Constant for fluent queries to be used to add include statements. Specifies
1347   * the path value of "<b>Endpoint:organization</b>".
1348   */
1349  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("Endpoint:organization").toLocked();
1350
1351 /**
1352   * Search parameter: <b>payload-type</b>
1353   * <p>
1354   * Description: <b>The type of content that may be used at this endpoint (e.g. XDS Discharge summaries)</b><br>
1355   * Type: <b>token</b><br>
1356   * Path: <b>Endpoint.payloadType</b><br>
1357   * </p>
1358   */
1359  @SearchParamDefinition(name="payload-type", path="Endpoint.payloadType", description="The type of content that may be used at this endpoint (e.g. XDS Discharge summaries)", type="token" )
1360  public static final String SP_PAYLOAD_TYPE = "payload-type";
1361 /**
1362   * <b>Fluent Client</b> search parameter constant for <b>payload-type</b>
1363   * <p>
1364   * Description: <b>The type of content that may be used at this endpoint (e.g. XDS Discharge summaries)</b><br>
1365   * Type: <b>token</b><br>
1366   * Path: <b>Endpoint.payloadType</b><br>
1367   * </p>
1368   */
1369  public static final ca.uhn.fhir.rest.gclient.TokenClientParam PAYLOAD_TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PAYLOAD_TYPE);
1370
1371 /**
1372   * Search parameter: <b>status</b>
1373   * <p>
1374   * Description: <b>The current status of the Endpoint (usually expected to be active)</b><br>
1375   * Type: <b>token</b><br>
1376   * Path: <b>Endpoint.status</b><br>
1377   * </p>
1378   */
1379  @SearchParamDefinition(name="status", path="Endpoint.status", description="The current status of the Endpoint (usually expected to be active)", type="token" )
1380  public static final String SP_STATUS = "status";
1381 /**
1382   * <b>Fluent Client</b> search parameter constant for <b>status</b>
1383   * <p>
1384   * Description: <b>The current status of the Endpoint (usually expected to be active)</b><br>
1385   * Type: <b>token</b><br>
1386   * Path: <b>Endpoint.status</b><br>
1387   * </p>
1388   */
1389  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
1390
1391
1392}