com.ibm.fhir.model.resource.CatalogEntry 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.Maturity;
import com.ibm.fhir.model.annotation.ReferenceTarget;
import com.ibm.fhir.model.annotation.Required;
import com.ibm.fhir.model.annotation.Summary;
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.DateTime;
import com.ibm.fhir.model.type.Extension;
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.Period;
import com.ibm.fhir.model.type.Reference;
import com.ibm.fhir.model.type.Uri;
import com.ibm.fhir.model.type.code.BindingStrength;
import com.ibm.fhir.model.type.code.CatalogEntryRelationType;
import com.ibm.fhir.model.type.code.PublicationStatus;
import com.ibm.fhir.model.type.code.StandardsStatus;
import com.ibm.fhir.model.util.ValidationSupport;
import com.ibm.fhir.model.visitor.Visitor;
/**
* Catalog entries are wrappers that contextualize items included in a catalog.
*
* Maturity level: FMM0 (Trial Use)
*/
@Maturity(
level = 0,
status = StandardsStatus.Value.TRIAL_USE
)
@Generated("com.ibm.fhir.tools.CodeGenerator")
public class CatalogEntry extends DomainResource {
@Summary
private final List identifier;
private final CodeableConcept type;
@Summary
@Required
private final Boolean orderable;
@Summary
@ReferenceTarget({ "Medication", "Device", "Organization", "Practitioner", "PractitionerRole", "HealthcareService", "ActivityDefinition", "PlanDefinition", "SpecimenDefinition", "ObservationDefinition", "Binary" })
@Required
private final Reference referencedItem;
private final List additionalIdentifier;
private final List classification;
@Binding(
bindingName = "PublicationStatus",
strength = BindingStrength.Value.REQUIRED,
description = "The lifecycle status of an artifact.",
valueSet = "http://hl7.org/fhir/ValueSet/publication-status|4.0.1"
)
private final PublicationStatus status;
private final Period validityPeriod;
private final DateTime validTo;
private final DateTime lastUpdated;
private final List additionalCharacteristic;
private final List additionalClassification;
private final List relatedEntry;
private CatalogEntry(Builder builder) {
super(builder);
identifier = Collections.unmodifiableList(builder.identifier);
type = builder.type;
orderable = builder.orderable;
referencedItem = builder.referencedItem;
additionalIdentifier = Collections.unmodifiableList(builder.additionalIdentifier);
classification = Collections.unmodifiableList(builder.classification);
status = builder.status;
validityPeriod = builder.validityPeriod;
validTo = builder.validTo;
lastUpdated = builder.lastUpdated;
additionalCharacteristic = Collections.unmodifiableList(builder.additionalCharacteristic);
additionalClassification = Collections.unmodifiableList(builder.additionalClassification);
relatedEntry = Collections.unmodifiableList(builder.relatedEntry);
}
/**
* Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.
*
* @return
* An unmodifiable list containing immutable objects of type {@link Identifier} that may be empty.
*/
public List getIdentifier() {
return identifier;
}
/**
* The type of item - medication, device, service, protocol or other.
*
* @return
* An immutable object of type {@link CodeableConcept} that may be null.
*/
public CodeableConcept getType() {
return type;
}
/**
* Whether the entry represents an orderable item.
*
* @return
* An immutable object of type {@link Boolean} that is non-null.
*/
public Boolean getOrderable() {
return orderable;
}
/**
* The item in a catalog or definition.
*
* @return
* An immutable object of type {@link Reference} that is non-null.
*/
public Reference getReferencedItem() {
return referencedItem;
}
/**
* Used in supporting related concepts, e.g. NDC to RxNorm.
*
* @return
* An unmodifiable list containing immutable objects of type {@link Identifier} that may be empty.
*/
public List getAdditionalIdentifier() {
return additionalIdentifier;
}
/**
* Classes of devices, or ATC for medication.
*
* @return
* An unmodifiable list containing immutable objects of type {@link CodeableConcept} that may be empty.
*/
public List getClassification() {
return classification;
}
/**
* Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not
* prescribable.
*
* @return
* An immutable object of type {@link PublicationStatus} that may be null.
*/
public PublicationStatus getStatus() {
return status;
}
/**
* The time period in which this catalog entry is expected to be active.
*
* @return
* An immutable object of type {@link Period} that may be null.
*/
public Period getValidityPeriod() {
return validityPeriod;
}
/**
* The date until which this catalog entry is expected to be active.
*
* @return
* An immutable object of type {@link DateTime} that may be null.
*/
public DateTime getValidTo() {
return validTo;
}
/**
* Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last
* updated.
*
* @return
* An immutable object of type {@link DateTime} that may be null.
*/
public DateTime getLastUpdated() {
return lastUpdated;
}
/**
* Used for examplefor Out of Formulary, or any specifics.
*
* @return
* An unmodifiable list containing immutable objects of type {@link CodeableConcept} that may be empty.
*/
public List getAdditionalCharacteristic() {
return additionalCharacteristic;
}
/**
* User for example for ATC classification, or.
*
* @return
* An unmodifiable list containing immutable objects of type {@link CodeableConcept} that may be empty.
*/
public List getAdditionalClassification() {
return additionalClassification;
}
/**
* Used for example, to point to a substance, or to a device used to administer a medication.
*
* @return
* An unmodifiable list containing immutable objects of type {@link RelatedEntry} that may be empty.
*/
public List getRelatedEntry() {
return relatedEntry;
}
@Override
public boolean hasChildren() {
return super.hasChildren() ||
!identifier.isEmpty() ||
(type != null) ||
(orderable != null) ||
(referencedItem != null) ||
!additionalIdentifier.isEmpty() ||
!classification.isEmpty() ||
(status != null) ||
(validityPeriod != null) ||
(validTo != null) ||
(lastUpdated != null) ||
!additionalCharacteristic.isEmpty() ||
!additionalClassification.isEmpty() ||
!relatedEntry.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(type, "type", visitor);
accept(orderable, "orderable", visitor);
accept(referencedItem, "referencedItem", visitor);
accept(additionalIdentifier, "additionalIdentifier", visitor, Identifier.class);
accept(classification, "classification", visitor, CodeableConcept.class);
accept(status, "status", visitor);
accept(validityPeriod, "validityPeriod", visitor);
accept(validTo, "validTo", visitor);
accept(lastUpdated, "lastUpdated", visitor);
accept(additionalCharacteristic, "additionalCharacteristic", visitor, CodeableConcept.class);
accept(additionalClassification, "additionalClassification", visitor, CodeableConcept.class);
accept(relatedEntry, "relatedEntry", visitor, RelatedEntry.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;
}
CatalogEntry other = (CatalogEntry) 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(type, other.type) &&
Objects.equals(orderable, other.orderable) &&
Objects.equals(referencedItem, other.referencedItem) &&
Objects.equals(additionalIdentifier, other.additionalIdentifier) &&
Objects.equals(classification, other.classification) &&
Objects.equals(status, other.status) &&
Objects.equals(validityPeriod, other.validityPeriod) &&
Objects.equals(validTo, other.validTo) &&
Objects.equals(lastUpdated, other.lastUpdated) &&
Objects.equals(additionalCharacteristic, other.additionalCharacteristic) &&
Objects.equals(additionalClassification, other.additionalClassification) &&
Objects.equals(relatedEntry, other.relatedEntry);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = Objects.hash(id,
meta,
implicitRules,
language,
text,
contained,
extension,
modifierExtension,
identifier,
type,
orderable,
referencedItem,
additionalIdentifier,
classification,
status,
validityPeriod,
validTo,
lastUpdated,
additionalCharacteristic,
additionalClassification,
relatedEntry);
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 CodeableConcept type;
private Boolean orderable;
private Reference referencedItem;
private List additionalIdentifier = new ArrayList<>();
private List classification = new ArrayList<>();
private PublicationStatus status;
private Period validityPeriod;
private DateTime validTo;
private DateTime lastUpdated;
private List additionalCharacteristic = new ArrayList<>();
private List additionalClassification = new ArrayList<>();
private List relatedEntry = 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);
}
/**
* Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.
*
* Adds new element(s) to the existing list
*
* @param identifier
* Unique identifier of the catalog item
*
* @return
* A reference to this Builder instance
*/
public Builder identifier(Identifier... identifier) {
for (Identifier value : identifier) {
this.identifier.add(value);
}
return this;
}
/**
* Used in supporting different identifiers for the same product, e.g. manufacturer code and retailer code.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param identifier
* Unique identifier of the catalog item
*
* @return
* A reference to this Builder instance
*/
public Builder identifier(Collection identifier) {
this.identifier = new ArrayList<>(identifier);
return this;
}
/**
* The type of item - medication, device, service, protocol or other.
*
* @param type
* The type of item - medication, device, service, protocol or other
*
* @return
* A reference to this Builder instance
*/
public Builder type(CodeableConcept type) {
this.type = type;
return this;
}
/**
* Whether the entry represents an orderable item.
*
* This element is required.
*
* @param orderable
* Whether the entry represents an orderable item
*
* @return
* A reference to this Builder instance
*/
public Builder orderable(Boolean orderable) {
this.orderable = orderable;
return this;
}
/**
* The item in a catalog or definition.
*
*
This element is required.
*
*
Allowed resource types for this reference:
*
* - {@link Medication}
* - {@link Device}
* - {@link Organization}
* - {@link Practitioner}
* - {@link PractitionerRole}
* - {@link HealthcareService}
* - {@link ActivityDefinition}
* - {@link PlanDefinition}
* - {@link SpecimenDefinition}
* - {@link ObservationDefinition}
* - {@link Binary}
*
*
* @param referencedItem
* The item that is being defined
*
* @return
* A reference to this Builder instance
*/
public Builder referencedItem(Reference referencedItem) {
this.referencedItem = referencedItem;
return this;
}
/**
* Used in supporting related concepts, e.g. NDC to RxNorm.
*
* Adds new element(s) to the existing list
*
* @param additionalIdentifier
* Any additional identifier(s) for the catalog item, in the same granularity or concept
*
* @return
* A reference to this Builder instance
*/
public Builder additionalIdentifier(Identifier... additionalIdentifier) {
for (Identifier value : additionalIdentifier) {
this.additionalIdentifier.add(value);
}
return this;
}
/**
* Used in supporting related concepts, e.g. NDC to RxNorm.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param additionalIdentifier
* Any additional identifier(s) for the catalog item, in the same granularity or concept
*
* @return
* A reference to this Builder instance
*/
public Builder additionalIdentifier(Collection additionalIdentifier) {
this.additionalIdentifier = new ArrayList<>(additionalIdentifier);
return this;
}
/**
* Classes of devices, or ATC for medication.
*
* Adds new element(s) to the existing list
*
* @param classification
* Classification (category or class) of the item entry
*
* @return
* A reference to this Builder instance
*/
public Builder classification(CodeableConcept... classification) {
for (CodeableConcept value : classification) {
this.classification.add(value);
}
return this;
}
/**
* Classes of devices, or ATC for medication.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param classification
* Classification (category or class) of the item entry
*
* @return
* A reference to this Builder instance
*/
public Builder classification(Collection classification) {
this.classification = new ArrayList<>(classification);
return this;
}
/**
* Used to support catalog exchange even for unsupported products, e.g. getting list of medications even if not
* prescribable.
*
* @param status
* draft | active | retired | unknown
*
* @return
* A reference to this Builder instance
*/
public Builder status(PublicationStatus status) {
this.status = status;
return this;
}
/**
* The time period in which this catalog entry is expected to be active.
*
* @param validityPeriod
* The time period in which this catalog entry is expected to be active
*
* @return
* A reference to this Builder instance
*/
public Builder validityPeriod(Period validityPeriod) {
this.validityPeriod = validityPeriod;
return this;
}
/**
* The date until which this catalog entry is expected to be active.
*
* @param validTo
* The date until which this catalog entry is expected to be active
*
* @return
* A reference to this Builder instance
*/
public Builder validTo(DateTime validTo) {
this.validTo = validTo;
return this;
}
/**
* Typically date of issue is different from the beginning of the validity. This can be used to see when an item was last
* updated.
*
* @param lastUpdated
* When was this catalog last updated
*
* @return
* A reference to this Builder instance
*/
public Builder lastUpdated(DateTime lastUpdated) {
this.lastUpdated = lastUpdated;
return this;
}
/**
* Used for examplefor Out of Formulary, or any specifics.
*
* Adds new element(s) to the existing list
*
* @param additionalCharacteristic
* Additional characteristics of the catalog entry
*
* @return
* A reference to this Builder instance
*/
public Builder additionalCharacteristic(CodeableConcept... additionalCharacteristic) {
for (CodeableConcept value : additionalCharacteristic) {
this.additionalCharacteristic.add(value);
}
return this;
}
/**
* Used for examplefor Out of Formulary, or any specifics.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param additionalCharacteristic
* Additional characteristics of the catalog entry
*
* @return
* A reference to this Builder instance
*/
public Builder additionalCharacteristic(Collection additionalCharacteristic) {
this.additionalCharacteristic = new ArrayList<>(additionalCharacteristic);
return this;
}
/**
* User for example for ATC classification, or.
*
* Adds new element(s) to the existing list
*
* @param additionalClassification
* Additional classification of the catalog entry
*
* @return
* A reference to this Builder instance
*/
public Builder additionalClassification(CodeableConcept... additionalClassification) {
for (CodeableConcept value : additionalClassification) {
this.additionalClassification.add(value);
}
return this;
}
/**
* User for example for ATC classification, or.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param additionalClassification
* Additional classification of the catalog entry
*
* @return
* A reference to this Builder instance
*/
public Builder additionalClassification(Collection additionalClassification) {
this.additionalClassification = new ArrayList<>(additionalClassification);
return this;
}
/**
* Used for example, to point to a substance, or to a device used to administer a medication.
*
* Adds new element(s) to the existing list
*
* @param relatedEntry
* An item that this catalog entry is related to
*
* @return
* A reference to this Builder instance
*/
public Builder relatedEntry(RelatedEntry... relatedEntry) {
for (RelatedEntry value : relatedEntry) {
this.relatedEntry.add(value);
}
return this;
}
/**
* Used for example, to point to a substance, or to a device used to administer a medication.
*
*
Replaces the existing list with a new one containing elements from the Collection
*
* @param relatedEntry
* An item that this catalog entry is related to
*
* @return
* A reference to this Builder instance
*/
public Builder relatedEntry(Collection relatedEntry) {
this.relatedEntry = new ArrayList<>(relatedEntry);
return this;
}
/**
* Build the {@link CatalogEntry}
*
* Required elements:
*
* - orderable
* - referencedItem
*
*
* @return
* An immutable object of type {@link CatalogEntry}
* @throws IllegalStateException
* if the current state cannot be built into a valid CatalogEntry per the base specification
*/
@Override
public CatalogEntry build() {
CatalogEntry catalogEntry = new CatalogEntry(this);
if (validating) {
validate(catalogEntry);
}
return catalogEntry;
}
protected void validate(CatalogEntry catalogEntry) {
super.validate(catalogEntry);
ValidationSupport.checkList(catalogEntry.identifier, "identifier", Identifier.class);
ValidationSupport.requireNonNull(catalogEntry.orderable, "orderable");
ValidationSupport.requireNonNull(catalogEntry.referencedItem, "referencedItem");
ValidationSupport.checkList(catalogEntry.additionalIdentifier, "additionalIdentifier", Identifier.class);
ValidationSupport.checkList(catalogEntry.classification, "classification", CodeableConcept.class);
ValidationSupport.checkList(catalogEntry.additionalCharacteristic, "additionalCharacteristic", CodeableConcept.class);
ValidationSupport.checkList(catalogEntry.additionalClassification, "additionalClassification", CodeableConcept.class);
ValidationSupport.checkList(catalogEntry.relatedEntry, "relatedEntry", RelatedEntry.class);
ValidationSupport.checkReferenceType(catalogEntry.referencedItem, "referencedItem", "Medication", "Device", "Organization", "Practitioner", "PractitionerRole", "HealthcareService", "ActivityDefinition", "PlanDefinition", "SpecimenDefinition", "ObservationDefinition", "Binary");
}
protected Builder from(CatalogEntry catalogEntry) {
super.from(catalogEntry);
identifier.addAll(catalogEntry.identifier);
type = catalogEntry.type;
orderable = catalogEntry.orderable;
referencedItem = catalogEntry.referencedItem;
additionalIdentifier.addAll(catalogEntry.additionalIdentifier);
classification.addAll(catalogEntry.classification);
status = catalogEntry.status;
validityPeriod = catalogEntry.validityPeriod;
validTo = catalogEntry.validTo;
lastUpdated = catalogEntry.lastUpdated;
additionalCharacteristic.addAll(catalogEntry.additionalCharacteristic);
additionalClassification.addAll(catalogEntry.additionalClassification);
relatedEntry.addAll(catalogEntry.relatedEntry);
return this;
}
}
/**
* Used for example, to point to a substance, or to a device used to administer a medication.
*/
public static class RelatedEntry extends BackboneElement {
@Binding(
bindingName = "CatalogEntryRelationType",
strength = BindingStrength.Value.REQUIRED,
description = "The type of relations between entries.",
valueSet = "http://hl7.org/fhir/ValueSet/relation-type|4.0.1"
)
@Required
private final CatalogEntryRelationType relationtype;
@ReferenceTarget({ "CatalogEntry" })
@Required
private final Reference item;
private RelatedEntry(Builder builder) {
super(builder);
relationtype = builder.relationtype;
item = builder.item;
}
/**
* The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.
*
* @return
* An immutable object of type {@link CatalogEntryRelationType} that is non-null.
*/
public CatalogEntryRelationType getRelationtype() {
return relationtype;
}
/**
* The reference to the related item.
*
* @return
* An immutable object of type {@link Reference} that is non-null.
*/
public Reference getItem() {
return item;
}
@Override
public boolean hasChildren() {
return super.hasChildren() ||
(relationtype != null) ||
(item != 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(relationtype, "relationtype", visitor);
accept(item, "item", 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;
}
RelatedEntry other = (RelatedEntry) obj;
return Objects.equals(id, other.id) &&
Objects.equals(extension, other.extension) &&
Objects.equals(modifierExtension, other.modifierExtension) &&
Objects.equals(relationtype, other.relationtype) &&
Objects.equals(item, other.item);
}
@Override
public int hashCode() {
int result = hashCode;
if (result == 0) {
result = Objects.hash(id,
extension,
modifierExtension,
relationtype,
item);
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 CatalogEntryRelationType relationtype;
private Reference item;
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);
}
/**
* The type of relation to the related item: child, parent, packageContent, containerPackage, usedIn, uses, requires, etc.
*
* This element is required.
*
* @param relationtype
* triggers | is-replaced-by
*
* @return
* A reference to this Builder instance
*/
public Builder relationtype(CatalogEntryRelationType relationtype) {
this.relationtype = relationtype;
return this;
}
/**
* The reference to the related item.
*
*
This element is required.
*
*
Allowed resource types for this reference:
*
* - {@link CatalogEntry}
*
*
* @param item
* The reference to the related item
*
* @return
* A reference to this Builder instance
*/
public Builder item(Reference item) {
this.item = item;
return this;
}
/**
* Build the {@link RelatedEntry}
*
* Required elements:
*
* - relationtype
* - item
*
*
* @return
* An immutable object of type {@link RelatedEntry}
* @throws IllegalStateException
* if the current state cannot be built into a valid RelatedEntry per the base specification
*/
@Override
public RelatedEntry build() {
RelatedEntry relatedEntry = new RelatedEntry(this);
if (validating) {
validate(relatedEntry);
}
return relatedEntry;
}
protected void validate(RelatedEntry relatedEntry) {
super.validate(relatedEntry);
ValidationSupport.requireNonNull(relatedEntry.relationtype, "relationtype");
ValidationSupport.requireNonNull(relatedEntry.item, "item");
ValidationSupport.checkReferenceType(relatedEntry.item, "item", "CatalogEntry");
ValidationSupport.requireValueOrChildren(relatedEntry);
}
protected Builder from(RelatedEntry relatedEntry) {
super.from(relatedEntry);
relationtype = relatedEntry.relationtype;
item = relatedEntry.item;
return this;
}
}
}
}