Resolve XXE issue in validator (#1530)

* Resolve XXE issue in validator

* Ensure that we're blocking XXE events into validator XML parser

* A bit of cleanup

* Add an LGTM config

* Add one more fix
This commit is contained in:
James Agnew 2019-10-08 13:06:03 -05:00 committed by GitHub
parent 3c4c6f7925
commit 1f1b94a566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
226 changed files with 447 additions and 320855 deletions

View File

@ -36,9 +36,12 @@ public class ServerOperations {
public void manualInputAndOutput(HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws IOException { public void manualInputAndOutput(HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws IOException {
String contentType = theServletRequest.getContentType(); String contentType = theServletRequest.getContentType();
byte[] bytes = IOUtils.toByteArray(theServletRequest.getInputStream()); byte[] bytes = IOUtils.toByteArray(theServletRequest.getInputStream());
ourLog.info("Received call with content type {} and {} bytes", contentType, bytes.length); ourLog.info("Received call with content type {} and {} bytes", contentType, bytes.length);
// In a real example we might do something more interesting with the received bytes,
// here we'll just replace them with hardcoded ones
bytes = new byte[] { 0, 1, 2, 3 };
theServletResponse.setContentType(contentType); theServletResponse.setContentType(contentType);
theServletResponse.getOutputStream().write(bytes); theServletResponse.getOutputStream().write(bytes);
theServletResponse.getOutputStream().close(); theServletResponse.getOutputStream().close();

View File

@ -31,6 +31,8 @@ import org.apache.commons.text.StringEscapeUtils;
import org.codehaus.stax2.XMLOutputFactory2; import org.codehaus.stax2.XMLOutputFactory2;
import org.codehaus.stax2.io.EscapingWriterFactory; import org.codehaus.stax2.io.EscapingWriterFactory;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.*; import javax.xml.stream.*;
import javax.xml.stream.events.XMLEvent; import javax.xml.stream.events.XMLEvent;
import java.io.*; import java.io.*;
@ -40,7 +42,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
/** /**
* Utility methods for working with the StAX API. * Utility methods for working with the StAX API.
* * <p>
* This class contains code adapted from the Apache Axiom project. * This class contains code adapted from the Apache Axiom project.
*/ */
public class XmlUtil { public class XmlUtil {
@ -1507,6 +1509,73 @@ public class XmlUtil {
VALID_ENTITY_NAMES = Collections.unmodifiableMap(validEntityNames); VALID_ENTITY_NAMES = Collections.unmodifiableMap(validEntityNames);
} }
/** Non-instantiable */
private XmlUtil() {}
private static final class ExtendedEntityReplacingXmlResolver implements XMLResolver {
@Override
public Object resolveEntity(String thePublicID, String theSystemID, String theBaseURI, String theNamespace) {
if (thePublicID == null && theSystemID == null) {
if (theNamespace != null && VALID_ENTITY_NAMES.containsKey(theNamespace)) {
return new String(Character.toChars(VALID_ENTITY_NAMES.get(theNamespace)));
}
}
return null;
}
}
public static class MyEscaper implements EscapingWriterFactory {
@Override
public Writer createEscapingWriterFor(OutputStream theOut, String theEnc) throws UnsupportedEncodingException {
return createEscapingWriterFor(new OutputStreamWriter(theOut, theEnc), theEnc);
}
@Override
public Writer createEscapingWriterFor(final Writer theW, String theEnc) {
return new Writer() {
@Override
public void close() throws IOException {
theW.close();
}
@Override
public void flush() throws IOException {
theW.flush();
}
@Override
public void write(char[] theCbuf, int theOff, int theLen) throws IOException {
boolean hasEscapable = false;
for (int i = 0; i < theLen && !hasEscapable; i++) {
char nextChar = theCbuf[i + theOff];
switch (nextChar) {
case '<':
case '>':
case '"':
case '&':
hasEscapable = true;
break;
default:
break;
}
}
if (!hasEscapable) {
theW.write(theCbuf, theOff, theLen);
return;
}
String escaped = StringEscapeUtils.escapeXml10(new String(theCbuf, theOff, theLen));
theW.write(escaped.toCharArray());
}
};
}
}
private static XMLOutputFactory createOutputFactory() throws FactoryConfigurationError { private static XMLOutputFactory createOutputFactory() throws FactoryConfigurationError {
try { try {
// Detect if we're running with the Android lib, and force repackaged Woodstox to be used // Detect if we're running with the Android lib, and force repackaged Woodstox to be used
@ -1637,15 +1706,11 @@ public class XmlUtil {
try { try {
Class.forName("com.ctc.wstx.stax.WstxInputFactory"); Class.forName("com.ctc.wstx.stax.WstxInputFactory");
boolean isWoodstox = inputFactory instanceof com.ctc.wstx.stax.WstxInputFactory; boolean isWoodstox = inputFactory instanceof com.ctc.wstx.stax.WstxInputFactory;
if ( !isWoodstox ) if (!isWoodstox) {
{
// Check if implementation is woodstox by property since instanceof check does not work if running in JBoss // Check if implementation is woodstox by property since instanceof check does not work if running in JBoss
try try {
{
isWoodstox = inputFactory.getProperty("org.codehaus.stax2.implVersion") != null; isWoodstox = inputFactory.getProperty("org.codehaus.stax2.implVersion") != null;
} } catch (Exception e) {
catch ( Exception e )
{
// ignore // ignore
} }
} }
@ -1673,7 +1738,6 @@ public class XmlUtil {
return ourOutputFactory; return ourOutputFactory;
} }
private static void logStaxImplementation(Class<?> theClass) { private static void logStaxImplementation(Class<?> theClass) {
IDependencyLog logger = DependencyLogFactory.createJarLogger(); IDependencyLog logger = DependencyLogFactory.createJarLogger();
if (logger != null) { if (logger != null) {
@ -1682,7 +1746,6 @@ public class XmlUtil {
ourHaveLoggedStaxImplementation = true; ourHaveLoggedStaxImplementation = true;
} }
static XMLInputFactory newInputFactory() throws FactoryConfigurationError { static XMLInputFactory newInputFactory() throws FactoryConfigurationError {
XMLInputFactory inputFactory; XMLInputFactory inputFactory;
try { try {
@ -1767,68 +1830,23 @@ public class XmlUtil {
} }
} }
private static final class ExtendedEntityReplacingXmlResolver implements XMLResolver { public static DocumentBuilderFactory newDocumentBuilderFactory() {
@Override DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
public Object resolveEntity(String thePublicID, String theSystemID, String theBaseURI, String theNamespace) { docBuilderFactory.setNamespaceAware(true);
if (thePublicID == null && theSystemID == null) { docBuilderFactory.setXIncludeAware(false);
if (theNamespace != null && VALID_ENTITY_NAMES.containsKey(theNamespace)) { docBuilderFactory.setExpandEntityReferences(false);
return new String(Character.toChars(VALID_ENTITY_NAMES.get(theNamespace))); try {
} docBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
} docBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
docBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
return null; docBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
} docBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
} throwUnitTestExceptionIfConfiguredToDoSo();
} catch (Exception e) {
public static class MyEscaper implements EscapingWriterFactory { ourLog.warn("Failed to set feature on XML parser: " + e.toString());
@Override
public Writer createEscapingWriterFor(OutputStream theOut, String theEnc) throws UnsupportedEncodingException {
return createEscapingWriterFor(new OutputStreamWriter(theOut, theEnc), theEnc);
}
@Override
public Writer createEscapingWriterFor(final Writer theW, String theEnc) {
return new Writer() {
@Override
public void close() throws IOException {
theW.close();
}
@Override
public void flush() throws IOException {
theW.flush();
}
@Override
public void write(char[] theCbuf, int theOff, int theLen) throws IOException {
boolean hasEscapable = false;
for (int i = 0; i < theLen && !hasEscapable; i++) {
char nextChar = theCbuf[i + theOff];
switch (nextChar) {
case '<':
case '>':
case '"':
case '&':
hasEscapable = true;
break;
default:
break;
}
}
if (!hasEscapable) {
theW.write(theCbuf, theOff, theLen);
return;
}
String escaped = StringEscapeUtils.escapeXml10(new String(theCbuf, theOff, theLen));
theW.write(escaped.toCharArray());
}
};
} }
return docBuilderFactory;
} }
} }

View File

@ -6,6 +6,7 @@ import java.util.*;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import ca.uhn.fhir.util.XmlUtil;
import org.apache.commons.lang3.Validate; import org.apache.commons.lang3.Validate;
import org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity; import org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.dstu2016may.model.StructureDefinition; import org.hl7.fhir.dstu2016may.model.StructureDefinition;
@ -48,8 +49,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
* The validation support * The validation support
*/ */
public FhirInstanceValidator(IValidationSupport theValidationSupport) { public FhirInstanceValidator(IValidationSupport theValidationSupport) {
myDocBuilderFactory = DocumentBuilderFactory.newInstance(); myDocBuilderFactory = XmlUtil.newDocumentBuilderFactory();
myDocBuilderFactory.setNamespaceAware(true);
myValidationSupport = theValidationSupport; myValidationSupport = theValidationSupport;
} }

View File

@ -1,83 +0,0 @@
package org.hl7.fhir.dstu2016may.formats;
/*
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 java.math.BigDecimal;
import java.net.URI;
import org.apache.commons.codec.binary.Base64;
public abstract class FormatUtilities {
public static final String ID_REGEX = "[A-Za-z0-9\\-\\.]{1,64}";
public static final String FHIR_NS = "http://hl7.org/fhir";
public static final String XHTML_NS = "http://www.w3.org/1999/xhtml";
public static final String NS_XSI = "http://www.w3.org/2001/XMLSchema-instance";
protected String toString(String value) {
return value;
}
protected String toString(int value) {
return java.lang.Integer.toString(value);
}
protected String toString(boolean value) {
return java.lang.Boolean.toString(value);
}
protected String toString(BigDecimal value) {
return value.toString();
}
protected String toString(URI value) {
return value.toString();
}
public static String toString(byte[] value) {
byte[] encodeBase64 = Base64.encodeBase64(value);
return new String(encodeBase64);
}
public static boolean isValidId(String tail) {
return tail.matches(ID_REGEX);
}
public static String makeId(String candidate) {
StringBuilder b = new StringBuilder();
for (char c : candidate.toCharArray())
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '.' || c == '-')
b.append(c);
return b.toString();
}
}

View File

@ -1,221 +0,0 @@
package org.hl7.fhir.dstu2016may.formats;
import java.io.IOException;
/*
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 java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import org.hl7.fhir.dstu2016may.model.Resource;
import org.hl7.fhir.dstu2016may.model.Type;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.xmlpull.v1.XmlPullParserException;
/**
* General interface - either an XML or JSON parser: read or write instances
*
* Defined to allow a factory to create a parser of the right type
*/
public interface IParser {
/**
* check what kind of parser this is
*
* @return what kind of parser this is
*/
public ParserType getType();
// -- Parser Configuration ----------------------------------
/**
* Whether to parse or ignore comments - either reading or writing
*/
public boolean getHandleComments();
public IParser setHandleComments(boolean value);
/**
* @param allowUnknownContent Whether to throw an exception if unknown content is found (or just skip it) when parsing
*/
public boolean isAllowUnknownContent();
public IParser setAllowUnknownContent(boolean value);
public enum OutputStyle {
/**
* Produce normal output - no whitespace, except in HTML where whitespace is untouched
*/
NORMAL,
/**
* Produce pretty output - human readable whitespace, HTML whitespace untouched
*/
PRETTY,
/**
* Produce canonical output - no comments, no whitspace, HTML whitespace normlised, JSON attributes sorted alphabetically (slightly slower)
*/
CANONICAL,
}
/**
* Writing:
*/
public OutputStyle getOutputStyle();
public IParser setOutputStyle(OutputStyle value);
/**
* This method is used by the publication tooling to stop the xhrtml narrative being generated.
* It is not valid to use in production use. The tooling uses it to generate json/xml representations in html that are not cluttered by escaped html representations of the html representation
*/
public IParser setSuppressXhtml(String message);
// -- Reading methods ----------------------------------------
/**
* parse content that is known to be a resource
* @throws XmlPullParserException
* @throws FHIRFormatError
* @throws IOException
*/
public Resource parse(InputStream input) throws IOException, FHIRFormatError;
/**
* parse content that is known to be a resource
* @throws UnsupportedEncodingException
* @throws IOException
* @throws FHIRFormatError
*/
public Resource parse(String input) throws UnsupportedEncodingException, FHIRFormatError, IOException;
/**
* parse content that is known to be a resource
* @throws IOException
* @throws FHIRFormatError
*/
public Resource parse(byte[] bytes) throws FHIRFormatError, IOException;
/**
* This is used to parse a type - a fragment of a resource.
* There's no reason to use this in production - it's used
* in the build tools
*
* Not supported by all implementations
*
* @param input
* @param knownType. if this is blank, the parser may try to infer the type (xml only)
* @return
* @throws XmlPullParserException
* @throws FHIRFormatError
* @throws IOException
*/
public Type parseType(InputStream input, String knownType) throws IOException, FHIRFormatError;
/**
* This is used to parse a type - a fragment of a resource.
* There's no reason to use this in production - it's used
* in the build tools
*
* Not supported by all implementations
*
* @param input
* @param knownType. if this is blank, the parser may try to infer the type (xml only)
* @return
* @throws UnsupportedEncodingException
* @throws IOException
* @throws FHIRFormatError
*/
public Type parseType(String input, String knownType) throws UnsupportedEncodingException, FHIRFormatError, IOException;
/**
* This is used to parse a type - a fragment of a resource.
* There's no reason to use this in production - it's used
* in the build tools
*
* Not supported by all implementations
*
* @param input
* @param knownType. if this is blank, the parser may try to infer the type (xml only)
* @return
* @throws IOException
* @throws FHIRFormatError
*/
public Type parseType(byte[] bytes, String knownType) throws FHIRFormatError, IOException;
// -- Writing methods ----------------------------------------
/**
* Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
* @throws IOException
*/
public void compose(OutputStream stream, Resource resource) throws IOException;
/**
* Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
* @throws IOException
*/
public String composeString(Resource resource) throws IOException;
/**
* Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
* @throws IOException
*/
public byte[] composeBytes(Resource resource) throws IOException;
/**
* Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
*
* Not supported by all implementations. rootName is ignored in the JSON format
* @throws XmlPullParserException
* @throws FHIRFormatError
* @throws IOException
*/
public void compose(OutputStream stream, Type type, String rootName) throws IOException;
/**
* Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
*
* Not supported by all implementations. rootName is ignored in the JSON format
* @throws IOException
*/
public String composeString(Type type, String rootName) throws IOException;
/**
* Compose a type to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
*
* Not supported by all implementations. rootName is ignored in the JSON format
* @throws IOException
*/
public byte[] composeBytes(Type type, String rootName) throws IOException;
}

View File

@ -1,38 +0,0 @@
package org.hl7.fhir.dstu2016may.formats;
import java.io.IOException;
import java.math.BigDecimal;
/**
* Facade to GSON writer, or something that imposes property ordering first
*
* @author Grahame
*
*/
public interface JsonCreator {
void setIndent(String string);
void beginObject() throws IOException;
void endObject() throws IOException;
void nullValue() throws IOException;
void name(String name) throws IOException;
void value(String value) throws IOException;
void value(Boolean value) throws IOException;
void value(BigDecimal value) throws IOException;
void value(Integer value) throws IOException;
void beginArray() throws IOException;
void endArray() throws IOException;
void finish() throws IOException;
}

View File

@ -1,227 +0,0 @@
package org.hl7.fhir.dstu2016may.formats;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Stack;
import com.google.gson.stream.JsonWriter;
public class JsonCreatorCanonical implements JsonCreator {
public class JsonCanValue {
String name;
private JsonCanValue(String name) {
this.name = name;
}
}
private class JsonCanNumberValue extends JsonCanValue {
private BigDecimal value;
private JsonCanNumberValue(String name, BigDecimal value) {
super(name);
this.value = value;
}
}
private class JsonCanIntegerValue extends JsonCanValue {
private Integer value;
private JsonCanIntegerValue(String name, Integer value) {
super(name);
this.value = value;
}
}
private class JsonCanBooleanValue extends JsonCanValue {
private Boolean value;
private JsonCanBooleanValue(String name, Boolean value) {
super(name);
this.value = value;
}
}
private class JsonCanStringValue extends JsonCanValue {
private String value;
private JsonCanStringValue(String name, String value) {
super(name);
this.value = value;
}
}
private class JsonCanNullValue extends JsonCanValue {
private JsonCanNullValue(String name) {
super(name);
}
}
public class JsonCanObject extends JsonCanValue {
boolean array;
List<JsonCanValue> children = new ArrayList<JsonCanValue>();
public JsonCanObject(String name, boolean array) {
super(name);
this.array = array;
}
public void addProp(JsonCanValue obj) {
children.add(obj);
}
}
Stack<JsonCanObject> stack;
JsonCanObject root;
JsonWriter gson;
String name;
public JsonCreatorCanonical(OutputStreamWriter osw) {
stack = new Stack<JsonCreatorCanonical.JsonCanObject>();
gson = new JsonWriter(osw);
name = null;
}
private String takeName() {
String res = name;
name = null;
return res;
}
@Override
public void setIndent(String indent) {
if (!indent.equals(""))
throw new Error("do not use pretty when canonical is set");
gson.setIndent(indent);
}
@Override
public void beginObject() throws IOException {
JsonCanObject obj = new JsonCanObject(takeName(), false);
if (stack.isEmpty())
root = obj;
else
stack.peek().addProp(obj);
stack.push(obj);
}
@Override
public void endObject() throws IOException {
stack.pop();
}
@Override
public void nullValue() throws IOException {
stack.peek().addProp(new JsonCanNullValue(takeName()));
}
@Override
public void name(String name) throws IOException {
this.name = name;
}
@Override
public void value(String value) throws IOException {
stack.peek().addProp(new JsonCanStringValue(takeName(), value));
}
@Override
public void value(Boolean value) throws IOException {
stack.peek().addProp(new JsonCanBooleanValue(takeName(), value));
}
@Override
public void value(BigDecimal value) throws IOException {
stack.peek().addProp(new JsonCanNumberValue(takeName(), value));
}
@Override
public void value(Integer value) throws IOException {
stack.peek().addProp(new JsonCanIntegerValue(takeName(), value));
}
@Override
public void beginArray() throws IOException {
JsonCanObject obj = new JsonCanObject(takeName(), true);
if (!stack.isEmpty())
stack.peek().addProp(obj);
stack.push(obj);
}
@Override
public void endArray() throws IOException {
stack.pop();
}
@Override
public void finish() throws IOException {
writeObject(root);
}
private void writeObject(JsonCanObject obj) throws IOException {
gson.beginObject();
List<String> names = new ArrayList<String>();
for (JsonCanValue v : obj.children)
names.add(v.name);
Collections.sort(names);
for (String n : names) {
gson.name(n);
JsonCanValue v = getPropForName(n, obj.children);
if (v instanceof JsonCanNumberValue)
gson.value(((JsonCanNumberValue) v).value);
else if (v instanceof JsonCanIntegerValue)
gson.value(((JsonCanIntegerValue) v).value);
else if (v instanceof JsonCanBooleanValue)
gson.value(((JsonCanBooleanValue) v).value);
else if (v instanceof JsonCanStringValue)
gson.value(((JsonCanStringValue) v).value);
else if (v instanceof JsonCanNullValue)
gson.nullValue();
else if (v instanceof JsonCanObject) {
JsonCanObject o = (JsonCanObject) v;
if (o.array)
writeArray(o);
else
writeObject(o);
} else
throw new Error("not possible");
}
gson.endObject();
}
private JsonCanValue getPropForName(String name, List<JsonCanValue> children) {
for (JsonCanValue child : children)
if (child.name.equals(name))
return child;
return null;
}
private void writeArray(JsonCanObject arr) throws IOException {
gson.beginArray();
for (JsonCanValue v : arr.children) {
if (v instanceof JsonCanNumberValue)
gson.value(((JsonCanNumberValue) v).value);
else if (v instanceof JsonCanIntegerValue)
gson.value(((JsonCanIntegerValue) v).value);
else if (v instanceof JsonCanBooleanValue)
gson.value(((JsonCanBooleanValue) v).value);
else if (v instanceof JsonCanStringValue)
gson.value(((JsonCanStringValue) v).value);
else if (v instanceof JsonCanNullValue)
gson.nullValue();
else if (v instanceof JsonCanObject) {
JsonCanObject o = (JsonCanObject) v;
if (o.array)
writeArray(o);
else
writeObject(o);
} else
throw new Error("not possible");
}
gson.endArray();
}
}

View File

@ -1,78 +0,0 @@
package org.hl7.fhir.dstu2016may.formats;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import com.google.gson.stream.JsonWriter;
public class JsonCreatorGson implements JsonCreator {
JsonWriter gson;
public JsonCreatorGson(OutputStreamWriter osw) {
gson = new JsonWriter(osw);
}
@Override
public void setIndent(String indent) {
gson.setIndent(indent);
}
@Override
public void beginObject() throws IOException {
gson.beginObject();
}
@Override
public void endObject() throws IOException {
gson.endObject();
}
@Override
public void nullValue() throws IOException {
gson.nullValue();
}
@Override
public void name(String name) throws IOException {
gson.name(name);
}
@Override
public void value(String value) throws IOException {
gson.value(value);
}
@Override
public void value(Boolean value) throws IOException {
gson.value(value);
}
@Override
public void value(BigDecimal value) throws IOException {
gson.value(value);
}
@Override
public void value(Integer value) throws IOException {
gson.value(value);
}
@Override
public void beginArray() throws IOException {
gson.beginArray();
}
@Override
public void endArray() throws IOException {
gson.endArray();
}
@Override
public void finish() {
// nothing to do here
}
}

View File

@ -1,30 +0,0 @@
package org.hl7.fhir.dstu2016may.formats;
/**
* Used in factory methods for parsers, for requesting a parser of a particular type
* (see IWorkerContext)
*
* @author Grahame
*
*/
public enum ParserType {
/**
* XML as specified in specification
*/
XML,
/**
* JSON as specified in the specification
*/
JSON,
/**
* XHTML - write narrative (generate if necessary). No read
*/
XHTML,
/**
* RDF is not supported yet
*/
RDF_TURTLE
}

View File

@ -1,304 +0,0 @@
package org.hl7.fhir.dstu2016may.metamodel;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.dstu2016may.model.Base;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
/**
* This class represents the reference model of FHIR
*
* A resource is nothing but a set of elements, where every element has a
* name, maybe a stated type, maybe an id, and either a value or child elements
* (one or the other, or both (but not neither if it's null)
*
* @author Grahame Grieve
*
*/
public class Element extends Base {
public enum SpecialElement {
CONTAINED, BUNDLE_ENTRY;
}
private List<String> comments;// not relevant for production, but useful in documentation
private String name;
private String type;
private String value;
private int index = -1;
private List<Element> children;
private Property property;
private int line;
private int col;
private SpecialElement special;
private XhtmlNode xhtml; // if this is populated, then value will also hold the string representation
public Element(String name) {
super();
this.name = name;
}
public Element(String name, Property property) {
super();
this.name = name;
this.property = property;
}
public Element(String name, Property property, String type, String value) {
super();
this.name = name;
this.property = property;
this.type = type;
this.value = value;
}
public void updateProperty(Property property, SpecialElement special) {
this.property = property;
this.special = special;
}
public SpecialElement getSpecial() {
return special;
}
public String getName() {
return name;
}
public String getType() {
if (type == null)
return property.getType(name);
else
return type;
}
public String getValue() {
return value;
}
public boolean hasChildren() {
return !(children == null || children.isEmpty());
}
public List<Element> getChildren() {
if (children == null)
children = new ArrayList<Element>();
return children;
}
public boolean hasComments() {
return !(comments == null || comments.isEmpty());
}
public List<String> getComments() {
if (comments == null)
comments = new ArrayList<String>();
return comments;
}
public Property getProperty() {
return property;
}
public void setValue(String value) {
this.value = value;
}
public void setType(String type) {
this.type = type;
}
public boolean hasValue() {
return value != null;
}
public List<Element> getChildrenByName(String name) {
List<Element> res = new ArrayList<Element>();
if (hasChildren()) {
for (Element child : children)
if (name.equals(child.getName()))
res.add(child);
}
return res;
}
public void numberChildren() {
if (children == null)
return;
String last = "";
int index = 0;
for (Element child : children) {
if (child.getProperty().isList()) {
if (last.equals(child.getName())) {
index++;
} else {
last = child.getName();
index = 0;
}
child.index = index;
} else {
child.index = -1;
}
child.numberChildren();
}
}
public int getIndex() {
return index;
}
public boolean hasIndex() {
return index > -1;
}
public void setIndex(int index) {
this.index = index;
}
public String getChildValue(String name) {
if (children == null)
return null;
for (Element child : children) {
if (name.equals(child.getName()))
return child.getValue();
}
return null;
}
public List<Element> getChildren(String name) {
List<Element> res = new ArrayList<Element>();
for (Element child : children) {
if (name.equals(child.getName()))
res.add(child);
}
return res;
}
public boolean hasType() {
if (type == null)
return property.hasType(name);
else
return true;
}
@Override
public String fhirType() {
return getType();
}
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
if (isPrimitive() && (hash == "value".hashCode()) && !Utilities.noString(value)) {
String tn = getType();
throw new Error("not done yet");
}
List<Base> result = new ArrayList<Base>();
for (Element child : children) {
if (child.getName().equals(name))
result.add(child);
if (child.getName().startsWith(name) && child.getProperty().isChoice() && child.getProperty().getName().equals(name+"[x]"))
result.add(child);
}
if (result.isEmpty() && checkValid) {
// throw new FHIRException("not determined yet");
}
return result.toArray(new Base[result.size()]);
}
@Override
protected void listChildren(
List<org.hl7.fhir.dstu2016may.model.Property> result) {
// TODO Auto-generated method stub
}
@Override
public boolean isPrimitive() {
return type != null ? ParserBase.isPrimitive(type) : property.isPrimitive(name);
}
@Override
public boolean hasPrimitiveValue() {
return property.isPrimitive(name) || property.IsLogicalAndHasPrimitiveValue(name);
}
@Override
public String primitiveValue() {
if (isPrimitive())
return value;
else {
if (hasPrimitiveValue()) {
for (Element c : children) {
if (c.getName().equals("value"))
return c.primitiveValue();
}
}
return null;
}
}
// for the validator
public int line() {
return line;
}
public int col() {
return col;
}
public Element markLocation(int line, int col) {
this.line = line;
this.col = col;
return this;
}
public Element getNamedChild(String name) {
if (children == null)
return null;
Element result = null;
for (Element child : children) {
if (child.getName().equals(name)) {
if (result == null)
result = child;
else
throw new Error("Attempt to read a single element when there is more than one present ("+name+")");
}
}
return result;
}
public void getNamedChildren(String name, List<Element> list) {
if (children != null)
for (Element child : children)
if (child.getName().equals(name))
list.add(child);
}
public String getNamedChildValue(String name) {
Element child = getNamedChild(name);
return child == null ? null : child.value;
}
public void getNamedChildrenWithWildcard(String string, List<Element> values) {
throw new Error("not done yet");
}
public XhtmlNode getXhtml() {
return xhtml;
}
public Element setXhtml(XhtmlNode xhtml) {
this.xhtml = xhtml;
return this;
}
}

View File

@ -1,421 +0,0 @@
package org.hl7.fhir.dstu2016may.metamodel;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu2016may.formats.JsonCreator;
import org.hl7.fhir.dstu2016may.formats.JsonCreatorCanonical;
import org.hl7.fhir.dstu2016may.formats.JsonCreatorGson;
import org.hl7.fhir.dstu2016may.metamodel.Element.SpecialElement;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.utils.IWorkerContext;
import org.hl7.fhir.dstu2016may.utils.JsonTrackingParser;
import org.hl7.fhir.dstu2016may.utils.JsonTrackingParser.LocationData;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonNull;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
public class JsonParser extends ParserBase {
private JsonCreator json;
private Map<JsonElement, LocationData> map;
public JsonParser(IWorkerContext context) {
super(context);
}
@Override
public Element parse(InputStream stream) throws Exception {
// if we're parsing at this point, then we're going to use the custom parser
map = new HashMap<JsonElement, LocationData>();
String source = TextFile.streamToString(stream);
if (policy == ValidationPolicy.EVERYTHING) {
JsonObject obj = null;
try {
obj = JsonTrackingParser.parse(source, map);
} catch (Exception e) {
logError(-1, -1, "(document)", IssueType.INVALID, "Error parsing JSON: "+e.getMessage(), IssueSeverity.FATAL);
return null;
}
assert (map.containsKey(obj));
return parse(obj);
} else {
JsonObject obj = (JsonObject) new com.google.gson.JsonParser().parse(source);
assert (map.containsKey(obj));
return parse(obj);
}
}
public Element parse(JsonObject object, Map<JsonElement, LocationData> map) throws Exception {
this.map = map;
return parse(object);
}
public Element parse(JsonObject object) throws Exception {
JsonElement rt = object.get("resourceType");
if (rt == null) {
logError(line(object), col(object), "$", IssueType.INVALID, "Unable to find resourceType property", IssueSeverity.FATAL);
return null;
} else {
String name = rt.getAsString();
String path = "/"+name;
StructureDefinition sd = getDefinition(line(object), col(object), name);
if (sd == null)
return null;
Element result = new Element(name, new Property(context, sd.getSnapshot().getElement().get(0), sd));
checkObject(object, path);
result.markLocation(line(object), col(object));
result.setType(name);
parseChildren(path, object, result, true);
result.numberChildren();
return result;
}
}
private void checkObject(JsonObject object, String path) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
boolean found = false;
for (Entry<String, JsonElement> e : object.entrySet()) {
// if (!e.getKey().equals("fhir_comments")) {
found = true;
break;
// }
}
if (!found)
logError(line(object), col(object), path, IssueType.INVALID, "Object must have some content", IssueSeverity.ERROR);
}
}
private void parseChildren(String path, JsonObject object, Element context, boolean hasResourceType) throws DefinitionException, FHIRFormatError {
reapComments(object, context);
List<Property> properties = getChildProperties(context.getProperty(), context.getName(), null);
Set<String> processed = new HashSet<String>();
if (hasResourceType)
processed.add("resourceType");
processed.add("fhir_comments");
// note that we do not trouble ourselves to maintain the wire format order here - we don't even know what it was anyway
// first pass: process the properties
for (Property property : properties) {
if (property.isChoice()) {
for (TypeRefComponent type : property.getDefinition().getType()) {
String eName = property.getName().substring(0, property.getName().length()-3) + Utilities.capitalize(type.getCode());
if (!ParserBase.isPrimitive(type.getCode()) && object.has(eName)) {
parseChildComplex(path, object, context, processed, property, eName);
break;
} else if (ParserBase.isPrimitive(type.getCode()) && (object.has(eName) || object.has("_"+eName))) {
parseChildPrimitive(object, context, processed, property, path, eName);
break;
}
}
} else if (property.isPrimitive(null)) {
parseChildPrimitive(object, context, processed, property, path, property.getName());
} else if (object.has(property.getName())) {
parseChildComplex(path, object, context, processed, property, property.getName());
}
}
// second pass: check for things not processed
if (policy != ValidationPolicy.NONE) {
for (Entry<String, JsonElement> e : object.entrySet()) {
if (!processed.contains(e.getKey())) {
logError(line(e.getValue()), col(e.getValue()), path, IssueType.STRUCTURE, "Unrecognised property '@"+e.getKey()+"'", IssueSeverity.ERROR);
}
}
}
}
private void parseChildComplex(String path, JsonObject object, Element context, Set<String> processed, Property property, String name) throws FHIRFormatError, DefinitionException {
processed.add(name);
String npath = path+"/"+property.getName();
JsonElement e = object.get(name);
if (property.isList() && (e instanceof JsonArray)) {
JsonArray arr = (JsonArray) e;
for (JsonElement am : arr) {
parseChildComplexInstance(npath, object, context, property, name, am);
}
} else {
parseChildComplexInstance(npath, object, context, property, name, e);
}
}
private void parseChildComplexInstance(String npath, JsonObject object, Element context, Property property, String name, JsonElement e) throws FHIRFormatError, DefinitionException {
if (e instanceof JsonObject) {
JsonObject child = (JsonObject) e;
Element n = new Element(name, property).markLocation(line(child), col(child));
checkObject(child, npath);
context.getChildren().add(n);
if (property.isResource())
parseResource(npath, child, n);
else
parseChildren(npath, child, n, false);
} else
logError(line(e), col(e), npath, IssueType.INVALID, "This property must be "+(property.isList() ? "an Array" : "an Object")+", not a "+e.getClass().getName(), IssueSeverity.ERROR);
}
private void parseChildPrimitive(JsonObject object, Element context, Set<String> processed, Property property, String path, String name) throws FHIRFormatError, DefinitionException {
String npath = path+"/"+property.getName();
processed.add(name);
processed.add("_"+name);
JsonElement main = object.has(name) ? object.get(name) : null;
JsonElement fork = object.has("_"+name) ? object.get("_"+name) : null;
if (main != null || fork != null) {
if (property.isList() && ((main == null) || (main instanceof JsonArray)) &&((fork == null) || (fork instanceof JsonArray)) ) {
JsonArray arr1 = (JsonArray) main;
JsonArray arr2 = (JsonArray) fork;
for (int i = 0; i < Math.max(arrC(arr1), arrC(arr2)); i++) {
JsonElement m = arrI(arr1, i);
JsonElement f = arrI(arr2, i);
parseChildPrimitiveInstance(context, property, name, npath, m, f);
}
} else
parseChildPrimitiveInstance(context, property, name, npath, main, fork);
}
}
private JsonElement arrI(JsonArray arr, int i) {
return arr == null || i >= arr.size() || arr.get(i) instanceof JsonNull ? null : arr.get(i);
}
private int arrC(JsonArray arr) {
return arr == null ? 0 : arr.size();
}
private void parseChildPrimitiveInstance(Element context, Property property, String name, String npath,
JsonElement main, JsonElement fork) throws FHIRFormatError, DefinitionException {
if (main != null && !(main instanceof JsonPrimitive))
logError(line(main), col(main), npath, IssueType.INVALID, "This property must be an simple value, not a "+main.getClass().getName(), IssueSeverity.ERROR);
else if (fork != null && !(fork instanceof JsonObject))
logError(line(fork), col(fork), npath, IssueType.INVALID, "This property must be an object, not a "+fork.getClass().getName(), IssueSeverity.ERROR);
else {
Element n = new Element(name, property).markLocation(line(main != null ? main : fork), col(main != null ? main : fork));
context.getChildren().add(n);
if (main != null) {
JsonPrimitive p = (JsonPrimitive) main;
n.setValue(p.getAsString());
if (!n.getProperty().isChoice() && n.getType().equals("xhtml")) {
try {
n.setXhtml(new XhtmlParser().setValidatorMode(policy == ValidationPolicy.EVERYTHING).parse(n.getValue(), null).getDocumentElement());
} catch (Exception e) {
logError(line(main), col(main), npath, IssueType.INVALID, "Error parsing XHTML: "+e.getMessage(), IssueSeverity.ERROR);
}
}
if (policy == ValidationPolicy.EVERYTHING) {
// now we cross-check the primitive format against the stated type
if (Utilities.existsInList(n.getType(), "boolean")) {
if (!p.isBoolean())
logError(line(main), col(main), npath, IssueType.INVALID, "Error parsing JSON: the primitive value must be a boolean", IssueSeverity.ERROR);
} else if (Utilities.existsInList(n.getType(), "integer", "unsignedInt", "positiveInt", "decimal")) {
if (!p.isNumber())
logError(line(main), col(main), npath, IssueType.INVALID, "Error parsing JSON: the primitive value must be a number", IssueSeverity.ERROR);
} else if (!p.isString())
logError(line(main), col(main), npath, IssueType.INVALID, "Error parsing JSON: the primitive value must be a string", IssueSeverity.ERROR);
}
}
if (fork != null) {
JsonObject child = (JsonObject) fork;
checkObject(child, npath);
parseChildren(npath, child, n, false);
}
}
}
private void parseResource(String npath, JsonObject res, Element parent) throws DefinitionException, FHIRFormatError {
JsonElement rt = res.get("resourceType");
if (rt == null) {
logError(line(res), col(res), npath, IssueType.INVALID, "Unable to find resourceType property", IssueSeverity.FATAL);
} else {
String name = rt.getAsString();
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+name);
if (sd == null)
throw new FHIRFormatError("Contained resource does not appear to be a FHIR resource (unknown name '"+name+"')");
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd), parent.getProperty().getName().equals("contained") ? SpecialElement.CONTAINED : SpecialElement.BUNDLE_ENTRY);
parent.setType(name);
parseChildren(npath, res, parent, true);
}
}
private void reapComments(JsonObject object, Element context) {
if (object.has("fhir_comments")) {
JsonArray arr = object.getAsJsonArray("fhir_comments");
for (JsonElement e : arr) {
context.getComments().add(e.getAsString());
}
}
}
private int line(JsonElement e) {
if (map == null|| !map.containsKey(e))
return -1;
else
return map.get(e).getLine();
}
private int col(JsonElement e) {
if (map == null|| !map.containsKey(e))
return -1;
else
return map.get(e).getCol();
}
protected void prop(String name, String value) throws IOException {
if (name != null)
json.name(name);
json.value(value);
}
protected void open(String name) throws IOException {
if (name != null)
json.name(name);
json.beginObject();
}
protected void close() throws IOException {
json.endObject();
}
protected void openArray(String name) throws IOException {
if (name != null)
json.name(name);
json.beginArray();
}
protected void closeArray() throws IOException {
json.endArray();
}
@Override
public void compose(Element e, OutputStream stream, OutputStyle style, String identity) throws Exception {
OutputStreamWriter osw = new OutputStreamWriter(stream, "UTF-8");
if (style == OutputStyle.CANONICAL)
json = new JsonCreatorCanonical(osw);
else
json = new JsonCreatorGson(osw);
json.setIndent(style == OutputStyle.PRETTY ? " " : "");
json.beginObject();
prop("resourceType", e.getType());
Set<String> done = new HashSet<String>();
for (Element child : e.getChildren()) {
compose(e.getName(), e, done, child);
}
json.endObject();
json.finish();
osw.flush();
}
private void compose(String path, Element e, Set<String> done, Element child) throws IOException {
if (child.getSpecial() == SpecialElement.BUNDLE_ENTRY || !child.getProperty().isList()) {// for specials, ignore the cardinality of the stated type
compose(path, child);
} else if (!done.contains(child.getName())) {
done.add(child.getName());
List<Element> list = e.getChildrenByName(child.getName());
composeList(path, list);
}
}
private void composeList(String path, List<Element> list) throws IOException {
// there will be at least one element
String name = list.get(0).getName();
boolean complex = true;
if (list.get(0).isPrimitive()) {
boolean prim = false;
complex = false;
for (Element item : list) {
if (item.hasValue())
prim = true;
if (item.hasChildren())
complex = true;
}
if (prim) {
openArray(name);
for (Element item : list) {
if (item.hasValue())
primitiveValue(null, item);
else
json.nullValue();
}
closeArray();
}
name = "_"+name;
}
if (complex) {
openArray(name);
for (Element item : list) {
if (item.hasChildren()) {
open(null);
if (item.getProperty().isResource()) {
prop("resourceType", item.getType());
}
Set<String> done = new HashSet<String>();
for (Element child : item.getChildren()) {
compose(path+"."+name+"[]", item, done, child);
}
close();
} else
json.nullValue();
}
closeArray();
}
}
private void primitiveValue(String name, Element item) throws IOException {
if (name != null)
json.name(name);
String type = item.getType();
if (Utilities.existsInList(type, "boolean"))
json.value(item.getValue().trim().equals("true") ? new Boolean(true) : new Boolean(false));
else if (Utilities.existsInList(type, "integer", "unsignedInt", "positiveInt"))
json.value(new Integer(item.getValue()));
else if (Utilities.existsInList(type, "decimal"))
json.value(new BigDecimal(item.getValue()));
else
json.value(item.getValue());
}
private void compose(String path, Element element) throws IOException {
String name = element.getName();
if (element.isPrimitive() || ParserBase.isPrimitive(element.getType())) {
if (element.hasValue())
primitiveValue(name, element);
name = "_"+name;
}
if (element.hasChildren()) {
open(name);
if (element.getProperty().isResource()) {
prop("resourceType", element.getType());
}
Set<String> done = new HashSet<String>();
for (Element child : element.getChildren()) {
compose(path+"."+element.getName(), element, done, child);
}
close();
}
}
}

View File

@ -1,30 +0,0 @@
package org.hl7.fhir.dstu2016may.metamodel;
import java.io.InputStream;
import java.io.OutputStream;
import org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu2016may.utils.IWorkerContext;
public class Manager {
public enum FhirFormat { XML, JSON, JSONLD, TURTLE }
public static Element parse(IWorkerContext context, InputStream source, FhirFormat inputFormat) throws Exception {
return makeParser(context, inputFormat).parse(source);
}
public static void compose(IWorkerContext context, Element e, OutputStream destination, FhirFormat outputFormat, OutputStyle style, String base) throws Exception {
makeParser(context, outputFormat).compose(e, destination, style, base);
}
public static ParserBase makeParser(IWorkerContext context, FhirFormat format) {
switch (format) {
case JSON : return new JsonParser(context);
case XML : return new XmlParser(context);
default:
throw new IllegalArgumentException("Unknown type: " + format);
}
}
}

View File

@ -1,164 +0,0 @@
package org.hl7.fhir.dstu2016may.metamodel;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.dstu2016may.formats.FormatUtilities;
import org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu2016may.model.ElementDefinition;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.utils.IWorkerContext;
import org.hl7.fhir.dstu2016may.utils.ProfileUtilities;
import org.hl7.fhir.dstu2016may.utils.ToolingExtensions;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.validation.ValidationMessage.Source;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.Utilities;
public abstract class ParserBase {
protected IWorkerContext context;
protected ValidationPolicy policy;
protected List<ValidationMessage> errors;
public ParserBase(IWorkerContext context) {
super();
this.context = context;
policy = ValidationPolicy.NONE;
}
public abstract void compose(Element e, OutputStream destination, OutputStyle style, String base) throws Exception;
protected List<Property> getChildProperties(Property property, String elementName, String statedType) throws DefinitionException {
ElementDefinition ed = property.getDefinition();
StructureDefinition sd = property.getStructure();
List<ElementDefinition> children = ProfileUtilities.getChildMap(sd, ed);
if (children.isEmpty()) {
// ok, find the right definitions
String t = null;
if (ed.getType().size() == 1)
t = ed.getType().get(0).getCode();
else if (ed.getType().size() == 0)
throw new Error("types == 0, and no children found");
else {
t = ed.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : ed.getType()) {
if (!tr.getCode().equals(t)) {
all = false;
break;
}
}
if (!all) {
// ok, it's polymorphic
if (ed.hasRepresentation(PropertyRepresentation.TYPEATTR)) {
t = statedType;
if (t == null && ToolingExtensions.hasExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaultype"))
t = ToolingExtensions.readStringExtension(ed, "http://hl7.org/fhir/StructureDefinition/elementdefinition-defaultype");
boolean ok = false;
for (TypeRefComponent tr : ed.getType())
if (tr.getCode().equals(t))
ok = true;
if (!ok)
throw new DefinitionException("Type '"+t+"' is not an acceptable type for '"+elementName+"' on property "+property.getDefinition().getPath());
} else {
t = elementName.substring(tail(ed.getPath()).length() - 3);
if (isPrimitive(lowFirst(t)))
t = lowFirst(t);
}
}
}
if (!"xhtml".equals(t)) {
sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+t);
if (sd == null)
throw new DefinitionException("Unable to find class '"+t+"' for name '"+elementName+"' on property "+property.getDefinition().getPath());
children = ProfileUtilities.getChildMap(sd, sd.getSnapshot().getElement().get(0));
}
}
List<Property> properties = new ArrayList<Property>();
for (ElementDefinition child : children) {
properties.add(new Property(context, child, sd));
}
return properties;
}
protected StructureDefinition getDefinition(int line, int col, String name) throws FHIRFormatError {
if (name == null) {
logError(line, col, name, IssueType.STRUCTURE, "This cannot be parsed as a FHIR object (no name)", IssueSeverity.FATAL);
return null;
}
for (StructureDefinition sd : context.allStructures()) {
if (name.equals(sd.getIdElement().getIdPart())) {
return sd;
}
}
logError(line, col, name, IssueType.STRUCTURE, "This does not appear to be a FHIR resource (unknown name '"+name+"')", IssueSeverity.FATAL);
return null;
}
protected StructureDefinition getDefinition(int line, int col, String ns, String name) throws FHIRFormatError {
if (ns == null) {
logError(line, col, name, IssueType.STRUCTURE, "This cannot be parsed as a FHIR object (no namespace)", IssueSeverity.FATAL);
return null;
}
if (name == null) {
logError(line, col, name, IssueType.STRUCTURE, "This cannot be parsed as a FHIR object (no name)", IssueSeverity.FATAL);
return null;
}
for (StructureDefinition sd : context.allStructures()) {
if (name.equals(sd.getIdElement().getIdPart())) {
if((ns == null || ns.equals(FormatUtilities.FHIR_NS)) && !ToolingExtensions.hasExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return sd;
String sns = ToolingExtensions.readStringExtension(sd, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
if (ns != null && ns.equals(sns))
return sd;
}
}
logError(line, col, name, IssueType.STRUCTURE, "This does not appear to be a FHIR resource (unknown namespace/name '"+ns+"::"+name+"')", IssueSeverity.FATAL);
return null;
}
public void logError(int line, int col, String path, IssueType type, String message, IssueSeverity level) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
ValidationMessage msg = new ValidationMessage(Source.InstanceValidator, type, line, col, path, message, level);
errors.add(msg);
} else if (level == IssueSeverity.FATAL || (level == IssueSeverity.ERROR && policy == ValidationPolicy.QUICK))
throw new FHIRFormatError(message+String.format(" at line %d col %d", line, col));
}
private String lowFirst(String t) {
return t.substring(0, 1).toLowerCase()+t.substring(1);
}
public abstract Element parse(InputStream stream) throws Exception;
public void setupValidation(ValidationPolicy policy, List<ValidationMessage> errors) {
this.policy = policy;
this.errors = errors;
}
private String tail(String path) {
return path.contains(".") ? path.substring(path.lastIndexOf(".")+1) : path;
}
public static boolean isPrimitive(String code) {
return Utilities.existsInList(code,
"xhtml", "boolean", "integer", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime",
"time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml", "base64Binary");
}
interface IErrorNotifier {
}
public enum ValidationPolicy { NONE, QUICK, EVERYTHING }
}

View File

@ -1,157 +0,0 @@
package org.hl7.fhir.dstu2016may.metamodel;
import org.hl7.fhir.dstu2016may.formats.FormatUtilities;
import org.hl7.fhir.dstu2016may.model.ElementDefinition;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.TypeRefComponent;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.model.StructureDefinition.StructureDefinitionKind;
import org.hl7.fhir.dstu2016may.utils.IWorkerContext;
import org.hl7.fhir.dstu2016may.utils.ToolingExtensions;
public class Property {
private IWorkerContext context;
private ElementDefinition definition;
private StructureDefinition structure;
private Boolean canBePrimitive;
public Property(IWorkerContext context, ElementDefinition definition, StructureDefinition structure) {
this.context = context;
this.definition = definition;
this.structure = structure;
}
public String getName() {
return definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
}
public ElementDefinition getDefinition() {
return definition;
}
public String getType() {
if (definition.getType().size() == 0)
return null;
else if (definition.getType().size() > 1) {
String tn = definition.getType().get(0).getCode();
for (int i = 1; i < definition.getType().size(); i++) {
if (!tn.equals(definition.getType().get(i).getCode()))
throw new Error("logic error, gettype when types > 1");
}
return tn;
} else
return definition.getType().get(0).getCode();
}
public String getType(String elementName) {
if (definition.getType().size() == 0)
return null;
else if (definition.getType().size() > 1) {
String t = definition.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : definition.getType()) {
if (!t.equals(tr.getCode()))
all = false;
}
if (all)
return t;
String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName != null && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return ParserBase.isPrimitive(lowFirst(name)) ? lowFirst(name) : name;
} else
throw new Error("logic error, gettype when types > 1, name mismatch for "+elementName+" on at "+definition.getPath());
} else if (definition.getType().get(0).getCode() == null) {
return structure.getId();
} else
return definition.getType().get(0).getCode();
}
public boolean hasType(String elementName) {
if (definition.getType().size() == 0)
return false;
else if (definition.getType().size() > 1) {
String t = definition.getType().get(0).getCode();
boolean all = true;
for (TypeRefComponent tr : definition.getType()) {
if (!t.equals(tr.getCode()))
all = false;
}
if (all)
return true;
String tail = definition.getPath().substring(definition.getPath().lastIndexOf(".")+1);
if (tail.endsWith("[x]") && elementName.startsWith(tail.substring(0, tail.length()-3))) {
String name = elementName.substring(tail.length()-3);
return true;
} else
return false;
} else
return true;
}
public StructureDefinition getStructure() {
return structure;
}
public boolean isPrimitive(String name) {
return ParserBase.isPrimitive(getType(name));
}
private String lowFirst(String t) {
return t.substring(0, 1).toLowerCase()+t.substring(1);
}
public boolean isResource() {
return definition.getType().size() == 1 && ("Resource".equals(definition.getType().get(0).getCode()) || "DomainResource".equals(definition.getType().get(0).getCode()));
}
public boolean isList() {
return !definition.getMax().equals("1");
}
public String getScopedPropertyName() {
return definition.getBase().getPath();
}
public String getNamespace() {
if (ToolingExtensions.hasExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return ToolingExtensions.readStringExtension(definition, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
if (ToolingExtensions.hasExtension(structure, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
return ToolingExtensions.readStringExtension(structure, "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
return FormatUtilities.FHIR_NS;
}
public boolean IsLogicalAndHasPrimitiveValue(String name) {
if (canBePrimitive!= null)
return canBePrimitive;
canBePrimitive = false;
if (structure.getKind() != StructureDefinitionKind.LOGICAL)
return false;
if (!hasType(name))
return false;
StructureDefinition sd = context.fetchResource(StructureDefinition.class, structure.getUrl().substring(0, structure.getUrl().lastIndexOf("/")+1)+getType(name));
if (sd == null || sd.getKind() != StructureDefinitionKind.LOGICAL)
return false;
for (ElementDefinition ed : sd.getSnapshot().getElement()) {
if (ed.getPath().equals(sd.getId()+".value") && ed.getType().size() == 1 && ParserBase.isPrimitive(ed.getType().get(0).getCode())) {
canBePrimitive = true;
return true;
}
}
return false;
}
public boolean isChoice() {
if (definition.getType().size() <= 1)
return false;
String tn = definition.getType().get(0).getCode();
for (int i = 1; i < definition.getType().size(); i++)
if (!definition.getType().get(i).getCode().equals(tn))
return true;
return false;
}
}

View File

@ -1,412 +0,0 @@
package org.hl7.fhir.dstu2016may.metamodel;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.sax.SAXSource;
import org.hl7.fhir.dstu2016may.formats.FormatUtilities;
import org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu2016may.metamodel.Element.SpecialElement;
import org.hl7.fhir.dstu2016may.model.DateTimeType;
import org.hl7.fhir.dstu2016may.model.ElementDefinition.PropertyRepresentation;
import org.hl7.fhir.dstu2016may.model.Enumeration;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
import org.hl7.fhir.dstu2016may.utils.IWorkerContext;
import org.hl7.fhir.dstu2016may.utils.ToolingExtensions;
import org.hl7.fhir.dstu2016may.utils.XmlLocationAnnotator;
import org.hl7.fhir.dstu2016may.utils.XmlLocationData;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.xhtml.XhtmlComposer;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.hl7.fhir.utilities.xml.XMLWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.xml.sax.InputSource;
import org.xml.sax.XMLReader;
public class XmlParser extends ParserBase {
public XmlParser(IWorkerContext context) {
super(context);
}
public Element parse(InputStream stream) throws Exception {
Document doc = null;
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
// xxe protection
factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
factory.setFeature("http://xml.org/sax/features/external-general-entities", false);
factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
factory.setXIncludeAware(false);
factory.setExpandEntityReferences(false);
factory.setNamespaceAware(true);
if (policy == ValidationPolicy.EVERYTHING) {
// use a slower parser that keeps location data
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer nullTransformer = transformerFactory.newTransformer();
DocumentBuilder docBuilder = factory.newDocumentBuilder();
doc = docBuilder.newDocument();
DOMResult domResult = new DOMResult(doc);
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(false);
SAXParser saxParser = spf.newSAXParser();
XMLReader xmlReader = saxParser.getXMLReader();
// xxe protection
spf.setFeature("http://xml.org/sax/features/external-general-entities", false);
spf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
xmlReader.setFeature("http://xml.org/sax/features/external-general-entities", false);
xmlReader.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
XmlLocationAnnotator locationAnnotator = new XmlLocationAnnotator(xmlReader, doc);
InputSource inputSource = new InputSource(stream);
SAXSource saxSource = new SAXSource(locationAnnotator, inputSource);
nullTransformer.transform(saxSource, domResult);
} else {
DocumentBuilder builder = factory.newDocumentBuilder();
doc = builder.parse(stream);
}
} catch (Exception e) {
logError(0, 0, "(syntax)", IssueType.INVALID, e.getMessage(), IssueSeverity.FATAL);
doc = null;
}
if (doc == null)
return null;
else
return parse(doc);
}
private void checkForProcessingInstruction(Document document) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
Node node = document.getFirstChild();
while (node != null) {
if (node.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE)
logError(line(document), col(document), "(document)", IssueType.INVALID, "No processing instructions allowed in resources", IssueSeverity.ERROR);
node = node.getNextSibling();
}
}
}
private int line(Node node) {
XmlLocationData loc = (XmlLocationData) node.getUserData(XmlLocationData.LOCATION_DATA_KEY);
return loc == null ? 0 : loc.getStartLine();
}
private int col(Node node) {
XmlLocationData loc = (XmlLocationData) node.getUserData(XmlLocationData.LOCATION_DATA_KEY);
return loc == null ? 0 : loc.getStartColumn();
}
public Element parse(Document doc) throws Exception {
checkForProcessingInstruction(doc);
org.w3c.dom.Element element = doc.getDocumentElement();
return parse(element);
}
public Element parse(org.w3c.dom.Element element) throws Exception {
String ns = element.getNamespaceURI();
String name = element.getLocalName();
String path = "/"+pathPrefix(ns)+name;
StructureDefinition sd = getDefinition(line(element), col(element), ns, name);
if (sd == null)
return null;
Element result = new Element(element.getLocalName(), new Property(context, sd.getSnapshot().getElement().get(0), sd));
checkElement(element, path, result.getProperty());
result.markLocation(line(element), col(element));
result.setType(element.getLocalName());
parseChildren(path, element, result);
result.numberChildren();
return result;
}
private String pathPrefix(String ns) {
if (Utilities.noString(ns))
return "";
if (ns.equals(FormatUtilities.FHIR_NS))
return "f:";
if (ns.equals(FormatUtilities.XHTML_NS))
return "h:";
if (ns.equals("urn:hl7-org:v3"))
return "v3:";
return "?:";
}
private boolean empty(org.w3c.dom.Element element) {
for (int i = 0; i < element.getAttributes().getLength(); i++) {
String n = element.getAttributes().item(i).getNodeName();
if (!n.equals("xmlns") && !n.startsWith("xmlns:"))
return false;
}
if (!Utilities.noString(element.getTextContent().trim()))
return false;
Node n = element.getFirstChild();
while (n != null) {
if (n.getNodeType() == Node.ELEMENT_NODE)
return false;
n = n.getNextSibling();
}
return true;
}
private void checkElement(org.w3c.dom.Element element, String path, Property prop) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
if (empty(element))
logError(line(element), col(element), path, IssueType.INVALID, "Element must have some content", IssueSeverity.ERROR);
String ns = FormatUtilities.FHIR_NS;
if (ToolingExtensions.hasExtension(prop.getDefinition(), "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
ns = ToolingExtensions.readStringExtension(prop.getDefinition(), "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
else if (ToolingExtensions.hasExtension(prop.getStructure(), "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace"))
ns = ToolingExtensions.readStringExtension(prop.getStructure(), "http://hl7.org/fhir/StructureDefinition/elementdefinition-namespace");
if (!element.getNamespaceURI().equals(ns))
logError(line(element), col(element), path, IssueType.INVALID, "Wrong namespace - expected '"+ns+"'", IssueSeverity.ERROR);
}
}
public Element parse(org.w3c.dom.Element base, String type) throws Exception {
StructureDefinition sd = getDefinition(0, 0, FormatUtilities.FHIR_NS, type);
Element result = new Element(base.getLocalName(), new Property(context, sd.getSnapshot().getElement().get(0), sd));
String path = "/"+pathPrefix(base.getNamespaceURI())+base.getLocalName();
checkElement(base, path, result.getProperty());
result.setType(base.getLocalName());
parseChildren(path, base, result);
result.numberChildren();
return result;
}
private void parseChildren(String path, org.w3c.dom.Element node, Element context) throws Exception {
// this parsing routine retains the original order in a the XML file, to support validation
reapComments(node, context);
List<Property> properties = getChildProperties(context.getProperty(), context.getName(), XMLUtil.getXsiType(node));
String text = XMLUtil.getDirectText(node).trim();
if (!Utilities.noString(text)) {
Property property = getTextProp(properties);
if (property != null) {
context.getChildren().add(new Element(property.getName(), property, property.getType(), text).markLocation(line(node), col(node)));
} else {
logError(line(node), col(node), path, IssueType.STRUCTURE, "Text should not be present", IssueSeverity.ERROR);
}
}
for (int i = 0; i < node.getAttributes().getLength(); i++) {
Node attr = node.getAttributes().item(i);
if (!(attr.getNodeName().equals("xmlns") || attr.getNodeName().startsWith("xmlns:"))) {
Property property = getAttrProp(properties, attr.getNodeName());
if (property != null) {
String av = attr.getNodeValue();
if (ToolingExtensions.hasExtension(property.getDefinition(), "http://www.healthintersections.com.au/fhir/StructureDefinition/elementdefinition-dateformat"))
av = convertForDateFormat(ToolingExtensions.readStringExtension(property.getDefinition(), "http://www.healthintersections.com.au/fhir/StructureDefinition/elementdefinition-dateformat"), av);
if (property.getName().equals("value") && context.isPrimitive())
context.setValue(av);
else
context.getChildren().add(new Element(property.getName(), property, property.getType(), av).markLocation(line(node), col(node)));
} else {
logError(line(node), col(node), path, IssueType.STRUCTURE, "Undefined attribute '@"+attr.getNodeName()+"'", IssueSeverity.ERROR);
}
}
}
Node child = node.getFirstChild();
while (child != null) {
if (child.getNodeType() == Node.ELEMENT_NODE) {
Property property = getElementProp(properties, child.getLocalName());
if (property != null) {
if (!property.isChoice() && "xhtml".equals(property.getType())) {
XhtmlNode xhtml = new XhtmlParser().setValidatorMode(true).parseHtmlNode((org.w3c.dom.Element) child);
context.getChildren().add(new Element("div", property, "xhtml", new XhtmlComposer(true, false).compose(xhtml)).setXhtml(xhtml).markLocation(line(child), col(child)));
} else {
String npath = path+"/"+pathPrefix(child.getNamespaceURI())+child.getLocalName();
Element n = new Element(child.getLocalName(), property).markLocation(line(child), col(child));
checkElement((org.w3c.dom.Element) child, npath, n.getProperty());
boolean ok = true;
if (property.isChoice()) {
if (property.getDefinition().hasRepresentation(PropertyRepresentation.TYPEATTR)) {
String xsiType = ((org.w3c.dom.Element) child).getAttributeNS(FormatUtilities.NS_XSI, "type");
if (xsiType == null) {
logError(line(child), col(child), path, IssueType.STRUCTURE, "No type found on '"+child.getLocalName()+'"', IssueSeverity.ERROR);
ok = false;
} else {
if (xsiType.contains(":"))
xsiType = xsiType.substring(xsiType.indexOf(":")+1);
n.setType(xsiType);
}
} else
n.setType(n.getType());
}
context.getChildren().add(n);
if (ok) {
if (property.isResource())
parseResource(npath, (org.w3c.dom.Element) child, n);
else
parseChildren(npath, (org.w3c.dom.Element) child, n);
}
}
} else
logError(line(child), col(child), path, IssueType.STRUCTURE, "Undefined element '"+child.getLocalName()+"'", IssueSeverity.ERROR);
} else if (child.getNodeType() == Node.CDATA_SECTION_NODE){
logError(line(child), col(child), path, IssueType.STRUCTURE, "CDATA is not allowed", IssueSeverity.ERROR);
} else if (!Utilities.existsInList(child.getNodeType(), 3, 8)) {
logError(line(child), col(child), path, IssueType.STRUCTURE, "Node type "+Integer.toString(child.getNodeType())+" is not allowed", IssueSeverity.ERROR);
}
child = child.getNextSibling();
}
}
private Property getElementProp(List<Property> properties, String nodeName) {
for (Property p : properties)
if (!p.getDefinition().hasRepresentation(PropertyRepresentation.XMLATTR) && !p.getDefinition().hasRepresentation(PropertyRepresentation.XMLTEXT)) {
if (p.getName().equals(nodeName))
return p;
if (p.getName().endsWith("[x]") && nodeName.length() > p.getName().length()-3 && p.getName().substring(0, p.getName().length()-3).equals(nodeName.substring(0, p.getName().length()-3)))
return p;
}
return null;
}
private Property getAttrProp(List<Property> properties, String nodeName) {
for (Property p : properties)
if (p.getName().equals(nodeName) && p.getDefinition().hasRepresentation(PropertyRepresentation.XMLATTR))
return p;
return null;
}
private Property getTextProp(List<Property> properties) {
for (Property p : properties)
if (p.getDefinition().hasRepresentation(PropertyRepresentation.XMLTEXT))
return p;
return null;
}
private String convertForDateFormat(String fmt, String av) throws FHIRException {
if ("v3".equals(fmt)) {
DateTimeType d = DateTimeType.parseV3(av);
return d.asStringValue();
} else
throw new FHIRException("Unknown Data format '"+fmt+"'");
}
private void parseResource(String string, org.w3c.dom.Element container, Element parent) throws Exception {
org.w3c.dom.Element res = XMLUtil.getFirstChild(container);
String name = res.getLocalName();
StructureDefinition sd = context.fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/"+name);
if (sd == null)
throw new FHIRFormatError("Contained resource does not appear to be a FHIR resource (unknown name '"+res.getLocalName()+"')");
parent.updateProperty(new Property(context, sd.getSnapshot().getElement().get(0), sd), parent.getProperty().getName().equals("contained") ? SpecialElement.CONTAINED : SpecialElement.BUNDLE_ENTRY);
parent.setType(name);
parseChildren(res.getLocalName(), res, parent);
}
private void reapComments(org.w3c.dom.Element element, Element context) {
Node node = element.getPreviousSibling();
while (node != null && node.getNodeType() != Node.ELEMENT_NODE) {
if (node.getNodeType() == Node.COMMENT_NODE)
context.getComments().add(0, node.getTextContent());
node = node.getPreviousSibling();
}
node = element.getLastChild();
while (node != null && node.getNodeType() != Node.ELEMENT_NODE) {
node = node.getPreviousSibling();
}
while (node != null) {
if (node.getNodeType() == Node.COMMENT_NODE)
context.getComments().add(node.getTextContent());
node = node.getNextSibling();
}
}
private boolean isAttr(Property property) {
for (Enumeration<PropertyRepresentation> r : property.getDefinition().getRepresentation()) {
if (r.getValue() == PropertyRepresentation.XMLATTR) {
return true;
}
}
return false;
}
private boolean isText(Property property) {
for (Enumeration<PropertyRepresentation> r : property.getDefinition().getRepresentation()) {
if (r.getValue() == PropertyRepresentation.XMLTEXT) {
return true;
}
}
return false;
}
@Override
public void compose(Element e, OutputStream stream, OutputStyle style, String base) throws Exception {
XMLWriter xml = new XMLWriter(stream, "UTF-8");
xml.setPretty(style == OutputStyle.PRETTY);
xml.start();
xml.setDefaultNamespace(e.getProperty().getNamespace());
composeElement(xml, e, e.getType());
xml.end();
}
private void composeElement(XMLWriter xml, Element element, String elementName) throws IOException {
for (String s : element.getComments()) {
xml.comment(s, true);
}
if (isText(element.getProperty())) {
xml.enter(elementName);
xml.text(element.getValue());
xml.exit(elementName);
} else if (element.isPrimitive() || (element.hasType() && ParserBase.isPrimitive(element.getType()))) {
if (element.getType().equals("xhtml")) {
xml.escapedText(element.getValue());
} else if (isText(element.getProperty())) {
xml.text(element.getValue());
} else {
if (element.hasValue())
xml.attribute("value", element.getValue());
if (element.hasChildren()) {
xml.enter(elementName);
for (Element child : element.getChildren())
composeElement(xml, child, child.getName());
xml.exit(elementName);
} else
xml.element(elementName);
}
} else {
for (Element child : element.getChildren()) {
if (isAttr(child.getProperty()))
xml.attribute(child.getName(), child.getValue());
}
xml.enter(elementName);
if (element.getSpecial() != null)
xml.enter(element.getType());
for (Element child : element.getChildren()) {
if (isText(child.getProperty()))
xml.text(child.getValue());
else if (!isAttr(child.getProperty()))
composeElement(xml, child, child.getName());
}
if (element.getSpecial() != null)
xml.exit(element.getType());
xml.exit(elementName);
}
}
}

View File

@ -1,88 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* 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

@ -1,349 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.Date;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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=false)
@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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Type
case 3560141: /*time*/ return this.time == null ? new Base[0] : new Base[] {this.time}; // DateTimeType
case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1406328437: // author
this.author = (Type) value; // Type
break;
case 3560141: // time
this.time = castToDateTime(value); // DateTimeType
break;
case 3556653: // text
this.text = castToString(value); // StringType
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 1475597077: return getAuthor(); // Type
case 3560141: throw new FHIRException("Cannot make property time as it is not a complex type"); // DateTimeType
case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType
default: return super.makeProperty(hash, name);
}
}
@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

@ -1,858 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
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.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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 {
/**
* 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 CodeType 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 = -1645343660L;
/**
* Constructor
*/
public AppointmentResponse() {
super();
}
/**
* Constructor
*/
public AppointmentResponse(Reference appointment, CodeType 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 CodeType getParticipantStatusElement() {
if (this.participantStatus == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create AppointmentResponse.participantStatus");
else if (Configuration.doAutoCreate())
this.participantStatus = new CodeType(); // 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(CodeType 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 String 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(String value) {
if (this.participantStatus == null)
this.participantStatus = new CodeType();
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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case -1474995297: /*appointment*/ return this.appointment == null ? new Base[0] : new Base[] {this.appointment}; // Reference
case 109757538: /*start*/ return this.start == null ? new Base[0] : new Base[] {this.start}; // InstantType
case 100571: /*end*/ return this.end == null ? new Base[0] : new Base[] {this.end}; // InstantType
case 841294093: /*participantType*/ return this.participantType == null ? new Base[0] : this.participantType.toArray(new Base[this.participantType.size()]); // CodeableConcept
case 92645877: /*actor*/ return this.actor == null ? new Base[0] : new Base[] {this.actor}; // Reference
case 996096261: /*participantStatus*/ return this.participantStatus == null ? new Base[0] : new Base[] {this.participantStatus}; // CodeType
case 950398559: /*comment*/ return this.comment == null ? new Base[0] : new Base[] {this.comment}; // StringType
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
break;
case -1474995297: // appointment
this.appointment = castToReference(value); // Reference
break;
case 109757538: // start
this.start = castToInstant(value); // InstantType
break;
case 100571: // end
this.end = castToInstant(value); // InstantType
break;
case 841294093: // participantType
this.getParticipantType().add(castToCodeableConcept(value)); // CodeableConcept
break;
case 92645877: // actor
this.actor = castToReference(value); // Reference
break;
case 996096261: // participantStatus
this.participantStatus = castToCode(value); // CodeType
break;
case 950398559: // comment
this.comment = castToString(value); // StringType
break;
default: super.setProperty(hash, name, value);
}
}
@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 = castToCode(value); // CodeType
else if (name.equals("comment"))
this.comment = castToString(value); // StringType
else
super.setProperty(name, value);
}
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return addIdentifier(); // Identifier
case -1474995297: return getAppointment(); // Reference
case 109757538: throw new FHIRException("Cannot make property start as it is not a complex type"); // InstantType
case 100571: throw new FHIRException("Cannot make property end as it is not a complex type"); // InstantType
case 841294093: return addParticipantType(); // CodeableConcept
case 92645877: return getActor(); // Reference
case 996096261: throw new FHIRException("Cannot make property participantStatus as it is not a complex type"); // CodeType
case 950398559: throw new FHIRException("Cannot make property comment as it is not a complex type"); // StringType
default: return super.makeProperty(hash, name);
}
}
@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;
}
/**
* Search parameter: <b>patient</b>
* <p>
* Description: <b>This Response is for this Patient</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
@SearchParamDefinition(name="patient", path="AppointmentResponse.actor", description="This Response is for this Patient", type="reference" )
public static final String SP_PATIENT = "patient";
/**
* <b>Fluent Client</b> search parameter constant for <b>patient</b>
* <p>
* Description: <b>This Response is for this Patient</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>AppointmentResponse:patient</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("AppointmentResponse:patient").toLocked();
/**
* Search parameter: <b>practitioner</b>
* <p>
* Description: <b>This Response is for this Practitioner</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
@SearchParamDefinition(name="practitioner", path="AppointmentResponse.actor", description="This Response is for this Practitioner", type="reference" )
public static final String SP_PRACTITIONER = "practitioner";
/**
* <b>Fluent Client</b> search parameter constant for <b>practitioner</b>
* <p>
* Description: <b>This Response is for this Practitioner</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PRACTITIONER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PRACTITIONER);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>AppointmentResponse:practitioner</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PRACTITIONER = new ca.uhn.fhir.model.api.Include("AppointmentResponse:practitioner").toLocked();
/**
* Search parameter: <b>location</b>
* <p>
* Description: <b>This Response is for this Location</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
@SearchParamDefinition(name="location", path="AppointmentResponse.actor", description="This Response is for this Location", type="reference" )
public static final String SP_LOCATION = "location";
/**
* <b>Fluent Client</b> search parameter constant for <b>location</b>
* <p>
* Description: <b>This Response is for this Location</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam LOCATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_LOCATION);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>AppointmentResponse:location</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_LOCATION = new ca.uhn.fhir.model.api.Include("AppointmentResponse:location").toLocked();
/**
* Search parameter: <b>part-status</b>
* <p>
* Description: <b>The participants acceptance status for this appointment</b><br>
* Type: <b>token</b><br>
* Path: <b>AppointmentResponse.participantStatus</b><br>
* </p>
*/
@SearchParamDefinition(name="part-status", path="AppointmentResponse.participantStatus", description="The participants acceptance status for this appointment", type="token" )
public static final String SP_PART_STATUS = "part-status";
/**
* <b>Fluent Client</b> search parameter constant for <b>part-status</b>
* <p>
* Description: <b>The participants acceptance status for this appointment</b><br>
* Type: <b>token</b><br>
* Path: <b>AppointmentResponse.participantStatus</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam PART_STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PART_STATUS);
/**
* Search parameter: <b>actor</b>
* <p>
* Description: <b>The Person, Location/HealthcareService or Device that this appointment response replies for</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
@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";
/**
* <b>Fluent Client</b> search parameter constant for <b>actor</b>
* <p>
* Description: <b>The Person, Location/HealthcareService or Device that this appointment response replies for</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.actor</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ACTOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ACTOR);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>AppointmentResponse:actor</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_ACTOR = new ca.uhn.fhir.model.api.Include("AppointmentResponse:actor").toLocked();
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>An Identifier in this appointment response</b><br>
* Type: <b>token</b><br>
* Path: <b>AppointmentResponse.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="AppointmentResponse.identifier", description="An Identifier in this appointment response", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>An Identifier in this appointment response</b><br>
* Type: <b>token</b><br>
* Path: <b>AppointmentResponse.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
/**
* Search parameter: <b>appointment</b>
* <p>
* Description: <b>The appointment that the response is attached to</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.appointment</b><br>
* </p>
*/
@SearchParamDefinition(name="appointment", path="AppointmentResponse.appointment", description="The appointment that the response is attached to", type="reference" )
public static final String SP_APPOINTMENT = "appointment";
/**
* <b>Fluent Client</b> search parameter constant for <b>appointment</b>
* <p>
* Description: <b>The appointment that the response is attached to</b><br>
* Type: <b>reference</b><br>
* Path: <b>AppointmentResponse.appointment</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam APPOINTMENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_APPOINTMENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>AppointmentResponse:appointment</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_APPOINTMENT = new ca.uhn.fhir.model.api.Include("AppointmentResponse:appointment").toLocked();
}

View File

@ -1,688 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.Date;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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=false)
@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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeType
case 3076010: /*data*/ return this.data == null ? new Base[0] : new Base[] {this.data}; // Base64BinaryType
case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
case 3530753: /*size*/ return this.size == null ? new Base[0] : new Base[] {this.size}; // UnsignedIntType
case 3195150: /*hash*/ return this.hash == null ? new Base[0] : new Base[] {this.hash}; // Base64BinaryType
case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
case 1820421855: /*creation*/ return this.creation == null ? new Base[0] : new Base[] {this.creation}; // DateTimeType
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -389131437: // contentType
this.contentType = castToCode(value); // CodeType
break;
case -1613589672: // language
this.language = castToCode(value); // CodeType
break;
case 3076010: // data
this.data = castToBase64Binary(value); // Base64BinaryType
break;
case 116079: // url
this.url = castToUri(value); // UriType
break;
case 3530753: // size
this.size = castToUnsignedInt(value); // UnsignedIntType
break;
case 3195150: // hash
this.hash = castToBase64Binary(value); // Base64BinaryType
break;
case 110371416: // title
this.title = castToString(value); // StringType
break;
case 1820421855: // creation
this.creation = castToDateTime(value); // DateTimeType
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -389131437: throw new FHIRException("Cannot make property contentType as it is not a complex type"); // CodeType
case -1613589672: throw new FHIRException("Cannot make property language as it is not a complex type"); // CodeType
case 3076010: throw new FHIRException("Cannot make property data as it is not a complex type"); // Base64BinaryType
case 116079: throw new FHIRException("Cannot make property url as it is not a complex type"); // UriType
case 3530753: throw new FHIRException("Cannot make property size as it is not a complex type"); // UnsignedIntType
case 3195150: throw new FHIRException("Cannot make property hash as it is not a complex type"); // Base64BinaryType
case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
case 1820421855: throw new FHIRException("Cannot make property creation as it is not a complex type"); // DateTimeType
default: return super.makeProperty(hash, name);
}
}
@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

@ -1,196 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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=true)
@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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -298878168: /*modifierExtension*/ return this.modifierExtension == null ? new Base[0] : this.modifierExtension.toArray(new Base[this.modifierExtension.size()]); // Extension
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -298878168: // modifierExtension
this.getModifierExtension().add(castToExtension(value)); // Extension
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -298878168: return addModifierExtension(); // Extension
default: return super.makeProperty(hash, name);
}
}
@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) {
super.copyValues(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

@ -1,609 +0,0 @@
package org.hl7.fhir.dstu2016may.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 3 allow evaluation engines to get access to primitive values
public boolean isPrimitive() {
return false;
}
public boolean hasPrimitiveValue() {
return isPrimitive();
}
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) throws FHIRException {
List<Base> result = new ArrayList<Base>();
for (Base b : listChildrenByName(name, true))
if (b != null)
result.add(b);
return result;
}
public Base[] listChildrenByName(String name, boolean checkValid) throws FHIRException {
if (name.equals("*")) {
List<Property> children = new ArrayList<Property>();
listChildren(children);
List<Base> result = new ArrayList<Base>();
for (Property c : children)
if (name.equals("*") || c.getName().equals(name) || (c.getName().endsWith("[x]") && c.getName().startsWith(name)))
result.addAll(c.getValues());
return result.toArray(new Base[result.size()]);
}
else
return getProperty(name.hashCode(), name, checkValid);
}
public boolean isEmpty() {
return true; // userData does not count
}
public boolean equalsDeep(Base other) {
return other == this;
}
public boolean equalsShallow(Base other) {
return other == this;
}
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 if (b.hasPrimitiveValue())
return new StringType(b.primitiveValue());
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 if (b.hasPrimitiveValue())
return new UriType(b.primitiveValue());
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 if (b.hasPrimitiveValue())
return new DateType(b.primitiveValue());
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 if (b.fhirType().equals("dateTime"))
return new DateTimeType(b.primitiveValue());
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 if (b.isPrimitive())
return new CodeType(b.primitiveValue());
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");
}
public ModuleMetadata castToModuleMetadata(Base b) throws FHIRException {
if (b instanceof ModuleMetadata)
return (ModuleMetadata) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a ModuleMetadata");
}
public ActionDefinition castToActionDefinition(Base b) throws FHIRException {
if (b instanceof ActionDefinition)
return (ActionDefinition) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a ActionDefinition");
}
public DataRequirement castToDataRequirement(Base b) throws FHIRException {
if (b instanceof DataRequirement)
return (DataRequirement) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a DataRequirement");
}
public ParameterDefinition castToParameterDefinition(Base b) throws FHIRException {
if (b instanceof ParameterDefinition)
return (ParameterDefinition) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a ParameterDefinition");
}
public TriggerDefinition castToTriggerDefinition(Base b) throws FHIRException {
if (b instanceof TriggerDefinition)
return (TriggerDefinition) b;
else
throw new FHIRException("Unable to convert a "+b.getClass().getName()+" to a TriggerDefinition");
}
protected boolean isMetadataBased() {
return false;
}
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
if (checkValid)
throw new FHIRException("Attempt to read invalid property '"+name+"' on type "+fhirType());
return null;
}
public void setProperty(int hash, String name, Base value) throws FHIRException {
throw new FHIRException("Attempt to write to invalid property '"+name+"' on type "+fhirType());
}
public Base makeProperty(int hash, String name) throws FHIRException {
throw new FHIRException("Attempt to make an invalid property '"+name+"' on type "+fhirType());
}
public static boolean equals(String v1, String v2) {
if (v1 == null && v2 == null)
return true;
else if (v1 == null || v2 == null)
return false;
else
return v1.equals(v2);
}
}

View File

@ -1,76 +0,0 @@
/*
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.dstu2016may.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

@ -1,26 +0,0 @@
package org.hl7.fhir.dstu2016may.model;
import org.hl7.fhir.instance.model.api.IBaseBinary;
public abstract class BaseBinary extends Resource implements IBaseBinary {
private static final long serialVersionUID = 1L;
@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

@ -1,743 +0,0 @@
package org.hl7.fhir.dstu2016may.model;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
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;
import ca.uhn.fhir.parser.DataFormatException;
public abstract class BaseDateTimeType extends PrimitiveType<Date> {
private static final long serialVersionUID = 1L;
static final long NANOS_PER_MILLIS = 1000000L;
static final long NANOS_PER_SECOND = 1000000000L;
private static final FastDateFormat ourHumanDateFormat = FastDateFormat.getDateInstance(FastDateFormat.MEDIUM);
private static final FastDateFormat ourHumanDateTimeFormat = FastDateFormat.getDateTimeInstance(FastDateFormat.MEDIUM, FastDateFormat.MEDIUM);
private String myFractionalSeconds;
private TemporalPrecisionEnum myPrecision = null;
private TimeZone myTimeZone;
private boolean myTimeZoneZulu = false;
/**
* Constructor
*/
public BaseDateTimeType() {
// nothing
}
/**
* Constructor
*
* @throws DataFormatException
* 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 DataFormatException("Invalid date/time string (datatype " + getClass().getSimpleName() + " does not support " + thePrecision + " precision): " + theDate);
}
}
/**
* Constructor
*/
public BaseDateTimeType(Date theDate, TemporalPrecisionEnum thePrecision, TimeZone theTimeZone) {
this(theDate, thePrecision);
setTimeZone(theTimeZone);
}
/**
* Constructor
*
* @throws DataFormatException
* If the specified precision is not allowed for this type
*/
public BaseDateTimeType(String theString) {
setValueAsString(theString);
if (isPrecisionAllowed(getPrecision()) == false) {
throw new DataFormatException("Invalid date/time string (datatype " + getClass().getSimpleName() + " does not support " + getPrecision() + " precision): " + theString);
}
}
private void clearTimeZone() {
myTimeZone = null;
myTimeZoneZulu = false;
}
@Override
protected String encode(Date theValue) {
if (theValue == null) {
return null;
} else {
GregorianCalendar cal;
if (myTimeZoneZulu) {
cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
} else if (myTimeZone != null) {
cal = new GregorianCalendar(myTimeZone);
} else {
cal = new GregorianCalendar();
}
cal.setTime(theValue);
StringBuilder b = new StringBuilder();
leftPadWithZeros(cal.get(Calendar.YEAR), 4, b);
if (myPrecision.ordinal() > TemporalPrecisionEnum.YEAR.ordinal()) {
b.append('-');
leftPadWithZeros(cal.get(Calendar.MONTH) + 1, 2, b);
if (myPrecision.ordinal() > TemporalPrecisionEnum.MONTH.ordinal()) {
b.append('-');
leftPadWithZeros(cal.get(Calendar.DATE), 2, b);
if (myPrecision.ordinal() > TemporalPrecisionEnum.DAY.ordinal()) {
b.append('T');
leftPadWithZeros(cal.get(Calendar.HOUR_OF_DAY), 2, b);
b.append(':');
leftPadWithZeros(cal.get(Calendar.MINUTE), 2, b);
if (myPrecision.ordinal() > TemporalPrecisionEnum.MINUTE.ordinal()) {
b.append(':');
leftPadWithZeros(cal.get(Calendar.SECOND), 2, b);
if (myPrecision.ordinal() > TemporalPrecisionEnum.SECOND.ordinal()) {
b.append('.');
b.append(myFractionalSeconds);
for (int i = myFractionalSeconds.length(); i < 3; i++) {
b.append('0');
}
}
}
if (myTimeZoneZulu) {
b.append('Z');
} else if (myTimeZone != null) {
int offset = myTimeZone.getOffset(theValue.getTime());
if (offset >= 0) {
b.append('+');
} else {
b.append('-');
offset = Math.abs(offset);
}
int hoursOffset = (int) (offset / DateUtils.MILLIS_PER_HOUR);
leftPadWithZeros(hoursOffset, 2, b);
b.append(':');
int minutesOffset = (int) (offset % DateUtils.MILLIS_PER_HOUR);
minutesOffset = (int) (minutesOffset / DateUtils.MILLIS_PER_MINUTE);
leftPadWithZeros(minutesOffset, 2, b);
}
}
}
}
return b.toString();
}
}
/**
* Returns the default precision for the given datatype
*/
protected abstract TemporalPrecisionEnum getDefaultPrecisionForDatatype();
private int getOffsetIndex(String theValueString) {
int plusIndex = theValueString.indexOf('+', 16);
int minusIndex = theValueString.indexOf('-', 16);
int zIndex = theValueString.indexOf('Z', 16);
int retVal = Math.max(Math.max(plusIndex, minusIndex), zIndex);
if (retVal == -1) {
return -1;
}
if ((retVal - 2) != (plusIndex + minusIndex + zIndex)) {
throwBadDateFormat(theValueString);
}
return retVal;
}
/**
* 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() {
if (myTimeZoneZulu) {
return TimeZone.getTimeZone("GMT");
}
return myTimeZone;
}
/**
* Returns the value of this object as a {@link GregorianCalendar}
*/
public GregorianCalendar getValueAsCalendar() {
if (getValue() == null) {
return null;
}
GregorianCalendar cal;
if (getTimeZone() != null) {
cal = new GregorianCalendar(getTimeZone());
} else {
cal = new GregorianCalendar();
}
cal.setTime(getValue());
return cal;
}
/**
* To be implemented by subclasses to indicate whether the given precision is allowed by this type
*/
abstract boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision);
/**
* Returns true if the timezone is set to GMT-0:00 (Z)
*/
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());
}
private void leftPadWithZeros(int theInteger, int theLength, StringBuilder theTarget) {
String string = Integer.toString(theInteger);
for (int i = string.length(); i < theLength; i++) {
theTarget.append('0');
}
theTarget.append(string);
}
@Override
protected Date parse(String theValue) throws DataFormatException {
Calendar cal = new GregorianCalendar(0, 0, 0);
cal.setTimeZone(TimeZone.getDefault());
String value = theValue;
boolean fractionalSecondsSet = false;
if (value.length() > 0 && (value.charAt(0) == ' ' || value.charAt(value.length() - 1) == ' ')) {
value = value.trim();
}
int length = value.length();
if (length == 0) {
return null;
}
if (length < 4) {
throwBadDateFormat(value);
}
TemporalPrecisionEnum precision = null;
cal.set(Calendar.YEAR, parseInt(value, value.substring(0, 4), 0, 9999));
precision = TemporalPrecisionEnum.YEAR;
if (length > 4) {
validateCharAtIndexIs(value, 4, '-');
validateLengthIsAtLeast(value, 7);
int monthVal = parseInt(value, value.substring(5, 7), 1, 12) - 1;
cal.set(Calendar.MONTH, monthVal);
precision = TemporalPrecisionEnum.MONTH;
if (length > 7) {
validateCharAtIndexIs(value, 7, '-');
validateLengthIsAtLeast(value, 10);
cal.set(Calendar.DATE, 1); // for some reason getActualMaximum works incorrectly if date isn't set
int actualMaximum = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
cal.set(Calendar.DAY_OF_MONTH, parseInt(value, value.substring(8, 10), 1, actualMaximum));
precision = TemporalPrecisionEnum.DAY;
if (length > 10) {
validateLengthIsAtLeast(value, 17);
validateCharAtIndexIs(value, 10, 'T'); // yyyy-mm-ddThh:mm:ss
int offsetIdx = getOffsetIndex(value);
String time;
if (offsetIdx == -1) {
//throwBadDateFormat(theValue);
// No offset - should this be an error?
time = value.substring(11);
} else {
time = value.substring(11, offsetIdx);
String offsetString = value.substring(offsetIdx);
setTimeZone(value, offsetString);
cal.setTimeZone(getTimeZone());
}
int timeLength = time.length();
validateCharAtIndexIs(value, 13, ':');
cal.set(Calendar.HOUR_OF_DAY, parseInt(value, value.substring(11, 13), 0, 23));
cal.set(Calendar.MINUTE, parseInt(value, value.substring(14, 16), 0, 59));
precision = TemporalPrecisionEnum.MINUTE;
if (timeLength > 5) {
validateLengthIsAtLeast(value, 19);
validateCharAtIndexIs(value, 16, ':'); // yyyy-mm-ddThh:mm:ss
cal.set(Calendar.SECOND, parseInt(value, value.substring(17, 19), 0, 59));
precision = TemporalPrecisionEnum.SECOND;
if (timeLength > 8) {
validateCharAtIndexIs(value, 19, '.'); // yyyy-mm-ddThh:mm:ss.SSSS
validateLengthIsAtLeast(value, 20);
int endIndex = getOffsetIndex(value);
if (endIndex == -1) {
endIndex = value.length();
}
int millis;
String millisString;
if (endIndex > 23) {
myFractionalSeconds = value.substring(20, endIndex);
fractionalSecondsSet = true;
endIndex = 23;
millisString = value.substring(20, endIndex);
millis = parseInt(value, millisString, 0, 999);
} else {
millisString = value.substring(20, endIndex);
millis = parseInt(value, millisString, 0, 999);
myFractionalSeconds = millisString;
fractionalSecondsSet = true;
}
if (millisString.length() == 1) {
millis = millis * 100;
} else if (millisString.length() == 2) {
millis = millis * 10;
}
cal.set(Calendar.MILLISECOND, millis);
precision = TemporalPrecisionEnum.MILLI;
}
}
}
} else {
cal.set(Calendar.DATE, 1);
}
} else {
cal.set(Calendar.DATE, 1);
}
if (fractionalSecondsSet == false) {
myFractionalSeconds = "";
}
myPrecision = precision;
return cal.getTime();
}
private int parseInt(String theValue, String theSubstring, int theLowerBound, int theUpperBound) {
int retVal = 0;
try {
retVal = Integer.parseInt(theSubstring);
} catch (NumberFormatException e) {
throwBadDateFormat(theValue);
}
if (retVal < theLowerBound || retVal > theUpperBound) {
throwBadDateFormat(theValue);
}
return retVal;
}
/**
* Sets the precision for this datatype
*
* @throws DataFormatException
*/
public void setPrecision(TemporalPrecisionEnum thePrecision) throws DataFormatException {
if (thePrecision == null) {
throw new NullPointerException("Precision may not be null");
}
myPrecision = thePrecision;
updateStringValue();
}
private BaseDateTimeType setTimeZone(String theWholeValue, String theValue) {
if (isBlank(theValue)) {
throwBadDateFormat(theWholeValue);
} else if (theValue.charAt(0) == 'Z') {
myTimeZone = null;
myTimeZoneZulu = true;
} else if (theValue.length() != 6) {
throwBadDateFormat(theWholeValue, "Timezone offset must be in the form \"Z\", \"-HH:mm\", or \"+HH:mm\"");
} else if (theValue.charAt(3) != ':' || !(theValue.charAt(0) == '+' || theValue.charAt(0) == '-')) {
throwBadDateFormat(theWholeValue, "Timezone offset must be in the form \"Z\", \"-HH:mm\", or \"+HH:mm\"");
} else {
parseInt(theWholeValue, theValue.substring(1, 3), 0, 23);
parseInt(theWholeValue, theValue.substring(4, 6), 0, 59);
myTimeZoneZulu = false;
myTimeZone = TimeZone.getTimeZone("GMT" + theValue);
}
return this;
}
public BaseDateTimeType setTimeZone(TimeZone theTimeZone) {
myTimeZone = theTimeZone;
myTimeZoneZulu = false;
updateStringValue();
return this;
}
public BaseDateTimeType setTimeZoneZulu(boolean theTimeZoneZulu) {
myTimeZoneZulu = theTimeZoneZulu;
myTimeZone = null;
updateStringValue();
return this;
}
/**
* Sets the value for this type using the given Java Date object as the time, and using the default precision for
* this datatype (unless the precision is already set), as well as the local timezone as determined by the local operating
* system. Both of these properties may be modified in subsequent calls if neccesary.
*/
@Override
public BaseDateTimeType setValue(Date theValue) {
setValue(theValue, getPrecision());
return this;
}
/**
* Sets the value for this type using the given Java Date object as the time, and using the specified precision, as
* well as the local timezone as determined by the local operating system. Both of
* these properties may be modified in subsequent calls if neccesary.
*
* @param theValue
* The date value
* @param thePrecision
* The precision
* @throws DataFormatException
*/
public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException {
if (getTimeZone() == null) {
setTimeZone(TimeZone.getDefault());
}
myPrecision = thePrecision;
myFractionalSeconds = "";
if (theValue != null) {
long millis = theValue.getTime() % 1000;
if (millis < 0) {
// This is for times before 1970 (see bug #444)
millis = 1000 + millis;
}
String fractionalSeconds = Integer.toString((int) millis);
myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0');
}
super.setValue(theValue);
}
@Override
public void setValueAsString(String theValue) throws DataFormatException {
clearTimeZone();
super.setValueAsString(theValue);
}
private void throwBadDateFormat(String theValue) {
throw new DataFormatException("Invalid date/time format: \"" + theValue + "\"");
}
private void throwBadDateFormat(String theValue, String theMesssage) {
throw new DataFormatException("Invalid date/time format: \"" + theValue + "\": " + theMesssage);
}
/**
* 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());
}
}
private void validateCharAtIndexIs(String theValue, int theIndex, char theChar) {
if (theValue.charAt(theIndex) != theChar) {
throwBadDateFormat(theValue, "Expected character '" + theChar + "' at index " + theIndex + " but found " + theValue.charAt(theIndex));
}
}
private void validateLengthIsAtLeast(String theValue, int theLength) {
if (theValue.length() < theLength) {
throwBadDateFormat(theValue);
}
}
/**
* Returns the year, e.g. 2015
*/
public Integer getYear() {
return getFieldValue(Calendar.YEAR);
}
/**
* Returns the month with 0-index, e.g. 0=January
*/
public Integer getMonth() {
return getFieldValue(Calendar.MONTH);
}
/**
* Returns the month with 1-index, e.g. 1=the first day of the month
*/
public Integer getDay() {
return getFieldValue(Calendar.DAY_OF_MONTH);
}
/**
* Returns the hour of the day in a 24h clock, e.g. 13=1pm
*/
public Integer getHour() {
return getFieldValue(Calendar.HOUR_OF_DAY);
}
/**
* Returns the minute of the hour in the range 0-59
*/
public Integer getMinute() {
return getFieldValue(Calendar.MINUTE);
}
/**
* Returns the second of the minute in the range 0-59
*/
public Integer getSecond() {
return getFieldValue(Calendar.SECOND);
}
/**
* Returns the milliseconds within the current second.
* <p>
* Note that this method returns the
* same value as {@link #getNanos()} but with less precision.
* </p>
*/
public Integer getMillis() {
return getFieldValue(Calendar.MILLISECOND);
}
/**
* Returns the nanoseconds within the current second
* <p>
* Note that this method returns the
* same value as {@link #getMillis()} but with more precision.
* </p>
*/
public Long getNanos() {
if (isBlank(myFractionalSeconds)) {
return null;
}
String retVal = StringUtils.rightPad(myFractionalSeconds, 9, '0');
retVal = retVal.substring(0, 9);
return Long.parseLong(retVal);
}
/**
* Sets the year, e.g. 2015
*/
public BaseDateTimeType setYear(int theYear) {
setFieldValue(Calendar.YEAR, theYear, null, 0, 9999);
return this;
}
/**
* Sets the month with 0-index, e.g. 0=January
*/
public BaseDateTimeType setMonth(int theMonth) {
setFieldValue(Calendar.MONTH, theMonth, null, 0, 11);
return this;
}
/**
* Sets the month with 1-index, e.g. 1=the first day of the month
*/
public BaseDateTimeType setDay(int theDay) {
setFieldValue(Calendar.DAY_OF_MONTH, theDay, null, 0, 31);
return this;
}
/**
* Sets the hour of the day in a 24h clock, e.g. 13=1pm
*/
public BaseDateTimeType setHour(int theHour) {
setFieldValue(Calendar.HOUR_OF_DAY, theHour, null, 0, 23);
return this;
}
/**
* Sets the minute of the hour in the range 0-59
*/
public BaseDateTimeType setMinute(int theMinute) {
setFieldValue(Calendar.MINUTE, theMinute, null, 0, 59);
return this;
}
/**
* Sets the second of the minute in the range 0-59
*/
public BaseDateTimeType setSecond(int theSecond) {
setFieldValue(Calendar.SECOND, theSecond, null, 0, 59);
return this;
}
/**
* Sets the milliseconds within the current second.
* <p>
* Note that this method sets the
* same value as {@link #setNanos(long)} but with less precision.
* </p>
*/
public BaseDateTimeType setMillis(int theMillis) {
setFieldValue(Calendar.MILLISECOND, theMillis, null, 0, 999);
return this;
}
/**
* Sets the nanoseconds within the current second
* <p>
* Note that this method sets the
* same value as {@link #setMillis(int)} but with more precision.
* </p>
*/
public BaseDateTimeType setNanos(long theNanos) {
validateValueInRange(theNanos, 0, NANOS_PER_SECOND-1);
String fractionalSeconds = StringUtils.leftPad(Long.toString(theNanos), 9, '0');
// Strip trailing 0s
for (int i = fractionalSeconds.length(); i > 0; i--) {
if (fractionalSeconds.charAt(i-1) != '0') {
fractionalSeconds = fractionalSeconds.substring(0, i);
break;
}
}
int millis = (int)(theNanos / NANOS_PER_MILLIS);
setFieldValue(Calendar.MILLISECOND, millis, fractionalSeconds, 0, 999);
return this;
}
private void setFieldValue(int theField, int theValue, String theFractionalSeconds, int theMinimum, int theMaximum) {
validateValueInRange(theValue, theMinimum, theMaximum);
Calendar cal;
if (getValue() == null) {
cal = new GregorianCalendar(0, 0, 0);
} else {
cal = getValueAsCalendar();
}
if (theField != -1) {
cal.set(theField, theValue);
}
if (theFractionalSeconds != null) {
myFractionalSeconds = theFractionalSeconds;
} else if (theField == Calendar.MILLISECOND) {
myFractionalSeconds = StringUtils.leftPad(Integer.toString(theValue), 3, '0');
}
super.setValue(cal.getTime());
}
private void validateValueInRange(long theValue, long theMinimum, long theMaximum) {
if (theValue < theMinimum || theValue > theMaximum) {
throw new IllegalArgumentException("Value " + theValue + " is not between allowable range: " + theMinimum + " - " + theMaximum);
}
}
private Integer getFieldValue(int theField) {
if (getValue() == null) {
return null;
}
Calendar cal = getValueAsCalendar();
return cal.get(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

@ -1,17 +0,0 @@
package org.hl7.fhir.dstu2016may.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

@ -1,50 +0,0 @@
package org.hl7.fhir.dstu2016may.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();
public abstract Enumeration<?> getStatusElement();
public INarrative setStatusAsString(String theString) {
getStatusElement().setValueAsString(theString);
return this;
}
public String getStatusAsString() {
return getStatusElement().getValueAsString();
}
}

View File

@ -1,68 +0,0 @@
package org.hl7.fhir.dstu2016may.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(IIdType 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.
*/
@Override
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.
*/
@Override
public BaseReference setResource(IBaseResource theResource) {
resource = theResource;
return null;
}
@Override
public boolean isEmpty() {
return resource == null && super.isEmpty();
}
}

View File

@ -1,34 +0,0 @@
package org.hl7.fhir.dstu2016may.model;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IIdType;
import ca.uhn.fhir.context.FhirVersionEnum;
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.
*/
@Override
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);
@Override
public FhirVersionEnum getStructureFhirVersionEnum() {
return FhirVersionEnum.DSTU2_1;
}
}

View File

@ -1,596 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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;
/**
* Identifies when the resource was first created.
*/
@Child(name = "created", type = {DateType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="When created", formalDefinition="Identifies when the resource was first created." )
protected DateType created;
/**
* Indicates who was responsible for creating the resource instance.
*/
@Child(name = "author", type = {Practitioner.class, Patient.class, RelatedPerson.class}, order=4, 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;
private static final long serialVersionUID = 650756402L;
/**
* 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 #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;
}
/**
* @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;
}
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("created", "date", "Identifies when the resource was first created.", 0, java.lang.Integer.MAX_VALUE, created));
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));
}
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateType
case -1406328437: /*author*/ return this.author == null ? new Base[0] : new Base[] {this.author}; // Reference
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
break;
case 3059181: // code
this.code = castToCodeableConcept(value); // CodeableConcept
break;
case -1867885268: // subject
this.subject = castToReference(value); // Reference
break;
case 1028554472: // created
this.created = castToDate(value); // DateType
break;
case -1406328437: // author
this.author = castToReference(value); // Reference
break;
default: super.setProperty(hash, name, value);
}
}
@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("created"))
this.created = castToDate(value); // DateType
else if (name.equals("author"))
this.author = castToReference(value); // Reference
else
super.setProperty(name, value);
}
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return addIdentifier(); // Identifier
case 3059181: return getCode(); // CodeableConcept
case -1867885268: return getSubject(); // Reference
case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateType
case -1406328437: return getAuthor(); // Reference
default: return super.makeProperty(hash, name);
}
}
@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("created")) {
throw new FHIRException("Cannot call addChild on a primitive type Basic.created");
}
else if (name.equals("author")) {
this.author = new Reference();
return this.author;
}
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.created = created == null ? null : created.copy();
dst.author = author == null ? null : author.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(created, o.created, true) && compareDeep(author, o.author, 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()) && (created == null || created.isEmpty()) && (author == null || author.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.Basic;
}
/**
* Search parameter: <b>author</b>
* <p>
* Description: <b>Who created</b><br>
* Type: <b>reference</b><br>
* Path: <b>Basic.author</b><br>
* </p>
*/
@SearchParamDefinition(name="author", path="Basic.author", description="Who created", type="reference" )
public static final String SP_AUTHOR = "author";
/**
* <b>Fluent Client</b> search parameter constant for <b>author</b>
* <p>
* Description: <b>Who created</b><br>
* Type: <b>reference</b><br>
* Path: <b>Basic.author</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam AUTHOR = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_AUTHOR);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Basic:author</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_AUTHOR = new ca.uhn.fhir.model.api.Include("Basic:author").toLocked();
/**
* Search parameter: <b>patient</b>
* <p>
* Description: <b>Identifies the focus of this resource</b><br>
* Type: <b>reference</b><br>
* Path: <b>Basic.subject</b><br>
* </p>
*/
@SearchParamDefinition(name="patient", path="Basic.subject", description="Identifies the focus of this resource", type="reference" )
public static final String SP_PATIENT = "patient";
/**
* <b>Fluent Client</b> search parameter constant for <b>patient</b>
* <p>
* Description: <b>Identifies the focus of this resource</b><br>
* Type: <b>reference</b><br>
* Path: <b>Basic.subject</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Basic:patient</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Basic:patient").toLocked();
/**
* Search parameter: <b>created</b>
* <p>
* Description: <b>When created</b><br>
* Type: <b>date</b><br>
* Path: <b>Basic.created</b><br>
* </p>
*/
@SearchParamDefinition(name="created", path="Basic.created", description="When created", type="date" )
public static final String SP_CREATED = "created";
/**
* <b>Fluent Client</b> search parameter constant for <b>created</b>
* <p>
* Description: <b>When created</b><br>
* Type: <b>date</b><br>
* Path: <b>Basic.created</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
/**
* Search parameter: <b>subject</b>
* <p>
* Description: <b>Identifies the focus of this resource</b><br>
* Type: <b>reference</b><br>
* Path: <b>Basic.subject</b><br>
* </p>
*/
@SearchParamDefinition(name="subject", path="Basic.subject", description="Identifies the focus of this resource", type="reference" )
public static final String SP_SUBJECT = "subject";
/**
* <b>Fluent Client</b> search parameter constant for <b>subject</b>
* <p>
* Description: <b>Identifies the focus of this resource</b><br>
* Type: <b>reference</b><br>
* Path: <b>Basic.subject</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>Basic:subject</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Basic:subject").toLocked();
/**
* Search parameter: <b>code</b>
* <p>
* Description: <b>Kind of Resource</b><br>
* Type: <b>token</b><br>
* Path: <b>Basic.code</b><br>
* </p>
*/
@SearchParamDefinition(name="code", path="Basic.code", description="Kind of Resource", type="token" )
public static final String SP_CODE = "code";
/**
* <b>Fluent Client</b> search parameter constant for <b>code</b>
* <p>
* Description: <b>Kind of Resource</b><br>
* Type: <b>token</b><br>
* Path: <b>Basic.code</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>Business identifier</b><br>
* Type: <b>token</b><br>
* Path: <b>Basic.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="Basic.identifier", description="Business identifier", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>Business identifier</b><br>
* Type: <b>token</b><br>
* Path: <b>Basic.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
}

View File

@ -1,301 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseBinary;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -389131437: /*contentType*/ return this.contentType == null ? new Base[0] : new Base[] {this.contentType}; // CodeType
case 951530617: /*content*/ return this.content == null ? new Base[0] : new Base[] {this.content}; // Base64BinaryType
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -389131437: // contentType
this.contentType = castToCode(value); // CodeType
break;
case 951530617: // content
this.content = castToBase64Binary(value); // Base64BinaryType
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -389131437: throw new FHIRException("Cannot make property contentType as it is not a complex type"); // CodeType
case 951530617: throw new FHIRException("Cannot make property content as it is not a complex type"); // Base64BinaryType
default: return super.makeProperty(hash, name);
}
}
@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;
}
/**
* Search parameter: <b>contenttype</b>
* <p>
* Description: <b>MimeType of the binary content</b><br>
* Type: <b>token</b><br>
* Path: <b>Binary.contentType</b><br>
* </p>
*/
@SearchParamDefinition(name="contenttype", path="Binary.contentType", description="MimeType of the binary content", type="token" )
public static final String SP_CONTENTTYPE = "contenttype";
/**
* <b>Fluent Client</b> search parameter constant for <b>contenttype</b>
* <p>
* Description: <b>MimeType of the binary content</b><br>
* Type: <b>token</b><br>
* Path: <b>Binary.contentType</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam CONTENTTYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CONTENTTYPE);
}

View File

@ -1,592 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
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.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
case 100313435: /*image*/ return this.image == null ? new Base[0] : this.image.toArray(new Base[this.image.size()]); // Attachment
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -791418107: // patient
this.patient = castToReference(value); // Reference
break;
case -1618432855: // identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
break;
case 3059181: // code
this.code = castToCodeableConcept(value); // CodeableConcept
break;
case -615513385: // modifier
this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
break;
case -1724546052: // description
this.description = castToString(value); // StringType
break;
case 100313435: // image
this.getImage().add(castToAttachment(value)); // Attachment
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -791418107: return getPatient(); // Reference
case -1618432855: return addIdentifier(); // Identifier
case 3059181: return getCode(); // CodeableConcept
case -615513385: return addModifier(); // CodeableConcept
case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
case 100313435: return addImage(); // Attachment
default: return super.makeProperty(hash, name);
}
}
@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;
}
/**
* Search parameter: <b>patient</b>
* <p>
* Description: <b>Patient to whom bodysite belongs</b><br>
* Type: <b>reference</b><br>
* Path: <b>BodySite.patient</b><br>
* </p>
*/
@SearchParamDefinition(name="patient", path="BodySite.patient", description="Patient to whom bodysite belongs", type="reference" )
public static final String SP_PATIENT = "patient";
/**
* <b>Fluent Client</b> search parameter constant for <b>patient</b>
* <p>
* Description: <b>Patient to whom bodysite belongs</b><br>
* Type: <b>reference</b><br>
* Path: <b>BodySite.patient</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>BodySite:patient</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("BodySite:patient").toLocked();
/**
* Search parameter: <b>code</b>
* <p>
* Description: <b>Named anatomical location</b><br>
* Type: <b>token</b><br>
* Path: <b>BodySite.code</b><br>
* </p>
*/
@SearchParamDefinition(name="code", path="BodySite.code", description="Named anatomical location", type="token" )
public static final String SP_CODE = "code";
/**
* <b>Fluent Client</b> search parameter constant for <b>code</b>
* <p>
* Description: <b>Named anatomical location</b><br>
* Type: <b>token</b><br>
* Path: <b>BodySite.code</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE);
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>Identifier for this instance of the anatomical location</b><br>
* Type: <b>token</b><br>
* Path: <b>BodySite.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="BodySite.identifier", description="Identifier for this instance of the anatomical location", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>Identifier for this instance of the anatomical location</b><br>
* Type: <b>token</b><br>
* Path: <b>BodySite.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
}

View File

@ -1,102 +0,0 @@
/*
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.dstu2016may.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);
}
/**
* Returns the value of this type as a primitive boolean.
*
* @return Returns the value of this type as a primitive boolean.
* @throws NullPointerException
* If the value is not set
*/
public boolean booleanValue() {
return getValue().booleanValue();
}
public BooleanType copy() {
return new BooleanType(getValue());
}
protected String encode(Boolean theValue) {
if (Boolean.TRUE.equals(theValue)) {
return "true";
} else {
return "false";
}
}
public String fhirType() {
return "boolean";
}
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 + "'");
}
}
}

View File

@ -1,76 +0,0 @@
/*
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.dstu2016may.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

@ -1,271 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1355086998: /*coding*/ return this.coding == null ? new Base[0] : this.coding.toArray(new Base[this.coding.size()]); // Coding
case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1355086998: // coding
this.getCoding().add(castToCoding(value)); // Coding
break;
case 3556653: // text
this.text = castToString(value); // StringType
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1355086998: return addCoding(); // Coding
case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType
default: return super.makeProperty(hash, name);
}
}
@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

@ -1,491 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseCoding;
import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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();
}
/**
* Convenience constructor
*
* @param theSystem The {@link #setSystem(String) code system}
* @param theCode The {@link #setCode(String) code}
* @param theDisplay The {@link #setDisplay(String) human readable display}
*/
public Coding(String theSystem, String theCode, String theDisplay) {
setSystem(theSystem);
setCode(theCode);
setDisplay(theDisplay);
}
/**
* @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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // UriType
case 351608024: /*version*/ return this.version == null ? new Base[0] : new Base[] {this.version}; // StringType
case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeType
case 1671764162: /*display*/ return this.display == null ? new Base[0] : new Base[] {this.display}; // StringType
case 423643014: /*userSelected*/ return this.userSelected == null ? new Base[0] : new Base[] {this.userSelected}; // BooleanType
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -887328209: // system
this.system = castToUri(value); // UriType
break;
case 351608024: // version
this.version = castToString(value); // StringType
break;
case 3059181: // code
this.code = castToCode(value); // CodeType
break;
case 1671764162: // display
this.display = castToString(value); // StringType
break;
case 423643014: // userSelected
this.userSelected = castToBoolean(value); // BooleanType
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -887328209: throw new FHIRException("Cannot make property system as it is not a complex type"); // UriType
case 351608024: throw new FHIRException("Cannot make property version as it is not a complex type"); // StringType
case 3059181: throw new FHIRException("Cannot make property code as it is not a complex type"); // CodeType
case 1671764162: throw new FHIRException("Cannot make property display as it is not a complex type"); // StringType
case 423643014: throw new FHIRException("Cannot make property userSelected as it is not a complex type"); // BooleanType
default: return super.makeProperty(hash, name);
}
}
@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

@ -1,110 +0,0 @@
package org.hl7.fhir.dstu2016may.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

@ -1,106 +0,0 @@
package org.hl7.fhir.dstu2016may.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

@ -1,40 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
public class Constants {
public final static String VERSION = "1.4.0";
public final static String REVISION = "8226";
public final static String DATE = "Sun May 08 03:05:30 AEST 2016";
}

View File

@ -1,724 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.ICompositeType;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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 String toSystem(ContactPointSystem code) {
return code.getSystem();
}
}
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 "?";
}
public String toSystem(ContactPointUse code) {
return code.getSystem();
}
}
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -887328209: /*system*/ return this.system == null ? new Base[0] : new Base[] {this.system}; // Enumeration<ContactPointSystem>
case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // StringType
case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration<ContactPointUse>
case 3492908: /*rank*/ return this.rank == null ? new Base[0] : new Base[] {this.rank}; // PositiveIntType
case -991726143: /*period*/ return this.period == null ? new Base[0] : new Base[] {this.period}; // Period
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -887328209: // system
this.system = new ContactPointSystemEnumFactory().fromType(value); // Enumeration<ContactPointSystem>
break;
case 111972721: // value
this.value = castToString(value); // StringType
break;
case 116103: // use
this.use = new ContactPointUseEnumFactory().fromType(value); // Enumeration<ContactPointUse>
break;
case 3492908: // rank
this.rank = castToPositiveInt(value); // PositiveIntType
break;
case -991726143: // period
this.period = castToPeriod(value); // Period
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -887328209: throw new FHIRException("Cannot make property system as it is not a complex type"); // Enumeration<ContactPointSystem>
case 111972721: throw new FHIRException("Cannot make property value as it is not a complex type"); // StringType
case 116103: throw new FHIRException("Cannot make property use as it is not a complex type"); // Enumeration<ContactPointUse>
case 3492908: throw new FHIRException("Cannot make property rank as it is not a complex type"); // PositiveIntType
case -991726143: return getPeriod(); // Period
default: return super.makeProperty(hash, name);
}
}
@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

@ -1,88 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* 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

@ -1,196 +0,0 @@
/*
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.dstu2016may.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

@ -1,171 +0,0 @@
/*
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.dstu2016may.model;
import java.util.Calendar;
/**
* Primitive type "date" in FHIR: any day in a gregorian calendar
*/
import java.util.Date;
import java.util.GregorianCalendar;
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);
}
/**
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
*/
public DateType(Calendar theCalendar) {
super(theCalendar.getTime(), DEFAULT_PRECISION);
setTimeZone(theCalendar.getTimeZone());
}
/**
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
*
* @param theYear The year, e.g. 2015
* @param theMonth The month, e.g. 0 for January
* @param theDay The day (1 indexed) e.g. 1 for the first day of the month
*/
public DateType(int theYear, int theMonth, int theDay) {
this(toCalendarZulu(theYear, theMonth, theDay));
}
private static GregorianCalendar toCalendarZulu(int theYear, int theMonth, int theDay) {
GregorianCalendar retVal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
retVal.set(Calendar.YEAR, theYear);
retVal.set(Calendar.MONTH, theMonth);
retVal.set(Calendar.DATE, theDay);
return retVal;
}
@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(getValueAsString());
}
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

@ -1,177 +0,0 @@
/*
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.dstu2016may.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

@ -1,595 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
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.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* This resource defines a decision support rule of the form [on Event] if Condition then Action. It is intended to be a shareable, computable definition of a actions that should be taken whenever some condition is met in response to a particular event or events.
*/
@ResourceDef(name="DecisionSupportRule", profile="http://hl7.org/fhir/Profile/DecisionSupportRule")
public class DecisionSupportRule extends DomainResource {
/**
* The metadata for the decision support rule, including publishing, life-cycle, version, documentation, and supporting evidence.
*/
@Child(name = "moduleMetadata", type = {ModuleMetadata.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Module information for the rule", formalDefinition="The metadata for the decision support rule, including publishing, life-cycle, version, documentation, and supporting evidence." )
protected ModuleMetadata moduleMetadata;
/**
* A reference to a Library containing the formal logic used by the rule.
*/
@Child(name = "library", type = {Library.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Logic used within the rule", formalDefinition="A reference to a Library containing the formal logic used by the rule." )
protected List<Reference> library;
/**
* The actual objects that are the target of the reference (A reference to a Library containing the formal logic used by the rule.)
*/
protected List<Library> libraryTarget;
/**
* The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.
*/
@Child(name = "trigger", type = {TriggerDefinition.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="\"when\" the rule should be invoked", formalDefinition="The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow." )
protected List<TriggerDefinition> trigger;
/**
* The condition element describes he "if" portion of the rule that determines whether or not the rule "fires". The condition must be the name of an expression in a referenced library.
*/
@Child(name = "condition", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="\"if\" some condition is true", formalDefinition="The condition element describes he \"if\" portion of the rule that determines whether or not the rule \"fires\". The condition must be the name of an expression in a referenced library." )
protected StringType condition;
/**
* The action element defines the "when" portion of the rule that determines what actions should be performed if the condition evaluates to true.
*/
@Child(name = "action", type = {ActionDefinition.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="\"then\" perform these actions", formalDefinition="The action element defines the \"when\" portion of the rule that determines what actions should be performed if the condition evaluates to true." )
protected List<ActionDefinition> action;
private static final long serialVersionUID = -810482843L;
/**
* Constructor
*/
public DecisionSupportRule() {
super();
}
/**
* @return {@link #moduleMetadata} (The metadata for the decision support rule, including publishing, life-cycle, version, documentation, and supporting evidence.)
*/
public ModuleMetadata getModuleMetadata() {
if (this.moduleMetadata == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DecisionSupportRule.moduleMetadata");
else if (Configuration.doAutoCreate())
this.moduleMetadata = new ModuleMetadata(); // cc
return this.moduleMetadata;
}
public boolean hasModuleMetadata() {
return this.moduleMetadata != null && !this.moduleMetadata.isEmpty();
}
/**
* @param value {@link #moduleMetadata} (The metadata for the decision support rule, including publishing, life-cycle, version, documentation, and supporting evidence.)
*/
public DecisionSupportRule setModuleMetadata(ModuleMetadata value) {
this.moduleMetadata = value;
return this;
}
/**
* @return {@link #library} (A reference to a Library containing the formal logic used by the rule.)
*/
public List<Reference> getLibrary() {
if (this.library == null)
this.library = new ArrayList<Reference>();
return this.library;
}
public boolean hasLibrary() {
if (this.library == null)
return false;
for (Reference item : this.library)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #library} (A reference to a Library containing the formal logic used by the rule.)
*/
// syntactic sugar
public Reference addLibrary() { //3
Reference t = new Reference();
if (this.library == null)
this.library = new ArrayList<Reference>();
this.library.add(t);
return t;
}
// syntactic sugar
public DecisionSupportRule addLibrary(Reference t) { //3
if (t == null)
return this;
if (this.library == null)
this.library = new ArrayList<Reference>();
this.library.add(t);
return this;
}
/**
* @return {@link #library} (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. A reference to a Library containing the formal logic used by the rule.)
*/
public List<Library> getLibraryTarget() {
if (this.libraryTarget == null)
this.libraryTarget = new ArrayList<Library>();
return this.libraryTarget;
}
// syntactic sugar
/**
* @return {@link #library} (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. A reference to a Library containing the formal logic used by the rule.)
*/
public Library addLibraryTarget() {
Library r = new Library();
if (this.libraryTarget == null)
this.libraryTarget = new ArrayList<Library>();
this.libraryTarget.add(r);
return r;
}
/**
* @return {@link #trigger} (The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.)
*/
public List<TriggerDefinition> getTrigger() {
if (this.trigger == null)
this.trigger = new ArrayList<TriggerDefinition>();
return this.trigger;
}
public boolean hasTrigger() {
if (this.trigger == null)
return false;
for (TriggerDefinition item : this.trigger)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #trigger} (The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.)
*/
// syntactic sugar
public TriggerDefinition addTrigger() { //3
TriggerDefinition t = new TriggerDefinition();
if (this.trigger == null)
this.trigger = new ArrayList<TriggerDefinition>();
this.trigger.add(t);
return t;
}
// syntactic sugar
public DecisionSupportRule addTrigger(TriggerDefinition t) { //3
if (t == null)
return this;
if (this.trigger == null)
this.trigger = new ArrayList<TriggerDefinition>();
this.trigger.add(t);
return this;
}
/**
* @return {@link #condition} (The condition element describes he "if" portion of the rule that determines whether or not the rule "fires". The condition must be the name of an expression in a referenced library.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
*/
public StringType getConditionElement() {
if (this.condition == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DecisionSupportRule.condition");
else if (Configuration.doAutoCreate())
this.condition = new StringType(); // bb
return this.condition;
}
public boolean hasConditionElement() {
return this.condition != null && !this.condition.isEmpty();
}
public boolean hasCondition() {
return this.condition != null && !this.condition.isEmpty();
}
/**
* @param value {@link #condition} (The condition element describes he "if" portion of the rule that determines whether or not the rule "fires". The condition must be the name of an expression in a referenced library.). This is the underlying object with id, value and extensions. The accessor "getCondition" gives direct access to the value
*/
public DecisionSupportRule setConditionElement(StringType value) {
this.condition = value;
return this;
}
/**
* @return The condition element describes he "if" portion of the rule that determines whether or not the rule "fires". The condition must be the name of an expression in a referenced library.
*/
public String getCondition() {
return this.condition == null ? null : this.condition.getValue();
}
/**
* @param value The condition element describes he "if" portion of the rule that determines whether or not the rule "fires". The condition must be the name of an expression in a referenced library.
*/
public DecisionSupportRule setCondition(String value) {
if (Utilities.noString(value))
this.condition = null;
else {
if (this.condition == null)
this.condition = new StringType();
this.condition.setValue(value);
}
return this;
}
/**
* @return {@link #action} (The action element defines the "when" portion of the rule that determines what actions should be performed if the condition evaluates to true.)
*/
public List<ActionDefinition> getAction() {
if (this.action == null)
this.action = new ArrayList<ActionDefinition>();
return this.action;
}
public boolean hasAction() {
if (this.action == null)
return false;
for (ActionDefinition item : this.action)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #action} (The action element defines the "when" portion of the rule that determines what actions should be performed if the condition evaluates to true.)
*/
// syntactic sugar
public ActionDefinition addAction() { //3
ActionDefinition t = new ActionDefinition();
if (this.action == null)
this.action = new ArrayList<ActionDefinition>();
this.action.add(t);
return t;
}
// syntactic sugar
public DecisionSupportRule addAction(ActionDefinition t) { //3
if (t == null)
return this;
if (this.action == null)
this.action = new ArrayList<ActionDefinition>();
this.action.add(t);
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("moduleMetadata", "ModuleMetadata", "The metadata for the decision support rule, including publishing, life-cycle, version, documentation, and supporting evidence.", 0, java.lang.Integer.MAX_VALUE, moduleMetadata));
childrenList.add(new Property("library", "Reference(Library)", "A reference to a Library containing the formal logic used by the rule.", 0, java.lang.Integer.MAX_VALUE, library));
childrenList.add(new Property("trigger", "TriggerDefinition", "The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.", 0, java.lang.Integer.MAX_VALUE, trigger));
childrenList.add(new Property("condition", "string", "The condition element describes he \"if\" portion of the rule that determines whether or not the rule \"fires\". The condition must be the name of an expression in a referenced library.", 0, java.lang.Integer.MAX_VALUE, condition));
childrenList.add(new Property("action", "ActionDefinition", "The action element defines the \"when\" portion of the rule that determines what actions should be performed if the condition evaluates to true.", 0, java.lang.Integer.MAX_VALUE, action));
}
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 455891387: /*moduleMetadata*/ return this.moduleMetadata == null ? new Base[0] : new Base[] {this.moduleMetadata}; // ModuleMetadata
case 166208699: /*library*/ return this.library == null ? new Base[0] : this.library.toArray(new Base[this.library.size()]); // Reference
case -1059891784: /*trigger*/ return this.trigger == null ? new Base[0] : this.trigger.toArray(new Base[this.trigger.size()]); // TriggerDefinition
case -861311717: /*condition*/ return this.condition == null ? new Base[0] : new Base[] {this.condition}; // StringType
case -1422950858: /*action*/ return this.action == null ? new Base[0] : this.action.toArray(new Base[this.action.size()]); // ActionDefinition
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 455891387: // moduleMetadata
this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
break;
case 166208699: // library
this.getLibrary().add(castToReference(value)); // Reference
break;
case -1059891784: // trigger
this.getTrigger().add(castToTriggerDefinition(value)); // TriggerDefinition
break;
case -861311717: // condition
this.condition = castToString(value); // StringType
break;
case -1422950858: // action
this.getAction().add(castToActionDefinition(value)); // ActionDefinition
break;
default: super.setProperty(hash, name, value);
}
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("moduleMetadata"))
this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
else if (name.equals("library"))
this.getLibrary().add(castToReference(value));
else if (name.equals("trigger"))
this.getTrigger().add(castToTriggerDefinition(value));
else if (name.equals("condition"))
this.condition = castToString(value); // StringType
else if (name.equals("action"))
this.getAction().add(castToActionDefinition(value));
else
super.setProperty(name, value);
}
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 455891387: return getModuleMetadata(); // ModuleMetadata
case 166208699: return addLibrary(); // Reference
case -1059891784: return addTrigger(); // TriggerDefinition
case -861311717: throw new FHIRException("Cannot make property condition as it is not a complex type"); // StringType
case -1422950858: return addAction(); // ActionDefinition
default: return super.makeProperty(hash, name);
}
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("moduleMetadata")) {
this.moduleMetadata = new ModuleMetadata();
return this.moduleMetadata;
}
else if (name.equals("library")) {
return addLibrary();
}
else if (name.equals("trigger")) {
return addTrigger();
}
else if (name.equals("condition")) {
throw new FHIRException("Cannot call addChild on a primitive type DecisionSupportRule.condition");
}
else if (name.equals("action")) {
return addAction();
}
else
return super.addChild(name);
}
public String fhirType() {
return "DecisionSupportRule";
}
public DecisionSupportRule copy() {
DecisionSupportRule dst = new DecisionSupportRule();
copyValues(dst);
dst.moduleMetadata = moduleMetadata == null ? null : moduleMetadata.copy();
if (library != null) {
dst.library = new ArrayList<Reference>();
for (Reference i : library)
dst.library.add(i.copy());
};
if (trigger != null) {
dst.trigger = new ArrayList<TriggerDefinition>();
for (TriggerDefinition i : trigger)
dst.trigger.add(i.copy());
};
dst.condition = condition == null ? null : condition.copy();
if (action != null) {
dst.action = new ArrayList<ActionDefinition>();
for (ActionDefinition i : action)
dst.action.add(i.copy());
};
return dst;
}
protected DecisionSupportRule typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof DecisionSupportRule))
return false;
DecisionSupportRule o = (DecisionSupportRule) other;
return compareDeep(moduleMetadata, o.moduleMetadata, true) && compareDeep(library, o.library, true)
&& compareDeep(trigger, o.trigger, true) && compareDeep(condition, o.condition, true) && compareDeep(action, o.action, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof DecisionSupportRule))
return false;
DecisionSupportRule o = (DecisionSupportRule) other;
return compareValues(condition, o.condition, true);
}
public boolean isEmpty() {
return super.isEmpty() && (moduleMetadata == null || moduleMetadata.isEmpty()) && (library == null || library.isEmpty())
&& (trigger == null || trigger.isEmpty()) && (condition == null || condition.isEmpty()) && (action == null || action.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.DecisionSupportRule;
}
/**
* Search parameter: <b>topic</b>
* <p>
* Description: <b>Topics associated with the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.topic</b><br>
* </p>
*/
@SearchParamDefinition(name="topic", path="DecisionSupportRule.moduleMetadata.topic", description="Topics associated with the module", type="token" )
public static final String SP_TOPIC = "topic";
/**
* <b>Fluent Client</b> search parameter constant for <b>topic</b>
* <p>
* Description: <b>Topics associated with the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.topic</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam TOPIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TOPIC);
/**
* Search parameter: <b>title</b>
* <p>
* Description: <b>Text search against the title</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.title</b><br>
* </p>
*/
@SearchParamDefinition(name="title", path="DecisionSupportRule.moduleMetadata.title", description="Text search against the title", type="string" )
public static final String SP_TITLE = "title";
/**
* <b>Fluent Client</b> search parameter constant for <b>title</b>
* <p>
* Description: <b>Text search against the title</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.title</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
/**
* Search parameter: <b>status</b>
* <p>
* Description: <b>Status of the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.status</b><br>
* </p>
*/
@SearchParamDefinition(name="status", path="DecisionSupportRule.moduleMetadata.status", description="Status of the module", type="token" )
public static final String SP_STATUS = "status";
/**
* <b>Fluent Client</b> search parameter constant for <b>status</b>
* <p>
* Description: <b>Status of the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.status</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
/**
* Search parameter: <b>description</b>
* <p>
* Description: <b>Text search against the description</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.description</b><br>
* </p>
*/
@SearchParamDefinition(name="description", path="DecisionSupportRule.moduleMetadata.description", description="Text search against the description", type="string" )
public static final String SP_DESCRIPTION = "description";
/**
* <b>Fluent Client</b> search parameter constant for <b>description</b>
* <p>
* Description: <b>Text search against the description</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.description</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="DecisionSupportRule.moduleMetadata.identifier", description="Logical identifier for the module (e.g. CMS-143)", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
/**
* Search parameter: <b>version</b>
* <p>
* Description: <b>Version of the module (e.g. 1.0.0)</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.version</b><br>
* </p>
*/
@SearchParamDefinition(name="version", path="DecisionSupportRule.moduleMetadata.version", description="Version of the module (e.g. 1.0.0)", type="string" )
public static final String SP_VERSION = "version";
/**
* <b>Fluent Client</b> search parameter constant for <b>version</b>
* <p>
* Description: <b>Version of the module (e.g. 1.0.0)</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportRule.moduleMetadata.version</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.StringClientParam VERSION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_VERSION);
}

View File

@ -1,500 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* The DecisionSupportServiceModule describes a unit of decision support functionality that is made available as a service, such as immunization modules or drug-drug interaction checking.
*/
@ResourceDef(name="DecisionSupportServiceModule", profile="http://hl7.org/fhir/Profile/DecisionSupportServiceModule")
public class DecisionSupportServiceModule extends DomainResource {
/**
* The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.
*/
@Child(name = "moduleMetadata", type = {ModuleMetadata.class}, order=0, min=0, max=1, modifier=false, summary=true)
@Description(shortDefinition="Metadata for the service module", formalDefinition="The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence." )
protected ModuleMetadata moduleMetadata;
/**
* The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.
*/
@Child(name = "trigger", type = {TriggerDefinition.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="\"when\" the module should be invoked", formalDefinition="The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow." )
protected List<TriggerDefinition> trigger;
/**
* The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.
*/
@Child(name = "parameter", type = {ParameterDefinition.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Parameters to the module", formalDefinition="The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse." )
protected List<ParameterDefinition> parameter;
/**
* Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.
*/
@Child(name = "dataRequirement", type = {DataRequirement.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
@Description(shortDefinition="Data requirements for the module", formalDefinition="Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation." )
protected List<DataRequirement> dataRequirement;
private static final long serialVersionUID = 1154664442L;
/**
* Constructor
*/
public DecisionSupportServiceModule() {
super();
}
/**
* @return {@link #moduleMetadata} (The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.)
*/
public ModuleMetadata getModuleMetadata() {
if (this.moduleMetadata == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create DecisionSupportServiceModule.moduleMetadata");
else if (Configuration.doAutoCreate())
this.moduleMetadata = new ModuleMetadata(); // cc
return this.moduleMetadata;
}
public boolean hasModuleMetadata() {
return this.moduleMetadata != null && !this.moduleMetadata.isEmpty();
}
/**
* @param value {@link #moduleMetadata} (The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.)
*/
public DecisionSupportServiceModule setModuleMetadata(ModuleMetadata value) {
this.moduleMetadata = value;
return this;
}
/**
* @return {@link #trigger} (The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.)
*/
public List<TriggerDefinition> getTrigger() {
if (this.trigger == null)
this.trigger = new ArrayList<TriggerDefinition>();
return this.trigger;
}
public boolean hasTrigger() {
if (this.trigger == null)
return false;
for (TriggerDefinition item : this.trigger)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #trigger} (The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.)
*/
// syntactic sugar
public TriggerDefinition addTrigger() { //3
TriggerDefinition t = new TriggerDefinition();
if (this.trigger == null)
this.trigger = new ArrayList<TriggerDefinition>();
this.trigger.add(t);
return t;
}
// syntactic sugar
public DecisionSupportServiceModule addTrigger(TriggerDefinition t) { //3
if (t == null)
return this;
if (this.trigger == null)
this.trigger = new ArrayList<TriggerDefinition>();
this.trigger.add(t);
return this;
}
/**
* @return {@link #parameter} (The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.)
*/
public List<ParameterDefinition> getParameter() {
if (this.parameter == null)
this.parameter = new ArrayList<ParameterDefinition>();
return this.parameter;
}
public boolean hasParameter() {
if (this.parameter == null)
return false;
for (ParameterDefinition item : this.parameter)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #parameter} (The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.)
*/
// syntactic sugar
public ParameterDefinition addParameter() { //3
ParameterDefinition t = new ParameterDefinition();
if (this.parameter == null)
this.parameter = new ArrayList<ParameterDefinition>();
this.parameter.add(t);
return t;
}
// syntactic sugar
public DecisionSupportServiceModule addParameter(ParameterDefinition t) { //3
if (t == null)
return this;
if (this.parameter == null)
this.parameter = new ArrayList<ParameterDefinition>();
this.parameter.add(t);
return this;
}
/**
* @return {@link #dataRequirement} (Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.)
*/
public List<DataRequirement> getDataRequirement() {
if (this.dataRequirement == null)
this.dataRequirement = new ArrayList<DataRequirement>();
return this.dataRequirement;
}
public boolean hasDataRequirement() {
if (this.dataRequirement == null)
return false;
for (DataRequirement item : this.dataRequirement)
if (!item.isEmpty())
return true;
return false;
}
/**
* @return {@link #dataRequirement} (Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.)
*/
// syntactic sugar
public DataRequirement addDataRequirement() { //3
DataRequirement t = new DataRequirement();
if (this.dataRequirement == null)
this.dataRequirement = new ArrayList<DataRequirement>();
this.dataRequirement.add(t);
return t;
}
// syntactic sugar
public DecisionSupportServiceModule addDataRequirement(DataRequirement t) { //3
if (t == null)
return this;
if (this.dataRequirement == null)
this.dataRequirement = new ArrayList<DataRequirement>();
this.dataRequirement.add(t);
return this;
}
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("moduleMetadata", "ModuleMetadata", "The metadata for the decision support service module, including publishing, life-cycle, version, documentation, and supporting evidence.", 0, java.lang.Integer.MAX_VALUE, moduleMetadata));
childrenList.add(new Property("trigger", "TriggerDefinition", "The trigger element defines when the rule should be invoked. This information is used by consumers of the rule to determine how to integrate the rule into a specific workflow.", 0, java.lang.Integer.MAX_VALUE, trigger));
childrenList.add(new Property("parameter", "ParameterDefinition", "The parameters to the module. This collection specifies both the input and output parameters. Input parameters are provided by the caller as part of the $evaluate operation. Output parameters are included in the GuidanceResponse.", 0, java.lang.Integer.MAX_VALUE, parameter));
childrenList.add(new Property("dataRequirement", "DataRequirement", "Data requirements are a machine processable description of the data required by the module in order to perform a successful evaluation.", 0, java.lang.Integer.MAX_VALUE, dataRequirement));
}
@Override
public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 455891387: /*moduleMetadata*/ return this.moduleMetadata == null ? new Base[0] : new Base[] {this.moduleMetadata}; // ModuleMetadata
case -1059891784: /*trigger*/ return this.trigger == null ? new Base[0] : this.trigger.toArray(new Base[this.trigger.size()]); // TriggerDefinition
case 1954460585: /*parameter*/ return this.parameter == null ? new Base[0] : this.parameter.toArray(new Base[this.parameter.size()]); // ParameterDefinition
case 629147193: /*dataRequirement*/ return this.dataRequirement == null ? new Base[0] : this.dataRequirement.toArray(new Base[this.dataRequirement.size()]); // DataRequirement
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 455891387: // moduleMetadata
this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
break;
case -1059891784: // trigger
this.getTrigger().add(castToTriggerDefinition(value)); // TriggerDefinition
break;
case 1954460585: // parameter
this.getParameter().add(castToParameterDefinition(value)); // ParameterDefinition
break;
case 629147193: // dataRequirement
this.getDataRequirement().add(castToDataRequirement(value)); // DataRequirement
break;
default: super.setProperty(hash, name, value);
}
}
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("moduleMetadata"))
this.moduleMetadata = castToModuleMetadata(value); // ModuleMetadata
else if (name.equals("trigger"))
this.getTrigger().add(castToTriggerDefinition(value));
else if (name.equals("parameter"))
this.getParameter().add(castToParameterDefinition(value));
else if (name.equals("dataRequirement"))
this.getDataRequirement().add(castToDataRequirement(value));
else
super.setProperty(name, value);
}
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 455891387: return getModuleMetadata(); // ModuleMetadata
case -1059891784: return addTrigger(); // TriggerDefinition
case 1954460585: return addParameter(); // ParameterDefinition
case 629147193: return addDataRequirement(); // DataRequirement
default: return super.makeProperty(hash, name);
}
}
@Override
public Base addChild(String name) throws FHIRException {
if (name.equals("moduleMetadata")) {
this.moduleMetadata = new ModuleMetadata();
return this.moduleMetadata;
}
else if (name.equals("trigger")) {
return addTrigger();
}
else if (name.equals("parameter")) {
return addParameter();
}
else if (name.equals("dataRequirement")) {
return addDataRequirement();
}
else
return super.addChild(name);
}
public String fhirType() {
return "DecisionSupportServiceModule";
}
public DecisionSupportServiceModule copy() {
DecisionSupportServiceModule dst = new DecisionSupportServiceModule();
copyValues(dst);
dst.moduleMetadata = moduleMetadata == null ? null : moduleMetadata.copy();
if (trigger != null) {
dst.trigger = new ArrayList<TriggerDefinition>();
for (TriggerDefinition i : trigger)
dst.trigger.add(i.copy());
};
if (parameter != null) {
dst.parameter = new ArrayList<ParameterDefinition>();
for (ParameterDefinition i : parameter)
dst.parameter.add(i.copy());
};
if (dataRequirement != null) {
dst.dataRequirement = new ArrayList<DataRequirement>();
for (DataRequirement i : dataRequirement)
dst.dataRequirement.add(i.copy());
};
return dst;
}
protected DecisionSupportServiceModule typedCopy() {
return copy();
}
@Override
public boolean equalsDeep(Base other) {
if (!super.equalsDeep(other))
return false;
if (!(other instanceof DecisionSupportServiceModule))
return false;
DecisionSupportServiceModule o = (DecisionSupportServiceModule) other;
return compareDeep(moduleMetadata, o.moduleMetadata, true) && compareDeep(trigger, o.trigger, true)
&& compareDeep(parameter, o.parameter, true) && compareDeep(dataRequirement, o.dataRequirement, true)
;
}
@Override
public boolean equalsShallow(Base other) {
if (!super.equalsShallow(other))
return false;
if (!(other instanceof DecisionSupportServiceModule))
return false;
DecisionSupportServiceModule o = (DecisionSupportServiceModule) other;
return true;
}
public boolean isEmpty() {
return super.isEmpty() && (moduleMetadata == null || moduleMetadata.isEmpty()) && (trigger == null || trigger.isEmpty())
&& (parameter == null || parameter.isEmpty()) && (dataRequirement == null || dataRequirement.isEmpty())
;
}
@Override
public ResourceType getResourceType() {
return ResourceType.DecisionSupportServiceModule;
}
/**
* Search parameter: <b>topic</b>
* <p>
* Description: <b>Topics associated with the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.topic</b><br>
* </p>
*/
@SearchParamDefinition(name="topic", path="DecisionSupportServiceModule.moduleMetadata.topic", description="Topics associated with the module", type="token" )
public static final String SP_TOPIC = "topic";
/**
* <b>Fluent Client</b> search parameter constant for <b>topic</b>
* <p>
* Description: <b>Topics associated with the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.topic</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam TOPIC = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TOPIC);
/**
* Search parameter: <b>title</b>
* <p>
* Description: <b>Text search against the title</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.title</b><br>
* </p>
*/
@SearchParamDefinition(name="title", path="DecisionSupportServiceModule.moduleMetadata.title", description="Text search against the title", type="string" )
public static final String SP_TITLE = "title";
/**
* <b>Fluent Client</b> search parameter constant for <b>title</b>
* <p>
* Description: <b>Text search against the title</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.title</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.StringClientParam TITLE = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_TITLE);
/**
* Search parameter: <b>status</b>
* <p>
* Description: <b>Status of the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.status</b><br>
* </p>
*/
@SearchParamDefinition(name="status", path="DecisionSupportServiceModule.moduleMetadata.status", description="Status of the module", type="token" )
public static final String SP_STATUS = "status";
/**
* <b>Fluent Client</b> search parameter constant for <b>status</b>
* <p>
* Description: <b>Status of the module</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.status</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
/**
* Search parameter: <b>description</b>
* <p>
* Description: <b>Text search against the description</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.description</b><br>
* </p>
*/
@SearchParamDefinition(name="description", path="DecisionSupportServiceModule.moduleMetadata.description", description="Text search against the description", type="string" )
public static final String SP_DESCRIPTION = "description";
/**
* <b>Fluent Client</b> search parameter constant for <b>description</b>
* <p>
* Description: <b>Text search against the description</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.description</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.StringClientParam DESCRIPTION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DESCRIPTION);
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="DecisionSupportServiceModule.moduleMetadata.identifier", description="Logical identifier for the module (e.g. CMS-143)", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>Logical identifier for the module (e.g. CMS-143)</b><br>
* Type: <b>token</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
/**
* Search parameter: <b>version</b>
* <p>
* Description: <b>Version of the module (e.g. 1.0.0)</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.version</b><br>
* </p>
*/
@SearchParamDefinition(name="version", path="DecisionSupportServiceModule.moduleMetadata.version", description="Version of the module (e.g. 1.0.0)", type="string" )
public static final String SP_VERSION = "version";
/**
* <b>Fluent Client</b> search parameter constant for <b>version</b>
* <p>
* Description: <b>Version of the module (e.g. 1.0.0)</b><br>
* Type: <b>string</b><br>
* Path: <b>DecisionSupportServiceModule.moduleMetadata.version</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.StringClientParam VERSION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_VERSION);
}

View File

@ -1,845 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 1702620169: /*bodySite*/ return this.bodySite == null ? new Base[0] : new Base[] {this.bodySite}; // Type
case 2042879511: /*whenUsed*/ return this.whenUsed == null ? new Base[0] : new Base[] {this.whenUsed}; // Period
case -1335157162: /*device*/ return this.device == null ? new Base[0] : new Base[] {this.device}; // Reference
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case -597168804: /*indication*/ return this.indication == null ? new Base[0] : this.indication.toArray(new Base[this.indication.size()]); // CodeableConcept
case 105008833: /*notes*/ return this.notes == null ? new Base[0] : this.notes.toArray(new Base[this.notes.size()]); // StringType
case 735397551: /*recordedOn*/ return this.recordedOn == null ? new Base[0] : new Base[] {this.recordedOn}; // DateTimeType
case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
case -873664438: /*timing*/ return this.timing == null ? new Base[0] : new Base[] {this.timing}; // Type
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 1702620169: // bodySite
this.bodySite = (Type) value; // Type
break;
case 2042879511: // whenUsed
this.whenUsed = castToPeriod(value); // Period
break;
case -1335157162: // device
this.device = castToReference(value); // Reference
break;
case -1618432855: // identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
break;
case -597168804: // indication
this.getIndication().add(castToCodeableConcept(value)); // CodeableConcept
break;
case 105008833: // notes
this.getNotes().add(castToString(value)); // StringType
break;
case 735397551: // recordedOn
this.recordedOn = castToDateTime(value); // DateTimeType
break;
case -1867885268: // subject
this.subject = castToReference(value); // Reference
break;
case -873664438: // timing
this.timing = (Type) value; // Type
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -806219817: return getBodySite(); // Type
case 2042879511: return getWhenUsed(); // Period
case -1335157162: return getDevice(); // Reference
case -1618432855: return addIdentifier(); // Identifier
case -597168804: return addIndication(); // CodeableConcept
case 105008833: throw new FHIRException("Cannot make property notes as it is not a complex type"); // StringType
case 735397551: throw new FHIRException("Cannot make property recordedOn as it is not a complex type"); // DateTimeType
case -1867885268: return getSubject(); // Reference
case 164632566: return getTiming(); // Type
default: return super.makeProperty(hash, name);
}
}
@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;
}
/**
* Search parameter: <b>patient</b>
* <p>
* Description: <b>Search by subject - a patient</b><br>
* Type: <b>reference</b><br>
* Path: <b>DeviceUseStatement.subject</b><br>
* </p>
*/
@SearchParamDefinition(name="patient", path="DeviceUseStatement.subject", description="Search by subject - a patient", type="reference" )
public static final String SP_PATIENT = "patient";
/**
* <b>Fluent Client</b> search parameter constant for <b>patient</b>
* <p>
* Description: <b>Search by subject - a patient</b><br>
* Type: <b>reference</b><br>
* Path: <b>DeviceUseStatement.subject</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>DeviceUseStatement:patient</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:patient").toLocked();
/**
* Search parameter: <b>subject</b>
* <p>
* Description: <b>Search by subject</b><br>
* Type: <b>reference</b><br>
* Path: <b>DeviceUseStatement.subject</b><br>
* </p>
*/
@SearchParamDefinition(name="subject", path="DeviceUseStatement.subject", description="Search by subject", type="reference" )
public static final String SP_SUBJECT = "subject";
/**
* <b>Fluent Client</b> search parameter constant for <b>subject</b>
* <p>
* Description: <b>Search by subject</b><br>
* Type: <b>reference</b><br>
* Path: <b>DeviceUseStatement.subject</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>DeviceUseStatement:subject</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:subject").toLocked();
/**
* Search parameter: <b>device</b>
* <p>
* Description: <b>Search by device</b><br>
* Type: <b>reference</b><br>
* Path: <b>DeviceUseStatement.device</b><br>
* </p>
*/
@SearchParamDefinition(name="device", path="DeviceUseStatement.device", description="Search by device", type="reference" )
public static final String SP_DEVICE = "device";
/**
* <b>Fluent Client</b> search parameter constant for <b>device</b>
* <p>
* Description: <b>Search by device</b><br>
* Type: <b>reference</b><br>
* Path: <b>DeviceUseStatement.device</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam DEVICE = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_DEVICE);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>DeviceUseStatement:device</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_DEVICE = new ca.uhn.fhir.model.api.Include("DeviceUseStatement:device").toLocked();
}

View File

@ -1,88 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* 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

@ -1,391 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
import org.hl7.fhir.instance.model.api.IDomainResource;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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 #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.)
*/
// syntactic sugar
public DomainResource addContained(Resource t) { //3
if (t == null)
return this;
if (this.contained == null)
this.contained = new ArrayList<Resource>();
this.contained.add(t);
return this;
}
/**
* @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;
}
/**
* Returns a list of extensions from this element which have the given URL. Note that
* this list may not be modified (you can not add or remove elements from it)
*/
public List<Extension> getExtensionsByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must be provided with a value");
ArrayList<Extension> retVal = new ArrayList<Extension>();
for (Extension next : getExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
return Collections.unmodifiableList(retVal);
}
/**
* Returns a list of modifier extensions from this element which have the given URL. Note that
* this list may not be modified (you can not add or remove elements from it)
*/
public List<Extension> getModifierExtensionsByUrl(String theUrl) {
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must be provided with a value");
ArrayList<Extension> retVal = new ArrayList<Extension>();
for (Extension next : getModifierExtension()) {
if (theUrl.equals(next.getUrl())) {
retVal.add(next);
}
}
return Collections.unmodifiableList(retVal);
}
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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // Narrative
case -410956685: /*contained*/ return this.contained == null ? new Base[0] : this.contained.toArray(new Base[this.contained.size()]); // Resource
case -612557761: /*extension*/ return this.extension == null ? new Base[0] : this.extension.toArray(new Base[this.extension.size()]); // Extension
case -298878168: /*modifierExtension*/ return this.modifierExtension == null ? new Base[0] : this.modifierExtension.toArray(new Base[this.modifierExtension.size()]); // Extension
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 3556653: // text
this.text = castToNarrative(value); // Narrative
break;
case -410956685: // contained
this.getContained().add(castToResource(value)); // Resource
break;
case -612557761: // extension
this.getExtension().add(castToExtension(value)); // Extension
break;
case -298878168: // modifierExtension
this.getModifierExtension().add(castToExtension(value)); // Extension
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3556653: return getText(); // Narrative
case -410956685: throw new FHIRException("Cannot make property contained as it is not a complex type"); // Resource
case -612557761: return addExtension(); // Extension
case -298878168: return addModifierExtension(); // Extension
default: return super.makeProperty(hash, name);
}
}
@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) {
super.copyValues(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

@ -1,88 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
/**
* 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

@ -1,298 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseElement;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import org.hl7.fhir.utilities.Utilities;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* Base definition for all elements in a resource.
*/
public abstract class Element extends Base implements IBaseHasExtensions, IBaseElement {
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 3355: /*id*/ return this.id == null ? new Base[0] : new Base[] {this.id}; // IdType
case -612557761: /*extension*/ return this.extension == null ? new Base[0] : this.extension.toArray(new Base[this.extension.size()]); // Extension
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 3355: // id
this.id = castToId(value); // IdType
break;
case -612557761: // extension
this.getExtension().add(castToExtension(value)); // Extension
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 3355: throw new FHIRException("Cannot make property id as it is not a complex type"); // IdType
case -612557761: return addExtension(); // Extension
default: return super.makeProperty(hash, name);
}
}
@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() {
boolean retVal = super.isEmpty() && (id == null || id.isEmpty()) && (extension == null || extension.isEmpty());
return retVal
;
}
}

View File

@ -1,841 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case 1548678118: /*ruleset*/ return this.ruleset == null ? new Base[0] : new Base[] {this.ruleset}; // Coding
case 1089373397: /*originalRuleset*/ return this.originalRuleset == null ? new Base[0] : new Base[] {this.originalRuleset}; // Coding
case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Reference
case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
break;
case 1548678118: // ruleset
this.ruleset = castToCoding(value); // Coding
break;
case 1089373397: // originalRuleset
this.originalRuleset = castToCoding(value); // Coding
break;
case 1028554472: // created
this.created = castToDateTime(value); // DateTimeType
break;
case -880905839: // target
this.target = castToReference(value); // Reference
break;
case -987494927: // provider
this.provider = castToReference(value); // Reference
break;
case 1178922291: // organization
this.organization = castToReference(value); // Reference
break;
case -1867885268: // subject
this.subject = castToReference(value); // Reference
break;
case -351767064: // coverage
this.coverage = castToReference(value); // Reference
break;
case -261851592: // relationship
this.relationship = castToCoding(value); // Coding
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return addIdentifier(); // Identifier
case 1548678118: return getRuleset(); // Coding
case 1089373397: return getOriginalRuleset(); // Coding
case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
case -880905839: return getTarget(); // Reference
case -987494927: return getProvider(); // Reference
case 1178922291: return getOrganization(); // Reference
case -1867885268: return getSubject(); // Reference
case -351767064: return getCoverage(); // Reference
case -261851592: return getRelationship(); // Coding
default: return super.makeProperty(hash, name);
}
}
@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;
}
/**
* Search parameter: <b>patient</b>
* <p>
* Description: <b>The party to be enrolled</b><br>
* Type: <b>reference</b><br>
* Path: <b>EnrollmentRequest.subject</b><br>
* </p>
*/
@SearchParamDefinition(name="patient", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference" )
public static final String SP_PATIENT = "patient";
/**
* <b>Fluent Client</b> search parameter constant for <b>patient</b>
* <p>
* Description: <b>The party to be enrolled</b><br>
* Type: <b>reference</b><br>
* Path: <b>EnrollmentRequest.subject</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>EnrollmentRequest:patient</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:patient").toLocked();
/**
* Search parameter: <b>subject</b>
* <p>
* Description: <b>The party to be enrolled</b><br>
* Type: <b>reference</b><br>
* Path: <b>EnrollmentRequest.subject</b><br>
* </p>
*/
@SearchParamDefinition(name="subject", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference" )
public static final String SP_SUBJECT = "subject";
/**
* <b>Fluent Client</b> search parameter constant for <b>subject</b>
* <p>
* Description: <b>The party to be enrolled</b><br>
* Type: <b>reference</b><br>
* Path: <b>EnrollmentRequest.subject</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
/**
* Constant for fluent queries to be used to add include statements. Specifies
* the path value of "<b>EnrollmentRequest:subject</b>".
*/
public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:subject").toLocked();
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>The business identifier of the Enrollment</b><br>
* Type: <b>token</b><br>
* Path: <b>EnrollmentRequest.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="EnrollmentRequest.identifier", description="The business identifier of the Enrollment", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>The business identifier of the Enrollment</b><br>
* Type: <b>token</b><br>
* Path: <b>EnrollmentRequest.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
}

View File

@ -1,807 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.hl7.fhir.dstu2016may.model.Enumerations.RemittanceOutcome;
import org.hl7.fhir.dstu2016may.model.Enumerations.RemittanceOutcomeEnumFactory;
import org.hl7.fhir.exceptions.FHIRException;
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.ResourceDef;
import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
/**
* 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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
case 1548678118: /*ruleset*/ return this.ruleset == null ? new Base[0] : new Base[] {this.ruleset}; // Coding
case 1089373397: /*originalRuleset*/ return this.originalRuleset == null ? new Base[0] : new Base[] {this.originalRuleset}; // Coding
case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
case 599053666: /*requestOrganization*/ return this.requestOrganization == null ? new Base[0] : new Base[] {this.requestOrganization}; // Reference
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case -1618432855: // identifier
this.getIdentifier().add(castToIdentifier(value)); // Identifier
break;
case 1095692943: // request
this.request = castToReference(value); // Reference
break;
case -1106507950: // outcome
this.outcome = new RemittanceOutcomeEnumFactory().fromType(value); // Enumeration<RemittanceOutcome>
break;
case 583380919: // disposition
this.disposition = castToString(value); // StringType
break;
case 1548678118: // ruleset
this.ruleset = castToCoding(value); // Coding
break;
case 1089373397: // originalRuleset
this.originalRuleset = castToCoding(value); // Coding
break;
case 1028554472: // created
this.created = castToDateTime(value); // DateTimeType
break;
case 1178922291: // organization
this.organization = castToReference(value); // Reference
break;
case 1601527200: // requestProvider
this.requestProvider = castToReference(value); // Reference
break;
case 599053666: // requestOrganization
this.requestOrganization = castToReference(value); // Reference
break;
default: super.setProperty(hash, name, value);
}
}
@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 makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case -1618432855: return addIdentifier(); // Identifier
case 1095692943: return getRequest(); // Reference
case -1106507950: throw new FHIRException("Cannot make property outcome as it is not a complex type"); // Enumeration<RemittanceOutcome>
case 583380919: throw new FHIRException("Cannot make property disposition as it is not a complex type"); // StringType
case 1548678118: return getRuleset(); // Coding
case 1089373397: return getOriginalRuleset(); // Coding
case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
case 1178922291: return getOrganization(); // Reference
case 1601527200: return getRequestProvider(); // Reference
case 599053666: return getRequestOrganization(); // Reference
default: return super.makeProperty(hash, name);
}
}
@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;
}
/**
* Search parameter: <b>identifier</b>
* <p>
* Description: <b>The business identifier of the Explanation of Benefit</b><br>
* Type: <b>token</b><br>
* Path: <b>EnrollmentResponse.identifier</b><br>
* </p>
*/
@SearchParamDefinition(name="identifier", path="EnrollmentResponse.identifier", description="The business identifier of the Explanation of Benefit", type="token" )
public static final String SP_IDENTIFIER = "identifier";
/**
* <b>Fluent Client</b> search parameter constant for <b>identifier</b>
* <p>
* Description: <b>The business identifier of the Explanation of Benefit</b><br>
* Type: <b>token</b><br>
* Path: <b>EnrollmentResponse.identifier</b><br>
* </p>
*/
public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
}

View File

@ -1,62 +0,0 @@
package org.hl7.fhir.dstu2016may.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
*/
public String toCode(T code);
/**
* Get the XML/JSON representation for an enumerated value
* @param code - the enumeration value
* @return the XML/JSON representation
*/
public String toSystem(T code);
}

View File

@ -1,134 +0,0 @@
package org.hl7.fhir.dstu2016may.model;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
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
*
* @deprecated This no-arg constructor is provided for serialization only - Do not use
*/
@Deprecated
public Enumeration() {
// nothing
}
/**
* 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, String theValue) {
if (theEnumFactory == null)
throw new IllegalArgumentException("An enumeration factory must be provided");
myEnumFactory = theEnumFactory;
setValueAsString(theValue);
}
/**
* Constructor
*/
public Enumeration(EnumFactory<T> theEnumFactory, T theValue) {
if (theEnumFactory == null)
throw new IllegalArgumentException("An enumeration factory must be provided");
myEnumFactory = theEnumFactory;
setValue(theValue);
}
@Override
public Enumeration<T> copy() {
return new Enumeration<T>(myEnumFactory, getValue());
}
@Override
protected String encode(T theValue) {
return myEnumFactory.toCode(theValue);
}
public String fhirType() {
return "code";
}
/**
* Provides the enum factory which binds this enumeration to a specific ValueSet
*/
public EnumFactory<T> getEnumFactory() {
return myEnumFactory;
}
@Override
protected T parse(String theValue) {
if (myEnumFactory != null) {
return myEnumFactory.fromCode(theValue);
}
return null;
}
@SuppressWarnings("unchecked")
@Override
public void readExternal(ObjectInput theIn) throws IOException, ClassNotFoundException {
myEnumFactory = (EnumFactory<T>) theIn.readObject();
super.readExternal(theIn);
}
public String toSystem() {
return getEnumFactory().toSystem(getValue());
}
@Override
public void writeExternal(ObjectOutput theOut) throws IOException {
theOut.writeObject(myEnumFactory);
super.writeExternal(theOut);
}
}

View File

@ -1,631 +0,0 @@
package org.hl7.fhir.dstu2016may.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
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 {
Custom,
Empty, Not, Exists, SubsetOf, SupersetOf, IsDistinct, Distinct, Count, Where, Select, All, Repeat, Item /*implicit from name[]*/, As, Is, Single,
First, Last, Tail, Skip, Take, Iif, ToInteger, ToDecimal, ToString, Substring, StartsWith, EndsWith, Matches, ReplaceMatches, Contains, Replace, Length,
Children, Descendents, MemberOf, Trace, Today, Now, Resolve, Extension;
public static Function fromCode(String name) {
if (name.equals("empty")) return Function.Empty;
if (name.equals("not")) return Function.Not;
if (name.equals("exists")) return Function.Exists;
if (name.equals("subsetOf")) return Function.SubsetOf;
if (name.equals("supersetOf")) return Function.SupersetOf;
if (name.equals("isDistinct")) return Function.IsDistinct;
if (name.equals("distinct")) return Function.Distinct;
if (name.equals("count")) return Function.Count;
if (name.equals("where")) return Function.Where;
if (name.equals("select")) return Function.Select;
if (name.equals("all")) return Function.All;
if (name.equals("repeat")) return Function.Repeat;
if (name.equals("item")) return Function.Item;
if (name.equals("as")) return Function.As;
if (name.equals("is")) return Function.Is;
if (name.equals("single")) return Function.Single;
if (name.equals("first")) return Function.First;
if (name.equals("last")) return Function.Last;
if (name.equals("tail")) return Function.Tail;
if (name.equals("skip")) return Function.Skip;
if (name.equals("take")) return Function.Take;
if (name.equals("iif")) return Function.Iif;
if (name.equals("toInteger")) return Function.ToInteger;
if (name.equals("toDecimal")) return Function.ToDecimal;
if (name.equals("toString")) return Function.ToString;
if (name.equals("substring")) return Function.Substring;
if (name.equals("startsWith")) return Function.StartsWith;
if (name.equals("endsWith")) return Function.EndsWith;
if (name.equals("matches")) return Function.Matches;
if (name.equals("replaceMatches")) return Function.ReplaceMatches;
if (name.equals("contains")) return Function.Contains;
if (name.equals("replace")) return Function.Replace;
if (name.equals("length")) return Function.Length;
if (name.equals("children")) return Function.Children;
if (name.equals("descendents")) return Function.Descendents;
if (name.equals("memberOf")) return Function.MemberOf;
if (name.equals("trace")) return Function.Trace;
if (name.equals("today")) return Function.Today;
if (name.equals("now")) return Function.Now;
if (name.equals("resolve")) return Function.Resolve;
if (name.equals("extension")) return Function.Extension;
return null;
}
public String toCode() {
switch (this) {
case Empty : return "empty";
case Not : return "not";
case Exists : return "exists";
case SubsetOf : return "subsetOf";
case SupersetOf : return "supersetOf";
case IsDistinct : return "isDistinct";
case Distinct : return "distinct";
case Count : return "count";
case Where : return "where";
case Select : return "select";
case All : return "all";
case Repeat : return "repeat";
case Item : return "item";
case As : return "as";
case Is : return "is";
case Single : return "single";
case First : return "first";
case Last : return "last";
case Tail : return "tail";
case Skip : return "skip";
case Take : return "take";
case Iif : return "iif";
case ToInteger : return "toInteger";
case ToDecimal : return "toDecimal";
case ToString : return "toString";
case Substring : return "substring";
case StartsWith : return "startsWith";
case EndsWith : return "endsWith";
case Matches : return "matches";
case ReplaceMatches : return "replaceMatches";
case Contains : return "contains";
case Replace : return "replace";
case Length : return "length";
case Children : return "children";
case Descendents : return "descendents";
case MemberOf : return "memberOf";
case Trace : return "trace";
case Today : return "today";
case Now : return "now";
case Resolve : return "resolve";
case Extension : return "extension";
default: return "??";
}
}
}
public enum Operation {
Equals, Equivalent, NotEquals, NotEquivalent, LessThen, Greater, LessOrEqual, GreaterOrEqual, Is, As, Union, Or, And, Xor, Implies,
Times, DivideBy, Plus, Minus, Concatenate, Div, Mod, In, Contains;
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("or"))
return Operation.Or;
if (name.equals("and"))
return Operation.And;
if (name.equals("xor"))
return Operation.Xor;
if (name.equals("is"))
return Operation.Is;
if (name.equals("as"))
return Operation.As;
if (name.equals("*"))
return Operation.Times;
if (name.equals("/"))
return Operation.DivideBy;
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;
if (name.equals("div"))
return Operation.Div;
if (name.equals("mod"))
return Operation.Mod;
if (name.equals("in"))
return Operation.In;
if (name.equals("contains"))
return Operation.Contains;
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 Or : return "or";
case And : return "and";
case Xor : return "xor";
case Times : return "*";
case DivideBy : return "/";
case Plus : return "+";
case Minus : return "-";
case Concatenate : return "&";
case Implies : return "implies";
case Is : return "is";
case As : return "as";
case Div : return "div";
case Mod : return "mod";
case In : return "in";
case Contains : return "contains";
default: return "??";
}
}
}
public enum CollectionStatus {
SINGLETON, ORDERED, UNORDERED
}
public static class TypeDetails {
private Set<String> types = new HashSet<String>();
private CollectionStatus collectionStatus;
public TypeDetails(CollectionStatus collectionStatus, String... names) {
super();
this.collectionStatus = collectionStatus;
for (String n : names)
this.types.add(n);
}
public TypeDetails(CollectionStatus collectionStatus, Set<String> names) {
super();
this.collectionStatus = collectionStatus;
for (String n : names)
this.types.add(n);
}
public void addType(String n) {
this.types.add(n);
}
public void addTypes(Collection<String> n) {
this.types.addAll(n);
}
public boolean hasType(String... tn) {
for (String t: tn)
if (types.contains(t))
return true;
return false;
}
public void update(TypeDetails source) {
types.addAll(source.types);
if (collectionStatus == null)
collectionStatus = source.collectionStatus;
else if (source.collectionStatus == CollectionStatus.UNORDERED)
collectionStatus = source.collectionStatus;
else
collectionStatus = CollectionStatus.ORDERED;
}
public TypeDetails union(TypeDetails right) {
TypeDetails result = new TypeDetails(null);
if (right.collectionStatus == CollectionStatus.UNORDERED || collectionStatus == CollectionStatus.UNORDERED)
result.collectionStatus = CollectionStatus.UNORDERED;
else
result.collectionStatus = CollectionStatus.ORDERED;
result.types.addAll(types);
result.types.addAll(right.types);
return result;
}
public boolean hasNoTypes() {
return types.isEmpty();
}
public Set<String> getTypes() {
return types;
}
public TypeDetails toSingleton() {
TypeDetails result = new TypeDetails(CollectionStatus.SINGLETON);
result.types.addAll(types);
return result;
}
public CollectionStatus getCollectionStatus() {
return collectionStatus;
}
public boolean hasType(Set<String> tn) {
for (String t: tn)
if (types.contains(t))
return true;
return false;
}
public String describe() {
return types.toString();
}
public String getType() {
for (String t : types)
return t;
return null;
}
}
//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 TypeDetails types;
private TypeDetails opTypes;
public ExpressionNode(int uniqueId) {
super();
this.uniqueId = Integer.toString(uniqueId);
}
public String toString() {
StringBuilder b = new StringBuilder();
switch (kind) {
case Name:
b.append(name);
break;
case Function:
if (function == Function.Item)
b.append("[");
else {
b.append(name);
b.append("(");
}
boolean first = true;
for (ExpressionNode n : parameters) {
if (first)
first = false;
else
b.append(", ");
b.append(n.toString());
}
if (function == Function.Item)
b.append("]");
else {
b.append(")");
}
break;
case Constant:
b.append(Utilities.escapeJava(constant));
break;
case Group:
b.append("(");
b.append(group.toString());
b.append(")");
}
if (inner != null) {
b.append(".");
b.append(inner.toString());
}
if (operation != null) {
b.append(" ");
b.append(operation.toCode());
b.append(" ");
b.append(opNext.toString());
}
return b.toString();
}
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() {
if (!name.startsWith("$"))
return true;
else
return name.equals("$this");
}
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 TypeDetails getTypes() {
return types;
}
public void setTypes(TypeDetails types) {
this.types = types;
}
public TypeDetails getOpTypes() {
return opTypes;
}
public void setOpTypes(TypeDetails opTypes) {
this.opTypes = opTypes;
}
}

View File

@ -1,394 +0,0 @@
package org.hl7.fhir.dstu2016may.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, May 8, 2016 03:05+1000 for FHIR v1.4.0
import java.util.List;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.instance.model.api.IBaseDatatype;
import org.hl7.fhir.instance.model.api.IBaseExtension;
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Description;
/**
* 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.dstu2016may.model.Type value;
private static final long serialVersionUID = 1240831878L;
/**
* Constructor
*/
public Extension() {
super();
}
/**
* Constructor
*/
public Extension(UriType url) {
super();
this.url = url;
}
/**
* Constructor
*/
public Extension(String theUrl) {
setUrl(theUrl);
}
/**
* Constructor
*/
public Extension(String theUrl, IBaseDatatype theValue) {
setUrl(theUrl);
setValue(theValue);
}
/**
* @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.dstu2016may.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.dstu2016may.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 Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
switch (hash) {
case 116079: /*url*/ return this.url == null ? new Base[0] : new Base[] {this.url}; // UriType
case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // org.hl7.fhir.dstu2016may.model.Type
default: return super.getProperty(hash, name, checkValid);
}
}
@Override
public void setProperty(int hash, String name, Base value) throws FHIRException {
switch (hash) {
case 116079: // url
this.url = castToUri(value); // UriType
break;
case 111972721: // value
this.value = (org.hl7.fhir.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
break;
default: super.setProperty(hash, name, 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.dstu2016may.model.Type) value; // org.hl7.fhir.dstu2016may.model.Type
else
super.setProperty(name, value);
}
@Override
public Base makeProperty(int hash, String name) throws FHIRException {
switch (hash) {
case 116079: throw new FHIRException("Cannot make property url as it is not a complex type"); // UriType
case -1410166417: return getValue(); // org.hl7.fhir.dstu2016may.model.Type
default: return super.makeProperty(hash, name);
}
}
@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

@ -1,148 +0,0 @@
package org.hl7.fhir.dstu2016may.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

@ -1,251 +0,0 @@
package org.hl7.fhir.dstu2016may.model;
import java.io.IOException;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.util.UUID;
import org.hl7.fhir.dstu2016may.model.ContactPoint.ContactPointSystem;
import org.hl7.fhir.dstu2016may.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);
try {
n.setDiv(new XhtmlParser().parseFragment("<div>"+Utilities.escapeXml(html)+"</div>"));
} catch (org.hl7.fhir.exceptions.FHIRException e) {
throw new FHIRException(e.getMessage(), e);
}
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);
}
}

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