Still not working DSTU2.1

This commit is contained in:
jamesagnew 2015-12-09 22:49:02 -05:00
parent ea89f3af28
commit 0a0daedcfd
850 changed files with 367541 additions and 4067 deletions

View File

@ -51,9 +51,8 @@ public @interface ResourceDef {
String id() default "";
/**
* The URL indicating the profile for this resource definition, if known. If this value is set
* on a custom profile definition class in a server, the profile is assumed to be external to
* the server, so the server will not export a profile for it.
* The URL indicating the profile for this resource definition. If specified, this URL will be
* automatically added to the meta tag when the resource is serialized.
*/
String profile() default "";

View File

@ -0,0 +1,93 @@
package ca.uhn.fhir.rest.client;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.io.InputStream;
import java.io.StringReader;
import java.nio.charset.Charset;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.message.BasicHeader;
import org.apache.http.message.BasicStatusLine;
import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu2.resource.Parameters;
import ca.uhn.fhir.model.dstu2.resource.Patient;
import ca.uhn.fhir.model.dstu2.valueset.IssueTypeEnum;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.server.Constants;
public class ClientWithProfileDstu2Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ClientWithProfileDstu2Test.class);
private FhirContext ourCtx;
private HttpClient ourHttpClient;
private HttpResponse ourHttpResponse;
@Before
public void before() {
ourCtx = FhirContext.forDstu2();
ourHttpClient = mock(HttpClient.class, new ReturnsDeepStubs());
ourCtx.getRestfulClientFactory().setHttpClient(ourHttpClient);
ourCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.NEVER);
ourHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
}
@Test
public void testClientWithProfile() throws Exception {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setCode(IssueTypeEnum.BUSINESS_RULE_VIOLATION);
final String retVal = ourCtx.newXmlParser().encodeResourceToString(oo);
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse);
when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(ourHttpResponse.getEntity().getContent()).thenAnswer(new Answer<InputStream>() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
return new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8"));
}
});
IGenericClient client = ourCtx.newRestfulGenericClient("http://foo");
int idx = 0;
MethodOutcome response = client.create().resource(new MyPatient()).execute();
HttpPost value = (HttpPost) capt.getAllValues().get(idx);
String requestBody = IOUtils.toString(((HttpPost) value).getEntity().getContent());
IOUtils.closeQuietly(((HttpPost) value).getEntity().getContent());
ourLog.info(requestBody);
}
@ResourceDef(name = "Patient", profile = "http://foo_profile")
public static class MyPatient extends Patient {
private static final long serialVersionUID = 1L;
}
}

View File

@ -28,9 +28,6 @@ import ca.uhn.fhir.rest.annotation.IdParam;
import ca.uhn.fhir.rest.annotation.Read;
import ca.uhn.fhir.util.PortUtil;
/**
* Created by dsotnikov on 2/25/2014.
*/
public class ReadDstu2Test {
private static CloseableHttpClient ourClient;
@ -70,6 +67,8 @@ public class ReadDstu2Test {
assertEquals(200, status.getStatusLine().getStatusCode());
assertThat(responseContent, containsString("p1ReadValue"));
assertThat(responseContent, containsString("p1ReadId"));
ourLog.info(responseContent);
}
@AfterClass

View File

@ -0,0 +1,209 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.4-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-structures-hl7org-dstu2.1</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR Structures - HL7.org DSTU2.1</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.4-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
<version>1.4-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- <dependency> <groupId>net.sf.saxon</groupId> <artifactId>saxon</artifactId>
<version>8.7</version> </dependency> -->
<dependency>
<groupId>xpp3</groupId>
<artifactId>xpp3_min</artifactId>
<version>1.1.4c</version>
</dependency>
<dependency>
<groupId>net.sf.saxon</groupId>
<artifactId>Saxon-HE</artifactId>
<version>9.6.0-4</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
</dependency>
<!-- Testing -->
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<version>${ebay_cors_filter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-schematron</artifactId>
<version>${phloc_schematron_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-commons</artifactId>
<version>${phloc_commons_version}</version>
<scope>test</scope>
</dependency>
<!-- UNIT TEST DEPENDENCIES -->
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.4</version>
<classifier>jdk15-sources</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>directory-naming</groupId>
<artifactId>naming-java</artifactId>
<version>0.8</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<show>public</show>
</configuration>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19</version>
<configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<runOrder>random</runOrder>
<argLine>-Dfile.encoding=UTF-8</argLine>
<reuseForks>false</reuseForks>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<configuration>
<!-- Don't add UHN licenses to RI structures -->
<skipUpdateLicense>true</skipUpdateLicense>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,797 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A financial tool for tracking value accrued for a particular purpose. In the healthcare field, used to track charges for a patient, cost centres, etc.
*/
@ResourceDef(name="Account", profile="http://hl7.org/fhir/Profile/Account")
public class Account extends DomainResource {
public enum AccountStatus {
/**
* This account is active and may be used.
*/
ACTIVE,
/**
* This account is inactive and should not be used to track financial information.
*/
INACTIVE,
/**
* added to help the parsers
*/
NULL;
public static AccountStatus fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("active".equals(codeString))
return ACTIVE;
if ("inactive".equals(codeString))
return INACTIVE;
throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case ACTIVE: return "active";
case INACTIVE: return "inactive";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case ACTIVE: return "http://hl7.org/fhir/account-status";
case INACTIVE: return "http://hl7.org/fhir/account-status";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case ACTIVE: return "This account is active and may be used.";
case INACTIVE: return "This account is inactive and should not be used to track financial information.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case ACTIVE: return "Active";
case INACTIVE: return "Inactive";
default: return "?";
}
}
}
public static class AccountStatusEnumFactory implements EnumFactory<AccountStatus> {
public AccountStatus fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("active".equals(codeString))
return AccountStatus.ACTIVE;
if ("inactive".equals(codeString))
return AccountStatus.INACTIVE;
throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'");
}
public Enumeration<AccountStatus> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("active".equals(codeString))
return new Enumeration<AccountStatus>(this, AccountStatus.ACTIVE);
if ("inactive".equals(codeString))
return new Enumeration<AccountStatus>(this, AccountStatus.INACTIVE);
throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
}
public String toCode(AccountStatus code) {
if (code == AccountStatus.ACTIVE)
return "active";
if (code == AccountStatus.INACTIVE)
return "inactive";
return "?";
}
}
/**
* Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Account number", formalDefinition="Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number)." )
protected List<Identifier> identifier;
/**
* Name used for the account when displaying it to humans in reports, etc.
*/
@Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Human-readable label", formalDefinition="Name used for the account when displaying it to humans in reports, etc." )
protected StringType name;
/**
* Categorizes the account for reporting and searching purposes.
*/
@Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="E.g. patient, expense, depreciation", formalDefinition="Categorizes the account for reporting and searching purposes." )
protected CodeableConcept type;
/**
* Indicates whether the account is presently used/useable or not.
*/
@Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="active | inactive", formalDefinition="Indicates whether the account is presently used/useable or not." )
protected Enumeration<AccountStatus> status;
/**
* Indicates the period of time over which the account is allowed.
*/
@Child(name = "activePeriod", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Valid from..to", formalDefinition="Indicates the period of time over which the account is allowed." )
protected Period activePeriod;
/**
* Identifies the currency to which transactions must be converted when crediting or debiting the account.
*/
@Child(name = "currency", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Base currency in which balance is tracked", formalDefinition="Identifies the currency to which transactions must be converted when crediting or debiting the account." )
protected Coding currency;
/**
* Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.
*/
@Child(name = "balance", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="How much is in account?", formalDefinition="Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative." )
protected Money balance;
/**
* Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.
*/
@Child(name = "coveragePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Transaction window", formalDefinition="Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc." )
protected Period coveragePeriod;
/**
* Identifies the patient, device, practitioner, location or other object the account is associated with.
*/
@Child(name = "subject", type = {Patient.class, Device.class, Practitioner.class, Location.class, HealthcareService.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="What is account tied to?", formalDefinition="Identifies the patient, device, practitioner, location or other object the account is associated with." )
protected Reference subject;
/**
* The actual object that is the target of the reference (Identifies the patient, device, practitioner, location or other object the account is associated with.)
*/
protected Resource subjectTarget;
/**
* Indicates the organization, department, etc. with responsibility for the account.
*/
@Child(name = "owner", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who is responsible?", formalDefinition="Indicates the organization, department, etc. with responsibility for the account." )
protected Reference owner;
/**
* The actual object that is the target of the reference (Indicates the organization, department, etc. with responsibility for the account.)
*/
protected Organization ownerTarget;
/**
* Provides additional information about what the account tracks and how it is used.
*/
@Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Explanation of purpose/use", formalDefinition="Provides additional information about what the account tracks and how it is used." )
protected StringType description;
private static final long serialVersionUID = -1926153194L;
/*
* Constructor
*/
public Account() {
super();
}
/**
* @return {@link #identifier} (Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public Account addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
*/
public StringType getNameElement() {
if (this.name == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.name");
else if (Configuration.doAutoCreate())
this.name = new StringType(); // bb
return this.name;
}
public boolean hasNameElement() {
return this.name != null && !this.name.isEmpty();
}
public boolean hasName() {
return this.name != null && !this.name.isEmpty();
}
/**
* @param value {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
*/
public Account setNameElement(StringType value) {
this.name = value;
return this;
}
/**
* @return Name used for the account when displaying it to humans in reports, etc.
*/
public String getName() {
return this.name == null ? null : this.name.getValue();
}
/**
* @param value Name used for the account when displaying it to humans in reports, etc.
*/
public Account setName(String value) {
if (Utilities.noString(value))
this.name = null;
else {
if (this.name == null)
this.name = new StringType();
this.name.setValue(value);
}
return this;
}
/**
* @return {@link #type} (Categorizes the account for reporting and searching purposes.)
*/
public CodeableConcept getType() {
if (this.type == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.type");
else if (Configuration.doAutoCreate())
this.type = new CodeableConcept(); // cc
return this.type;
}
public boolean hasType() {
return this.type != null && !this.type.isEmpty();
}
/**
* @param value {@link #type} (Categorizes the account for reporting and searching purposes.)
*/
public Account setType(CodeableConcept value) {
this.type = value;
return this;
}
/**
* @return {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
*/
public Enumeration<AccountStatus> getStatusElement() {
if (this.status == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.status");
else if (Configuration.doAutoCreate())
this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory()); // bb
return this.status;
}
public boolean hasStatusElement() {
return this.status != null && !this.status.isEmpty();
}
public boolean hasStatus() {
return this.status != null && !this.status.isEmpty();
}
/**
* @param value {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
*/
public Account setStatusElement(Enumeration<AccountStatus> value) {
this.status = value;
return this;
}
/**
* @return Indicates whether the account is presently used/useable or not.
*/
public AccountStatus getStatus() {
return this.status == null ? null : this.status.getValue();
}
/**
* @param value Indicates whether the account is presently used/useable or not.
*/
public Account setStatus(AccountStatus value) {
if (value == null)
this.status = null;
else {
if (this.status == null)
this.status = new Enumeration<AccountStatus>(new AccountStatusEnumFactory());
this.status.setValue(value);
}
return this;
}
/**
* @return {@link #activePeriod} (Indicates the period of time over which the account is allowed.)
*/
public Period getActivePeriod() {
if (this.activePeriod == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.activePeriod");
else if (Configuration.doAutoCreate())
this.activePeriod = new Period(); // cc
return this.activePeriod;
}
public boolean hasActivePeriod() {
return this.activePeriod != null && !this.activePeriod.isEmpty();
}
/**
* @param value {@link #activePeriod} (Indicates the period of time over which the account is allowed.)
*/
public Account setActivePeriod(Period value) {
this.activePeriod = value;
return this;
}
/**
* @return {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.)
*/
public Coding getCurrency() {
if (this.currency == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.currency");
else if (Configuration.doAutoCreate())
this.currency = new Coding(); // cc
return this.currency;
}
public boolean hasCurrency() {
return this.currency != null && !this.currency.isEmpty();
}
/**
* @param value {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.)
*/
public Account setCurrency(Coding value) {
this.currency = value;
return this;
}
/**
* @return {@link #balance} (Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.)
*/
public Money getBalance() {
if (this.balance == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.balance");
else if (Configuration.doAutoCreate())
this.balance = new Money(); // cc
return this.balance;
}
public boolean hasBalance() {
return this.balance != null && !this.balance.isEmpty();
}
/**
* @param value {@link #balance} (Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.)
*/
public Account setBalance(Money value) {
this.balance = value;
return this;
}
/**
* @return {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
*/
public Period getCoveragePeriod() {
if (this.coveragePeriod == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.coveragePeriod");
else if (Configuration.doAutoCreate())
this.coveragePeriod = new Period(); // cc
return this.coveragePeriod;
}
public boolean hasCoveragePeriod() {
return this.coveragePeriod != null && !this.coveragePeriod.isEmpty();
}
/**
* @param value {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
*/
public Account setCoveragePeriod(Period value) {
this.coveragePeriod = value;
return this;
}
/**
* @return {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.)
*/
public Reference getSubject() {
if (this.subject == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.subject");
else if (Configuration.doAutoCreate())
this.subject = new Reference(); // cc
return this.subject;
}
public boolean hasSubject() {
return this.subject != null && !this.subject.isEmpty();
}
/**
* @param value {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.)
*/
public Account setSubject(Reference value) {
this.subject = value;
return this;
}
/**
* @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient, device, practitioner, location or other object the account is associated with.)
*/
public Resource getSubjectTarget() {
return this.subjectTarget;
}
/**
* @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient, device, practitioner, location or other object the account is associated with.)
*/
public Account setSubjectTarget(Resource value) {
this.subjectTarget = value;
return this;
}
/**
* @return {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.)
*/
public Reference getOwner() {
if (this.owner == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.owner");
else if (Configuration.doAutoCreate())
this.owner = new Reference(); // cc
return this.owner;
}
public boolean hasOwner() {
return this.owner != null && !this.owner.isEmpty();
}
/**
* @param value {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.)
*/
public Account setOwner(Reference value) {
this.owner = value;
return this;
}
/**
* @return {@link #owner} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the organization, department, etc. with responsibility for the account.)
*/
public Organization getOwnerTarget() {
if (this.ownerTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.owner");
else if (Configuration.doAutoCreate())
this.ownerTarget = new Organization(); // aa
return this.ownerTarget;
}
/**
* @param value {@link #owner} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the organization, department, etc. with responsibility for the account.)
*/
public Account setOwnerTarget(Organization value) {
this.ownerTarget = value;
return this;
}
/**
* @return {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
*/
public StringType getDescriptionElement() {
if (this.description == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Account.description");
else if (Configuration.doAutoCreate())
this.description = new StringType(); // bb
return this.description;
}
public boolean hasDescriptionElement() {
return this.description != null && !this.description.isEmpty();
}
public boolean hasDescription() {
return this.description != null && !this.description.isEmpty();
}
/**
* @param value {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
*/
public Account setDescriptionElement(StringType value) {
this.description = value;
return this;
}
/**
* @return Provides additional information about what the account tracks and how it is used.
*/
public String getDescription() {
return this.description == null ? null : this.description.getValue();
}
/**
* @param value Provides additional information about what the account tracks and how it is used.
*/
public Account setDescription(String value) {
if (Utilities.noString(value))
this.description = null;
else {
if (this.description == null)
this.description = new StringType();
this.description.setValue(value);
}
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, java.lang.Integer.MAX_VALUE, name));
childrenList.add(new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, java.lang.Integer.MAX_VALUE, type));
childrenList.add(new Property("status", "code", "Indicates whether the account is presently used/useable or not.", 0, java.lang.Integer.MAX_VALUE, status));
childrenList.add(new Property("activePeriod", "Period", "Indicates the period of time over which the account is allowed.", 0, java.lang.Integer.MAX_VALUE, activePeriod));
childrenList.add(new Property("currency", "Coding", "Identifies the currency to which transactions must be converted when crediting or debiting the account.", 0, java.lang.Integer.MAX_VALUE, currency));
childrenList.add(new Property("balance", "Money", "Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.", 0, java.lang.Integer.MAX_VALUE, balance));
childrenList.add(new Property("coveragePeriod", "Period", "Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.", 0, java.lang.Integer.MAX_VALUE, coveragePeriod));
childrenList.add(new Property("subject", "Reference(Patient|Device|Practitioner|Location|HealthcareService|Organization)", "Identifies the patient, device, practitioner, location or other object the account is associated with.", 0, java.lang.Integer.MAX_VALUE, subject));
childrenList.add(new Property("owner", "Reference(Organization)", "Indicates the organization, department, etc. with responsibility for the account.", 0, java.lang.Integer.MAX_VALUE, owner));
childrenList.add(new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, java.lang.Integer.MAX_VALUE, description));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("name"))
this.name = castToString(value); // StringType
else if (name.equals("type"))
this.type = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("status"))
this.status = new AccountStatusEnumFactory().fromType(value); // Enumeration<AccountStatus>
else if (name.equals("activePeriod"))
this.activePeriod = castToPeriod(value); // Period
else if (name.equals("currency"))
this.currency = castToCoding(value); // Coding
else if (name.equals("balance"))
this.balance = castToMoney(value); // Money
else if (name.equals("coveragePeriod"))
this.coveragePeriod = castToPeriod(value); // Period
else if (name.equals("subject"))
this.subject = castToReference(value); // Reference
else if (name.equals("owner"))
this.owner = castToReference(value); // Reference
else if (name.equals("description"))
this.description = castToString(value); // StringType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("name")) {
throw new FHIRException("Cannot call addChild on a primitive type Account.name");
}
else if (name.equals("type")) {
this.type = new CodeableConcept();
return this.type;
}
else if (name.equals("status")) {
throw new FHIRException("Cannot call addChild on a primitive type Account.status");
}
else if (name.equals("activePeriod")) {
this.activePeriod = new Period();
return this.activePeriod;
}
else if (name.equals("currency")) {
this.currency = new Coding();
return this.currency;
}
else if (name.equals("balance")) {
this.balance = new Money();
return this.balance;
}
else if (name.equals("coveragePeriod")) {
this.coveragePeriod = new Period();
return this.coveragePeriod;
}
else if (name.equals("subject")) {
this.subject = new Reference();
return this.subject;
}
else if (name.equals("owner")) {
this.owner = new Reference();
return this.owner;
}
else if (name.equals("description")) {
throw new FHIRException("Cannot call addChild on a primitive type Account.description");
}
else
return super.addChild(name);
}
public String fhirType() {
return "Account";
}
public Account copy() {
Account dst = new Account();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.name = name == null ? null : name.copy();
dst.type = type == null ? null : type.copy();
dst.status = status == null ? null : status.copy();
dst.activePeriod = activePeriod == null ? null : activePeriod.copy();
dst.currency = currency == null ? null : currency.copy();
dst.balance = balance == null ? null : balance.copy();
dst.coveragePeriod = coveragePeriod == null ? null : coveragePeriod.copy();
dst.subject = subject == null ? null : subject.copy();
dst.owner = owner == null ? null : owner.copy();
dst.description = description == null ? null : description.copy();
return dst;
}
protected Account typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Account))
return false;
Account o = (Account) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(type, o.type, true)
&& compareDeep(status, o.status, true) && compareDeep(activePeriod, o.activePeriod, true) && compareDeep(currency, o.currency, true)
&& compareDeep(balance, o.balance, true) && compareDeep(coveragePeriod, o.coveragePeriod, true)
&& compareDeep(subject, o.subject, true) && compareDeep(owner, o.owner, true) && compareDeep(description, o.description, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Account))
return false;
Account o = (Account) other;
return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(description, o.description, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (name == null || name.isEmpty())
&& (type == null || type.isEmpty()) && (status == null || status.isEmpty()) && (activePeriod == null || activePeriod.isEmpty())
&& (currency == null || currency.isEmpty()) && (balance == null || balance.isEmpty()) && (coveragePeriod == null || coveragePeriod.isEmpty())
&& (subject == null || subject.isEmpty()) && (owner == null || owner.isEmpty()) && (description == null || description.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Account;
}
@SearchParamDefinition(name="owner", path="Account.owner", description="Who is responsible?", type="reference" )
public static final String SP_OWNER = "owner";
@SearchParamDefinition(name="identifier", path="Account.identifier", description="Account number", type="token" )
public static final String SP_IDENTIFIER = "identifier";
@SearchParamDefinition(name="period", path="Account.coveragePeriod", description="Transaction window", type="date" )
public static final String SP_PERIOD = "period";
@SearchParamDefinition(name="balance", path="Account.balance", description="How much is in account?", type="quantity" )
public static final String SP_BALANCE = "balance";
@SearchParamDefinition(name="subject", path="Account.subject", description="What is account tied to?", type="reference" )
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="patient", path="Account.subject", description="What is account tied to?", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="name", path="Account.name", description="Human-readable label", type="string" )
public static final String SP_NAME = "name";
@SearchParamDefinition(name="type", path="Account.type", description="E.g. patient, expense, depreciation", type="token" )
public static final String SP_TYPE = "type";
@SearchParamDefinition(name="status", path="Account.status", description="active | inactive", type="token" )
public static final String SP_STATUS = "status";
}

View File

@ -0,0 +1,955 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* There is a variety of postal address formats defined around the world. This format defines a superset that is the basis for all addresses around the world.
*/
@DatatypeDef(name="Address")
public class Address extends Type implements ICompositeType {
public enum AddressUse {
/**
* A communication address at a home.
*/
HOME,
/**
* An office address. First choice for business related contacts during business hours.
*/
WORK,
/**
* A temporary address. The period can provide more detailed information.
*/
TEMP,
/**
* This address is no longer in use (or was never correct, but retained for records).
*/
OLD,
/**
* added to help the parsers
*/
NULL;
public static AddressUse fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("home".equals(codeString))
return HOME;
if ("work".equals(codeString))
return WORK;
if ("temp".equals(codeString))
return TEMP;
if ("old".equals(codeString))
return OLD;
throw new FHIRException("Unknown AddressUse code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case HOME: return "home";
case WORK: return "work";
case TEMP: return "temp";
case OLD: return "old";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case HOME: return "http://hl7.org/fhir/address-use";
case WORK: return "http://hl7.org/fhir/address-use";
case TEMP: return "http://hl7.org/fhir/address-use";
case OLD: return "http://hl7.org/fhir/address-use";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case HOME: return "A communication address at a home.";
case WORK: return "An office address. First choice for business related contacts during business hours.";
case TEMP: return "A temporary address. The period can provide more detailed information.";
case OLD: return "This address is no longer in use (or was never correct, but retained for records).";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case HOME: return "Home";
case WORK: return "Work";
case TEMP: return "Temporary";
case OLD: return "Old / Incorrect";
default: return "?";
}
}
}
public static class AddressUseEnumFactory implements EnumFactory<AddressUse> {
public AddressUse fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("home".equals(codeString))
return AddressUse.HOME;
if ("work".equals(codeString))
return AddressUse.WORK;
if ("temp".equals(codeString))
return AddressUse.TEMP;
if ("old".equals(codeString))
return AddressUse.OLD;
throw new IllegalArgumentException("Unknown AddressUse code '"+codeString+"'");
}
public Enumeration<AddressUse> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("home".equals(codeString))
return new Enumeration<AddressUse>(this, AddressUse.HOME);
if ("work".equals(codeString))
return new Enumeration<AddressUse>(this, AddressUse.WORK);
if ("temp".equals(codeString))
return new Enumeration<AddressUse>(this, AddressUse.TEMP);
if ("old".equals(codeString))
return new Enumeration<AddressUse>(this, AddressUse.OLD);
throw new FHIRException("Unknown AddressUse code '"+codeString+"'");
}
public String toCode(AddressUse code) {
if (code == AddressUse.HOME)
return "home";
if (code == AddressUse.WORK)
return "work";
if (code == AddressUse.TEMP)
return "temp";
if (code == AddressUse.OLD)
return "old";
return "?";
}
}
public enum AddressType {
/**
* Mailing addresses - PO Boxes and care-of addresses.
*/
POSTAL,
/**
* A physical address that can be visited.
*/
PHYSICAL,
/**
* An address that is both physical and postal.
*/
BOTH,
/**
* added to help the parsers
*/
NULL;
public static AddressType fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("postal".equals(codeString))
return POSTAL;
if ("physical".equals(codeString))
return PHYSICAL;
if ("both".equals(codeString))
return BOTH;
throw new FHIRException("Unknown AddressType code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case POSTAL: return "postal";
case PHYSICAL: return "physical";
case BOTH: return "both";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case POSTAL: return "http://hl7.org/fhir/address-type";
case PHYSICAL: return "http://hl7.org/fhir/address-type";
case BOTH: return "http://hl7.org/fhir/address-type";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case POSTAL: return "Mailing addresses - PO Boxes and care-of addresses.";
case PHYSICAL: return "A physical address that can be visited.";
case BOTH: return "An address that is both physical and postal.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case POSTAL: return "Postal";
case PHYSICAL: return "Physical";
case BOTH: return "Postal & Physical";
default: return "?";
}
}
}
public static class AddressTypeEnumFactory implements EnumFactory<AddressType> {
public AddressType fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("postal".equals(codeString))
return AddressType.POSTAL;
if ("physical".equals(codeString))
return AddressType.PHYSICAL;
if ("both".equals(codeString))
return AddressType.BOTH;
throw new IllegalArgumentException("Unknown AddressType code '"+codeString+"'");
}
public Enumeration<AddressType> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("postal".equals(codeString))
return new Enumeration<AddressType>(this, AddressType.POSTAL);
if ("physical".equals(codeString))
return new Enumeration<AddressType>(this, AddressType.PHYSICAL);
if ("both".equals(codeString))
return new Enumeration<AddressType>(this, AddressType.BOTH);
throw new FHIRException("Unknown AddressType code '"+codeString+"'");
}
public String toCode(AddressType code) {
if (code == AddressType.POSTAL)
return "postal";
if (code == AddressType.PHYSICAL)
return "physical";
if (code == AddressType.BOTH)
return "both";
return "?";
}
}
/**
* The purpose of this address.
*/
@Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="home | work | temp | old - purpose of this address", formalDefinition="The purpose of this address." )
protected Enumeration<AddressUse> use;
/**
* Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
*/
@Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="postal | physical | both", formalDefinition="Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both." )
protected Enumeration<AddressType> type;
/**
* A full text representation of the address.
*/
@Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Text representation of the address", formalDefinition="A full text representation of the address." )
protected StringType text;
/**
* This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.
*/
@Child(name = "line", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Street name, number, direction & P.O. Box etc.", formalDefinition="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information." )
protected List<StringType> line;
/**
* The name of the city, town, village or other community or delivery center.
*/
@Child(name = "city", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Name of city, town etc.", formalDefinition="The name of the city, town, village or other community or delivery center." )
protected StringType city;
/**
* The name of the administrative area (county).
*/
@Child(name = "district", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="District name (aka county)", formalDefinition="The name of the administrative area (county)." )
protected StringType district;
/**
* Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
*/
@Child(name = "state", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Sub-unit of country (abbreviations ok)", formalDefinition="Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes)." )
protected StringType state;
/**
* A postal code designating a region defined by the postal service.
*/
@Child(name = "postalCode", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Postal code for area", formalDefinition="A postal code designating a region defined by the postal service." )
protected StringType postalCode;
/**
* Country - a nation as commonly understood or generally accepted.
*/
@Child(name = "country", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Country (can be ISO 3166 3 letter code)", formalDefinition="Country - a nation as commonly understood or generally accepted." )
protected StringType country;
/**
* Time period when address was/is in use.
*/
@Child(name = "period", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time period when address was/is in use", formalDefinition="Time period when address was/is in use." )
protected Period period;
private static final long serialVersionUID = 561490318L;
/*
* Constructor
*/
public Address() {
super();
}
/**
* @return {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public Enumeration<AddressUse> getUseElement() {
if (this.use == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.use");
else if (Configuration.doAutoCreate())
this.use = new Enumeration<AddressUse>(new AddressUseEnumFactory()); // bb
return this.use;
}
public boolean hasUseElement() {
return this.use != null && !this.use.isEmpty();
}
public boolean hasUse() {
return this.use != null && !this.use.isEmpty();
}
/**
* @param value {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public Address setUseElement(Enumeration<AddressUse> value) {
this.use = value;
return this;
}
/**
* @return The purpose of this address.
*/
public AddressUse getUse() {
return this.use == null ? null : this.use.getValue();
}
/**
* @param value The purpose of this address.
*/
public Address setUse(AddressUse value) {
if (value == null)
this.use = null;
else {
if (this.use == null)
this.use = new Enumeration<AddressUse>(new AddressUseEnumFactory());
this.use.setValue(value);
}
return this;
}
/**
* @return {@link #type} (Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
*/
public Enumeration<AddressType> getTypeElement() {
if (this.type == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.type");
else if (Configuration.doAutoCreate())
this.type = new Enumeration<AddressType>(new AddressTypeEnumFactory()); // bb
return this.type;
}
public boolean hasTypeElement() {
return this.type != null && !this.type.isEmpty();
}
public boolean hasType() {
return this.type != null && !this.type.isEmpty();
}
/**
* @param value {@link #type} (Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
*/
public Address setTypeElement(Enumeration<AddressType> value) {
this.type = value;
return this;
}
/**
* @return Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
*/
public AddressType getType() {
return this.type == null ? null : this.type.getValue();
}
/**
* @param value Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
*/
public Address setType(AddressType value) {
if (value == null)
this.type = null;
else {
if (this.type == null)
this.type = new Enumeration<AddressType>(new AddressTypeEnumFactory());
this.type.setValue(value);
}
return this;
}
/**
* @return {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public StringType getTextElement() {
if (this.text == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.text");
else if (Configuration.doAutoCreate())
this.text = new StringType(); // bb
return this.text;
}
public boolean hasTextElement() {
return this.text != null && !this.text.isEmpty();
}
public boolean hasText() {
return this.text != null && !this.text.isEmpty();
}
/**
* @param value {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public Address setTextElement(StringType value) {
this.text = value;
return this;
}
/**
* @return A full text representation of the address.
*/
public String getText() {
return this.text == null ? null : this.text.getValue();
}
/**
* @param value A full text representation of the address.
*/
public Address setText(String value) {
if (Utilities.noString(value))
this.text = null;
else {
if (this.text == null)
this.text = new StringType();
this.text.setValue(value);
}
return this;
}
/**
* @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
*/
public List<StringType> getLine() {
if (this.line == null)
this.line = new ArrayList<StringType>();
return this.line;
}
public boolean hasLine() {
if (this.line == null)
return false;
for (StringType item : this.line)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
*/
// syntactic sugar
public StringType addLineElement() {//2
StringType t = new StringType();
if (this.line == null)
this.line = new ArrayList<StringType>();
this.line.add(t);
return t;
}
/**
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
*/
public Address addLine(String value) { //1
StringType t = new StringType();
t.setValue(value);
if (this.line == null)
this.line = new ArrayList<StringType>();
this.line.add(t);
return this;
}
/**
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
*/
public boolean hasLine(String value) {
if (this.line == null)
return false;
for (StringType v : this.line)
if (v.equals(value)) // string
return true;
return false;
}
/**
* @return {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value
*/
public StringType getCityElement() {
if (this.city == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.city");
else if (Configuration.doAutoCreate())
this.city = new StringType(); // bb
return this.city;
}
public boolean hasCityElement() {
return this.city != null && !this.city.isEmpty();
}
public boolean hasCity() {
return this.city != null && !this.city.isEmpty();
}
/**
* @param value {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value
*/
public Address setCityElement(StringType value) {
this.city = value;
return this;
}
/**
* @return The name of the city, town, village or other community or delivery center.
*/
public String getCity() {
return this.city == null ? null : this.city.getValue();
}
/**
* @param value The name of the city, town, village or other community or delivery center.
*/
public Address setCity(String value) {
if (Utilities.noString(value))
this.city = null;
else {
if (this.city == null)
this.city = new StringType();
this.city.setValue(value);
}
return this;
}
/**
* @return {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value
*/
public StringType getDistrictElement() {
if (this.district == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.district");
else if (Configuration.doAutoCreate())
this.district = new StringType(); // bb
return this.district;
}
public boolean hasDistrictElement() {
return this.district != null && !this.district.isEmpty();
}
public boolean hasDistrict() {
return this.district != null && !this.district.isEmpty();
}
/**
* @param value {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value
*/
public Address setDistrictElement(StringType value) {
this.district = value;
return this;
}
/**
* @return The name of the administrative area (county).
*/
public String getDistrict() {
return this.district == null ? null : this.district.getValue();
}
/**
* @param value The name of the administrative area (county).
*/
public Address setDistrict(String value) {
if (Utilities.noString(value))
this.district = null;
else {
if (this.district == null)
this.district = new StringType();
this.district.setValue(value);
}
return this;
}
/**
* @return {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
*/
public StringType getStateElement() {
if (this.state == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.state");
else if (Configuration.doAutoCreate())
this.state = new StringType(); // bb
return this.state;
}
public boolean hasStateElement() {
return this.state != null && !this.state.isEmpty();
}
public boolean hasState() {
return this.state != null && !this.state.isEmpty();
}
/**
* @param value {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
*/
public Address setStateElement(StringType value) {
this.state = value;
return this;
}
/**
* @return Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
*/
public String getState() {
return this.state == null ? null : this.state.getValue();
}
/**
* @param value Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
*/
public Address setState(String value) {
if (Utilities.noString(value))
this.state = null;
else {
if (this.state == null)
this.state = new StringType();
this.state.setValue(value);
}
return this;
}
/**
* @return {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value
*/
public StringType getPostalCodeElement() {
if (this.postalCode == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.postalCode");
else if (Configuration.doAutoCreate())
this.postalCode = new StringType(); // bb
return this.postalCode;
}
public boolean hasPostalCodeElement() {
return this.postalCode != null && !this.postalCode.isEmpty();
}
public boolean hasPostalCode() {
return this.postalCode != null && !this.postalCode.isEmpty();
}
/**
* @param value {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value
*/
public Address setPostalCodeElement(StringType value) {
this.postalCode = value;
return this;
}
/**
* @return A postal code designating a region defined by the postal service.
*/
public String getPostalCode() {
return this.postalCode == null ? null : this.postalCode.getValue();
}
/**
* @param value A postal code designating a region defined by the postal service.
*/
public Address setPostalCode(String value) {
if (Utilities.noString(value))
this.postalCode = null;
else {
if (this.postalCode == null)
this.postalCode = new StringType();
this.postalCode.setValue(value);
}
return this;
}
/**
* @return {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value
*/
public StringType getCountryElement() {
if (this.country == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.country");
else if (Configuration.doAutoCreate())
this.country = new StringType(); // bb
return this.country;
}
public boolean hasCountryElement() {
return this.country != null && !this.country.isEmpty();
}
public boolean hasCountry() {
return this.country != null && !this.country.isEmpty();
}
/**
* @param value {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value
*/
public Address setCountryElement(StringType value) {
this.country = value;
return this;
}
/**
* @return Country - a nation as commonly understood or generally accepted.
*/
public String getCountry() {
return this.country == null ? null : this.country.getValue();
}
/**
* @param value Country - a nation as commonly understood or generally accepted.
*/
public Address setCountry(String value) {
if (Utilities.noString(value))
this.country = null;
else {
if (this.country == null)
this.country = new StringType();
this.country.setValue(value);
}
return this;
}
/**
* @return {@link #period} (Time period when address was/is in use.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Address.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (Time period when address was/is in use.)
*/
public Address setPeriod(Period value) {
this.period = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("use", "code", "The purpose of this address.", 0, java.lang.Integer.MAX_VALUE, use));
childrenList.add(new Property("type", "code", "Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.", 0, java.lang.Integer.MAX_VALUE, type));
childrenList.add(new Property("text", "string", "A full text representation of the address.", 0, java.lang.Integer.MAX_VALUE, text));
childrenList.add(new Property("line", "string", "This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.", 0, java.lang.Integer.MAX_VALUE, line));
childrenList.add(new Property("city", "string", "The name of the city, town, village or other community or delivery center.", 0, java.lang.Integer.MAX_VALUE, city));
childrenList.add(new Property("district", "string", "The name of the administrative area (county).", 0, java.lang.Integer.MAX_VALUE, district));
childrenList.add(new Property("state", "string", "Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).", 0, java.lang.Integer.MAX_VALUE, state));
childrenList.add(new Property("postalCode", "string", "A postal code designating a region defined by the postal service.", 0, java.lang.Integer.MAX_VALUE, postalCode));
childrenList.add(new Property("country", "string", "Country - a nation as commonly understood or generally accepted.", 0, java.lang.Integer.MAX_VALUE, country));
childrenList.add(new Property("period", "Period", "Time period when address was/is in use.", 0, java.lang.Integer.MAX_VALUE, period));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("use"))
this.use = new AddressUseEnumFactory().fromType(value); // Enumeration<AddressUse>
else if (name.equals("type"))
this.type = new AddressTypeEnumFactory().fromType(value); // Enumeration<AddressType>
else if (name.equals("text"))
this.text = castToString(value); // StringType
else if (name.equals("line"))
this.getLine().add(castToString(value));
else if (name.equals("city"))
this.city = castToString(value); // StringType
else if (name.equals("district"))
this.district = castToString(value); // StringType
else if (name.equals("state"))
this.state = castToString(value); // StringType
else if (name.equals("postalCode"))
this.postalCode = castToString(value); // StringType
else if (name.equals("country"))
this.country = castToString(value); // StringType
else if (name.equals("period"))
this.period = castToPeriod(value); // Period
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("use")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.use");
}
else if (name.equals("type")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.type");
}
else if (name.equals("text")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.text");
}
else if (name.equals("line")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.line");
}
else if (name.equals("city")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.city");
}
else if (name.equals("district")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.district");
}
else if (name.equals("state")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.state");
}
else if (name.equals("postalCode")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.postalCode");
}
else if (name.equals("country")) {
throw new FHIRException("Cannot call addChild on a primitive type Address.country");
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else
return super.addChild(name);
}
public String fhirType() {
return "Address";
}
public Address copy() {
Address dst = new Address();
copyValues(dst);
dst.use = use == null ? null : use.copy();
dst.type = type == null ? null : type.copy();
dst.text = text == null ? null : text.copy();
if (line != null) {
dst.line = new ArrayList<StringType>();
for (StringType i : line)
dst.line.add(i.copy());
};
dst.city = city == null ? null : city.copy();
dst.district = district == null ? null : district.copy();
dst.state = state == null ? null : state.copy();
dst.postalCode = postalCode == null ? null : postalCode.copy();
dst.country = country == null ? null : country.copy();
dst.period = period == null ? null : period.copy();
return dst;
}
protected Address typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Address))
return false;
Address o = (Address) other;
return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
&& compareDeep(line, o.line, true) && compareDeep(city, o.city, true) && compareDeep(district, o.district, true)
&& compareDeep(state, o.state, true) && compareDeep(postalCode, o.postalCode, true) && compareDeep(country, o.country, true)
&& compareDeep(period, o.period, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Address))
return false;
Address o = (Address) other;
return compareValues(use, o.use, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
&& compareValues(line, o.line, true) && compareValues(city, o.city, true) && compareValues(district, o.district, true)
&& compareValues(state, o.state, true) && compareValues(postalCode, o.postalCode, true) && compareValues(country, o.country, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (use == null || use.isEmpty()) && (type == null || type.isEmpty())
&& (text == null || text.isEmpty()) && (line == null || line.isEmpty()) && (city == null || city.isEmpty())
&& (district == null || district.isEmpty()) && (state == null || state.isEmpty()) && (postalCode == null || postalCode.isEmpty())
&& (country == null || country.isEmpty()) && (period == null || period.isEmpty());
}
}

View File

@ -0,0 +1,91 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
@DatatypeDef(name="Age", profileOf=Quantity.class)
public class Age extends Quantity {
private static final long serialVersionUID = 1069574054L;
public Age copy() {
Age dst = new Age();
copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
return dst;
}
protected Age typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Age))
return false;
Age o = (Age) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Age))
return false;
Age o = (Age) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -0,0 +1,311 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A text note which also contains information about who made the statement and when.
*/
@DatatypeDef(name="Annotation")
public class Annotation extends Type implements ICompositeType {
/**
* The individual responsible for making the annotation.
*/
@Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class, StringType.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Individual responsible for the annotation", formalDefinition="The individual responsible for making the annotation." )
protected Type author;
/**
* Indicates when this particular annotation was made.
*/
@Child(name = "time", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="When the annotation was made", formalDefinition="Indicates when this particular annotation was made." )
protected DateTimeType time;
/**
* The text of the annotation.
*/
@Child(name = "text", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="The annotation - text content", formalDefinition="The text of the annotation." )
protected StringType text;
private static final long serialVersionUID = -575590381L;
/*
* Constructor
*/
public Annotation() {
super();
}
/*
* Constructor
*/
public Annotation(StringType text) {
super();
this.text = text;
}
/**
* @return {@link #author} (The individual responsible for making the annotation.)
*/
public Type getAuthor() {
return this.author;
}
/**
* @return {@link #author} (The individual responsible for making the annotation.)
*/
public Reference getAuthorReference() throws FHIRException {
if (!(this.author instanceof Reference))
throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.author.getClass().getName()+" was encountered");
return (Reference) this.author;
}
public boolean hasAuthorReference() {
return this.author instanceof Reference;
}
/**
* @return {@link #author} (The individual responsible for making the annotation.)
*/
public StringType getAuthorStringType() throws FHIRException {
if (!(this.author instanceof StringType))
throw new FHIRException("Type mismatch: the type StringType was expected, but "+this.author.getClass().getName()+" was encountered");
return (StringType) this.author;
}
public boolean hasAuthorStringType() {
return this.author instanceof StringType;
}
public boolean hasAuthor() {
return this.author != null && !this.author.isEmpty();
}
/**
* @param value {@link #author} (The individual responsible for making the annotation.)
*/
public Annotation setAuthor(Type value) {
this.author = value;
return this;
}
/**
* @return {@link #time} (Indicates when this particular annotation was made.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value
*/
public DateTimeType getTimeElement() {
if (this.time == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Annotation.time");
else if (Configuration.doAutoCreate())
this.time = new DateTimeType(); // bb
return this.time;
}
public boolean hasTimeElement() {
return this.time != null && !this.time.isEmpty();
}
public boolean hasTime() {
return this.time != null && !this.time.isEmpty();
}
/**
* @param value {@link #time} (Indicates when this particular annotation was made.). This is the underlying object with id, value and extensions. The accessor "getTime" gives direct access to the value
*/
public Annotation setTimeElement(DateTimeType value) {
this.time = value;
return this;
}
/**
* @return Indicates when this particular annotation was made.
*/
public Date getTime() {
return this.time == null ? null : this.time.getValue();
}
/**
* @param value Indicates when this particular annotation was made.
*/
public Annotation setTime(Date value) {
if (value == null)
this.time = null;
else {
if (this.time == null)
this.time = new DateTimeType();
this.time.setValue(value);
}
return this;
}
/**
* @return {@link #text} (The text of the annotation.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public StringType getTextElement() {
if (this.text == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Annotation.text");
else if (Configuration.doAutoCreate())
this.text = new StringType(); // bb
return this.text;
}
public boolean hasTextElement() {
return this.text != null && !this.text.isEmpty();
}
public boolean hasText() {
return this.text != null && !this.text.isEmpty();
}
/**
* @param value {@link #text} (The text of the annotation.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public Annotation setTextElement(StringType value) {
this.text = value;
return this;
}
/**
* @return The text of the annotation.
*/
public String getText() {
return this.text == null ? null : this.text.getValue();
}
/**
* @param value The text of the annotation.
*/
public Annotation setText(String value) {
if (this.text == null)
this.text = new StringType();
this.text.setValue(value);
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("author[x]", "Reference(Practitioner|Patient|RelatedPerson)|string", "The individual responsible for making the annotation.", 0, java.lang.Integer.MAX_VALUE, author));
childrenList.add(new Property("time", "dateTime", "Indicates when this particular annotation was made.", 0, java.lang.Integer.MAX_VALUE, time));
childrenList.add(new Property("text", "string", "The text of the annotation.", 0, java.lang.Integer.MAX_VALUE, text));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("author[x]"))
this.author = (Type) value; // Type
else if (name.equals("time"))
this.time = castToDateTime(value); // DateTimeType
else if (name.equals("text"))
this.text = castToString(value); // StringType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("authorReference")) {
this.author = new Reference();
return this.author;
}
else if (name.equals("authorString")) {
this.author = new StringType();
return this.author;
}
else if (name.equals("time")) {
throw new FHIRException("Cannot call addChild on a primitive type Annotation.time");
}
else if (name.equals("text")) {
throw new FHIRException("Cannot call addChild on a primitive type Annotation.text");
}
else
return super.addChild(name);
}
public String fhirType() {
return "Annotation";
}
public Annotation copy() {
Annotation dst = new Annotation();
copyValues(dst);
dst.author = author == null ? null : author.copy();
dst.time = time == null ? null : time.copy();
dst.text = text == null ? null : text.copy();
return dst;
}
protected Annotation typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Annotation))
return false;
Annotation o = (Annotation) other;
return compareDeep(author, o.author, true) && compareDeep(time, o.time, true) && compareDeep(text, o.text, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Annotation))
return false;
Annotation o = (Annotation) other;
return compareValues(time, o.time, true) && compareValues(text, o.text, true);
}
public boolean isEmpty() {
return super.isEmpty() && (author == null || author.isEmpty()) && (time == null || time.isEmpty())
&& (text == null || text.isEmpty());
}
}

View File

@ -0,0 +1,786 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A reply to an appointment request for a patient and/or practitioner(s), such as a confirmation or rejection.
*/
@ResourceDef(name="AppointmentResponse", profile="http://hl7.org/fhir/Profile/AppointmentResponse")
public class AppointmentResponse extends DomainResource {
public enum ParticipantStatus {
/**
* The appointment participant has accepted that they can attend the appointment at the time specified in the AppointmentResponse.
*/
ACCEPTED,
/**
* The appointment participant has declined the appointment.
*/
DECLINED,
/**
* The appointment participant has tentatively accepted the appointment.
*/
TENTATIVE,
/**
* The participant has in-process the appointment.
*/
INPROCESS,
/**
* The participant has completed the appointment.
*/
COMPLETED,
/**
* This is the intitial status of an appointment participant until a participant has replied. It implies that there is no commitment for the appointment.
*/
NEEDSACTION,
/**
* added to help the parsers
*/
NULL;
public static ParticipantStatus fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("accepted".equals(codeString))
return ACCEPTED;
if ("declined".equals(codeString))
return DECLINED;
if ("tentative".equals(codeString))
return TENTATIVE;
if ("in-process".equals(codeString))
return INPROCESS;
if ("completed".equals(codeString))
return COMPLETED;
if ("needs-action".equals(codeString))
return NEEDSACTION;
throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case ACCEPTED: return "accepted";
case DECLINED: return "declined";
case TENTATIVE: return "tentative";
case INPROCESS: return "in-process";
case COMPLETED: return "completed";
case NEEDSACTION: return "needs-action";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case ACCEPTED: return "http://hl7.org/fhir/participantstatus";
case DECLINED: return "http://hl7.org/fhir/participantstatus";
case TENTATIVE: return "http://hl7.org/fhir/participantstatus";
case INPROCESS: return "http://hl7.org/fhir/participantstatus";
case COMPLETED: return "http://hl7.org/fhir/participantstatus";
case NEEDSACTION: return "http://hl7.org/fhir/participantstatus";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case ACCEPTED: return "The appointment participant has accepted that they can attend the appointment at the time specified in the AppointmentResponse.";
case DECLINED: return "The appointment participant has declined the appointment.";
case TENTATIVE: return "The appointment participant has tentatively accepted the appointment.";
case INPROCESS: return "The participant has in-process the appointment.";
case COMPLETED: return "The participant has completed the appointment.";
case NEEDSACTION: return "This is the intitial status of an appointment participant until a participant has replied. It implies that there is no commitment for the appointment.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case ACCEPTED: return "Accepted";
case DECLINED: return "Declined";
case TENTATIVE: return "Tentative";
case INPROCESS: return "In Process";
case COMPLETED: return "Completed";
case NEEDSACTION: return "Needs Action";
default: return "?";
}
}
}
public static class ParticipantStatusEnumFactory implements EnumFactory<ParticipantStatus> {
public ParticipantStatus fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("accepted".equals(codeString))
return ParticipantStatus.ACCEPTED;
if ("declined".equals(codeString))
return ParticipantStatus.DECLINED;
if ("tentative".equals(codeString))
return ParticipantStatus.TENTATIVE;
if ("in-process".equals(codeString))
return ParticipantStatus.INPROCESS;
if ("completed".equals(codeString))
return ParticipantStatus.COMPLETED;
if ("needs-action".equals(codeString))
return ParticipantStatus.NEEDSACTION;
throw new IllegalArgumentException("Unknown ParticipantStatus code '"+codeString+"'");
}
public Enumeration<ParticipantStatus> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("accepted".equals(codeString))
return new Enumeration<ParticipantStatus>(this, ParticipantStatus.ACCEPTED);
if ("declined".equals(codeString))
return new Enumeration<ParticipantStatus>(this, ParticipantStatus.DECLINED);
if ("tentative".equals(codeString))
return new Enumeration<ParticipantStatus>(this, ParticipantStatus.TENTATIVE);
if ("in-process".equals(codeString))
return new Enumeration<ParticipantStatus>(this, ParticipantStatus.INPROCESS);
if ("completed".equals(codeString))
return new Enumeration<ParticipantStatus>(this, ParticipantStatus.COMPLETED);
if ("needs-action".equals(codeString))
return new Enumeration<ParticipantStatus>(this, ParticipantStatus.NEEDSACTION);
throw new FHIRException("Unknown ParticipantStatus code '"+codeString+"'");
}
public String toCode(ParticipantStatus code) {
if (code == ParticipantStatus.ACCEPTED)
return "accepted";
if (code == ParticipantStatus.DECLINED)
return "declined";
if (code == ParticipantStatus.TENTATIVE)
return "tentative";
if (code == ParticipantStatus.INPROCESS)
return "in-process";
if (code == ParticipantStatus.COMPLETED)
return "completed";
if (code == ParticipantStatus.NEEDSACTION)
return "needs-action";
return "?";
}
}
/**
* This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="External Ids for this item", formalDefinition="This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate." )
protected List<Identifier> identifier;
/**
* Appointment that this response is replying to.
*/
@Child(name = "appointment", type = {Appointment.class}, order=1, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Appointment this response relates to", formalDefinition="Appointment that this response is replying to." )
protected Reference appointment;
/**
* The actual object that is the target of the reference (Appointment that this response is replying to.)
*/
protected Appointment appointmentTarget;
/**
* Date/Time that the appointment is to take place, or requested new start time.
*/
@Child(name = "start", type = {InstantType.class}, order=2, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Time from appointment, or requested new start time", formalDefinition="Date/Time that the appointment is to take place, or requested new start time." )
protected InstantType start;
/**
* This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.
*/
@Child(name = "end", type = {InstantType.class}, order=3, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Time from appointment, or requested new end time", formalDefinition="This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time." )
protected InstantType end;
/**
* Role of participant in the appointment.
*/
@Child(name = "participantType", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Role of participant in the appointment", formalDefinition="Role of participant in the appointment." )
protected List<CodeableConcept> participantType;
/**
* A Person, Location/HealthcareService or Device that is participating in the appointment.
*/
@Child(name = "actor", type = {Patient.class, Practitioner.class, RelatedPerson.class, Device.class, HealthcareService.class, Location.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Person, Location/HealthcareService or Device", formalDefinition="A Person, Location/HealthcareService or Device that is participating in the appointment." )
protected Reference actor;
/**
* The actual object that is the target of the reference (A Person, Location/HealthcareService or Device that is participating in the appointment.)
*/
protected Resource actorTarget;
/**
* Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.
*/
@Child(name = "participantStatus", type = {CodeType.class}, order=6, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="accepted | declined | tentative | in-process | completed | needs-action", formalDefinition="Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty." )
protected Enumeration<ParticipantStatus> participantStatus;
/**
* Additional comments about the appointment.
*/
@Child(name = "comment", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Additional comments", formalDefinition="Additional comments about the appointment." )
protected StringType comment;
private static final long serialVersionUID = 248548635L;
/*
* Constructor
*/
public AppointmentResponse() {
super();
}
/*
* Constructor
*/
public AppointmentResponse(Reference appointment, Enumeration<ParticipantStatus> participantStatus) {
super();
this.appointment = appointment;
this.participantStatus = participantStatus;
}
/**
* @return {@link #identifier} (This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public AppointmentResponse addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #appointment} (Appointment that this response is replying to.)
*/
public Reference getAppointment() {
if (this.appointment == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.appointment");
else if (Configuration.doAutoCreate())
this.appointment = new Reference(); // cc
return this.appointment;
}
public boolean hasAppointment() {
return this.appointment != null && !this.appointment.isEmpty();
}
/**
* @param value {@link #appointment} (Appointment that this response is replying to.)
*/
public AppointmentResponse setAppointment(Reference value) {
this.appointment = value;
return this;
}
/**
* @return {@link #appointment} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Appointment that this response is replying to.)
*/
public Appointment getAppointmentTarget() {
if (this.appointmentTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.appointment");
else if (Configuration.doAutoCreate())
this.appointmentTarget = new Appointment(); // aa
return this.appointmentTarget;
}
/**
* @param value {@link #appointment} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Appointment that this response is replying to.)
*/
public AppointmentResponse setAppointmentTarget(Appointment value) {
this.appointmentTarget = value;
return this;
}
/**
* @return {@link #start} (Date/Time that the appointment is to take place, or requested new start time.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
*/
public InstantType getStartElement() {
if (this.start == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.start");
else if (Configuration.doAutoCreate())
this.start = new InstantType(); // bb
return this.start;
}
public boolean hasStartElement() {
return this.start != null && !this.start.isEmpty();
}
public boolean hasStart() {
return this.start != null && !this.start.isEmpty();
}
/**
* @param value {@link #start} (Date/Time that the appointment is to take place, or requested new start time.). This is the underlying object with id, value and extensions. The accessor "getStart" gives direct access to the value
*/
public AppointmentResponse setStartElement(InstantType value) {
this.start = value;
return this;
}
/**
* @return Date/Time that the appointment is to take place, or requested new start time.
*/
public Date getStart() {
return this.start == null ? null : this.start.getValue();
}
/**
* @param value Date/Time that the appointment is to take place, or requested new start time.
*/
public AppointmentResponse setStart(Date value) {
if (value == null)
this.start = null;
else {
if (this.start == null)
this.start = new InstantType();
this.start.setValue(value);
}
return this;
}
/**
* @return {@link #end} (This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
*/
public InstantType getEndElement() {
if (this.end == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.end");
else if (Configuration.doAutoCreate())
this.end = new InstantType(); // bb
return this.end;
}
public boolean hasEndElement() {
return this.end != null && !this.end.isEmpty();
}
public boolean hasEnd() {
return this.end != null && !this.end.isEmpty();
}
/**
* @param value {@link #end} (This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.). This is the underlying object with id, value and extensions. The accessor "getEnd" gives direct access to the value
*/
public AppointmentResponse setEndElement(InstantType value) {
this.end = value;
return this;
}
/**
* @return This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.
*/
public Date getEnd() {
return this.end == null ? null : this.end.getValue();
}
/**
* @param value This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.
*/
public AppointmentResponse setEnd(Date value) {
if (value == null)
this.end = null;
else {
if (this.end == null)
this.end = new InstantType();
this.end.setValue(value);
}
return this;
}
/**
* @return {@link #participantType} (Role of participant in the appointment.)
*/
public List<CodeableConcept> getParticipantType() {
if (this.participantType == null)
this.participantType = new ArrayList<CodeableConcept>();
return this.participantType;
}
public boolean hasParticipantType() {
if (this.participantType == null)
return false;
for (CodeableConcept item : this.participantType)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #participantType} (Role of participant in the appointment.)
*/
// syntactic sugar
public CodeableConcept addParticipantType() { //3
CodeableConcept t = new CodeableConcept();
if (this.participantType == null)
this.participantType = new ArrayList<CodeableConcept>();
this.participantType.add(t);
return t;
}
// syntactic sugar
public AppointmentResponse addParticipantType(CodeableConcept t) { //3
if (t == null)
return this;
if (this.participantType == null)
this.participantType = new ArrayList<CodeableConcept>();
this.participantType.add(t);
return this;
}
/**
* @return {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
*/
public Reference getActor() {
if (this.actor == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.actor");
else if (Configuration.doAutoCreate())
this.actor = new Reference(); // cc
return this.actor;
}
public boolean hasActor() {
return this.actor != null && !this.actor.isEmpty();
}
/**
* @param value {@link #actor} (A Person, Location/HealthcareService or Device that is participating in the appointment.)
*/
public AppointmentResponse setActor(Reference value) {
this.actor = value;
return this;
}
/**
* @return {@link #actor} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A Person, Location/HealthcareService or Device that is participating in the appointment.)
*/
public Resource getActorTarget() {
return this.actorTarget;
}
/**
* @param value {@link #actor} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A Person, Location/HealthcareService or Device that is participating in the appointment.)
*/
public AppointmentResponse setActorTarget(Resource value) {
this.actorTarget = value;
return this;
}
/**
* @return {@link #participantStatus} (Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.). This is the underlying object with id, value and extensions. The accessor "getParticipantStatus" gives direct access to the value
*/
public Enumeration<ParticipantStatus> getParticipantStatusElement() {
if (this.participantStatus == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.participantStatus");
else if (Configuration.doAutoCreate())
this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory()); // bb
return this.participantStatus;
}
public boolean hasParticipantStatusElement() {
return this.participantStatus != null && !this.participantStatus.isEmpty();
}
public boolean hasParticipantStatus() {
return this.participantStatus != null && !this.participantStatus.isEmpty();
}
/**
* @param value {@link #participantStatus} (Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.). This is the underlying object with id, value and extensions. The accessor "getParticipantStatus" gives direct access to the value
*/
public AppointmentResponse setParticipantStatusElement(Enumeration<ParticipantStatus> value) {
this.participantStatus = value;
return this;
}
/**
* @return Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.
*/
public ParticipantStatus getParticipantStatus() {
return this.participantStatus == null ? null : this.participantStatus.getValue();
}
/**
* @param value Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.
*/
public AppointmentResponse setParticipantStatus(ParticipantStatus value) {
if (this.participantStatus == null)
this.participantStatus = new Enumeration<ParticipantStatus>(new ParticipantStatusEnumFactory());
this.participantStatus.setValue(value);
return this;
}
/**
* @return {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
*/
public StringType getCommentElement() {
if (this.comment == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.comment");
else if (Configuration.doAutoCreate())
this.comment = new StringType(); // bb
return this.comment;
}
public boolean hasCommentElement() {
return this.comment != null && !this.comment.isEmpty();
}
public boolean hasComment() {
return this.comment != null && !this.comment.isEmpty();
}
/**
* @param value {@link #comment} (Additional comments about the appointment.). This is the underlying object with id, value and extensions. The accessor "getComment" gives direct access to the value
*/
public AppointmentResponse setCommentElement(StringType value) {
this.comment = value;
return this;
}
/**
* @return Additional comments about the appointment.
*/
public String getComment() {
return this.comment == null ? null : this.comment.getValue();
}
/**
* @param value Additional comments about the appointment.
*/
public AppointmentResponse setComment(String value) {
if (Utilities.noString(value))
this.comment = null;
else {
if (this.comment == null)
this.comment = new StringType();
this.comment.setValue(value);
}
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "This records identifiers associated with this appointment response concern that are defined by business processes and/ or used to refer to it when a direct URL reference to the resource itself is not appropriate.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("appointment", "Reference(Appointment)", "Appointment that this response is replying to.", 0, java.lang.Integer.MAX_VALUE, appointment));
childrenList.add(new Property("start", "instant", "Date/Time that the appointment is to take place, or requested new start time.", 0, java.lang.Integer.MAX_VALUE, start));
childrenList.add(new Property("end", "instant", "This may be either the same as the appointment request to confirm the details of the appointment, or alternately a new time to request a re-negotiation of the end time.", 0, java.lang.Integer.MAX_VALUE, end));
childrenList.add(new Property("participantType", "CodeableConcept", "Role of participant in the appointment.", 0, java.lang.Integer.MAX_VALUE, participantType));
childrenList.add(new Property("actor", "Reference(Patient|Practitioner|RelatedPerson|Device|HealthcareService|Location)", "A Person, Location/HealthcareService or Device that is participating in the appointment.", 0, java.lang.Integer.MAX_VALUE, actor));
childrenList.add(new Property("participantStatus", "code", "Participation status of the participant. When the status is declined or tentative if the start/end times are different to the appointment, then these times should be interpreted as a requested time change. When the status is accepted, the times can either be the time of the appointment (as a confirmation of the time) or can be empty.", 0, java.lang.Integer.MAX_VALUE, participantStatus));
childrenList.add(new Property("comment", "string", "Additional comments about the appointment.", 0, java.lang.Integer.MAX_VALUE, comment));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("appointment"))
this.appointment = castToReference(value); // Reference
else if (name.equals("start"))
this.start = castToInstant(value); // InstantType
else if (name.equals("end"))
this.end = castToInstant(value); // InstantType
else if (name.equals("participantType"))
this.getParticipantType().add(castToCodeableConcept(value));
else if (name.equals("actor"))
this.actor = castToReference(value); // Reference
else if (name.equals("participantStatus"))
this.participantStatus = new ParticipantStatusEnumFactory().fromType(value); // Enumeration<ParticipantStatus>
else if (name.equals("comment"))
this.comment = castToString(value); // StringType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("appointment")) {
this.appointment = new Reference();
return this.appointment;
}
else if (name.equals("start")) {
throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.start");
}
else if (name.equals("end")) {
throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.end");
}
else if (name.equals("participantType")) {
return addParticipantType();
}
else if (name.equals("actor")) {
this.actor = new Reference();
return this.actor;
}
else if (name.equals("participantStatus")) {
throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.participantStatus");
}
else if (name.equals("comment")) {
throw new FHIRException("Cannot call addChild on a primitive type AppointmentResponse.comment");
}
else
return super.addChild(name);
}
public String fhirType() {
return "AppointmentResponse";
}
public AppointmentResponse copy() {
AppointmentResponse dst = new AppointmentResponse();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.appointment = appointment == null ? null : appointment.copy();
dst.start = start == null ? null : start.copy();
dst.end = end == null ? null : end.copy();
if (participantType != null) {
dst.participantType = new ArrayList<CodeableConcept>();
for (CodeableConcept i : participantType)
dst.participantType.add(i.copy());
};
dst.actor = actor == null ? null : actor.copy();
dst.participantStatus = participantStatus == null ? null : participantStatus.copy();
dst.comment = comment == null ? null : comment.copy();
return dst;
}
protected AppointmentResponse typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof AppointmentResponse))
return false;
AppointmentResponse o = (AppointmentResponse) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(appointment, o.appointment, true)
&& compareDeep(start, o.start, true) && compareDeep(end, o.end, true) && compareDeep(participantType, o.participantType, true)
&& compareDeep(actor, o.actor, true) && compareDeep(participantStatus, o.participantStatus, true)
&& compareDeep(comment, o.comment, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof AppointmentResponse))
return false;
AppointmentResponse o = (AppointmentResponse) other;
return compareValues(start, o.start, true) && compareValues(end, o.end, true) && compareValues(participantStatus, o.participantStatus, true)
&& compareValues(comment, o.comment, true);
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (appointment == null || appointment.isEmpty())
&& (start == null || start.isEmpty()) && (end == null || end.isEmpty()) && (participantType == null || participantType.isEmpty())
&& (actor == null || actor.isEmpty()) && (participantStatus == null || participantStatus.isEmpty())
&& (comment == null || comment.isEmpty());
}
@Override
public ResourceType getResourceType() {
return ResourceType.AppointmentResponse;
}
@SearchParamDefinition(name="actor", path="AppointmentResponse.actor", description="The Person, Location/HealthcareService or Device that this appointment response replies for", type="reference" )
public static final String SP_ACTOR = "actor";
@SearchParamDefinition(name="identifier", path="AppointmentResponse.identifier", description="An Identifier in this appointment response", type="token" )
public static final String SP_IDENTIFIER = "identifier";
@SearchParamDefinition(name="practitioner", path="AppointmentResponse.actor", description="This Response is for this Practitioner", type="reference" )
public static final String SP_PRACTITIONER = "practitioner";
@SearchParamDefinition(name="part-status", path="AppointmentResponse.participantStatus", description="The participants acceptance status for this appointment", type="token" )
public static final String SP_PARTSTATUS = "part-status";
@SearchParamDefinition(name="patient", path="AppointmentResponse.actor", description="This Response is for this Patient", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="appointment", path="AppointmentResponse.appointment", description="The appointment that the response is attached to", type="reference" )
public static final String SP_APPOINTMENT = "appointment";
@SearchParamDefinition(name="location", path="AppointmentResponse.actor", description="This Response is for this Location", type="reference" )
public static final String SP_LOCATION = "location";
}

View File

@ -0,0 +1,625 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* For referring to data content defined in other formats.
*/
@DatatypeDef(name="Attachment")
public class Attachment extends Type implements ICompositeType {
/**
* Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
*/
@Child(name = "contentType", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Mime type of the content, with charset etc.", formalDefinition="Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate." )
protected CodeType contentType;
/**
* The human language of the content. The value can be any valid value according to BCP 47.
*/
@Child(name = "language", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Human language of the content (BCP-47)", formalDefinition="The human language of the content. The value can be any valid value according to BCP 47." )
protected CodeType language;
/**
* The actual data of the attachment - a sequence of bytes. In XML, represented using base64.
*/
@Child(name = "data", type = {Base64BinaryType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Data inline, base64ed", formalDefinition="The actual data of the attachment - a sequence of bytes. In XML, represented using base64." )
protected Base64BinaryType data;
/**
* An alternative location where the data can be accessed.
*/
@Child(name = "url", type = {UriType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Uri where the data can be found", formalDefinition="An alternative location where the data can be accessed." )
protected UriType url;
/**
* The number of bytes of data that make up this attachment.
*/
@Child(name = "size", type = {UnsignedIntType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Number of bytes of content (if url provided)", formalDefinition="The number of bytes of data that make up this attachment." )
protected UnsignedIntType size;
/**
* The calculated hash of the data using SHA-1. Represented using base64.
*/
@Child(name = "hash", type = {Base64BinaryType.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Hash of the data (sha-1, base64ed)", formalDefinition="The calculated hash of the data using SHA-1. Represented using base64." )
protected Base64BinaryType hash;
/**
* A label or set of text to display in place of the data.
*/
@Child(name = "title", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Label to display in place of the data", formalDefinition="A label or set of text to display in place of the data." )
protected StringType title;
/**
* The date that the attachment was first created.
*/
@Child(name = "creation", type = {DateTimeType.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Date attachment was first created", formalDefinition="The date that the attachment was first created." )
protected DateTimeType creation;
private static final long serialVersionUID = 581007080L;
/*
* Constructor
*/
public Attachment() {
super();
}
/**
* @return {@link #contentType} (Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
*/
public CodeType getContentTypeElement() {
if (this.contentType == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.contentType");
else if (Configuration.doAutoCreate())
this.contentType = new CodeType(); // bb
return this.contentType;
}
public boolean hasContentTypeElement() {
return this.contentType != null && !this.contentType.isEmpty();
}
public boolean hasContentType() {
return this.contentType != null && !this.contentType.isEmpty();
}
/**
* @param value {@link #contentType} (Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
*/
public Attachment setContentTypeElement(CodeType value) {
this.contentType = value;
return this;
}
/**
* @return Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
*/
public String getContentType() {
return this.contentType == null ? null : this.contentType.getValue();
}
/**
* @param value Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.
*/
public Attachment setContentType(String value) {
if (Utilities.noString(value))
this.contentType = null;
else {
if (this.contentType == null)
this.contentType = new CodeType();
this.contentType.setValue(value);
}
return this;
}
/**
* @return {@link #language} (The human language of the content. The value can be any valid value according to BCP 47.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
*/
public CodeType getLanguageElement() {
if (this.language == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.language");
else if (Configuration.doAutoCreate())
this.language = new CodeType(); // bb
return this.language;
}
public boolean hasLanguageElement() {
return this.language != null && !this.language.isEmpty();
}
public boolean hasLanguage() {
return this.language != null && !this.language.isEmpty();
}
/**
* @param value {@link #language} (The human language of the content. The value can be any valid value according to BCP 47.). This is the underlying object with id, value and extensions. The accessor "getLanguage" gives direct access to the value
*/
public Attachment setLanguageElement(CodeType value) {
this.language = value;
return this;
}
/**
* @return The human language of the content. The value can be any valid value according to BCP 47.
*/
public String getLanguage() {
return this.language == null ? null : this.language.getValue();
}
/**
* @param value The human language of the content. The value can be any valid value according to BCP 47.
*/
public Attachment setLanguage(String value) {
if (Utilities.noString(value))
this.language = null;
else {
if (this.language == null)
this.language = new CodeType();
this.language.setValue(value);
}
return this;
}
/**
* @return {@link #data} (The actual data of the attachment - a sequence of bytes. In XML, represented using base64.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
*/
public Base64BinaryType getDataElement() {
if (this.data == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.data");
else if (Configuration.doAutoCreate())
this.data = new Base64BinaryType(); // bb
return this.data;
}
public boolean hasDataElement() {
return this.data != null && !this.data.isEmpty();
}
public boolean hasData() {
return this.data != null && !this.data.isEmpty();
}
/**
* @param value {@link #data} (The actual data of the attachment - a sequence of bytes. In XML, represented using base64.). This is the underlying object with id, value and extensions. The accessor "getData" gives direct access to the value
*/
public Attachment setDataElement(Base64BinaryType value) {
this.data = value;
return this;
}
/**
* @return The actual data of the attachment - a sequence of bytes. In XML, represented using base64.
*/
public byte[] getData() {
return this.data == null ? null : this.data.getValue();
}
/**
* @param value The actual data of the attachment - a sequence of bytes. In XML, represented using base64.
*/
public Attachment setData(byte[] value) {
if (value == null)
this.data = null;
else {
if (this.data == null)
this.data = new Base64BinaryType();
this.data.setValue(value);
}
return this;
}
/**
* @return {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public UriType getUrlElement() {
if (this.url == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.url");
else if (Configuration.doAutoCreate())
this.url = new UriType(); // bb
return this.url;
}
public boolean hasUrlElement() {
return this.url != null && !this.url.isEmpty();
}
public boolean hasUrl() {
return this.url != null && !this.url.isEmpty();
}
/**
* @param value {@link #url} (An alternative location where the data can be accessed.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public Attachment setUrlElement(UriType value) {
this.url = value;
return this;
}
/**
* @return An alternative location where the data can be accessed.
*/
public String getUrl() {
return this.url == null ? null : this.url.getValue();
}
/**
* @param value An alternative location where the data can be accessed.
*/
public Attachment setUrl(String value) {
if (Utilities.noString(value))
this.url = null;
else {
if (this.url == null)
this.url = new UriType();
this.url.setValue(value);
}
return this;
}
/**
* @return {@link #size} (The number of bytes of data that make up this attachment.). This is the underlying object with id, value and extensions. The accessor "getSize" gives direct access to the value
*/
public UnsignedIntType getSizeElement() {
if (this.size == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.size");
else if (Configuration.doAutoCreate())
this.size = new UnsignedIntType(); // bb
return this.size;
}
public boolean hasSizeElement() {
return this.size != null && !this.size.isEmpty();
}
public boolean hasSize() {
return this.size != null && !this.size.isEmpty();
}
/**
* @param value {@link #size} (The number of bytes of data that make up this attachment.). This is the underlying object with id, value and extensions. The accessor "getSize" gives direct access to the value
*/
public Attachment setSizeElement(UnsignedIntType value) {
this.size = value;
return this;
}
/**
* @return The number of bytes of data that make up this attachment.
*/
public int getSize() {
return this.size == null || this.size.isEmpty() ? 0 : this.size.getValue();
}
/**
* @param value The number of bytes of data that make up this attachment.
*/
public Attachment setSize(int value) {
if (this.size == null)
this.size = new UnsignedIntType();
this.size.setValue(value);
return this;
}
/**
* @return {@link #hash} (The calculated hash of the data using SHA-1. Represented using base64.). This is the underlying object with id, value and extensions. The accessor "getHash" gives direct access to the value
*/
public Base64BinaryType getHashElement() {
if (this.hash == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.hash");
else if (Configuration.doAutoCreate())
this.hash = new Base64BinaryType(); // bb
return this.hash;
}
public boolean hasHashElement() {
return this.hash != null && !this.hash.isEmpty();
}
public boolean hasHash() {
return this.hash != null && !this.hash.isEmpty();
}
/**
* @param value {@link #hash} (The calculated hash of the data using SHA-1. Represented using base64.). This is the underlying object with id, value and extensions. The accessor "getHash" gives direct access to the value
*/
public Attachment setHashElement(Base64BinaryType value) {
this.hash = value;
return this;
}
/**
* @return The calculated hash of the data using SHA-1. Represented using base64.
*/
public byte[] getHash() {
return this.hash == null ? null : this.hash.getValue();
}
/**
* @param value The calculated hash of the data using SHA-1. Represented using base64.
*/
public Attachment setHash(byte[] value) {
if (value == null)
this.hash = null;
else {
if (this.hash == null)
this.hash = new Base64BinaryType();
this.hash.setValue(value);
}
return this;
}
/**
* @return {@link #title} (A label or set of text to display in place of the data.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
*/
public StringType getTitleElement() {
if (this.title == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.title");
else if (Configuration.doAutoCreate())
this.title = new StringType(); // bb
return this.title;
}
public boolean hasTitleElement() {
return this.title != null && !this.title.isEmpty();
}
public boolean hasTitle() {
return this.title != null && !this.title.isEmpty();
}
/**
* @param value {@link #title} (A label or set of text to display in place of the data.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
*/
public Attachment setTitleElement(StringType value) {
this.title = value;
return this;
}
/**
* @return A label or set of text to display in place of the data.
*/
public String getTitle() {
return this.title == null ? null : this.title.getValue();
}
/**
* @param value A label or set of text to display in place of the data.
*/
public Attachment setTitle(String value) {
if (Utilities.noString(value))
this.title = null;
else {
if (this.title == null)
this.title = new StringType();
this.title.setValue(value);
}
return this;
}
/**
* @return {@link #creation} (The date that the attachment was first created.). This is the underlying object with id, value and extensions. The accessor "getCreation" gives direct access to the value
*/
public DateTimeType getCreationElement() {
if (this.creation == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Attachment.creation");
else if (Configuration.doAutoCreate())
this.creation = new DateTimeType(); // bb
return this.creation;
}
public boolean hasCreationElement() {
return this.creation != null && !this.creation.isEmpty();
}
public boolean hasCreation() {
return this.creation != null && !this.creation.isEmpty();
}
/**
* @param value {@link #creation} (The date that the attachment was first created.). This is the underlying object with id, value and extensions. The accessor "getCreation" gives direct access to the value
*/
public Attachment setCreationElement(DateTimeType value) {
this.creation = value;
return this;
}
/**
* @return The date that the attachment was first created.
*/
public Date getCreation() {
return this.creation == null ? null : this.creation.getValue();
}
/**
* @param value The date that the attachment was first created.
*/
public Attachment setCreation(Date value) {
if (value == null)
this.creation = null;
else {
if (this.creation == null)
this.creation = new DateTimeType();
this.creation.setValue(value);
}
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("contentType", "code", "Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.", 0, java.lang.Integer.MAX_VALUE, contentType));
childrenList.add(new Property("language", "code", "The human language of the content. The value can be any valid value according to BCP 47.", 0, java.lang.Integer.MAX_VALUE, language));
childrenList.add(new Property("data", "base64Binary", "The actual data of the attachment - a sequence of bytes. In XML, represented using base64.", 0, java.lang.Integer.MAX_VALUE, data));
childrenList.add(new Property("url", "uri", "An alternative location where the data can be accessed.", 0, java.lang.Integer.MAX_VALUE, url));
childrenList.add(new Property("size", "unsignedInt", "The number of bytes of data that make up this attachment.", 0, java.lang.Integer.MAX_VALUE, size));
childrenList.add(new Property("hash", "base64Binary", "The calculated hash of the data using SHA-1. Represented using base64.", 0, java.lang.Integer.MAX_VALUE, hash));
childrenList.add(new Property("title", "string", "A label or set of text to display in place of the data.", 0, java.lang.Integer.MAX_VALUE, title));
childrenList.add(new Property("creation", "dateTime", "The date that the attachment was first created.", 0, java.lang.Integer.MAX_VALUE, creation));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("contentType"))
this.contentType = castToCode(value); // CodeType
else if (name.equals("language"))
this.language = castToCode(value); // CodeType
else if (name.equals("data"))
this.data = castToBase64Binary(value); // Base64BinaryType
else if (name.equals("url"))
this.url = castToUri(value); // UriType
else if (name.equals("size"))
this.size = castToUnsignedInt(value); // UnsignedIntType
else if (name.equals("hash"))
this.hash = castToBase64Binary(value); // Base64BinaryType
else if (name.equals("title"))
this.title = castToString(value); // StringType
else if (name.equals("creation"))
this.creation = castToDateTime(value); // DateTimeType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("contentType")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.contentType");
}
else if (name.equals("language")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.language");
}
else if (name.equals("data")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.data");
}
else if (name.equals("url")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.url");
}
else if (name.equals("size")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.size");
}
else if (name.equals("hash")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.hash");
}
else if (name.equals("title")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.title");
}
else if (name.equals("creation")) {
throw new FHIRException("Cannot call addChild on a primitive type Attachment.creation");
}
else
return super.addChild(name);
}
public String fhirType() {
return "Attachment";
}
public Attachment copy() {
Attachment dst = new Attachment();
copyValues(dst);
dst.contentType = contentType == null ? null : contentType.copy();
dst.language = language == null ? null : language.copy();
dst.data = data == null ? null : data.copy();
dst.url = url == null ? null : url.copy();
dst.size = size == null ? null : size.copy();
dst.hash = hash == null ? null : hash.copy();
dst.title = title == null ? null : title.copy();
dst.creation = creation == null ? null : creation.copy();
return dst;
}
protected Attachment typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Attachment))
return false;
Attachment o = (Attachment) other;
return compareDeep(contentType, o.contentType, true) && compareDeep(language, o.language, true)
&& compareDeep(data, o.data, true) && compareDeep(url, o.url, true) && compareDeep(size, o.size, true)
&& compareDeep(hash, o.hash, true) && compareDeep(title, o.title, true) && compareDeep(creation, o.creation, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Attachment))
return false;
Attachment o = (Attachment) other;
return compareValues(contentType, o.contentType, true) && compareValues(language, o.language, true)
&& compareValues(data, o.data, true) && compareValues(url, o.url, true) && compareValues(size, o.size, true)
&& compareValues(hash, o.hash, true) && compareValues(title, o.title, true) && compareValues(creation, o.creation, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (contentType == null || contentType.isEmpty()) && (language == null || language.isEmpty())
&& (data == null || data.isEmpty()) && (url == null || url.isEmpty()) && (size == null || size.isEmpty())
&& (hash == null || hash.isEmpty()) && (title == null || title.isEmpty()) && (creation == null || creation.isEmpty())
;
}
}

View File

@ -0,0 +1,166 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Base definition for all elements that are defined inside a resource - but not those in a data type.
*/
@DatatypeDef(name="BackboneElement")
public abstract class BackboneElement extends Element implements IBaseBackboneElement {
/**
* 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 that contains it. Usually modifier elements provide negation or qualification. In order 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.
*/
@Child(name = "modifierExtension", type = {Extension.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false)
@Description(shortDefinition="Extensions that cannot be ignored", formalDefinition="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 that contains it. Usually modifier elements provide negation or qualification. In order 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." )
protected List<Extension> modifierExtension;
private static final long serialVersionUID = -1431673179L;
/*
* Constructor
*/
public BackboneElement() {
super();
}
/**
* @return {@link #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 that contains it. Usually modifier elements provide negation or qualification. In order 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.)
*/
public List<Extension> getModifierExtension() {
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>();
return this.modifierExtension;
}
public boolean hasModifierExtension() {
if (this.modifierExtension == null)
return false;
for (Extension item : this.modifierExtension)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #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 that contains it. Usually modifier elements provide negation or qualification. In order 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.)
*/
// syntactic sugar
public Extension addModifierExtension() { //3
Extension t = new Extension();
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension.add(t);
return t;
}
// syntactic sugar
public BackboneElement addModifierExtension(Extension t) { //3
if (t == null)
return this;
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension.add(t);
return this;
}
protected void listChildren(List<Property> childrenList) {
childrenList.add(new Property("modifierExtension", "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 that contains it. Usually modifier elements provide negation or qualification. In order 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.", 0, java.lang.Integer.MAX_VALUE, modifierExtension));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("modifierExtension"))
this.getModifierExtension().add(castToExtension(value));
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("modifierExtension")) {
return addModifierExtension();
}
else
return super.addChild(name);
}
public String fhirType() {
return "BackboneElement";
}
public abstract BackboneElement copy();
public void copyValues(BackboneElement dst) {
if (modifierExtension != null) {
dst.modifierExtension = new ArrayList<Extension>();
for (Extension i : modifierExtension)
dst.modifierExtension.add(i.copy());
};
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof BackboneElement))
return false;
BackboneElement o = (BackboneElement) other;
return compareDeep(modifierExtension, o.modifierExtension, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof BackboneElement))
return false;
BackboneElement o = (BackboneElement) other;
return true;
}
public boolean isEmpty() {
return super.isEmpty() && (modifierExtension == null || modifierExtension.isEmpty());
}
}

View File

@ -0,0 +1,524 @@
package org.hl7.fhir.dstu21.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBase;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import ca.uhn.fhir.model.api.IElement;
public abstract class Base implements Serializable, IBase, IElement {
/**
* User appended data items - allow users to add extra information to the class
*/
private Map<String, Object> userData;
/**
* Round tracking xml comments for testing convenience
*/
private List<String> formatCommentsPre;
/**
* Round tracking xml comments for testing convenience
*/
private List<String> formatCommentsPost;
public Object getUserData(String name) {
if (userData == null)
return null;
return userData.get(name);
}
public void setUserData(String name, Object value) {
if (userData == null)
userData = new HashMap<String, Object>();
userData.put(name, value);
}
public void setUserDataINN(String name, Object value) {
if (value == null)
return;
if (userData == null)
userData = new HashMap<String, Object>();
userData.put(name, value);
}
public boolean hasUserData(String name) {
if (userData == null)
return false;
else
return userData.containsKey(name);
}
public String getUserString(String name) {
return (String) getUserData(name);
}
public int getUserInt(String name) {
if (!hasUserData(name))
return 0;
return (Integer) getUserData(name);
}
public boolean hasFormatComment() {
return (formatCommentsPre != null && !formatCommentsPre.isEmpty()) || (formatCommentsPost != null && !formatCommentsPost.isEmpty());
}
public List<String> getFormatCommentsPre() {
if (formatCommentsPre == null)
formatCommentsPre = new ArrayList<String>();
return formatCommentsPre;
}
public List<String> getFormatCommentsPost() {
if (formatCommentsPost == null)
formatCommentsPost = new ArrayList<String>();
return formatCommentsPost;
}
// these 2 allow evaluation engines to get access to primitive values
public boolean isPrimitive() {
return false;
}
public String primitiveValue() {
return null;
}
public abstract String fhirType() ;
public boolean hasType(String... name) {
String t = fhirType();
for (String n : name)
if (n.equals(t))
return true;
return false;
}
protected abstract void listChildren(List<Property> result) ;
public void setProperty(String name, Base value) throws FHIRException {
throw new FHIRException("Attempt to set unknown property "+name);
}
public Base addChild(String name) throws FHIRException {
throw new FHIRException("Attempt to add child with unknown name "+name);
}
/**
* Supports iterating the children elements in some generic processor or browser
* All defined children will be listed, even if they have no value on this instance
*
* Note that the actual content of primitive or xhtml elements is not iterated explicitly.
* To find these, the processing code must recognise the element as a primitive, typecast
* the value to a {@link Type}, and examine the value
*
* @return a list of all the children defined for this element
*/
public List<Property> children() {
List<Property> result = new ArrayList<Property>();
listChildren(result);
return result;
}
public Property getChildByName(String name) {
List<Property> children = new ArrayList<Property>();
listChildren(children);
for (Property c : children)
if (c.getName().equals(name))
return c;
return null;
}
public List<Base> listChildrenByName(String name) {
List<Property> children = new ArrayList<Property>();
listChildren(children);
for (Property c : children)
if (c.getName().equals(name) || (c.getName().endsWith("[x]") && name.startsWith(c.getName())))
return c.getValues();
return new ArrayList<Base>();
}
public boolean isEmpty() {
return true; // userData does not count
}
public boolean equalsDeep(Base other) {
return other != null;
}
public boolean equalsShallow(Base other) {
return other != null;
}
public static boolean compareDeep(List<? extends Base> e1, List<? extends Base> e2, boolean allowNull) {
if (noList(e1) && noList(e2) && allowNull)
return true;
if (noList(e1) || noList(e2))
return false;
if (e1.size() != e2.size())
return false;
for (int i = 0; i < e1.size(); i++) {
if (!compareDeep(e1.get(i), e2.get(i), allowNull))
return false;
}
return true;
}
private static boolean noList(List<? extends Base> list) {
return list == null || list.isEmpty();
}
public static boolean compareDeep(Base e1, Base e2, boolean allowNull) {
if (e1 == null && e2 == null && allowNull)
return true;
if (e1 == null || e2 == null)
return false;
if (e2.isMetadataBased() && !e1.isMetadataBased()) // respect existing order for debugging consistency; outcome must be the same either way
return e2.equalsDeep(e1);
else
return e1.equalsDeep(e2);
}
public static boolean compareDeep(XhtmlNode div1, XhtmlNode div2, boolean allowNull) {
if (div1 == null && div2 == null && allowNull)
return true;
if (div1 == null || div2 == null)
return false;
return div1.equalsDeep(div2);
}
public static boolean compareValues(List<? extends PrimitiveType> e1, List<? extends PrimitiveType> e2, boolean allowNull) {
if (e1 == null && e2 == null && allowNull)
return true;
if (e1 == null || e2 == null)
return false;
if (e1.size() != e2.size())
return false;
for (int i = 0; i < e1.size(); i++) {
if (!compareValues(e1.get(i), e2.get(i), allowNull))
return false;
}
return true;
}
public static boolean compareValues(PrimitiveType e1, PrimitiveType e2, boolean allowNull) {
if (e1 == null && e2 == null && allowNull)
return true;
if (e1 == null || e2 == null)
return false;
return e1.equalsShallow(e2);
}
// -- converters for property setters
public BooleanType castToBoolean(Base b) throws FHIRException {
if (b instanceof BooleanType)
return (BooleanType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Boolean");
}
public IntegerType castToInteger(Base b) throws FHIRException {
if (b instanceof IntegerType)
return (IntegerType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Integer");
}
public DecimalType castToDecimal(Base b) throws FHIRException {
if (b instanceof DecimalType)
return (DecimalType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Decimal");
}
public Base64BinaryType castToBase64Binary(Base b) throws FHIRException {
if (b instanceof Base64BinaryType)
return (Base64BinaryType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Base64Binary");
}
public InstantType castToInstant(Base b) throws FHIRException {
if (b instanceof InstantType)
return (InstantType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Instant");
}
public StringType castToString(Base b) throws FHIRException {
if (b instanceof StringType)
return (StringType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a String");
}
public UriType castToUri(Base b) throws FHIRException {
if (b instanceof UriType)
return (UriType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Uri");
}
public DateType castToDate(Base b) throws FHIRException {
if (b instanceof DateType)
return (DateType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Date");
}
public DateTimeType castToDateTime(Base b) throws FHIRException {
if (b instanceof DateTimeType)
return (DateTimeType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a DateTime");
}
public TimeType castToTime(Base b) throws FHIRException {
if (b instanceof TimeType)
return (TimeType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Time");
}
public CodeType castToCode(Base b) throws FHIRException {
if (b instanceof CodeType)
return (CodeType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Code");
}
public OidType castToOid(Base b) throws FHIRException {
if (b instanceof OidType)
return (OidType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Oid");
}
public IdType castToId(Base b) throws FHIRException {
if (b instanceof IdType)
return (IdType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Id");
}
public UnsignedIntType castToUnsignedInt(Base b) throws FHIRException {
if (b instanceof UnsignedIntType)
return (UnsignedIntType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a UnsignedInt");
}
public PositiveIntType castToPositiveInt(Base b) throws FHIRException {
if (b instanceof PositiveIntType)
return (PositiveIntType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a PositiveInt");
}
public MarkdownType castToMarkdown(Base b) throws FHIRException {
if (b instanceof MarkdownType)
return (MarkdownType) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Markdown");
}
public Annotation castToAnnotation(Base b) throws FHIRException {
if (b instanceof Annotation)
return (Annotation) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an Annotation");
}
public Attachment castToAttachment(Base b) throws FHIRException {
if (b instanceof Attachment)
return (Attachment) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an Attachment");
}
public Identifier castToIdentifier(Base b) throws FHIRException {
if (b instanceof Identifier)
return (Identifier) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an Identifier");
}
public CodeableConcept castToCodeableConcept(Base b) throws FHIRException {
if (b instanceof CodeableConcept)
return (CodeableConcept) b;
else if (b instanceof CodeType) {
CodeableConcept cc = new CodeableConcept();
cc.addCoding().setCode(((CodeType) b).asStringValue());
return cc;
} else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a CodeableConcept");
}
public Coding castToCoding(Base b) throws FHIRException {
if (b instanceof Coding)
return (Coding) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Coding");
}
public Quantity castToQuantity(Base b) throws FHIRException {
if (b instanceof Quantity)
return (Quantity) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an Quantity");
}
public Money castToMoney(Base b) throws FHIRException {
if (b instanceof Money)
return (Money) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an Money");
}
public Duration castToDuration(Base b) throws FHIRException {
if (b instanceof Duration)
return (Duration) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an Duration");
}
public SimpleQuantity castToSimpleQuantity(Base b) throws FHIRException {
if (b instanceof SimpleQuantity)
return (SimpleQuantity) b;
else if (b instanceof Quantity) {
Quantity q = (Quantity) b;
SimpleQuantity sq = new SimpleQuantity();
sq.setValueElement(q.getValueElement());
sq.setComparatorElement(q.getComparatorElement());
sq.setUnitElement(q.getUnitElement());
sq.setSystemElement(q.getSystemElement());
sq.setCodeElement(q.getCodeElement());
return sq;
} else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to an SimpleQuantity");
}
public Range castToRange(Base b) throws FHIRException {
if (b instanceof Range)
return (Range) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Range");
}
public Period castToPeriod(Base b) throws FHIRException {
if (b instanceof Period)
return (Period) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Period");
}
public Ratio castToRatio(Base b) throws FHIRException {
if (b instanceof Ratio)
return (Ratio) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Ratio");
}
public SampledData castToSampledData(Base b) throws FHIRException {
if (b instanceof SampledData)
return (SampledData) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a SampledData");
}
public Signature castToSignature(Base b) throws FHIRException {
if (b instanceof Signature)
return (Signature) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Signature");
}
public HumanName castToHumanName(Base b) throws FHIRException {
if (b instanceof HumanName)
return (HumanName) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a HumanName");
}
public Address castToAddress(Base b) throws FHIRException {
if (b instanceof Address)
return (Address) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Address");
}
public ContactPoint castToContactPoint(Base b) throws FHIRException {
if (b instanceof ContactPoint)
return (ContactPoint) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a ContactPoint");
}
public Timing castToTiming(Base b) throws FHIRException {
if (b instanceof Timing)
return (Timing) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Timing");
}
public Reference castToReference(Base b) throws FHIRException {
if (b instanceof Reference)
return (Reference) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Reference");
}
public Meta castToMeta(Base b) throws FHIRException {
if (b instanceof Meta)
return (Meta) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Meta");
}
public Extension castToExtension(Base b) throws FHIRException {
if (b instanceof Extension)
return (Extension) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Extension");
}
public Resource castToResource(Base b) throws FHIRException {
if (b instanceof Resource)
return (Resource) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Resource");
}
public Narrative castToNarrative(Base b) throws FHIRException {
if (b instanceof Narrative)
return (Narrative) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a Narrative");
}
public ElementDefinition castToElementDefinition(Base b) throws FHIRException {
if (b instanceof ElementDefinition)
return (ElementDefinition) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a ElementDefinition");
}
protected boolean isMetadataBased() {
return false;
}
}

View File

@ -0,0 +1,76 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
package org.hl7.fhir.dstu21.model;
import org.apache.commons.codec.binary.Base64;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Primitive type "base64Binary" in FHIR: a sequence of bytes represented in base64
*/
@DatatypeDef(name="base64binary")
public class Base64BinaryType extends PrimitiveType<byte[]> {
private static final long serialVersionUID = 3L;
/**
* Constructor
*/
public Base64BinaryType() {
super();
}
public Base64BinaryType(byte[] theBytes) {
super();
setValue(theBytes);
}
public Base64BinaryType(String theValue) {
super();
setValueAsString(theValue);
}
protected byte[] parse(String theValue) {
return Base64.decodeBase64(theValue);
}
protected String encode(byte[] theValue) {
return Base64.encodeBase64String(theValue);
}
@Override
public Base64BinaryType copy() {
return new Base64BinaryType(getValue());
}
public String fhirType() {
return "base64Binary";
}
}

View File

@ -0,0 +1,24 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IBaseBinary;
public abstract class BaseBinary extends Resource implements IBaseBinary {
@Override
public String getContentAsBase64() {
return getContentElement().getValueAsString();
}
@Override
public BaseBinary setContentAsBase64(String theContent) {
if (theContent != null) {
getContentElement().setValueAsString(theContent);
} else {
setContent(null);
}
return this;
}
abstract Base64BinaryType getContentElement();
}

View File

@ -0,0 +1,621 @@
package org.hl7.fhir.dstu21.model;
import static org.hl7.fhir.dstu21.model.TemporalPrecisionEnum.DAY;
import static org.hl7.fhir.dstu21.model.TemporalPrecisionEnum.MONTH;
import static org.hl7.fhir.dstu21.model.TemporalPrecisionEnum.YEAR;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
import java.util.TimeZone;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.commons.lang3.time.FastDateFormat;
public abstract class BaseDateTimeType extends PrimitiveType<Date> {
private static final long serialVersionUID = 1L;
/*
* Add any new formatters to the static block below!!
*/
private static final List<FastDateFormat> ourFormatters;
private static final Pattern ourYearDashMonthDashDayPattern = Pattern.compile("[0-9]{4}-[0-9]{2}-[0-9]{2}");
private static final Pattern ourYearDashMonthPattern = Pattern.compile("[0-9]{4}-[0-9]{2}");
private static final FastDateFormat ourYearFormat = FastDateFormat.getInstance("yyyy");
private static final FastDateFormat ourYearMonthDayFormat = FastDateFormat.getInstance("yyyy-MM-dd");
private static final FastDateFormat ourYearMonthDayNoDashesFormat = FastDateFormat.getInstance("yyyyMMdd");
private static final Pattern ourYearMonthDayPattern = Pattern.compile("[0-9]{4}[0-9]{2}[0-9]{2}");
private static final FastDateFormat ourYearMonthDayTimeFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss");
private static final FastDateFormat ourYearMonthDayTimeMilliFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS");
private static final FastDateFormat ourYearMonthDayTimeMilliUTCZFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", TimeZone.getTimeZone("UTC"));
private static final FastDateFormat ourYearMonthDayTimeMilliZoneFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSZZ");
private static final FastDateFormat ourYearMonthDayTimeUTCZFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss'Z'", TimeZone.getTimeZone("UTC"));
private static final FastDateFormat ourYearMonthDayTimeZoneFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ssZZ");
private static final FastDateFormat ourYearMonthFormat = FastDateFormat.getInstance("yyyy-MM");
private static final FastDateFormat ourYearMonthNoDashesFormat = FastDateFormat.getInstance("yyyyMM");
private static final Pattern ourYearMonthPattern = Pattern.compile("[0-9]{4}[0-9]{2}");
private static final Pattern ourYearPattern = Pattern.compile("[0-9]{4}");
private static final FastDateFormat ourYearMonthDayTimeMinsFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm");
private static final FastDateFormat ourYearMonthDayTimeMinsUTCZFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm'Z'", TimeZone.getTimeZone("UTC"));
private static final FastDateFormat ourYearMonthDayTimeMinsZoneFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mmZZ");
private static final FastDateFormat ourHumanDateTimeFormat = FastDateFormat.getDateTimeInstance(FastDateFormat.MEDIUM, FastDateFormat.MEDIUM);
private static final FastDateFormat ourHumanDateFormat = FastDateFormat.getDateInstance(FastDateFormat.MEDIUM);
static {
ArrayList<FastDateFormat> formatters = new ArrayList<FastDateFormat>();
formatters.add(ourYearFormat);
formatters.add(ourYearMonthDayFormat);
formatters.add(ourYearMonthDayNoDashesFormat);
formatters.add(ourYearMonthDayTimeFormat);
formatters.add(ourYearMonthDayTimeUTCZFormat);
formatters.add(ourYearMonthDayTimeZoneFormat);
formatters.add(ourYearMonthDayTimeMilliFormat);
formatters.add(ourYearMonthDayTimeMilliUTCZFormat);
formatters.add(ourYearMonthDayTimeMilliZoneFormat);
formatters.add(ourYearMonthDayTimeMinsFormat);
formatters.add(ourYearMonthDayTimeMinsUTCZFormat);
formatters.add(ourYearMonthDayTimeMinsZoneFormat);
formatters.add(ourYearMonthFormat);
formatters.add(ourYearMonthNoDashesFormat);
ourFormatters = Collections.unmodifiableList(formatters);
}
private TemporalPrecisionEnum myPrecision = TemporalPrecisionEnum.SECOND;
private TimeZone myTimeZone;
private boolean myTimeZoneZulu = false;
/**
* Constructor
*/
public BaseDateTimeType() {
// nothing
}
/**
* Constructor
*
* @throws IllegalArgumentException
* If the specified precision is not allowed for this type
*/
public BaseDateTimeType(Date theDate, TemporalPrecisionEnum thePrecision) {
setValue(theDate, thePrecision);
if (isPrecisionAllowed(thePrecision) == false) {
throw new IllegalArgumentException("Invalid date/time string (datatype " + getClass().getSimpleName() + " does not support " + thePrecision + " precision): " + theDate);
}
}
/**
* Constructor
*
* @throws IllegalArgumentException
* If the specified precision is not allowed for this type
*/
public BaseDateTimeType(String theString) {
setValueAsString(theString);
if (isPrecisionAllowed(getPrecision()) == false) {
throw new IllegalArgumentException("Invalid date/time string (datatype " + getClass().getSimpleName() + " does not support " + getPrecision() + " precision): " + theString);
}
}
/**
* Constructor
*/
public BaseDateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimeZone) {
this(theDate, thePrecision);
setTimeZone(theTimeZone);
}
private void clearTimeZone() {
myTimeZone = null;
myTimeZoneZulu = false;
}
@Override
protected String encode(Date theValue) {
if (theValue == null) {
return null;
} else {
switch (myPrecision) {
case DAY:
return ourYearMonthDayFormat.format(theValue);
case MONTH:
return ourYearMonthFormat.format(theValue);
case YEAR:
return ourYearFormat.format(theValue);
case MINUTE:
if (myTimeZoneZulu) {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.setTime(theValue);
return ourYearMonthDayTimeMinsFormat.format(cal) + "Z";
} else if (myTimeZone != null) {
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
cal.setTime(theValue);
return (ourYearMonthDayTimeMinsZoneFormat.format(cal));
} else {
return ourYearMonthDayTimeMinsFormat.format(theValue);
}
case SECOND:
if (myTimeZoneZulu) {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.setTime(theValue);
return ourYearMonthDayTimeFormat.format(cal) + "Z";
} else if (myTimeZone != null) {
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
cal.setTime(theValue);
return (ourYearMonthDayTimeZoneFormat.format(cal));
} else {
return ourYearMonthDayTimeFormat.format(theValue);
}
case MILLI:
if (myTimeZoneZulu) {
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
cal.setTime(theValue);
return ourYearMonthDayTimeMilliFormat.format(cal) + "Z";
} else if (myTimeZone != null) {
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
cal.setTime(theValue);
return (ourYearMonthDayTimeMilliZoneFormat.format(cal));
} else {
return ourYearMonthDayTimeMilliFormat.format(theValue);
}
}
throw new IllegalStateException("Invalid precision (this is a bug, shouldn't happen): " + myPrecision);
}
}
/**
* Returns the default precision for the given datatype
*/
protected abstract TemporalPrecisionEnum getDefaultPrecisionForDatatype();
/**
* Gets the precision for this datatype (using the default for the given type if not set)
*
* @see #setPrecision(TemporalPrecisionEnum)
*/
public TemporalPrecisionEnum getPrecision() {
if (myPrecision == null) {
return getDefaultPrecisionForDatatype();
}
return myPrecision;
}
/**
* Returns the TimeZone associated with this dateTime's value. May return <code>null</code> if no timezone was
* supplied.
*/
public TimeZone getTimeZone() {
return myTimeZone;
}
private boolean hasOffset(String theValue) {
boolean inTime = false;
for (int i = 0; i < theValue.length(); i++) {
switch (theValue.charAt(i)) {
case 'T':
inTime = true;
break;
case '+':
case '-':
if (inTime) {
return true;
}
break;
}
}
return false;
}
/**
* To be implemented by subclasses to indicate whether the given precision is allowed by this type
*/
abstract boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision);
public boolean isTimeZoneZulu() {
return myTimeZoneZulu;
}
/**
* Returns <code>true</code> if this object represents a date that is today's date
*
* @throws NullPointerException
* if {@link #getValue()} returns <code>null</code>
*/
public boolean isToday() {
Validate.notNull(getValue(), getClass().getSimpleName() + " contains null value");
return DateUtils.isSameDay(new Date(), getValue());
}
@Override
protected Date parse(String theValue) throws IllegalArgumentException {
try {
if (theValue.length() == 4 && ourYearPattern.matcher(theValue).matches()) {
if (!isPrecisionAllowed(YEAR)) {
// ourLog.debug("Invalid date/time string (datatype " + getClass().getSimpleName() +
// " does not support YEAR precision): " + theValue);
}
setPrecision(YEAR);
clearTimeZone();
return ((ourYearFormat).parse(theValue));
} else if (theValue.length() == 6 && ourYearMonthPattern.matcher(theValue).matches()) {
// Eg. 198401 (allow this just to be lenient)
if (!isPrecisionAllowed(MONTH)) {
// ourLog.debug("Invalid date/time string (datatype " + getClass().getSimpleName() +
// " does not support DAY precision): " + theValue);
}
setPrecision(MONTH);
clearTimeZone();
return ((ourYearMonthNoDashesFormat).parse(theValue));
} else if (theValue.length() == 7 && ourYearDashMonthPattern.matcher(theValue).matches()) {
// E.g. 1984-01 (this is valid according to the spec)
if (!isPrecisionAllowed(MONTH)) {
// ourLog.debug("Invalid date/time string (datatype " + getClass().getSimpleName() +
// " does not support MONTH precision): " + theValue);
}
setPrecision(MONTH);
clearTimeZone();
return ((ourYearMonthFormat).parse(theValue));
} else if (theValue.length() == 8 && ourYearMonthDayPattern.matcher(theValue).matches()) {
// Eg. 19840101 (allow this just to be lenient)
if (!isPrecisionAllowed(DAY)) {
// ourLog.debug("Invalid date/time string (datatype " + getClass().getSimpleName() +
// " does not support DAY precision): " + theValue);
}
setPrecision(DAY);
clearTimeZone();
return ((ourYearMonthDayNoDashesFormat).parse(theValue));
} else if (theValue.length() == 10 && ourYearDashMonthDashDayPattern.matcher(theValue).matches()) {
// E.g. 1984-01-01 (this is valid according to the spec)
if (!isPrecisionAllowed(DAY)) {
// ourLog.debug("Invalid date/time string (datatype " + getClass().getSimpleName() +
// " does not support DAY precision): " + theValue);
}
setPrecision(DAY);
clearTimeZone();
return ((ourYearMonthDayFormat).parse(theValue));
} else if (theValue.length() >= 16) { // date and time with possible time zone
int firstColonIndex = theValue.indexOf(':');
if (firstColonIndex == -1) {
throw new IllegalArgumentException("Invalid date/time string: " + theValue);
}
boolean hasSeconds = theValue.length() > firstColonIndex+3 ? theValue.charAt(firstColonIndex+3) == ':' : false;
int dotIndex = theValue.length() >= 18 ? theValue.indexOf('.', 18): -1;
boolean hasMillis = dotIndex > -1;
// if (!hasMillis && !isPrecisionAllowed(SECOND)) {
// ourLog.debug("Invalid date/time string (data type does not support SECONDS precision): " +
// theValue);
// } else if (hasMillis && !isPrecisionAllowed(MILLI)) {
// ourLog.debug("Invalid date/time string (data type " + getClass().getSimpleName() +
// " does not support MILLIS precision):" + theValue);
// }
Date retVal;
if (hasMillis) {
try {
if (hasOffset(theValue)) {
retVal = ourYearMonthDayTimeMilliZoneFormat.parse(theValue);
} else if (theValue.endsWith("Z")) {
retVal = ourYearMonthDayTimeMilliUTCZFormat.parse(theValue);
} else {
retVal = ourYearMonthDayTimeMilliFormat.parse(theValue);
}
} catch (ParseException p2) {
throw new IllegalArgumentException("Invalid data/time string (" + p2.getMessage() + "): " + theValue);
}
setTimeZone(theValue, hasMillis);
setPrecision(TemporalPrecisionEnum.MILLI);
} else if (hasSeconds) {
try {
if (hasOffset(theValue)) {
retVal = ourYearMonthDayTimeZoneFormat.parse(theValue);
} else if (theValue.endsWith("Z")) {
retVal = ourYearMonthDayTimeUTCZFormat.parse(theValue);
} else {
retVal = ourYearMonthDayTimeFormat.parse(theValue);
}
} catch (ParseException p2) {
throw new IllegalArgumentException("Invalid data/time string (" + p2.getMessage() + "): " + theValue);
}
setTimeZone(theValue, hasMillis);
setPrecision(TemporalPrecisionEnum.SECOND);
} else {
try {
if (hasOffset(theValue)) {
retVal = ourYearMonthDayTimeMinsZoneFormat.parse(theValue);
} else if (theValue.endsWith("Z")) {
retVal = ourYearMonthDayTimeMinsUTCZFormat.parse(theValue);
} else {
retVal = ourYearMonthDayTimeMinsFormat.parse(theValue);
}
} catch (ParseException p2) {
throw new IllegalArgumentException("Invalid data/time string (" + p2.getMessage() + "): " + theValue, p2);
}
setTimeZone(theValue, hasMillis);
setPrecision(TemporalPrecisionEnum.MINUTE);
}
return retVal;
} else {
throw new IllegalArgumentException("Invalid date/time string (invalid length): " + theValue);
}
} catch (ParseException e) {
throw new IllegalArgumentException("Invalid date string (" + e.getMessage() + "): " + theValue);
}
}
/**
* Sets the precision for this datatype using field values from {@link Calendar}. Valid values are:
* <ul>
* <li>{@link Calendar#SECOND}
* <li>{@link Calendar#DAY_OF_MONTH}
* <li>{@link Calendar#MONTH}
* <li>{@link Calendar#YEAR}
* </ul>
*
* @throws IllegalArgumentException
*/
public void setPrecision(TemporalPrecisionEnum thePrecision) throws IllegalArgumentException {
if (thePrecision == null) {
throw new NullPointerException("Precision may not be null");
}
myPrecision = thePrecision;
updateStringValue();
}
private void setTimeZone(String theValueString, boolean hasMillis) {
clearTimeZone();
int timeZoneStart = 19;
if (hasMillis)
timeZoneStart += 4;
if (theValueString.endsWith("Z")) {
setTimeZoneZulu(true);
} else if (theValueString.indexOf("GMT", timeZoneStart) != -1) {
setTimeZone(TimeZone.getTimeZone(theValueString.substring(timeZoneStart)));
} else if (theValueString.indexOf('+', timeZoneStart) != -1 || theValueString.indexOf('-', timeZoneStart) != -1) {
setTimeZone(TimeZone.getTimeZone("GMT" + theValueString.substring(timeZoneStart)));
}
}
public void setTimeZone(TimeZone theTimeZone) {
myTimeZone = theTimeZone;
updateStringValue();
}
public void setTimeZoneZulu(boolean theTimeZoneZulu) {
myTimeZoneZulu = theTimeZoneZulu;
updateStringValue();
}
/**
* Sets the value of this date/time using the default level of precision
* for this datatype
* using the system local time zone
*
* @param theValue
* The date value
*/
@Override
public BaseDateTimeType setValue(Date theValue) {
if (myTimeZoneZulu == false && myTimeZone == null) {
myTimeZone = TimeZone.getDefault();
}
myPrecision = getDefaultPrecisionForDatatype();
BaseDateTimeType retVal = (BaseDateTimeType) super.setValue(theValue);
return retVal;
}
/**
* Sets the value of this date/time using the specified level of precision
* using the system local time zone
*
* @param theValue
* The date value
* @param thePrecision
* The precision
* @throws IllegalArgumentException
*/
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws IllegalArgumentException {
if (myTimeZoneZulu == false && myTimeZone == null) {
myTimeZone = TimeZone.getDefault();
}
myPrecision = thePrecision;
super.setValue(theValue);
}
@Override
public void setValueAsString(String theValue) throws IllegalArgumentException {
clearTimeZone();
super.setValueAsString(theValue);
}
/**
* For unit tests only
*/
static List<FastDateFormat> getFormatters() {
return ourFormatters;
}
public boolean before(DateTimeType theDateTimeType) {
return getValue().before(theDateTimeType.getValue());
}
public boolean after(DateTimeType theDateTimeType) {
return getValue().after(theDateTimeType.getValue());
}
/**
* Returns a human readable version of this date/time using the system local format.
* <p>
* <b>Note on time zones:</b> This method renders the value using the time zone
* that is contained within the value. For example, if this date object contains the
* value "2012-01-05T12:00:00-08:00", the human display will be rendered as "12:00:00"
* even if the application is being executed on a system in a different time zone. If
* this behaviour is not what you want, use {@link #toHumanDisplayLocalTimezone()}
* instead.
* </p>
*/
public String toHumanDisplay() {
TimeZone tz = getTimeZone();
Calendar value = tz != null ? Calendar.getInstance(tz) : Calendar.getInstance();
value.setTime(getValue());
switch (getPrecision()) {
case YEAR:
case MONTH:
case DAY:
return ourHumanDateFormat.format(value);
case MILLI:
case SECOND:
default:
return ourHumanDateTimeFormat.format(value);
}
}
/**
* Returns a human readable version of this date/time using the system local format,
* converted to the local timezone if neccesary.
*
* @see #toHumanDisplay() for a method which does not convert the time to the local
* timezone before rendering it.
*/
public String toHumanDisplayLocalTimezone() {
switch (getPrecision()) {
case YEAR:
case MONTH:
case DAY:
return ourHumanDateFormat.format(getValue());
case MILLI:
case SECOND:
default:
return ourHumanDateTimeFormat.format(getValue());
}
}
/**
* Returns a view of this date/time as a Calendar object
*/
public Calendar toCalendar() {
Calendar retVal = Calendar.getInstance();
retVal.setTime(getValue());
retVal.setTimeZone(getTimeZone());
return retVal;
}
/**
* Sets the TimeZone offset in minutes relative to GMT
*/
public void setOffsetMinutes(int theZoneOffsetMinutes) {
int offsetAbs = Math.abs(theZoneOffsetMinutes);
int mins = offsetAbs % 60;
int hours = offsetAbs / 60;
if (theZoneOffsetMinutes < 0) {
setTimeZone(TimeZone.getTimeZone("GMT-" + hours + ":" + mins));
} else {
setTimeZone(TimeZone.getTimeZone("GMT+" + hours + ":" + mins));
}
}
/**
* Returns the time in millis as represented by this Date/Time
*/
public long getTime() {
return getValue().getTime();
}
/**
* Adds the given amount to the field specified by theField
*
* @param theField
* The field, uses constants from {@link Calendar} such as {@link Calendar#YEAR}
* @param theValue
* The number to add (or subtract for a negative number)
*/
public void add(int theField, int theValue) {
switch (theField) {
case Calendar.YEAR:
setValue(DateUtils.addYears(getValue(), theValue), getPrecision());
break;
case Calendar.MONTH:
setValue(DateUtils.addMonths(getValue(), theValue), getPrecision());
break;
case Calendar.DATE:
setValue(DateUtils.addDays(getValue(), theValue), getPrecision());
break;
case Calendar.HOUR:
setValue(DateUtils.addHours(getValue(), theValue), getPrecision());
break;
case Calendar.MINUTE:
setValue(DateUtils.addMinutes(getValue(), theValue), getPrecision());
break;
case Calendar.SECOND:
setValue(DateUtils.addSeconds(getValue(), theValue), getPrecision());
break;
case Calendar.MILLISECOND:
setValue(DateUtils.addMilliseconds(getValue(), theValue), getPrecision());
break;
default:
throw new IllegalArgumentException("Unknown field constant: " + theField);
}
}
protected void setValueAsV3String(String theV3String) {
if (StringUtils.isBlank(theV3String)) {
setValue(null);
} else {
StringBuilder b = new StringBuilder();
String timeZone = null;
for (int i = 0; i < theV3String.length(); i++) {
char nextChar = theV3String.charAt(i);
if (nextChar == '+' || nextChar == '-' || nextChar == 'Z') {
timeZone = (theV3String.substring(i));
break;
}
// assertEquals("2013-02-02T20:13:03-05:00", DateAndTime.parseV3("20130202201303-0500").toString());
if (i == 4 || i == 6) {
b.append('-');
} else if (i == 8) {
b.append('T');
} else if (i == 10 || i == 12) {
b.append(':');
}
b.append(nextChar);
}
if (b.length() == 16)
b.append(":00"); // schema rule, must have seconds
if (timeZone != null && b.length() > 10) {
if (timeZone.length() ==5) {
b.append(timeZone.substring(0, 3));
b.append(':');
b.append(timeZone.substring(3));
}else {
b.append(timeZone);
}
}
setValueAsString(b.toString());
}
}
}

View File

@ -0,0 +1,17 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
public abstract class BaseExtension extends Type implements IBaseExtension<Extension, Type>, IBaseHasExtensions {
@Override
public Extension setValue(IBaseDatatype theValue) {
setValue((Type)theValue);
return (Extension) this;
}
public abstract Extension setValue(Type theValue);
}

View File

@ -0,0 +1,39 @@
package org.hl7.fhir.dstu21.model;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.instance.model.api.INarrative;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
public abstract class BaseNarrative extends Type implements INarrative {
/**
* Sets the value of
*
* @param theString
* @throws Exception
*/
public void setDivAsString(String theString) {
XhtmlNode div;
if (StringUtils.isNotBlank(theString)) {
div = new XhtmlNode();
div.setValueAsString(theString);
} else {
div = null;
}
setDiv(div);
}
protected abstract BaseNarrative setDiv(XhtmlNode theDiv);
public String getDivAsString() {
XhtmlNode div = getDiv();
if (div != null && !div.isEmpty()) {
return div.getValueAsString();
} else {
return null;
}
}
protected abstract XhtmlNode getDiv();
}

View File

@ -0,0 +1,65 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseReference;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.instance.model.api.IIdType;
public abstract class BaseReference extends Type implements IBaseReference, ICompositeType {
/**
* This is not a part of the "wire format" resource, but can be changed/accessed by parsers
*/
private transient IBaseResource resource;
public BaseReference(String theReference) {
setReference(theReference);
}
public BaseReference(IdType theReference) {
if (theReference != null) {
setReference(theReference.getValue());
} else {
setReference(null);
}
}
public BaseReference(IAnyResource theResource) {
resource = theResource;
}
public BaseReference() {
}
/**
* Retrieves the actual resource referenced by this reference. Note that the resource itself is not
* a part of the FHIR "wire format" and is never transmitted or receieved inline, but this property
* may be changed/accessed by parsers.
*/
public IBaseResource getResource() {
return resource;
}
@Override
public IIdType getReferenceElement() {
return new IdType(getReference());
}
abstract String getReference();
/**
* Sets the actual resource referenced by this reference. Note that the resource itself is not
* a part of the FHIR "wire format" and is never transmitted or receieved inline, but this property
* may be changed/accessed by parsers.
*/
public void setResource(IBaseResource theResource) {
resource = theResource;
}
@Override
public boolean isEmpty() {
return resource == null && super.isEmpty();
}
}

View File

@ -0,0 +1,28 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IIdType;
import ca.uhn.fhir.model.api.IElement;
public abstract class BaseResource extends Base implements IAnyResource, IElement {
private static final long serialVersionUID = 1L;
/**
* @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes.
*/
public BaseResource setId(IIdType value) {
if (value == null) {
setIdElement((IdType)null);
} else if (value instanceof IdType) {
setIdElement((IdType) value);
} else {
setIdElement(new IdType(value.getValue()));
}
return this;
}
public abstract BaseResource setIdElement(IdType theIdType);
}

View File

@ -0,0 +1,421 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Basic is used for handling concepts not yet defined in FHIR, narrative-only resources that don't map to an existing resource, and custom resources not appropriate for inclusion in the FHIR specification.
*/
@ResourceDef(name="Basic", profile="http://hl7.org/fhir/Profile/Basic")
public class Basic extends DomainResource {
/**
* Identifier assigned to the resource for business purposes, outside the context of FHIR.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the resource for business purposes, outside the context of FHIR." )
protected List<Identifier> identifier;
/**
* Identifies the 'type' of resource - equivalent to the resource name for other resources.
*/
@Child(name = "code", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="Kind of Resource", formalDefinition="Identifies the 'type' of resource - equivalent to the resource name for other resources." )
protected CodeableConcept code;
/**
* Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.
*/
@Child(name = "subject", type = {}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Identifies the focus of this resource", formalDefinition="Identifies the patient, practitioner, device or any other resource that is the \"focus\" of this resource." )
protected Reference subject;
/**
* The actual object that is the target of the reference (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.)
*/
protected Resource subjectTarget;
/**
* Indicates who was responsible for creating the resource instance.
*/
@Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who created", formalDefinition="Indicates who was responsible for creating the resource instance." )
protected Reference author;
/**
* The actual object that is the target of the reference (Indicates who was responsible for creating the resource instance.)
*/
protected Resource authorTarget;
/**
* Identifies when the resource was first created.
*/
@Child(name = "created", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="When created", formalDefinition="Identifies when the resource was first created." )
protected DateType created;
private static final long serialVersionUID = 916539354L;
/*
* Constructor
*/
public Basic() {
super();
}
/*
* Constructor
*/
public Basic(CodeableConcept code) {
super();
this.code = code;
}
/**
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (Identifier assigned to the resource for business purposes, outside the context of FHIR.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public Basic addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.)
*/
public CodeableConcept getCode() {
if (this.code == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Basic.code");
else if (Configuration.doAutoCreate())
this.code = new CodeableConcept(); // cc
return this.code;
}
public boolean hasCode() {
return this.code != null && !this.code.isEmpty();
}
/**
* @param value {@link #code} (Identifies the 'type' of resource - equivalent to the resource name for other resources.)
*/
public Basic setCode(CodeableConcept value) {
this.code = value;
return this;
}
/**
* @return {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.)
*/
public Reference getSubject() {
if (this.subject == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Basic.subject");
else if (Configuration.doAutoCreate())
this.subject = new Reference(); // cc
return this.subject;
}
public boolean hasSubject() {
return this.subject != null && !this.subject.isEmpty();
}
/**
* @param value {@link #subject} (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.)
*/
public Basic setSubject(Reference value) {
this.subject = value;
return this;
}
/**
* @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.)
*/
public Resource getSubjectTarget() {
return this.subjectTarget;
}
/**
* @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient, practitioner, device or any other resource that is the "focus" of this resource.)
*/
public Basic setSubjectTarget(Resource value) {
this.subjectTarget = value;
return this;
}
/**
* @return {@link #author} (Indicates who was responsible for creating the resource instance.)
*/
public Reference getAuthor() {
if (this.author == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Basic.author");
else if (Configuration.doAutoCreate())
this.author = new Reference(); // cc
return this.author;
}
public boolean hasAuthor() {
return this.author != null && !this.author.isEmpty();
}
/**
* @param value {@link #author} (Indicates who was responsible for creating the resource instance.)
*/
public Basic setAuthor(Reference value) {
this.author = value;
return this;
}
/**
* @return {@link #author} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates who was responsible for creating the resource instance.)
*/
public Resource getAuthorTarget() {
return this.authorTarget;
}
/**
* @param value {@link #author} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates who was responsible for creating the resource instance.)
*/
public Basic setAuthorTarget(Resource value) {
this.authorTarget = value;
return this;
}
/**
* @return {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public DateType getCreatedElement() {
if (this.created == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Basic.created");
else if (Configuration.doAutoCreate())
this.created = new DateType(); // bb
return this.created;
}
public boolean hasCreatedElement() {
return this.created != null && !this.created.isEmpty();
}
public boolean hasCreated() {
return this.created != null && !this.created.isEmpty();
}
/**
* @param value {@link #created} (Identifies when the resource was first created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public Basic setCreatedElement(DateType value) {
this.created = value;
return this;
}
/**
* @return Identifies when the resource was first created.
*/
public Date getCreated() {
return this.created == null ? null : this.created.getValue();
}
/**
* @param value Identifies when the resource was first created.
*/
public Basic setCreated(Date value) {
if (value == null)
this.created = null;
else {
if (this.created == null)
this.created = new DateType();
this.created.setValue(value);
}
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the resource for business purposes, outside the context of FHIR.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("code", "CodeableConcept", "Identifies the 'type' of resource - equivalent to the resource name for other resources.", 0, java.lang.Integer.MAX_VALUE, code));
childrenList.add(new Property("subject", "Reference(Any)", "Identifies the patient, practitioner, device or any other resource that is the \"focus\" of this resource.", 0, java.lang.Integer.MAX_VALUE, subject));
childrenList.add(new Property("author", "Reference(Practitioner|Patient|RelatedPerson)", "Indicates who was responsible for creating the resource instance.", 0, java.lang.Integer.MAX_VALUE, author));
childrenList.add(new Property("created", "date", "Identifies when the resource was first created.", 0, java.lang.Integer.MAX_VALUE, created));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("code"))
this.code = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("subject"))
this.subject = castToReference(value); // Reference
else if (name.equals("author"))
this.author = castToReference(value); // Reference
else if (name.equals("created"))
this.created = castToDate(value); // DateType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("code")) {
this.code = new CodeableConcept();
return this.code;
}
else if (name.equals("subject")) {
this.subject = new Reference();
return this.subject;
}
else if (name.equals("author")) {
this.author = new Reference();
return this.author;
}
else if (name.equals("created")) {
throw new FHIRException("Cannot call addChild on a primitive type Basic.created");
}
else
return super.addChild(name);
}
public String fhirType() {
return "Basic";
}
public Basic copy() {
Basic dst = new Basic();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.code = code == null ? null : code.copy();
dst.subject = subject == null ? null : subject.copy();
dst.author = author == null ? null : author.copy();
dst.created = created == null ? null : created.copy();
return dst;
}
protected Basic typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Basic))
return false;
Basic o = (Basic) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true) && compareDeep(subject, o.subject, true)
&& compareDeep(author, o.author, true) && compareDeep(created, o.created, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Basic))
return false;
Basic o = (Basic) other;
return compareValues(created, o.created, true);
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (code == null || code.isEmpty())
&& (subject == null || subject.isEmpty()) && (author == null || author.isEmpty()) && (created == null || created.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Basic;
}
@SearchParamDefinition(name="identifier", path="Basic.identifier", description="Business identifier", type="token" )
public static final String SP_IDENTIFIER = "identifier";
@SearchParamDefinition(name="code", path="Basic.code", description="Kind of Resource", type="token" )
public static final String SP_CODE = "code";
@SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the focus of this resource", type="reference" )
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" )
public static final String SP_CREATED = "created";
@SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the focus of this resource", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="author", path="Basic.author", description="Who created", type="reference" )
public static final String SP_AUTHOR = "author";
}

View File

@ -0,0 +1,252 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A binary resource can contain any content, whether text, image, pdf, zip archive, etc.
*/
@ResourceDef(name="Binary", profile="http://hl7.org/fhir/Profile/Binary")
public class Binary extends BaseBinary implements IBaseBinary {
/**
* MimeType of the binary content represented as a standard MimeType (BCP 13).
*/
@Child(name = "contentType", type = {CodeType.class}, order=0, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="MimeType of the binary content", formalDefinition="MimeType of the binary content represented as a standard MimeType (BCP 13)." )
protected CodeType contentType;
/**
* The actual content, base64 encoded.
*/
@Child(name = "content", type = {Base64BinaryType.class}, order=1, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="The actual content", formalDefinition="The actual content, base64 encoded." )
protected Base64BinaryType content;
private static final long serialVersionUID = 974764407L;
/*
* Constructor
*/
public Binary() {
super();
}
/*
* Constructor
*/
public Binary(CodeType contentType, Base64BinaryType content) {
super();
this.contentType = contentType;
this.content = content;
}
/**
* @return {@link #contentType} (MimeType of the binary content represented as a standard MimeType (BCP 13).). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
*/
public CodeType getContentTypeElement() {
if (this.contentType == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Binary.contentType");
else if (Configuration.doAutoCreate())
this.contentType = new CodeType(); // bb
return this.contentType;
}
public boolean hasContentTypeElement() {
return this.contentType != null && !this.contentType.isEmpty();
}
public boolean hasContentType() {
return this.contentType != null && !this.contentType.isEmpty();
}
/**
* @param value {@link #contentType} (MimeType of the binary content represented as a standard MimeType (BCP 13).). This is the underlying object with id, value and extensions. The accessor "getContentType" gives direct access to the value
*/
public Binary setContentTypeElement(CodeType value) {
this.contentType = value;
return this;
}
/**
* @return MimeType of the binary content represented as a standard MimeType (BCP 13).
*/
public String getContentType() {
return this.contentType == null ? null : this.contentType.getValue();
}
/**
* @param value MimeType of the binary content represented as a standard MimeType (BCP 13).
*/
public Binary setContentType(String value) {
if (this.contentType == null)
this.contentType = new CodeType();
this.contentType.setValue(value);
return this;
}
/**
* @return {@link #content} (The actual content, base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value
*/
public Base64BinaryType getContentElement() {
if (this.content == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Binary.content");
else if (Configuration.doAutoCreate())
this.content = new Base64BinaryType(); // bb
return this.content;
}
public boolean hasContentElement() {
return this.content != null && !this.content.isEmpty();
}
public boolean hasContent() {
return this.content != null && !this.content.isEmpty();
}
/**
* @param value {@link #content} (The actual content, base64 encoded.). This is the underlying object with id, value and extensions. The accessor "getContent" gives direct access to the value
*/
public Binary setContentElement(Base64BinaryType value) {
this.content = value;
return this;
}
/**
* @return The actual content, base64 encoded.
*/
public byte[] getContent() {
return this.content == null ? null : this.content.getValue();
}
/**
* @param value The actual content, base64 encoded.
*/
public Binary setContent(byte[] value) {
if (this.content == null)
this.content = new Base64BinaryType();
this.content.setValue(value);
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("contentType", "code", "MimeType of the binary content represented as a standard MimeType (BCP 13).", 0, java.lang.Integer.MAX_VALUE, contentType));
childrenList.add(new Property("content", "base64Binary", "The actual content, base64 encoded.", 0, java.lang.Integer.MAX_VALUE, content));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("contentType"))
this.contentType = castToCode(value); // CodeType
else if (name.equals("content"))
this.content = castToBase64Binary(value); // Base64BinaryType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("contentType")) {
throw new FHIRException("Cannot call addChild on a primitive type Binary.contentType");
}
else if (name.equals("content")) {
throw new FHIRException("Cannot call addChild on a primitive type Binary.content");
}
else
return super.addChild(name);
}
public String fhirType() {
return "Binary";
}
public Binary copy() {
Binary dst = new Binary();
copyValues(dst);
dst.contentType = contentType == null ? null : contentType.copy();
dst.content = content == null ? null : content.copy();
return dst;
}
protected Binary typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Binary))
return false;
Binary o = (Binary) other;
return compareDeep(contentType, o.contentType, true) && compareDeep(content, o.content, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Binary))
return false;
Binary o = (Binary) other;
return compareValues(contentType, o.contentType, true) && compareValues(content, o.content, true);
}
public boolean isEmpty() {
return super.isEmpty() && (contentType == null || contentType.isEmpty()) && (content == null || content.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Binary;
}
@SearchParamDefinition(name="contenttype", path="Binary.contentType", description="MimeType of the binary content", type="token" )
public static final String SP_CONTENTTYPE = "contenttype";
}

View File

@ -0,0 +1,479 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Record details about the anatomical location of a specimen or body part. This resource may be used when a coded concept does not provide the necessary detail needed for the use case.
*/
@ResourceDef(name="BodySite", profile="http://hl7.org/fhir/Profile/BodySite")
public class BodySite extends DomainResource {
/**
* The person to which the body site belongs.
*/
@Child(name = "patient", type = {Patient.class}, order=0, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Patient", formalDefinition="The person to which the body site belongs." )
protected Reference patient;
/**
* The actual object that is the target of the reference (The person to which the body site belongs.)
*/
protected Patient patientTarget;
/**
* Identifier for this instance of the anatomical location.
*/
@Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Bodysite identifier", formalDefinition="Identifier for this instance of the anatomical location." )
protected List<Identifier> identifier;
/**
* Named anatomical location - ideally coded where possible.
*/
@Child(name = "code", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Named anatomical location", formalDefinition="Named anatomical location - ideally coded where possible." )
protected CodeableConcept code;
/**
* Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.
*/
@Child(name = "modifier", type = {CodeableConcept.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Modification to location code", formalDefinition="Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane." )
protected List<CodeableConcept> modifier;
/**
* Description of anatomical location.
*/
@Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="The Description of anatomical location", formalDefinition="Description of anatomical location." )
protected StringType description;
/**
* Image or images used to identify a location.
*/
@Child(name = "image", type = {Attachment.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Attached images", formalDefinition="Image or images used to identify a location." )
protected List<Attachment> image;
private static final long serialVersionUID = 1568109920L;
/*
* Constructor
*/
public BodySite() {
super();
}
/*
* Constructor
*/
public BodySite(Reference patient) {
super();
this.patient = patient;
}
/**
* @return {@link #patient} (The person to which the body site belongs.)
*/
public Reference getPatient() {
if (this.patient == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create BodySite.patient");
else if (Configuration.doAutoCreate())
this.patient = new Reference(); // cc
return this.patient;
}
public boolean hasPatient() {
return this.patient != null && !this.patient.isEmpty();
}
/**
* @param value {@link #patient} (The person to which the body site belongs.)
*/
public BodySite setPatient(Reference value) {
this.patient = value;
return this;
}
/**
* @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person to which the body site belongs.)
*/
public Patient getPatientTarget() {
if (this.patientTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create BodySite.patient");
else if (Configuration.doAutoCreate())
this.patientTarget = new Patient(); // aa
return this.patientTarget;
}
/**
* @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person to which the body site belongs.)
*/
public BodySite setPatientTarget(Patient value) {
this.patientTarget = value;
return this;
}
/**
* @return {@link #identifier} (Identifier for this instance of the anatomical location.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (Identifier for this instance of the anatomical location.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public BodySite addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #code} (Named anatomical location - ideally coded where possible.)
*/
public CodeableConcept getCode() {
if (this.code == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create BodySite.code");
else if (Configuration.doAutoCreate())
this.code = new CodeableConcept(); // cc
return this.code;
}
public boolean hasCode() {
return this.code != null && !this.code.isEmpty();
}
/**
* @param value {@link #code} (Named anatomical location - ideally coded where possible.)
*/
public BodySite setCode(CodeableConcept value) {
this.code = value;
return this;
}
/**
* @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.)
*/
public List<CodeableConcept> getModifier() {
if (this.modifier == null)
this.modifier = new ArrayList<CodeableConcept>();
return this.modifier;
}
public boolean hasModifier() {
if (this.modifier == null)
return false;
for (CodeableConcept item : this.modifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #modifier} (Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.)
*/
// syntactic sugar
public CodeableConcept addModifier() { //3
CodeableConcept t = new CodeableConcept();
if (this.modifier == null)
this.modifier = new ArrayList<CodeableConcept>();
this.modifier.add(t);
return t;
}
// syntactic sugar
public BodySite addModifier(CodeableConcept t) { //3
if (t == null)
return this;
if (this.modifier == null)
this.modifier = new ArrayList<CodeableConcept>();
this.modifier.add(t);
return this;
}
/**
* @return {@link #description} (Description of anatomical location.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
*/
public StringType getDescriptionElement() {
if (this.description == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create BodySite.description");
else if (Configuration.doAutoCreate())
this.description = new StringType(); // bb
return this.description;
}
public boolean hasDescriptionElement() {
return this.description != null && !this.description.isEmpty();
}
public boolean hasDescription() {
return this.description != null && !this.description.isEmpty();
}
/**
* @param value {@link #description} (Description of anatomical location.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
*/
public BodySite setDescriptionElement(StringType value) {
this.description = value;
return this;
}
/**
* @return Description of anatomical location.
*/
public String getDescription() {
return this.description == null ? null : this.description.getValue();
}
/**
* @param value Description of anatomical location.
*/
public BodySite setDescription(String value) {
if (Utilities.noString(value))
this.description = null;
else {
if (this.description == null)
this.description = new StringType();
this.description.setValue(value);
}
return this;
}
/**
* @return {@link #image} (Image or images used to identify a location.)
*/
public List<Attachment> getImage() {
if (this.image == null)
this.image = new ArrayList<Attachment>();
return this.image;
}
public boolean hasImage() {
if (this.image == null)
return false;
for (Attachment item : this.image)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #image} (Image or images used to identify a location.)
*/
// syntactic sugar
public Attachment addImage() { //3
Attachment t = new Attachment();
if (this.image == null)
this.image = new ArrayList<Attachment>();
this.image.add(t);
return t;
}
// syntactic sugar
public BodySite addImage(Attachment t) { //3
if (t == null)
return this;
if (this.image == null)
this.image = new ArrayList<Attachment>();
this.image.add(t);
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("patient", "Reference(Patient)", "The person to which the body site belongs.", 0, java.lang.Integer.MAX_VALUE, patient));
childrenList.add(new Property("identifier", "Identifier", "Identifier for this instance of the anatomical location.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("code", "CodeableConcept", "Named anatomical location - ideally coded where possible.", 0, java.lang.Integer.MAX_VALUE, code));
childrenList.add(new Property("modifier", "CodeableConcept", "Modifier to refine the anatomical location. These include modifiers for laterality, relative location, directionality, number, and plane.", 0, java.lang.Integer.MAX_VALUE, modifier));
childrenList.add(new Property("description", "string", "Description of anatomical location.", 0, java.lang.Integer.MAX_VALUE, description));
childrenList.add(new Property("image", "Attachment", "Image or images used to identify a location.", 0, java.lang.Integer.MAX_VALUE, image));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("patient"))
this.patient = castToReference(value); // Reference
else if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("code"))
this.code = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("modifier"))
this.getModifier().add(castToCodeableConcept(value));
else if (name.equals("description"))
this.description = castToString(value); // StringType
else if (name.equals("image"))
this.getImage().add(castToAttachment(value));
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("patient")) {
this.patient = new Reference();
return this.patient;
}
else if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("code")) {
this.code = new CodeableConcept();
return this.code;
}
else if (name.equals("modifier")) {
return addModifier();
}
else if (name.equals("description")) {
throw new FHIRException("Cannot call addChild on a primitive type BodySite.description");
}
else if (name.equals("image")) {
return addImage();
}
else
return super.addChild(name);
}
public String fhirType() {
return "BodySite";
}
public BodySite copy() {
BodySite dst = new BodySite();
copyValues(dst);
dst.patient = patient == null ? null : patient.copy();
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.code = code == null ? null : code.copy();
if (modifier != null) {
dst.modifier = new ArrayList<CodeableConcept>();
for (CodeableConcept i : modifier)
dst.modifier.add(i.copy());
};
dst.description = description == null ? null : description.copy();
if (image != null) {
dst.image = new ArrayList<Attachment>();
for (Attachment i : image)
dst.image.add(i.copy());
};
return dst;
}
protected BodySite typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof BodySite))
return false;
BodySite o = (BodySite) other;
return compareDeep(patient, o.patient, true) && compareDeep(identifier, o.identifier, true) && compareDeep(code, o.code, true)
&& compareDeep(modifier, o.modifier, true) && compareDeep(description, o.description, true) && compareDeep(image, o.image, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof BodySite))
return false;
BodySite o = (BodySite) other;
return compareValues(description, o.description, true);
}
public boolean isEmpty() {
return super.isEmpty() && (patient == null || patient.isEmpty()) && (identifier == null || identifier.isEmpty())
&& (code == null || code.isEmpty()) && (modifier == null || modifier.isEmpty()) && (description == null || description.isEmpty())
&& (image == null || image.isEmpty());
}
@Override
public ResourceType getResourceType() {
return ResourceType.BodySite;
}
@SearchParamDefinition(name="identifier", path="BodySite.identifier", description="Identifier for this instance of the anatomical location", type="token" )
public static final String SP_IDENTIFIER = "identifier";
@SearchParamDefinition(name="code", path="BodySite.code", description="Named anatomical location", type="token" )
public static final String SP_CODE = "code";
@SearchParamDefinition(name="patient", path="BodySite.patient", description="Patient to whom bodysite belongs", type="reference" )
public static final String SP_PATIENT = "patient";
}

View File

@ -0,0 +1,90 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
*/
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Primitive type "boolean" in FHIR "true" or "false"
*/
@DatatypeDef(name="boolean")
public class BooleanType extends PrimitiveType<Boolean> implements IBaseBooleanDatatype {
private static final long serialVersionUID = 3L;
public BooleanType() {
super();
}
public BooleanType(boolean theBoolean) {
super();
setValue(theBoolean);
}
public BooleanType(Boolean theBoolean) {
super();
setValue(theBoolean);
}
public BooleanType(String value) {
super();
setValueAsString(value);
}
protected Boolean parse(String theValue) {
String value = theValue.trim();
if ("true".equals(value)) {
return Boolean.TRUE;
} else if ("false".equals(value)) {
return Boolean.FALSE;
} else {
throw new IllegalArgumentException("Invalid boolean string: '" + theValue + "'");
}
}
protected String encode(Boolean theValue) {
if (Boolean.TRUE.equals(theValue)) {
return "true";
} else {
return "false";
}
}
public BooleanType copy() {
return new BooleanType(getValue());
}
public String fhirType() {
return "boolean";
}
}

View File

@ -0,0 +1,76 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
package org.hl7.fhir.dstu21.model;
import static org.apache.commons.lang3.StringUtils.defaultString;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Primitive type "code" in FHIR, when not bound to an enumerated list of codes
*/
@DatatypeDef(name="code", profileOf=StringType.class)
public class CodeType extends StringType implements Comparable<CodeType> {
private static final long serialVersionUID = 3L;
public CodeType() {
super();
}
public CodeType(String theCode) {
setValue(theCode);
}
public int compareTo(CodeType theCode) {
if (theCode == null) {
return 1;
}
return defaultString(getValue()).compareTo(defaultString(theCode.getValue()));
}
@Override
protected String parse(String theValue) {
return theValue.trim();
}
@Override
protected String encode(String theValue) {
return theValue;
}
@Override
public CodeType copy() {
return new CodeType(getValue());
}
public String fhirType() {
return "code";
}
}

View File

@ -0,0 +1,237 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A concept that may be defined by a formal reference to a terminology or ontology or may be provided by text.
*/
@DatatypeDef(name="CodeableConcept")
public class CodeableConcept extends Type implements ICompositeType {
/**
* A reference to a code defined by a terminology system.
*/
@Child(name = "coding", type = {Coding.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Code defined by a terminology system", formalDefinition="A reference to a code defined by a terminology system." )
protected List<Coding> coding;
/**
* A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
*/
@Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Plain text representation of the concept", formalDefinition="A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user." )
protected StringType text;
private static final long serialVersionUID = 760353246L;
/*
* Constructor
*/
public CodeableConcept() {
super();
}
/**
* @return {@link #coding} (A reference to a code defined by a terminology system.)
*/
public List<Coding> getCoding() {
if (this.coding == null)
this.coding = new ArrayList<Coding>();
return this.coding;
}
public boolean hasCoding() {
if (this.coding == null)
return false;
for (Coding item : this.coding)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #coding} (A reference to a code defined by a terminology system.)
*/
// syntactic sugar
public Coding addCoding() { //3
Coding t = new Coding();
if (this.coding == null)
this.coding = new ArrayList<Coding>();
this.coding.add(t);
return t;
}
// syntactic sugar
public CodeableConcept addCoding(Coding t) { //3
if (t == null)
return this;
if (this.coding == null)
this.coding = new ArrayList<Coding>();
this.coding.add(t);
return this;
}
/**
* @return {@link #text} (A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public StringType getTextElement() {
if (this.text == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create CodeableConcept.text");
else if (Configuration.doAutoCreate())
this.text = new StringType(); // bb
return this.text;
}
public boolean hasTextElement() {
return this.text != null && !this.text.isEmpty();
}
public boolean hasText() {
return this.text != null && !this.text.isEmpty();
}
/**
* @param value {@link #text} (A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public CodeableConcept setTextElement(StringType value) {
this.text = value;
return this;
}
/**
* @return A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
*/
public String getText() {
return this.text == null ? null : this.text.getValue();
}
/**
* @param value A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.
*/
public CodeableConcept setText(String value) {
if (Utilities.noString(value))
this.text = null;
else {
if (this.text == null)
this.text = new StringType();
this.text.setValue(value);
}
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("coding", "Coding", "A reference to a code defined by a terminology system.", 0, java.lang.Integer.MAX_VALUE, coding));
childrenList.add(new Property("text", "string", "A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.", 0, java.lang.Integer.MAX_VALUE, text));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("coding"))
this.getCoding().add(castToCoding(value));
else if (name.equals("text"))
this.text = castToString(value); // StringType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("coding")) {
return addCoding();
}
else if (name.equals("text")) {
throw new FHIRException("Cannot call addChild on a primitive type CodeableConcept.text");
}
else
return super.addChild(name);
}
public String fhirType() {
return "CodeableConcept";
}
public CodeableConcept copy() {
CodeableConcept dst = new CodeableConcept();
copyValues(dst);
if (coding != null) {
dst.coding = new ArrayList<Coding>();
for (Coding i : coding)
dst.coding.add(i.copy());
};
dst.text = text == null ? null : text.copy();
return dst;
}
protected CodeableConcept typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof CodeableConcept))
return false;
CodeableConcept o = (CodeableConcept) other;
return compareDeep(coding, o.coding, true) && compareDeep(text, o.text, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof CodeableConcept))
return false;
CodeableConcept o = (CodeableConcept) other;
return compareValues(text, o.text, true);
}
public boolean isEmpty() {
return super.isEmpty() && (coding == null || coding.isEmpty()) && (text == null || text.isEmpty())
;
}
}

View File

@ -0,0 +1,430 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A reference to a code defined by a terminology system.
*/
@DatatypeDef(name="Coding")
public class Coding extends Type implements IBaseCoding, ICompositeType {
/**
* The identification of the code system that defines the meaning of the symbol in the code.
*/
@Child(name = "system", type = {UriType.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Identity of the terminology system", formalDefinition="The identification of the code system that defines the meaning of the symbol in the code." )
protected UriType system;
/**
* The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
*/
@Child(name = "version", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Version of the system - if relevant", formalDefinition="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged." )
protected StringType version;
/**
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
*/
@Child(name = "code", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Symbol in syntax defined by the system", formalDefinition="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)." )
protected CodeType code;
/**
* A representation of the meaning of the code in the system, following the rules of the system.
*/
@Child(name = "display", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Representation defined by the system", formalDefinition="A representation of the meaning of the code in the system, following the rules of the system." )
protected StringType display;
/**
* Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
*/
@Child(name = "userSelected", type = {BooleanType.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="If this coding was chosen directly by the user", formalDefinition="Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays)." )
protected BooleanType userSelected;
private static final long serialVersionUID = -1417514061L;
/*
* Constructor
*/
public Coding() {
super();
}
/**
* @return {@link #system} (The identification of the code system that defines the meaning of the symbol in the code.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public UriType getSystemElement() {
if (this.system == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.system");
else if (Configuration.doAutoCreate())
this.system = new UriType(); // bb
return this.system;
}
public boolean hasSystemElement() {
return this.system != null && !this.system.isEmpty();
}
public boolean hasSystem() {
return this.system != null && !this.system.isEmpty();
}
/**
* @param value {@link #system} (The identification of the code system that defines the meaning of the symbol in the code.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public Coding setSystemElement(UriType value) {
this.system = value;
return this;
}
/**
* @return The identification of the code system that defines the meaning of the symbol in the code.
*/
public String getSystem() {
return this.system == null ? null : this.system.getValue();
}
/**
* @param value The identification of the code system that defines the meaning of the symbol in the code.
*/
public Coding setSystem(String value) {
if (Utilities.noString(value))
this.system = null;
else {
if (this.system == null)
this.system = new UriType();
this.system.setValue(value);
}
return this;
}
/**
* @return {@link #version} (The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
*/
public StringType getVersionElement() {
if (this.version == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.version");
else if (Configuration.doAutoCreate())
this.version = new StringType(); // bb
return this.version;
}
public boolean hasVersionElement() {
return this.version != null && !this.version.isEmpty();
}
public boolean hasVersion() {
return this.version != null && !this.version.isEmpty();
}
/**
* @param value {@link #version} (The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.). This is the underlying object with id, value and extensions. The accessor "getVersion" gives direct access to the value
*/
public Coding setVersionElement(StringType value) {
this.version = value;
return this;
}
/**
* @return The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
*/
public String getVersion() {
return this.version == null ? null : this.version.getValue();
}
/**
* @param value The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.
*/
public Coding setVersion(String value) {
if (Utilities.noString(value))
this.version = null;
else {
if (this.version == null)
this.version = new StringType();
this.version.setValue(value);
}
return this;
}
/**
* @return {@link #code} (A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/
public CodeType getCodeElement() {
if (this.code == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.code");
else if (Configuration.doAutoCreate())
this.code = new CodeType(); // bb
return this.code;
}
public boolean hasCodeElement() {
return this.code != null && !this.code.isEmpty();
}
public boolean hasCode() {
return this.code != null && !this.code.isEmpty();
}
/**
* @param value {@link #code} (A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).). This is the underlying object with id, value and extensions. The accessor "getCode" gives direct access to the value
*/
public Coding setCodeElement(CodeType value) {
this.code = value;
return this;
}
/**
* @return A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
*/
public String getCode() {
return this.code == null ? null : this.code.getValue();
}
/**
* @param value A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).
*/
public Coding setCode(String value) {
if (Utilities.noString(value))
this.code = null;
else {
if (this.code == null)
this.code = new CodeType();
this.code.setValue(value);
}
return this;
}
/**
* @return {@link #display} (A representation of the meaning of the code in the system, following the rules of the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
*/
public StringType getDisplayElement() {
if (this.display == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.display");
else if (Configuration.doAutoCreate())
this.display = new StringType(); // bb
return this.display;
}
public boolean hasDisplayElement() {
return this.display != null && !this.display.isEmpty();
}
public boolean hasDisplay() {
return this.display != null && !this.display.isEmpty();
}
/**
* @param value {@link #display} (A representation of the meaning of the code in the system, following the rules of the system.). This is the underlying object with id, value and extensions. The accessor "getDisplay" gives direct access to the value
*/
public Coding setDisplayElement(StringType value) {
this.display = value;
return this;
}
/**
* @return A representation of the meaning of the code in the system, following the rules of the system.
*/
public String getDisplay() {
return this.display == null ? null : this.display.getValue();
}
/**
* @param value A representation of the meaning of the code in the system, following the rules of the system.
*/
public Coding setDisplay(String value) {
if (Utilities.noString(value))
this.display = null;
else {
if (this.display == null)
this.display = new StringType();
this.display.setValue(value);
}
return this;
}
/**
* @return {@link #userSelected} (Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays).). This is the underlying object with id, value and extensions. The accessor "getUserSelected" gives direct access to the value
*/
public BooleanType getUserSelectedElement() {
if (this.userSelected == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coding.userSelected");
else if (Configuration.doAutoCreate())
this.userSelected = new BooleanType(); // bb
return this.userSelected;
}
public boolean hasUserSelectedElement() {
return this.userSelected != null && !this.userSelected.isEmpty();
}
public boolean hasUserSelected() {
return this.userSelected != null && !this.userSelected.isEmpty();
}
/**
* @param value {@link #userSelected} (Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays).). This is the underlying object with id, value and extensions. The accessor "getUserSelected" gives direct access to the value
*/
public Coding setUserSelectedElement(BooleanType value) {
this.userSelected = value;
return this;
}
/**
* @return Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
*/
public boolean getUserSelected() {
return this.userSelected == null || this.userSelected.isEmpty() ? false : this.userSelected.getValue();
}
/**
* @param value Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays).
*/
public Coding setUserSelected(boolean value) {
if (this.userSelected == null)
this.userSelected = new BooleanType();
this.userSelected.setValue(value);
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("system", "uri", "The identification of the code system that defines the meaning of the symbol in the code.", 0, java.lang.Integer.MAX_VALUE, system));
childrenList.add(new Property("version", "string", "The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.", 0, java.lang.Integer.MAX_VALUE, version));
childrenList.add(new Property("code", "code", "A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).", 0, java.lang.Integer.MAX_VALUE, code));
childrenList.add(new Property("display", "string", "A representation of the meaning of the code in the system, following the rules of the system.", 0, java.lang.Integer.MAX_VALUE, display));
childrenList.add(new Property("userSelected", "boolean", "Indicates that this coding was chosen by a user directly - i.e. off a pick list of available items (codes or displays).", 0, java.lang.Integer.MAX_VALUE, userSelected));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("system"))
this.system = castToUri(value); // UriType
else if (name.equals("version"))
this.version = castToString(value); // StringType
else if (name.equals("code"))
this.code = castToCode(value); // CodeType
else if (name.equals("display"))
this.display = castToString(value); // StringType
else if (name.equals("userSelected"))
this.userSelected = castToBoolean(value); // BooleanType
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("system")) {
throw new FHIRException("Cannot call addChild on a primitive type Coding.system");
}
else if (name.equals("version")) {
throw new FHIRException("Cannot call addChild on a primitive type Coding.version");
}
else if (name.equals("code")) {
throw new FHIRException("Cannot call addChild on a primitive type Coding.code");
}
else if (name.equals("display")) {
throw new FHIRException("Cannot call addChild on a primitive type Coding.display");
}
else if (name.equals("userSelected")) {
throw new FHIRException("Cannot call addChild on a primitive type Coding.userSelected");
}
else
return super.addChild(name);
}
public String fhirType() {
return "Coding";
}
public Coding copy() {
Coding dst = new Coding();
copyValues(dst);
dst.system = system == null ? null : system.copy();
dst.version = version == null ? null : version.copy();
dst.code = code == null ? null : code.copy();
dst.display = display == null ? null : display.copy();
dst.userSelected = userSelected == null ? null : userSelected.copy();
return dst;
}
protected Coding typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Coding))
return false;
Coding o = (Coding) other;
return compareDeep(system, o.system, true) && compareDeep(version, o.version, true) && compareDeep(code, o.code, true)
&& compareDeep(display, o.display, true) && compareDeep(userSelected, o.userSelected, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Coding))
return false;
Coding o = (Coding) other;
return compareValues(system, o.system, true) && compareValues(version, o.version, true) && compareValues(code, o.code, true)
&& compareValues(display, o.display, true) && compareValues(userSelected, o.userSelected, true);
}
public boolean isEmpty() {
return super.isEmpty() && (system == null || system.isEmpty()) && (version == null || version.isEmpty())
&& (code == null || code.isEmpty()) && (display == null || display.isEmpty()) && (userSelected == null || userSelected.isEmpty())
;
}
}

View File

@ -0,0 +1,110 @@
package org.hl7.fhir.dstu21.model;
import java.util.List;
import org.apache.commons.lang3.NotImplementedException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
/**
* See http://www.healthintersections.com.au/?p=1941
*
* @author Grahame
*
*/
public class Comparison {
public class MatchProfile {
}
public static boolean matches(String c1, String c2, MatchProfile profile) {
if (Utilities.noString(c1) || Utilities.noString(c2))
return false;
c1 = Utilities.normalize(c1);
c2 = Utilities.normalize(c2);
return c1.equals(c2);
}
public static <T extends Enum<?>> boolean matches(Enumeration<T> e1, Enumeration<T> e2, MatchProfile profile) {
if (e1 == null || e2 == null)
return false;
return e1.getValue().equals(e2.getValue());
}
public static boolean matches(CodeableConcept c1, CodeableConcept c2, MatchProfile profile) throws FHIRException {
if (profile != null)
throw new NotImplementedException("Not Implemented Yet");
if (c1.getCoding().isEmpty() && c2.getCoding().isEmpty()) {
return matches(c1.getText(), c2.getText(), null);
} else {
// in the absence of specific guidance, we just require that all codes match
boolean ok = true;
for (Coding c : c1.getCoding()) {
ok = ok && inList(c2.getCoding(), c, null);
}
for (Coding c : c2.getCoding()) {
ok = ok && inList(c1.getCoding(), c, null);
}
return ok;
}
}
public static void merge(CodeableConcept dst, CodeableConcept src) {
if (dst.getTextElement() == null && src.getTextElement() != null)
dst.setTextElement(src.getTextElement());
}
public static boolean inList(List<Coding> list, Coding c, MatchProfile profile) {
for (Coding item : list) {
if (matches(item, c, profile))
return true;
}
return false;
}
public static boolean matches(Coding c1, Coding c2, MatchProfile profile) {
if (profile != null)
throw new NotImplementedException("Not Implemented Yet");
// in the absence of a profile, we ignore version
return matches(c1.getSystem(), c2.getSystem(), null) && matches(c1.getCode(), c2.getCode(), null);
}
public static boolean matches(Identifier i1, Identifier i2, MatchProfile profile) {
if (profile != null)
throw new NotImplementedException("Not Implemented Yet");
// in the absence of a profile, we ignore version
return matches(i1.getSystem(), i2.getSystem(), null) && matches(i1.getValue(), i2.getValue(), null);
}
public static void merge(Identifier dst, Identifier src) {
if (dst.getUseElement() == null && src.getUseElement() != null)
dst.setUseElement(src.getUseElement());
if (dst.getType() == null && src.getType() != null)
dst.setType(src.getType());
if (dst.getPeriod() == null && src.getPeriod() != null)
dst.setPeriod(src.getPeriod());
if (dst.getAssigner() == null && src.getAssigner() != null)
dst.setAssigner(src.getAssigner());
}
public static boolean matches(ContactPoint c1, ContactPoint c2, Object profile) {
if (profile != null)
throw new NotImplementedException("Not Implemented Yet");
// in the absence of a profile, we insist on system
return matches(c1.getSystemElement(), c2.getSystemElement(), null) && matches(c1.getValue(), c2.getValue(), null);
}
public static void merge(ContactPoint dst, ContactPoint src) {
if (dst.getUseElement() == null && src.getUseElement() != null)
dst.setUseElement(src.getUseElement());
if (dst.getPeriod() == null && src.getPeriod() != null)
dst.setPeriod(src.getPeriod());
}
}

View File

@ -0,0 +1,106 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
* This class is created to help implementers deal with a change to
* the API that was made between versions 0.81 and 0.9
*
* The change is the behaviour of the .getX() where the cardinality of
* x is 0..1 or 1..1. Before the change, these routines would return
* null if the object had not previously been assigned, and after the '
* change, they will automatically create the object if it had not
* been assigned (unless the object is polymorphic, in which case,
* only the type specific getters create the object)
*
* When making the transition from the old style to the new style,
* the main change is that when testing for presence or abssense
* of the element, instead of doing one of these two:
*
* if (obj.getProperty() == null)
* if (obj.getProperty() != null)
*
* you instead do
*
* if (!obj.hasProperty())
* if (obj.hasProperty())
*
* or else one of these two:
*
* if (obj.getProperty().isEmpty())
* if (!obj.getProperty().isEmpty())
*
* The only way to sort this out is by finding all these things
* in the code, and changing them.
*
* To help with that, you can set the status field of this class
* to change how this API behaves. Note: the status value is tied
* to the way that you program. The intent of this class is to
* help make developers the transiition to status = 0. The old
* behaviour is status = 2. To make the transition, set the
* status code to 1. This way, any time a .getX routine needs
* to automatically create an object, an exception will be
* raised instead. The expected use of this is:
* - set status = 1
* - test your code (all paths)
* - when an exception happens, change the code to use .hasX() or .isEmpty()
* - when all execution paths don't raise an exception, set status = 0
* - start programming to the new style.
*
* You can set status = 2 and leave it like that, but this is not
* compatible with the utilities and validation code, nor with the
* HAPI code. So everyone shoul make this transition
*
* This is a difficult change to make to an API. Most users should engage with it
* as they migrate from DSTU1 to DSTU2, at the same time as they encounter
* other changes. This change was made in order to align the two java reference
* implementations on a common object model, which is an important outcome that
* justifies making this change to implementers (sorry for any pain caused)
*
* @author Grahame
*
*/
public class Configuration {
private static int status = 0;
// 0: auto-create
// 1: error
// 2: return null
public static boolean errorOnAutoCreate() {
return status == 1;
}
public static boolean doAutoCreate() {
return status == 0;
}
}

View File

@ -0,0 +1,40 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
public class Constants {
public final static String VERSION = "1.1.0";
public final static String REVISION = "7388";
public final static String DATE = "Sun Dec 06 19:25:18 EST 2015";
}

View File

@ -0,0 +1,670 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Details for all kinds of technology mediated contact points for a person or organization, including telephone, email, etc.
*/
@DatatypeDef(name="ContactPoint")
public class ContactPoint extends Type implements ICompositeType {
public enum ContactPointSystem {
/**
* The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.
*/
PHONE,
/**
* The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.
*/
FAX,
/**
* The value is an email address.
*/
EMAIL,
/**
* The value is a pager number. These may be local pager numbers that are only usable on a particular pager system.
*/
PAGER,
/**
* A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation.
*/
OTHER,
/**
* added to help the parsers
*/
NULL;
public static ContactPointSystem fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("phone".equals(codeString))
return PHONE;
if ("fax".equals(codeString))
return FAX;
if ("email".equals(codeString))
return EMAIL;
if ("pager".equals(codeString))
return PAGER;
if ("other".equals(codeString))
return OTHER;
throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case PHONE: return "phone";
case FAX: return "fax";
case EMAIL: return "email";
case PAGER: return "pager";
case OTHER: return "other";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case PHONE: return "http://hl7.org/fhir/contact-point-system";
case FAX: return "http://hl7.org/fhir/contact-point-system";
case EMAIL: return "http://hl7.org/fhir/contact-point-system";
case PAGER: return "http://hl7.org/fhir/contact-point-system";
case OTHER: return "http://hl7.org/fhir/contact-point-system";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case PHONE: return "The value is a telephone number used for voice calls. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.";
case FAX: return "The value is a fax machine. Use of full international numbers starting with + is recommended to enable automatic dialing support but not required.";
case EMAIL: return "The value is an email address.";
case PAGER: return "The value is a pager number. These may be local pager numbers that are only usable on a particular pager system.";
case OTHER: return "A contact that is not a phone, fax, or email address. The format of the value SHOULD be a URL. This is intended for various personal contacts including blogs, Twitter, Facebook, etc. Do not use for email addresses. If this is not a URL, then it will require human interpretation.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case PHONE: return "Phone";
case FAX: return "Fax";
case EMAIL: return "Email";
case PAGER: return "Pager";
case OTHER: return "URL";
default: return "?";
}
}
}
public static class ContactPointSystemEnumFactory implements EnumFactory<ContactPointSystem> {
public ContactPointSystem fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("phone".equals(codeString))
return ContactPointSystem.PHONE;
if ("fax".equals(codeString))
return ContactPointSystem.FAX;
if ("email".equals(codeString))
return ContactPointSystem.EMAIL;
if ("pager".equals(codeString))
return ContactPointSystem.PAGER;
if ("other".equals(codeString))
return ContactPointSystem.OTHER;
throw new IllegalArgumentException("Unknown ContactPointSystem code '"+codeString+"'");
}
public Enumeration<ContactPointSystem> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("phone".equals(codeString))
return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PHONE);
if ("fax".equals(codeString))
return new Enumeration<ContactPointSystem>(this, ContactPointSystem.FAX);
if ("email".equals(codeString))
return new Enumeration<ContactPointSystem>(this, ContactPointSystem.EMAIL);
if ("pager".equals(codeString))
return new Enumeration<ContactPointSystem>(this, ContactPointSystem.PAGER);
if ("other".equals(codeString))
return new Enumeration<ContactPointSystem>(this, ContactPointSystem.OTHER);
throw new FHIRException("Unknown ContactPointSystem code '"+codeString+"'");
}
public String toCode(ContactPointSystem code) {
if (code == ContactPointSystem.PHONE)
return "phone";
if (code == ContactPointSystem.FAX)
return "fax";
if (code == ContactPointSystem.EMAIL)
return "email";
if (code == ContactPointSystem.PAGER)
return "pager";
if (code == ContactPointSystem.OTHER)
return "other";
return "?";
}
}
public enum ContactPointUse {
/**
* A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.
*/
HOME,
/**
* An office contact point. First choice for business related contacts during business hours.
*/
WORK,
/**
* A temporary contact point. The period can provide more detailed information.
*/
TEMP,
/**
* This contact point is no longer in use (or was never correct, but retained for records).
*/
OLD,
/**
* A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.
*/
MOBILE,
/**
* added to help the parsers
*/
NULL;
public static ContactPointUse fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("home".equals(codeString))
return HOME;
if ("work".equals(codeString))
return WORK;
if ("temp".equals(codeString))
return TEMP;
if ("old".equals(codeString))
return OLD;
if ("mobile".equals(codeString))
return MOBILE;
throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case HOME: return "home";
case WORK: return "work";
case TEMP: return "temp";
case OLD: return "old";
case MOBILE: return "mobile";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case HOME: return "http://hl7.org/fhir/contact-point-use";
case WORK: return "http://hl7.org/fhir/contact-point-use";
case TEMP: return "http://hl7.org/fhir/contact-point-use";
case OLD: return "http://hl7.org/fhir/contact-point-use";
case MOBILE: return "http://hl7.org/fhir/contact-point-use";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case HOME: return "A communication contact point at a home; attempted contacts for business purposes might intrude privacy and chances are one will contact family or other household members instead of the person one wishes to call. Typically used with urgent cases, or if no other contacts are available.";
case WORK: return "An office contact point. First choice for business related contacts during business hours.";
case TEMP: return "A temporary contact point. The period can provide more detailed information.";
case OLD: return "This contact point is no longer in use (or was never correct, but retained for records).";
case MOBILE: return "A telecommunication device that moves and stays with its owner. May have characteristics of all other use codes, suitable for urgent matters, not the first choice for routine business.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case HOME: return "Home";
case WORK: return "Work";
case TEMP: return "Temp";
case OLD: return "Old";
case MOBILE: return "Mobile";
default: return "?";
}
}
}
public static class ContactPointUseEnumFactory implements EnumFactory<ContactPointUse> {
public ContactPointUse fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("home".equals(codeString))
return ContactPointUse.HOME;
if ("work".equals(codeString))
return ContactPointUse.WORK;
if ("temp".equals(codeString))
return ContactPointUse.TEMP;
if ("old".equals(codeString))
return ContactPointUse.OLD;
if ("mobile".equals(codeString))
return ContactPointUse.MOBILE;
throw new IllegalArgumentException("Unknown ContactPointUse code '"+codeString+"'");
}
public Enumeration<ContactPointUse> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("home".equals(codeString))
return new Enumeration<ContactPointUse>(this, ContactPointUse.HOME);
if ("work".equals(codeString))
return new Enumeration<ContactPointUse>(this, ContactPointUse.WORK);
if ("temp".equals(codeString))
return new Enumeration<ContactPointUse>(this, ContactPointUse.TEMP);
if ("old".equals(codeString))
return new Enumeration<ContactPointUse>(this, ContactPointUse.OLD);
if ("mobile".equals(codeString))
return new Enumeration<ContactPointUse>(this, ContactPointUse.MOBILE);
throw new FHIRException("Unknown ContactPointUse code '"+codeString+"'");
}
public String toCode(ContactPointUse code) {
if (code == ContactPointUse.HOME)
return "home";
if (code == ContactPointUse.WORK)
return "work";
if (code == ContactPointUse.TEMP)
return "temp";
if (code == ContactPointUse.OLD)
return "old";
if (code == ContactPointUse.MOBILE)
return "mobile";
return "?";
}
}
/**
* Telecommunications form for contact point - what communications system is required to make use of the contact.
*/
@Child(name = "system", type = {CodeType.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="phone | fax | email | pager | other", formalDefinition="Telecommunications form for contact point - what communications system is required to make use of the contact." )
protected Enumeration<ContactPointSystem> system;
/**
* The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
*/
@Child(name = "value", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="The actual contact point details", formalDefinition="The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address)." )
protected StringType value;
/**
* Identifies the purpose for the contact point.
*/
@Child(name = "use", type = {CodeType.class}, order=2, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="home | work | temp | old | mobile - purpose of this contact point", formalDefinition="Identifies the purpose for the contact point." )
protected Enumeration<ContactPointUse> use;
/**
* Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
*/
@Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Specify preferred order of use (1 = highest)", formalDefinition="Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values." )
protected PositiveIntType rank;
/**
* Time period when the contact point was/is in use.
*/
@Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time period when the contact point was/is in use", formalDefinition="Time period when the contact point was/is in use." )
protected Period period;
private static final long serialVersionUID = 1509610874L;
/*
* Constructor
*/
public ContactPoint() {
super();
}
/**
* @return {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public Enumeration<ContactPointSystem> getSystemElement() {
if (this.system == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ContactPoint.system");
else if (Configuration.doAutoCreate())
this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory()); // bb
return this.system;
}
public boolean hasSystemElement() {
return this.system != null && !this.system.isEmpty();
}
public boolean hasSystem() {
return this.system != null && !this.system.isEmpty();
}
/**
* @param value {@link #system} (Telecommunications form for contact point - what communications system is required to make use of the contact.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public ContactPoint setSystemElement(Enumeration<ContactPointSystem> value) {
this.system = value;
return this;
}
/**
* @return Telecommunications form for contact point - what communications system is required to make use of the contact.
*/
public ContactPointSystem getSystem() {
return this.system == null ? null : this.system.getValue();
}
/**
* @param value Telecommunications form for contact point - what communications system is required to make use of the contact.
*/
public ContactPoint setSystem(ContactPointSystem value) {
if (value == null)
this.system = null;
else {
if (this.system == null)
this.system = new Enumeration<ContactPointSystem>(new ContactPointSystemEnumFactory());
this.system.setValue(value);
}
return this;
}
/**
* @return {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
*/
public StringType getValueElement() {
if (this.value == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ContactPoint.value");
else if (Configuration.doAutoCreate())
this.value = new StringType(); // bb
return this.value;
}
public boolean hasValueElement() {
return this.value != null && !this.value.isEmpty();
}
public boolean hasValue() {
return this.value != null && !this.value.isEmpty();
}
/**
* @param value {@link #value} (The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
*/
public ContactPoint setValueElement(StringType value) {
this.value = value;
return this;
}
/**
* @return The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
*/
public String getValue() {
return this.value == null ? null : this.value.getValue();
}
/**
* @param value The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).
*/
public ContactPoint setValue(String value) {
if (Utilities.noString(value))
this.value = null;
else {
if (this.value == null)
this.value = new StringType();
this.value.setValue(value);
}
return this;
}
/**
* @return {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public Enumeration<ContactPointUse> getUseElement() {
if (this.use == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ContactPoint.use");
else if (Configuration.doAutoCreate())
this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory()); // bb
return this.use;
}
public boolean hasUseElement() {
return this.use != null && !this.use.isEmpty();
}
public boolean hasUse() {
return this.use != null && !this.use.isEmpty();
}
/**
* @param value {@link #use} (Identifies the purpose for the contact point.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public ContactPoint setUseElement(Enumeration<ContactPointUse> value) {
this.use = value;
return this;
}
/**
* @return Identifies the purpose for the contact point.
*/
public ContactPointUse getUse() {
return this.use == null ? null : this.use.getValue();
}
/**
* @param value Identifies the purpose for the contact point.
*/
public ContactPoint setUse(ContactPointUse value) {
if (value == null)
this.use = null;
else {
if (this.use == null)
this.use = new Enumeration<ContactPointUse>(new ContactPointUseEnumFactory());
this.use.setValue(value);
}
return this;
}
/**
* @return {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
*/
public PositiveIntType getRankElement() {
if (this.rank == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ContactPoint.rank");
else if (Configuration.doAutoCreate())
this.rank = new PositiveIntType(); // bb
return this.rank;
}
public boolean hasRankElement() {
return this.rank != null && !this.rank.isEmpty();
}
public boolean hasRank() {
return this.rank != null && !this.rank.isEmpty();
}
/**
* @param value {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
*/
public ContactPoint setRankElement(PositiveIntType value) {
this.rank = value;
return this;
}
/**
* @return Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
*/
public int getRank() {
return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue();
}
/**
* @param value Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
*/
public ContactPoint setRank(int value) {
if (this.rank == null)
this.rank = new PositiveIntType();
this.rank.setValue(value);
return this;
}
/**
* @return {@link #period} (Time period when the contact point was/is in use.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ContactPoint.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (Time period when the contact point was/is in use.)
*/
public ContactPoint setPeriod(Period value) {
this.period = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, java.lang.Integer.MAX_VALUE, system));
childrenList.add(new Property("value", "string", "The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).", 0, java.lang.Integer.MAX_VALUE, value));
childrenList.add(new Property("use", "code", "Identifies the purpose for the contact point.", 0, java.lang.Integer.MAX_VALUE, use));
childrenList.add(new Property("rank", "positiveInt", "Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.", 0, java.lang.Integer.MAX_VALUE, rank));
childrenList.add(new Property("period", "Period", "Time period when the contact point was/is in use.", 0, java.lang.Integer.MAX_VALUE, period));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("system"))
this.system = new ContactPointSystemEnumFactory().fromType(value); // Enumeration<ContactPointSystem>
else if (name.equals("value"))
this.value = castToString(value); // StringType
else if (name.equals("use"))
this.use = new ContactPointUseEnumFactory().fromType(value); // Enumeration<ContactPointUse>
else if (name.equals("rank"))
this.rank = castToPositiveInt(value); // PositiveIntType
else if (name.equals("period"))
this.period = castToPeriod(value); // Period
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("system")) {
throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.system");
}
else if (name.equals("value")) {
throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.value");
}
else if (name.equals("use")) {
throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.use");
}
else if (name.equals("rank")) {
throw new FHIRException("Cannot call addChild on a primitive type ContactPoint.rank");
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else
return super.addChild(name);
}
public String fhirType() {
return "ContactPoint";
}
public ContactPoint copy() {
ContactPoint dst = new ContactPoint();
copyValues(dst);
dst.system = system == null ? null : system.copy();
dst.value = value == null ? null : value.copy();
dst.use = use == null ? null : use.copy();
dst.rank = rank == null ? null : rank.copy();
dst.period = period == null ? null : period.copy();
return dst;
}
protected ContactPoint typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof ContactPoint))
return false;
ContactPoint o = (ContactPoint) other;
return compareDeep(system, o.system, true) && compareDeep(value, o.value, true) && compareDeep(use, o.use, true)
&& compareDeep(rank, o.rank, true) && compareDeep(period, o.period, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof ContactPoint))
return false;
ContactPoint o = (ContactPoint) other;
return compareValues(system, o.system, true) && compareValues(value, o.value, true) && compareValues(use, o.use, true)
&& compareValues(rank, o.rank, true);
}
public boolean isEmpty() {
return super.isEmpty() && (system == null || system.isEmpty()) && (value == null || value.isEmpty())
&& (use == null || use.isEmpty()) && (rank == null || rank.isEmpty()) && (period == null || period.isEmpty())
;
}
}

View File

@ -0,0 +1,91 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
@DatatypeDef(name="Count", profileOf=Quantity.class)
public class Count extends Quantity {
private static final long serialVersionUID = 1069574054L;
public Count copy() {
Count dst = new Count();
copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
return dst;
}
protected Count typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Count))
return false;
Count o = (Count) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Count))
return false;
Count o = (Count) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -0,0 +1,919 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Financial instrument which may be used to pay for or reimburse health care products and services.
*/
@ResourceDef(name="Coverage", profile="http://hl7.org/fhir/Profile/Coverage")
public class Coverage extends DomainResource {
/**
* The program or plan underwriter or payor.
*/
@Child(name = "issuer", type = {Organization.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="An identifier for the plan issuer", formalDefinition="The program or plan underwriter or payor." )
protected Reference issuer;
/**
* The actual object that is the target of the reference (The program or plan underwriter or payor.)
*/
protected Organization issuerTarget;
/**
* Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.
*/
@Child(name = "bin", type = {Identifier.class}, order=1, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="BIN Number", formalDefinition="Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business." )
protected Identifier bin;
/**
* Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.
*/
@Child(name = "period", type = {Period.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Coverage start and end dates", formalDefinition="Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force." )
protected Period period;
/**
* The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.
*/
@Child(name = "type", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Type of coverage", formalDefinition="The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health." )
protected Coding type;
/**
* The id issued to the subscriber.
*/
@Child(name = "subscriberId", type = {Identifier.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Subscriber ID", formalDefinition="The id issued to the subscriber." )
protected Identifier subscriberId;
/**
* The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.
*/
@Child(name = "identifier", type = {Identifier.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="The primary coverage ID", formalDefinition="The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID." )
protected List<Identifier> identifier;
/**
* Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
*/
@Child(name = "group", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="An identifier for the group", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID." )
protected StringType group;
/**
* Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
*/
@Child(name = "plan", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="An identifier for the plan", formalDefinition="Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID." )
protected StringType plan;
/**
* Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.
*/
@Child(name = "subPlan", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="An identifier for the subsection of the plan", formalDefinition="Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID." )
protected StringType subPlan;
/**
* A unique identifier for a dependent under the coverage.
*/
@Child(name = "dependent", type = {PositiveIntType.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="The dependent number", formalDefinition="A unique identifier for a dependent under the coverage." )
protected PositiveIntType dependent;
/**
* An optional counter for a particular instance of the identified coverage which increments upon each renewal.
*/
@Child(name = "sequence", type = {PositiveIntType.class}, order=10, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="The plan instance or sequence counter", formalDefinition="An optional counter for a particular instance of the identified coverage which increments upon each renewal." )
protected PositiveIntType sequence;
/**
* The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.
*/
@Child(name = "subscriber", type = {Patient.class}, order=11, min=0, max=1, modifier=true, summary=false)
@Description(shortDefinition="Plan holder information", formalDefinition="The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due." )
protected Reference subscriber;
/**
* The actual object that is the target of the reference (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
*/
protected Patient subscriberTarget;
/**
* The identifier for a community of providers.
*/
@Child(name = "network", type = {Identifier.class}, order=12, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurer network", formalDefinition="The identifier for a community of providers." )
protected Identifier network;
/**
* The policy(s) which constitute this insurance coverage.
*/
@Child(name = "contract", type = {Contract.class}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Contract details", formalDefinition="The policy(s) which constitute this insurance coverage." )
protected List<Reference> contract;
/**
* The actual objects that are the target of the reference (The policy(s) which constitute this insurance coverage.)
*/
protected List<Contract> contractTarget;
private static final long serialVersionUID = -1312031251L;
/*
* Constructor
*/
public Coverage() {
super();
}
/**
* @return {@link #issuer} (The program or plan underwriter or payor.)
*/
public Reference getIssuer() {
if (this.issuer == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.issuer");
else if (Configuration.doAutoCreate())
this.issuer = new Reference(); // cc
return this.issuer;
}
public boolean hasIssuer() {
return this.issuer != null && !this.issuer.isEmpty();
}
/**
* @param value {@link #issuer} (The program or plan underwriter or payor.)
*/
public Coverage setIssuer(Reference value) {
this.issuer = value;
return this;
}
/**
* @return {@link #issuer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The program or plan underwriter or payor.)
*/
public Organization getIssuerTarget() {
if (this.issuerTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.issuer");
else if (Configuration.doAutoCreate())
this.issuerTarget = new Organization(); // aa
return this.issuerTarget;
}
/**
* @param value {@link #issuer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The program or plan underwriter or payor.)
*/
public Coverage setIssuerTarget(Organization value) {
this.issuerTarget = value;
return this;
}
/**
* @return {@link #bin} (Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.)
*/
public Identifier getBin() {
if (this.bin == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.bin");
else if (Configuration.doAutoCreate())
this.bin = new Identifier(); // cc
return this.bin;
}
public boolean hasBin() {
return this.bin != null && !this.bin.isEmpty();
}
/**
* @param value {@link #bin} (Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.)
*/
public Coverage setBin(Identifier value) {
this.bin = value;
return this;
}
/**
* @return {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.)
*/
public Coverage setPeriod(Period value) {
this.period = value;
return this;
}
/**
* @return {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.)
*/
public Coding getType() {
if (this.type == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.type");
else if (Configuration.doAutoCreate())
this.type = new Coding(); // cc
return this.type;
}
public boolean hasType() {
return this.type != null && !this.type.isEmpty();
}
/**
* @param value {@link #type} (The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.)
*/
public Coverage setType(Coding value) {
this.type = value;
return this;
}
/**
* @return {@link #subscriberId} (The id issued to the subscriber.)
*/
public Identifier getSubscriberId() {
if (this.subscriberId == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.subscriberId");
else if (Configuration.doAutoCreate())
this.subscriberId = new Identifier(); // cc
return this.subscriberId;
}
public boolean hasSubscriberId() {
return this.subscriberId != null && !this.subscriberId.isEmpty();
}
/**
* @param value {@link #subscriberId} (The id issued to the subscriber.)
*/
public Coverage setSubscriberId(Identifier value) {
this.subscriberId = value;
return this;
}
/**
* @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public Coverage addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #group} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value
*/
public StringType getGroupElement() {
if (this.group == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.group");
else if (Configuration.doAutoCreate())
this.group = new StringType(); // bb
return this.group;
}
public boolean hasGroupElement() {
return this.group != null && !this.group.isEmpty();
}
public boolean hasGroup() {
return this.group != null && !this.group.isEmpty();
}
/**
* @param value {@link #group} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getGroup" gives direct access to the value
*/
public Coverage setGroupElement(StringType value) {
this.group = value;
return this;
}
/**
* @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
*/
public String getGroup() {
return this.group == null ? null : this.group.getValue();
}
/**
* @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
*/
public Coverage setGroup(String value) {
if (Utilities.noString(value))
this.group = null;
else {
if (this.group == null)
this.group = new StringType();
this.group.setValue(value);
}
return this;
}
/**
* @return {@link #plan} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value
*/
public StringType getPlanElement() {
if (this.plan == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.plan");
else if (Configuration.doAutoCreate())
this.plan = new StringType(); // bb
return this.plan;
}
public boolean hasPlanElement() {
return this.plan != null && !this.plan.isEmpty();
}
public boolean hasPlan() {
return this.plan != null && !this.plan.isEmpty();
}
/**
* @param value {@link #plan} (Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.). This is the underlying object with id, value and extensions. The accessor "getPlan" gives direct access to the value
*/
public Coverage setPlanElement(StringType value) {
this.plan = value;
return this;
}
/**
* @return Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
*/
public String getPlan() {
return this.plan == null ? null : this.plan.getValue();
}
/**
* @param value Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.
*/
public Coverage setPlan(String value) {
if (Utilities.noString(value))
this.plan = null;
else {
if (this.plan == null)
this.plan = new StringType();
this.plan.setValue(value);
}
return this;
}
/**
* @return {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value
*/
public StringType getSubPlanElement() {
if (this.subPlan == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.subPlan");
else if (Configuration.doAutoCreate())
this.subPlan = new StringType(); // bb
return this.subPlan;
}
public boolean hasSubPlanElement() {
return this.subPlan != null && !this.subPlan.isEmpty();
}
public boolean hasSubPlan() {
return this.subPlan != null && !this.subPlan.isEmpty();
}
/**
* @param value {@link #subPlan} (Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.). This is the underlying object with id, value and extensions. The accessor "getSubPlan" gives direct access to the value
*/
public Coverage setSubPlanElement(StringType value) {
this.subPlan = value;
return this;
}
/**
* @return Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.
*/
public String getSubPlan() {
return this.subPlan == null ? null : this.subPlan.getValue();
}
/**
* @param value Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.
*/
public Coverage setSubPlan(String value) {
if (Utilities.noString(value))
this.subPlan = null;
else {
if (this.subPlan == null)
this.subPlan = new StringType();
this.subPlan.setValue(value);
}
return this;
}
/**
* @return {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
*/
public PositiveIntType getDependentElement() {
if (this.dependent == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.dependent");
else if (Configuration.doAutoCreate())
this.dependent = new PositiveIntType(); // bb
return this.dependent;
}
public boolean hasDependentElement() {
return this.dependent != null && !this.dependent.isEmpty();
}
public boolean hasDependent() {
return this.dependent != null && !this.dependent.isEmpty();
}
/**
* @param value {@link #dependent} (A unique identifier for a dependent under the coverage.). This is the underlying object with id, value and extensions. The accessor "getDependent" gives direct access to the value
*/
public Coverage setDependentElement(PositiveIntType value) {
this.dependent = value;
return this;
}
/**
* @return A unique identifier for a dependent under the coverage.
*/
public int getDependent() {
return this.dependent == null || this.dependent.isEmpty() ? 0 : this.dependent.getValue();
}
/**
* @param value A unique identifier for a dependent under the coverage.
*/
public Coverage setDependent(int value) {
if (this.dependent == null)
this.dependent = new PositiveIntType();
this.dependent.setValue(value);
return this;
}
/**
* @return {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
*/
public PositiveIntType getSequenceElement() {
if (this.sequence == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.sequence");
else if (Configuration.doAutoCreate())
this.sequence = new PositiveIntType(); // bb
return this.sequence;
}
public boolean hasSequenceElement() {
return this.sequence != null && !this.sequence.isEmpty();
}
public boolean hasSequence() {
return this.sequence != null && !this.sequence.isEmpty();
}
/**
* @param value {@link #sequence} (An optional counter for a particular instance of the identified coverage which increments upon each renewal.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
*/
public Coverage setSequenceElement(PositiveIntType value) {
this.sequence = value;
return this;
}
/**
* @return An optional counter for a particular instance of the identified coverage which increments upon each renewal.
*/
public int getSequence() {
return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
}
/**
* @param value An optional counter for a particular instance of the identified coverage which increments upon each renewal.
*/
public Coverage setSequence(int value) {
if (this.sequence == null)
this.sequence = new PositiveIntType();
this.sequence.setValue(value);
return this;
}
/**
* @return {@link #subscriber} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
*/
public Reference getSubscriber() {
if (this.subscriber == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.subscriber");
else if (Configuration.doAutoCreate())
this.subscriber = new Reference(); // cc
return this.subscriber;
}
public boolean hasSubscriber() {
return this.subscriber != null && !this.subscriber.isEmpty();
}
/**
* @param value {@link #subscriber} (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
*/
public Coverage setSubscriber(Reference value) {
this.subscriber = value;
return this;
}
/**
* @return {@link #subscriber} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
*/
public Patient getSubscriberTarget() {
if (this.subscriberTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.subscriber");
else if (Configuration.doAutoCreate())
this.subscriberTarget = new Patient(); // aa
return this.subscriberTarget;
}
/**
* @param value {@link #subscriber} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.)
*/
public Coverage setSubscriberTarget(Patient value) {
this.subscriberTarget = value;
return this;
}
/**
* @return {@link #network} (The identifier for a community of providers.)
*/
public Identifier getNetwork() {
if (this.network == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Coverage.network");
else if (Configuration.doAutoCreate())
this.network = new Identifier(); // cc
return this.network;
}
public boolean hasNetwork() {
return this.network != null && !this.network.isEmpty();
}
/**
* @param value {@link #network} (The identifier for a community of providers.)
*/
public Coverage setNetwork(Identifier value) {
this.network = value;
return this;
}
/**
* @return {@link #contract} (The policy(s) which constitute this insurance coverage.)
*/
public List<Reference> getContract() {
if (this.contract == null)
this.contract = new ArrayList<Reference>();
return this.contract;
}
public boolean hasContract() {
if (this.contract == null)
return false;
for (Reference item : this.contract)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #contract} (The policy(s) which constitute this insurance coverage.)
*/
// syntactic sugar
public Reference addContract() { //3
Reference t = new Reference();
if (this.contract == null)
this.contract = new ArrayList<Reference>();
this.contract.add(t);
return t;
}
// syntactic sugar
public Coverage addContract(Reference t) { //3
if (t == null)
return this;
if (this.contract == null)
this.contract = new ArrayList<Reference>();
this.contract.add(t);
return this;
}
/**
* @return {@link #contract} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. The policy(s) which constitute this insurance coverage.)
*/
public List<Contract> getContractTarget() {
if (this.contractTarget == null)
this.contractTarget = new ArrayList<Contract>();
return this.contractTarget;
}
// syntactic sugar
/**
* @return {@link #contract} (Add an actual object that is the target of the reference. The reference library doesn't use these, but you can use this to hold the resources if you resolvethemt. The policy(s) which constitute this insurance coverage.)
*/
public Contract addContractTarget() {
Contract r = new Contract();
if (this.contractTarget == null)
this.contractTarget = new ArrayList<Contract>();
this.contractTarget.add(r);
return r;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("issuer", "Reference(Organization)", "The program or plan underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, issuer));
childrenList.add(new Property("bin", "Identifier", "Business Identification Number (BIN number) used to identify the routing of eclaims if the insurer themselves don't have a BIN number for all of their business.", 0, java.lang.Integer.MAX_VALUE, bin));
childrenList.add(new Property("period", "Period", "Time period during which the coverage is in force. A missing start date indicates the start date isn't known, a missing end date means the coverage is continuing to be in force.", 0, java.lang.Integer.MAX_VALUE, period));
childrenList.add(new Property("type", "Coding", "The type of coverage: social program, medical plan, accident coverage (workers compensation, auto), group health.", 0, java.lang.Integer.MAX_VALUE, type));
childrenList.add(new Property("subscriberId", "Identifier", "The id issued to the subscriber.", 0, java.lang.Integer.MAX_VALUE, subscriberId));
childrenList.add(new Property("identifier", "Identifier", "The main (and possibly only) identifier for the coverage - often referred to as a Member Id, Subscriber Id, Certificate number or Personal Health Number or Case ID.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("group", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.", 0, java.lang.Integer.MAX_VALUE, group));
childrenList.add(new Property("plan", "string", "Identifies a style or collective of coverage issues by the underwriter, for example may be used to identify a class of coverage or employer group. May also be referred to as a Policy or Group ID.", 0, java.lang.Integer.MAX_VALUE, plan));
childrenList.add(new Property("subPlan", "string", "Identifies a sub-style or sub-collective of coverage issues by the underwriter, for example may be used to identify a specific employer group within a class of employers. May be referred to as a Section or Division ID.", 0, java.lang.Integer.MAX_VALUE, subPlan));
childrenList.add(new Property("dependent", "positiveInt", "A unique identifier for a dependent under the coverage.", 0, java.lang.Integer.MAX_VALUE, dependent));
childrenList.add(new Property("sequence", "positiveInt", "An optional counter for a particular instance of the identified coverage which increments upon each renewal.", 0, java.lang.Integer.MAX_VALUE, sequence));
childrenList.add(new Property("subscriber", "Reference(Patient)", "The party who 'owns' the insurance contractual relationship to the policy or to whom the benefit of the policy is due.", 0, java.lang.Integer.MAX_VALUE, subscriber));
childrenList.add(new Property("network", "Identifier", "The identifier for a community of providers.", 0, java.lang.Integer.MAX_VALUE, network));
childrenList.add(new Property("contract", "Reference(Contract)", "The policy(s) which constitute this insurance coverage.", 0, java.lang.Integer.MAX_VALUE, contract));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("issuer"))
this.issuer = castToReference(value); // Reference
else if (name.equals("bin"))
this.bin = castToIdentifier(value); // Identifier
else if (name.equals("period"))
this.period = castToPeriod(value); // Period
else if (name.equals("type"))
this.type = castToCoding(value); // Coding
else if (name.equals("subscriberId"))
this.subscriberId = castToIdentifier(value); // Identifier
else if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("group"))
this.group = castToString(value); // StringType
else if (name.equals("plan"))
this.plan = castToString(value); // StringType
else if (name.equals("subPlan"))
this.subPlan = castToString(value); // StringType
else if (name.equals("dependent"))
this.dependent = castToPositiveInt(value); // PositiveIntType
else if (name.equals("sequence"))
this.sequence = castToPositiveInt(value); // PositiveIntType
else if (name.equals("subscriber"))
this.subscriber = castToReference(value); // Reference
else if (name.equals("network"))
this.network = castToIdentifier(value); // Identifier
else if (name.equals("contract"))
this.getContract().add(castToReference(value));
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("issuer")) {
this.issuer = new Reference();
return this.issuer;
}
else if (name.equals("bin")) {
this.bin = new Identifier();
return this.bin;
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else if (name.equals("type")) {
this.type = new Coding();
return this.type;
}
else if (name.equals("subscriberId")) {
this.subscriberId = new Identifier();
return this.subscriberId;
}
else if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("group")) {
throw new FHIRException("Cannot call addChild on a primitive type Coverage.group");
}
else if (name.equals("plan")) {
throw new FHIRException("Cannot call addChild on a primitive type Coverage.plan");
}
else if (name.equals("subPlan")) {
throw new FHIRException("Cannot call addChild on a primitive type Coverage.subPlan");
}
else if (name.equals("dependent")) {
throw new FHIRException("Cannot call addChild on a primitive type Coverage.dependent");
}
else if (name.equals("sequence")) {
throw new FHIRException("Cannot call addChild on a primitive type Coverage.sequence");
}
else if (name.equals("subscriber")) {
this.subscriber = new Reference();
return this.subscriber;
}
else if (name.equals("network")) {
this.network = new Identifier();
return this.network;
}
else if (name.equals("contract")) {
return addContract();
}
else
return super.addChild(name);
}
public String fhirType() {
return "Coverage";
}
public Coverage copy() {
Coverage dst = new Coverage();
copyValues(dst);
dst.issuer = issuer == null ? null : issuer.copy();
dst.bin = bin == null ? null : bin.copy();
dst.period = period == null ? null : period.copy();
dst.type = type == null ? null : type.copy();
dst.subscriberId = subscriberId == null ? null : subscriberId.copy();
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.group = group == null ? null : group.copy();
dst.plan = plan == null ? null : plan.copy();
dst.subPlan = subPlan == null ? null : subPlan.copy();
dst.dependent = dependent == null ? null : dependent.copy();
dst.sequence = sequence == null ? null : sequence.copy();
dst.subscriber = subscriber == null ? null : subscriber.copy();
dst.network = network == null ? null : network.copy();
if (contract != null) {
dst.contract = new ArrayList<Reference>();
for (Reference i : contract)
dst.contract.add(i.copy());
};
return dst;
}
protected Coverage typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Coverage))
return false;
Coverage o = (Coverage) other;
return compareDeep(issuer, o.issuer, true) && compareDeep(bin, o.bin, true) && compareDeep(period, o.period, true)
&& compareDeep(type, o.type, true) && compareDeep(subscriberId, o.subscriberId, true) && compareDeep(identifier, o.identifier, true)
&& compareDeep(group, o.group, true) && compareDeep(plan, o.plan, true) && compareDeep(subPlan, o.subPlan, true)
&& compareDeep(dependent, o.dependent, true) && compareDeep(sequence, o.sequence, true) && compareDeep(subscriber, o.subscriber, true)
&& compareDeep(network, o.network, true) && compareDeep(contract, o.contract, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Coverage))
return false;
Coverage o = (Coverage) other;
return compareValues(group, o.group, true) && compareValues(plan, o.plan, true) && compareValues(subPlan, o.subPlan, true)
&& compareValues(dependent, o.dependent, true) && compareValues(sequence, o.sequence, true);
}
public boolean isEmpty() {
return super.isEmpty() && (issuer == null || issuer.isEmpty()) && (bin == null || bin.isEmpty())
&& (period == null || period.isEmpty()) && (type == null || type.isEmpty()) && (subscriberId == null || subscriberId.isEmpty())
&& (identifier == null || identifier.isEmpty()) && (group == null || group.isEmpty()) && (plan == null || plan.isEmpty())
&& (subPlan == null || subPlan.isEmpty()) && (dependent == null || dependent.isEmpty()) && (sequence == null || sequence.isEmpty())
&& (subscriber == null || subscriber.isEmpty()) && (network == null || network.isEmpty())
&& (contract == null || contract.isEmpty());
}
@Override
public ResourceType getResourceType() {
return ResourceType.Coverage;
}
@SearchParamDefinition(name="identifier", path="Coverage.identifier", description="The primary identifier of the insured", type="token" )
public static final String SP_IDENTIFIER = "identifier";
@SearchParamDefinition(name="sequence", path="Coverage.sequence", description="Sequence number", type="token" )
public static final String SP_SEQUENCE = "sequence";
@SearchParamDefinition(name="subplan", path="Coverage.subPlan", description="Sub-plan identifier", type="token" )
public static final String SP_SUBPLAN = "subplan";
@SearchParamDefinition(name="type", path="Coverage.type", description="The kind of coverage", type="token" )
public static final String SP_TYPE = "type";
@SearchParamDefinition(name="plan", path="Coverage.plan", description="A plan or policy identifier", type="token" )
public static final String SP_PLAN = "plan";
@SearchParamDefinition(name="dependent", path="Coverage.dependent", description="Dependent number", type="token" )
public static final String SP_DEPENDENT = "dependent";
@SearchParamDefinition(name="issuer", path="Coverage.issuer", description="The identity of the insurer", type="reference" )
public static final String SP_ISSUER = "issuer";
@SearchParamDefinition(name="group", path="Coverage.group", description="Group identifier", type="token" )
public static final String SP_GROUP = "group";
}

View File

@ -0,0 +1,196 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
package org.hl7.fhir.dstu21.model;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.util.zip.DataFormatException;
import org.apache.commons.lang3.time.DateUtils;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Represents a FHIR dateTime datatype. Valid precisions values for this type are:
* <ul>
* <li>{@link TemporalPrecisionEnum#YEAR}
* <li>{@link TemporalPrecisionEnum#MONTH}
* <li>{@link TemporalPrecisionEnum#DAY}
* <li>{@link TemporalPrecisionEnum#SECOND}
* <li>{@link TemporalPrecisionEnum#MILLI}
* </ul>
*/
@DatatypeDef(name = "dateTime")
public class DateTimeType extends BaseDateTimeType {
private static final long serialVersionUID = 3L;
/**
* The default precision for this type
*/
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.SECOND;
/**
* Constructor
*/
public DateTimeType() {
super();
}
/**
* Create a new DateTimeDt with seconds precision and the local time zone
*/
public DateTimeType(Date theDate) {
super(theDate, DEFAULT_PRECISION, TimeZone.getDefault());
}
/**
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
* <ul>
* <li>{@link TemporalPrecisionEnum#YEAR}
* <li>{@link TemporalPrecisionEnum#MONTH}
* <li>{@link TemporalPrecisionEnum#DAY}
* <li>{@link TemporalPrecisionEnum#SECOND}
* <li>{@link TemporalPrecisionEnum#MILLI}
* </ul>
*
* @throws DataFormatException
* If the specified precision is not allowed for this type
*/
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision) {
super(theDate, thePrecision, TimeZone.getDefault());
}
/**
* Create a new instance using a string date/time
*
* @throws DataFormatException
* If the specified precision is not allowed for this type
*/
public DateTimeType(String theValue) {
super(theValue);
}
/**
* Constructor which accepts a date value, precision value, and time zone. Valid precisions values for this type
* are:
* <ul>
* <li>{@link TemporalPrecisionEnum#YEAR}
* <li>{@link TemporalPrecisionEnum#MONTH}
* <li>{@link TemporalPrecisionEnum#DAY}
* <li>{@link TemporalPrecisionEnum#SECOND}
* <li>{@link TemporalPrecisionEnum#MILLI}
* </ul>
*/
public DateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) {
super(theDate, thePrecision, theTimezone);
}
/**
* Constructor
*/
public DateTimeType(Calendar theCalendar) {
if (theCalendar != null) {
setValue(theCalendar.getTime());
setPrecision(DEFAULT_PRECISION);
setTimeZone(theCalendar.getTimeZone());
}
}
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
switch (thePrecision) {
case YEAR:
case MONTH:
case DAY:
case SECOND:
case MILLI:
return true;
default:
return false;
}
}
/**
* Returns a new instance of DateTimeType with the current system time and SECOND precision and the system local time
* zone
*/
public static DateTimeType now() {
return new DateTimeType(new Date(), TemporalPrecisionEnum.SECOND, TimeZone.getDefault());
}
/**
* Returns the default precision for this datatype
*
* @see #DEFAULT_PRECISION
*/
@Override
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
return DEFAULT_PRECISION;
}
@Override
public DateTimeType copy() {
return new DateTimeType(getValueAsString());
}
/**
* Creates a new instance by parsing an HL7 v3 format date time string
*/
public static DateTimeType parseV3(String theV3String) {
DateTimeType retVal = new DateTimeType();
retVal.setValueAsV3String(theV3String);
return retVal;
}
public static DateTimeType today() {
DateTimeType retVal = now();
retVal.setPrecision(TemporalPrecisionEnum.DAY);
return retVal;
}
public boolean getTzSign() {
return getTimeZone().getRawOffset() >= 0;
}
public int getTzHour() {
return (int) (getTimeZone().getRawOffset() / DateUtils.MILLIS_PER_MINUTE) / 60;
}
public int getTzMin() {
return (int) (getTimeZone().getRawOffset() / DateUtils.MILLIS_PER_MINUTE) % 60;
}
public String fhirType() {
return "dateTime";
}
}

View File

@ -0,0 +1,141 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
package org.hl7.fhir.dstu21.model;
/**
* Primitive type "date" in FHIR: any day in a gregorian calendar
*/
import java.util.Date;
import java.util.TimeZone;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Represents a FHIR date datatype. Valid precisions values for this type are:
* <ul>
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#YEAR}
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#MONTH}
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#DAY}
* </ul>
*/
@DatatypeDef(name = "date")
public class DateType extends BaseDateTimeType {
private static final long serialVersionUID = 3L;
/**
* The default precision for this type
*/
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.DAY;
/**
* Constructor
*/
public DateType() {
super();
}
/**
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type
*/
public DateType(Date theDate) {
super(theDate, DEFAULT_PRECISION);
}
/**
* Constructor which accepts a date value and a precision value. Valid precisions values for this type are:
* <ul>
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#YEAR}
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#MONTH}
* <li>{@link ca.uhn.fhir.model.api.TemporalPrecisionEnum#DAY}
* </ul>
*
* @throws ca.uhn.fhir.parser.DataFormatException
* If the specified precision is not allowed for this type
*/
public DateType(Date theDate, TemporalPrecisionEnum thePrecision) {
super(theDate, thePrecision);
}
/**
* Constructor which accepts a date as a string in FHIR format
*
* @throws ca.uhn.fhir.parser.DataFormatException
* If the precision in the date string is not allowed for this type
*/
public DateType(String theDate) {
super(theDate);
}
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
switch (thePrecision) {
case YEAR:
case MONTH:
case DAY:
return true;
default:
return false;
}
}
/**
* Returns the default precision for this datatype
*
* @see #DEFAULT_PRECISION
*/
@Override
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
return DEFAULT_PRECISION;
}
@Override
public DateType copy() {
return new DateType(getValue());
}
public static InstantType today() {
return new InstantType(new Date(), TemporalPrecisionEnum.DAY, TimeZone.getDefault());
}
/**
* Creates a new instance by parsing an HL7 v3 format date time string
*/
public static DateType parseV3(String theV3String) {
DateType retVal = new DateType();
retVal.setValueAsV3String(theV3String);
return retVal;
}
public String fhirType() {
return "date";
}
}

View File

@ -0,0 +1,177 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
*/
package org.hl7.fhir.dstu21.model;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import org.hl7.fhir.instance.model.api.IBaseDecimalDatatype;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Primitive type "decimal" in FHIR: A rational number
*/
@DatatypeDef(name = "decimal")
public class DecimalType extends PrimitiveType<BigDecimal> implements Comparable<DecimalType>, IBaseDecimalDatatype {
private static final long serialVersionUID = 3L;
/**
* Constructor
*/
public DecimalType() {
super();
}
/**
* Constructor
*/
public DecimalType(BigDecimal theValue) {
setValue(theValue);
}
/**
* Constructor
*/
public DecimalType(double theValue) {
// Use the valueOf here because the constructor gives wacky precision
// changes due to the floating point conversion
setValue(BigDecimal.valueOf(theValue));
}
/**
* Constructor
*/
public DecimalType(long theValue) {
setValue(new BigDecimal(theValue));
}
/**
* Constructor
*/
public DecimalType(String theValue) {
setValue(new BigDecimal(theValue));
}
@Override
public int compareTo(DecimalType theObj) {
if (getValue() == null && theObj.getValue() == null) {
return 0;
}
if (getValue() != null && theObj.getValue() == null) {
return 1;
}
if (getValue() == null && theObj.getValue() != null) {
return -1;
}
return getValue().compareTo(theObj.getValue());
}
@Override
protected String encode(BigDecimal theValue) {
return getValue().toPlainString();
}
/**
* Gets the value as an integer, using {@link BigDecimal#intValue()}
*/
public int getValueAsInteger() {
return getValue().intValue();
}
public Number getValueAsNumber() {
return getValue();
}
@Override
protected BigDecimal parse(String theValue) {
return new BigDecimal(theValue);
}
/**
* Rounds the value to the given prevision
*
* @see MathContext#getPrecision()
*/
public void round(int thePrecision) {
if (getValue() != null) {
BigDecimal newValue = getValue().round(new MathContext(thePrecision));
setValue(newValue);
}
}
/**
* Rounds the value to the given prevision
*
* @see MathContext#getPrecision()
* @see MathContext#getRoundingMode()
*/
public void round(int thePrecision, RoundingMode theRoundingMode) {
if (getValue() != null) {
BigDecimal newValue = getValue().round(new MathContext(thePrecision, theRoundingMode));
setValue(newValue);
}
}
/**
* Sets a new value using an integer
*/
public void setValueAsInteger(int theValue) {
setValue(new BigDecimal(theValue));
}
/**
* Sets a new value using a long
*/
public void setValue(long theValue) {
setValue(new BigDecimal(theValue));
}
/**
* Sets a new value using a double
*/
public void setValue(double theValue) {
setValue(new BigDecimal(theValue));
}
@Override
public DecimalType copy() {
return new DecimalType(getValue());
}
public String fhirType() {
return "decimal";
}
}

View File

@ -0,0 +1,705 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A record of a device being used by a patient where the record is the result of a report from the patient or another clinician.
*/
@ResourceDef(name="DeviceUseStatement", profile="http://hl7.org/fhir/Profile/DeviceUseStatement")
public class DeviceUseStatement extends DomainResource {
/**
* Indicates the site on the subject's body where the device was used ( i.e. the target site).
*/
@Child(name = "bodySite", type = {CodeableConcept.class, BodySite.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Target body site", formalDefinition="Indicates the site on the subject's body where the device was used ( i.e. the target site)." )
protected Type bodySite;
/**
* The time period over which the device was used.
*/
@Child(name = "whenUsed", type = {Period.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="The time period over which the device was used." )
protected Period whenUsed;
/**
* The details of the device used.
*/
@Child(name = "device", type = {Device.class}, order=2, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="The details of the device used." )
protected Reference device;
/**
* The actual object that is the target of the reference (The details of the device used.)
*/
protected Device deviceTarget;
/**
* An external identifier for this statement such as an IRI.
*/
@Child(name = "identifier", type = {Identifier.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="An external identifier for this statement such as an IRI." )
protected List<Identifier> identifier;
/**
* Reason or justification for the use of the device.
*/
@Child(name = "indication", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="Reason or justification for the use of the device." )
protected List<CodeableConcept> indication;
/**
* Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.
*/
@Child(name = "notes", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement." )
protected List<StringType> notes;
/**
* The time at which the statement was made/recorded.
*/
@Child(name = "recordedOn", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="The time at which the statement was made/recorded." )
protected DateTimeType recordedOn;
/**
* The patient who used the device.
*/
@Child(name = "subject", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="The patient who used the device." )
protected Reference subject;
/**
* The actual object that is the target of the reference (The patient who used the device.)
*/
protected Patient subjectTarget;
/**
* How often the device was used.
*/
@Child(name = "timing", type = {Timing.class, Period.class, DateTimeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="", formalDefinition="How often the device was used." )
protected Type timing;
private static final long serialVersionUID = -1668571635L;
/*
* Constructor
*/
public DeviceUseStatement() {
super();
}
/*
* Constructor
*/
public DeviceUseStatement(Reference device, Reference subject) {
super();
this.device = device;
this.subject = subject;
}
/**
* @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).)
*/
public Type getBodySite() {
return this.bodySite;
}
/**
* @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).)
*/
public CodeableConcept getBodySiteCodeableConcept() throws FHIRException {
if (!(this.bodySite instanceof CodeableConcept))
throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.bodySite.getClass().getName()+" was encountered");
return (CodeableConcept) this.bodySite;
}
public boolean hasBodySiteCodeableConcept() {
return this.bodySite instanceof CodeableConcept;
}
/**
* @return {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).)
*/
public Reference getBodySiteReference() throws FHIRException {
if (!(this.bodySite instanceof Reference))
throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.bodySite.getClass().getName()+" was encountered");
return (Reference) this.bodySite;
}
public boolean hasBodySiteReference() {
return this.bodySite instanceof Reference;
}
public boolean hasBodySite() {
return this.bodySite != null && !this.bodySite.isEmpty();
}
/**
* @param value {@link #bodySite} (Indicates the site on the subject's body where the device was used ( i.e. the target site).)
*/
public DeviceUseStatement setBodySite(Type value) {
this.bodySite = value;
return this;
}
/**
* @return {@link #whenUsed} (The time period over which the device was used.)
*/
public Period getWhenUsed() {
if (this.whenUsed == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DeviceUseStatement.whenUsed");
else if (Configuration.doAutoCreate())
this.whenUsed = new Period(); // cc
return this.whenUsed;
}
public boolean hasWhenUsed() {
return this.whenUsed != null && !this.whenUsed.isEmpty();
}
/**
* @param value {@link #whenUsed} (The time period over which the device was used.)
*/
public DeviceUseStatement setWhenUsed(Period value) {
this.whenUsed = value;
return this;
}
/**
* @return {@link #device} (The details of the device used.)
*/
public Reference getDevice() {
if (this.device == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DeviceUseStatement.device");
else if (Configuration.doAutoCreate())
this.device = new Reference(); // cc
return this.device;
}
public boolean hasDevice() {
return this.device != null && !this.device.isEmpty();
}
/**
* @param value {@link #device} (The details of the device used.)
*/
public DeviceUseStatement setDevice(Reference value) {
this.device = value;
return this;
}
/**
* @return {@link #device} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The details of the device used.)
*/
public Device getDeviceTarget() {
if (this.deviceTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DeviceUseStatement.device");
else if (Configuration.doAutoCreate())
this.deviceTarget = new Device(); // aa
return this.deviceTarget;
}
/**
* @param value {@link #device} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The details of the device used.)
*/
public DeviceUseStatement setDeviceTarget(Device value) {
this.deviceTarget = value;
return this;
}
/**
* @return {@link #identifier} (An external identifier for this statement such as an IRI.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (An external identifier for this statement such as an IRI.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public DeviceUseStatement addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #indication} (Reason or justification for the use of the device.)
*/
public List<CodeableConcept> getIndication() {
if (this.indication == null)
this.indication = new ArrayList<CodeableConcept>();
return this.indication;
}
public boolean hasIndication() {
if (this.indication == null)
return false;
for (CodeableConcept item : this.indication)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #indication} (Reason or justification for the use of the device.)
*/
// syntactic sugar
public CodeableConcept addIndication() { //3
CodeableConcept t = new CodeableConcept();
if (this.indication == null)
this.indication = new ArrayList<CodeableConcept>();
this.indication.add(t);
return t;
}
// syntactic sugar
public DeviceUseStatement addIndication(CodeableConcept t) { //3
if (t == null)
return this;
if (this.indication == null)
this.indication = new ArrayList<CodeableConcept>();
this.indication.add(t);
return this;
}
/**
* @return {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.)
*/
public List<StringType> getNotes() {
if (this.notes == null)
this.notes = new ArrayList<StringType>();
return this.notes;
}
public boolean hasNotes() {
if (this.notes == null)
return false;
for (StringType item : this.notes)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.)
*/
// syntactic sugar
public StringType addNotesElement() {//2
StringType t = new StringType();
if (this.notes == null)
this.notes = new ArrayList<StringType>();
this.notes.add(t);
return t;
}
/**
* @param value {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.)
*/
public DeviceUseStatement addNotes(String value) { //1
StringType t = new StringType();
t.setValue(value);
if (this.notes == null)
this.notes = new ArrayList<StringType>();
this.notes.add(t);
return this;
}
/**
* @param value {@link #notes} (Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.)
*/
public boolean hasNotes(String value) {
if (this.notes == null)
return false;
for (StringType v : this.notes)
if (v.equals(value)) // string
return true;
return false;
}
/**
* @return {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value
*/
public DateTimeType getRecordedOnElement() {
if (this.recordedOn == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DeviceUseStatement.recordedOn");
else if (Configuration.doAutoCreate())
this.recordedOn = new DateTimeType(); // bb
return this.recordedOn;
}
public boolean hasRecordedOnElement() {
return this.recordedOn != null && !this.recordedOn.isEmpty();
}
public boolean hasRecordedOn() {
return this.recordedOn != null && !this.recordedOn.isEmpty();
}
/**
* @param value {@link #recordedOn} (The time at which the statement was made/recorded.). This is the underlying object with id, value and extensions. The accessor "getRecordedOn" gives direct access to the value
*/
public DeviceUseStatement setRecordedOnElement(DateTimeType value) {
this.recordedOn = value;
return this;
}
/**
* @return The time at which the statement was made/recorded.
*/
public Date getRecordedOn() {
return this.recordedOn == null ? null : this.recordedOn.getValue();
}
/**
* @param value The time at which the statement was made/recorded.
*/
public DeviceUseStatement setRecordedOn(Date value) {
if (value == null)
this.recordedOn = null;
else {
if (this.recordedOn == null)
this.recordedOn = new DateTimeType();
this.recordedOn.setValue(value);
}
return this;
}
/**
* @return {@link #subject} (The patient who used the device.)
*/
public Reference getSubject() {
if (this.subject == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DeviceUseStatement.subject");
else if (Configuration.doAutoCreate())
this.subject = new Reference(); // cc
return this.subject;
}
public boolean hasSubject() {
return this.subject != null && !this.subject.isEmpty();
}
/**
* @param value {@link #subject} (The patient who used the device.)
*/
public DeviceUseStatement setSubject(Reference value) {
this.subject = value;
return this;
}
/**
* @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient who used the device.)
*/
public Patient getSubjectTarget() {
if (this.subjectTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DeviceUseStatement.subject");
else if (Configuration.doAutoCreate())
this.subjectTarget = new Patient(); // aa
return this.subjectTarget;
}
/**
* @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient who used the device.)
*/
public DeviceUseStatement setSubjectTarget(Patient value) {
this.subjectTarget = value;
return this;
}
/**
* @return {@link #timing} (How often the device was used.)
*/
public Type getTiming() {
return this.timing;
}
/**
* @return {@link #timing} (How often the device was used.)
*/
public Timing getTimingTiming() throws FHIRException {
if (!(this.timing instanceof Timing))
throw new FHIRException("Type mismatch: the type Timing was expected, but "+this.timing.getClass().getName()+" was encountered");
return (Timing) this.timing;
}
public boolean hasTimingTiming() {
return this.timing instanceof Timing;
}
/**
* @return {@link #timing} (How often the device was used.)
*/
public Period getTimingPeriod() throws FHIRException {
if (!(this.timing instanceof Period))
throw new FHIRException("Type mismatch: the type Period was expected, but "+this.timing.getClass().getName()+" was encountered");
return (Period) this.timing;
}
public boolean hasTimingPeriod() {
return this.timing instanceof Period;
}
/**
* @return {@link #timing} (How often the device was used.)
*/
public DateTimeType getTimingDateTimeType() throws FHIRException {
if (!(this.timing instanceof DateTimeType))
throw new FHIRException("Type mismatch: the type DateTimeType was expected, but "+this.timing.getClass().getName()+" was encountered");
return (DateTimeType) this.timing;
}
public boolean hasTimingDateTimeType() {
return this.timing instanceof DateTimeType;
}
public boolean hasTiming() {
return this.timing != null && !this.timing.isEmpty();
}
/**
* @param value {@link #timing} (How often the device was used.)
*/
public DeviceUseStatement setTiming(Type value) {
this.timing = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("bodySite[x]", "CodeableConcept|Reference(BodySite)", "Indicates the site on the subject's body where the device was used ( i.e. the target site).", 0, java.lang.Integer.MAX_VALUE, bodySite));
childrenList.add(new Property("whenUsed", "Period", "The time period over which the device was used.", 0, java.lang.Integer.MAX_VALUE, whenUsed));
childrenList.add(new Property("device", "Reference(Device)", "The details of the device used.", 0, java.lang.Integer.MAX_VALUE, device));
childrenList.add(new Property("identifier", "Identifier", "An external identifier for this statement such as an IRI.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("indication", "CodeableConcept", "Reason or justification for the use of the device.", 0, java.lang.Integer.MAX_VALUE, indication));
childrenList.add(new Property("notes", "string", "Details about the device statement that were not represented at all or sufficiently in one of the attributes provided in a class. These may include for example a comment, an instruction, or a note associated with the statement.", 0, java.lang.Integer.MAX_VALUE, notes));
childrenList.add(new Property("recordedOn", "dateTime", "The time at which the statement was made/recorded.", 0, java.lang.Integer.MAX_VALUE, recordedOn));
childrenList.add(new Property("subject", "Reference(Patient)", "The patient who used the device.", 0, java.lang.Integer.MAX_VALUE, subject));
childrenList.add(new Property("timing[x]", "Timing|Period|dateTime", "How often the device was used.", 0, java.lang.Integer.MAX_VALUE, timing));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("bodySite[x]"))
this.bodySite = (Type) value; // Type
else if (name.equals("whenUsed"))
this.whenUsed = castToPeriod(value); // Period
else if (name.equals("device"))
this.device = castToReference(value); // Reference
else if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("indication"))
this.getIndication().add(castToCodeableConcept(value));
else if (name.equals("notes"))
this.getNotes().add(castToString(value));
else if (name.equals("recordedOn"))
this.recordedOn = castToDateTime(value); // DateTimeType
else if (name.equals("subject"))
this.subject = castToReference(value); // Reference
else if (name.equals("timing[x]"))
this.timing = (Type) value; // Type
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("bodySiteCodeableConcept")) {
this.bodySite = new CodeableConcept();
return this.bodySite;
}
else if (name.equals("bodySiteReference")) {
this.bodySite = new Reference();
return this.bodySite;
}
else if (name.equals("whenUsed")) {
this.whenUsed = new Period();
return this.whenUsed;
}
else if (name.equals("device")) {
this.device = new Reference();
return this.device;
}
else if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("indication")) {
return addIndication();
}
else if (name.equals("notes")) {
throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.notes");
}
else if (name.equals("recordedOn")) {
throw new FHIRException("Cannot call addChild on a primitive type DeviceUseStatement.recordedOn");
}
else if (name.equals("subject")) {
this.subject = new Reference();
return this.subject;
}
else if (name.equals("timingTiming")) {
this.timing = new Timing();
return this.timing;
}
else if (name.equals("timingPeriod")) {
this.timing = new Period();
return this.timing;
}
else if (name.equals("timingDateTime")) {
this.timing = new DateTimeType();
return this.timing;
}
else
return super.addChild(name);
}
public String fhirType() {
return "DeviceUseStatement";
}
public DeviceUseStatement copy() {
DeviceUseStatement dst = new DeviceUseStatement();
copyValues(dst);
dst.bodySite = bodySite == null ? null : bodySite.copy();
dst.whenUsed = whenUsed == null ? null : whenUsed.copy();
dst.device = device == null ? null : device.copy();
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
if (indication != null) {
dst.indication = new ArrayList<CodeableConcept>();
for (CodeableConcept i : indication)
dst.indication.add(i.copy());
};
if (notes != null) {
dst.notes = new ArrayList<StringType>();
for (StringType i : notes)
dst.notes.add(i.copy());
};
dst.recordedOn = recordedOn == null ? null : recordedOn.copy();
dst.subject = subject == null ? null : subject.copy();
dst.timing = timing == null ? null : timing.copy();
return dst;
}
protected DeviceUseStatement typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof DeviceUseStatement))
return false;
DeviceUseStatement o = (DeviceUseStatement) other;
return compareDeep(bodySite, o.bodySite, true) && compareDeep(whenUsed, o.whenUsed, true) && compareDeep(device, o.device, true)
&& compareDeep(identifier, o.identifier, true) && compareDeep(indication, o.indication, true) && compareDeep(notes, o.notes, true)
&& compareDeep(recordedOn, o.recordedOn, true) && compareDeep(subject, o.subject, true) && compareDeep(timing, o.timing, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof DeviceUseStatement))
return false;
DeviceUseStatement o = (DeviceUseStatement) other;
return compareValues(notes, o.notes, true) && compareValues(recordedOn, o.recordedOn, true);
}
public boolean isEmpty() {
return super.isEmpty() && (bodySite == null || bodySite.isEmpty()) && (whenUsed == null || whenUsed.isEmpty())
&& (device == null || device.isEmpty()) && (identifier == null || identifier.isEmpty()) && (indication == null || indication.isEmpty())
&& (notes == null || notes.isEmpty()) && (recordedOn == null || recordedOn.isEmpty()) && (subject == null || subject.isEmpty())
&& (timing == null || timing.isEmpty());
}
@Override
public ResourceType getResourceType() {
return ResourceType.DeviceUseStatement;
}
@SearchParamDefinition(name="subject", path="DeviceUseStatement.subject", description="Search by subject", type="reference" )
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="patient", path="DeviceUseStatement.subject", description="Search by subject - a patient", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="device", path="DeviceUseStatement.device", description="Search by device", type="reference" )
public static final String SP_DEVICE = "device";
}

View File

@ -0,0 +1,91 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
@DatatypeDef(name="Distance", profileOf=Quantity.class)
public class Distance extends Quantity {
private static final long serialVersionUID = 1069574054L;
public Distance copy() {
Distance dst = new Distance();
copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
return dst;
}
protected Distance typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Distance))
return false;
Distance o = (Distance) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Distance))
return false;
Distance o = (Distance) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -0,0 +1,302 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A resource that includes narrative, extensions, and contained resources.
*/
public abstract class DomainResource extends Resource implements IBaseHasExtensions, IBaseHasModifierExtensions, IDomainResource {
/**
* A human-readable narrative that contains a summary of the resource, and may 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.
*/
@Child(name = "text", type = {Narrative.class}, order=0, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Text summary of the resource, for human interpretation", formalDefinition="A human-readable narrative that contains a summary of the resource, and may 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." )
protected Narrative 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.
*/
@Child(name = "contained", type = {Resource.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Contained, inline Resources", formalDefinition="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." )
protected List<Resource> contained;
/**
* May be used to represent additional information that is not part of the basic definition of the resource. In order 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.
*/
@Child(name = "extension", type = {Extension.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the resource. In order 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." )
protected List<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. Usually modifier elements provide negation or qualification. In order 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.
*/
@Child(name = "modifierExtension", type = {Extension.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=true, summary=false)
@Description(shortDefinition="Extensions that cannot be ignored", formalDefinition="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. Usually modifier elements provide negation or qualification. In order 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." )
protected List<Extension> modifierExtension;
private static final long serialVersionUID = -970285559L;
/*
* Constructor
*/
public DomainResource() {
super();
}
/**
* @return {@link #text} (A human-readable narrative that contains a summary of the resource, and may 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.)
*/
public Narrative getText() {
if (this.text == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DomainResource.text");
else if (Configuration.doAutoCreate())
this.text = new Narrative(); // cc
return this.text;
}
public boolean hasText() {
return this.text != null && !this.text.isEmpty();
}
/**
* @param value {@link #text} (A human-readable narrative that contains a summary of the resource, and may 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.)
*/
public DomainResource setText(Narrative value) {
this.text = value;
return this;
}
/**
* @return {@link #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.)
*/
public List<Resource> getContained() {
if (this.contained == null)
this.contained = new ArrayList<Resource>();
return this.contained;
}
public boolean hasContained() {
if (this.contained == null)
return false;
for (Resource item : this.contained)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the resource. In order 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.)
*/
public List<Extension> getExtension() {
if (this.extension == null)
this.extension = new ArrayList<Extension>();
return this.extension;
}
public boolean hasExtension() {
if (this.extension == null)
return false;
for (Extension item : this.extension)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the resource. In order 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.)
*/
// syntactic sugar
public Extension addExtension() { //3
Extension t = new Extension();
if (this.extension == null)
this.extension = new ArrayList<Extension>();
this.extension.add(t);
return t;
}
// syntactic sugar
public DomainResource addExtension(Extension t) { //3
if (t == null)
return this;
if (this.extension == null)
this.extension = new ArrayList<Extension>();
this.extension.add(t);
return this;
}
/**
* @return {@link #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. Usually modifier elements provide negation or qualification. In order 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.)
*/
public List<Extension> getModifierExtension() {
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>();
return this.modifierExtension;
}
public boolean hasModifierExtension() {
if (this.modifierExtension == null)
return false;
for (Extension item : this.modifierExtension)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #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. Usually modifier elements provide negation or qualification. In order 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.)
*/
// syntactic sugar
public Extension addModifierExtension() { //3
Extension t = new Extension();
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension.add(t);
return t;
}
// syntactic sugar
public DomainResource addModifierExtension(Extension t) { //3
if (t == null)
return this;
if (this.modifierExtension == null)
this.modifierExtension = new ArrayList<Extension>();
this.modifierExtension.add(t);
return this;
}
protected void listChildren(List<Property> childrenList) {
childrenList.add(new Property("text", "Narrative", "A human-readable narrative that contains a summary of the resource, and may 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.", 0, java.lang.Integer.MAX_VALUE, text));
childrenList.add(new Property("contained", "Resource", "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.", 0, java.lang.Integer.MAX_VALUE, contained));
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the resource. In order 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.", 0, java.lang.Integer.MAX_VALUE, extension));
childrenList.add(new Property("modifierExtension", "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. Usually modifier elements provide negation or qualification. In order 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.", 0, java.lang.Integer.MAX_VALUE, modifierExtension));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("text"))
this.text = castToNarrative(value); // Narrative
else if (name.equals("contained"))
this.getContained().add(castToResource(value));
else if (name.equals("extension"))
this.getExtension().add(castToExtension(value));
else if (name.equals("modifierExtension"))
this.getModifierExtension().add(castToExtension(value));
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("text")) {
this.text = new Narrative();
return this.text;
}
else if (name.equals("contained")) {
throw new FHIRException("Cannot call addChild on an abstract type DomainResource.contained");
}
else if (name.equals("extension")) {
return addExtension();
}
else if (name.equals("modifierExtension")) {
return addModifierExtension();
}
else
return super.addChild(name);
}
public String fhirType() {
return "DomainResource";
}
public abstract DomainResource copy();
public void copyValues(DomainResource dst) {
dst.text = text == null ? null : text.copy();
if (contained != null) {
dst.contained = new ArrayList<Resource>();
for (Resource i : contained)
dst.contained.add(i.copy());
};
if (extension != null) {
dst.extension = new ArrayList<Extension>();
for (Extension i : extension)
dst.extension.add(i.copy());
};
if (modifierExtension != null) {
dst.modifierExtension = new ArrayList<Extension>();
for (Extension i : modifierExtension)
dst.modifierExtension.add(i.copy());
};
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof DomainResource))
return false;
DomainResource o = (DomainResource) other;
return compareDeep(text, o.text, true) && compareDeep(contained, o.contained, true) && compareDeep(extension, o.extension, true)
&& compareDeep(modifierExtension, o.modifierExtension, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof DomainResource))
return false;
DomainResource o = (DomainResource) other;
return true;
}
public boolean isEmpty() {
return super.isEmpty() && (text == null || text.isEmpty()) && (contained == null || contained.isEmpty())
&& (extension == null || extension.isEmpty()) && (modifierExtension == null || modifierExtension.isEmpty())
;
}
}

View File

@ -0,0 +1,91 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A measured amount (or an amount that can potentially be measured). Note that measured amounts include amounts that are not precisely quantified, including amounts involving arbitrary units and floating currencies.
*/
@DatatypeDef(name="Duration", profileOf=Quantity.class)
public class Duration extends Quantity {
private static final long serialVersionUID = 1069574054L;
public Duration copy() {
Duration dst = new Duration();
copyValues(dst);
dst.value = value == null ? null : value.copy();
dst.comparator = comparator == null ? null : comparator.copy();
dst.unit = unit == null ? null : unit.copy();
dst.system = system == null ? null : system.copy();
dst.code = code == null ? null : code.copy();
return dst;
}
protected Duration typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Duration))
return false;
Duration o = (Duration) other;
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Duration))
return false;
Duration o = (Duration) other;
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
}
public boolean isEmpty() {
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
&& (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
;
}
}

View File

@ -0,0 +1,263 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Base definition for all elements in a resource.
*/
public abstract class Element extends Base implements IBaseHasExtensions {
/**
* unique id for the element within a resource (for internal references).
*/
@Child(name = "id", type = {IdType.class}, order=0, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="xml:id (or equivalent in JSON)", formalDefinition="unique id for the element within a resource (for internal references)." )
protected IdType id;
/**
* May be used to represent additional information that is not part of the basic definition of the element. In order 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.
*/
@Child(name = "extension", type = {Extension.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
@Description(shortDefinition="Additional Content defined by implementations", formalDefinition="May be used to represent additional information that is not part of the basic definition of the element. In order 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." )
protected List<Extension> extension;
private static final long serialVersionUID = -158027598L;
/*
* Constructor
*/
public Element() {
super();
}
/**
* @return {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
*/
public IdType getIdElement() {
if (this.id == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Element.id");
else if (Configuration.doAutoCreate())
this.id = new IdType(); // bb
return this.id;
}
public boolean hasIdElement() {
return this.id != null && !this.id.isEmpty();
}
public boolean hasId() {
return this.id != null && !this.id.isEmpty();
}
/**
* @param value {@link #id} (unique id for the element within a resource (for internal references).). This is the underlying object with id, value and extensions. The accessor "getId" gives direct access to the value
*/
public Element setIdElement(IdType value) {
this.id = value;
return this;
}
/**
* @return unique id for the element within a resource (for internal references).
*/
public String getId() {
return this.id == null ? null : this.id.getValue();
}
/**
* @param value unique id for the element within a resource (for internal references).
*/
public Element setId(String value) {
if (Utilities.noString(value))
this.id = null;
else {
if (this.id == null)
this.id = new IdType();
this.id.setValue(value);
}
return this;
}
/**
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order 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.)
*/
public List<Extension> getExtension() {
if (this.extension == null)
this.extension = new ArrayList<Extension>();
return this.extension;
}
public boolean hasExtension() {
if (this.extension == null)
return false;
for (Extension item : this.extension)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #extension} (May be used to represent additional information that is not part of the basic definition of the element. In order 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.)
*/
// syntactic sugar
public Extension addExtension() { //3
Extension t = new Extension();
if (this.extension == null)
this.extension = new ArrayList<Extension>();
this.extension.add(t);
return t;
}
// syntactic sugar
public Element addExtension(Extension t) { //3
if (t == null)
return this;
if (this.extension == null)
this.extension = new ArrayList<Extension>();
this.extension.add(t);
return this;
}
/**
* Returns an unmodifiable list containing all extensions on this element which
* match the given URL.
*
* @param theUrl The URL. Must not be blank or null.
* @return an unmodifiable list containing all extensions on this element which
* match the given URL
*/
public List<Extension> getExtensionsByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
ArrayList<Extension> retVal = new ArrayList<Extension>();
for (Extension next : getExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
return java.util.Collections.unmodifiableList(retVal);
}
public boolean hasExtension(String theUrl) {
return !getExtensionsByUrl(theUrl).isEmpty();
}
public String getExtensionString(String theUrl) throws FHIRException {
List<Extension> ext = getExtensionsByUrl(theUrl);
if (ext.isEmpty())
return null;
if (ext.size() > 1)
throw new FHIRException("Multiple matching extensions found");
if (!ext.get(0).getValue().isPrimitive())
throw new FHIRException("Extension could not be converted to a string");
return ext.get(0).getValue().primitiveValue();
}
protected void listChildren(List<Property> childrenList) {
childrenList.add(new Property("id", "id", "unique id for the element within a resource (for internal references).", 0, java.lang.Integer.MAX_VALUE, id));
childrenList.add(new Property("extension", "Extension", "May be used to represent additional information that is not part of the basic definition of the element. In order 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.", 0, java.lang.Integer.MAX_VALUE, extension));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("id"))
this.id = castToId(value); // IdType
else if (name.equals("extension"))
this.getExtension().add(castToExtension(value));
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("id")) {
throw new FHIRException("Cannot call addChild on a primitive type Element.id");
}
else if (name.equals("extension")) {
return addExtension();
}
else
return super.addChild(name);
}
public String fhirType() {
return "Element";
}
public abstract Element copy();
public void copyValues(Element dst) {
dst.id = id == null ? null : id.copy();
if (extension != null) {
dst.extension = new ArrayList<Extension>();
for (Extension i : extension)
dst.extension.add(i.copy());
};
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Element))
return false;
Element o = (Element) other;
return compareDeep(id, o.id, true) && compareDeep(extension, o.extension, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Element))
return false;
Element o = (Element) other;
return compareValues(id, o.id, true);
}
public boolean isEmpty() {
return super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty())
;
}
}

View File

@ -0,0 +1,519 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* This resource provides the insurance eligibility details from the insurer regarding a specified coverage and optionally some class of service.
*/
@ResourceDef(name="EligibilityRequest", profile="http://hl7.org/fhir/Profile/EligibilityRequest")
public class EligibilityRequest extends DomainResource {
/**
* The Response business identifier.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
protected List<Identifier> identifier;
/**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
*/
@Child(name = "ruleset", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
protected Coding ruleset;
/**
* The style (standard) and version of the original material which was converted into this resource.
*/
@Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
protected Coding originalRuleset;
/**
* The date when this resource was created.
*/
@Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
protected DateTimeType created;
/**
* The Insurer who is target of the request.
*/
@Child(name = "target", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." )
protected Reference target;
/**
* The actual object that is the target of the reference (The Insurer who is target of the request.)
*/
protected Organization targetTarget;
/**
* The practitioner who is responsible for the services rendered to the patient.
*/
@Child(name = "provider", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
protected Reference provider;
/**
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
*/
protected Practitioner providerTarget;
/**
* The organization which is responsible for the services rendered to the patient.
*/
@Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
protected Reference organization;
/**
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
*/
protected Organization organizationTarget;
private static final long serialVersionUID = 1836339504L;
/*
* Constructor
*/
public EligibilityRequest() {
super();
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public EligibilityRequest addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public Coding getRuleset() {
if (this.ruleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.ruleset");
else if (Configuration.doAutoCreate())
this.ruleset = new Coding(); // cc
return this.ruleset;
}
public boolean hasRuleset() {
return this.ruleset != null && !this.ruleset.isEmpty();
}
/**
* @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public EligibilityRequest setRuleset(Coding value) {
this.ruleset = value;
return this;
}
/**
* @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public Coding getOriginalRuleset() {
if (this.originalRuleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.originalRuleset");
else if (Configuration.doAutoCreate())
this.originalRuleset = new Coding(); // cc
return this.originalRuleset;
}
public boolean hasOriginalRuleset() {
return this.originalRuleset != null && !this.originalRuleset.isEmpty();
}
/**
* @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public EligibilityRequest setOriginalRuleset(Coding value) {
this.originalRuleset = value;
return this;
}
/**
* @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public DateTimeType getCreatedElement() {
if (this.created == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.created");
else if (Configuration.doAutoCreate())
this.created = new DateTimeType(); // bb
return this.created;
}
public boolean hasCreatedElement() {
return this.created != null && !this.created.isEmpty();
}
public boolean hasCreated() {
return this.created != null && !this.created.isEmpty();
}
/**
* @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public EligibilityRequest setCreatedElement(DateTimeType value) {
this.created = value;
return this;
}
/**
* @return The date when this resource was created.
*/
public Date getCreated() {
return this.created == null ? null : this.created.getValue();
}
/**
* @param value The date when this resource was created.
*/
public EligibilityRequest setCreated(Date value) {
if (value == null)
this.created = null;
else {
if (this.created == null)
this.created = new DateTimeType();
this.created.setValue(value);
}
return this;
}
/**
* @return {@link #target} (The Insurer who is target of the request.)
*/
public Reference getTarget() {
if (this.target == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.target");
else if (Configuration.doAutoCreate())
this.target = new Reference(); // cc
return this.target;
}
public boolean hasTarget() {
return this.target != null && !this.target.isEmpty();
}
/**
* @param value {@link #target} (The Insurer who is target of the request.)
*/
public EligibilityRequest setTarget(Reference value) {
this.target = value;
return this;
}
/**
* @return {@link #target} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who is target of the request.)
*/
public Organization getTargetTarget() {
if (this.targetTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.target");
else if (Configuration.doAutoCreate())
this.targetTarget = new Organization(); // aa
return this.targetTarget;
}
/**
* @param value {@link #target} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who is target of the request.)
*/
public EligibilityRequest setTargetTarget(Organization value) {
this.targetTarget = value;
return this;
}
/**
* @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public Reference getProvider() {
if (this.provider == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.provider");
else if (Configuration.doAutoCreate())
this.provider = new Reference(); // cc
return this.provider;
}
public boolean hasProvider() {
return this.provider != null && !this.provider.isEmpty();
}
/**
* @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public EligibilityRequest setProvider(Reference value) {
this.provider = value;
return this;
}
/**
* @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public Practitioner getProviderTarget() {
if (this.providerTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.provider");
else if (Configuration.doAutoCreate())
this.providerTarget = new Practitioner(); // aa
return this.providerTarget;
}
/**
* @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public EligibilityRequest setProviderTarget(Practitioner value) {
this.providerTarget = value;
return this;
}
/**
* @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
*/
public Reference getOrganization() {
if (this.organization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.organization");
else if (Configuration.doAutoCreate())
this.organization = new Reference(); // cc
return this.organization;
}
public boolean hasOrganization() {
return this.organization != null && !this.organization.isEmpty();
}
/**
* @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
*/
public EligibilityRequest setOrganization(Reference value) {
this.organization = value;
return this;
}
/**
* @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public Organization getOrganizationTarget() {
if (this.organizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityRequest.organization");
else if (Configuration.doAutoCreate())
this.organizationTarget = new Organization(); // aa
return this.organizationTarget;
}
/**
* @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public EligibilityRequest setOrganizationTarget(Organization value) {
this.organizationTarget = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created));
childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target of the request.", 0, java.lang.Integer.MAX_VALUE, target));
childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("ruleset"))
this.ruleset = castToCoding(value); // Coding
else if (name.equals("originalRuleset"))
this.originalRuleset = castToCoding(value); // Coding
else if (name.equals("created"))
this.created = castToDateTime(value); // DateTimeType
else if (name.equals("target"))
this.target = castToReference(value); // Reference
else if (name.equals("provider"))
this.provider = castToReference(value); // Reference
else if (name.equals("organization"))
this.organization = castToReference(value); // Reference
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("ruleset")) {
this.ruleset = new Coding();
return this.ruleset;
}
else if (name.equals("originalRuleset")) {
this.originalRuleset = new Coding();
return this.originalRuleset;
}
else if (name.equals("created")) {
throw new FHIRException("Cannot call addChild on a primitive type EligibilityRequest.created");
}
else if (name.equals("target")) {
this.target = new Reference();
return this.target;
}
else if (name.equals("provider")) {
this.provider = new Reference();
return this.provider;
}
else if (name.equals("organization")) {
this.organization = new Reference();
return this.organization;
}
else
return super.addChild(name);
}
public String fhirType() {
return "EligibilityRequest";
}
public EligibilityRequest copy() {
EligibilityRequest dst = new EligibilityRequest();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.ruleset = ruleset == null ? null : ruleset.copy();
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
dst.created = created == null ? null : created.copy();
dst.target = target == null ? null : target.copy();
dst.provider = provider == null ? null : provider.copy();
dst.organization = organization == null ? null : organization.copy();
return dst;
}
protected EligibilityRequest typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof EligibilityRequest))
return false;
EligibilityRequest o = (EligibilityRequest) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
&& compareDeep(created, o.created, true) && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true)
&& compareDeep(organization, o.organization, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof EligibilityRequest))
return false;
EligibilityRequest o = (EligibilityRequest) other;
return compareValues(created, o.created, true);
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (ruleset == null || ruleset.isEmpty())
&& (originalRuleset == null || originalRuleset.isEmpty()) && (created == null || created.isEmpty())
&& (target == null || target.isEmpty()) && (provider == null || provider.isEmpty()) && (organization == null || organization.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.EligibilityRequest;
}
@SearchParamDefinition(name="identifier", path="EligibilityRequest.identifier", description="The business identifier of the Eligibility", type="token" )
public static final String SP_IDENTIFIER = "identifier";
}

View File

@ -0,0 +1,714 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* This resource provides eligibility and plan details from the processing of an Eligibility resource.
*/
@ResourceDef(name="EligibilityResponse", profile="http://hl7.org/fhir/Profile/EligibilityResponse")
public class EligibilityResponse extends DomainResource {
/**
* The Response business identifier.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
protected List<Identifier> identifier;
/**
* Original request resource reference.
*/
@Child(name = "request", type = {EligibilityRequest.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
protected Reference request;
/**
* The actual object that is the target of the reference (Original request resource reference.)
*/
protected EligibilityRequest requestTarget;
/**
* Transaction status: error, complete.
*/
@Child(name = "outcome", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="complete | error", formalDefinition="Transaction status: error, complete." )
protected Enumeration<RemittanceOutcome> outcome;
/**
* A description of the status of the adjudication.
*/
@Child(name = "disposition", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
protected StringType disposition;
/**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
*/
@Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
protected Coding ruleset;
/**
* The style (standard) and version of the original material which was converted into this resource.
*/
@Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
protected Coding originalRuleset;
/**
* The date when the enclosed suite of services were performed or completed.
*/
@Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
protected DateTimeType created;
/**
* The Insurer who produced this adjudicated response.
*/
@Child(name = "organization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
protected Reference organization;
/**
* The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
*/
protected Organization organizationTarget;
/**
* The practitioner who is responsible for the services rendered to the patient.
*/
@Child(name = "requestProvider", type = {Practitioner.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
protected Reference requestProvider;
/**
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
*/
protected Practitioner requestProviderTarget;
/**
* The organization which is responsible for the services rendered to the patient.
*/
@Child(name = "requestOrganization", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
protected Reference requestOrganization;
/**
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
*/
protected Organization requestOrganizationTarget;
private static final long serialVersionUID = -299931023L;
/*
* Constructor
*/
public EligibilityResponse() {
super();
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public EligibilityResponse addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #request} (Original request resource reference.)
*/
public Reference getRequest() {
if (this.request == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.request");
else if (Configuration.doAutoCreate())
this.request = new Reference(); // cc
return this.request;
}
public boolean hasRequest() {
return this.request != null && !this.request.isEmpty();
}
/**
* @param value {@link #request} (Original request resource reference.)
*/
public EligibilityResponse setRequest(Reference value) {
this.request = value;
return this;
}
/**
* @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
*/
public EligibilityRequest getRequestTarget() {
if (this.requestTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.request");
else if (Configuration.doAutoCreate())
this.requestTarget = new EligibilityRequest(); // aa
return this.requestTarget;
}
/**
* @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
*/
public EligibilityResponse setRequestTarget(EligibilityRequest value) {
this.requestTarget = value;
return this;
}
/**
* @return {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
*/
public Enumeration<RemittanceOutcome> getOutcomeElement() {
if (this.outcome == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.outcome");
else if (Configuration.doAutoCreate())
this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
return this.outcome;
}
public boolean hasOutcomeElement() {
return this.outcome != null && !this.outcome.isEmpty();
}
public boolean hasOutcome() {
return this.outcome != null && !this.outcome.isEmpty();
}
/**
* @param value {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
*/
public EligibilityResponse setOutcomeElement(Enumeration<RemittanceOutcome> value) {
this.outcome = value;
return this;
}
/**
* @return Transaction status: error, complete.
*/
public RemittanceOutcome getOutcome() {
return this.outcome == null ? null : this.outcome.getValue();
}
/**
* @param value Transaction status: error, complete.
*/
public EligibilityResponse setOutcome(RemittanceOutcome value) {
if (value == null)
this.outcome = null;
else {
if (this.outcome == null)
this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
this.outcome.setValue(value);
}
return this;
}
/**
* @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
*/
public StringType getDispositionElement() {
if (this.disposition == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.disposition");
else if (Configuration.doAutoCreate())
this.disposition = new StringType(); // bb
return this.disposition;
}
public boolean hasDispositionElement() {
return this.disposition != null && !this.disposition.isEmpty();
}
public boolean hasDisposition() {
return this.disposition != null && !this.disposition.isEmpty();
}
/**
* @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
*/
public EligibilityResponse setDispositionElement(StringType value) {
this.disposition = value;
return this;
}
/**
* @return A description of the status of the adjudication.
*/
public String getDisposition() {
return this.disposition == null ? null : this.disposition.getValue();
}
/**
* @param value A description of the status of the adjudication.
*/
public EligibilityResponse setDisposition(String value) {
if (Utilities.noString(value))
this.disposition = null;
else {
if (this.disposition == null)
this.disposition = new StringType();
this.disposition.setValue(value);
}
return this;
}
/**
* @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public Coding getRuleset() {
if (this.ruleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.ruleset");
else if (Configuration.doAutoCreate())
this.ruleset = new Coding(); // cc
return this.ruleset;
}
public boolean hasRuleset() {
return this.ruleset != null && !this.ruleset.isEmpty();
}
/**
* @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public EligibilityResponse setRuleset(Coding value) {
this.ruleset = value;
return this;
}
/**
* @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public Coding getOriginalRuleset() {
if (this.originalRuleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.originalRuleset");
else if (Configuration.doAutoCreate())
this.originalRuleset = new Coding(); // cc
return this.originalRuleset;
}
public boolean hasOriginalRuleset() {
return this.originalRuleset != null && !this.originalRuleset.isEmpty();
}
/**
* @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public EligibilityResponse setOriginalRuleset(Coding value) {
this.originalRuleset = value;
return this;
}
/**
* @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public DateTimeType getCreatedElement() {
if (this.created == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.created");
else if (Configuration.doAutoCreate())
this.created = new DateTimeType(); // bb
return this.created;
}
public boolean hasCreatedElement() {
return this.created != null && !this.created.isEmpty();
}
public boolean hasCreated() {
return this.created != null && !this.created.isEmpty();
}
/**
* @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public EligibilityResponse setCreatedElement(DateTimeType value) {
this.created = value;
return this;
}
/**
* @return The date when the enclosed suite of services were performed or completed.
*/
public Date getCreated() {
return this.created == null ? null : this.created.getValue();
}
/**
* @param value The date when the enclosed suite of services were performed or completed.
*/
public EligibilityResponse setCreated(Date value) {
if (value == null)
this.created = null;
else {
if (this.created == null)
this.created = new DateTimeType();
this.created.setValue(value);
}
return this;
}
/**
* @return {@link #organization} (The Insurer who produced this adjudicated response.)
*/
public Reference getOrganization() {
if (this.organization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.organization");
else if (Configuration.doAutoCreate())
this.organization = new Reference(); // cc
return this.organization;
}
public boolean hasOrganization() {
return this.organization != null && !this.organization.isEmpty();
}
/**
* @param value {@link #organization} (The Insurer who produced this adjudicated response.)
*/
public EligibilityResponse setOrganization(Reference value) {
this.organization = value;
return this;
}
/**
* @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
*/
public Organization getOrganizationTarget() {
if (this.organizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.organization");
else if (Configuration.doAutoCreate())
this.organizationTarget = new Organization(); // aa
return this.organizationTarget;
}
/**
* @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
*/
public EligibilityResponse setOrganizationTarget(Organization value) {
this.organizationTarget = value;
return this;
}
/**
* @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public Reference getRequestProvider() {
if (this.requestProvider == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.requestProvider");
else if (Configuration.doAutoCreate())
this.requestProvider = new Reference(); // cc
return this.requestProvider;
}
public boolean hasRequestProvider() {
return this.requestProvider != null && !this.requestProvider.isEmpty();
}
/**
* @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public EligibilityResponse setRequestProvider(Reference value) {
this.requestProvider = value;
return this;
}
/**
* @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public Practitioner getRequestProviderTarget() {
if (this.requestProviderTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.requestProvider");
else if (Configuration.doAutoCreate())
this.requestProviderTarget = new Practitioner(); // aa
return this.requestProviderTarget;
}
/**
* @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public EligibilityResponse setRequestProviderTarget(Practitioner value) {
this.requestProviderTarget = value;
return this;
}
/**
* @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
*/
public Reference getRequestOrganization() {
if (this.requestOrganization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.requestOrganization");
else if (Configuration.doAutoCreate())
this.requestOrganization = new Reference(); // cc
return this.requestOrganization;
}
public boolean hasRequestOrganization() {
return this.requestOrganization != null && !this.requestOrganization.isEmpty();
}
/**
* @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
*/
public EligibilityResponse setRequestOrganization(Reference value) {
this.requestOrganization = value;
return this;
}
/**
* @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public Organization getRequestOrganizationTarget() {
if (this.requestOrganizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EligibilityResponse.requestOrganization");
else if (Configuration.doAutoCreate())
this.requestOrganizationTarget = new Organization(); // aa
return this.requestOrganizationTarget;
}
/**
* @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public EligibilityResponse setRequestOrganizationTarget(Organization value) {
this.requestOrganizationTarget = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("request", "Reference(EligibilityRequest)", "Original request resource reference.", 0, java.lang.Integer.MAX_VALUE, request));
childrenList.add(new Property("outcome", "code", "Transaction status: error, complete.", 0, java.lang.Integer.MAX_VALUE, outcome));
childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
childrenList.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, organization));
childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("request"))
this.request = castToReference(value); // Reference
else if (name.equals("outcome"))
this.outcome = new RemittanceOutcomeEnumFactory().fromType(value); // Enumeration<RemittanceOutcome>
else if (name.equals("disposition"))
this.disposition = castToString(value); // StringType
else if (name.equals("ruleset"))
this.ruleset = castToCoding(value); // Coding
else if (name.equals("originalRuleset"))
this.originalRuleset = castToCoding(value); // Coding
else if (name.equals("created"))
this.created = castToDateTime(value); // DateTimeType
else if (name.equals("organization"))
this.organization = castToReference(value); // Reference
else if (name.equals("requestProvider"))
this.requestProvider = castToReference(value); // Reference
else if (name.equals("requestOrganization"))
this.requestOrganization = castToReference(value); // Reference
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("request")) {
this.request = new Reference();
return this.request;
}
else if (name.equals("outcome")) {
throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.outcome");
}
else if (name.equals("disposition")) {
throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.disposition");
}
else if (name.equals("ruleset")) {
this.ruleset = new Coding();
return this.ruleset;
}
else if (name.equals("originalRuleset")) {
this.originalRuleset = new Coding();
return this.originalRuleset;
}
else if (name.equals("created")) {
throw new FHIRException("Cannot call addChild on a primitive type EligibilityResponse.created");
}
else if (name.equals("organization")) {
this.organization = new Reference();
return this.organization;
}
else if (name.equals("requestProvider")) {
this.requestProvider = new Reference();
return this.requestProvider;
}
else if (name.equals("requestOrganization")) {
this.requestOrganization = new Reference();
return this.requestOrganization;
}
else
return super.addChild(name);
}
public String fhirType() {
return "EligibilityResponse";
}
public EligibilityResponse copy() {
EligibilityResponse dst = new EligibilityResponse();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.request = request == null ? null : request.copy();
dst.outcome = outcome == null ? null : outcome.copy();
dst.disposition = disposition == null ? null : disposition.copy();
dst.ruleset = ruleset == null ? null : ruleset.copy();
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
dst.created = created == null ? null : created.copy();
dst.organization = organization == null ? null : organization.copy();
dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
return dst;
}
protected EligibilityResponse typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof EligibilityResponse))
return false;
EligibilityResponse o = (EligibilityResponse) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true)
&& compareDeep(disposition, o.disposition, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
&& compareDeep(created, o.created, true) && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
&& compareDeep(requestOrganization, o.requestOrganization, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof EligibilityResponse))
return false;
EligibilityResponse o = (EligibilityResponse) other;
return compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(created, o.created, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
&& (outcome == null || outcome.isEmpty()) && (disposition == null || disposition.isEmpty())
&& (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
&& (created == null || created.isEmpty()) && (organization == null || organization.isEmpty())
&& (requestProvider == null || requestProvider.isEmpty()) && (requestOrganization == null || requestOrganization.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.EligibilityResponse;
}
@SearchParamDefinition(name="identifier", path="EligibilityResponse.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
public static final String SP_IDENTIFIER = "identifier";
}

View File

@ -0,0 +1,702 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* This resource provides the insurance enrollment details to the insurer regarding a specified coverage.
*/
@ResourceDef(name="EnrollmentRequest", profile="http://hl7.org/fhir/Profile/EnrollmentRequest")
public class EnrollmentRequest extends DomainResource {
/**
* The Response business identifier.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
protected List<Identifier> identifier;
/**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
*/
@Child(name = "ruleset", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
protected Coding ruleset;
/**
* The style (standard) and version of the original material which was converted into this resource.
*/
@Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
protected Coding originalRuleset;
/**
* The date when this resource was created.
*/
@Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
protected DateTimeType created;
/**
* The Insurer who is target of the request.
*/
@Child(name = "target", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target of the request." )
protected Reference target;
/**
* The actual object that is the target of the reference (The Insurer who is target of the request.)
*/
protected Organization targetTarget;
/**
* The practitioner who is responsible for the services rendered to the patient.
*/
@Child(name = "provider", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
protected Reference provider;
/**
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
*/
protected Practitioner providerTarget;
/**
* The organization which is responsible for the services rendered to the patient.
*/
@Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
protected Reference organization;
/**
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
*/
protected Organization organizationTarget;
/**
* Patient Resource.
*/
@Child(name = "subject", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
protected Reference subject;
/**
* The actual object that is the target of the reference (Patient Resource.)
*/
protected Patient subjectTarget;
/**
* Reference to the program or plan identification, underwriter or payor.
*/
@Child(name = "coverage", type = {Coverage.class}, order=8, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
protected Reference coverage;
/**
* The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
*/
protected Coverage coverageTarget;
/**
* The relationship of the patient to the subscriber.
*/
@Child(name = "relationship", type = {Coding.class}, order=9, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Patient relationship to subscriber", formalDefinition="The relationship of the patient to the subscriber." )
protected Coding relationship;
private static final long serialVersionUID = -1656505325L;
/*
* Constructor
*/
public EnrollmentRequest() {
super();
}
/*
* Constructor
*/
public EnrollmentRequest(Reference subject, Reference coverage, Coding relationship) {
super();
this.subject = subject;
this.coverage = coverage;
this.relationship = relationship;
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public EnrollmentRequest addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public Coding getRuleset() {
if (this.ruleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.ruleset");
else if (Configuration.doAutoCreate())
this.ruleset = new Coding(); // cc
return this.ruleset;
}
public boolean hasRuleset() {
return this.ruleset != null && !this.ruleset.isEmpty();
}
/**
* @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public EnrollmentRequest setRuleset(Coding value) {
this.ruleset = value;
return this;
}
/**
* @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public Coding getOriginalRuleset() {
if (this.originalRuleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.originalRuleset");
else if (Configuration.doAutoCreate())
this.originalRuleset = new Coding(); // cc
return this.originalRuleset;
}
public boolean hasOriginalRuleset() {
return this.originalRuleset != null && !this.originalRuleset.isEmpty();
}
/**
* @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public EnrollmentRequest setOriginalRuleset(Coding value) {
this.originalRuleset = value;
return this;
}
/**
* @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public DateTimeType getCreatedElement() {
if (this.created == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.created");
else if (Configuration.doAutoCreate())
this.created = new DateTimeType(); // bb
return this.created;
}
public boolean hasCreatedElement() {
return this.created != null && !this.created.isEmpty();
}
public boolean hasCreated() {
return this.created != null && !this.created.isEmpty();
}
/**
* @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public EnrollmentRequest setCreatedElement(DateTimeType value) {
this.created = value;
return this;
}
/**
* @return The date when this resource was created.
*/
public Date getCreated() {
return this.created == null ? null : this.created.getValue();
}
/**
* @param value The date when this resource was created.
*/
public EnrollmentRequest setCreated(Date value) {
if (value == null)
this.created = null;
else {
if (this.created == null)
this.created = new DateTimeType();
this.created.setValue(value);
}
return this;
}
/**
* @return {@link #target} (The Insurer who is target of the request.)
*/
public Reference getTarget() {
if (this.target == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.target");
else if (Configuration.doAutoCreate())
this.target = new Reference(); // cc
return this.target;
}
public boolean hasTarget() {
return this.target != null && !this.target.isEmpty();
}
/**
* @param value {@link #target} (The Insurer who is target of the request.)
*/
public EnrollmentRequest setTarget(Reference value) {
this.target = value;
return this;
}
/**
* @return {@link #target} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who is target of the request.)
*/
public Organization getTargetTarget() {
if (this.targetTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.target");
else if (Configuration.doAutoCreate())
this.targetTarget = new Organization(); // aa
return this.targetTarget;
}
/**
* @param value {@link #target} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who is target of the request.)
*/
public EnrollmentRequest setTargetTarget(Organization value) {
this.targetTarget = value;
return this;
}
/**
* @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public Reference getProvider() {
if (this.provider == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.provider");
else if (Configuration.doAutoCreate())
this.provider = new Reference(); // cc
return this.provider;
}
public boolean hasProvider() {
return this.provider != null && !this.provider.isEmpty();
}
/**
* @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public EnrollmentRequest setProvider(Reference value) {
this.provider = value;
return this;
}
/**
* @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public Practitioner getProviderTarget() {
if (this.providerTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.provider");
else if (Configuration.doAutoCreate())
this.providerTarget = new Practitioner(); // aa
return this.providerTarget;
}
/**
* @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public EnrollmentRequest setProviderTarget(Practitioner value) {
this.providerTarget = value;
return this;
}
/**
* @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
*/
public Reference getOrganization() {
if (this.organization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.organization");
else if (Configuration.doAutoCreate())
this.organization = new Reference(); // cc
return this.organization;
}
public boolean hasOrganization() {
return this.organization != null && !this.organization.isEmpty();
}
/**
* @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
*/
public EnrollmentRequest setOrganization(Reference value) {
this.organization = value;
return this;
}
/**
* @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public Organization getOrganizationTarget() {
if (this.organizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.organization");
else if (Configuration.doAutoCreate())
this.organizationTarget = new Organization(); // aa
return this.organizationTarget;
}
/**
* @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public EnrollmentRequest setOrganizationTarget(Organization value) {
this.organizationTarget = value;
return this;
}
/**
* @return {@link #subject} (Patient Resource.)
*/
public Reference getSubject() {
if (this.subject == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.subject");
else if (Configuration.doAutoCreate())
this.subject = new Reference(); // cc
return this.subject;
}
public boolean hasSubject() {
return this.subject != null && !this.subject.isEmpty();
}
/**
* @param value {@link #subject} (Patient Resource.)
*/
public EnrollmentRequest setSubject(Reference value) {
this.subject = value;
return this;
}
/**
* @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Patient Resource.)
*/
public Patient getSubjectTarget() {
if (this.subjectTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.subject");
else if (Configuration.doAutoCreate())
this.subjectTarget = new Patient(); // aa
return this.subjectTarget;
}
/**
* @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Patient Resource.)
*/
public EnrollmentRequest setSubjectTarget(Patient value) {
this.subjectTarget = value;
return this;
}
/**
* @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
*/
public Reference getCoverage() {
if (this.coverage == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
else if (Configuration.doAutoCreate())
this.coverage = new Reference(); // cc
return this.coverage;
}
public boolean hasCoverage() {
return this.coverage != null && !this.coverage.isEmpty();
}
/**
* @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
*/
public EnrollmentRequest setCoverage(Reference value) {
this.coverage = value;
return this;
}
/**
* @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
*/
public Coverage getCoverageTarget() {
if (this.coverageTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
else if (Configuration.doAutoCreate())
this.coverageTarget = new Coverage(); // aa
return this.coverageTarget;
}
/**
* @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
*/
public EnrollmentRequest setCoverageTarget(Coverage value) {
this.coverageTarget = value;
return this;
}
/**
* @return {@link #relationship} (The relationship of the patient to the subscriber.)
*/
public Coding getRelationship() {
if (this.relationship == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentRequest.relationship");
else if (Configuration.doAutoCreate())
this.relationship = new Coding(); // cc
return this.relationship;
}
public boolean hasRelationship() {
return this.relationship != null && !this.relationship.isEmpty();
}
/**
* @param value {@link #relationship} (The relationship of the patient to the subscriber.)
*/
public EnrollmentRequest setRelationship(Coding value) {
this.relationship = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created));
childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target of the request.", 0, java.lang.Integer.MAX_VALUE, target));
childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization));
childrenList.add(new Property("subject", "Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, subject));
childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
childrenList.add(new Property("relationship", "Coding", "The relationship of the patient to the subscriber.", 0, java.lang.Integer.MAX_VALUE, relationship));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("ruleset"))
this.ruleset = castToCoding(value); // Coding
else if (name.equals("originalRuleset"))
this.originalRuleset = castToCoding(value); // Coding
else if (name.equals("created"))
this.created = castToDateTime(value); // DateTimeType
else if (name.equals("target"))
this.target = castToReference(value); // Reference
else if (name.equals("provider"))
this.provider = castToReference(value); // Reference
else if (name.equals("organization"))
this.organization = castToReference(value); // Reference
else if (name.equals("subject"))
this.subject = castToReference(value); // Reference
else if (name.equals("coverage"))
this.coverage = castToReference(value); // Reference
else if (name.equals("relationship"))
this.relationship = castToCoding(value); // Coding
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("ruleset")) {
this.ruleset = new Coding();
return this.ruleset;
}
else if (name.equals("originalRuleset")) {
this.originalRuleset = new Coding();
return this.originalRuleset;
}
else if (name.equals("created")) {
throw new FHIRException("Cannot call addChild on a primitive type EnrollmentRequest.created");
}
else if (name.equals("target")) {
this.target = new Reference();
return this.target;
}
else if (name.equals("provider")) {
this.provider = new Reference();
return this.provider;
}
else if (name.equals("organization")) {
this.organization = new Reference();
return this.organization;
}
else if (name.equals("subject")) {
this.subject = new Reference();
return this.subject;
}
else if (name.equals("coverage")) {
this.coverage = new Reference();
return this.coverage;
}
else if (name.equals("relationship")) {
this.relationship = new Coding();
return this.relationship;
}
else
return super.addChild(name);
}
public String fhirType() {
return "EnrollmentRequest";
}
public EnrollmentRequest copy() {
EnrollmentRequest dst = new EnrollmentRequest();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.ruleset = ruleset == null ? null : ruleset.copy();
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
dst.created = created == null ? null : created.copy();
dst.target = target == null ? null : target.copy();
dst.provider = provider == null ? null : provider.copy();
dst.organization = organization == null ? null : organization.copy();
dst.subject = subject == null ? null : subject.copy();
dst.coverage = coverage == null ? null : coverage.copy();
dst.relationship = relationship == null ? null : relationship.copy();
return dst;
}
protected EnrollmentRequest typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof EnrollmentRequest))
return false;
EnrollmentRequest o = (EnrollmentRequest) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
&& compareDeep(created, o.created, true) && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true)
&& compareDeep(organization, o.organization, true) && compareDeep(subject, o.subject, true) && compareDeep(coverage, o.coverage, true)
&& compareDeep(relationship, o.relationship, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof EnrollmentRequest))
return false;
EnrollmentRequest o = (EnrollmentRequest) other;
return compareValues(created, o.created, true);
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (ruleset == null || ruleset.isEmpty())
&& (originalRuleset == null || originalRuleset.isEmpty()) && (created == null || created.isEmpty())
&& (target == null || target.isEmpty()) && (provider == null || provider.isEmpty()) && (organization == null || organization.isEmpty())
&& (subject == null || subject.isEmpty()) && (coverage == null || coverage.isEmpty()) && (relationship == null || relationship.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.EnrollmentRequest;
}
@SearchParamDefinition(name="identifier", path="EnrollmentRequest.identifier", description="The business identifier of the Enrollment", type="token" )
public static final String SP_IDENTIFIER = "identifier";
@SearchParamDefinition(name="subject", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference" )
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="patient", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference" )
public static final String SP_PATIENT = "patient";
}

View File

@ -0,0 +1,714 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* This resource provides enrollment and plan details from the processing of an Enrollment resource.
*/
@ResourceDef(name="EnrollmentResponse", profile="http://hl7.org/fhir/Profile/EnrollmentResponse")
public class EnrollmentResponse extends DomainResource {
/**
* The Response business identifier.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
protected List<Identifier> identifier;
/**
* Original request resource reference.
*/
@Child(name = "request", type = {EnrollmentRequest.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
protected Reference request;
/**
* The actual object that is the target of the reference (Original request resource reference.)
*/
protected EnrollmentRequest requestTarget;
/**
* Transaction status: error, complete.
*/
@Child(name = "outcome", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="complete | error", formalDefinition="Transaction status: error, complete." )
protected Enumeration<RemittanceOutcome> outcome;
/**
* A description of the status of the adjudication.
*/
@Child(name = "disposition", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
protected StringType disposition;
/**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
*/
@Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
protected Coding ruleset;
/**
* The style (standard) and version of the original material which was converted into this resource.
*/
@Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
protected Coding originalRuleset;
/**
* The date when the enclosed suite of services were performed or completed.
*/
@Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
protected DateTimeType created;
/**
* The Insurer who produced this adjudicated response.
*/
@Child(name = "organization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
protected Reference organization;
/**
* The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
*/
protected Organization organizationTarget;
/**
* The practitioner who is responsible for the services rendered to the patient.
*/
@Child(name = "requestProvider", type = {Practitioner.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
protected Reference requestProvider;
/**
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
*/
protected Practitioner requestProviderTarget;
/**
* The organization which is responsible for the services rendered to the patient.
*/
@Child(name = "requestOrganization", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
protected Reference requestOrganization;
/**
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
*/
protected Organization requestOrganizationTarget;
private static final long serialVersionUID = -1740067108L;
/*
* Constructor
*/
public EnrollmentResponse() {
super();
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public EnrollmentResponse addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #request} (Original request resource reference.)
*/
public Reference getRequest() {
if (this.request == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.request");
else if (Configuration.doAutoCreate())
this.request = new Reference(); // cc
return this.request;
}
public boolean hasRequest() {
return this.request != null && !this.request.isEmpty();
}
/**
* @param value {@link #request} (Original request resource reference.)
*/
public EnrollmentResponse setRequest(Reference value) {
this.request = value;
return this;
}
/**
* @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
*/
public EnrollmentRequest getRequestTarget() {
if (this.requestTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.request");
else if (Configuration.doAutoCreate())
this.requestTarget = new EnrollmentRequest(); // aa
return this.requestTarget;
}
/**
* @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
*/
public EnrollmentResponse setRequestTarget(EnrollmentRequest value) {
this.requestTarget = value;
return this;
}
/**
* @return {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
*/
public Enumeration<RemittanceOutcome> getOutcomeElement() {
if (this.outcome == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.outcome");
else if (Configuration.doAutoCreate())
this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
return this.outcome;
}
public boolean hasOutcomeElement() {
return this.outcome != null && !this.outcome.isEmpty();
}
public boolean hasOutcome() {
return this.outcome != null && !this.outcome.isEmpty();
}
/**
* @param value {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
*/
public EnrollmentResponse setOutcomeElement(Enumeration<RemittanceOutcome> value) {
this.outcome = value;
return this;
}
/**
* @return Transaction status: error, complete.
*/
public RemittanceOutcome getOutcome() {
return this.outcome == null ? null : this.outcome.getValue();
}
/**
* @param value Transaction status: error, complete.
*/
public EnrollmentResponse setOutcome(RemittanceOutcome value) {
if (value == null)
this.outcome = null;
else {
if (this.outcome == null)
this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
this.outcome.setValue(value);
}
return this;
}
/**
* @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
*/
public StringType getDispositionElement() {
if (this.disposition == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.disposition");
else if (Configuration.doAutoCreate())
this.disposition = new StringType(); // bb
return this.disposition;
}
public boolean hasDispositionElement() {
return this.disposition != null && !this.disposition.isEmpty();
}
public boolean hasDisposition() {
return this.disposition != null && !this.disposition.isEmpty();
}
/**
* @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
*/
public EnrollmentResponse setDispositionElement(StringType value) {
this.disposition = value;
return this;
}
/**
* @return A description of the status of the adjudication.
*/
public String getDisposition() {
return this.disposition == null ? null : this.disposition.getValue();
}
/**
* @param value A description of the status of the adjudication.
*/
public EnrollmentResponse setDisposition(String value) {
if (Utilities.noString(value))
this.disposition = null;
else {
if (this.disposition == null)
this.disposition = new StringType();
this.disposition.setValue(value);
}
return this;
}
/**
* @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public Coding getRuleset() {
if (this.ruleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.ruleset");
else if (Configuration.doAutoCreate())
this.ruleset = new Coding(); // cc
return this.ruleset;
}
public boolean hasRuleset() {
return this.ruleset != null && !this.ruleset.isEmpty();
}
/**
* @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public EnrollmentResponse setRuleset(Coding value) {
this.ruleset = value;
return this;
}
/**
* @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public Coding getOriginalRuleset() {
if (this.originalRuleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.originalRuleset");
else if (Configuration.doAutoCreate())
this.originalRuleset = new Coding(); // cc
return this.originalRuleset;
}
public boolean hasOriginalRuleset() {
return this.originalRuleset != null && !this.originalRuleset.isEmpty();
}
/**
* @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public EnrollmentResponse setOriginalRuleset(Coding value) {
this.originalRuleset = value;
return this;
}
/**
* @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public DateTimeType getCreatedElement() {
if (this.created == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.created");
else if (Configuration.doAutoCreate())
this.created = new DateTimeType(); // bb
return this.created;
}
public boolean hasCreatedElement() {
return this.created != null && !this.created.isEmpty();
}
public boolean hasCreated() {
return this.created != null && !this.created.isEmpty();
}
/**
* @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public EnrollmentResponse setCreatedElement(DateTimeType value) {
this.created = value;
return this;
}
/**
* @return The date when the enclosed suite of services were performed or completed.
*/
public Date getCreated() {
return this.created == null ? null : this.created.getValue();
}
/**
* @param value The date when the enclosed suite of services were performed or completed.
*/
public EnrollmentResponse setCreated(Date value) {
if (value == null)
this.created = null;
else {
if (this.created == null)
this.created = new DateTimeType();
this.created.setValue(value);
}
return this;
}
/**
* @return {@link #organization} (The Insurer who produced this adjudicated response.)
*/
public Reference getOrganization() {
if (this.organization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.organization");
else if (Configuration.doAutoCreate())
this.organization = new Reference(); // cc
return this.organization;
}
public boolean hasOrganization() {
return this.organization != null && !this.organization.isEmpty();
}
/**
* @param value {@link #organization} (The Insurer who produced this adjudicated response.)
*/
public EnrollmentResponse setOrganization(Reference value) {
this.organization = value;
return this;
}
/**
* @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
*/
public Organization getOrganizationTarget() {
if (this.organizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.organization");
else if (Configuration.doAutoCreate())
this.organizationTarget = new Organization(); // aa
return this.organizationTarget;
}
/**
* @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
*/
public EnrollmentResponse setOrganizationTarget(Organization value) {
this.organizationTarget = value;
return this;
}
/**
* @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public Reference getRequestProvider() {
if (this.requestProvider == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.requestProvider");
else if (Configuration.doAutoCreate())
this.requestProvider = new Reference(); // cc
return this.requestProvider;
}
public boolean hasRequestProvider() {
return this.requestProvider != null && !this.requestProvider.isEmpty();
}
/**
* @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public EnrollmentResponse setRequestProvider(Reference value) {
this.requestProvider = value;
return this;
}
/**
* @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public Practitioner getRequestProviderTarget() {
if (this.requestProviderTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.requestProvider");
else if (Configuration.doAutoCreate())
this.requestProviderTarget = new Practitioner(); // aa
return this.requestProviderTarget;
}
/**
* @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public EnrollmentResponse setRequestProviderTarget(Practitioner value) {
this.requestProviderTarget = value;
return this;
}
/**
* @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
*/
public Reference getRequestOrganization() {
if (this.requestOrganization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.requestOrganization");
else if (Configuration.doAutoCreate())
this.requestOrganization = new Reference(); // cc
return this.requestOrganization;
}
public boolean hasRequestOrganization() {
return this.requestOrganization != null && !this.requestOrganization.isEmpty();
}
/**
* @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
*/
public EnrollmentResponse setRequestOrganization(Reference value) {
this.requestOrganization = value;
return this;
}
/**
* @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public Organization getRequestOrganizationTarget() {
if (this.requestOrganizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create EnrollmentResponse.requestOrganization");
else if (Configuration.doAutoCreate())
this.requestOrganizationTarget = new Organization(); // aa
return this.requestOrganizationTarget;
}
/**
* @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public EnrollmentResponse setRequestOrganizationTarget(Organization value) {
this.requestOrganizationTarget = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("request", "Reference(EnrollmentRequest)", "Original request resource reference.", 0, java.lang.Integer.MAX_VALUE, request));
childrenList.add(new Property("outcome", "code", "Transaction status: error, complete.", 0, java.lang.Integer.MAX_VALUE, outcome));
childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
childrenList.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, organization));
childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("request"))
this.request = castToReference(value); // Reference
else if (name.equals("outcome"))
this.outcome = new RemittanceOutcomeEnumFactory().fromType(value); // Enumeration<RemittanceOutcome>
else if (name.equals("disposition"))
this.disposition = castToString(value); // StringType
else if (name.equals("ruleset"))
this.ruleset = castToCoding(value); // Coding
else if (name.equals("originalRuleset"))
this.originalRuleset = castToCoding(value); // Coding
else if (name.equals("created"))
this.created = castToDateTime(value); // DateTimeType
else if (name.equals("organization"))
this.organization = castToReference(value); // Reference
else if (name.equals("requestProvider"))
this.requestProvider = castToReference(value); // Reference
else if (name.equals("requestOrganization"))
this.requestOrganization = castToReference(value); // Reference
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("request")) {
this.request = new Reference();
return this.request;
}
else if (name.equals("outcome")) {
throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.outcome");
}
else if (name.equals("disposition")) {
throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.disposition");
}
else if (name.equals("ruleset")) {
this.ruleset = new Coding();
return this.ruleset;
}
else if (name.equals("originalRuleset")) {
this.originalRuleset = new Coding();
return this.originalRuleset;
}
else if (name.equals("created")) {
throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.created");
}
else if (name.equals("organization")) {
this.organization = new Reference();
return this.organization;
}
else if (name.equals("requestProvider")) {
this.requestProvider = new Reference();
return this.requestProvider;
}
else if (name.equals("requestOrganization")) {
this.requestOrganization = new Reference();
return this.requestOrganization;
}
else
return super.addChild(name);
}
public String fhirType() {
return "EnrollmentResponse";
}
public EnrollmentResponse copy() {
EnrollmentResponse dst = new EnrollmentResponse();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.request = request == null ? null : request.copy();
dst.outcome = outcome == null ? null : outcome.copy();
dst.disposition = disposition == null ? null : disposition.copy();
dst.ruleset = ruleset == null ? null : ruleset.copy();
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
dst.created = created == null ? null : created.copy();
dst.organization = organization == null ? null : organization.copy();
dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
return dst;
}
protected EnrollmentResponse typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof EnrollmentResponse))
return false;
EnrollmentResponse o = (EnrollmentResponse) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true)
&& compareDeep(disposition, o.disposition, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
&& compareDeep(created, o.created, true) && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
&& compareDeep(requestOrganization, o.requestOrganization, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof EnrollmentResponse))
return false;
EnrollmentResponse o = (EnrollmentResponse) other;
return compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(created, o.created, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
&& (outcome == null || outcome.isEmpty()) && (disposition == null || disposition.isEmpty())
&& (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
&& (created == null || created.isEmpty()) && (organization == null || organization.isEmpty())
&& (requestProvider == null || requestProvider.isEmpty()) && (requestOrganization == null || requestOrganization.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.EnrollmentResponse;
}
@SearchParamDefinition(name="identifier", path="EnrollmentResponse.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
public static final String SP_IDENTIFIER = "identifier";
}

View File

@ -0,0 +1,56 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Helper class to help manage generic enumerated types
*/
public interface EnumFactory<T extends Enum<?>> extends IBaseEnumFactory<T> {
/**
* Read an enumeration value from the string that represents it on the XML or JSON
* @param codeString the value found in the XML or JSON
* @return the enumeration value
* @throws Exception is the value is not known
*/
public T fromCode(String codeString) throws IllegalArgumentException;
/**
* Get the XML/JSON representation for an enumerated value
* @param code - the enumeration value
* @return the XML/JSON representation
* @throws Exception if the enumeration is not valid (would usually indicate a code generation bug)
*/
public String toCode(T code);
}

View File

@ -0,0 +1,97 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Primitive type "code" in FHIR, where the code is tied to an enumerated list of possible values
*
*/
@DatatypeDef(name="code", isSpecialization=true)
public class Enumeration<T extends Enum<?>> extends PrimitiveType<T> implements IBaseEnumeration<T> {
private static final long serialVersionUID = 1L;
private EnumFactory<T> myEnumFactory;
/**
* Constructor
*/
public Enumeration(EnumFactory<T> theEnumFactory) {
if (theEnumFactory == null)
throw new IllegalArgumentException("An enumeration factory must be provided");
myEnumFactory = theEnumFactory;
}
/**
* Constructor
*/
public Enumeration(EnumFactory<T> theEnumFactory, T theValue) {
if (theEnumFactory == null)
throw new IllegalArgumentException("An enumeration factory must be provided");
myEnumFactory = theEnumFactory;
setValue(theValue);
}
/**
* Constructor
*/
public Enumeration(EnumFactory<T> theEnumFactory, String theValue) {
if (theEnumFactory == null)
throw new IllegalArgumentException("An enumeration factory must be provided");
myEnumFactory = theEnumFactory;
setValueAsString(theValue);
}
@Override
protected T parse(String theValue) {
if (myEnumFactory != null) {
return myEnumFactory.fromCode(theValue);
}
return null;
}
@Override
protected String encode(T theValue) {
return myEnumFactory.toCode(theValue);
}
@Override
public Enumeration<T> copy() {
return new Enumeration<T>(myEnumFactory, getValue());
}
public String fhirType() {
return "code";
}
}

View File

@ -0,0 +1,714 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* This resource provides: the claim details; adjudication details from the processing of a Claim; and optionally account balance information, for informing the subscriber of the benefits provided.
*/
@ResourceDef(name="ExplanationOfBenefit", profile="http://hl7.org/fhir/Profile/ExplanationOfBenefit")
public class ExplanationOfBenefit extends DomainResource {
/**
* The Response business identifier.
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
protected List<Identifier> identifier;
/**
* Original request resource reference.
*/
@Child(name = "request", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
protected Reference request;
/**
* The actual object that is the target of the reference (Original request resource reference.)
*/
protected Claim requestTarget;
/**
* Transaction status: error, complete.
*/
@Child(name = "outcome", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="complete | error", formalDefinition="Transaction status: error, complete." )
protected Enumeration<RemittanceOutcome> outcome;
/**
* A description of the status of the adjudication.
*/
@Child(name = "disposition", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
protected StringType disposition;
/**
* The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
*/
@Child(name = "ruleset", type = {Coding.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
protected Coding ruleset;
/**
* The style (standard) and version of the original material which was converted into this resource.
*/
@Child(name = "originalRuleset", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
protected Coding originalRuleset;
/**
* The date when the enclosed suite of services were performed or completed.
*/
@Child(name = "created", type = {DateTimeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
protected DateTimeType created;
/**
* The Insurer who produced this adjudicated response.
*/
@Child(name = "organization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
protected Reference organization;
/**
* The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
*/
protected Organization organizationTarget;
/**
* The practitioner who is responsible for the services rendered to the patient.
*/
@Child(name = "requestProvider", type = {Practitioner.class}, order=8, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
protected Reference requestProvider;
/**
* The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
*/
protected Practitioner requestProviderTarget;
/**
* The organization which is responsible for the services rendered to the patient.
*/
@Child(name = "requestOrganization", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
protected Reference requestOrganization;
/**
* The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
*/
protected Organization requestOrganizationTarget;
private static final long serialVersionUID = 205412587L;
/*
* Constructor
*/
public ExplanationOfBenefit() {
super();
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (The Response business identifier.)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public ExplanationOfBenefit addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #request} (Original request resource reference.)
*/
public Reference getRequest() {
if (this.request == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.request");
else if (Configuration.doAutoCreate())
this.request = new Reference(); // cc
return this.request;
}
public boolean hasRequest() {
return this.request != null && !this.request.isEmpty();
}
/**
* @param value {@link #request} (Original request resource reference.)
*/
public ExplanationOfBenefit setRequest(Reference value) {
this.request = value;
return this;
}
/**
* @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
*/
public Claim getRequestTarget() {
if (this.requestTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.request");
else if (Configuration.doAutoCreate())
this.requestTarget = new Claim(); // aa
return this.requestTarget;
}
/**
* @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource reference.)
*/
public ExplanationOfBenefit setRequestTarget(Claim value) {
this.requestTarget = value;
return this;
}
/**
* @return {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
*/
public Enumeration<RemittanceOutcome> getOutcomeElement() {
if (this.outcome == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.outcome");
else if (Configuration.doAutoCreate())
this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
return this.outcome;
}
public boolean hasOutcomeElement() {
return this.outcome != null && !this.outcome.isEmpty();
}
public boolean hasOutcome() {
return this.outcome != null && !this.outcome.isEmpty();
}
/**
* @param value {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
*/
public ExplanationOfBenefit setOutcomeElement(Enumeration<RemittanceOutcome> value) {
this.outcome = value;
return this;
}
/**
* @return Transaction status: error, complete.
*/
public RemittanceOutcome getOutcome() {
return this.outcome == null ? null : this.outcome.getValue();
}
/**
* @param value Transaction status: error, complete.
*/
public ExplanationOfBenefit setOutcome(RemittanceOutcome value) {
if (value == null)
this.outcome = null;
else {
if (this.outcome == null)
this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
this.outcome.setValue(value);
}
return this;
}
/**
* @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
*/
public StringType getDispositionElement() {
if (this.disposition == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.disposition");
else if (Configuration.doAutoCreate())
this.disposition = new StringType(); // bb
return this.disposition;
}
public boolean hasDispositionElement() {
return this.disposition != null && !this.disposition.isEmpty();
}
public boolean hasDisposition() {
return this.disposition != null && !this.disposition.isEmpty();
}
/**
* @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
*/
public ExplanationOfBenefit setDispositionElement(StringType value) {
this.disposition = value;
return this;
}
/**
* @return A description of the status of the adjudication.
*/
public String getDisposition() {
return this.disposition == null ? null : this.disposition.getValue();
}
/**
* @param value A description of the status of the adjudication.
*/
public ExplanationOfBenefit setDisposition(String value) {
if (Utilities.noString(value))
this.disposition = null;
else {
if (this.disposition == null)
this.disposition = new StringType();
this.disposition.setValue(value);
}
return this;
}
/**
* @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public Coding getRuleset() {
if (this.ruleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.ruleset");
else if (Configuration.doAutoCreate())
this.ruleset = new Coding(); // cc
return this.ruleset;
}
public boolean hasRuleset() {
return this.ruleset != null && !this.ruleset.isEmpty();
}
/**
* @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
*/
public ExplanationOfBenefit setRuleset(Coding value) {
this.ruleset = value;
return this;
}
/**
* @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public Coding getOriginalRuleset() {
if (this.originalRuleset == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.originalRuleset");
else if (Configuration.doAutoCreate())
this.originalRuleset = new Coding(); // cc
return this.originalRuleset;
}
public boolean hasOriginalRuleset() {
return this.originalRuleset != null && !this.originalRuleset.isEmpty();
}
/**
* @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
*/
public ExplanationOfBenefit setOriginalRuleset(Coding value) {
this.originalRuleset = value;
return this;
}
/**
* @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public DateTimeType getCreatedElement() {
if (this.created == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.created");
else if (Configuration.doAutoCreate())
this.created = new DateTimeType(); // bb
return this.created;
}
public boolean hasCreatedElement() {
return this.created != null && !this.created.isEmpty();
}
public boolean hasCreated() {
return this.created != null && !this.created.isEmpty();
}
/**
* @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
*/
public ExplanationOfBenefit setCreatedElement(DateTimeType value) {
this.created = value;
return this;
}
/**
* @return The date when the enclosed suite of services were performed or completed.
*/
public Date getCreated() {
return this.created == null ? null : this.created.getValue();
}
/**
* @param value The date when the enclosed suite of services were performed or completed.
*/
public ExplanationOfBenefit setCreated(Date value) {
if (value == null)
this.created = null;
else {
if (this.created == null)
this.created = new DateTimeType();
this.created.setValue(value);
}
return this;
}
/**
* @return {@link #organization} (The Insurer who produced this adjudicated response.)
*/
public Reference getOrganization() {
if (this.organization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
else if (Configuration.doAutoCreate())
this.organization = new Reference(); // cc
return this.organization;
}
public boolean hasOrganization() {
return this.organization != null && !this.organization.isEmpty();
}
/**
* @param value {@link #organization} (The Insurer who produced this adjudicated response.)
*/
public ExplanationOfBenefit setOrganization(Reference value) {
this.organization = value;
return this;
}
/**
* @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
*/
public Organization getOrganizationTarget() {
if (this.organizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.organization");
else if (Configuration.doAutoCreate())
this.organizationTarget = new Organization(); // aa
return this.organizationTarget;
}
/**
* @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
*/
public ExplanationOfBenefit setOrganizationTarget(Organization value) {
this.organizationTarget = value;
return this;
}
/**
* @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public Reference getRequestProvider() {
if (this.requestProvider == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.requestProvider");
else if (Configuration.doAutoCreate())
this.requestProvider = new Reference(); // cc
return this.requestProvider;
}
public boolean hasRequestProvider() {
return this.requestProvider != null && !this.requestProvider.isEmpty();
}
/**
* @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
*/
public ExplanationOfBenefit setRequestProvider(Reference value) {
this.requestProvider = value;
return this;
}
/**
* @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public Practitioner getRequestProviderTarget() {
if (this.requestProviderTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.requestProvider");
else if (Configuration.doAutoCreate())
this.requestProviderTarget = new Practitioner(); // aa
return this.requestProviderTarget;
}
/**
* @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
*/
public ExplanationOfBenefit setRequestProviderTarget(Practitioner value) {
this.requestProviderTarget = value;
return this;
}
/**
* @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
*/
public Reference getRequestOrganization() {
if (this.requestOrganization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.requestOrganization");
else if (Configuration.doAutoCreate())
this.requestOrganization = new Reference(); // cc
return this.requestOrganization;
}
public boolean hasRequestOrganization() {
return this.requestOrganization != null && !this.requestOrganization.isEmpty();
}
/**
* @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
*/
public ExplanationOfBenefit setRequestOrganization(Reference value) {
this.requestOrganization = value;
return this;
}
/**
* @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public Organization getRequestOrganizationTarget() {
if (this.requestOrganizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ExplanationOfBenefit.requestOrganization");
else if (Configuration.doAutoCreate())
this.requestOrganizationTarget = new Organization(); // aa
return this.requestOrganizationTarget;
}
/**
* @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
*/
public ExplanationOfBenefit setRequestOrganizationTarget(Organization value) {
this.requestOrganizationTarget = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("request", "Reference(Claim)", "Original request resource reference.", 0, java.lang.Integer.MAX_VALUE, request));
childrenList.add(new Property("outcome", "code", "Transaction status: error, complete.", 0, java.lang.Integer.MAX_VALUE, outcome));
childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
childrenList.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, organization));
childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("request"))
this.request = castToReference(value); // Reference
else if (name.equals("outcome"))
this.outcome = new RemittanceOutcomeEnumFactory().fromType(value); // Enumeration<RemittanceOutcome>
else if (name.equals("disposition"))
this.disposition = castToString(value); // StringType
else if (name.equals("ruleset"))
this.ruleset = castToCoding(value); // Coding
else if (name.equals("originalRuleset"))
this.originalRuleset = castToCoding(value); // Coding
else if (name.equals("created"))
this.created = castToDateTime(value); // DateTimeType
else if (name.equals("organization"))
this.organization = castToReference(value); // Reference
else if (name.equals("requestProvider"))
this.requestProvider = castToReference(value); // Reference
else if (name.equals("requestOrganization"))
this.requestOrganization = castToReference(value); // Reference
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("request")) {
this.request = new Reference();
return this.request;
}
else if (name.equals("outcome")) {
throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.outcome");
}
else if (name.equals("disposition")) {
throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.disposition");
}
else if (name.equals("ruleset")) {
this.ruleset = new Coding();
return this.ruleset;
}
else if (name.equals("originalRuleset")) {
this.originalRuleset = new Coding();
return this.originalRuleset;
}
else if (name.equals("created")) {
throw new FHIRException("Cannot call addChild on a primitive type ExplanationOfBenefit.created");
}
else if (name.equals("organization")) {
this.organization = new Reference();
return this.organization;
}
else if (name.equals("requestProvider")) {
this.requestProvider = new Reference();
return this.requestProvider;
}
else if (name.equals("requestOrganization")) {
this.requestOrganization = new Reference();
return this.requestOrganization;
}
else
return super.addChild(name);
}
public String fhirType() {
return "ExplanationOfBenefit";
}
public ExplanationOfBenefit copy() {
ExplanationOfBenefit dst = new ExplanationOfBenefit();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.request = request == null ? null : request.copy();
dst.outcome = outcome == null ? null : outcome.copy();
dst.disposition = disposition == null ? null : disposition.copy();
dst.ruleset = ruleset == null ? null : ruleset.copy();
dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
dst.created = created == null ? null : created.copy();
dst.organization = organization == null ? null : organization.copy();
dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
return dst;
}
protected ExplanationOfBenefit typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof ExplanationOfBenefit))
return false;
ExplanationOfBenefit o = (ExplanationOfBenefit) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(outcome, o.outcome, true)
&& compareDeep(disposition, o.disposition, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
&& compareDeep(created, o.created, true) && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
&& compareDeep(requestOrganization, o.requestOrganization, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof ExplanationOfBenefit))
return false;
ExplanationOfBenefit o = (ExplanationOfBenefit) other;
return compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true) && compareValues(created, o.created, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
&& (outcome == null || outcome.isEmpty()) && (disposition == null || disposition.isEmpty())
&& (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
&& (created == null || created.isEmpty()) && (organization == null || organization.isEmpty())
&& (requestProvider == null || requestProvider.isEmpty()) && (requestOrganization == null || requestOrganization.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.ExplanationOfBenefit;
}
@SearchParamDefinition(name="identifier", path="ExplanationOfBenefit.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
public static final String SP_IDENTIFIER = "identifier";
}

View File

@ -0,0 +1,455 @@
package org.hl7.fhir.dstu21.model;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import org.hl7.fhir.utilities.Utilities;
public class ExpressionNode {
public enum Kind {
Name, Function, Constant, Group
}
public static class SourceLocation {
private int line;
private int column;
public SourceLocation(int line, int column) {
super();
this.line = line;
this.column = column;
}
public int getLine() {
return line;
}
public int getColumn() {
return column;
}
public void setLine(int line) {
this.line = line;
}
public void setColumn(int column) {
this.column = column;
}
public String toString() {
return Integer.toString(line)+", "+Integer.toString(column);
}
}
public enum Function {
Empty, Item, Where, All, Any, First, Last, Tail, Count, AsInteger, StartsWith, Length, Matches, Substring, Contains, Distinct, Not, Resolve, Extension, Log;
public static Function fromCode(String name) {
if (name.equals("empty"))
return Function.Empty;
if (name.equals("item"))
return Function.Item;
if (name.equals("where"))
return Function.Where;
if (name.equals("all"))
return Function.All;
if (name.equals("any"))
return Function.Any;
if (name.equals("first"))
return Function.First;
if (name.equals("last"))
return Function.Last;
if (name.equals("tail"))
return Function.Tail;
if (name.equals("count"))
return Function.Count;
if (name.equals("asInteger"))
return Function.AsInteger;
if (name.equals("startsWith"))
return Function.StartsWith;
if (name.equals("length"))
return Function.Length;
if (name.equals("matches"))
return Function.Matches;
if (name.equals("contains"))
return Function.Contains;
if (name.equals("substring"))
return Function.Substring;
if (name.equals("distinct"))
return Function.Distinct;
if (name.equals("not"))
return Function.Not;
if (name.equals("resolve"))
return Function.Resolve;
if (name.equals("extension"))
return Function.Extension;
if (name.equals("log"))
return Function.Log;
return null;
}
public String toCode() {
switch (this) {
case Empty : return "empty";
case Item : return "item";
case Where : return "where";
case All : return "all";
case Any : return "any";
case First : return "first";
case Last : return "last";
case Tail : return "tail";
case Count : return "count";
case AsInteger : return "asInteger";
case StartsWith : return "startsWith";
case Length : return "length";
case Matches : return "matches";
case Contains : return "contains";
case Substring : return "substring";
case Distinct : return "distinct";
case Not : return "not";
case Resolve : return "resolve";
case Extension : return "extension";
case Log : return "log";
default: return "??";
}
}
}
public enum Operation {
Equals, Equivalent, NotEquals, NotEquivalent, LessThen, Greater, LessOrEqual, GreaterOrEqual, Union, In, Or, And, Xor, Implies, Plus, Minus, Concatenate;
public static Operation fromCode(String name) {
if (Utilities.noString(name))
return null;
if (name.equals("="))
return Operation.Equals;
if (name.equals("~"))
return Operation.Equivalent;
if (name.equals("!="))
return Operation.NotEquals;
if (name.equals("!~"))
return Operation.NotEquivalent;
if (name.equals(">"))
return Operation.Greater;
if (name.equals("<"))
return Operation.LessThen;
if (name.equals(">="))
return Operation.GreaterOrEqual;
if (name.equals("<="))
return Operation.LessOrEqual;
if (name.equals("|"))
return Operation.Union;
if (name.equals("in"))
return Operation.In;
if (name.equals("or"))
return Operation.Or;
if (name.equals("and"))
return Operation.And;
if (name.equals("xor"))
return Operation.Xor;
if (name.equals("+"))
return Operation.Plus;
if (name.equals("-"))
return Operation.Minus;
if (name.equals("&"))
return Operation.Concatenate;
if (name.equals("implies"))
return Operation.Implies;
return null;
}
public String toCode() {
switch (this) {
case Equals : return "=";
case Equivalent : return "~";
case NotEquals : return "!=";
case NotEquivalent : return "!~";
case Greater : return ">";
case LessThen : return "<";
case GreaterOrEqual : return ">=";
case LessOrEqual : return "<=";
case Union : return "|";
case In : return "in";
case Or : return "or";
case And : return "and";
case Xor : return "xor";
case Plus : return "+";
case Minus : return "-";
case Concatenate : return "&";
case Implies : return "implies";
default: return "??";
}
}
}
//the expression will have one of either name or constant
private String uniqueId;
private Kind kind;
private String name;
private String constant;
private Function function;
private List<ExpressionNode> parameters; // will be created if there is a function
private ExpressionNode inner;
private ExpressionNode group;
private Operation operation;
private boolean proximal; // a proximal operation is the first in the sequence of operations. This is significant when evaluating the outcomes
private ExpressionNode opNext;
private SourceLocation start;
private SourceLocation end;
private SourceLocation opStart;
private SourceLocation opEnd;
private Set<String> types;
private Set<String> opTypes;
public ExpressionNode(int uniqueId) {
super();
this.uniqueId = Integer.toString(uniqueId);
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getConstant() {
return constant;
}
public void setConstant(String constant) {
this.constant = constant;
}
public Function getFunction() {
return function;
}
public void setFunction(Function function) {
this.function = function;
if (parameters == null)
parameters = new ArrayList<ExpressionNode>();
}
public boolean isProximal() {
return proximal;
}
public void setProximal(boolean proximal) {
this.proximal = proximal;
}
public Operation getOperation() {
return operation;
}
public void setOperation(Operation operation) {
this.operation = operation;
}
public ExpressionNode getInner() {
return inner;
}
public void setInner(ExpressionNode value) {
this.inner = value;
}
public ExpressionNode getOpNext() {
return opNext;
}
public void setOpNext(ExpressionNode value) {
this.opNext = value;
}
public List<ExpressionNode> getParameters() {
return parameters;
}
public boolean checkName(boolean mappingExtensions) {
if (!name.startsWith("$"))
return true;
else if (mappingExtensions && name.equals("$value"))
return true;
else
return name.equals("$context") || name.equals("$resource") || name.equals("$parent");
}
public Kind getKind() {
return kind;
}
public void setKind(Kind kind) {
this.kind = kind;
}
public ExpressionNode getGroup() {
return group;
}
public void setGroup(ExpressionNode group) {
this.group = group;
}
public SourceLocation getStart() {
return start;
}
public void setStart(SourceLocation start) {
this.start = start;
}
public SourceLocation getEnd() {
return end;
}
public void setEnd(SourceLocation end) {
this.end = end;
}
public SourceLocation getOpStart() {
return opStart;
}
public void setOpStart(SourceLocation opStart) {
this.opStart = opStart;
}
public SourceLocation getOpEnd() {
return opEnd;
}
public void setOpEnd(SourceLocation opEnd) {
this.opEnd = opEnd;
}
public String getUniqueId() {
return uniqueId;
}
public int parameterCount() {
if (parameters == null)
return 0;
else
return parameters.size();
}
public String Canonical() {
StringBuilder b = new StringBuilder();
write(b);
return b.toString();
}
public String summary() {
switch (kind) {
case Name: return uniqueId+": "+name;
case Function: return uniqueId+": "+function.toString()+"()";
case Constant: return uniqueId+": "+constant;
case Group: return uniqueId+": (Group)";
}
return "??";
}
private void write(StringBuilder b) {
switch (kind) {
case Name:
b.append(name);
break;
case Constant:
b.append(constant);
break;
case Function:
b.append(function.toCode());
b.append('(');
boolean f = true;
for (ExpressionNode n : parameters) {
if (f)
f = false;
else
b.append(", ");
n.write(b);
}
b.append(')');
break;
case Group:
b.append('(');
group.write(b);
b.append(')');
}
if (inner != null) {
b.append('.');
inner.write(b);
}
if (operation != null) {
b.append(' ');
b.append(operation.toCode());
b.append(' ');
opNext.write(b);
}
}
public String check() {
switch (kind) {
case Name:
if (Utilities.noString(name))
return "No Name provided @ "+location();
break;
case Function:
if (function == null)
return "No Function id provided @ "+location();
for (ExpressionNode n : parameters) {
String msg = n.check();
if (msg != null)
return msg;
}
break;
case Constant:
if (Utilities.noString(constant))
return "No Constant provided @ "+location();
break;
case Group:
if (group == null)
return "No Group provided @ "+location();
else {
String msg = group.check();
if (msg != null)
return msg;
}
}
if (inner != null) {
String msg = inner.check();
if (msg != null)
return msg;
}
if (operation == null) {
if (opNext != null)
return "Next provided when it shouldn't be @ "+location();
}
else {
if (opNext == null)
return "No Next provided @ "+location();
else
opNext.check();
}
return null;
}
private String location() {
return Integer.toString(start.line)+", "+Integer.toString(start.column);
}
public Set<String> getTypes() {
return types;
}
public void setTypes(Set<String> types) {
this.types = types;
}
public Set<String> getOpTypes() {
return opTypes;
}
public void setOpTypes(Set<String> opTypes) {
this.opTypes = opTypes;
}
}

View File

@ -0,0 +1,360 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Optional Extensions Element - found in all resources.
*/
@DatatypeDef(name="Extension")
public class Extension extends BaseExtension implements IBaseExtension<Extension, Type>, IBaseHasExtensions {
/**
* Source of the definition for the extension code - a logical name or a URL.
*/
@Child(name = "url", type = {UriType.class}, order=0, min=1, max=1, modifier=false, summary=false)
@Description(shortDefinition="identifies the meaning of the extension", formalDefinition="Source of the definition for the extension code - a logical name or a URL." )
protected UriType url;
/**
* Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).
*/
@Child(name = "value", type = {}, order=1, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Value of extension", formalDefinition="Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list)." )
protected org.hl7.fhir.dstu21.model.Type value;
private static final long serialVersionUID = -1764879552L;
/**
* Constructor
*/
public Extension(String theUrl) {
setUrl(theUrl);
}
/**
* Constructor
*/
public Extension(String theUrl, IBaseDatatype theValue) {
setUrl(theUrl);
setValue(theValue);
}
/*
* Constructor
*/
public Extension() {
super();
}
/*
* Constructor
*/
public Extension(UriType url) {
super();
this.url = url;
}
/**
* @return {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public UriType getUrlElement() {
if (this.url == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Extension.url");
else if (Configuration.doAutoCreate())
this.url = new UriType(); // bb
return this.url;
}
public boolean hasUrlElement() {
return this.url != null && !this.url.isEmpty();
}
public boolean hasUrl() {
return this.url != null && !this.url.isEmpty();
}
/**
* @param value {@link #url} (Source of the definition for the extension code - a logical name or a URL.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
*/
public Extension setUrlElement(UriType value) {
this.url = value;
return this;
}
/**
* @return Source of the definition for the extension code - a logical name or a URL.
*/
public String getUrl() {
return this.url == null ? null : this.url.getValue();
}
/**
* @param value Source of the definition for the extension code - a logical name or a URL.
*/
public Extension setUrl(String value) {
if (this.url == null)
this.url = new UriType();
this.url.setValue(value);
return this;
}
/**
* @return {@link #value} (Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).)
*/
public org.hl7.fhir.dstu21.model.Type getValue() {
return this.value;
}
public boolean hasValue() {
return this.value != null && !this.value.isEmpty();
}
/**
* @param value {@link #value} (Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).)
*/
public Extension setValue(org.hl7.fhir.dstu21.model.Type value) {
this.value = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("url", "uri", "Source of the definition for the extension code - a logical name or a URL.", 0, java.lang.Integer.MAX_VALUE, url));
childrenList.add(new Property("value[x]", "*", "Value of extension - may be a resource or one of a constrained set of the data types (see Extensibility in the spec for list).", 0, java.lang.Integer.MAX_VALUE, value));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("url"))
this.url = castToUri(value); // UriType
else if (name.equals("value[x]"))
this.value = (org.hl7.fhir.dstu21.model.Type) value; // org.hl7.fhir.dstu21.model.Type
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("url")) {
throw new FHIRException("Cannot call addChild on a primitive type Extension.url");
}
else if (name.equals("valueBoolean")) {
this.value = new BooleanType();
return this.value;
}
else if (name.equals("valueInteger")) {
this.value = new IntegerType();
return this.value;
}
else if (name.equals("valueDecimal")) {
this.value = new DecimalType();
return this.value;
}
else if (name.equals("valueBase64Binary")) {
this.value = new Base64BinaryType();
return this.value;
}
else if (name.equals("valueInstant")) {
this.value = new InstantType();
return this.value;
}
else if (name.equals("valueString")) {
this.value = new StringType();
return this.value;
}
else if (name.equals("valueUri")) {
this.value = new UriType();
return this.value;
}
else if (name.equals("valueDate")) {
this.value = new DateType();
return this.value;
}
else if (name.equals("valueDateTime")) {
this.value = new DateTimeType();
return this.value;
}
else if (name.equals("valueTime")) {
this.value = new TimeType();
return this.value;
}
else if (name.equals("valueCode")) {
this.value = new CodeType();
return this.value;
}
else if (name.equals("valueOid")) {
this.value = new OidType();
return this.value;
}
else if (name.equals("valueId")) {
this.value = new IdType();
return this.value;
}
else if (name.equals("valueUnsignedInt")) {
this.value = new UnsignedIntType();
return this.value;
}
else if (name.equals("valuePositiveInt")) {
this.value = new PositiveIntType();
return this.value;
}
else if (name.equals("valueMarkdown")) {
this.value = new MarkdownType();
return this.value;
}
else if (name.equals("valueAnnotation")) {
this.value = new Annotation();
return this.value;
}
else if (name.equals("valueAttachment")) {
this.value = new Attachment();
return this.value;
}
else if (name.equals("valueIdentifier")) {
this.value = new Identifier();
return this.value;
}
else if (name.equals("valueCodeableConcept")) {
this.value = new CodeableConcept();
return this.value;
}
else if (name.equals("valueCoding")) {
this.value = new Coding();
return this.value;
}
else if (name.equals("valueQuantity")) {
this.value = new Quantity();
return this.value;
}
else if (name.equals("valueRange")) {
this.value = new Range();
return this.value;
}
else if (name.equals("valuePeriod")) {
this.value = new Period();
return this.value;
}
else if (name.equals("valueRatio")) {
this.value = new Ratio();
return this.value;
}
else if (name.equals("valueSampledData")) {
this.value = new SampledData();
return this.value;
}
else if (name.equals("valueSignature")) {
this.value = new Signature();
return this.value;
}
else if (name.equals("valueHumanName")) {
this.value = new HumanName();
return this.value;
}
else if (name.equals("valueAddress")) {
this.value = new Address();
return this.value;
}
else if (name.equals("valueContactPoint")) {
this.value = new ContactPoint();
return this.value;
}
else if (name.equals("valueTiming")) {
this.value = new Timing();
return this.value;
}
else if (name.equals("valueReference")) {
this.value = new Reference();
return this.value;
}
else if (name.equals("valueMeta")) {
this.value = new Meta();
return this.value;
}
else
return super.addChild(name);
}
public String fhirType() {
return "Extension";
}
public Extension copy() {
Extension dst = new Extension();
copyValues(dst);
dst.url = url == null ? null : url.copy();
dst.value = value == null ? null : value.copy();
return dst;
}
protected Extension typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Extension))
return false;
Extension o = (Extension) other;
return compareDeep(url, o.url, true) && compareDeep(value, o.value, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Extension))
return false;
Extension o = (Extension) other;
return compareValues(url, o.url, true);
}
public boolean isEmpty() {
return super.isEmpty() && (url == null || url.isEmpty()) && (value == null || value.isEmpty())
;
}
}

View File

@ -0,0 +1,148 @@
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.exceptions.FHIRException;
/**
* in a language with helper classes, this would be a helper class (at least, the base exgtension helpers would be)
* @author Grahame
*
*/
public class ExtensionHelper {
/**
* @param name the identity of the extension of interest
* @return true if the named extension is on this element. Will check modifier extensions too if appropriate
*/
public static boolean hasExtension(Element element, String name) {
if (element != null && element instanceof BackboneElement)
return hasExtension((BackboneElement) element, name);
if (name == null || element == null || !element.hasExtension())
return false;
for (Extension e : element.getExtension()) {
if (name.equals(e.getUrl()))
return true;
}
return false;
}
/**
* @param name the identity of the extension of interest
* @return true if the named extension is on this element. Will check modifier extensions
*/
public static boolean hasExtension(BackboneElement element, String name) {
if (name == null || element == null || !(element.hasExtension() || element.hasModifierExtension()))
return false;
for (Extension e : element.getModifierExtension()) {
if (name.equals(e.getUrl()))
return true;
}
for (Extension e : element.getExtension()) {
if (name.equals(e.getUrl()))
return true;
}
return false;
}
/**
* @param name the identity of the extension of interest
* @return The extension, if on this element, else null. will check modifier extensions too, if appropriate
*/
public static Extension getExtension(Element element, String name) {
if (element != null && element instanceof BackboneElement)
return getExtension((BackboneElement) element, name);
if (name == null || element == null || !element.hasExtension())
return null;
for (Extension e : element.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
/**
* @param name the identity of the extension of interest
* @return The extension, if on this element, else null. will check modifier extensions too
*/
public static Extension getExtension(BackboneElement element, String name) {
if (name == null || element == null || !element.hasExtension())
return null;
for (Extension e : element.getModifierExtension()) {
if (name.equals(e.getUrl()))
return e;
}
for (Extension e : element.getExtension()) {
if (name.equals(e.getUrl()))
return e;
}
return null;
}
/**
* set the value of an extension on the element. if value == null, make sure it doesn't exist
*
* @param element - the element to act on. Can also be a backbone element
* @param modifier - whether this is a modifier. Note that this is a definitional property of the extension; don't alternate
* @param uri - the identifier for the extension
* @param value - the value of the extension. Delete if this is null
* @throws Exception - if the modifier logic is incorrect
*/
public static void setExtension(Element element, boolean modifier, String uri, Type value) throws FHIRException {
if (value == null) {
// deleting the extension
if (element instanceof BackboneElement)
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
if (uri.equals(e.getUrl()))
((BackboneElement) element).getModifierExtension().remove(e);
}
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl()))
element.getExtension().remove(e);
}
} else {
// it would probably be easier to delete and then create, but this would re-order the extensions
// not that order matters, but we'll preserve it anyway
boolean found = false;
if (element instanceof BackboneElement)
for (Extension e : ((BackboneElement) element).getModifierExtension()) {
if (uri.equals(e.getUrl())) {
if (!modifier)
throw new FHIRException("Error adding extension \""+uri+"\": found an existing modifier extension, and the extension is not marked as a modifier");
e.setValue(value);
found = true;
}
}
for (Extension e : element.getExtension()) {
if (uri.equals(e.getUrl())) {
if (modifier)
throw new FHIRException("Error adding extension \""+uri+"\": found an existing extension, and the extension is marked as a modifier");
e.setValue(value);
found = true;
}
}
if (!found) {
Extension ex = new Extension().setUrl(uri).setValue(value);
if (modifier) {
if (!(element instanceof BackboneElement))
throw new FHIRException("Error adding extension \""+uri+"\": extension is marked as a modifier, but element is not a backbone element");
((BackboneElement) element).getModifierExtension().add(ex);
} else {
element.getExtension().add(ex);
}
}
}
}
public static boolean hasExtensions(Element element) {
if (element instanceof BackboneElement)
return element.hasExtension() || ((BackboneElement) element).hasModifierExtension();
else
return element.hasExtension();
}
}

View File

@ -0,0 +1,247 @@
package org.hl7.fhir.dstu21.model;
import java.io.IOException;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.UUID;
import org.hl7.fhir.dstu21.model.ContactPoint.ContactPointSystem;
import org.hl7.fhir.dstu21.model.Narrative.NarrativeStatus;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
public class Factory {
public static IdType newId(String value) {
if (value == null)
return null;
IdType res = new IdType();
res.setValue(value);
return res;
}
public static StringType newString_(String value) {
if (value == null)
return null;
StringType res = new StringType();
res.setValue(value);
return res;
}
public static UriType newUri(String value) throws URISyntaxException {
if (value == null)
return null;
UriType res = new UriType();
res.setValue(value);
return res;
}
public static DateTimeType newDateTime(String value) throws ParseException {
if (value == null)
return null;
return new DateTimeType(value);
}
public static DateType newDate(String value) throws ParseException {
if (value == null)
return null;
return new DateType(value);
}
public static CodeType newCode(String value) {
if (value == null)
return null;
CodeType res = new CodeType();
res.setValue(value);
return res;
}
public static IntegerType newInteger(int value) {
IntegerType res = new IntegerType();
res.setValue(value);
return res;
}
public static IntegerType newInteger(java.lang.Integer value) {
if (value == null)
return null;
IntegerType res = new IntegerType();
res.setValue(value);
return res;
}
public static BooleanType newBoolean(boolean value) {
BooleanType res = new BooleanType();
res.setValue(value);
return res;
}
public static ContactPoint newContactPoint(ContactPointSystem system, String value) {
ContactPoint res = new ContactPoint();
res.setSystem(system);
res.setValue(value);
return res;
}
public static Extension newExtension(String uri, Type value, boolean evenIfNull) {
if (!evenIfNull && (value == null || value.isEmpty()))
return null;
Extension e = new Extension();
e.setUrl(uri);
e.setValue(value);
return e;
}
public static CodeableConcept newCodeableConcept(String code, String system, String display) {
CodeableConcept cc = new CodeableConcept();
Coding c = new Coding();
c.setCode(code);
c.setSystem(system);
c.setDisplay(display);
cc.getCoding().add(c);
return cc;
}
public static Reference makeReference(String url) {
Reference rr = new Reference();
rr.setReference(url);
return rr;
}
public static Narrative newNarrative(NarrativeStatus status, String html) throws IOException, FHIRException {
Narrative n = new Narrative();
n.setStatus(status);
n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>"));
return n;
}
public static Coding makeCoding(String code) throws FHIRException {
String[] parts = code.split("\\|");
Coding c = new Coding();
if (parts.length == 2) {
c.setSystem(parts[0]);
c.setCode(parts[1]);
} else if (parts.length == 3) {
c.setSystem(parts[0]);
c.setCode(parts[1]);
c.setDisplay(parts[2]);
} else
throw new FHIRException("Unable to understand the code '"+code+"'. Use the format system|code(|display)");
return c;
}
public static Reference makeReference(String url, String text) {
Reference rr = new Reference();
rr.setReference(url);
if (!Utilities.noString(text))
rr.setDisplay(text);
return rr;
}
public static String createUUID() {
return "urn:uuid:"+UUID.randomUUID().toString().toLowerCase();
}
public Type create(String name) throws FHIRException {
if (name.equals("boolean"))
return new BooleanType();
else if (name.equals("integer"))
return new IntegerType();
else if (name.equals("decimal"))
return new DecimalType();
else if (name.equals("base64Binary"))
return new Base64BinaryType();
else if (name.equals("instant"))
return new InstantType();
else if (name.equals("string"))
return new StringType();
else if (name.equals("uri"))
return new UriType();
else if (name.equals("date"))
return new DateType();
else if (name.equals("dateTime"))
return new DateTimeType();
else if (name.equals("time"))
return new TimeType();
else if (name.equals("code"))
return new CodeType();
else if (name.equals("oid"))
return new OidType();
else if (name.equals("id"))
return new IdType();
else if (name.equals("unsignedInt"))
return new UnsignedIntType();
else if (name.equals("positiveInt"))
return new PositiveIntType();
else if (name.equals("markdown"))
return new MarkdownType();
else if (name.equals("Annotation"))
return new Annotation();
else if (name.equals("Attachment"))
return new Attachment();
else if (name.equals("Identifier"))
return new Identifier();
else if (name.equals("CodeableConcept"))
return new CodeableConcept();
else if (name.equals("Coding"))
return new Coding();
else if (name.equals("Quantity"))
return new Quantity();
else if (name.equals("Range"))
return new Range();
else if (name.equals("Period"))
return new Period();
else if (name.equals("Ratio"))
return new Ratio();
else if (name.equals("SampledData"))
return new SampledData();
else if (name.equals("Signature"))
return new Signature();
else if (name.equals("HumanName"))
return new HumanName();
else if (name.equals("Address"))
return new Address();
else if (name.equals("ContactPoint"))
return new ContactPoint();
else if (name.equals("Timing"))
return new Timing();
else if (name.equals("Reference"))
return new Reference();
else if (name.equals("Meta"))
return new Meta();
else
throw new FHIRException("Unknown data type name "+name);
}
}

View File

@ -0,0 +1,662 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* Prospective warnings of potential issues when providing care to the patient.
*/
@ResourceDef(name="Flag", profile="http://hl7.org/fhir/Profile/Flag")
public class Flag extends DomainResource {
public enum FlagStatus {
/**
* A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.
*/
ACTIVE,
/**
* The flag does not need to be displayed any more.
*/
INACTIVE,
/**
* The flag was added in error, and should no longer be displayed.
*/
ENTEREDINERROR,
/**
* added to help the parsers
*/
NULL;
public static FlagStatus fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("active".equals(codeString))
return ACTIVE;
if ("inactive".equals(codeString))
return INACTIVE;
if ("entered-in-error".equals(codeString))
return ENTEREDINERROR;
throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case ACTIVE: return "active";
case INACTIVE: return "inactive";
case ENTEREDINERROR: return "entered-in-error";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case ACTIVE: return "http://hl7.org/fhir/flag-status";
case INACTIVE: return "http://hl7.org/fhir/flag-status";
case ENTEREDINERROR: return "http://hl7.org/fhir/flag-status";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case ACTIVE: return "A current flag that should be displayed to a user. A system may use the category to determine which roles should view the flag.";
case INACTIVE: return "The flag does not need to be displayed any more.";
case ENTEREDINERROR: return "The flag was added in error, and should no longer be displayed.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case ACTIVE: return "Active";
case INACTIVE: return "Inactive";
case ENTEREDINERROR: return "Entered in Error";
default: return "?";
}
}
}
public static class FlagStatusEnumFactory implements EnumFactory<FlagStatus> {
public FlagStatus fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("active".equals(codeString))
return FlagStatus.ACTIVE;
if ("inactive".equals(codeString))
return FlagStatus.INACTIVE;
if ("entered-in-error".equals(codeString))
return FlagStatus.ENTEREDINERROR;
throw new IllegalArgumentException("Unknown FlagStatus code '"+codeString+"'");
}
public Enumeration<FlagStatus> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("active".equals(codeString))
return new Enumeration<FlagStatus>(this, FlagStatus.ACTIVE);
if ("inactive".equals(codeString))
return new Enumeration<FlagStatus>(this, FlagStatus.INACTIVE);
if ("entered-in-error".equals(codeString))
return new Enumeration<FlagStatus>(this, FlagStatus.ENTEREDINERROR);
throw new FHIRException("Unknown FlagStatus code '"+codeString+"'");
}
public String toCode(FlagStatus code) {
if (code == FlagStatus.ACTIVE)
return "active";
if (code == FlagStatus.INACTIVE)
return "inactive";
if (code == FlagStatus.ENTEREDINERROR)
return "entered-in-error";
return "?";
}
}
/**
* Identifier assigned to the flag for external use (outside the FHIR environment).
*/
@Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Business identifier", formalDefinition="Identifier assigned to the flag for external use (outside the FHIR environment)." )
protected List<Identifier> identifier;
/**
* Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.
*/
@Child(name = "category", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Clinical, administrative, etc.", formalDefinition="Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context." )
protected CodeableConcept category;
/**
* Supports basic workflow.
*/
@Child(name = "status", type = {CodeType.class}, order=2, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="active | inactive | entered-in-error", formalDefinition="Supports basic workflow." )
protected Enumeration<FlagStatus> status;
/**
* The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.
*/
@Child(name = "period", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time period when flag is active", formalDefinition="The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified." )
protected Period period;
/**
* The patient, location, group , organization , or practitioner this is about record this flag is associated with.
*/
@Child(name = "subject", type = {Patient.class, Location.class, Group.class, Organization.class, Practitioner.class}, order=4, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Who/What is flag about?", formalDefinition="The patient, location, group , organization , or practitioner this is about record this flag is associated with." )
protected Reference subject;
/**
* The actual object that is the target of the reference (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
*/
protected Resource subjectTarget;
/**
* This alert is only relevant during the encounter.
*/
@Child(name = "encounter", type = {Encounter.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Alert relevant during encounter", formalDefinition="This alert is only relevant during the encounter." )
protected Reference encounter;
/**
* The actual object that is the target of the reference (This alert is only relevant during the encounter.)
*/
protected Encounter encounterTarget;
/**
* The person, organization or device that created the flag.
*/
@Child(name = "author", type = {Device.class, Organization.class, Patient.class, Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Flag creator", formalDefinition="The person, organization or device that created the flag." )
protected Reference author;
/**
* The actual object that is the target of the reference (The person, organization or device that created the flag.)
*/
protected Resource authorTarget;
/**
* The coded value or textual component of the flag to display to the user.
*/
@Child(name = "code", type = {CodeableConcept.class}, order=7, min=1, max=1, modifier=false, summary=true)
@Description(shortDefinition="Partially deaf, Requires easy open caps, No permanent address, etc.", formalDefinition="The coded value or textual component of the flag to display to the user." )
protected CodeableConcept code;
private static final long serialVersionUID = 701147751L;
/*
* Constructor
*/
public Flag() {
super();
}
/*
* Constructor
*/
public Flag(Enumeration<FlagStatus> status, Reference subject, CodeableConcept code) {
super();
this.status = status;
this.subject = subject;
this.code = code;
}
/**
* @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
*/
public List<Identifier> getIdentifier() {
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
return this.identifier;
}
public boolean hasIdentifier() {
if (this.identifier == null)
return false;
for (Identifier item : this.identifier)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #identifier} (Identifier assigned to the flag for external use (outside the FHIR environment).)
*/
// syntactic sugar
public Identifier addIdentifier() { //3
Identifier t = new Identifier();
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return t;
}
// syntactic sugar
public Flag addIdentifier(Identifier t) { //3
if (t == null)
return this;
if (this.identifier == null)
this.identifier = new ArrayList<Identifier>();
this.identifier.add(t);
return this;
}
/**
* @return {@link #category} (Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.)
*/
public CodeableConcept getCategory() {
if (this.category == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.category");
else if (Configuration.doAutoCreate())
this.category = new CodeableConcept(); // cc
return this.category;
}
public boolean hasCategory() {
return this.category != null && !this.category.isEmpty();
}
/**
* @param value {@link #category} (Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.)
*/
public Flag setCategory(CodeableConcept value) {
this.category = value;
return this;
}
/**
* @return {@link #status} (Supports basic workflow.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
*/
public Enumeration<FlagStatus> getStatusElement() {
if (this.status == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.status");
else if (Configuration.doAutoCreate())
this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory()); // bb
return this.status;
}
public boolean hasStatusElement() {
return this.status != null && !this.status.isEmpty();
}
public boolean hasStatus() {
return this.status != null && !this.status.isEmpty();
}
/**
* @param value {@link #status} (Supports basic workflow.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
*/
public Flag setStatusElement(Enumeration<FlagStatus> value) {
this.status = value;
return this;
}
/**
* @return Supports basic workflow.
*/
public FlagStatus getStatus() {
return this.status == null ? null : this.status.getValue();
}
/**
* @param value Supports basic workflow.
*/
public Flag setStatus(FlagStatus value) {
if (this.status == null)
this.status = new Enumeration<FlagStatus>(new FlagStatusEnumFactory());
this.status.setValue(value);
return this;
}
/**
* @return {@link #period} (The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.)
*/
public Flag setPeriod(Period value) {
this.period = value;
return this;
}
/**
* @return {@link #subject} (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
*/
public Reference getSubject() {
if (this.subject == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.subject");
else if (Configuration.doAutoCreate())
this.subject = new Reference(); // cc
return this.subject;
}
public boolean hasSubject() {
return this.subject != null && !this.subject.isEmpty();
}
/**
* @param value {@link #subject} (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
*/
public Flag setSubject(Reference value) {
this.subject = value;
return this;
}
/**
* @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
*/
public Resource getSubjectTarget() {
return this.subjectTarget;
}
/**
* @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The patient, location, group , organization , or practitioner this is about record this flag is associated with.)
*/
public Flag setSubjectTarget(Resource value) {
this.subjectTarget = value;
return this;
}
/**
* @return {@link #encounter} (This alert is only relevant during the encounter.)
*/
public Reference getEncounter() {
if (this.encounter == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.encounter");
else if (Configuration.doAutoCreate())
this.encounter = new Reference(); // cc
return this.encounter;
}
public boolean hasEncounter() {
return this.encounter != null && !this.encounter.isEmpty();
}
/**
* @param value {@link #encounter} (This alert is only relevant during the encounter.)
*/
public Flag setEncounter(Reference value) {
this.encounter = value;
return this;
}
/**
* @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (This alert is only relevant during the encounter.)
*/
public Encounter getEncounterTarget() {
if (this.encounterTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.encounter");
else if (Configuration.doAutoCreate())
this.encounterTarget = new Encounter(); // aa
return this.encounterTarget;
}
/**
* @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (This alert is only relevant during the encounter.)
*/
public Flag setEncounterTarget(Encounter value) {
this.encounterTarget = value;
return this;
}
/**
* @return {@link #author} (The person, organization or device that created the flag.)
*/
public Reference getAuthor() {
if (this.author == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.author");
else if (Configuration.doAutoCreate())
this.author = new Reference(); // cc
return this.author;
}
public boolean hasAuthor() {
return this.author != null && !this.author.isEmpty();
}
/**
* @param value {@link #author} (The person, organization or device that created the flag.)
*/
public Flag setAuthor(Reference value) {
this.author = value;
return this;
}
/**
* @return {@link #author} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person, organization or device that created the flag.)
*/
public Resource getAuthorTarget() {
return this.authorTarget;
}
/**
* @param value {@link #author} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person, organization or device that created the flag.)
*/
public Flag setAuthorTarget(Resource value) {
this.authorTarget = value;
return this;
}
/**
* @return {@link #code} (The coded value or textual component of the flag to display to the user.)
*/
public CodeableConcept getCode() {
if (this.code == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Flag.code");
else if (Configuration.doAutoCreate())
this.code = new CodeableConcept(); // cc
return this.code;
}
public boolean hasCode() {
return this.code != null && !this.code.isEmpty();
}
/**
* @param value {@link #code} (The coded value or textual component of the flag to display to the user.)
*/
public Flag setCode(CodeableConcept value) {
this.code = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("identifier", "Identifier", "Identifier assigned to the flag for external use (outside the FHIR environment).", 0, java.lang.Integer.MAX_VALUE, identifier));
childrenList.add(new Property("category", "CodeableConcept", "Allows an flag to be divided into different categories like clinical, administrative etc. Intended to be used as a means of filtering which flags are displayed to particular user or in a given context.", 0, java.lang.Integer.MAX_VALUE, category));
childrenList.add(new Property("status", "code", "Supports basic workflow.", 0, java.lang.Integer.MAX_VALUE, status));
childrenList.add(new Property("period", "Period", "The period of time from the activation of the flag to inactivation of the flag. If the flag is active, the end of the period should be unspecified.", 0, java.lang.Integer.MAX_VALUE, period));
childrenList.add(new Property("subject", "Reference(Patient|Location|Group|Organization|Practitioner)", "The patient, location, group , organization , or practitioner this is about record this flag is associated with.", 0, java.lang.Integer.MAX_VALUE, subject));
childrenList.add(new Property("encounter", "Reference(Encounter)", "This alert is only relevant during the encounter.", 0, java.lang.Integer.MAX_VALUE, encounter));
childrenList.add(new Property("author", "Reference(Device|Organization|Patient|Practitioner)", "The person, organization or device that created the flag.", 0, java.lang.Integer.MAX_VALUE, author));
childrenList.add(new Property("code", "CodeableConcept", "The coded value or textual component of the flag to display to the user.", 0, java.lang.Integer.MAX_VALUE, code));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("category"))
this.category = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("status"))
this.status = new FlagStatusEnumFactory().fromType(value); // Enumeration<FlagStatus>
else if (name.equals("period"))
this.period = castToPeriod(value); // Period
else if (name.equals("subject"))
this.subject = castToReference(value); // Reference
else if (name.equals("encounter"))
this.encounter = castToReference(value); // Reference
else if (name.equals("author"))
this.author = castToReference(value); // Reference
else if (name.equals("code"))
this.code = castToCodeableConcept(value); // CodeableConcept
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("identifier")) {
return addIdentifier();
}
else if (name.equals("category")) {
this.category = new CodeableConcept();
return this.category;
}
else if (name.equals("status")) {
throw new FHIRException("Cannot call addChild on a primitive type Flag.status");
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else if (name.equals("subject")) {
this.subject = new Reference();
return this.subject;
}
else if (name.equals("encounter")) {
this.encounter = new Reference();
return this.encounter;
}
else if (name.equals("author")) {
this.author = new Reference();
return this.author;
}
else if (name.equals("code")) {
this.code = new CodeableConcept();
return this.code;
}
else
return super.addChild(name);
}
public String fhirType() {
return "Flag";
}
public Flag copy() {
Flag dst = new Flag();
copyValues(dst);
if (identifier != null) {
dst.identifier = new ArrayList<Identifier>();
for (Identifier i : identifier)
dst.identifier.add(i.copy());
};
dst.category = category == null ? null : category.copy();
dst.status = status == null ? null : status.copy();
dst.period = period == null ? null : period.copy();
dst.subject = subject == null ? null : subject.copy();
dst.encounter = encounter == null ? null : encounter.copy();
dst.author = author == null ? null : author.copy();
dst.code = code == null ? null : code.copy();
return dst;
}
protected Flag typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Flag))
return false;
Flag o = (Flag) other;
return compareDeep(identifier, o.identifier, true) && compareDeep(category, o.category, true) && compareDeep(status, o.status, true)
&& compareDeep(period, o.period, true) && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true)
&& compareDeep(author, o.author, true) && compareDeep(code, o.code, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Flag))
return false;
Flag o = (Flag) other;
return compareValues(status, o.status, true);
}
public boolean isEmpty() {
return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (category == null || category.isEmpty())
&& (status == null || status.isEmpty()) && (period == null || period.isEmpty()) && (subject == null || subject.isEmpty())
&& (encounter == null || encounter.isEmpty()) && (author == null || author.isEmpty()) && (code == null || code.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Flag;
}
@SearchParamDefinition(name="date", path="Flag.period", description="Time period when flag is active", type="date" )
public static final String SP_DATE = "date";
@SearchParamDefinition(name="subject", path="Flag.subject", description="The identity of a subject to list flags for", type="reference" )
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="patient", path="Flag.subject", description="The identity of a subject to list flags for", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="author", path="Flag.author", description="Flag creator", type="reference" )
public static final String SP_AUTHOR = "author";
@SearchParamDefinition(name="encounter", path="Flag.encounter", description="Alert relevant during encounter", type="reference" )
public static final String SP_ENCOUNTER = "encounter";
}

View File

@ -0,0 +1,912 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A guidance request is a request to evaluate a particular knowledge module focused on decision support, providing information relevant to decision support such as workflow and user context.
*/
@ResourceDef(name="GuidanceRequest", profile="http://hl7.org/fhir/Profile/GuidanceRequest")
public class GuidanceRequest extends DomainResource {
/**
* A reference to a knowledge module involved in an interaction.
*/
@Child(name = "module", type = {DecisionSupportRule.class, DecisionSupportServiceModule.class}, order=0, min=1, max=1, modifier=true, summary=true)
@Description(shortDefinition="A reference to a knowledge module", formalDefinition="A reference to a knowledge module involved in an interaction." )
protected Reference module;
/**
* The actual object that is the target of the reference (A reference to a knowledge module involved in an interaction.)
*/
protected Resource moduleTarget;
/**
* The date and time of the request, with respect to the initiator.
*/
@Child(name = "dateTime", type = {DateTimeType.class}, order=1, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="The date and time of the request", formalDefinition="The date and time of the request, with respect to the initiator." )
protected DateTimeType dateTime;
/**
* Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to "Now" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed.
*/
@Child(name = "evaluateAtDateTime", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="Indicates that the evaluation should be performed as though it was the given date and time", formalDefinition="Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to \"Now\" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed." )
protected DateTimeType evaluateAtDateTime;
/**
* The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.
*/
@Child(name = "inputParameters", type = {Parameters.class}, order=3, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="The input parameters for a request, if any", formalDefinition="The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources." )
protected Reference inputParameters;
/**
* The actual object that is the target of the reference (The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.)
*/
protected Parameters inputParametersTarget;
/**
* The organization initiating the request.
*/
@Child(name = "initiatingOrganization", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The organization initiating the request." )
protected Reference initiatingOrganization;
/**
* The actual object that is the target of the reference (The organization initiating the request.)
*/
protected Organization initiatingOrganizationTarget;
/**
* The person initiating the request.
*/
@Child(name = "initiatingPerson", type = {Person.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=5, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The person initiating the request." )
protected Reference initiatingPerson;
/**
* The actual object that is the target of the reference (The person initiating the request.)
*/
protected Resource initiatingPersonTarget;
/**
* The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.).
*/
@Child(name = "userType", type = {CodeableConcept.class}, order=6, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="The type of user initiating the request", formalDefinition="The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.)." )
protected CodeableConcept userType;
/**
* Preferred language of the person using the system.
*/
@Child(name = "userLanguage", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="Preferred language of the person using the system." )
protected CodeableConcept userLanguage;
/**
* The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources.
*/
@Child(name = "userTaskContext", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="The task the system user is performing", formalDefinition="The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources." )
protected CodeableConcept userTaskContext;
/**
* The organization that will receive the response.
*/
@Child(name = "receivingOrganization", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The organization that will receive the response." )
protected Reference receivingOrganization;
/**
* The actual object that is the target of the reference (The organization that will receive the response.)
*/
protected Organization receivingOrganizationTarget;
/**
* The person in the receiving organization that will receive the response.
*/
@Child(name = "receivingPerson", type = {Person.class, Patient.class, Practitioner.class, RelatedPerson.class}, order=10, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The person in the receiving organization that will receive the response." )
protected Reference receivingPerson;
/**
* The actual object that is the target of the reference (The person in the receiving organization that will receive the response.)
*/
protected Resource receivingPersonTarget;
/**
* The type of individual that will consume the response content. This may be different from the requesting user type (e.g. if a clinician is getting disease management guidance for provision to a patient). E.g. patient, healthcare provider or specific type of healthcare provider (physician, nurse, etc.).
*/
@Child(name = "recipientType", type = {CodeableConcept.class}, order=11, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The type of individual that will consume the response content. This may be different from the requesting user type (e.g. if a clinician is getting disease management guidance for provision to a patient). E.g. patient, healthcare provider or specific type of healthcare provider (physician, nurse, etc.)." )
protected CodeableConcept recipientType;
/**
* Preferred language of the person that will consume the content.
*/
@Child(name = "recipientLanguage", type = {CodeableConcept.class}, order=12, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="Preferred language of the person that will consume the content." )
protected CodeableConcept recipientLanguage;
/**
* The class of encounter (inpatient, outpatient, etc).
*/
@Child(name = "encounterClass", type = {CodeableConcept.class}, order=13, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The class of encounter (inpatient, outpatient, etc)." )
protected CodeableConcept encounterClass;
/**
* The type of the encounter.
*/
@Child(name = "encounterType", type = {CodeableConcept.class}, order=14, min=0, max=1, modifier=false, summary=false)
@Description(shortDefinition="", formalDefinition="The type of the encounter." )
protected CodeableConcept encounterType;
private static final long serialVersionUID = -1810099048L;
/*
* Constructor
*/
public GuidanceRequest() {
super();
}
/*
* Constructor
*/
public GuidanceRequest(Reference module) {
super();
this.module = module;
}
/**
* @return {@link #module} (A reference to a knowledge module involved in an interaction.)
*/
public Reference getModule() {
if (this.module == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.module");
else if (Configuration.doAutoCreate())
this.module = new Reference(); // cc
return this.module;
}
public boolean hasModule() {
return this.module != null && !this.module.isEmpty();
}
/**
* @param value {@link #module} (A reference to a knowledge module involved in an interaction.)
*/
public GuidanceRequest setModule(Reference value) {
this.module = value;
return this;
}
/**
* @return {@link #module} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A reference to a knowledge module involved in an interaction.)
*/
public Resource getModuleTarget() {
return this.moduleTarget;
}
/**
* @param value {@link #module} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A reference to a knowledge module involved in an interaction.)
*/
public GuidanceRequest setModuleTarget(Resource value) {
this.moduleTarget = value;
return this;
}
/**
* @return {@link #dateTime} (The date and time of the request, with respect to the initiator.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
*/
public DateTimeType getDateTimeElement() {
if (this.dateTime == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.dateTime");
else if (Configuration.doAutoCreate())
this.dateTime = new DateTimeType(); // bb
return this.dateTime;
}
public boolean hasDateTimeElement() {
return this.dateTime != null && !this.dateTime.isEmpty();
}
public boolean hasDateTime() {
return this.dateTime != null && !this.dateTime.isEmpty();
}
/**
* @param value {@link #dateTime} (The date and time of the request, with respect to the initiator.). This is the underlying object with id, value and extensions. The accessor "getDateTime" gives direct access to the value
*/
public GuidanceRequest setDateTimeElement(DateTimeType value) {
this.dateTime = value;
return this;
}
/**
* @return The date and time of the request, with respect to the initiator.
*/
public Date getDateTime() {
return this.dateTime == null ? null : this.dateTime.getValue();
}
/**
* @param value The date and time of the request, with respect to the initiator.
*/
public GuidanceRequest setDateTime(Date value) {
if (value == null)
this.dateTime = null;
else {
if (this.dateTime == null)
this.dateTime = new DateTimeType();
this.dateTime.setValue(value);
}
return this;
}
/**
* @return {@link #evaluateAtDateTime} (Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to "Now" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed.). This is the underlying object with id, value and extensions. The accessor "getEvaluateAtDateTime" gives direct access to the value
*/
public DateTimeType getEvaluateAtDateTimeElement() {
if (this.evaluateAtDateTime == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.evaluateAtDateTime");
else if (Configuration.doAutoCreate())
this.evaluateAtDateTime = new DateTimeType(); // bb
return this.evaluateAtDateTime;
}
public boolean hasEvaluateAtDateTimeElement() {
return this.evaluateAtDateTime != null && !this.evaluateAtDateTime.isEmpty();
}
public boolean hasEvaluateAtDateTime() {
return this.evaluateAtDateTime != null && !this.evaluateAtDateTime.isEmpty();
}
/**
* @param value {@link #evaluateAtDateTime} (Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to "Now" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed.). This is the underlying object with id, value and extensions. The accessor "getEvaluateAtDateTime" gives direct access to the value
*/
public GuidanceRequest setEvaluateAtDateTimeElement(DateTimeType value) {
this.evaluateAtDateTime = value;
return this;
}
/**
* @return Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to "Now" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed.
*/
public Date getEvaluateAtDateTime() {
return this.evaluateAtDateTime == null ? null : this.evaluateAtDateTime.getValue();
}
/**
* @param value Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to "Now" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed.
*/
public GuidanceRequest setEvaluateAtDateTime(Date value) {
if (value == null)
this.evaluateAtDateTime = null;
else {
if (this.evaluateAtDateTime == null)
this.evaluateAtDateTime = new DateTimeType();
this.evaluateAtDateTime.setValue(value);
}
return this;
}
/**
* @return {@link #inputParameters} (The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.)
*/
public Reference getInputParameters() {
if (this.inputParameters == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.inputParameters");
else if (Configuration.doAutoCreate())
this.inputParameters = new Reference(); // cc
return this.inputParameters;
}
public boolean hasInputParameters() {
return this.inputParameters != null && !this.inputParameters.isEmpty();
}
/**
* @param value {@link #inputParameters} (The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.)
*/
public GuidanceRequest setInputParameters(Reference value) {
this.inputParameters = value;
return this;
}
/**
* @return {@link #inputParameters} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.)
*/
public Parameters getInputParametersTarget() {
if (this.inputParametersTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.inputParameters");
else if (Configuration.doAutoCreate())
this.inputParametersTarget = new Parameters(); // aa
return this.inputParametersTarget;
}
/**
* @param value {@link #inputParameters} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.)
*/
public GuidanceRequest setInputParametersTarget(Parameters value) {
this.inputParametersTarget = value;
return this;
}
/**
* @return {@link #initiatingOrganization} (The organization initiating the request.)
*/
public Reference getInitiatingOrganization() {
if (this.initiatingOrganization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.initiatingOrganization");
else if (Configuration.doAutoCreate())
this.initiatingOrganization = new Reference(); // cc
return this.initiatingOrganization;
}
public boolean hasInitiatingOrganization() {
return this.initiatingOrganization != null && !this.initiatingOrganization.isEmpty();
}
/**
* @param value {@link #initiatingOrganization} (The organization initiating the request.)
*/
public GuidanceRequest setInitiatingOrganization(Reference value) {
this.initiatingOrganization = value;
return this;
}
/**
* @return {@link #initiatingOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization initiating the request.)
*/
public Organization getInitiatingOrganizationTarget() {
if (this.initiatingOrganizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.initiatingOrganization");
else if (Configuration.doAutoCreate())
this.initiatingOrganizationTarget = new Organization(); // aa
return this.initiatingOrganizationTarget;
}
/**
* @param value {@link #initiatingOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization initiating the request.)
*/
public GuidanceRequest setInitiatingOrganizationTarget(Organization value) {
this.initiatingOrganizationTarget = value;
return this;
}
/**
* @return {@link #initiatingPerson} (The person initiating the request.)
*/
public Reference getInitiatingPerson() {
if (this.initiatingPerson == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.initiatingPerson");
else if (Configuration.doAutoCreate())
this.initiatingPerson = new Reference(); // cc
return this.initiatingPerson;
}
public boolean hasInitiatingPerson() {
return this.initiatingPerson != null && !this.initiatingPerson.isEmpty();
}
/**
* @param value {@link #initiatingPerson} (The person initiating the request.)
*/
public GuidanceRequest setInitiatingPerson(Reference value) {
this.initiatingPerson = value;
return this;
}
/**
* @return {@link #initiatingPerson} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person initiating the request.)
*/
public Resource getInitiatingPersonTarget() {
return this.initiatingPersonTarget;
}
/**
* @param value {@link #initiatingPerson} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person initiating the request.)
*/
public GuidanceRequest setInitiatingPersonTarget(Resource value) {
this.initiatingPersonTarget = value;
return this;
}
/**
* @return {@link #userType} (The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.).)
*/
public CodeableConcept getUserType() {
if (this.userType == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.userType");
else if (Configuration.doAutoCreate())
this.userType = new CodeableConcept(); // cc
return this.userType;
}
public boolean hasUserType() {
return this.userType != null && !this.userType.isEmpty();
}
/**
* @param value {@link #userType} (The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.).)
*/
public GuidanceRequest setUserType(CodeableConcept value) {
this.userType = value;
return this;
}
/**
* @return {@link #userLanguage} (Preferred language of the person using the system.)
*/
public CodeableConcept getUserLanguage() {
if (this.userLanguage == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.userLanguage");
else if (Configuration.doAutoCreate())
this.userLanguage = new CodeableConcept(); // cc
return this.userLanguage;
}
public boolean hasUserLanguage() {
return this.userLanguage != null && !this.userLanguage.isEmpty();
}
/**
* @param value {@link #userLanguage} (Preferred language of the person using the system.)
*/
public GuidanceRequest setUserLanguage(CodeableConcept value) {
this.userLanguage = value;
return this;
}
/**
* @return {@link #userTaskContext} (The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources.)
*/
public CodeableConcept getUserTaskContext() {
if (this.userTaskContext == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.userTaskContext");
else if (Configuration.doAutoCreate())
this.userTaskContext = new CodeableConcept(); // cc
return this.userTaskContext;
}
public boolean hasUserTaskContext() {
return this.userTaskContext != null && !this.userTaskContext.isEmpty();
}
/**
* @param value {@link #userTaskContext} (The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources.)
*/
public GuidanceRequest setUserTaskContext(CodeableConcept value) {
this.userTaskContext = value;
return this;
}
/**
* @return {@link #receivingOrganization} (The organization that will receive the response.)
*/
public Reference getReceivingOrganization() {
if (this.receivingOrganization == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.receivingOrganization");
else if (Configuration.doAutoCreate())
this.receivingOrganization = new Reference(); // cc
return this.receivingOrganization;
}
public boolean hasReceivingOrganization() {
return this.receivingOrganization != null && !this.receivingOrganization.isEmpty();
}
/**
* @param value {@link #receivingOrganization} (The organization that will receive the response.)
*/
public GuidanceRequest setReceivingOrganization(Reference value) {
this.receivingOrganization = value;
return this;
}
/**
* @return {@link #receivingOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization that will receive the response.)
*/
public Organization getReceivingOrganizationTarget() {
if (this.receivingOrganizationTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.receivingOrganization");
else if (Configuration.doAutoCreate())
this.receivingOrganizationTarget = new Organization(); // aa
return this.receivingOrganizationTarget;
}
/**
* @param value {@link #receivingOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization that will receive the response.)
*/
public GuidanceRequest setReceivingOrganizationTarget(Organization value) {
this.receivingOrganizationTarget = value;
return this;
}
/**
* @return {@link #receivingPerson} (The person in the receiving organization that will receive the response.)
*/
public Reference getReceivingPerson() {
if (this.receivingPerson == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.receivingPerson");
else if (Configuration.doAutoCreate())
this.receivingPerson = new Reference(); // cc
return this.receivingPerson;
}
public boolean hasReceivingPerson() {
return this.receivingPerson != null && !this.receivingPerson.isEmpty();
}
/**
* @param value {@link #receivingPerson} (The person in the receiving organization that will receive the response.)
*/
public GuidanceRequest setReceivingPerson(Reference value) {
this.receivingPerson = value;
return this;
}
/**
* @return {@link #receivingPerson} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person in the receiving organization that will receive the response.)
*/
public Resource getReceivingPersonTarget() {
return this.receivingPersonTarget;
}
/**
* @param value {@link #receivingPerson} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person in the receiving organization that will receive the response.)
*/
public GuidanceRequest setReceivingPersonTarget(Resource value) {
this.receivingPersonTarget = value;
return this;
}
/**
* @return {@link #recipientType} (The type of individual that will consume the response content. This may be different from the requesting user type (e.g. if a clinician is getting disease management guidance for provision to a patient). E.g. patient, healthcare provider or specific type of healthcare provider (physician, nurse, etc.).)
*/
public CodeableConcept getRecipientType() {
if (this.recipientType == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.recipientType");
else if (Configuration.doAutoCreate())
this.recipientType = new CodeableConcept(); // cc
return this.recipientType;
}
public boolean hasRecipientType() {
return this.recipientType != null && !this.recipientType.isEmpty();
}
/**
* @param value {@link #recipientType} (The type of individual that will consume the response content. This may be different from the requesting user type (e.g. if a clinician is getting disease management guidance for provision to a patient). E.g. patient, healthcare provider or specific type of healthcare provider (physician, nurse, etc.).)
*/
public GuidanceRequest setRecipientType(CodeableConcept value) {
this.recipientType = value;
return this;
}
/**
* @return {@link #recipientLanguage} (Preferred language of the person that will consume the content.)
*/
public CodeableConcept getRecipientLanguage() {
if (this.recipientLanguage == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.recipientLanguage");
else if (Configuration.doAutoCreate())
this.recipientLanguage = new CodeableConcept(); // cc
return this.recipientLanguage;
}
public boolean hasRecipientLanguage() {
return this.recipientLanguage != null && !this.recipientLanguage.isEmpty();
}
/**
* @param value {@link #recipientLanguage} (Preferred language of the person that will consume the content.)
*/
public GuidanceRequest setRecipientLanguage(CodeableConcept value) {
this.recipientLanguage = value;
return this;
}
/**
* @return {@link #encounterClass} (The class of encounter (inpatient, outpatient, etc).)
*/
public CodeableConcept getEncounterClass() {
if (this.encounterClass == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.encounterClass");
else if (Configuration.doAutoCreate())
this.encounterClass = new CodeableConcept(); // cc
return this.encounterClass;
}
public boolean hasEncounterClass() {
return this.encounterClass != null && !this.encounterClass.isEmpty();
}
/**
* @param value {@link #encounterClass} (The class of encounter (inpatient, outpatient, etc).)
*/
public GuidanceRequest setEncounterClass(CodeableConcept value) {
this.encounterClass = value;
return this;
}
/**
* @return {@link #encounterType} (The type of the encounter.)
*/
public CodeableConcept getEncounterType() {
if (this.encounterType == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create GuidanceRequest.encounterType");
else if (Configuration.doAutoCreate())
this.encounterType = new CodeableConcept(); // cc
return this.encounterType;
}
public boolean hasEncounterType() {
return this.encounterType != null && !this.encounterType.isEmpty();
}
/**
* @param value {@link #encounterType} (The type of the encounter.)
*/
public GuidanceRequest setEncounterType(CodeableConcept value) {
this.encounterType = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("module", "Reference(DecisionSupportRule|DecisionSupportServiceModule)", "A reference to a knowledge module involved in an interaction.", 0, java.lang.Integer.MAX_VALUE, module));
childrenList.add(new Property("dateTime", "dateTime", "The date and time of the request, with respect to the initiator.", 0, java.lang.Integer.MAX_VALUE, dateTime));
childrenList.add(new Property("evaluateAtDateTime", "dateTime", "Indicates that the evaluation should be performed as though it was the given date and time. The most direct implication of this is that references to \"Now\" within the evaluation logic of the module should result in this value. In addition, wherever possible, the data accessed by the module should appear as though it was accessed at this time. The evaluateAtDateTime value may be any time in the past or future, enabling both retrospective and prospective scenarios. If no value is provided, the requestDateTime is assumed.", 0, java.lang.Integer.MAX_VALUE, evaluateAtDateTime));
childrenList.add(new Property("inputParameters", "Reference(Parameters)", "The input parameters for a request, if any. These parameters are used to provide patient-independent information to the evaluation. Patient-specific information is either accessed directly as part of the evaluation (because the evaluation engine and the patient-data are co-located) or provided as part of the operation input in the form of resources.", 0, java.lang.Integer.MAX_VALUE, inputParameters));
childrenList.add(new Property("initiatingOrganization", "Reference(Organization)", "The organization initiating the request.", 0, java.lang.Integer.MAX_VALUE, initiatingOrganization));
childrenList.add(new Property("initiatingPerson", "Reference(Person|Patient|Practitioner|RelatedPerson)", "The person initiating the request.", 0, java.lang.Integer.MAX_VALUE, initiatingPerson));
childrenList.add(new Property("userType", "CodeableConcept", "The type of user initiating the request, e.g. patient, healthcare provider, or specific type of healthcare provider (physician, nurse, etc.).", 0, java.lang.Integer.MAX_VALUE, userType));
childrenList.add(new Property("userLanguage", "CodeableConcept", "Preferred language of the person using the system.", 0, java.lang.Integer.MAX_VALUE, userLanguage));
childrenList.add(new Property("userTaskContext", "CodeableConcept", "The task the system user is performing, e.g. laboratory results review, medication list review, etc. This information can be used to tailor decision support outputs, such as recommended information resources.", 0, java.lang.Integer.MAX_VALUE, userTaskContext));
childrenList.add(new Property("receivingOrganization", "Reference(Organization)", "The organization that will receive the response.", 0, java.lang.Integer.MAX_VALUE, receivingOrganization));
childrenList.add(new Property("receivingPerson", "Reference(Person|Patient|Practitioner|RelatedPerson)", "The person in the receiving organization that will receive the response.", 0, java.lang.Integer.MAX_VALUE, receivingPerson));
childrenList.add(new Property("recipientType", "CodeableConcept", "The type of individual that will consume the response content. This may be different from the requesting user type (e.g. if a clinician is getting disease management guidance for provision to a patient). E.g. patient, healthcare provider or specific type of healthcare provider (physician, nurse, etc.).", 0, java.lang.Integer.MAX_VALUE, recipientType));
childrenList.add(new Property("recipientLanguage", "CodeableConcept", "Preferred language of the person that will consume the content.", 0, java.lang.Integer.MAX_VALUE, recipientLanguage));
childrenList.add(new Property("encounterClass", "CodeableConcept", "The class of encounter (inpatient, outpatient, etc).", 0, java.lang.Integer.MAX_VALUE, encounterClass));
childrenList.add(new Property("encounterType", "CodeableConcept", "The type of the encounter.", 0, java.lang.Integer.MAX_VALUE, encounterType));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("module"))
this.module = castToReference(value); // Reference
else if (name.equals("dateTime"))
this.dateTime = castToDateTime(value); // DateTimeType
else if (name.equals("evaluateAtDateTime"))
this.evaluateAtDateTime = castToDateTime(value); // DateTimeType
else if (name.equals("inputParameters"))
this.inputParameters = castToReference(value); // Reference
else if (name.equals("initiatingOrganization"))
this.initiatingOrganization = castToReference(value); // Reference
else if (name.equals("initiatingPerson"))
this.initiatingPerson = castToReference(value); // Reference
else if (name.equals("userType"))
this.userType = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("userLanguage"))
this.userLanguage = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("userTaskContext"))
this.userTaskContext = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("receivingOrganization"))
this.receivingOrganization = castToReference(value); // Reference
else if (name.equals("receivingPerson"))
this.receivingPerson = castToReference(value); // Reference
else if (name.equals("recipientType"))
this.recipientType = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("recipientLanguage"))
this.recipientLanguage = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("encounterClass"))
this.encounterClass = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("encounterType"))
this.encounterType = castToCodeableConcept(value); // CodeableConcept
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("module")) {
this.module = new Reference();
return this.module;
}
else if (name.equals("dateTime")) {
throw new FHIRException("Cannot call addChild on a primitive type GuidanceRequest.dateTime");
}
else if (name.equals("evaluateAtDateTime")) {
throw new FHIRException("Cannot call addChild on a primitive type GuidanceRequest.evaluateAtDateTime");
}
else if (name.equals("inputParameters")) {
this.inputParameters = new Reference();
return this.inputParameters;
}
else if (name.equals("initiatingOrganization")) {
this.initiatingOrganization = new Reference();
return this.initiatingOrganization;
}
else if (name.equals("initiatingPerson")) {
this.initiatingPerson = new Reference();
return this.initiatingPerson;
}
else if (name.equals("userType")) {
this.userType = new CodeableConcept();
return this.userType;
}
else if (name.equals("userLanguage")) {
this.userLanguage = new CodeableConcept();
return this.userLanguage;
}
else if (name.equals("userTaskContext")) {
this.userTaskContext = new CodeableConcept();
return this.userTaskContext;
}
else if (name.equals("receivingOrganization")) {
this.receivingOrganization = new Reference();
return this.receivingOrganization;
}
else if (name.equals("receivingPerson")) {
this.receivingPerson = new Reference();
return this.receivingPerson;
}
else if (name.equals("recipientType")) {
this.recipientType = new CodeableConcept();
return this.recipientType;
}
else if (name.equals("recipientLanguage")) {
this.recipientLanguage = new CodeableConcept();
return this.recipientLanguage;
}
else if (name.equals("encounterClass")) {
this.encounterClass = new CodeableConcept();
return this.encounterClass;
}
else if (name.equals("encounterType")) {
this.encounterType = new CodeableConcept();
return this.encounterType;
}
else
return super.addChild(name);
}
public String fhirType() {
return "GuidanceRequest";
}
public GuidanceRequest copy() {
GuidanceRequest dst = new GuidanceRequest();
copyValues(dst);
dst.module = module == null ? null : module.copy();
dst.dateTime = dateTime == null ? null : dateTime.copy();
dst.evaluateAtDateTime = evaluateAtDateTime == null ? null : evaluateAtDateTime.copy();
dst.inputParameters = inputParameters == null ? null : inputParameters.copy();
dst.initiatingOrganization = initiatingOrganization == null ? null : initiatingOrganization.copy();
dst.initiatingPerson = initiatingPerson == null ? null : initiatingPerson.copy();
dst.userType = userType == null ? null : userType.copy();
dst.userLanguage = userLanguage == null ? null : userLanguage.copy();
dst.userTaskContext = userTaskContext == null ? null : userTaskContext.copy();
dst.receivingOrganization = receivingOrganization == null ? null : receivingOrganization.copy();
dst.receivingPerson = receivingPerson == null ? null : receivingPerson.copy();
dst.recipientType = recipientType == null ? null : recipientType.copy();
dst.recipientLanguage = recipientLanguage == null ? null : recipientLanguage.copy();
dst.encounterClass = encounterClass == null ? null : encounterClass.copy();
dst.encounterType = encounterType == null ? null : encounterType.copy();
return dst;
}
protected GuidanceRequest typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof GuidanceRequest))
return false;
GuidanceRequest o = (GuidanceRequest) other;
return compareDeep(module, o.module, true) && compareDeep(dateTime, o.dateTime, true) && compareDeep(evaluateAtDateTime, o.evaluateAtDateTime, true)
&& compareDeep(inputParameters, o.inputParameters, true) && compareDeep(initiatingOrganization, o.initiatingOrganization, true)
&& compareDeep(initiatingPerson, o.initiatingPerson, true) && compareDeep(userType, o.userType, true)
&& compareDeep(userLanguage, o.userLanguage, true) && compareDeep(userTaskContext, o.userTaskContext, true)
&& compareDeep(receivingOrganization, o.receivingOrganization, true) && compareDeep(receivingPerson, o.receivingPerson, true)
&& compareDeep(recipientType, o.recipientType, true) && compareDeep(recipientLanguage, o.recipientLanguage, true)
&& compareDeep(encounterClass, o.encounterClass, true) && compareDeep(encounterType, o.encounterType, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof GuidanceRequest))
return false;
GuidanceRequest o = (GuidanceRequest) other;
return compareValues(dateTime, o.dateTime, true) && compareValues(evaluateAtDateTime, o.evaluateAtDateTime, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (module == null || module.isEmpty()) && (dateTime == null || dateTime.isEmpty())
&& (evaluateAtDateTime == null || evaluateAtDateTime.isEmpty()) && (inputParameters == null || inputParameters.isEmpty())
&& (initiatingOrganization == null || initiatingOrganization.isEmpty()) && (initiatingPerson == null || initiatingPerson.isEmpty())
&& (userType == null || userType.isEmpty()) && (userLanguage == null || userLanguage.isEmpty())
&& (userTaskContext == null || userTaskContext.isEmpty()) && (receivingOrganization == null || receivingOrganization.isEmpty())
&& (receivingPerson == null || receivingPerson.isEmpty()) && (recipientType == null || recipientType.isEmpty())
&& (recipientLanguage == null || recipientLanguage.isEmpty()) && (encounterClass == null || encounterClass.isEmpty())
&& (encounterType == null || encounterType.isEmpty());
}
@Override
public ResourceType getResourceType() {
return ResourceType.GuidanceRequest;
}
}

View File

@ -0,0 +1,738 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A human's name with the ability to identify parts and usage.
*/
@DatatypeDef(name="HumanName")
public class HumanName extends Type implements ICompositeType {
public enum NameUse {
/**
* Known as/conventional/the one you normally use
*/
USUAL,
/**
* The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called "legal name".
*/
OFFICIAL,
/**
* A temporary name. Name.period can provide more detailed information. This may also be used for temporary names assigned at birth or in emergency situations.
*/
TEMP,
/**
* A name that is used to address the person in an informal manner, but is not part of their formal or usual name
*/
NICKNAME,
/**
* Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)
*/
ANONYMOUS,
/**
* This name is no longer in use (or was never correct, but retained for records)
*/
OLD,
/**
* A name used prior to marriage. Marriage naming customs vary greatly around the world. This name use is for use by applications that collect and store "maiden" names. Though the concept of maiden name is often gender specific, the use of this term is not gender specific. The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically.
*/
MAIDEN,
/**
* added to help the parsers
*/
NULL;
public static NameUse fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return USUAL;
if ("official".equals(codeString))
return OFFICIAL;
if ("temp".equals(codeString))
return TEMP;
if ("nickname".equals(codeString))
return NICKNAME;
if ("anonymous".equals(codeString))
return ANONYMOUS;
if ("old".equals(codeString))
return OLD;
if ("maiden".equals(codeString))
return MAIDEN;
throw new FHIRException("Unknown NameUse code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case USUAL: return "usual";
case OFFICIAL: return "official";
case TEMP: return "temp";
case NICKNAME: return "nickname";
case ANONYMOUS: return "anonymous";
case OLD: return "old";
case MAIDEN: return "maiden";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case USUAL: return "http://hl7.org/fhir/name-use";
case OFFICIAL: return "http://hl7.org/fhir/name-use";
case TEMP: return "http://hl7.org/fhir/name-use";
case NICKNAME: return "http://hl7.org/fhir/name-use";
case ANONYMOUS: return "http://hl7.org/fhir/name-use";
case OLD: return "http://hl7.org/fhir/name-use";
case MAIDEN: return "http://hl7.org/fhir/name-use";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case USUAL: return "Known as/conventional/the one you normally use";
case OFFICIAL: return "The formal name as registered in an official (government) registry, but which name might not be commonly used. May be called \"legal name\".";
case TEMP: return "A temporary name. Name.period can provide more detailed information. This may also be used for temporary names assigned at birth or in emergency situations.";
case NICKNAME: return "A name that is used to address the person in an informal manner, but is not part of their formal or usual name";
case ANONYMOUS: return "Anonymous assigned name, alias, or pseudonym (used to protect a person's identity for privacy reasons)";
case OLD: return "This name is no longer in use (or was never correct, but retained for records)";
case MAIDEN: return "A name used prior to marriage. Marriage naming customs vary greatly around the world. This name use is for use by applications that collect and store \"maiden\" names. Though the concept of maiden name is often gender specific, the use of this term is not gender specific. The use of this term does not imply any particular history for a person's name, nor should the maiden name be determined algorithmically.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case USUAL: return "Usual";
case OFFICIAL: return "Official";
case TEMP: return "Temp";
case NICKNAME: return "Nickname";
case ANONYMOUS: return "Anonymous";
case OLD: return "Old";
case MAIDEN: return "Maiden";
default: return "?";
}
}
}
public static class NameUseEnumFactory implements EnumFactory<NameUse> {
public NameUse fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return NameUse.USUAL;
if ("official".equals(codeString))
return NameUse.OFFICIAL;
if ("temp".equals(codeString))
return NameUse.TEMP;
if ("nickname".equals(codeString))
return NameUse.NICKNAME;
if ("anonymous".equals(codeString))
return NameUse.ANONYMOUS;
if ("old".equals(codeString))
return NameUse.OLD;
if ("maiden".equals(codeString))
return NameUse.MAIDEN;
throw new IllegalArgumentException("Unknown NameUse code '"+codeString+"'");
}
public Enumeration<NameUse> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.USUAL);
if ("official".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.OFFICIAL);
if ("temp".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.TEMP);
if ("nickname".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.NICKNAME);
if ("anonymous".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.ANONYMOUS);
if ("old".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.OLD);
if ("maiden".equals(codeString))
return new Enumeration<NameUse>(this, NameUse.MAIDEN);
throw new FHIRException("Unknown NameUse code '"+codeString+"'");
}
public String toCode(NameUse code) {
if (code == NameUse.USUAL)
return "usual";
if (code == NameUse.OFFICIAL)
return "official";
if (code == NameUse.TEMP)
return "temp";
if (code == NameUse.NICKNAME)
return "nickname";
if (code == NameUse.ANONYMOUS)
return "anonymous";
if (code == NameUse.OLD)
return "old";
if (code == NameUse.MAIDEN)
return "maiden";
return "?";
}
}
/**
* Identifies the purpose for this name.
*/
@Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="usual | official | temp | nickname | anonymous | old | maiden", formalDefinition="Identifies the purpose for this name." )
protected Enumeration<NameUse> use;
/**
* A full text representation of the name.
*/
@Child(name = "text", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Text representation of the full name", formalDefinition="A full text representation of the name." )
protected StringType text;
/**
* The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.
*/
@Child(name = "family", type = {StringType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Family name (often called 'Surname')", formalDefinition="The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father." )
protected List<StringType> family;
/**
* Given name.
*/
@Child(name = "given", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Given names (not always 'first'). Includes middle names", formalDefinition="Given name." )
protected List<StringType> given;
/**
* Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.
*/
@Child(name = "prefix", type = {StringType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Parts that come before the name", formalDefinition="Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name." )
protected List<StringType> prefix;
/**
* Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.
*/
@Child(name = "suffix", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Parts that come after the name", formalDefinition="Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name." )
protected List<StringType> suffix;
/**
* Indicates the period of time when this name was valid for the named person.
*/
@Child(name = "period", type = {Period.class}, order=6, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time period when name was/is in use", formalDefinition="Indicates the period of time when this name was valid for the named person." )
protected Period period;
private static final long serialVersionUID = -210174642L;
/*
* Constructor
*/
public HumanName() {
super();
}
/**
* @return {@link #use} (Identifies the purpose for this name.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public Enumeration<NameUse> getUseElement() {
if (this.use == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create HumanName.use");
else if (Configuration.doAutoCreate())
this.use = new Enumeration<NameUse>(new NameUseEnumFactory()); // bb
return this.use;
}
public boolean hasUseElement() {
return this.use != null && !this.use.isEmpty();
}
public boolean hasUse() {
return this.use != null && !this.use.isEmpty();
}
/**
* @param value {@link #use} (Identifies the purpose for this name.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public HumanName setUseElement(Enumeration<NameUse> value) {
this.use = value;
return this;
}
/**
* @return Identifies the purpose for this name.
*/
public NameUse getUse() {
return this.use == null ? null : this.use.getValue();
}
/**
* @param value Identifies the purpose for this name.
*/
public HumanName setUse(NameUse value) {
if (value == null)
this.use = null;
else {
if (this.use == null)
this.use = new Enumeration<NameUse>(new NameUseEnumFactory());
this.use.setValue(value);
}
return this;
}
/**
* @return {@link #text} (A full text representation of the name.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public StringType getTextElement() {
if (this.text == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create HumanName.text");
else if (Configuration.doAutoCreate())
this.text = new StringType(); // bb
return this.text;
}
public boolean hasTextElement() {
return this.text != null && !this.text.isEmpty();
}
public boolean hasText() {
return this.text != null && !this.text.isEmpty();
}
/**
* @param value {@link #text} (A full text representation of the name.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
*/
public HumanName setTextElement(StringType value) {
this.text = value;
return this;
}
/**
* @return A full text representation of the name.
*/
public String getText() {
return this.text == null ? null : this.text.getValue();
}
/**
* @param value A full text representation of the name.
*/
public HumanName setText(String value) {
if (Utilities.noString(value))
this.text = null;
else {
if (this.text == null)
this.text = new StringType();
this.text.setValue(value);
}
return this;
}
/**
* @return {@link #family} (The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.)
*/
public List<StringType> getFamily() {
if (this.family == null)
this.family = new ArrayList<StringType>();
return this.family;
}
public boolean hasFamily() {
if (this.family == null)
return false;
for (StringType item : this.family)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #family} (The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.)
*/
// syntactic sugar
public StringType addFamilyElement() {//2
StringType t = new StringType();
if (this.family == null)
this.family = new ArrayList<StringType>();
this.family.add(t);
return t;
}
/**
* @param value {@link #family} (The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.)
*/
public HumanName addFamily(String value) { //1
StringType t = new StringType();
t.setValue(value);
if (this.family == null)
this.family = new ArrayList<StringType>();
this.family.add(t);
return this;
}
/**
* @param value {@link #family} (The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.)
*/
public boolean hasFamily(String value) {
if (this.family == null)
return false;
for (StringType v : this.family)
if (v.equals(value)) // string
return true;
return false;
}
/**
* @return {@link #given} (Given name.)
*/
public List<StringType> getGiven() {
if (this.given == null)
this.given = new ArrayList<StringType>();
return this.given;
}
public boolean hasGiven() {
if (this.given == null)
return false;
for (StringType item : this.given)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #given} (Given name.)
*/
// syntactic sugar
public StringType addGivenElement() {//2
StringType t = new StringType();
if (this.given == null)
this.given = new ArrayList<StringType>();
this.given.add(t);
return t;
}
/**
* @param value {@link #given} (Given name.)
*/
public HumanName addGiven(String value) { //1
StringType t = new StringType();
t.setValue(value);
if (this.given == null)
this.given = new ArrayList<StringType>();
this.given.add(t);
return this;
}
/**
* @param value {@link #given} (Given name.)
*/
public boolean hasGiven(String value) {
if (this.given == null)
return false;
for (StringType v : this.given)
if (v.equals(value)) // string
return true;
return false;
}
/**
* @return {@link #prefix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.)
*/
public List<StringType> getPrefix() {
if (this.prefix == null)
this.prefix = new ArrayList<StringType>();
return this.prefix;
}
public boolean hasPrefix() {
if (this.prefix == null)
return false;
for (StringType item : this.prefix)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #prefix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.)
*/
// syntactic sugar
public StringType addPrefixElement() {//2
StringType t = new StringType();
if (this.prefix == null)
this.prefix = new ArrayList<StringType>();
this.prefix.add(t);
return t;
}
/**
* @param value {@link #prefix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.)
*/
public HumanName addPrefix(String value) { //1
StringType t = new StringType();
t.setValue(value);
if (this.prefix == null)
this.prefix = new ArrayList<StringType>();
this.prefix.add(t);
return this;
}
/**
* @param value {@link #prefix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.)
*/
public boolean hasPrefix(String value) {
if (this.prefix == null)
return false;
for (StringType v : this.prefix)
if (v.equals(value)) // string
return true;
return false;
}
/**
* @return {@link #suffix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.)
*/
public List<StringType> getSuffix() {
if (this.suffix == null)
this.suffix = new ArrayList<StringType>();
return this.suffix;
}
public boolean hasSuffix() {
if (this.suffix == null)
return false;
for (StringType item : this.suffix)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #suffix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.)
*/
// syntactic sugar
public StringType addSuffixElement() {//2
StringType t = new StringType();
if (this.suffix == null)
this.suffix = new ArrayList<StringType>();
this.suffix.add(t);
return t;
}
/**
* @param value {@link #suffix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.)
*/
public HumanName addSuffix(String value) { //1
StringType t = new StringType();
t.setValue(value);
if (this.suffix == null)
this.suffix = new ArrayList<StringType>();
this.suffix.add(t);
return this;
}
/**
* @param value {@link #suffix} (Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.)
*/
public boolean hasSuffix(String value) {
if (this.suffix == null)
return false;
for (StringType v : this.suffix)
if (v.equals(value)) // string
return true;
return false;
}
/**
* @return {@link #period} (Indicates the period of time when this name was valid for the named person.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create HumanName.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (Indicates the period of time when this name was valid for the named person.)
*/
public HumanName setPeriod(Period value) {
this.period = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("use", "code", "Identifies the purpose for this name.", 0, java.lang.Integer.MAX_VALUE, use));
childrenList.add(new Property("text", "string", "A full text representation of the name.", 0, java.lang.Integer.MAX_VALUE, text));
childrenList.add(new Property("family", "string", "The part of a name that links to the genealogy. In some cultures (e.g. Eritrea) the family name of a son is the first name of his father.", 0, java.lang.Integer.MAX_VALUE, family));
childrenList.add(new Property("given", "string", "Given name.", 0, java.lang.Integer.MAX_VALUE, given));
childrenList.add(new Property("prefix", "string", "Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the start of the name.", 0, java.lang.Integer.MAX_VALUE, prefix));
childrenList.add(new Property("suffix", "string", "Part of the name that is acquired as a title due to academic, legal, employment or nobility status, etc. and that appears at the end of the name.", 0, java.lang.Integer.MAX_VALUE, suffix));
childrenList.add(new Property("period", "Period", "Indicates the period of time when this name was valid for the named person.", 0, java.lang.Integer.MAX_VALUE, period));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("use"))
this.use = new NameUseEnumFactory().fromType(value); // Enumeration<NameUse>
else if (name.equals("text"))
this.text = castToString(value); // StringType
else if (name.equals("family"))
this.getFamily().add(castToString(value));
else if (name.equals("given"))
this.getGiven().add(castToString(value));
else if (name.equals("prefix"))
this.getPrefix().add(castToString(value));
else if (name.equals("suffix"))
this.getSuffix().add(castToString(value));
else if (name.equals("period"))
this.period = castToPeriod(value); // Period
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("use")) {
throw new FHIRException("Cannot call addChild on a primitive type HumanName.use");
}
else if (name.equals("text")) {
throw new FHIRException("Cannot call addChild on a primitive type HumanName.text");
}
else if (name.equals("family")) {
throw new FHIRException("Cannot call addChild on a primitive type HumanName.family");
}
else if (name.equals("given")) {
throw new FHIRException("Cannot call addChild on a primitive type HumanName.given");
}
else if (name.equals("prefix")) {
throw new FHIRException("Cannot call addChild on a primitive type HumanName.prefix");
}
else if (name.equals("suffix")) {
throw new FHIRException("Cannot call addChild on a primitive type HumanName.suffix");
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else
return super.addChild(name);
}
public String fhirType() {
return "HumanName";
}
public HumanName copy() {
HumanName dst = new HumanName();
copyValues(dst);
dst.use = use == null ? null : use.copy();
dst.text = text == null ? null : text.copy();
if (family != null) {
dst.family = new ArrayList<StringType>();
for (StringType i : family)
dst.family.add(i.copy());
};
if (given != null) {
dst.given = new ArrayList<StringType>();
for (StringType i : given)
dst.given.add(i.copy());
};
if (prefix != null) {
dst.prefix = new ArrayList<StringType>();
for (StringType i : prefix)
dst.prefix.add(i.copy());
};
if (suffix != null) {
dst.suffix = new ArrayList<StringType>();
for (StringType i : suffix)
dst.suffix.add(i.copy());
};
dst.period = period == null ? null : period.copy();
return dst;
}
protected HumanName typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof HumanName))
return false;
HumanName o = (HumanName) other;
return compareDeep(use, o.use, true) && compareDeep(text, o.text, true) && compareDeep(family, o.family, true)
&& compareDeep(given, o.given, true) && compareDeep(prefix, o.prefix, true) && compareDeep(suffix, o.suffix, true)
&& compareDeep(period, o.period, true);
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof HumanName))
return false;
HumanName o = (HumanName) other;
return compareValues(use, o.use, true) && compareValues(text, o.text, true) && compareValues(family, o.family, true)
&& compareValues(given, o.given, true) && compareValues(prefix, o.prefix, true) && compareValues(suffix, o.suffix, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (use == null || use.isEmpty()) && (text == null || text.isEmpty())
&& (family == null || family.isEmpty()) && (given == null || given.isEmpty()) && (prefix == null || prefix.isEmpty())
&& (suffix == null || suffix.isEmpty()) && (period == null || period.isEmpty());
}
}

View File

@ -0,0 +1,740 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.math.BigDecimal;
import java.util.UUID;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* This class represents the logical identity for a resource, or as much of that
* identity is known. In FHIR, every resource must have a "logical ID" which is
* defined by the FHIR specification as:
* <p>
* <code>A whole number in the range 0 to 2^64-1 (optionally represented in hex),
* a uuid, an oid, or any other combination of lowercase letters, numerals, "-"
* and ".", with a length limit of 36 characters</code>
* </p>
* <p>
* This class contains that logical ID, and can optionally also contain a
* relative or absolute URL representing the resource identity. For example, the
* following are all valid values for IdType, and all might represent the same
* resource:
* </p>
* <ul>
* <li><code>123</code> (just a resource's ID)</li>
* <li><code>Patient/123</code> (a relative identity)</li>
* <li><code>http://example.com/Patient/123 (an absolute identity)</code></li>
* <li>
* <code>http://example.com/Patient/123/_history/1 (an absolute identity with a version id)</code>
* </li>
* <li>
* <code>Patient/123/_history/1 (a relative identity with a version id)</code>
* </li>
* </ul>
* <p>
* In most situations, you only need to populate the resource's ID (e.g.
* <code>123</code>) in resources you are constructing and the encoder will
* infer the rest from the context in which the object is being used. On the
* other hand, the parser will always try to populate the complete absolute
* identity on objects it creates as a convenience.
* </p>
* <p>
* Regex for ID: [a-z0-9\-\.]{1,36}
* </p>
*/
@DatatypeDef(name = "id", profileOf=StringType.class)
public final class IdType extends UriType implements IPrimitiveType<String>, IIdType {
/**
* This is the maximum length for the ID
*/
public static final int MAX_LENGTH = 64; // maximum length
private static final long serialVersionUID = 2L;
private String myBaseUrl;
private boolean myHaveComponentParts;
private String myResourceType;
private String myUnqualifiedId;
private String myUnqualifiedVersionId;
/**
* Create a new empty ID
*/
public IdType() {
super();
}
/**
* Create a new ID, using a BigDecimal input. Uses
* {@link BigDecimal#toPlainString()} to generate the string representation.
*/
public IdType(BigDecimal thePid) {
if (thePid != null) {
setValue(toPlainStringWithNpeThrowIfNeeded(thePid));
} else {
setValue(null);
}
}
/**
* Create a new ID using a long
*/
public IdType(long theId) {
setValue(Long.toString(theId));
}
/**
* Create a new ID using a string. This String may contain a simple ID (e.g.
* "1234") or it may contain a complete URL
* (http://example.com/fhir/Patient/1234).
*
* <p>
* <b>Description</b>: A whole number in the range 0 to 2^64-1 (optionally
* represented in hex), a uuid, an oid, or any other combination of lowercase
* letters, numerals, "-" and ".", with a length limit of 36 characters.
* </p>
* <p>
* regex: [a-z0-9\-\.]{1,36}
* </p>
*/
public IdType(String theValue) {
setValue(theValue);
}
/**
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* @param theIdPart
* The ID (e.g. "123")
*/
public IdType(String theResourceType, BigDecimal theIdPart) {
this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart));
}
/**
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* @param theIdPart
* The ID (e.g. "123")
*/
public IdType(String theResourceType, Long theIdPart) {
this(theResourceType, toPlainStringWithNpeThrowIfNeeded(theIdPart));
}
/**
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* @param theId
* The ID (e.g. "123")
*/
public IdType(String theResourceType, String theId) {
this(theResourceType, theId, null);
}
/**
* Constructor
*
* @param theResourceType
* The resource type (e.g. "Patient")
* @param theId
* The ID (e.g. "123")
* @param theVersionId
* The version ID ("e.g. "456")
*/
public IdType(String theResourceType, String theId, String theVersionId) {
this(null, theResourceType, theId, theVersionId);
}
/**
* Constructor
*
* @param theBaseUrl
* The server base URL (e.g. "http://example.com/fhir")
* @param theResourceType
* The resource type (e.g. "Patient")
* @param theId
* The ID (e.g. "123")
* @param theVersionId
* The version ID ("e.g. "456")
*/
public IdType(String theBaseUrl, String theResourceType, String theId, String theVersionId) {
myBaseUrl = theBaseUrl;
myResourceType = theResourceType;
myUnqualifiedId = theId;
myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionId, null);
myHaveComponentParts = true;
}
/**
* Creates an ID based on a given URL
*/
public IdType(UriType theUrl) {
setValue(theUrl.getValueAsString());
}
public void applyTo(IBaseResource theResouce) {
if (theResouce == null) {
throw new NullPointerException("theResource can not be null");
} else {
theResouce.setId(new IdType(getValue()));
}
}
/**
* @deprecated Use {@link #getIdPartAsBigDecimal()} instead (this method was
* deprocated because its name is ambiguous)
*/
@Deprecated
public BigDecimal asBigDecimal() {
return getIdPartAsBigDecimal();
}
@Override
public IdType copy() {
return new IdType(getValue());
}
private String determineLocalPrefix(String theValue) {
if (theValue == null || theValue.isEmpty()) {
return null;
}
if (theValue.startsWith("#")) {
return "#";
}
int lastPrefix = -1;
for (int i = 0; i < theValue.length(); i++) {
char nextChar = theValue.charAt(i);
if (nextChar == ':') {
lastPrefix = i;
} else if (!Character.isLetter(nextChar) || !Character.isLowerCase(nextChar)) {
break;
}
}
if (lastPrefix != -1) {
String candidate = theValue.substring(0, lastPrefix + 1);
if (candidate.startsWith("cid:") || candidate.startsWith("urn:")) {
return candidate;
} else {
return null;
}
} else {
return null;
}
}
@Override
public boolean equals(Object theArg0) {
if (!(theArg0 instanceof IdType)) {
return false;
}
IdType id = (IdType) theArg0;
return StringUtils.equals(getValueAsString(), id.getValueAsString());
}
/**
* Returns true if this IdType matches the given IdType in terms of resource
* type and ID, but ignores the URL base
*/
@SuppressWarnings("deprecation")
public boolean equalsIgnoreBase(IdType theId) {
if (theId == null) {
return false;
}
if (theId.isEmpty()) {
return isEmpty();
}
return ObjectUtils.equals(getResourceType(), theId.getResourceType())
&& ObjectUtils.equals(getIdPart(), theId.getIdPart())
&& ObjectUtils.equals(getVersionIdPart(), theId.getVersionIdPart());
}
/**
* Returns the portion of this resource ID which corresponds to the server
* base URL. For example given the resource ID
* <code>http://example.com/fhir/Patient/123</code> the base URL would be
* <code>http://example.com/fhir</code>.
* <p>
* This method may return null if the ID contains no base (e.g. "Patient/123")
* </p>
*/
@Override
public String getBaseUrl() {
return myBaseUrl;
}
/**
* Returns only the logical ID part of this ID. For example, given the ID
* "http://example,.com/fhir/Patient/123/_history/456", this method would
* return "123".
*/
@Override
public String getIdPart() {
return myUnqualifiedId;
}
/**
* Returns the unqualified portion of this ID as a big decimal, or
* <code>null</code> if the value is null
*
* @throws NumberFormatException
* If the value is not a valid BigDecimal
*/
public BigDecimal getIdPartAsBigDecimal() {
String val = getIdPart();
if (isBlank(val)) {
return null;
}
return new BigDecimal(val);
}
/**
* Returns the unqualified portion of this ID as a {@link Long}, or
* <code>null</code> if the value is null
*
* @throws NumberFormatException
* If the value is not a valid Long
*/
@Override
public Long getIdPartAsLong() {
String val = getIdPart();
if (isBlank(val)) {
return null;
}
return Long.parseLong(val);
}
@Override
public String getResourceType() {
return myResourceType;
}
/**
* Returns the value of this ID. Note that this value may be a fully qualified
* URL, a relative/partial URL, or a simple ID. Use {@link #getIdPart()} to
* get just the ID portion.
*
* @see #getIdPart()
*/
@Override
public String getValue() {
String retVal = super.getValue();
if (retVal == null && myHaveComponentParts) {
if (determineLocalPrefix(myBaseUrl) != null && myResourceType == null && myUnqualifiedVersionId == null) {
return myBaseUrl + myUnqualifiedId;
}
StringBuilder b = new StringBuilder();
if (isNotBlank(myBaseUrl)) {
b.append(myBaseUrl);
if (myBaseUrl.charAt(myBaseUrl.length() - 1) != '/') {
b.append('/');
}
}
if (isNotBlank(myResourceType)) {
b.append(myResourceType);
}
if (b.length() > 0) {
b.append('/');
}
b.append(myUnqualifiedId);
if (isNotBlank(myUnqualifiedVersionId)) {
b.append('/');
b.append("_history");
b.append('/');
b.append(myUnqualifiedVersionId);
}
retVal = b.toString();
super.setValue(retVal);
}
return retVal;
}
@Override
public String getValueAsString() {
return getValue();
}
@Override
public String getVersionIdPart() {
return myUnqualifiedVersionId;
}
public Long getVersionIdPartAsLong() {
if (!hasVersionIdPart()) {
return null;
} else {
return Long.parseLong(getVersionIdPart());
}
}
/**
* Returns true if this ID has a base url
*
* @see #getBaseUrl()
*/
public boolean hasBaseUrl() {
return isNotBlank(myBaseUrl);
}
@Override
public int hashCode() {
HashCodeBuilder b = new HashCodeBuilder();
b.append(getValueAsString());
return b.toHashCode();
}
@Override
public boolean hasIdPart() {
return isNotBlank(getIdPart());
}
@Override
public boolean hasResourceType() {
return isNotBlank(myResourceType);
}
@Override
public boolean hasVersionIdPart() {
return isNotBlank(getVersionIdPart());
}
/**
* Returns <code>true</code> if this ID contains an absolute URL (in other
* words, a URL starting with "http://" or "https://"
*/
@Override
public boolean isAbsolute() {
if (StringUtils.isBlank(getValue())) {
return false;
}
return isUrlAbsolute(getValue());
}
@Override
public boolean isEmpty() {
return isBlank(getValue());
}
@Override
public boolean isIdPartValid() {
String id = getIdPart();
if (StringUtils.isBlank(id)) {
return false;
}
if (id.length() > 64) {
return false;
}
for (int i = 0; i < id.length(); i++) {
char nextChar = id.charAt(i);
if (nextChar >= 'a' && nextChar <= 'z') {
continue;
}
if (nextChar >= 'A' && nextChar <= 'Z') {
continue;
}
if (nextChar >= '0' && nextChar <= '9') {
continue;
}
if (nextChar == '-' || nextChar == '.') {
continue;
}
return false;
}
return true;
}
/**
* Returns <code>true</code> if the unqualified ID is a valid {@link Long}
* value (in other words, it consists only of digits)
*/
@Override
public boolean isIdPartValidLong() {
return isValidLong(getIdPart());
}
/**
* Returns <code>true</code> if the ID is a local reference (in other words,
* it begins with the '#' character)
*/
@Override
public boolean isLocal() {
return "#".equals(myBaseUrl);
}
@Override
public boolean isVersionIdPartValidLong() {
return isValidLong(getVersionIdPart());
}
/**
* Set the value
*
* <p>
* <b>Description</b>: A whole number in the range 0 to 2^64-1 (optionally
* represented in hex), a uuid, an oid, or any other combination of lowercase
* letters, numerals, "-" and ".", with a length limit of 36 characters.
* </p>
* <p>
* regex: [a-z0-9\-\.]{1,36}
* </p>
*/
@Override
public IdType setValue(String theValue) {
// TODO: add validation
super.setValue(theValue);
myHaveComponentParts = false;
String localPrefix = determineLocalPrefix(theValue);
if (StringUtils.isBlank(theValue)) {
myBaseUrl = null;
super.setValue(null);
myUnqualifiedId = null;
myUnqualifiedVersionId = null;
myResourceType = null;
} else if (theValue.charAt(0) == '#' && theValue.length() > 1) {
super.setValue(theValue);
myBaseUrl = "#";
myUnqualifiedId = theValue.substring(1);
myUnqualifiedVersionId = null;
myResourceType = null;
myHaveComponentParts = true;
} else if (localPrefix != null) {
myBaseUrl = localPrefix;
myUnqualifiedId = theValue.substring(localPrefix.length());
} else {
int vidIndex = theValue.indexOf("/_history/");
int idIndex;
if (vidIndex != -1) {
myUnqualifiedVersionId = theValue.substring(vidIndex + "/_history/".length());
idIndex = theValue.lastIndexOf('/', vidIndex - 1);
myUnqualifiedId = theValue.substring(idIndex + 1, vidIndex);
} else {
idIndex = theValue.lastIndexOf('/');
myUnqualifiedId = theValue.substring(idIndex + 1);
myUnqualifiedVersionId = null;
}
myBaseUrl = null;
if (idIndex <= 0) {
myResourceType = null;
} else {
int typeIndex = theValue.lastIndexOf('/', idIndex - 1);
if (typeIndex == -1) {
myResourceType = theValue.substring(0, idIndex);
} else {
myResourceType = theValue.substring(typeIndex + 1, idIndex);
if (typeIndex > 4) {
myBaseUrl = theValue.substring(0, typeIndex);
}
}
}
}
return this;
}
/**
* Set the value
*
* <p>
* <b>Description</b>: A whole number in the range 0 to 2^64-1 (optionally
* represented in hex), a uuid, an oid, or any other combination of lowercase
* letters, numerals, "-" and ".", with a length limit of 36 characters.
* </p>
* <p>
* regex: [a-z0-9\-\.]{1,36}
* </p>
*/
@Override
public void setValueAsString(String theValue) {
setValue(theValue);
}
@Override
public String toString() {
return getValue();
}
/**
* Returns a new IdType containing this IdType's values but with no server
* base URL if one is present in this IdType. For example, if this IdType
* contains the ID "http://foo/Patient/1", this method will return a new
* IdType containing ID "Patient/1".
*/
@Override
public IdType toUnqualified() {
return new IdType(getResourceType(), getIdPart(), getVersionIdPart());
}
@Override
public IdType toUnqualifiedVersionless() {
return new IdType(getResourceType(), getIdPart());
}
@Override
public IdType toVersionless() {
return new IdType(getBaseUrl(), getResourceType(), getIdPart(), null);
}
@Override
public IdType withResourceType(String theResourceName) {
return new IdType(theResourceName, getIdPart(), getVersionIdPart());
}
/**
* Returns a view of this ID as a fully qualified URL, given a server base and
* resource name (which will only be used if the ID does not already contain
* those respective parts). Essentially, because IdType can contain either a
* complete URL or a partial one (or even jut a simple ID), this method may be
* used to translate into a complete URL.
*
* @param theServerBase
* The server base (e.g. "http://example.com/fhir")
* @param theResourceType
* The resource name (e.g. "Patient")
* @return A fully qualified URL for this ID (e.g.
* "http://example.com/fhir/Patient/1")
*/
@Override
public IdType withServerBase(String theServerBase, String theResourceType) {
return new IdType(theServerBase, theResourceType, getIdPart(), getVersionIdPart());
}
/**
* Creates a new instance of this ID which is identical, but refers to the
* specific version of this resource ID noted by theVersion.
*
* @param theVersion
* The actual version string, e.g. "1"
* @return A new instance of IdType which is identical, but refers to the
* specific version of this resource ID noted by theVersion.
*/
public IdType withVersion(String theVersion) {
Validate.notBlank(theVersion, "Version may not be null or empty");
String existingValue = getValue();
int i = existingValue.indexOf("_history");
String value;
if (i > 1) {
value = existingValue.substring(0, i - 1);
} else {
value = existingValue;
}
return new IdType(value + '/' + "_history" + '/' + theVersion);
}
private static boolean isUrlAbsolute(String theValue) {
String value = theValue.toLowerCase();
return value.startsWith("http://") || value.startsWith("https://");
}
private static boolean isValidLong(String id) {
if (StringUtils.isBlank(id)) {
return false;
}
for (int i = 0; i < id.length(); i++) {
if (Character.isDigit(id.charAt(i)) == false) {
return false;
}
}
return true;
}
/**
* Construct a new ID with with form "urn:uuid:[UUID]" where [UUID] is a new,
* randomly created UUID generated by {@link UUID#randomUUID()}
*/
public static IdType newRandomUuid() {
return new IdType("urn:uuid:" + UUID.randomUUID().toString());
}
/**
* Retrieves the ID from the given resource instance
*/
public static IdType of(IBaseResource theResouce) {
if (theResouce == null) {
throw new NullPointerException("theResource can not be null");
} else {
IIdType retVal = theResouce.getIdElement();
if (retVal == null) {
return null;
} else if (retVal instanceof IdType) {
return (IdType) retVal;
} else {
return new IdType(retVal.getValue());
}
}
}
private static String toPlainStringWithNpeThrowIfNeeded(BigDecimal theIdPart) {
if (theIdPart == null) {
throw new NullPointerException("BigDecimal ID can not be null");
}
return theIdPart.toPlainString();
}
private static String toPlainStringWithNpeThrowIfNeeded(Long theIdPart) {
if (theIdPart == null) {
throw new NullPointerException("Long ID can not be null");
}
return theIdPart.toString();
}
public String fhirType() {
return "id";
}
}

View File

@ -0,0 +1,568 @@
package org.hl7.fhir.dstu21.model;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
// Generated on Sun, Dec 6, 2015 19:25-0500 for FHIR v1.1.0
import java.util.*;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.dstu21.model.Enumerations.*;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Block;
import org.hl7.fhir.instance.model.api.*;
import org.hl7.fhir.exceptions.FHIRException;
/**
* A technical identifier - identifies some entity uniquely and unambiguously.
*/
@DatatypeDef(name="Identifier")
public class Identifier extends Type implements ICompositeType {
public enum IdentifierUse {
/**
* The identifier recommended for display and use in real-world interactions.
*/
USUAL,
/**
* The identifier considered to be most trusted for the identification of this item.
*/
OFFICIAL,
/**
* A temporary identifier.
*/
TEMP,
/**
* An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.
*/
SECONDARY,
/**
* added to help the parsers
*/
NULL;
public static IdentifierUse fromCode(String codeString) throws FHIRException {
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return USUAL;
if ("official".equals(codeString))
return OFFICIAL;
if ("temp".equals(codeString))
return TEMP;
if ("secondary".equals(codeString))
return SECONDARY;
throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case USUAL: return "usual";
case OFFICIAL: return "official";
case TEMP: return "temp";
case SECONDARY: return "secondary";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case USUAL: return "http://hl7.org/fhir/identifier-use";
case OFFICIAL: return "http://hl7.org/fhir/identifier-use";
case TEMP: return "http://hl7.org/fhir/identifier-use";
case SECONDARY: return "http://hl7.org/fhir/identifier-use";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case USUAL: return "The identifier recommended for display and use in real-world interactions.";
case OFFICIAL: return "The identifier considered to be most trusted for the identification of this item.";
case TEMP: return "A temporary identifier.";
case SECONDARY: return "An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case USUAL: return "Usual";
case OFFICIAL: return "Official";
case TEMP: return "Temp";
case SECONDARY: return "Secondary";
default: return "?";
}
}
}
public static class IdentifierUseEnumFactory implements EnumFactory<IdentifierUse> {
public IdentifierUse fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return IdentifierUse.USUAL;
if ("official".equals(codeString))
return IdentifierUse.OFFICIAL;
if ("temp".equals(codeString))
return IdentifierUse.TEMP;
if ("secondary".equals(codeString))
return IdentifierUse.SECONDARY;
throw new IllegalArgumentException("Unknown IdentifierUse code '"+codeString+"'");
}
public Enumeration<IdentifierUse> fromType(Base code) throws FHIRException {
if (code == null || code.isEmpty())
return null;
String codeString = ((PrimitiveType) code).asStringValue();
if (codeString == null || "".equals(codeString))
return null;
if ("usual".equals(codeString))
return new Enumeration<IdentifierUse>(this, IdentifierUse.USUAL);
if ("official".equals(codeString))
return new Enumeration<IdentifierUse>(this, IdentifierUse.OFFICIAL);
if ("temp".equals(codeString))
return new Enumeration<IdentifierUse>(this, IdentifierUse.TEMP);
if ("secondary".equals(codeString))
return new Enumeration<IdentifierUse>(this, IdentifierUse.SECONDARY);
throw new FHIRException("Unknown IdentifierUse code '"+codeString+"'");
}
public String toCode(IdentifierUse code) {
if (code == IdentifierUse.USUAL)
return "usual";
if (code == IdentifierUse.OFFICIAL)
return "official";
if (code == IdentifierUse.TEMP)
return "temp";
if (code == IdentifierUse.SECONDARY)
return "secondary";
return "?";
}
}
/**
* The purpose of this identifier.
*/
@Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true)
@Description(shortDefinition="usual | official | temp | secondary (If known)", formalDefinition="The purpose of this identifier." )
protected Enumeration<IdentifierUse> use;
/**
* A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.
*/
@Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Description of identifier", formalDefinition="A coded type for the identifier that can be used to determine which identifier to use for a specific purpose." )
protected CodeableConcept type;
/**
* Establishes the namespace in which set of possible id values is unique.
*/
@Child(name = "system", type = {UriType.class}, order=2, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="The namespace for the identifier", formalDefinition="Establishes the namespace in which set of possible id values is unique." )
protected UriType system;
/**
* The portion of the identifier typically displayed to the user and which is unique within the context of the system.
*/
@Child(name = "value", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="The value that is unique", formalDefinition="The portion of the identifier typically displayed to the user and which is unique within the context of the system." )
protected StringType value;
/**
* Time period during which identifier is/was valid for use.
*/
@Child(name = "period", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Time period when id is/was valid for use", formalDefinition="Time period during which identifier is/was valid for use." )
protected Period period;
/**
* Organization that issued/manages the identifier.
*/
@Child(name = "assigner", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Organization that issued id (may be just text)", formalDefinition="Organization that issued/manages the identifier." )
protected Reference assigner;
/**
* The actual object that is the target of the reference (Organization that issued/manages the identifier.)
*/
protected Organization assignerTarget;
private static final long serialVersionUID = -478840981L;
/*
* Constructor
*/
public Identifier() {
super();
}
/**
* @return {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public Enumeration<IdentifierUse> getUseElement() {
if (this.use == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.use");
else if (Configuration.doAutoCreate())
this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory()); // bb
return this.use;
}
public boolean hasUseElement() {
return this.use != null && !this.use.isEmpty();
}
public boolean hasUse() {
return this.use != null && !this.use.isEmpty();
}
/**
* @param value {@link #use} (The purpose of this identifier.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
*/
public Identifier setUseElement(Enumeration<IdentifierUse> value) {
this.use = value;
return this;
}
/**
* @return The purpose of this identifier.
*/
public IdentifierUse getUse() {
return this.use == null ? null : this.use.getValue();
}
/**
* @param value The purpose of this identifier.
*/
public Identifier setUse(IdentifierUse value) {
if (value == null)
this.use = null;
else {
if (this.use == null)
this.use = new Enumeration<IdentifierUse>(new IdentifierUseEnumFactory());
this.use.setValue(value);
}
return this;
}
/**
* @return {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
*/
public CodeableConcept getType() {
if (this.type == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.type");
else if (Configuration.doAutoCreate())
this.type = new CodeableConcept(); // cc
return this.type;
}
public boolean hasType() {
return this.type != null && !this.type.isEmpty();
}
/**
* @param value {@link #type} (A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.)
*/
public Identifier setType(CodeableConcept value) {
this.type = value;
return this;
}
/**
* @return {@link #system} (Establishes the namespace in which set of possible id values is unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public UriType getSystemElement() {
if (this.system == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.system");
else if (Configuration.doAutoCreate())
this.system = new UriType(); // bb
return this.system;
}
public boolean hasSystemElement() {
return this.system != null && !this.system.isEmpty();
}
public boolean hasSystem() {
return this.system != null && !this.system.isEmpty();
}
/**
* @param value {@link #system} (Establishes the namespace in which set of possible id values is unique.). This is the underlying object with id, value and extensions. The accessor "getSystem" gives direct access to the value
*/
public Identifier setSystemElement(UriType value) {
this.system = value;
return this;
}
/**
* @return Establishes the namespace in which set of possible id values is unique.
*/
public String getSystem() {
return this.system == null ? null : this.system.getValue();
}
/**
* @param value Establishes the namespace in which set of possible id values is unique.
*/
public Identifier setSystem(String value) {
if (Utilities.noString(value))
this.system = null;
else {
if (this.system == null)
this.system = new UriType();
this.system.setValue(value);
}
return this;
}
/**
* @return {@link #value} (The portion of the identifier typically displayed to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
*/
public StringType getValueElement() {
if (this.value == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.value");
else if (Configuration.doAutoCreate())
this.value = new StringType(); // bb
return this.value;
}
public boolean hasValueElement() {
return this.value != null && !this.value.isEmpty();
}
public boolean hasValue() {
return this.value != null && !this.value.isEmpty();
}
/**
* @param value {@link #value} (The portion of the identifier typically displayed to the user and which is unique within the context of the system.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
*/
public Identifier setValueElement(StringType value) {
this.value = value;
return this;
}
/**
* @return The portion of the identifier typically displayed to the user and which is unique within the context of the system.
*/
public String getValue() {
return this.value == null ? null : this.value.getValue();
}
/**
* @param value The portion of the identifier typically displayed to the user and which is unique within the context of the system.
*/
public Identifier setValue(String value) {
if (Utilities.noString(value))
this.value = null;
else {
if (this.value == null)
this.value = new StringType();
this.value.setValue(value);
}
return this;
}
/**
* @return {@link #period} (Time period during which identifier is/was valid for use.)
*/
public Period getPeriod() {
if (this.period == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.period");
else if (Configuration.doAutoCreate())
this.period = new Period(); // cc
return this.period;
}
public boolean hasPeriod() {
return this.period != null && !this.period.isEmpty();
}
/**
* @param value {@link #period} (Time period during which identifier is/was valid for use.)
*/
public Identifier setPeriod(Period value) {
this.period = value;
return this;
}
/**
* @return {@link #assigner} (Organization that issued/manages the identifier.)
*/
public Reference getAssigner() {
if (this.assigner == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.assigner");
else if (Configuration.doAutoCreate())
this.assigner = new Reference(); // cc
return this.assigner;
}
public boolean hasAssigner() {
return this.assigner != null && !this.assigner.isEmpty();
}
/**
* @param value {@link #assigner} (Organization that issued/manages the identifier.)
*/
public Identifier setAssigner(Reference value) {
this.assigner = value;
return this;
}
/**
* @return {@link #assigner} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Organization that issued/manages the identifier.)
*/
public Organization getAssignerTarget() {
if (this.assignerTarget == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create Identifier.assigner");
else if (Configuration.doAutoCreate())
this.assignerTarget = new Organization(); // aa
return this.assignerTarget;
}
/**
* @param value {@link #assigner} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Organization that issued/manages the identifier.)
*/
public Identifier setAssignerTarget(Organization value) {
this.assignerTarget = value;
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("use", "code", "The purpose of this identifier.", 0, java.lang.Integer.MAX_VALUE, use));
childrenList.add(new Property("type", "CodeableConcept", "A coded type for the identifier that can be used to determine which identifier to use for a specific purpose.", 0, java.lang.Integer.MAX_VALUE, type));
childrenList.add(new Property("system", "uri", "Establishes the namespace in which set of possible id values is unique.", 0, java.lang.Integer.MAX_VALUE, system));
childrenList.add(new Property("value", "string", "The portion of the identifier typically displayed to the user and which is unique within the context of the system.", 0, java.lang.Integer.MAX_VALUE, value));
childrenList.add(new Property("period", "Period", "Time period during which identifier is/was valid for use.", 0, java.lang.Integer.MAX_VALUE, period));
childrenList.add(new Property("assigner", "Reference(Organization)", "Organization that issued/manages the identifier.", 0, java.lang.Integer.MAX_VALUE, assigner));
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("use"))
this.use = new IdentifierUseEnumFactory().fromType(value); // Enumeration<IdentifierUse>
else if (name.equals("type"))
this.type = castToCodeableConcept(value); // CodeableConcept
else if (name.equals("system"))
this.system = castToUri(value); // UriType
else if (name.equals("value"))
this.value = castToString(value); // StringType
else if (name.equals("period"))
this.period = castToPeriod(value); // Period
else if (name.equals("assigner"))
this.assigner = castToReference(value); // Reference
else
super.setProperty(name, value);
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("use")) {
throw new FHIRException("Cannot call addChild on a primitive type Identifier.use");
}
else if (name.equals("type")) {
this.type = new CodeableConcept();
return this.type;
}
else if (name.equals("system")) {
throw new FHIRException("Cannot call addChild on a primitive type Identifier.system");
}
else if (name.equals("value")) {
throw new FHIRException("Cannot call addChild on a primitive type Identifier.value");
}
else if (name.equals("period")) {
this.period = new Period();
return this.period;
}
else if (name.equals("assigner")) {
this.assigner = new Reference();
return this.assigner;
}
else
return super.addChild(name);
}
public String fhirType() {
return "Identifier";
}
public Identifier copy() {
Identifier dst = new Identifier();
copyValues(dst);
dst.use = use == null ? null : use.copy();
dst.type = type == null ? null : type.copy();
dst.system = system == null ? null : system.copy();
dst.value = value == null ? null : value.copy();
dst.period = period == null ? null : period.copy();
dst.assigner = assigner == null ? null : assigner.copy();
return dst;
}
protected Identifier typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof Identifier))
return false;
Identifier o = (Identifier) other;
return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(system, o.system, true)
&& compareDeep(value, o.value, true) && compareDeep(period, o.period, true) && compareDeep(assigner, o.assigner, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof Identifier))
return false;
Identifier o = (Identifier) other;
return compareValues(use, o.use, true) && compareValues(system, o.system, true) && compareValues(value, o.value, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (use == null || use.isEmpty()) && (type == null || type.isEmpty())
&& (system == null || system.isEmpty()) && (value == null || value.isEmpty()) && (period == null || period.isEmpty())
&& (assigner == null || assigner.isEmpty());
}
}

View File

@ -0,0 +1,223 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
*/
package org.hl7.fhir.dstu21.model;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.util.zip.DataFormatException;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Represents a FHIR instant datatype. Valid precisions values for this type are:
* <ul>
* <li>{@link TemporalPrecisionEnum#SECOND}
* <li>{@link TemporalPrecisionEnum#MILLI}
* </ul>
*/
@DatatypeDef(name="instant")
public class InstantType extends BaseDateTimeType {
private static final long serialVersionUID = 3L;
/**
* The default precision for this type
*/
public static final TemporalPrecisionEnum DEFAULT_PRECISION = TemporalPrecisionEnum.MILLI;
/**
* Constructor which creates an InstantDt with <b>no timne value</b>. Note
* that unlike the default constructor for the Java {@link Date} or
* {@link Calendar} objects, this constructor does not initialize the object
* with the current time.
*
* @see #withCurrentTime() to create a new object that has been initialized
* with the current time.
*/
public InstantType() {
super();
}
/**
* Create a new DateTimeDt
*/
public InstantType(Calendar theCalendar) {
super(theCalendar.getTime(), DEFAULT_PRECISION, theCalendar.getTimeZone());
}
/**
* Create a new instance using the given date, precision level, and time zone
*
* @throws DataFormatException
* If the specified precision is not allowed for this type
*/
public InstantType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimezone) {
super(theDate, thePrecision, theTimezone);
}
/**
* Create a new DateTimeDt using an existing value. <b>Use this constructor with caution</b>,
* as it may create more precision than warranted (since for example it is possible to pass in
* a DateTime with only a year, and this constructor will convert to an InstantDt with
* milliseconds precision).
*/
public InstantType(BaseDateTimeType theDateTime) {
// Do not call super(foo) here, we don't want to trigger a DataFormatException
setValue(theDateTime.getValue());
setPrecision(DEFAULT_PRECISION);
setTimeZone(theDateTime.getTimeZone());
}
/**
* Create a new DateTimeDt with the given date/time and {@link TemporalPrecisionEnum#MILLI} precision
*/
public InstantType(Date theDate) {
super(theDate, DEFAULT_PRECISION, TimeZone.getDefault());
}
/**
* Constructor which accepts a date value and a precision value. Valid
* precisions values for this type are:
* <ul>
* <li>{@link TemporalPrecisionEnum#SECOND}
* <li>{@link TemporalPrecisionEnum#MILLI}
* </ul>
*/
public InstantType(Date theDate, TemporalPrecisionEnum thePrecision) {
setValue(theDate);
setPrecision(thePrecision);
setTimeZone(TimeZone.getDefault());
}
/**
* Create a new InstantDt from a string value
*
* @param theString
* The string representation of the string. Must be in a valid
* format according to the FHIR specification
* @throws DataFormatException
*/
public InstantType(String theString) {
super(theString);
}
/**
* Invokes {@link Date#after(Date)} on the contained Date against the given
* date
*
* @throws NullPointerException
* If the {@link #getValue() contained Date} is null
*/
public boolean after(Date theDate) {
return getValue().after(theDate);
}
/**
* Invokes {@link Date#before(Date)} on the contained Date against the given
* date
*
* @throws NullPointerException
* If the {@link #getValue() contained Date} is null
*/
public boolean before(Date theDate) {
return getValue().before(theDate);
}
/**
* Sets the value of this instant to the current time (from the system
* clock) and the local/default timezone (as retrieved using
* {@link TimeZone#getDefault()}. This TimeZone is generally obtained from
* the underlying OS.
*/
public void setToCurrentTimeInLocalTimeZone() {
setValue(new Date());
setTimeZone(TimeZone.getDefault());
}
@Override
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
switch (thePrecision) {
case SECOND:
case MILLI:
return true;
default:
return false;
}
}
/**
* Factory method which creates a new InstantDt with millisecond precision and initializes it with the
* current time and the system local timezone.
*/
public static InstantType withCurrentTime() {
return new InstantType(new Date(), TemporalPrecisionEnum.MILLI, TimeZone.getDefault());
}
/**
* Returns the default precision for this datatype
*
* @see #DEFAULT_PRECISION
*/
@Override
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
return DEFAULT_PRECISION;
}
@Override
public InstantType copy() {
return new InstantType(getValue());
}
/**
* Returns a new instance of DateTimeType with the current system time and MILLI precision and the system local time
* zone
*/
public static InstantType now() {
return new InstantType(new Date(), TemporalPrecisionEnum.MILLI, TimeZone.getDefault());
}
/**
* Creates a new instance by parsing an HL7 v3 format date time string
*/
public static InstantType parseV3(String theV3String) {
InstantType retVal = new InstantType();
retVal.setValueAsV3String(theV3String);
return retVal;
}
public String fhirType() {
return "instant";
}
}

View File

@ -0,0 +1,110 @@
/*
Copyright (c) 2011+, HL7, Inc
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/**
*
*/
package org.hl7.fhir.dstu21.model;
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* Primitive type "integer" in FHIR: A signed 32-bit integer
*/
@DatatypeDef(name = "integer")
public class IntegerType extends PrimitiveType<Integer> implements IBaseIntegerDatatype {
private static final long serialVersionUID = 3L;
/**
* Constructor
*/
public IntegerType() {
// nothing
}
/**
* Constructor
*/
public IntegerType(int theInteger) {
setValue(theInteger);
}
/**
* Constructor
*
* @param theIntegerAsString
* A string representation of an integer
* @throws IllegalArgumentException
* If the string is not a valid integer representation
*/
public IntegerType(String theIntegerAsString) {
setValueAsString(theIntegerAsString);
}
/**
* Constructor
*
* @param theValue The value
* @throws IllegalArgumentException If the value is too large to fit in a signed integer
*/
public IntegerType(Long theValue) {
if (theValue < java.lang.Integer.MIN_VALUE || theValue > java.lang.Integer.MAX_VALUE) {
throw new IllegalArgumentException
(theValue + " cannot be cast to int without changing its value.");
}
if(theValue!=null) {
setValue((int)theValue.longValue());
}
}
@Override
protected Integer parse(String theValue) {
try {
return Integer.parseInt(theValue);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(e);
}
}
@Override
protected String encode(Integer theValue) {
return Integer.toString(theValue);
}
@Override
public IntegerType copy() {
return new IntegerType(getValue());
}
public String fhirType() {
return "integer";
}
}

Some files were not shown because too many files have changed in this diff Show More