com.ibm.fhir.model.resource.Organization Maven / Gradle / Ivy
/*
* (C) Copyright IBM Corp. 2019, 2021
*
* SPDX-License-Identifier: Apache-2.0
*/
package com.ibm.fhir.model.resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.annotation.Generated;
import com.ibm.fhir.model.annotation.Binding;
import com.ibm.fhir.model.annotation.Constraint;
import com.ibm.fhir.model.annotation.Maturity;
import com.ibm.fhir.model.annotation.ReferenceTarget;
import com.ibm.fhir.model.annotation.Summary;
import com.ibm.fhir.model.type.Address;
import com.ibm.fhir.model.type.BackboneElement;
import com.ibm.fhir.model.type.Boolean;
import com.ibm.fhir.model.type.Code;
import com.ibm.fhir.model.type.CodeableConcept;
import com.ibm.fhir.model.type.ContactPoint;
import com.ibm.fhir.model.type.Extension;
import com.ibm.fhir.model.type.HumanName;
import com.ibm.fhir.model.type.Identifier;
import com.ibm.fhir.model.type.Meta;
import com.ibm.fhir.model.type.Narrative;
import com.ibm.fhir.model.type.Reference;
import com.ibm.fhir.model.type.String;
import com.ibm.fhir.model.type.Uri;
import com.ibm.fhir.model.type.code.BindingStrength;
import com.ibm.fhir.model.type.code.StandardsStatus;
import com.ibm.fhir.model.util.ValidationSupport;
import com.ibm.fhir.model.visitor.Visitor;
/**
* A formally or informally recognized grouping of people or organizations formed for the purpose of achieving some form
* of collective action. Includes companies, institutions, corporations, departments, community groups, healthcare
* practice groups, payer/insurer, etc.
*
* Maturity level: FMM3 (Trial Use)
*/
@Maturity(
level = 3,
status = StandardsStatus.Value.TRIAL_USE
)
@Constraint(
id = "org-1",
level = "Rule",
location = "(base)",
description = "The organization SHALL at least have a name or an identifier, and possibly more than one",
expression = "(identifier.count() + name.count()) > 0"
)
@Constraint(
id = "org-2",
level = "Rule",
location = "Organization.address",
description = "An address of an organization can never be of use 'home'",
expression = "where(use = 'home').empty()"
)
@Constraint(
id = "org-3",
level = "Rule",
location = "Organization.telecom",
description = "The telecom of an organization can never be of use 'home'",
expression = "where(use = 'home').empty()"
)
@Constraint(
id = "organization-4",
level = "Warning",
location = "contact.purpose",
description = "SHALL, if possible, contain a code from value set http://hl7.org/fhir/ValueSet/contactentity-type",
expression = "$this.memberOf('http://hl7.org/fhir/ValueSet/contactentity-type', 'extensible')",
generated = true
)
@Generated("com.ibm.fhir.tools.CodeGenerator")
public class Organization extends DomainResource {
@Summary
private final List identifier;
@Summary
private final Boolean active;
@Summary
@Binding(
bindingName = "OrganizationType",
strength = BindingStrength.Value.EXAMPLE,
description = "Used to categorize the organization.",
valueSet = "http://hl7.org/fhir/ValueSet/organization-type"
)
private final List type;
@Summary
private final String name;
private final List alias;
private final List telecom;
private final List address;
@Summary
@ReferenceTarget({ "Organization" })
private final Reference partOf;
private final List contact;
@ReferenceTarget({ "Endpoint" })
private final List endpoint;
private Organization(Builder builder) {
super(builder);
identifier = Collections.unmodifiableList(builder.identifier);
active = builder.active;
type = Collections.unmodifiableList(builder.type);
name = builder.name;
alias = Collections.unmodifiableList(builder.alias);
telecom = Collections.unmodifiableList(builder.telecom);
address = Collections.unmodifiableList(builder.address);
partOf = builder.partOf;
contact = Collections.unmodifiableList(builder.contact);
endpoint = Collections.unmodifiableList(builder.endpoint);
}
/**
* Identifier for the organization that is used to identify the organization across multiple disparate systems.
*
* @return
* An unmodifiable list containing immutable objects of type {@link Identifier} that may be empty.
*/
public List getIdentifier() {
return identifier;
}
/**
* Whether the organization's record is still in active use.
*
* @return
* An immutable object of type {@link Boolean} that may be null.
*/
public Boolean getActive() {
return active;
}
/**
* The kind(s) of organization that this is.
*
* @return
* An unmodifiable list containing immutable objects of type {@link CodeableConcept} that may be empty.
*/
public List getType() {
return type;
}
/**
* A name associated with the organization.
*
* @return
* An immutable object of type {@link String} that may be null.
*/
public String getName() {
return name;
}
/**
* A list of alternate names that the organization is known as, or was known as in the past.
*
* @return
* An unmodifiable list containing immutable objects of type {@link String} that may be empty.
*/
public List getAlias() {
return alias;
}
/**
* A contact detail for the organization.
*
* @return
* An unmodifiable list containing immutable objects of type {@link ContactPoint} that may be empty.
*/
public List getTelecom() {
return telecom;
}
/**
* An address for the organization.
*
* @return
* An unmodifiable list containing immutable objects of type {@link Address} that may be empty.
*/
public List getAddress() {
return address;
}
/**
* The organization of which this organization forms a part.
*
* @return
* An immutable object of type {@link Reference} that may be null.
*/
public Reference getPartOf() {
return partOf;
}
/**
* Contact for the organization for a certain purpose.
*
* @return
* An unmodifiable list containing immutable objects of type {@link Contact} that may be empty.
*/
public List getContact() {
return contact;
}
/**
* Technical endpoints providing access to services operated for the organization.
*
* @return
* An unmodifiable list containing immutable objects of type {@link Reference} that may be empty.
*/
public List getEndpoint() {
return endpoint;
}
@Override
public boolean hasChildren() {
return super.hasChildren() ||
!identifier.isEmpty() ||
(active != null) ||
!type.isEmpty() ||
(name != null) ||
!alias.isEmpty() ||
!telecom.isEmpty() ||
!address.isEmpty() ||
(partOf != null) ||
!contact.isEmpty() ||
!endpoint.isEmpty();
}
@Override
public void accept(java.lang.String elementName, int elementIndex, Visitor visitor) {
if (visitor.preVisit(this)) {
visitor.visitStart(elementName, elementIndex, this);
if (visitor.visit(elementName, elementIndex, this)) {
// visit children
accept(id, "id", visitor);
accept(meta, "meta", visitor);
accept(implicitRules, "implicitRules", visitor);
accept(language, "language", visitor);
accept(text, "text", visitor);
accept(contained, "contained", visitor, Resource.class);
accept(extension, "extension", visitor, Extension.class);
accept(modifierExtension, "modifierExtension", visitor, Extension.class);
accept(identifier, "identifier", visitor, Identifier.class);
accept(active, "active", visitor);
accept(type, "type", visitor, CodeableConcept.class);
accept(name, "name", visitor);
accept(alias, "alias", visitor, String.class);
accept(telecom, "telecom", visitor, ContactPoint.class);
accept(address, "address", visitor, Address.class);
accept(partOf, "partOf", visitor);
accept(contact, "contact", visitor, Contact.class);
accept(endpoint, "endpoint", visitor, Reference.class);
}
visitor.visitEnd(elementName, elementIndex, this);
visitor.postVisit(this);
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Organization other = (Organization) obj;
return Objects.equals(id, other.id) &&
Objects.equals(meta, other.meta) &&
Objects.equals(implicitRules, other.implicitRules) &&
Objects.equals(language, other.language) &&
Objects.equals(text, other.text) &&
Objects.equals(contained, other.contained) &&
Objects.equals(extension, other.extension) &&
Objects.equals(modifierExtension, other.modifierExtension) &&
Objects.equals(identifier, other.identifier) &&
Objects.equals(active, other.active) &&
Objects.equals(type, other.type) &&
Objects.equals(name, other.name) &&
Objects.equals(alias, other.alias) &&
Objects.equals(telecom, other.telecom) &&
Objects.equals(address, other.address) &&
Objects.equals(partOf, other.partOf) &&
Objects.equals(contact, other.contact) &&
Objects.equals(endpoint, other.endpoint);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = Objects.hash(id,
meta,
implicitRules,
language,
text,
contained,
extension,
modifierExtension,
identifier,
active,
type,
name,
alias,
telecom,
address,
partOf,
contact,
endpoint);
hashCode = result;
}
return result;
}
@Override
public Builder toBuilder() {
return new Builder().from(this);
}
public static Builder builder() {
return new Builder();
}
public static class Builder extends DomainResource.Builder {
private List identifier = new ArrayList<>();
private Boolean active;
private List type = new ArrayList<>();
private String name;
private List alias = new ArrayList<>();
private List telecom = new ArrayList<>();
private List address = new ArrayList<>();
private Reference partOf;
private List contact = new ArrayList<>();
private List endpoint = new ArrayList<>();
private Builder() {
super();
}
/**
* The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
*
* @param id
* Logical id of this artifact
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder id(java.lang.String id) {
return (Builder) super.id(id);
}
/**
* The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content
* might not always be associated with version changes to the resource.
*
* @param meta
* Metadata about the resource
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder meta(Meta meta) {
return (Builder) super.meta(meta);
}
/**
* A reference to a set of rules that were followed when the resource was constructed, and which must be understood when
* processing the content. Often, this is a reference to an implementation guide that defines the special rules along
* with other profiles etc.
*
* @param implicitRules
* A set of rules under which this content was created
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder implicitRules(Uri implicitRules) {
return (Builder) super.implicitRules(implicitRules);
}
/**
* The base language in which the resource is written.
*
* @param language
* Language of the resource content
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder language(Code language) {
return (Builder) super.language(language);
}
/**
* A human-readable narrative that contains a summary of the resource and can be used to represent the content of the
* resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient
* detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what
* content should be represented in the narrative to ensure clinical safety.
*
* @param text
* Text summary of the resource, for human interpretation
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder text(Narrative text) {
return (Builder) super.text(text);
}
/**
* These resources do not have an independent existence apart from the resource that contains them - they cannot be
* identified independently, and nor can they have their own independent transaction scope.
*
* Adds new element(s) to the existing list
*
* @param contained
* Contained, inline Resources
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder contained(Resource... contained) {
return (Builder) super.contained(contained);
}
/**
* These resources do not have an independent existence apart from the resource that contains them - they cannot be
* identified independently, and nor can they have their own independent transaction scope.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param contained
* Contained, inline Resources
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder contained(Collection contained) {
return (Builder) super.contained(contained);
}
/**
* May be used to represent additional information that is not part of the basic definition of the resource. To make the
* use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of
* extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part
* of the definition of the extension.
*
* Adds new element(s) to the existing list
*
* @param extension
* Additional content defined by implementations
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder extension(Extension... extension) {
return (Builder) super.extension(extension);
}
/**
* May be used to represent additional information that is not part of the basic definition of the resource. To make the
* use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of
* extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part
* of the definition of the extension.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param extension
* Additional content defined by implementations
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder extension(Collection extension) {
return (Builder) super.extension(extension);
}
/**
* May be used to represent additional information that is not part of the basic definition of the resource and that
* modifies the understanding of the element that contains it and/or the understanding of the containing element's
* descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and
* manageable, there is a strict set of governance applied to the definition and use of extensions. Though any
* implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the
* definition of the extension. Applications processing a resource are required to check for modifier extensions.
*
* Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot
* change the meaning of modifierExtension itself).
*
*
Adds new element(s) to the existing list
*
* @param modifierExtension
* Extensions that cannot be ignored
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder modifierExtension(Extension... modifierExtension) {
return (Builder) super.modifierExtension(modifierExtension);
}
/**
* May be used to represent additional information that is not part of the basic definition of the resource and that
* modifies the understanding of the element that contains it and/or the understanding of the containing element's
* descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and
* manageable, there is a strict set of governance applied to the definition and use of extensions. Though any
* implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the
* definition of the extension. Applications processing a resource are required to check for modifier extensions.
*
*
Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot
* change the meaning of modifierExtension itself).
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param modifierExtension
* Extensions that cannot be ignored
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder modifierExtension(Collection modifierExtension) {
return (Builder) super.modifierExtension(modifierExtension);
}
/**
* Identifier for the organization that is used to identify the organization across multiple disparate systems.
*
* Adds new element(s) to the existing list
*
* @param identifier
* Identifies this organization across multiple systems
*
* @return
* A reference to this Builder instance
*/
public Builder identifier(Identifier... identifier) {
for (Identifier value : identifier) {
this.identifier.add(value);
}
return this;
}
/**
* Identifier for the organization that is used to identify the organization across multiple disparate systems.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param identifier
* Identifies this organization across multiple systems
*
* @return
* A reference to this Builder instance
*/
public Builder identifier(Collection identifier) {
this.identifier = new ArrayList<>(identifier);
return this;
}
/**
* Whether the organization's record is still in active use.
*
* @param active
* Whether the organization's record is still in active use
*
* @return
* A reference to this Builder instance
*/
public Builder active(Boolean active) {
this.active = active;
return this;
}
/**
* The kind(s) of organization that this is.
*
* Adds new element(s) to the existing list
*
* @param type
* Kind of organization
*
* @return
* A reference to this Builder instance
*/
public Builder type(CodeableConcept... type) {
for (CodeableConcept value : type) {
this.type.add(value);
}
return this;
}
/**
* The kind(s) of organization that this is.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param type
* Kind of organization
*
* @return
* A reference to this Builder instance
*/
public Builder type(Collection type) {
this.type = new ArrayList<>(type);
return this;
}
/**
* A name associated with the organization.
*
* @param name
* Name used for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder name(String name) {
this.name = name;
return this;
}
/**
* A list of alternate names that the organization is known as, or was known as in the past.
*
* Adds new element(s) to the existing list
*
* @param alias
* A list of alternate names that the organization is known as, or was known as in the past
*
* @return
* A reference to this Builder instance
*/
public Builder alias(String... alias) {
for (String value : alias) {
this.alias.add(value);
}
return this;
}
/**
* A list of alternate names that the organization is known as, or was known as in the past.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param alias
* A list of alternate names that the organization is known as, or was known as in the past
*
* @return
* A reference to this Builder instance
*/
public Builder alias(Collection alias) {
this.alias = new ArrayList<>(alias);
return this;
}
/**
* A contact detail for the organization.
*
* Adds new element(s) to the existing list
*
* @param telecom
* A contact detail for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder telecom(ContactPoint... telecom) {
for (ContactPoint value : telecom) {
this.telecom.add(value);
}
return this;
}
/**
* A contact detail for the organization.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param telecom
* A contact detail for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder telecom(Collection telecom) {
this.telecom = new ArrayList<>(telecom);
return this;
}
/**
* An address for the organization.
*
* Adds new element(s) to the existing list
*
* @param address
* An address for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder address(Address... address) {
for (Address value : address) {
this.address.add(value);
}
return this;
}
/**
* An address for the organization.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param address
* An address for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder address(Collection
address) {
this.address = new ArrayList<>(address);
return this;
}
/**
* The organization of which this organization forms a part.
*
* Allowed resource types for this reference:
*
* - {@link Organization}
*
*
* @param partOf
* The organization of which this organization forms a part
*
* @return
* A reference to this Builder instance
*/
public Builder partOf(Reference partOf) {
this.partOf = partOf;
return this;
}
/**
* Contact for the organization for a certain purpose.
*
* Adds new element(s) to the existing list
*
* @param contact
* Contact for the organization for a certain purpose
*
* @return
* A reference to this Builder instance
*/
public Builder contact(Contact... contact) {
for (Contact value : contact) {
this.contact.add(value);
}
return this;
}
/**
* Contact for the organization for a certain purpose.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param contact
* Contact for the organization for a certain purpose
*
* @return
* A reference to this Builder instance
*/
public Builder contact(Collection contact) {
this.contact = new ArrayList<>(contact);
return this;
}
/**
* Technical endpoints providing access to services operated for the organization.
*
* Adds new element(s) to the existing list
*
*
Allowed resource types for the references:
*
* - {@link Endpoint}
*
*
* @param endpoint
* Technical endpoints providing access to services operated for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder endpoint(Reference... endpoint) {
for (Reference value : endpoint) {
this.endpoint.add(value);
}
return this;
}
/**
* Technical endpoints providing access to services operated for the organization.
*
* Replaces the existing list with a new one containing elements from the Collection
*
*
Allowed resource types for the references:
*
* - {@link Endpoint}
*
*
* @param endpoint
* Technical endpoints providing access to services operated for the organization
*
* @return
* A reference to this Builder instance
*/
public Builder endpoint(Collection endpoint) {
this.endpoint = new ArrayList<>(endpoint);
return this;
}
/**
* Build the {@link Organization}
*
* @return
* An immutable object of type {@link Organization}
* @throws IllegalStateException
* if the current state cannot be built into a valid Organization per the base specification
*/
@Override
public Organization build() {
Organization organization = new Organization(this);
if (validating) {
validate(organization);
}
return organization;
}
protected void validate(Organization organization) {
super.validate(organization);
ValidationSupport.checkList(organization.identifier, "identifier", Identifier.class);
ValidationSupport.checkList(organization.type, "type", CodeableConcept.class);
ValidationSupport.checkList(organization.alias, "alias", String.class);
ValidationSupport.checkList(organization.telecom, "telecom", ContactPoint.class);
ValidationSupport.checkList(organization.address, "address", Address.class);
ValidationSupport.checkList(organization.contact, "contact", Contact.class);
ValidationSupport.checkList(organization.endpoint, "endpoint", Reference.class);
ValidationSupport.checkReferenceType(organization.partOf, "partOf", "Organization");
ValidationSupport.checkReferenceType(organization.endpoint, "endpoint", "Endpoint");
}
protected Builder from(Organization organization) {
super.from(organization);
identifier.addAll(organization.identifier);
active = organization.active;
type.addAll(organization.type);
name = organization.name;
alias.addAll(organization.alias);
telecom.addAll(organization.telecom);
address.addAll(organization.address);
partOf = organization.partOf;
contact.addAll(organization.contact);
endpoint.addAll(organization.endpoint);
return this;
}
}
/**
* Contact for the organization for a certain purpose.
*/
public static class Contact extends BackboneElement {
@Binding(
bindingName = "ContactPartyType",
strength = BindingStrength.Value.EXTENSIBLE,
description = "The purpose for which you would contact a contact party.",
valueSet = "http://hl7.org/fhir/ValueSet/contactentity-type"
)
private final CodeableConcept purpose;
private final HumanName name;
private final List telecom;
private final Address address;
private Contact(Builder builder) {
super(builder);
purpose = builder.purpose;
name = builder.name;
telecom = Collections.unmodifiableList(builder.telecom);
address = builder.address;
}
/**
* Indicates a purpose for which the contact can be reached.
*
* @return
* An immutable object of type {@link CodeableConcept} that may be null.
*/
public CodeableConcept getPurpose() {
return purpose;
}
/**
* A name associated with the contact.
*
* @return
* An immutable object of type {@link HumanName} that may be null.
*/
public HumanName getName() {
return name;
}
/**
* A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.
*
* @return
* An unmodifiable list containing immutable objects of type {@link ContactPoint} that may be empty.
*/
public List getTelecom() {
return telecom;
}
/**
* Visiting or postal addresses for the contact.
*
* @return
* An immutable object of type {@link Address} that may be null.
*/
public Address getAddress() {
return address;
}
@Override
public boolean hasChildren() {
return super.hasChildren() ||
(purpose != null) ||
(name != null) ||
!telecom.isEmpty() ||
(address != null);
}
@Override
public void accept(java.lang.String elementName, int elementIndex, Visitor visitor) {
if (visitor.preVisit(this)) {
visitor.visitStart(elementName, elementIndex, this);
if (visitor.visit(elementName, elementIndex, this)) {
// visit children
accept(id, "id", visitor);
accept(extension, "extension", visitor, Extension.class);
accept(modifierExtension, "modifierExtension", visitor, Extension.class);
accept(purpose, "purpose", visitor);
accept(name, "name", visitor);
accept(telecom, "telecom", visitor, ContactPoint.class);
accept(address, "address", visitor);
}
visitor.visitEnd(elementName, elementIndex, this);
visitor.postVisit(this);
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
Contact other = (Contact) obj;
return Objects.equals(id, other.id) &&
Objects.equals(extension, other.extension) &&
Objects.equals(modifierExtension, other.modifierExtension) &&
Objects.equals(purpose, other.purpose) &&
Objects.equals(name, other.name) &&
Objects.equals(telecom, other.telecom) &&
Objects.equals(address, other.address);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = Objects.hash(id,
extension,
modifierExtension,
purpose,
name,
telecom,
address);
hashCode = result;
}
return result;
}
@Override
public Builder toBuilder() {
return new Builder().from(this);
}
public static Builder builder() {
return new Builder();
}
public static class Builder extends BackboneElement.Builder {
private CodeableConcept purpose;
private HumanName name;
private List telecom = new ArrayList<>();
private Address address;
private Builder() {
super();
}
/**
* Unique id for the element within a resource (for internal references). This may be any string value that does not
* contain spaces.
*
* @param id
* Unique id for inter-element referencing
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder id(java.lang.String id) {
return (Builder) super.id(id);
}
/**
* May be used to represent additional information that is not part of the basic definition of the element. To make the
* use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of
* extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part
* of the definition of the extension.
*
* Adds new element(s) to the existing list
*
* @param extension
* Additional content defined by implementations
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder extension(Extension... extension) {
return (Builder) super.extension(extension);
}
/**
* May be used to represent additional information that is not part of the basic definition of the element. To make the
* use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of
* extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part
* of the definition of the extension.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param extension
* Additional content defined by implementations
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder extension(Collection extension) {
return (Builder) super.extension(extension);
}
/**
* May be used to represent additional information that is not part of the basic definition of the element and that
* modifies the understanding of the element in which it is contained and/or the understanding of the containing
* element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe
* and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any
* implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the
* extension. Applications processing a resource are required to check for modifier extensions.
*
* Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot
* change the meaning of modifierExtension itself).
*
*
Adds new element(s) to the existing list
*
* @param modifierExtension
* Extensions that cannot be ignored even if unrecognized
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder modifierExtension(Extension... modifierExtension) {
return (Builder) super.modifierExtension(modifierExtension);
}
/**
* May be used to represent additional information that is not part of the basic definition of the element and that
* modifies the understanding of the element in which it is contained and/or the understanding of the containing
* element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe
* and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any
* implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the
* extension. Applications processing a resource are required to check for modifier extensions.
*
*
Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot
* change the meaning of modifierExtension itself).
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param modifierExtension
* Extensions that cannot be ignored even if unrecognized
*
* @return
* A reference to this Builder instance
*/
@Override
public Builder modifierExtension(Collection modifierExtension) {
return (Builder) super.modifierExtension(modifierExtension);
}
/**
* Indicates a purpose for which the contact can be reached.
*
* @param purpose
* The type of contact
*
* @return
* A reference to this Builder instance
*/
public Builder purpose(CodeableConcept purpose) {
this.purpose = purpose;
return this;
}
/**
* A name associated with the contact.
*
* @param name
* A name associated with the contact
*
* @return
* A reference to this Builder instance
*/
public Builder name(HumanName name) {
this.name = name;
return this;
}
/**
* A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.
*
* Adds new element(s) to the existing list
*
* @param telecom
* Contact details (telephone, email, etc.) for a contact
*
* @return
* A reference to this Builder instance
*/
public Builder telecom(ContactPoint... telecom) {
for (ContactPoint value : telecom) {
this.telecom.add(value);
}
return this;
}
/**
* A contact detail (e.g. a telephone number or an email address) by which the party may be contacted.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param telecom
* Contact details (telephone, email, etc.) for a contact
*
* @return
* A reference to this Builder instance
*/
public Builder telecom(Collection telecom) {
this.telecom = new ArrayList<>(telecom);
return this;
}
/**
* Visiting or postal addresses for the contact.
*
* @param address
* Visiting or postal addresses for the contact
*
* @return
* A reference to this Builder instance
*/
public Builder address(Address address) {
this.address = address;
return this;
}
/**
* Build the {@link Contact}
*
* @return
* An immutable object of type {@link Contact}
* @throws IllegalStateException
* if the current state cannot be built into a valid Contact per the base specification
*/
@Override
public Contact build() {
Contact contact = new Contact(this);
if (validating) {
validate(contact);
}
return contact;
}
protected void validate(Contact contact) {
super.validate(contact);
ValidationSupport.checkList(contact.telecom, "telecom", ContactPoint.class);
ValidationSupport.requireValueOrChildren(contact);
}
protected Builder from(Contact contact) {
super.from(contact);
purpose = contact.purpose;
name = contact.name;
telecom.addAll(contact.telecom);
address = contact.address;
return this;
}
}
}
}