diff --git a/examples/src/main/java/example/ServerOperations.java b/examples/src/main/java/example/ServerOperations.java
index c4ce7287e8c..5d978867a0a 100644
--- a/examples/src/main/java/example/ServerOperations.java
+++ b/examples/src/main/java/example/ServerOperations.java
@@ -36,9 +36,12 @@ public class ServerOperations {
public void manualInputAndOutput(HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws IOException {
String contentType = theServletRequest.getContentType();
byte[] bytes = IOUtils.toByteArray(theServletRequest.getInputStream());
-
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.getOutputStream().write(bytes);
theServletResponse.getOutputStream().close();
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java
index e6f793f95e2..a87800dfc91 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlUtil.java
@@ -31,6 +31,8 @@ import org.apache.commons.text.StringEscapeUtils;
import org.codehaus.stax2.XMLOutputFactory2;
import org.codehaus.stax2.io.EscapingWriterFactory;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
import javax.xml.stream.*;
import javax.xml.stream.events.XMLEvent;
import java.io.*;
@@ -40,7 +42,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
/**
* Utility methods for working with the StAX API.
- *
+ *
* This class contains code adapted from the Apache Axiom project.
*/
public class XmlUtil {
@@ -1503,10 +1505,77 @@ public class XmlUtil {
validEntityNames.put("zscr", 0x1D4CF);
validEntityNames.put("zwj", 0x0200D);
validEntityNames.put("zwnj", 0x0200C);
-
+
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 {
try {
// Detect if we're running with the Android lib, and force repackaged Woodstox to be used
@@ -1637,15 +1706,11 @@ public class XmlUtil {
try {
Class.forName("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
- try
- {
- isWoodstox = inputFactory.getProperty( "org.codehaus.stax2.implVersion" ) != null;
- }
- catch ( Exception e )
- {
+ try {
+ isWoodstox = inputFactory.getProperty("org.codehaus.stax2.implVersion") != null;
+ } catch (Exception e) {
// ignore
}
}
@@ -1673,7 +1738,6 @@ public class XmlUtil {
return ourOutputFactory;
}
-
private static void logStaxImplementation(Class> theClass) {
IDependencyLog logger = DependencyLogFactory.createJarLogger();
if (logger != null) {
@@ -1682,7 +1746,6 @@ public class XmlUtil {
ourHaveLoggedStaxImplementation = true;
}
-
static XMLInputFactory newInputFactory() throws FactoryConfigurationError {
XMLInputFactory inputFactory;
try {
@@ -1761,74 +1824,29 @@ public class XmlUtil {
private static void throwUnitTestExceptionIfConfiguredToDoSo() throws FactoryConfigurationError, XMLStreamException {
if (ourNextException != null) {
if (ourNextException instanceof javax.xml.stream.FactoryConfigurationError) {
- throw ((javax.xml.stream.FactoryConfigurationError)ourNextException);
+ throw ((javax.xml.stream.FactoryConfigurationError) ourNextException);
}
- throw (XMLStreamException)ourNextException;
+ throw (XMLStreamException) ourNextException;
}
}
- 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());
- }
- };
+ public static DocumentBuilderFactory newDocumentBuilderFactory() {
+ DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+ docBuilderFactory.setNamespaceAware(true);
+ docBuilderFactory.setXIncludeAware(false);
+ docBuilderFactory.setExpandEntityReferences(false);
+ 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);
+ 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) {
+ ourLog.warn("Failed to set feature on XML parser: " + e.toString());
}
+ return docBuilderFactory;
}
}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java
index b14596caf18..7933bf542bf 100644
--- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java
+++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/validation/FhirInstanceValidator.java
@@ -6,6 +6,7 @@ import java.util.*;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import ca.uhn.fhir.util.XmlUtil;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.dstu2016may.model.OperationOutcome.IssueSeverity;
import org.hl7.fhir.dstu2016may.model.StructureDefinition;
@@ -48,8 +49,7 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid
* The validation support
*/
public FhirInstanceValidator(IValidationSupport theValidationSupport) {
- myDocBuilderFactory = DocumentBuilderFactory.newInstance();
- myDocBuilderFactory.setNamespaceAware(true);
+ myDocBuilderFactory = XmlUtil.newDocumentBuilderFactory();
myValidationSupport = theValidationSupport;
}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/FormatUtilities.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/FormatUtilities.java
deleted file mode 100644
index 773dce2d82f..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/FormatUtilities.java
+++ /dev/null
@@ -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();
- }
-
-
-
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/IParser.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/IParser.java
deleted file mode 100644
index 41864a89818..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/IParser.java
+++ /dev/null
@@ -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;
-
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreator.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreator.java
deleted file mode 100644
index 11131380bd1..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreator.java
+++ /dev/null
@@ -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;
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreatorCanonical.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreatorCanonical.java
deleted file mode 100644
index 427af2f91f8..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreatorCanonical.java
+++ /dev/null
@@ -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 children = new ArrayList();
-
- public JsonCanObject(String name, boolean array) {
- super(name);
- this.array = array;
- }
-
- public void addProp(JsonCanValue obj) {
- children.add(obj);
- }
- }
-
- Stack stack;
- JsonCanObject root;
- JsonWriter gson;
- String name;
-
- public JsonCreatorCanonical(OutputStreamWriter osw) {
- stack = new Stack();
- 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 names = new ArrayList();
- 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 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();
- }
-
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreatorGson.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreatorGson.java
deleted file mode 100644
index 8594b82860e..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/JsonCreatorGson.java
+++ /dev/null
@@ -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
-
- }
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/ParserType.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/ParserType.java
deleted file mode 100644
index 353508b64b6..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/formats/ParserType.java
+++ /dev/null
@@ -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
-}
\ No newline at end of file
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Element.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Element.java
deleted file mode 100644
index f65e3b64fd6..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Element.java
+++ /dev/null
@@ -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 comments;// not relevant for production, but useful in documentation
- private String name;
- private String type;
- private String value;
- private int index = -1;
- private List 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 getChildren() {
- if (children == null)
- children = new ArrayList();
- return children;
- }
-
- public boolean hasComments() {
- return !(comments == null || comments.isEmpty());
- }
-
- public List getComments() {
- if (comments == null)
- comments = new ArrayList();
- 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 getChildrenByName(String name) {
- List res = new ArrayList();
- 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 getChildren(String name) {
- List res = new ArrayList();
- 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 result = new ArrayList();
- 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 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 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 values) {
- throw new Error("not done yet");
- }
-
-
- public XhtmlNode getXhtml() {
- return xhtml;
- }
-
- public Element setXhtml(XhtmlNode xhtml) {
- this.xhtml = xhtml;
- return this;
- }
-
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/JsonParser.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/JsonParser.java
deleted file mode 100644
index 95c58553047..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/JsonParser.java
+++ /dev/null
@@ -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 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();
- 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 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 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 properties = getChildProperties(context.getProperty(), context.getName(), null);
- Set processed = new HashSet();
- 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 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 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 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 done = new HashSet();
- 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 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 list = e.getChildrenByName(child.getName());
- composeList(path, list);
- }
- }
-
- private void composeList(String path, List 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 done = new HashSet();
- 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 done = new HashSet();
- for (Element child : element.getChildren()) {
- compose(path+"."+element.getName(), element, done, child);
- }
- close();
- }
- }
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Manager.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Manager.java
deleted file mode 100644
index bd6a5c036fb..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Manager.java
+++ /dev/null
@@ -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);
- }
- }
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/ParserBase.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/ParserBase.java
deleted file mode 100644
index 65d16b5579a..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/ParserBase.java
+++ /dev/null
@@ -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 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 getChildProperties(Property property, String elementName, String statedType) throws DefinitionException {
- ElementDefinition ed = property.getDefinition();
- StructureDefinition sd = property.getStructure();
- List 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 properties = new ArrayList();
- 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 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 }
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Property.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Property.java
deleted file mode 100644
index e71ec09af22..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/Property.java
+++ /dev/null
@@ -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;
- }
-
-
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/XmlParser.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/XmlParser.java
deleted file mode 100644
index 5e0bed7e194..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/metamodel/XmlParser.java
+++ /dev/null
@@ -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 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 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 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 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 r : property.getDefinition().getRepresentation()) {
- if (r.getValue() == PropertyRepresentation.XMLATTR) {
- return true;
- }
- }
- return false;
- }
-
- private boolean isText(Property property) {
- for (Enumeration 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);
- }
- }
-
-}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Account.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Account.java
deleted file mode 100644
index 89c176048ff..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Account.java
+++ /dev/null
@@ -1,1058 +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;
-/**
- * A financial tool for tracking value accrued for a particular purpose. In the healthcare field, used to track charges for a patient, cost centres, etc.
- */
-@ResourceDef(name="Account", profile="http://hl7.org/fhir/Profile/Account")
-public class Account extends DomainResource {
-
- public enum AccountStatus {
- /**
- * This account is active and may be used.
- */
- ACTIVE,
- /**
- * This account is inactive and should not be used to track financial information.
- */
- INACTIVE,
- /**
- * added to help the parsers
- */
- NULL;
- public static AccountStatus fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("active".equals(codeString))
- return ACTIVE;
- if ("inactive".equals(codeString))
- return INACTIVE;
- throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case ACTIVE: return "active";
- case INACTIVE: return "inactive";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case ACTIVE: return "http://hl7.org/fhir/account-status";
- case INACTIVE: return "http://hl7.org/fhir/account-status";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case ACTIVE: return "This account is active and may be used.";
- case INACTIVE: return "This account is inactive and should not be used to track financial information.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case ACTIVE: return "Active";
- case INACTIVE: return "Inactive";
- default: return "?";
- }
- }
- }
-
- public static class AccountStatusEnumFactory implements EnumFactory {
- public AccountStatus fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("active".equals(codeString))
- return AccountStatus.ACTIVE;
- if ("inactive".equals(codeString))
- return AccountStatus.INACTIVE;
- throw new IllegalArgumentException("Unknown AccountStatus code '"+codeString+"'");
- }
- public Enumeration fromType(Base code) throws FHIRException {
- if (code == null || code.isEmpty())
- return null;
- String codeString = ((PrimitiveType) code).asStringValue();
- if (codeString == null || "".equals(codeString))
- return null;
- if ("active".equals(codeString))
- return new Enumeration(this, AccountStatus.ACTIVE);
- if ("inactive".equals(codeString))
- return new Enumeration(this, AccountStatus.INACTIVE);
- throw new FHIRException("Unknown AccountStatus code '"+codeString+"'");
- }
- public String toCode(AccountStatus code) {
- if (code == AccountStatus.ACTIVE)
- return "active";
- if (code == AccountStatus.INACTIVE)
- return "inactive";
- return "?";
- }
- public String toSystem(AccountStatus code) {
- return code.getSystem();
- }
- }
-
- /**
- * Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).
- */
- @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Account number", formalDefinition="Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number)." )
- protected List identifier;
-
- /**
- * Name used for the account when displaying it to humans in reports, etc.
- */
- @Child(name = "name", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Human-readable label", formalDefinition="Name used for the account when displaying it to humans in reports, etc." )
- protected StringType name;
-
- /**
- * Categorizes the account for reporting and searching purposes.
- */
- @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="E.g. patient, expense, depreciation", formalDefinition="Categorizes the account for reporting and searching purposes." )
- protected CodeableConcept type;
-
- /**
- * Indicates whether the account is presently used/useable or not.
- */
- @Child(name = "status", type = {CodeType.class}, order=3, min=0, max=1, modifier=true, summary=true)
- @Description(shortDefinition="active | inactive", formalDefinition="Indicates whether the account is presently used/useable or not." )
- protected Enumeration status;
-
- /**
- * Indicates the period of time over which the account is allowed.
- */
- @Child(name = "activePeriod", type = {Period.class}, order=4, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Valid from..to", formalDefinition="Indicates the period of time over which the account is allowed." )
- protected Period activePeriod;
-
- /**
- * Identifies the currency to which transactions must be converted when crediting or debiting the account.
- */
- @Child(name = "currency", type = {Coding.class}, order=5, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Base currency in which balance is tracked", formalDefinition="Identifies the currency to which transactions must be converted when crediting or debiting the account." )
- protected Coding currency;
-
- /**
- * Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.
- */
- @Child(name = "balance", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="How much is in account?", formalDefinition="Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative." )
- protected Money balance;
-
- /**
- * Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.
- */
- @Child(name = "coveragePeriod", type = {Period.class}, order=7, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Transaction window", formalDefinition="Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc." )
- protected Period coveragePeriod;
-
- /**
- * Identifies the patient, device, practitioner, location or other object the account is associated with.
- */
- @Child(name = "subject", type = {Patient.class, Device.class, Practitioner.class, Location.class, HealthcareService.class, Organization.class}, order=8, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="What is account tied to?", formalDefinition="Identifies the patient, device, practitioner, location or other object the account is associated with." )
- protected Reference subject;
-
- /**
- * The actual object that is the target of the reference (Identifies the patient, device, practitioner, location or other object the account is associated with.)
- */
- protected Resource subjectTarget;
-
- /**
- * Indicates the organization, department, etc. with responsibility for the account.
- */
- @Child(name = "owner", type = {Organization.class}, order=9, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Who is responsible?", formalDefinition="Indicates the organization, department, etc. with responsibility for the account." )
- protected Reference owner;
-
- /**
- * The actual object that is the target of the reference (Indicates the organization, department, etc. with responsibility for the account.)
- */
- protected Organization ownerTarget;
-
- /**
- * Provides additional information about what the account tracks and how it is used.
- */
- @Child(name = "description", type = {StringType.class}, order=10, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Explanation of purpose/use", formalDefinition="Provides additional information about what the account tracks and how it is used." )
- protected StringType description;
-
- private static final long serialVersionUID = -1926153194L;
-
- /**
- * Constructor
- */
- public Account() {
- super();
- }
-
- /**
- * @return {@link #identifier} (Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).)
- */
- public List getIdentifier() {
- if (this.identifier == null)
- this.identifier = new ArrayList();
- return this.identifier;
- }
-
- public boolean hasIdentifier() {
- if (this.identifier == null)
- return false;
- for (Identifier item : this.identifier)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #identifier} (Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).)
- */
- // syntactic sugar
- public Identifier addIdentifier() { //3
- Identifier t = new Identifier();
- if (this.identifier == null)
- this.identifier = new ArrayList();
- this.identifier.add(t);
- return t;
- }
-
- // syntactic sugar
- public Account addIdentifier(Identifier t) { //3
- if (t == null)
- return this;
- if (this.identifier == null)
- this.identifier = new ArrayList();
- this.identifier.add(t);
- return this;
- }
-
- /**
- * @return {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
- */
- public StringType getNameElement() {
- if (this.name == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.name");
- else if (Configuration.doAutoCreate())
- this.name = new StringType(); // bb
- return this.name;
- }
-
- public boolean hasNameElement() {
- return this.name != null && !this.name.isEmpty();
- }
-
- public boolean hasName() {
- return this.name != null && !this.name.isEmpty();
- }
-
- /**
- * @param value {@link #name} (Name used for the account when displaying it to humans in reports, etc.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
- */
- public Account setNameElement(StringType value) {
- this.name = value;
- return this;
- }
-
- /**
- * @return Name used for the account when displaying it to humans in reports, etc.
- */
- public String getName() {
- return this.name == null ? null : this.name.getValue();
- }
-
- /**
- * @param value Name used for the account when displaying it to humans in reports, etc.
- */
- public Account setName(String value) {
- if (Utilities.noString(value))
- this.name = null;
- else {
- if (this.name == null)
- this.name = new StringType();
- this.name.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #type} (Categorizes the account for reporting and searching purposes.)
- */
- public CodeableConcept getType() {
- if (this.type == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.type");
- else if (Configuration.doAutoCreate())
- this.type = new CodeableConcept(); // cc
- return this.type;
- }
-
- public boolean hasType() {
- return this.type != null && !this.type.isEmpty();
- }
-
- /**
- * @param value {@link #type} (Categorizes the account for reporting and searching purposes.)
- */
- public Account setType(CodeableConcept value) {
- this.type = value;
- return this;
- }
-
- /**
- * @return {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
- */
- public Enumeration getStatusElement() {
- if (this.status == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.status");
- else if (Configuration.doAutoCreate())
- this.status = new Enumeration(new AccountStatusEnumFactory()); // bb
- return this.status;
- }
-
- public boolean hasStatusElement() {
- return this.status != null && !this.status.isEmpty();
- }
-
- public boolean hasStatus() {
- return this.status != null && !this.status.isEmpty();
- }
-
- /**
- * @param value {@link #status} (Indicates whether the account is presently used/useable or not.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
- */
- public Account setStatusElement(Enumeration value) {
- this.status = value;
- return this;
- }
-
- /**
- * @return Indicates whether the account is presently used/useable or not.
- */
- public AccountStatus getStatus() {
- return this.status == null ? null : this.status.getValue();
- }
-
- /**
- * @param value Indicates whether the account is presently used/useable or not.
- */
- public Account setStatus(AccountStatus value) {
- if (value == null)
- this.status = null;
- else {
- if (this.status == null)
- this.status = new Enumeration(new AccountStatusEnumFactory());
- this.status.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #activePeriod} (Indicates the period of time over which the account is allowed.)
- */
- public Period getActivePeriod() {
- if (this.activePeriod == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.activePeriod");
- else if (Configuration.doAutoCreate())
- this.activePeriod = new Period(); // cc
- return this.activePeriod;
- }
-
- public boolean hasActivePeriod() {
- return this.activePeriod != null && !this.activePeriod.isEmpty();
- }
-
- /**
- * @param value {@link #activePeriod} (Indicates the period of time over which the account is allowed.)
- */
- public Account setActivePeriod(Period value) {
- this.activePeriod = value;
- return this;
- }
-
- /**
- * @return {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.)
- */
- public Coding getCurrency() {
- if (this.currency == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.currency");
- else if (Configuration.doAutoCreate())
- this.currency = new Coding(); // cc
- return this.currency;
- }
-
- public boolean hasCurrency() {
- return this.currency != null && !this.currency.isEmpty();
- }
-
- /**
- * @param value {@link #currency} (Identifies the currency to which transactions must be converted when crediting or debiting the account.)
- */
- public Account setCurrency(Coding value) {
- this.currency = value;
- return this;
- }
-
- /**
- * @return {@link #balance} (Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.)
- */
- public Money getBalance() {
- if (this.balance == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.balance");
- else if (Configuration.doAutoCreate())
- this.balance = new Money(); // cc
- return this.balance;
- }
-
- public boolean hasBalance() {
- return this.balance != null && !this.balance.isEmpty();
- }
-
- /**
- * @param value {@link #balance} (Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.)
- */
- public Account setBalance(Money value) {
- this.balance = value;
- return this;
- }
-
- /**
- * @return {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
- */
- public Period getCoveragePeriod() {
- if (this.coveragePeriod == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.coveragePeriod");
- else if (Configuration.doAutoCreate())
- this.coveragePeriod = new Period(); // cc
- return this.coveragePeriod;
- }
-
- public boolean hasCoveragePeriod() {
- return this.coveragePeriod != null && !this.coveragePeriod.isEmpty();
- }
-
- /**
- * @param value {@link #coveragePeriod} (Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.)
- */
- public Account setCoveragePeriod(Period value) {
- this.coveragePeriod = value;
- return this;
- }
-
- /**
- * @return {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.)
- */
- public Reference getSubject() {
- if (this.subject == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.subject");
- else if (Configuration.doAutoCreate())
- this.subject = new Reference(); // cc
- return this.subject;
- }
-
- public boolean hasSubject() {
- return this.subject != null && !this.subject.isEmpty();
- }
-
- /**
- * @param value {@link #subject} (Identifies the patient, device, practitioner, location or other object the account is associated with.)
- */
- public Account setSubject(Reference value) {
- this.subject = value;
- return this;
- }
-
- /**
- * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Identifies the patient, device, practitioner, location or other object the account is associated with.)
- */
- public Resource getSubjectTarget() {
- return this.subjectTarget;
- }
-
- /**
- * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Identifies the patient, device, practitioner, location or other object the account is associated with.)
- */
- public Account setSubjectTarget(Resource value) {
- this.subjectTarget = value;
- return this;
- }
-
- /**
- * @return {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.)
- */
- public Reference getOwner() {
- if (this.owner == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.owner");
- else if (Configuration.doAutoCreate())
- this.owner = new Reference(); // cc
- return this.owner;
- }
-
- public boolean hasOwner() {
- return this.owner != null && !this.owner.isEmpty();
- }
-
- /**
- * @param value {@link #owner} (Indicates the organization, department, etc. with responsibility for the account.)
- */
- public Account setOwner(Reference value) {
- this.owner = value;
- return this;
- }
-
- /**
- * @return {@link #owner} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the organization, department, etc. with responsibility for the account.)
- */
- public Organization getOwnerTarget() {
- if (this.ownerTarget == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.owner");
- else if (Configuration.doAutoCreate())
- this.ownerTarget = new Organization(); // aa
- return this.ownerTarget;
- }
-
- /**
- * @param value {@link #owner} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the organization, department, etc. with responsibility for the account.)
- */
- public Account setOwnerTarget(Organization value) {
- this.ownerTarget = value;
- return this;
- }
-
- /**
- * @return {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
- */
- public StringType getDescriptionElement() {
- if (this.description == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Account.description");
- else if (Configuration.doAutoCreate())
- this.description = new StringType(); // bb
- return this.description;
- }
-
- public boolean hasDescriptionElement() {
- return this.description != null && !this.description.isEmpty();
- }
-
- public boolean hasDescription() {
- return this.description != null && !this.description.isEmpty();
- }
-
- /**
- * @param value {@link #description} (Provides additional information about what the account tracks and how it is used.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
- */
- public Account setDescriptionElement(StringType value) {
- this.description = value;
- return this;
- }
-
- /**
- * @return Provides additional information about what the account tracks and how it is used.
- */
- public String getDescription() {
- return this.description == null ? null : this.description.getValue();
- }
-
- /**
- * @param value Provides additional information about what the account tracks and how it is used.
- */
- public Account setDescription(String value) {
- if (Utilities.noString(value))
- this.description = null;
- else {
- if (this.description == null)
- this.description = new StringType();
- this.description.setValue(value);
- }
- return this;
- }
-
- protected void listChildren(List childrenList) {
- super.listChildren(childrenList);
- childrenList.add(new Property("identifier", "Identifier", "Unique identifier used to reference the account. May or may not be intended for human use (e.g. credit card number).", 0, java.lang.Integer.MAX_VALUE, identifier));
- childrenList.add(new Property("name", "string", "Name used for the account when displaying it to humans in reports, etc.", 0, java.lang.Integer.MAX_VALUE, name));
- childrenList.add(new Property("type", "CodeableConcept", "Categorizes the account for reporting and searching purposes.", 0, java.lang.Integer.MAX_VALUE, type));
- childrenList.add(new Property("status", "code", "Indicates whether the account is presently used/useable or not.", 0, java.lang.Integer.MAX_VALUE, status));
- childrenList.add(new Property("activePeriod", "Period", "Indicates the period of time over which the account is allowed.", 0, java.lang.Integer.MAX_VALUE, activePeriod));
- childrenList.add(new Property("currency", "Coding", "Identifies the currency to which transactions must be converted when crediting or debiting the account.", 0, java.lang.Integer.MAX_VALUE, currency));
- childrenList.add(new Property("balance", "Money", "Represents the sum of all credits less all debits associated with the account. Might be positive, zero or negative.", 0, java.lang.Integer.MAX_VALUE, balance));
- childrenList.add(new Property("coveragePeriod", "Period", "Identifies the period of time the account applies to; e.g. accounts created per fiscal year, quarter, etc.", 0, java.lang.Integer.MAX_VALUE, coveragePeriod));
- childrenList.add(new Property("subject", "Reference(Patient|Device|Practitioner|Location|HealthcareService|Organization)", "Identifies the patient, device, practitioner, location or other object the account is associated with.", 0, java.lang.Integer.MAX_VALUE, subject));
- childrenList.add(new Property("owner", "Reference(Organization)", "Indicates the organization, department, etc. with responsibility for the account.", 0, java.lang.Integer.MAX_VALUE, owner));
- childrenList.add(new Property("description", "string", "Provides additional information about what the account tracks and how it is used.", 0, java.lang.Integer.MAX_VALUE, description));
- }
-
- @Override
- public 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 3373707: /*name*/ return this.name == null ? new Base[0] : new Base[] {this.name}; // StringType
- case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
- case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration
- case 1325532263: /*activePeriod*/ return this.activePeriod == null ? new Base[0] : new Base[] {this.activePeriod}; // Period
- case 575402001: /*currency*/ return this.currency == null ? new Base[0] : new Base[] {this.currency}; // Coding
- case -339185956: /*balance*/ return this.balance == null ? new Base[0] : new Base[] {this.balance}; // Money
- case 1024117193: /*coveragePeriod*/ return this.coveragePeriod == null ? new Base[0] : new Base[] {this.coveragePeriod}; // Period
- case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
- case 106164915: /*owner*/ return this.owner == null ? new Base[0] : new Base[] {this.owner}; // Reference
- case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // 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 3373707: // name
- this.name = castToString(value); // StringType
- break;
- case 3575610: // type
- this.type = castToCodeableConcept(value); // CodeableConcept
- break;
- case -892481550: // status
- this.status = new AccountStatusEnumFactory().fromType(value); // Enumeration
- break;
- case 1325532263: // activePeriod
- this.activePeriod = castToPeriod(value); // Period
- break;
- case 575402001: // currency
- this.currency = castToCoding(value); // Coding
- break;
- case -339185956: // balance
- this.balance = castToMoney(value); // Money
- break;
- case 1024117193: // coveragePeriod
- this.coveragePeriod = castToPeriod(value); // Period
- break;
- case -1867885268: // subject
- this.subject = castToReference(value); // Reference
- break;
- case 106164915: // owner
- this.owner = castToReference(value); // Reference
- break;
- case -1724546052: // description
- this.description = 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("name"))
- this.name = castToString(value); // StringType
- else if (name.equals("type"))
- this.type = castToCodeableConcept(value); // CodeableConcept
- else if (name.equals("status"))
- this.status = new AccountStatusEnumFactory().fromType(value); // Enumeration
- else if (name.equals("activePeriod"))
- this.activePeriod = castToPeriod(value); // Period
- else if (name.equals("currency"))
- this.currency = castToCoding(value); // Coding
- else if (name.equals("balance"))
- this.balance = castToMoney(value); // Money
- else if (name.equals("coveragePeriod"))
- this.coveragePeriod = castToPeriod(value); // Period
- else if (name.equals("subject"))
- this.subject = castToReference(value); // Reference
- else if (name.equals("owner"))
- this.owner = castToReference(value); // Reference
- else if (name.equals("description"))
- this.description = castToString(value); // StringType
- else
- super.setProperty(name, value);
- }
-
- @Override
- public Base makeProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case -1618432855: return addIdentifier(); // Identifier
- case 3373707: throw new FHIRException("Cannot make property name as it is not a complex type"); // StringType
- case 3575610: return getType(); // CodeableConcept
- case -892481550: throw new FHIRException("Cannot make property status as it is not a complex type"); // Enumeration
- case 1325532263: return getActivePeriod(); // Period
- case 575402001: return getCurrency(); // Coding
- case -339185956: return getBalance(); // Money
- case 1024117193: return getCoveragePeriod(); // Period
- case -1867885268: return getSubject(); // Reference
- case 106164915: return getOwner(); // Reference
- case -1724546052: throw new FHIRException("Cannot make property description 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("name")) {
- throw new FHIRException("Cannot call addChild on a primitive type Account.name");
- }
- else if (name.equals("type")) {
- this.type = new CodeableConcept();
- return this.type;
- }
- else if (name.equals("status")) {
- throw new FHIRException("Cannot call addChild on a primitive type Account.status");
- }
- else if (name.equals("activePeriod")) {
- this.activePeriod = new Period();
- return this.activePeriod;
- }
- else if (name.equals("currency")) {
- this.currency = new Coding();
- return this.currency;
- }
- else if (name.equals("balance")) {
- this.balance = new Money();
- return this.balance;
- }
- else if (name.equals("coveragePeriod")) {
- this.coveragePeriod = new Period();
- return this.coveragePeriod;
- }
- else if (name.equals("subject")) {
- this.subject = new Reference();
- return this.subject;
- }
- else if (name.equals("owner")) {
- this.owner = new Reference();
- return this.owner;
- }
- else if (name.equals("description")) {
- throw new FHIRException("Cannot call addChild on a primitive type Account.description");
- }
- else
- return super.addChild(name);
- }
-
- public String fhirType() {
- return "Account";
-
- }
-
- public Account copy() {
- Account dst = new Account();
- copyValues(dst);
- if (identifier != null) {
- dst.identifier = new ArrayList();
- for (Identifier i : identifier)
- dst.identifier.add(i.copy());
- };
- dst.name = name == null ? null : name.copy();
- dst.type = type == null ? null : type.copy();
- dst.status = status == null ? null : status.copy();
- dst.activePeriod = activePeriod == null ? null : activePeriod.copy();
- dst.currency = currency == null ? null : currency.copy();
- dst.balance = balance == null ? null : balance.copy();
- dst.coveragePeriod = coveragePeriod == null ? null : coveragePeriod.copy();
- dst.subject = subject == null ? null : subject.copy();
- dst.owner = owner == null ? null : owner.copy();
- dst.description = description == null ? null : description.copy();
- return dst;
- }
-
- protected Account typedCopy() {
- return copy();
- }
-
- @Override
- public boolean equalsDeep(Base other) {
- if (!super.equalsDeep(other))
- return false;
- if (!(other instanceof Account))
- return false;
- Account o = (Account) other;
- return compareDeep(identifier, o.identifier, true) && compareDeep(name, o.name, true) && compareDeep(type, o.type, true)
- && compareDeep(status, o.status, true) && compareDeep(activePeriod, o.activePeriod, true) && compareDeep(currency, o.currency, true)
- && compareDeep(balance, o.balance, true) && compareDeep(coveragePeriod, o.coveragePeriod, true)
- && compareDeep(subject, o.subject, true) && compareDeep(owner, o.owner, true) && compareDeep(description, o.description, true)
- ;
- }
-
- @Override
- public boolean equalsShallow(Base other) {
- if (!super.equalsShallow(other))
- return false;
- if (!(other instanceof Account))
- return false;
- Account o = (Account) other;
- return compareValues(name, o.name, true) && compareValues(status, o.status, true) && compareValues(description, o.description, true)
- ;
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (name == null || name.isEmpty())
- && (type == null || type.isEmpty()) && (status == null || status.isEmpty()) && (activePeriod == null || activePeriod.isEmpty())
- && (currency == null || currency.isEmpty()) && (balance == null || balance.isEmpty()) && (coveragePeriod == null || coveragePeriod.isEmpty())
- && (subject == null || subject.isEmpty()) && (owner == null || owner.isEmpty()) && (description == null || description.isEmpty())
- ;
- }
-
- @Override
- public ResourceType getResourceType() {
- return ResourceType.Account;
- }
-
- /**
- * Search parameter: balance
- *
- * Description: How much is in account?
- * Type: quantity
- * Path: Account.balance
- *
- */
- @SearchParamDefinition(name="balance", path="Account.balance", description="How much is in account?", type="quantity" )
- public static final String SP_BALANCE = "balance";
- /**
- * Fluent Client search parameter constant for balance
- *
- * Description: How much is in account?
- * Type: quantity
- * Path: Account.balance
- *
- */
- public static final ca.uhn.fhir.rest.gclient.QuantityClientParam BALANCE = new ca.uhn.fhir.rest.gclient.QuantityClientParam(SP_BALANCE);
-
- /**
- * Search parameter: patient
- *
- * Description: What is account tied to?
- * Type: reference
- * Path: Account.subject
- *
- */
- @SearchParamDefinition(name="patient", path="Account.subject", description="What is account tied to?", type="reference" )
- public static final String SP_PATIENT = "patient";
- /**
- * Fluent Client search parameter constant for patient
- *
- * Description: What is account tied to?
- * Type: reference
- * Path: Account.subject
- *
- */
- 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 "Account:patient".
- */
- public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("Account:patient").toLocked();
-
- /**
- * Search parameter: status
- *
- * Description: active | inactive
- * Type: token
- * Path: Account.status
- *
- */
- @SearchParamDefinition(name="status", path="Account.status", description="active | inactive", type="token" )
- public static final String SP_STATUS = "status";
- /**
- * Fluent Client search parameter constant for status
- *
- * Description: active | inactive
- * Type: token
- * Path: Account.status
- *
- */
- public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
-
- /**
- * Search parameter: subject
- *
- * Description: What is account tied to?
- * Type: reference
- * Path: Account.subject
- *
- */
- @SearchParamDefinition(name="subject", path="Account.subject", description="What is account tied to?", type="reference" )
- public static final String SP_SUBJECT = "subject";
- /**
- * Fluent Client search parameter constant for subject
- *
- * Description: What is account tied to?
- * Type: reference
- * Path: Account.subject
- *
- */
- 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 "Account:subject".
- */
- public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("Account:subject").toLocked();
-
- /**
- * Search parameter: name
- *
- * Description: Human-readable label
- * Type: string
- * Path: Account.name
- *
- */
- @SearchParamDefinition(name="name", path="Account.name", description="Human-readable label", type="string" )
- public static final String SP_NAME = "name";
- /**
- * Fluent Client search parameter constant for name
- *
- * Description: Human-readable label
- * Type: string
- * Path: Account.name
- *
- */
- public static final ca.uhn.fhir.rest.gclient.StringClientParam NAME = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_NAME);
-
- /**
- * Search parameter: owner
- *
- * Description: Who is responsible?
- * Type: reference
- * Path: Account.owner
- *
- */
- @SearchParamDefinition(name="owner", path="Account.owner", description="Who is responsible?", type="reference" )
- public static final String SP_OWNER = "owner";
- /**
- * Fluent Client search parameter constant for owner
- *
- * Description: Who is responsible?
- * Type: reference
- * Path: Account.owner
- *
- */
- public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam OWNER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_OWNER);
-
-/**
- * Constant for fluent queries to be used to add include statements. Specifies
- * the path value of "Account:owner".
- */
- public static final ca.uhn.fhir.model.api.Include INCLUDE_OWNER = new ca.uhn.fhir.model.api.Include("Account:owner").toLocked();
-
- /**
- * Search parameter: period
- *
- * Description: Transaction window
- * Type: date
- * Path: Account.coveragePeriod
- *
- */
- @SearchParamDefinition(name="period", path="Account.coveragePeriod", description="Transaction window", type="date" )
- public static final String SP_PERIOD = "period";
- /**
- * Fluent Client search parameter constant for period
- *
- * Description: Transaction window
- * Type: date
- * Path: Account.coveragePeriod
- *
- */
- public static final ca.uhn.fhir.rest.gclient.DateClientParam PERIOD = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PERIOD);
-
- /**
- * Search parameter: type
- *
- * Description: E.g. patient, expense, depreciation
- * Type: token
- * Path: Account.type
- *
- */
- @SearchParamDefinition(name="type", path="Account.type", description="E.g. patient, expense, depreciation", type="token" )
- public static final String SP_TYPE = "type";
- /**
- * Fluent Client search parameter constant for type
- *
- * Description: E.g. patient, expense, depreciation
- * Type: token
- * Path: Account.type
- *
- */
- public static final ca.uhn.fhir.rest.gclient.TokenClientParam TYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_TYPE);
-
- /**
- * Search parameter: identifier
- *
- * Description: Account number
- * Type: token
- * Path: Account.identifier
- *
- */
- @SearchParamDefinition(name="identifier", path="Account.identifier", description="Account number", type="token" )
- public static final String SP_IDENTIFIER = "identifier";
- /**
- * Fluent Client search parameter constant for identifier
- *
- * Description: Account number
- * Type: token
- * Path: Account.identifier
- *
- */
- public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
-
-
-}
-
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/ActionDefinition.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/ActionDefinition.java
deleted file mode 100644
index cc235196326..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/ActionDefinition.java
+++ /dev/null
@@ -1,2254 +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.IBaseDatatypeElement;
-import org.hl7.fhir.instance.model.api.ICompositeType;
-import org.hl7.fhir.utilities.Utilities;
-
-import ca.uhn.fhir.model.api.annotation.Block;
-import ca.uhn.fhir.model.api.annotation.Child;
-import ca.uhn.fhir.model.api.annotation.DatatypeDef;
-import ca.uhn.fhir.model.api.annotation.Description;
-/**
- * The definition of an action to be performed. Some aspects of the definition are specified statically, and some aspects can be specified dynamically by referencing logic defined in a library.
- */
-@DatatypeDef(name="ActionDefinition")
-public class ActionDefinition extends Type implements ICompositeType {
-
- public enum ActionRelationshipType {
- /**
- * The action must be performed before the related action
- */
- BEFORE,
- /**
- * The action must be performed after the related action
- */
- AFTER,
- /**
- * added to help the parsers
- */
- NULL;
- public static ActionRelationshipType fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("before".equals(codeString))
- return BEFORE;
- if ("after".equals(codeString))
- return AFTER;
- throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case BEFORE: return "before";
- case AFTER: return "after";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case BEFORE: return "http://hl7.org/fhir/action-relationship-type";
- case AFTER: return "http://hl7.org/fhir/action-relationship-type";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case BEFORE: return "The action must be performed before the related action";
- case AFTER: return "The action must be performed after the related action";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case BEFORE: return "Before";
- case AFTER: return "After";
- default: return "?";
- }
- }
- }
-
- public static class ActionRelationshipTypeEnumFactory implements EnumFactory {
- public ActionRelationshipType fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("before".equals(codeString))
- return ActionRelationshipType.BEFORE;
- if ("after".equals(codeString))
- return ActionRelationshipType.AFTER;
- throw new IllegalArgumentException("Unknown ActionRelationshipType code '"+codeString+"'");
- }
- public Enumeration 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 ("before".equals(codeString))
- return new Enumeration(this, ActionRelationshipType.BEFORE);
- if ("after".equals(codeString))
- return new Enumeration(this, ActionRelationshipType.AFTER);
- throw new FHIRException("Unknown ActionRelationshipType code '"+codeString+"'");
- }
- public String toCode(ActionRelationshipType code) {
- if (code == ActionRelationshipType.BEFORE)
- return "before";
- if (code == ActionRelationshipType.AFTER)
- return "after";
- return "?";
- }
- public String toSystem(ActionRelationshipType code) {
- return code.getSystem();
- }
- }
-
- public enum ActionRelationshipAnchor {
- /**
- * The action relationship is anchored to the start of the related action
- */
- START,
- /**
- * The action relationship is anchored to the end of the related action
- */
- END,
- /**
- * added to help the parsers
- */
- NULL;
- public static ActionRelationshipAnchor fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("start".equals(codeString))
- return START;
- if ("end".equals(codeString))
- return END;
- throw new FHIRException("Unknown ActionRelationshipAnchor code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case START: return "start";
- case END: return "end";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case START: return "http://hl7.org/fhir/action-relationship-anchor";
- case END: return "http://hl7.org/fhir/action-relationship-anchor";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case START: return "The action relationship is anchored to the start of the related action";
- case END: return "The action relationship is anchored to the end of the related action";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case START: return "Start";
- case END: return "End";
- default: return "?";
- }
- }
- }
-
- public static class ActionRelationshipAnchorEnumFactory implements EnumFactory {
- public ActionRelationshipAnchor fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("start".equals(codeString))
- return ActionRelationshipAnchor.START;
- if ("end".equals(codeString))
- return ActionRelationshipAnchor.END;
- throw new IllegalArgumentException("Unknown ActionRelationshipAnchor code '"+codeString+"'");
- }
- public Enumeration 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 ("start".equals(codeString))
- return new Enumeration(this, ActionRelationshipAnchor.START);
- if ("end".equals(codeString))
- return new Enumeration(this, ActionRelationshipAnchor.END);
- throw new FHIRException("Unknown ActionRelationshipAnchor code '"+codeString+"'");
- }
- public String toCode(ActionRelationshipAnchor code) {
- if (code == ActionRelationshipAnchor.START)
- return "start";
- if (code == ActionRelationshipAnchor.END)
- return "end";
- return "?";
- }
- public String toSystem(ActionRelationshipAnchor code) {
- return code.getSystem();
- }
- }
-
- public enum ParticipantType {
- /**
- * The participant is the patient under evaluation
- */
- PATIENT,
- /**
- * The participant is a practitioner involved in the patient's care
- */
- PRACTITIONER,
- /**
- * The participant is a person related to the patient
- */
- RELATEDPERSON,
- /**
- * added to help the parsers
- */
- NULL;
- public static ParticipantType fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("patient".equals(codeString))
- return PATIENT;
- if ("practitioner".equals(codeString))
- return PRACTITIONER;
- if ("related-person".equals(codeString))
- return RELATEDPERSON;
- throw new FHIRException("Unknown ParticipantType code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case PATIENT: return "patient";
- case PRACTITIONER: return "practitioner";
- case RELATEDPERSON: return "related-person";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case PATIENT: return "http://hl7.org/fhir/action-participant-type";
- case PRACTITIONER: return "http://hl7.org/fhir/action-participant-type";
- case RELATEDPERSON: return "http://hl7.org/fhir/action-participant-type";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case PATIENT: return "The participant is the patient under evaluation";
- case PRACTITIONER: return "The participant is a practitioner involved in the patient's care";
- case RELATEDPERSON: return "The participant is a person related to the patient";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case PATIENT: return "Patient";
- case PRACTITIONER: return "Practitioner";
- case RELATEDPERSON: return "Related Person";
- default: return "?";
- }
- }
- }
-
- public static class ParticipantTypeEnumFactory implements EnumFactory {
- public ParticipantType fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("patient".equals(codeString))
- return ParticipantType.PATIENT;
- if ("practitioner".equals(codeString))
- return ParticipantType.PRACTITIONER;
- if ("related-person".equals(codeString))
- return ParticipantType.RELATEDPERSON;
- throw new IllegalArgumentException("Unknown ParticipantType code '"+codeString+"'");
- }
- public Enumeration 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 ("patient".equals(codeString))
- return new Enumeration(this, ParticipantType.PATIENT);
- if ("practitioner".equals(codeString))
- return new Enumeration(this, ParticipantType.PRACTITIONER);
- if ("related-person".equals(codeString))
- return new Enumeration(this, ParticipantType.RELATEDPERSON);
- throw new FHIRException("Unknown ParticipantType code '"+codeString+"'");
- }
- public String toCode(ParticipantType code) {
- if (code == ParticipantType.PATIENT)
- return "patient";
- if (code == ParticipantType.PRACTITIONER)
- return "practitioner";
- if (code == ParticipantType.RELATEDPERSON)
- return "related-person";
- return "?";
- }
- public String toSystem(ParticipantType code) {
- return code.getSystem();
- }
- }
-
- public enum ActionType {
- /**
- * The action is to create a new resource
- */
- CREATE,
- /**
- * The action is to update an existing resource
- */
- UPDATE,
- /**
- * The action is to remove an existing resource
- */
- REMOVE,
- /**
- * The action is to fire a specific event
- */
- FIREEVENT,
- /**
- * added to help the parsers
- */
- NULL;
- public static ActionType fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("create".equals(codeString))
- return CREATE;
- if ("update".equals(codeString))
- return UPDATE;
- if ("remove".equals(codeString))
- return REMOVE;
- if ("fire-event".equals(codeString))
- return FIREEVENT;
- throw new FHIRException("Unknown ActionType code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case CREATE: return "create";
- case UPDATE: return "update";
- case REMOVE: return "remove";
- case FIREEVENT: return "fire-event";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case CREATE: return "http://hl7.org/fhir/action-type";
- case UPDATE: return "http://hl7.org/fhir/action-type";
- case REMOVE: return "http://hl7.org/fhir/action-type";
- case FIREEVENT: return "http://hl7.org/fhir/action-type";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case CREATE: return "The action is to create a new resource";
- case UPDATE: return "The action is to update an existing resource";
- case REMOVE: return "The action is to remove an existing resource";
- case FIREEVENT: return "The action is to fire a specific event";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case CREATE: return "Create";
- case UPDATE: return "Update";
- case REMOVE: return "Remove";
- case FIREEVENT: return "Fire Event";
- default: return "?";
- }
- }
- }
-
- public static class ActionTypeEnumFactory implements EnumFactory {
- public ActionType fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("create".equals(codeString))
- return ActionType.CREATE;
- if ("update".equals(codeString))
- return ActionType.UPDATE;
- if ("remove".equals(codeString))
- return ActionType.REMOVE;
- if ("fire-event".equals(codeString))
- return ActionType.FIREEVENT;
- throw new IllegalArgumentException("Unknown ActionType code '"+codeString+"'");
- }
- public Enumeration 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 ("create".equals(codeString))
- return new Enumeration(this, ActionType.CREATE);
- if ("update".equals(codeString))
- return new Enumeration(this, ActionType.UPDATE);
- if ("remove".equals(codeString))
- return new Enumeration(this, ActionType.REMOVE);
- if ("fire-event".equals(codeString))
- return new Enumeration(this, ActionType.FIREEVENT);
- throw new FHIRException("Unknown ActionType code '"+codeString+"'");
- }
- public String toCode(ActionType code) {
- if (code == ActionType.CREATE)
- return "create";
- if (code == ActionType.UPDATE)
- return "update";
- if (code == ActionType.REMOVE)
- return "remove";
- if (code == ActionType.FIREEVENT)
- return "fire-event";
- return "?";
- }
- public String toSystem(ActionType code) {
- return code.getSystem();
- }
- }
-
- @Block()
- public static class ActionDefinitionRelatedActionComponent extends Element implements IBaseDatatypeElement {
- /**
- * The unique identifier of the related action.
- */
- @Child(name = "actionIdentifier", type = {Identifier.class}, order=1, min=1, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Identifier of the related action", formalDefinition="The unique identifier of the related action." )
- protected Identifier actionIdentifier;
-
- /**
- * The relationship of this action to the related action.
- */
- @Child(name = "relationship", type = {CodeType.class}, order=2, min=1, max=1, modifier=false, summary=true)
- @Description(shortDefinition="before | after", formalDefinition="The relationship of this action to the related action." )
- protected Enumeration relationship;
-
- /**
- * A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.
- */
- @Child(name = "offset", type = {Duration.class, Range.class}, order=3, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Time offset for the relationship", formalDefinition="A duration or range of durations to apply to the relationship. For example, 30-60 minutes before." )
- protected Type offset;
-
- /**
- * An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.
- */
- @Child(name = "anchor", type = {CodeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="start | end", formalDefinition="An optional indicator for how the relationship is anchored to the related action. For example \"before the start\" or \"before the end\" of the related action." )
- protected Enumeration anchor;
-
- private static final long serialVersionUID = 451097227L;
-
- /**
- * Constructor
- */
- public ActionDefinitionRelatedActionComponent() {
- super();
- }
-
- /**
- * Constructor
- */
- public ActionDefinitionRelatedActionComponent(Identifier actionIdentifier, Enumeration relationship) {
- super();
- this.actionIdentifier = actionIdentifier;
- this.relationship = relationship;
- }
-
- /**
- * @return {@link #actionIdentifier} (The unique identifier of the related action.)
- */
- public Identifier getActionIdentifier() {
- if (this.actionIdentifier == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionRelatedActionComponent.actionIdentifier");
- else if (Configuration.doAutoCreate())
- this.actionIdentifier = new Identifier(); // cc
- return this.actionIdentifier;
- }
-
- public boolean hasActionIdentifier() {
- return this.actionIdentifier != null && !this.actionIdentifier.isEmpty();
- }
-
- /**
- * @param value {@link #actionIdentifier} (The unique identifier of the related action.)
- */
- public ActionDefinitionRelatedActionComponent setActionIdentifier(Identifier value) {
- this.actionIdentifier = value;
- return this;
- }
-
- /**
- * @return {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
- */
- public Enumeration getRelationshipElement() {
- if (this.relationship == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionRelatedActionComponent.relationship");
- else if (Configuration.doAutoCreate())
- this.relationship = new Enumeration(new ActionRelationshipTypeEnumFactory()); // bb
- return this.relationship;
- }
-
- public boolean hasRelationshipElement() {
- return this.relationship != null && !this.relationship.isEmpty();
- }
-
- public boolean hasRelationship() {
- return this.relationship != null && !this.relationship.isEmpty();
- }
-
- /**
- * @param value {@link #relationship} (The relationship of this action to the related action.). This is the underlying object with id, value and extensions. The accessor "getRelationship" gives direct access to the value
- */
- public ActionDefinitionRelatedActionComponent setRelationshipElement(Enumeration value) {
- this.relationship = value;
- return this;
- }
-
- /**
- * @return The relationship of this action to the related action.
- */
- public ActionRelationshipType getRelationship() {
- return this.relationship == null ? null : this.relationship.getValue();
- }
-
- /**
- * @param value The relationship of this action to the related action.
- */
- public ActionDefinitionRelatedActionComponent setRelationship(ActionRelationshipType value) {
- if (this.relationship == null)
- this.relationship = new Enumeration(new ActionRelationshipTypeEnumFactory());
- this.relationship.setValue(value);
- return this;
- }
-
- /**
- * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
- */
- public Type getOffset() {
- return this.offset;
- }
-
- /**
- * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
- */
- public Duration getOffsetDuration() throws FHIRException {
- if (!(this.offset instanceof Duration))
- throw new FHIRException("Type mismatch: the type Duration was expected, but "+this.offset.getClass().getName()+" was encountered");
- return (Duration) this.offset;
- }
-
- public boolean hasOffsetDuration() {
- return this.offset instanceof Duration;
- }
-
- /**
- * @return {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
- */
- public Range getOffsetRange() throws FHIRException {
- if (!(this.offset instanceof Range))
- throw new FHIRException("Type mismatch: the type Range was expected, but "+this.offset.getClass().getName()+" was encountered");
- return (Range) this.offset;
- }
-
- public boolean hasOffsetRange() {
- return this.offset instanceof Range;
- }
-
- public boolean hasOffset() {
- return this.offset != null && !this.offset.isEmpty();
- }
-
- /**
- * @param value {@link #offset} (A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.)
- */
- public ActionDefinitionRelatedActionComponent setOffset(Type value) {
- this.offset = value;
- return this;
- }
-
- /**
- * @return {@link #anchor} (An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.). This is the underlying object with id, value and extensions. The accessor "getAnchor" gives direct access to the value
- */
- public Enumeration getAnchorElement() {
- if (this.anchor == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionRelatedActionComponent.anchor");
- else if (Configuration.doAutoCreate())
- this.anchor = new Enumeration(new ActionRelationshipAnchorEnumFactory()); // bb
- return this.anchor;
- }
-
- public boolean hasAnchorElement() {
- return this.anchor != null && !this.anchor.isEmpty();
- }
-
- public boolean hasAnchor() {
- return this.anchor != null && !this.anchor.isEmpty();
- }
-
- /**
- * @param value {@link #anchor} (An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.). This is the underlying object with id, value and extensions. The accessor "getAnchor" gives direct access to the value
- */
- public ActionDefinitionRelatedActionComponent setAnchorElement(Enumeration value) {
- this.anchor = value;
- return this;
- }
-
- /**
- * @return An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.
- */
- public ActionRelationshipAnchor getAnchor() {
- return this.anchor == null ? null : this.anchor.getValue();
- }
-
- /**
- * @param value An optional indicator for how the relationship is anchored to the related action. For example "before the start" or "before the end" of the related action.
- */
- public ActionDefinitionRelatedActionComponent setAnchor(ActionRelationshipAnchor value) {
- if (value == null)
- this.anchor = null;
- else {
- if (this.anchor == null)
- this.anchor = new Enumeration(new ActionRelationshipAnchorEnumFactory());
- this.anchor.setValue(value);
- }
- return this;
- }
-
- protected void listChildren(List childrenList) {
- super.listChildren(childrenList);
- childrenList.add(new Property("actionIdentifier", "Identifier", "The unique identifier of the related action.", 0, java.lang.Integer.MAX_VALUE, actionIdentifier));
- childrenList.add(new Property("relationship", "code", "The relationship of this action to the related action.", 0, java.lang.Integer.MAX_VALUE, relationship));
- childrenList.add(new Property("offset[x]", "Duration|Range", "A duration or range of durations to apply to the relationship. For example, 30-60 minutes before.", 0, java.lang.Integer.MAX_VALUE, offset));
- childrenList.add(new Property("anchor", "code", "An optional indicator for how the relationship is anchored to the related action. For example \"before the start\" or \"before the end\" of the related action.", 0, java.lang.Integer.MAX_VALUE, anchor));
- }
-
- @Override
- public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
- switch (hash) {
- case -889046145: /*actionIdentifier*/ return this.actionIdentifier == null ? new Base[0] : new Base[] {this.actionIdentifier}; // Identifier
- case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Enumeration
- case -1019779949: /*offset*/ return this.offset == null ? new Base[0] : new Base[] {this.offset}; // Type
- case -1413299531: /*anchor*/ return this.anchor == null ? new Base[0] : new Base[] {this.anchor}; // Enumeration
- default: return super.getProperty(hash, name, checkValid);
- }
-
- }
-
- @Override
- public void setProperty(int hash, String name, Base value) throws FHIRException {
- switch (hash) {
- case -889046145: // actionIdentifier
- this.actionIdentifier = castToIdentifier(value); // Identifier
- break;
- case -261851592: // relationship
- this.relationship = new ActionRelationshipTypeEnumFactory().fromType(value); // Enumeration
- break;
- case -1019779949: // offset
- this.offset = (Type) value; // Type
- break;
- case -1413299531: // anchor
- this.anchor = new ActionRelationshipAnchorEnumFactory().fromType(value); // Enumeration
- break;
- default: super.setProperty(hash, name, value);
- }
-
- }
-
- @Override
- public void setProperty(String name, Base value) throws FHIRException {
- if (name.equals("actionIdentifier"))
- this.actionIdentifier = castToIdentifier(value); // Identifier
- else if (name.equals("relationship"))
- this.relationship = new ActionRelationshipTypeEnumFactory().fromType(value); // Enumeration
- else if (name.equals("offset[x]"))
- this.offset = (Type) value; // Type
- else if (name.equals("anchor"))
- this.anchor = new ActionRelationshipAnchorEnumFactory().fromType(value); // Enumeration
- else
- super.setProperty(name, value);
- }
-
- @Override
- public Base makeProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case -889046145: return getActionIdentifier(); // Identifier
- case -261851592: throw new FHIRException("Cannot make property relationship as it is not a complex type"); // Enumeration
- case -1960684787: return getOffset(); // Type
- case -1413299531: throw new FHIRException("Cannot make property anchor as it is not a complex type"); // Enumeration
- default: return super.makeProperty(hash, name);
- }
-
- }
-
- @Override
- public Base addChild(String name) throws FHIRException {
- if (name.equals("actionIdentifier")) {
- this.actionIdentifier = new Identifier();
- return this.actionIdentifier;
- }
- else if (name.equals("relationship")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.relationship");
- }
- else if (name.equals("offsetDuration")) {
- this.offset = new Duration();
- return this.offset;
- }
- else if (name.equals("offsetRange")) {
- this.offset = new Range();
- return this.offset;
- }
- else if (name.equals("anchor")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.anchor");
- }
- else
- return super.addChild(name);
- }
-
- public ActionDefinitionRelatedActionComponent copy() {
- ActionDefinitionRelatedActionComponent dst = new ActionDefinitionRelatedActionComponent();
- copyValues(dst);
- dst.actionIdentifier = actionIdentifier == null ? null : actionIdentifier.copy();
- dst.relationship = relationship == null ? null : relationship.copy();
- dst.offset = offset == null ? null : offset.copy();
- dst.anchor = anchor == null ? null : anchor.copy();
- return dst;
- }
-
- @Override
- public boolean equalsDeep(Base other) {
- if (!super.equalsDeep(other))
- return false;
- if (!(other instanceof ActionDefinitionRelatedActionComponent))
- return false;
- ActionDefinitionRelatedActionComponent o = (ActionDefinitionRelatedActionComponent) other;
- return compareDeep(actionIdentifier, o.actionIdentifier, true) && compareDeep(relationship, o.relationship, true)
- && compareDeep(offset, o.offset, true) && compareDeep(anchor, o.anchor, true);
- }
-
- @Override
- public boolean equalsShallow(Base other) {
- if (!super.equalsShallow(other))
- return false;
- if (!(other instanceof ActionDefinitionRelatedActionComponent))
- return false;
- ActionDefinitionRelatedActionComponent o = (ActionDefinitionRelatedActionComponent) other;
- return compareValues(relationship, o.relationship, true) && compareValues(anchor, o.anchor, true);
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && (actionIdentifier == null || actionIdentifier.isEmpty()) && (relationship == null || relationship.isEmpty())
- && (offset == null || offset.isEmpty()) && (anchor == null || anchor.isEmpty());
- }
-
- public String fhirType() {
- return "ActionDefinition.relatedAction";
-
- }
-
- }
-
- @Block()
- public static class ActionDefinitionBehaviorComponent extends Element implements IBaseDatatypeElement {
- /**
- * The type of the behavior to be described, such as grouping, visual, or selection behaviors.
- */
- @Child(name = "type", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
- @Description(shortDefinition="The type of behavior (grouping, precheck, selection, cardinality, etc)", formalDefinition="The type of the behavior to be described, such as grouping, visual, or selection behaviors." )
- protected Coding type;
-
- /**
- * The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.
- */
- @Child(name = "value", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Specific behavior (e.g. required, at-most-one, single, etc)", formalDefinition="The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset." )
- protected Coding value;
-
- private static final long serialVersionUID = -1054119695L;
-
- /**
- * Constructor
- */
- public ActionDefinitionBehaviorComponent() {
- super();
- }
-
- /**
- * Constructor
- */
- public ActionDefinitionBehaviorComponent(Coding type, Coding value) {
- super();
- this.type = type;
- this.value = value;
- }
-
- /**
- * @return {@link #type} (The type of the behavior to be described, such as grouping, visual, or selection behaviors.)
- */
- public Coding getType() {
- if (this.type == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionBehaviorComponent.type");
- else if (Configuration.doAutoCreate())
- this.type = new Coding(); // cc
- return this.type;
- }
-
- public boolean hasType() {
- return this.type != null && !this.type.isEmpty();
- }
-
- /**
- * @param value {@link #type} (The type of the behavior to be described, such as grouping, visual, or selection behaviors.)
- */
- public ActionDefinitionBehaviorComponent setType(Coding value) {
- this.type = value;
- return this;
- }
-
- /**
- * @return {@link #value} (The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.)
- */
- public Coding getValue() {
- if (this.value == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionBehaviorComponent.value");
- else if (Configuration.doAutoCreate())
- this.value = new Coding(); // cc
- return this.value;
- }
-
- public boolean hasValue() {
- return this.value != null && !this.value.isEmpty();
- }
-
- /**
- * @param value {@link #value} (The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.)
- */
- public ActionDefinitionBehaviorComponent setValue(Coding value) {
- this.value = value;
- return this;
- }
-
- protected void listChildren(List childrenList) {
- super.listChildren(childrenList);
- childrenList.add(new Property("type", "Coding", "The type of the behavior to be described, such as grouping, visual, or selection behaviors.", 0, java.lang.Integer.MAX_VALUE, type));
- childrenList.add(new Property("value", "Coding", "The specific behavior. The code used here is determined by the type of behavior being described. For example, the grouping behavior uses the grouping-behavior-type valueset.", 0, java.lang.Integer.MAX_VALUE, value));
- }
-
- @Override
- public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
- switch (hash) {
- case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Coding
- case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // Coding
- default: return super.getProperty(hash, name, checkValid);
- }
-
- }
-
- @Override
- public void setProperty(int hash, String name, Base value) throws FHIRException {
- switch (hash) {
- case 3575610: // type
- this.type = castToCoding(value); // Coding
- break;
- case 111972721: // value
- this.value = castToCoding(value); // Coding
- break;
- default: super.setProperty(hash, name, value);
- }
-
- }
-
- @Override
- public void setProperty(String name, Base value) throws FHIRException {
- if (name.equals("type"))
- this.type = castToCoding(value); // Coding
- else if (name.equals("value"))
- this.value = castToCoding(value); // Coding
- else
- super.setProperty(name, value);
- }
-
- @Override
- public Base makeProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case 3575610: return getType(); // Coding
- case 111972721: return getValue(); // Coding
- default: return super.makeProperty(hash, name);
- }
-
- }
-
- @Override
- public Base addChild(String name) throws FHIRException {
- if (name.equals("type")) {
- this.type = new Coding();
- return this.type;
- }
- else if (name.equals("value")) {
- this.value = new Coding();
- return this.value;
- }
- else
- return super.addChild(name);
- }
-
- public ActionDefinitionBehaviorComponent copy() {
- ActionDefinitionBehaviorComponent dst = new ActionDefinitionBehaviorComponent();
- copyValues(dst);
- dst.type = type == null ? null : type.copy();
- dst.value = value == null ? null : value.copy();
- return dst;
- }
-
- @Override
- public boolean equalsDeep(Base other) {
- if (!super.equalsDeep(other))
- return false;
- if (!(other instanceof ActionDefinitionBehaviorComponent))
- return false;
- ActionDefinitionBehaviorComponent o = (ActionDefinitionBehaviorComponent) other;
- return compareDeep(type, o.type, true) && compareDeep(value, o.value, true);
- }
-
- @Override
- public boolean equalsShallow(Base other) {
- if (!super.equalsShallow(other))
- return false;
- if (!(other instanceof ActionDefinitionBehaviorComponent))
- return false;
- ActionDefinitionBehaviorComponent o = (ActionDefinitionBehaviorComponent) other;
- return true;
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && (type == null || type.isEmpty()) && (value == null || value.isEmpty())
- ;
- }
-
- public String fhirType() {
- return "ActionDefinition.behavior";
-
- }
-
- }
-
- @Block()
- public static class ActionDefinitionCustomizationComponent extends Element implements IBaseDatatypeElement {
- /**
- * The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
- */
- @Child(name = "path", type = {StringType.class}, order=1, min=1, max=1, modifier=false, summary=true)
- @Description(shortDefinition="The path to the element to be set dynamically", formalDefinition="The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression." )
- protected StringType path;
-
- /**
- * An expression specifying the value of the customized element.
- */
- @Child(name = "expression", type = {StringType.class}, order=2, min=1, max=1, modifier=false, summary=true)
- @Description(shortDefinition="An expression that provides the dynamic value for the customization", formalDefinition="An expression specifying the value of the customized element." )
- protected StringType expression;
-
- private static final long serialVersionUID = -252690483L;
-
- /**
- * Constructor
- */
- public ActionDefinitionCustomizationComponent() {
- super();
- }
-
- /**
- * Constructor
- */
- public ActionDefinitionCustomizationComponent(StringType path, StringType expression) {
- super();
- this.path = path;
- this.expression = expression;
- }
-
- /**
- * @return {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
- */
- public StringType getPathElement() {
- if (this.path == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionCustomizationComponent.path");
- else if (Configuration.doAutoCreate())
- this.path = new StringType(); // bb
- return this.path;
- }
-
- public boolean hasPathElement() {
- return this.path != null && !this.path.isEmpty();
- }
-
- public boolean hasPath() {
- return this.path != null && !this.path.isEmpty();
- }
-
- /**
- * @param value {@link #path} (The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.). This is the underlying object with id, value and extensions. The accessor "getPath" gives direct access to the value
- */
- public ActionDefinitionCustomizationComponent setPathElement(StringType value) {
- this.path = value;
- return this;
- }
-
- /**
- * @return The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
- */
- public String getPath() {
- return this.path == null ? null : this.path.getValue();
- }
-
- /**
- * @param value The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.
- */
- public ActionDefinitionCustomizationComponent setPath(String value) {
- if (this.path == null)
- this.path = new StringType();
- this.path.setValue(value);
- return this;
- }
-
- /**
- * @return {@link #expression} (An expression specifying the value of the customized element.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
- */
- public StringType getExpressionElement() {
- if (this.expression == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinitionCustomizationComponent.expression");
- else if (Configuration.doAutoCreate())
- this.expression = new StringType(); // bb
- return this.expression;
- }
-
- public boolean hasExpressionElement() {
- return this.expression != null && !this.expression.isEmpty();
- }
-
- public boolean hasExpression() {
- return this.expression != null && !this.expression.isEmpty();
- }
-
- /**
- * @param value {@link #expression} (An expression specifying the value of the customized element.). This is the underlying object with id, value and extensions. The accessor "getExpression" gives direct access to the value
- */
- public ActionDefinitionCustomizationComponent setExpressionElement(StringType value) {
- this.expression = value;
- return this;
- }
-
- /**
- * @return An expression specifying the value of the customized element.
- */
- public String getExpression() {
- return this.expression == null ? null : this.expression.getValue();
- }
-
- /**
- * @param value An expression specifying the value of the customized element.
- */
- public ActionDefinitionCustomizationComponent setExpression(String value) {
- if (this.expression == null)
- this.expression = new StringType();
- this.expression.setValue(value);
- return this;
- }
-
- protected void listChildren(List childrenList) {
- super.listChildren(childrenList);
- childrenList.add(new Property("path", "string", "The path to the element to be customized. This is the path on the resource that will hold the result of the calculation defined by the expression.", 0, java.lang.Integer.MAX_VALUE, path));
- childrenList.add(new Property("expression", "string", "An expression specifying the value of the customized element.", 0, java.lang.Integer.MAX_VALUE, expression));
- }
-
- @Override
- public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
- switch (hash) {
- case 3433509: /*path*/ return this.path == null ? new Base[0] : new Base[] {this.path}; // StringType
- case -1795452264: /*expression*/ return this.expression == null ? new Base[0] : new Base[] {this.expression}; // StringType
- default: return super.getProperty(hash, name, checkValid);
- }
-
- }
-
- @Override
- public void setProperty(int hash, String name, Base value) throws FHIRException {
- switch (hash) {
- case 3433509: // path
- this.path = castToString(value); // StringType
- break;
- case -1795452264: // expression
- this.expression = castToString(value); // StringType
- break;
- default: super.setProperty(hash, name, value);
- }
-
- }
-
- @Override
- public void setProperty(String name, Base value) throws FHIRException {
- if (name.equals("path"))
- this.path = castToString(value); // StringType
- else if (name.equals("expression"))
- this.expression = castToString(value); // StringType
- else
- super.setProperty(name, value);
- }
-
- @Override
- public Base makeProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case 3433509: throw new FHIRException("Cannot make property path as it is not a complex type"); // StringType
- case -1795452264: throw new FHIRException("Cannot make property expression 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("path")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.path");
- }
- else if (name.equals("expression")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.expression");
- }
- else
- return super.addChild(name);
- }
-
- public ActionDefinitionCustomizationComponent copy() {
- ActionDefinitionCustomizationComponent dst = new ActionDefinitionCustomizationComponent();
- copyValues(dst);
- dst.path = path == null ? null : path.copy();
- dst.expression = expression == null ? null : expression.copy();
- return dst;
- }
-
- @Override
- public boolean equalsDeep(Base other) {
- if (!super.equalsDeep(other))
- return false;
- if (!(other instanceof ActionDefinitionCustomizationComponent))
- return false;
- ActionDefinitionCustomizationComponent o = (ActionDefinitionCustomizationComponent) other;
- return compareDeep(path, o.path, true) && compareDeep(expression, o.expression, true);
- }
-
- @Override
- public boolean equalsShallow(Base other) {
- if (!super.equalsShallow(other))
- return false;
- if (!(other instanceof ActionDefinitionCustomizationComponent))
- return false;
- ActionDefinitionCustomizationComponent o = (ActionDefinitionCustomizationComponent) other;
- return compareValues(path, o.path, true) && compareValues(expression, o.expression, true);
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && (path == null || path.isEmpty()) && (expression == null || expression.isEmpty())
- ;
- }
-
- public String fhirType() {
- return "ActionDefinition.customization";
-
- }
-
- }
-
- /**
- * A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.
- */
- @Child(name = "actionIdentifier", type = {Identifier.class}, order=0, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Unique identifier", formalDefinition="A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique." )
- protected Identifier actionIdentifier;
-
- /**
- * A user-visible label for the action.
- */
- @Child(name = "label", type = {StringType.class}, order=1, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="User-visible label for the action (e.g. 1. or A.)", formalDefinition="A user-visible label for the action." )
- protected StringType label;
-
- /**
- * The title of the action displayed to a user.
- */
- @Child(name = "title", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="User-visible title", formalDefinition="The title of the action displayed to a user." )
- protected StringType title;
-
- /**
- * A short description of the action used to provide a summary to display to the user.
- */
- @Child(name = "description", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Short description of the action", formalDefinition="A short description of the action used to provide a summary to display to the user." )
- protected StringType description;
-
- /**
- * A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.
- */
- @Child(name = "textEquivalent", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Static text equivalent of the action, used if the dynamic aspects cannot be interpreted by the receiving system", formalDefinition="A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically." )
- protected StringType textEquivalent;
-
- /**
- * The concept represented by this action or its sub-actions.
- */
- @Child(name = "concept", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="The meaning of the action or its sub-actions", formalDefinition="The concept represented by this action or its sub-actions." )
- protected List concept;
-
- /**
- * The evidence grade and the sources of evidence for this action.
- */
- @Child(name = "supportingEvidence", type = {Attachment.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Evidence that supports taking the action", formalDefinition="The evidence grade and the sources of evidence for this action." )
- protected List supportingEvidence;
-
- /**
- * Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.
- */
- @Child(name = "documentation", type = {Attachment.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Supporting documentation for the intended performer of the action", formalDefinition="Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources." )
- protected List documentation;
-
- /**
- * A relationship to another action such as "before" or "30-60 minutes after start of".
- */
- @Child(name = "relatedAction", type = {}, order=8, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Relationship to another action", formalDefinition="A relationship to another action such as \"before\" or \"30-60 minutes after start of\"." )
- protected ActionDefinitionRelatedActionComponent relatedAction;
-
- /**
- * The type of participant in the action.
- */
- @Child(name = "participantType", type = {CodeType.class}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="patient | practitioner | related-person", formalDefinition="The type of participant in the action." )
- protected List> participantType;
-
- /**
- * The type of action to perform (create, update, remove).
- */
- @Child(name = "type", type = {CodeType.class}, order=10, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="create | update | remove | fire-event", formalDefinition="The type of action to perform (create, update, remove)." )
- protected Enumeration type;
-
- /**
- * A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.
- */
- @Child(name = "behavior", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Defines behaviors such as selection and grouping", formalDefinition="A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment." )
- protected List behavior;
-
- /**
- * The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).
- */
- @Child(name = "resource", type = {}, order=12, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Static portion of the action definition", formalDefinition="The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition)." )
- protected Reference resource;
-
- /**
- * The actual object that is the target of the reference (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
- */
- protected Resource resourceTarget;
-
- /**
- * Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.
- */
- @Child(name = "customization", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Dynamic aspects of the definition", formalDefinition="Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result." )
- protected List customization;
-
- /**
- * Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.
- */
- @Child(name = "action", type = {ActionDefinition.class}, order=14, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="A sub-action", formalDefinition="Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition." )
- protected List action;
-
- private static final long serialVersionUID = -1659761573L;
-
- /**
- * Constructor
- */
- public ActionDefinition() {
- super();
- }
-
- /**
- * @return {@link #actionIdentifier} (A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.)
- */
- public Identifier getActionIdentifier() {
- if (this.actionIdentifier == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinition.actionIdentifier");
- else if (Configuration.doAutoCreate())
- this.actionIdentifier = new Identifier(); // cc
- return this.actionIdentifier;
- }
-
- public boolean hasActionIdentifier() {
- return this.actionIdentifier != null && !this.actionIdentifier.isEmpty();
- }
-
- /**
- * @param value {@link #actionIdentifier} (A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.)
- */
- public ActionDefinition setActionIdentifier(Identifier value) {
- this.actionIdentifier = value;
- return this;
- }
-
- /**
- * @return {@link #label} (A user-visible label for the action.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
- */
- public StringType getLabelElement() {
- if (this.label == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinition.label");
- else if (Configuration.doAutoCreate())
- this.label = new StringType(); // bb
- return this.label;
- }
-
- public boolean hasLabelElement() {
- return this.label != null && !this.label.isEmpty();
- }
-
- public boolean hasLabel() {
- return this.label != null && !this.label.isEmpty();
- }
-
- /**
- * @param value {@link #label} (A user-visible label for the action.). This is the underlying object with id, value and extensions. The accessor "getLabel" gives direct access to the value
- */
- public ActionDefinition setLabelElement(StringType value) {
- this.label = value;
- return this;
- }
-
- /**
- * @return A user-visible label for the action.
- */
- public String getLabel() {
- return this.label == null ? null : this.label.getValue();
- }
-
- /**
- * @param value A user-visible label for the action.
- */
- public ActionDefinition setLabel(String value) {
- if (Utilities.noString(value))
- this.label = null;
- else {
- if (this.label == null)
- this.label = new StringType();
- this.label.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #title} (The title of the action displayed to a user.). 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 ActionDefinition.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} (The title of the action displayed to a user.). This is the underlying object with id, value and extensions. The accessor "getTitle" gives direct access to the value
- */
- public ActionDefinition setTitleElement(StringType value) {
- this.title = value;
- return this;
- }
-
- /**
- * @return The title of the action displayed to a user.
- */
- public String getTitle() {
- return this.title == null ? null : this.title.getValue();
- }
-
- /**
- * @param value The title of the action displayed to a user.
- */
- public ActionDefinition 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 #description} (A short description of the action used to provide a summary to display to the user.). 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 ActionDefinition.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} (A short description of the action used to provide a summary to display to the user.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
- */
- public ActionDefinition setDescriptionElement(StringType value) {
- this.description = value;
- return this;
- }
-
- /**
- * @return A short description of the action used to provide a summary to display to the user.
- */
- public String getDescription() {
- return this.description == null ? null : this.description.getValue();
- }
-
- /**
- * @param value A short description of the action used to provide a summary to display to the user.
- */
- public ActionDefinition 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 #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
- */
- public StringType getTextEquivalentElement() {
- if (this.textEquivalent == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinition.textEquivalent");
- else if (Configuration.doAutoCreate())
- this.textEquivalent = new StringType(); // bb
- return this.textEquivalent;
- }
-
- public boolean hasTextEquivalentElement() {
- return this.textEquivalent != null && !this.textEquivalent.isEmpty();
- }
-
- public boolean hasTextEquivalent() {
- return this.textEquivalent != null && !this.textEquivalent.isEmpty();
- }
-
- /**
- * @param value {@link #textEquivalent} (A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.). This is the underlying object with id, value and extensions. The accessor "getTextEquivalent" gives direct access to the value
- */
- public ActionDefinition setTextEquivalentElement(StringType value) {
- this.textEquivalent = value;
- return this;
- }
-
- /**
- * @return A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.
- */
- public String getTextEquivalent() {
- return this.textEquivalent == null ? null : this.textEquivalent.getValue();
- }
-
- /**
- * @param value A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.
- */
- public ActionDefinition setTextEquivalent(String value) {
- if (Utilities.noString(value))
- this.textEquivalent = null;
- else {
- if (this.textEquivalent == null)
- this.textEquivalent = new StringType();
- this.textEquivalent.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #concept} (The concept represented by this action or its sub-actions.)
- */
- public List getConcept() {
- if (this.concept == null)
- this.concept = new ArrayList();
- return this.concept;
- }
-
- public boolean hasConcept() {
- if (this.concept == null)
- return false;
- for (CodeableConcept item : this.concept)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #concept} (The concept represented by this action or its sub-actions.)
- */
- // syntactic sugar
- public CodeableConcept addConcept() { //3
- CodeableConcept t = new CodeableConcept();
- if (this.concept == null)
- this.concept = new ArrayList();
- this.concept.add(t);
- return t;
- }
-
- // syntactic sugar
- public ActionDefinition addConcept(CodeableConcept t) { //3
- if (t == null)
- return this;
- if (this.concept == null)
- this.concept = new ArrayList();
- this.concept.add(t);
- return this;
- }
-
- /**
- * @return {@link #supportingEvidence} (The evidence grade and the sources of evidence for this action.)
- */
- public List getSupportingEvidence() {
- if (this.supportingEvidence == null)
- this.supportingEvidence = new ArrayList();
- return this.supportingEvidence;
- }
-
- public boolean hasSupportingEvidence() {
- if (this.supportingEvidence == null)
- return false;
- for (Attachment item : this.supportingEvidence)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #supportingEvidence} (The evidence grade and the sources of evidence for this action.)
- */
- // syntactic sugar
- public Attachment addSupportingEvidence() { //3
- Attachment t = new Attachment();
- if (this.supportingEvidence == null)
- this.supportingEvidence = new ArrayList();
- this.supportingEvidence.add(t);
- return t;
- }
-
- // syntactic sugar
- public ActionDefinition addSupportingEvidence(Attachment t) { //3
- if (t == null)
- return this;
- if (this.supportingEvidence == null)
- this.supportingEvidence = new ArrayList();
- this.supportingEvidence.add(t);
- return this;
- }
-
- /**
- * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
- */
- public List getDocumentation() {
- if (this.documentation == null)
- this.documentation = new ArrayList();
- return this.documentation;
- }
-
- public boolean hasDocumentation() {
- if (this.documentation == null)
- return false;
- for (Attachment item : this.documentation)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #documentation} (Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.)
- */
- // syntactic sugar
- public Attachment addDocumentation() { //3
- Attachment t = new Attachment();
- if (this.documentation == null)
- this.documentation = new ArrayList();
- this.documentation.add(t);
- return t;
- }
-
- // syntactic sugar
- public ActionDefinition addDocumentation(Attachment t) { //3
- if (t == null)
- return this;
- if (this.documentation == null)
- this.documentation = new ArrayList();
- this.documentation.add(t);
- return this;
- }
-
- /**
- * @return {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
- */
- public ActionDefinitionRelatedActionComponent getRelatedAction() {
- if (this.relatedAction == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinition.relatedAction");
- else if (Configuration.doAutoCreate())
- this.relatedAction = new ActionDefinitionRelatedActionComponent(); // cc
- return this.relatedAction;
- }
-
- public boolean hasRelatedAction() {
- return this.relatedAction != null && !this.relatedAction.isEmpty();
- }
-
- /**
- * @param value {@link #relatedAction} (A relationship to another action such as "before" or "30-60 minutes after start of".)
- */
- public ActionDefinition setRelatedAction(ActionDefinitionRelatedActionComponent value) {
- this.relatedAction = value;
- return this;
- }
-
- /**
- * @return {@link #participantType} (The type of participant in the action.)
- */
- public List> getParticipantType() {
- if (this.participantType == null)
- this.participantType = new ArrayList>();
- return this.participantType;
- }
-
- public boolean hasParticipantType() {
- if (this.participantType == null)
- return false;
- for (Enumeration item : this.participantType)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #participantType} (The type of participant in the action.)
- */
- // syntactic sugar
- public Enumeration addParticipantTypeElement() {//2
- Enumeration t = new Enumeration(new ParticipantTypeEnumFactory());
- if (this.participantType == null)
- this.participantType = new ArrayList>();
- this.participantType.add(t);
- return t;
- }
-
- /**
- * @param value {@link #participantType} (The type of participant in the action.)
- */
- public ActionDefinition addParticipantType(ParticipantType value) { //1
- Enumeration t = new Enumeration(new ParticipantTypeEnumFactory());
- t.setValue(value);
- if (this.participantType == null)
- this.participantType = new ArrayList>();
- this.participantType.add(t);
- return this;
- }
-
- /**
- * @param value {@link #participantType} (The type of participant in the action.)
- */
- public boolean hasParticipantType(ParticipantType value) {
- if (this.participantType == null)
- return false;
- for (Enumeration v : this.participantType)
- if (v.getValue().equals(value)) // code
- return true;
- return false;
- }
-
- /**
- * @return {@link #type} (The type of action to perform (create, update, remove).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
- */
- public Enumeration getTypeElement() {
- if (this.type == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinition.type");
- else if (Configuration.doAutoCreate())
- this.type = new Enumeration(new ActionTypeEnumFactory()); // bb
- return this.type;
- }
-
- public boolean hasTypeElement() {
- return this.type != null && !this.type.isEmpty();
- }
-
- public boolean hasType() {
- return this.type != null && !this.type.isEmpty();
- }
-
- /**
- * @param value {@link #type} (The type of action to perform (create, update, remove).). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
- */
- public ActionDefinition setTypeElement(Enumeration value) {
- this.type = value;
- return this;
- }
-
- /**
- * @return The type of action to perform (create, update, remove).
- */
- public ActionType getType() {
- return this.type == null ? null : this.type.getValue();
- }
-
- /**
- * @param value The type of action to perform (create, update, remove).
- */
- public ActionDefinition setType(ActionType value) {
- if (value == null)
- this.type = null;
- else {
- if (this.type == null)
- this.type = new Enumeration(new ActionTypeEnumFactory());
- this.type.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #behavior} (A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.)
- */
- public List getBehavior() {
- if (this.behavior == null)
- this.behavior = new ArrayList();
- return this.behavior;
- }
-
- public boolean hasBehavior() {
- if (this.behavior == null)
- return false;
- for (ActionDefinitionBehaviorComponent item : this.behavior)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #behavior} (A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.)
- */
- // syntactic sugar
- public ActionDefinitionBehaviorComponent addBehavior() { //3
- ActionDefinitionBehaviorComponent t = new ActionDefinitionBehaviorComponent();
- if (this.behavior == null)
- this.behavior = new ArrayList();
- this.behavior.add(t);
- return t;
- }
-
- // syntactic sugar
- public ActionDefinition addBehavior(ActionDefinitionBehaviorComponent t) { //3
- if (t == null)
- return this;
- if (this.behavior == null)
- this.behavior = new ArrayList();
- this.behavior.add(t);
- return this;
- }
-
- /**
- * @return {@link #resource} (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
- */
- public Reference getResource() {
- if (this.resource == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create ActionDefinition.resource");
- else if (Configuration.doAutoCreate())
- this.resource = new Reference(); // cc
- return this.resource;
- }
-
- public boolean hasResource() {
- return this.resource != null && !this.resource.isEmpty();
- }
-
- /**
- * @param value {@link #resource} (The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
- */
- public ActionDefinition setResource(Reference value) {
- this.resource = value;
- return this;
- }
-
- /**
- * @return {@link #resource} 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 resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
- */
- public Resource getResourceTarget() {
- return this.resourceTarget;
- }
-
- /**
- * @param value {@link #resource} 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 resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).)
- */
- public ActionDefinition setResourceTarget(Resource value) {
- this.resourceTarget = value;
- return this;
- }
-
- /**
- * @return {@link #customization} (Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.)
- */
- public List getCustomization() {
- if (this.customization == null)
- this.customization = new ArrayList();
- return this.customization;
- }
-
- public boolean hasCustomization() {
- if (this.customization == null)
- return false;
- for (ActionDefinitionCustomizationComponent item : this.customization)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #customization} (Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.)
- */
- // syntactic sugar
- public ActionDefinitionCustomizationComponent addCustomization() { //3
- ActionDefinitionCustomizationComponent t = new ActionDefinitionCustomizationComponent();
- if (this.customization == null)
- this.customization = new ArrayList();
- this.customization.add(t);
- return t;
- }
-
- // syntactic sugar
- public ActionDefinition addCustomization(ActionDefinitionCustomizationComponent t) { //3
- if (t == null)
- return this;
- if (this.customization == null)
- this.customization = new ArrayList();
- this.customization.add(t);
- return this;
- }
-
- /**
- * @return {@link #action} (Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.)
- */
- public List getAction() {
- if (this.action == null)
- this.action = new ArrayList();
- 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} (Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.)
- */
- // syntactic sugar
- public ActionDefinition addAction() { //3
- ActionDefinition t = new ActionDefinition();
- if (this.action == null)
- this.action = new ArrayList();
- this.action.add(t);
- return t;
- }
-
- // syntactic sugar
- public ActionDefinition addAction(ActionDefinition t) { //3
- if (t == null)
- return this;
- if (this.action == null)
- this.action = new ArrayList();
- this.action.add(t);
- return this;
- }
-
- protected void listChildren(List childrenList) {
- super.listChildren(childrenList);
- childrenList.add(new Property("actionIdentifier", "Identifier", "A unique identifier for the action. The identifier SHALL be unique within the container in which it appears, and MAY be universally unique.", 0, java.lang.Integer.MAX_VALUE, actionIdentifier));
- childrenList.add(new Property("label", "string", "A user-visible label for the action.", 0, java.lang.Integer.MAX_VALUE, label));
- childrenList.add(new Property("title", "string", "The title of the action displayed to a user.", 0, java.lang.Integer.MAX_VALUE, title));
- childrenList.add(new Property("description", "string", "A short description of the action used to provide a summary to display to the user.", 0, java.lang.Integer.MAX_VALUE, description));
- childrenList.add(new Property("textEquivalent", "string", "A text equivalent of the action to be performed. This provides a human-interpretable description of the action when the definition is consumed by a system that may not be capable of interpreting it dynamically.", 0, java.lang.Integer.MAX_VALUE, textEquivalent));
- childrenList.add(new Property("concept", "CodeableConcept", "The concept represented by this action or its sub-actions.", 0, java.lang.Integer.MAX_VALUE, concept));
- childrenList.add(new Property("supportingEvidence", "Attachment", "The evidence grade and the sources of evidence for this action.", 0, java.lang.Integer.MAX_VALUE, supportingEvidence));
- childrenList.add(new Property("documentation", "Attachment", "Didactic or other informational resources associated with the action that can be provided to the CDS recipient. Information resources can include inline text commentary and links to web resources.", 0, java.lang.Integer.MAX_VALUE, documentation));
- childrenList.add(new Property("relatedAction", "", "A relationship to another action such as \"before\" or \"30-60 minutes after start of\".", 0, java.lang.Integer.MAX_VALUE, relatedAction));
- childrenList.add(new Property("participantType", "code", "The type of participant in the action.", 0, java.lang.Integer.MAX_VALUE, participantType));
- childrenList.add(new Property("type", "code", "The type of action to perform (create, update, remove).", 0, java.lang.Integer.MAX_VALUE, type));
- childrenList.add(new Property("behavior", "", "A behavior associated with the action. Behaviors define how the action is to be presented and/or executed within the receiving environment.", 0, java.lang.Integer.MAX_VALUE, behavior));
- childrenList.add(new Property("resource", "Reference(Any)", "The resource that is the target of the action (e.g. CommunicationRequest). The resource described here defines any aspects of the action that can be specified statically (i.e. are known at the time of definition).", 0, java.lang.Integer.MAX_VALUE, resource));
- childrenList.add(new Property("customization", "", "Customizations that should be applied to the statically defined resource. For example, if the dosage of a medication must be computed based on the patient's weight, a customization would be used to specify an expression that calculated the weight, and the path on the resource that would contain the result.", 0, java.lang.Integer.MAX_VALUE, customization));
- childrenList.add(new Property("action", "ActionDefinition", "Sub actions that are contained within the action. The behavior of this action determines the functionality of the sub-actions. For example, a selection behavior of at-most-one indicates that of the sub-actions, at most one may be chosen as part of realizing the action definition.", 0, java.lang.Integer.MAX_VALUE, action));
- }
-
- @Override
- public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
- switch (hash) {
- case -889046145: /*actionIdentifier*/ return this.actionIdentifier == null ? new Base[0] : new Base[] {this.actionIdentifier}; // Identifier
- case 102727412: /*label*/ return this.label == null ? new Base[0] : new Base[] {this.label}; // StringType
- case 110371416: /*title*/ return this.title == null ? new Base[0] : new Base[] {this.title}; // StringType
- case -1724546052: /*description*/ return this.description == null ? new Base[0] : new Base[] {this.description}; // StringType
- case -900391049: /*textEquivalent*/ return this.textEquivalent == null ? new Base[0] : new Base[] {this.textEquivalent}; // StringType
- case 951024232: /*concept*/ return this.concept == null ? new Base[0] : this.concept.toArray(new Base[this.concept.size()]); // CodeableConcept
- case -1735429846: /*supportingEvidence*/ return this.supportingEvidence == null ? new Base[0] : this.supportingEvidence.toArray(new Base[this.supportingEvidence.size()]); // Attachment
- case 1587405498: /*documentation*/ return this.documentation == null ? new Base[0] : this.documentation.toArray(new Base[this.documentation.size()]); // Attachment
- case -384107967: /*relatedAction*/ return this.relatedAction == null ? new Base[0] : new Base[] {this.relatedAction}; // ActionDefinitionRelatedActionComponent
- case 841294093: /*participantType*/ return this.participantType == null ? new Base[0] : this.participantType.toArray(new Base[this.participantType.size()]); // Enumeration
- case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration
- case 1510912594: /*behavior*/ return this.behavior == null ? new Base[0] : this.behavior.toArray(new Base[this.behavior.size()]); // ActionDefinitionBehaviorComponent
- case -341064690: /*resource*/ return this.resource == null ? new Base[0] : new Base[] {this.resource}; // Reference
- case 1637263315: /*customization*/ return this.customization == null ? new Base[0] : this.customization.toArray(new Base[this.customization.size()]); // ActionDefinitionCustomizationComponent
- 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 -889046145: // actionIdentifier
- this.actionIdentifier = castToIdentifier(value); // Identifier
- break;
- case 102727412: // label
- this.label = castToString(value); // StringType
- break;
- case 110371416: // title
- this.title = castToString(value); // StringType
- break;
- case -1724546052: // description
- this.description = castToString(value); // StringType
- break;
- case -900391049: // textEquivalent
- this.textEquivalent = castToString(value); // StringType
- break;
- case 951024232: // concept
- this.getConcept().add(castToCodeableConcept(value)); // CodeableConcept
- break;
- case -1735429846: // supportingEvidence
- this.getSupportingEvidence().add(castToAttachment(value)); // Attachment
- break;
- case 1587405498: // documentation
- this.getDocumentation().add(castToAttachment(value)); // Attachment
- break;
- case -384107967: // relatedAction
- this.relatedAction = (ActionDefinitionRelatedActionComponent) value; // ActionDefinitionRelatedActionComponent
- break;
- case 841294093: // participantType
- this.getParticipantType().add(new ParticipantTypeEnumFactory().fromType(value)); // Enumeration
- break;
- case 3575610: // type
- this.type = new ActionTypeEnumFactory().fromType(value); // Enumeration
- break;
- case 1510912594: // behavior
- this.getBehavior().add((ActionDefinitionBehaviorComponent) value); // ActionDefinitionBehaviorComponent
- break;
- case -341064690: // resource
- this.resource = castToReference(value); // Reference
- break;
- case 1637263315: // customization
- this.getCustomization().add((ActionDefinitionCustomizationComponent) value); // ActionDefinitionCustomizationComponent
- 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("actionIdentifier"))
- this.actionIdentifier = castToIdentifier(value); // Identifier
- else if (name.equals("label"))
- this.label = castToString(value); // StringType
- else if (name.equals("title"))
- this.title = castToString(value); // StringType
- else if (name.equals("description"))
- this.description = castToString(value); // StringType
- else if (name.equals("textEquivalent"))
- this.textEquivalent = castToString(value); // StringType
- else if (name.equals("concept"))
- this.getConcept().add(castToCodeableConcept(value));
- else if (name.equals("supportingEvidence"))
- this.getSupportingEvidence().add(castToAttachment(value));
- else if (name.equals("documentation"))
- this.getDocumentation().add(castToAttachment(value));
- else if (name.equals("relatedAction"))
- this.relatedAction = (ActionDefinitionRelatedActionComponent) value; // ActionDefinitionRelatedActionComponent
- else if (name.equals("participantType"))
- this.getParticipantType().add(new ParticipantTypeEnumFactory().fromType(value));
- else if (name.equals("type"))
- this.type = new ActionTypeEnumFactory().fromType(value); // Enumeration
- else if (name.equals("behavior"))
- this.getBehavior().add((ActionDefinitionBehaviorComponent) value);
- else if (name.equals("resource"))
- this.resource = castToReference(value); // Reference
- else if (name.equals("customization"))
- this.getCustomization().add((ActionDefinitionCustomizationComponent) value);
- 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 -889046145: return getActionIdentifier(); // Identifier
- case 102727412: throw new FHIRException("Cannot make property label as it is not a complex type"); // StringType
- case 110371416: throw new FHIRException("Cannot make property title as it is not a complex type"); // StringType
- case -1724546052: throw new FHIRException("Cannot make property description as it is not a complex type"); // StringType
- case -900391049: throw new FHIRException("Cannot make property textEquivalent as it is not a complex type"); // StringType
- case 951024232: return addConcept(); // CodeableConcept
- case -1735429846: return addSupportingEvidence(); // Attachment
- case 1587405498: return addDocumentation(); // Attachment
- case -384107967: return getRelatedAction(); // ActionDefinitionRelatedActionComponent
- case 841294093: throw new FHIRException("Cannot make property participantType as it is not a complex type"); // Enumeration
- case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // Enumeration
- case 1510912594: return addBehavior(); // ActionDefinitionBehaviorComponent
- case -341064690: return getResource(); // Reference
- case 1637263315: return addCustomization(); // ActionDefinitionCustomizationComponent
- case -1422950858: return addAction(); // ActionDefinition
- default: return super.makeProperty(hash, name);
- }
-
- }
-
- @Override
- public Base addChild(String name) throws FHIRException {
- if (name.equals("actionIdentifier")) {
- this.actionIdentifier = new Identifier();
- return this.actionIdentifier;
- }
- else if (name.equals("label")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.label");
- }
- else if (name.equals("title")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.title");
- }
- else if (name.equals("description")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.description");
- }
- else if (name.equals("textEquivalent")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.textEquivalent");
- }
- else if (name.equals("concept")) {
- return addConcept();
- }
- else if (name.equals("supportingEvidence")) {
- return addSupportingEvidence();
- }
- else if (name.equals("documentation")) {
- return addDocumentation();
- }
- else if (name.equals("relatedAction")) {
- this.relatedAction = new ActionDefinitionRelatedActionComponent();
- return this.relatedAction;
- }
- else if (name.equals("participantType")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.participantType");
- }
- else if (name.equals("type")) {
- throw new FHIRException("Cannot call addChild on a primitive type ActionDefinition.type");
- }
- else if (name.equals("behavior")) {
- return addBehavior();
- }
- else if (name.equals("resource")) {
- this.resource = new Reference();
- return this.resource;
- }
- else if (name.equals("customization")) {
- return addCustomization();
- }
- else if (name.equals("action")) {
- return addAction();
- }
- else
- return super.addChild(name);
- }
-
- public String fhirType() {
- return "ActionDefinition";
-
- }
-
- public ActionDefinition copy() {
- ActionDefinition dst = new ActionDefinition();
- copyValues(dst);
- dst.actionIdentifier = actionIdentifier == null ? null : actionIdentifier.copy();
- dst.label = label == null ? null : label.copy();
- dst.title = title == null ? null : title.copy();
- dst.description = description == null ? null : description.copy();
- dst.textEquivalent = textEquivalent == null ? null : textEquivalent.copy();
- if (concept != null) {
- dst.concept = new ArrayList();
- for (CodeableConcept i : concept)
- dst.concept.add(i.copy());
- };
- if (supportingEvidence != null) {
- dst.supportingEvidence = new ArrayList();
- for (Attachment i : supportingEvidence)
- dst.supportingEvidence.add(i.copy());
- };
- if (documentation != null) {
- dst.documentation = new ArrayList();
- for (Attachment i : documentation)
- dst.documentation.add(i.copy());
- };
- dst.relatedAction = relatedAction == null ? null : relatedAction.copy();
- if (participantType != null) {
- dst.participantType = new ArrayList>();
- for (Enumeration i : participantType)
- dst.participantType.add(i.copy());
- };
- dst.type = type == null ? null : type.copy();
- if (behavior != null) {
- dst.behavior = new ArrayList();
- for (ActionDefinitionBehaviorComponent i : behavior)
- dst.behavior.add(i.copy());
- };
- dst.resource = resource == null ? null : resource.copy();
- if (customization != null) {
- dst.customization = new ArrayList();
- for (ActionDefinitionCustomizationComponent i : customization)
- dst.customization.add(i.copy());
- };
- if (action != null) {
- dst.action = new ArrayList();
- for (ActionDefinition i : action)
- dst.action.add(i.copy());
- };
- return dst;
- }
-
- protected ActionDefinition typedCopy() {
- return copy();
- }
-
- @Override
- public boolean equalsDeep(Base other) {
- if (!super.equalsDeep(other))
- return false;
- if (!(other instanceof ActionDefinition))
- return false;
- ActionDefinition o = (ActionDefinition) other;
- return compareDeep(actionIdentifier, o.actionIdentifier, true) && compareDeep(label, o.label, true)
- && compareDeep(title, o.title, true) && compareDeep(description, o.description, true) && compareDeep(textEquivalent, o.textEquivalent, true)
- && compareDeep(concept, o.concept, true) && compareDeep(supportingEvidence, o.supportingEvidence, true)
- && compareDeep(documentation, o.documentation, true) && compareDeep(relatedAction, o.relatedAction, true)
- && compareDeep(participantType, o.participantType, true) && compareDeep(type, o.type, true) && compareDeep(behavior, o.behavior, true)
- && compareDeep(resource, o.resource, true) && compareDeep(customization, o.customization, true)
- && compareDeep(action, o.action, true);
- }
-
- @Override
- public boolean equalsShallow(Base other) {
- if (!super.equalsShallow(other))
- return false;
- if (!(other instanceof ActionDefinition))
- return false;
- ActionDefinition o = (ActionDefinition) other;
- return compareValues(label, o.label, true) && compareValues(title, o.title, true) && compareValues(description, o.description, true)
- && compareValues(textEquivalent, o.textEquivalent, true) && compareValues(participantType, o.participantType, true)
- && compareValues(type, o.type, true);
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && (actionIdentifier == null || actionIdentifier.isEmpty()) && (label == null || label.isEmpty())
- && (title == null || title.isEmpty()) && (description == null || description.isEmpty()) && (textEquivalent == null || textEquivalent.isEmpty())
- && (concept == null || concept.isEmpty()) && (supportingEvidence == null || supportingEvidence.isEmpty())
- && (documentation == null || documentation.isEmpty()) && (relatedAction == null || relatedAction.isEmpty())
- && (participantType == null || participantType.isEmpty()) && (type == null || type.isEmpty())
- && (behavior == null || behavior.isEmpty()) && (resource == null || resource.isEmpty()) && (customization == null || customization.isEmpty())
- && (action == null || action.isEmpty());
- }
-
-
-}
-
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Address.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Address.java
deleted file mode 100644
index a611fd7a37c..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Address.java
+++ /dev/null
@@ -1,1035 +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;
-/**
- * An address expressed using postal conventions (as opposed to GPS or other location definition formats). This data type may be used to convey addresses for use in delivering mail as well as for visiting locations and which might not be valid for mail delivery. There are a variety of postal address formats defined around the world.
- */
-@DatatypeDef(name="Address")
-public class Address extends Type implements ICompositeType {
-
- public enum AddressUse {
- /**
- * A communication address at a home.
- */
- HOME,
- /**
- * An office address. First choice for business related contacts during business hours.
- */
- WORK,
- /**
- * A temporary address. The period can provide more detailed information.
- */
- TEMP,
- /**
- * This address is no longer in use (or was never correct, but retained for records).
- */
- OLD,
- /**
- * added to help the parsers
- */
- NULL;
- public static AddressUse fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("home".equals(codeString))
- return HOME;
- if ("work".equals(codeString))
- return WORK;
- if ("temp".equals(codeString))
- return TEMP;
- if ("old".equals(codeString))
- return OLD;
- throw new FHIRException("Unknown AddressUse code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case HOME: return "home";
- case WORK: return "work";
- case TEMP: return "temp";
- case OLD: return "old";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case HOME: return "http://hl7.org/fhir/address-use";
- case WORK: return "http://hl7.org/fhir/address-use";
- case TEMP: return "http://hl7.org/fhir/address-use";
- case OLD: return "http://hl7.org/fhir/address-use";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case HOME: return "A communication address at a home.";
- case WORK: return "An office address. First choice for business related contacts during business hours.";
- case TEMP: return "A temporary address. The period can provide more detailed information.";
- case OLD: return "This address is no longer in use (or was never correct, but retained for records).";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case HOME: return "Home";
- case WORK: return "Work";
- case TEMP: return "Temporary";
- case OLD: return "Old / Incorrect";
- default: return "?";
- }
- }
- }
-
- public static class AddressUseEnumFactory implements EnumFactory {
- public AddressUse fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("home".equals(codeString))
- return AddressUse.HOME;
- if ("work".equals(codeString))
- return AddressUse.WORK;
- if ("temp".equals(codeString))
- return AddressUse.TEMP;
- if ("old".equals(codeString))
- return AddressUse.OLD;
- throw new IllegalArgumentException("Unknown AddressUse code '"+codeString+"'");
- }
- public Enumeration 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(this, AddressUse.HOME);
- if ("work".equals(codeString))
- return new Enumeration(this, AddressUse.WORK);
- if ("temp".equals(codeString))
- return new Enumeration(this, AddressUse.TEMP);
- if ("old".equals(codeString))
- return new Enumeration(this, AddressUse.OLD);
- throw new FHIRException("Unknown AddressUse code '"+codeString+"'");
- }
- public String toCode(AddressUse code) {
- if (code == AddressUse.HOME)
- return "home";
- if (code == AddressUse.WORK)
- return "work";
- if (code == AddressUse.TEMP)
- return "temp";
- if (code == AddressUse.OLD)
- return "old";
- return "?";
- }
- public String toSystem(AddressUse code) {
- return code.getSystem();
- }
- }
-
- public enum AddressType {
- /**
- * Mailing addresses - PO Boxes and care-of addresses.
- */
- POSTAL,
- /**
- * A physical address that can be visited.
- */
- PHYSICAL,
- /**
- * An address that is both physical and postal.
- */
- BOTH,
- /**
- * added to help the parsers
- */
- NULL;
- public static AddressType fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("postal".equals(codeString))
- return POSTAL;
- if ("physical".equals(codeString))
- return PHYSICAL;
- if ("both".equals(codeString))
- return BOTH;
- throw new FHIRException("Unknown AddressType code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case POSTAL: return "postal";
- case PHYSICAL: return "physical";
- case BOTH: return "both";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case POSTAL: return "http://hl7.org/fhir/address-type";
- case PHYSICAL: return "http://hl7.org/fhir/address-type";
- case BOTH: return "http://hl7.org/fhir/address-type";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case POSTAL: return "Mailing addresses - PO Boxes and care-of addresses.";
- case PHYSICAL: return "A physical address that can be visited.";
- case BOTH: return "An address that is both physical and postal.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case POSTAL: return "Postal";
- case PHYSICAL: return "Physical";
- case BOTH: return "Postal & Physical";
- default: return "?";
- }
- }
- }
-
- public static class AddressTypeEnumFactory implements EnumFactory {
- public AddressType fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("postal".equals(codeString))
- return AddressType.POSTAL;
- if ("physical".equals(codeString))
- return AddressType.PHYSICAL;
- if ("both".equals(codeString))
- return AddressType.BOTH;
- throw new IllegalArgumentException("Unknown AddressType code '"+codeString+"'");
- }
- public Enumeration fromType(Base code) throws FHIRException {
- if (code == null || code.isEmpty())
- return null;
- String codeString = ((PrimitiveType) code).asStringValue();
- if (codeString == null || "".equals(codeString))
- return null;
- if ("postal".equals(codeString))
- return new Enumeration(this, AddressType.POSTAL);
- if ("physical".equals(codeString))
- return new Enumeration(this, AddressType.PHYSICAL);
- if ("both".equals(codeString))
- return new Enumeration(this, AddressType.BOTH);
- throw new FHIRException("Unknown AddressType code '"+codeString+"'");
- }
- public String toCode(AddressType code) {
- if (code == AddressType.POSTAL)
- return "postal";
- if (code == AddressType.PHYSICAL)
- return "physical";
- if (code == AddressType.BOTH)
- return "both";
- return "?";
- }
- public String toSystem(AddressType code) {
- return code.getSystem();
- }
- }
-
- /**
- * The purpose of this address.
- */
- @Child(name = "use", type = {CodeType.class}, order=0, min=0, max=1, modifier=true, summary=true)
- @Description(shortDefinition="home | work | temp | old - purpose of this address", formalDefinition="The purpose of this address." )
- protected Enumeration use;
-
- /**
- * Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
- */
- @Child(name = "type", type = {CodeType.class}, order=1, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="postal | physical | both", formalDefinition="Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both." )
- protected Enumeration type;
-
- /**
- * A full text representation of the address.
- */
- @Child(name = "text", type = {StringType.class}, order=2, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Text representation of the address", formalDefinition="A full text representation of the address." )
- protected StringType text;
-
- /**
- * This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.
- */
- @Child(name = "line", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Street name, number, direction & P.O. Box etc.", formalDefinition="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information." )
- protected List line;
-
- /**
- * The name of the city, town, village or other community or delivery center.
- */
- @Child(name = "city", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Name of city, town etc.", formalDefinition="The name of the city, town, village or other community or delivery center." )
- protected StringType city;
-
- /**
- * The name of the administrative area (county).
- */
- @Child(name = "district", type = {StringType.class}, order=5, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="District name (aka county)", formalDefinition="The name of the administrative area (county)." )
- protected StringType district;
-
- /**
- * Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
- */
- @Child(name = "state", type = {StringType.class}, order=6, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Sub-unit of country (abbreviations ok)", formalDefinition="Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes)." )
- protected StringType state;
-
- /**
- * A postal code designating a region defined by the postal service.
- */
- @Child(name = "postalCode", type = {StringType.class}, order=7, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Postal code for area", formalDefinition="A postal code designating a region defined by the postal service." )
- protected StringType postalCode;
-
- /**
- * Country - a nation as commonly understood or generally accepted.
- */
- @Child(name = "country", type = {StringType.class}, order=8, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Country (can be ISO 3166 3 letter code)", formalDefinition="Country - a nation as commonly understood or generally accepted." )
- protected StringType country;
-
- /**
- * Time period when address was/is in use.
- */
- @Child(name = "period", type = {Period.class}, order=9, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Time period when address was/is in use", formalDefinition="Time period when address was/is in use." )
- protected Period period;
-
- private static final long serialVersionUID = 561490318L;
-
- /**
- * Constructor
- */
- public Address() {
- super();
- }
-
- /**
- * @return {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
- */
- public Enumeration getUseElement() {
- if (this.use == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.use");
- else if (Configuration.doAutoCreate())
- this.use = new Enumeration(new AddressUseEnumFactory()); // bb
- return this.use;
- }
-
- public boolean hasUseElement() {
- return this.use != null && !this.use.isEmpty();
- }
-
- public boolean hasUse() {
- return this.use != null && !this.use.isEmpty();
- }
-
- /**
- * @param value {@link #use} (The purpose of this address.). This is the underlying object with id, value and extensions. The accessor "getUse" gives direct access to the value
- */
- public Address setUseElement(Enumeration value) {
- this.use = value;
- return this;
- }
-
- /**
- * @return The purpose of this address.
- */
- public AddressUse getUse() {
- return this.use == null ? null : this.use.getValue();
- }
-
- /**
- * @param value The purpose of this address.
- */
- public Address setUse(AddressUse value) {
- if (value == null)
- this.use = null;
- else {
- if (this.use == null)
- this.use = new Enumeration(new AddressUseEnumFactory());
- this.use.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #type} (Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
- */
- public Enumeration getTypeElement() {
- if (this.type == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.type");
- else if (Configuration.doAutoCreate())
- this.type = new Enumeration(new AddressTypeEnumFactory()); // bb
- return this.type;
- }
-
- public boolean hasTypeElement() {
- return this.type != null && !this.type.isEmpty();
- }
-
- public boolean hasType() {
- return this.type != null && !this.type.isEmpty();
- }
-
- /**
- * @param value {@link #type} (Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.). This is the underlying object with id, value and extensions. The accessor "getType" gives direct access to the value
- */
- public Address setTypeElement(Enumeration value) {
- this.type = value;
- return this;
- }
-
- /**
- * @return Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
- */
- public AddressType getType() {
- return this.type == null ? null : this.type.getValue();
- }
-
- /**
- * @param value Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.
- */
- public Address setType(AddressType value) {
- if (value == null)
- this.type = null;
- else {
- if (this.type == null)
- this.type = new Enumeration(new AddressTypeEnumFactory());
- this.type.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
- */
- public StringType getTextElement() {
- if (this.text == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.text");
- else if (Configuration.doAutoCreate())
- this.text = new StringType(); // bb
- return this.text;
- }
-
- public boolean hasTextElement() {
- return this.text != null && !this.text.isEmpty();
- }
-
- public boolean hasText() {
- return this.text != null && !this.text.isEmpty();
- }
-
- /**
- * @param value {@link #text} (A full text representation of the address.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
- */
- public Address setTextElement(StringType value) {
- this.text = value;
- return this;
- }
-
- /**
- * @return A full text representation of the address.
- */
- public String getText() {
- return this.text == null ? null : this.text.getValue();
- }
-
- /**
- * @param value A full text representation of the address.
- */
- public Address setText(String value) {
- if (Utilities.noString(value))
- this.text = null;
- else {
- if (this.text == null)
- this.text = new StringType();
- this.text.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
- */
- public List getLine() {
- if (this.line == null)
- this.line = new ArrayList();
- return this.line;
- }
-
- public boolean hasLine() {
- if (this.line == null)
- return false;
- for (StringType item : this.line)
- if (!item.isEmpty())
- return true;
- return false;
- }
-
- /**
- * @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
- */
- // syntactic sugar
- public StringType addLineElement() {//2
- StringType t = new StringType();
- if (this.line == null)
- this.line = new ArrayList();
- this.line.add(t);
- return t;
- }
-
- /**
- * @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
- */
- public Address addLine(String value) { //1
- StringType t = new StringType();
- t.setValue(value);
- if (this.line == null)
- this.line = new ArrayList();
- this.line.add(t);
- return this;
- }
-
- /**
- * @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
- */
- public boolean hasLine(String value) {
- if (this.line == null)
- return false;
- for (StringType v : this.line)
- if (v.equals(value)) // string
- return true;
- return false;
- }
-
- /**
- * @return {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value
- */
- public StringType getCityElement() {
- if (this.city == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.city");
- else if (Configuration.doAutoCreate())
- this.city = new StringType(); // bb
- return this.city;
- }
-
- public boolean hasCityElement() {
- return this.city != null && !this.city.isEmpty();
- }
-
- public boolean hasCity() {
- return this.city != null && !this.city.isEmpty();
- }
-
- /**
- * @param value {@link #city} (The name of the city, town, village or other community or delivery center.). This is the underlying object with id, value and extensions. The accessor "getCity" gives direct access to the value
- */
- public Address setCityElement(StringType value) {
- this.city = value;
- return this;
- }
-
- /**
- * @return The name of the city, town, village or other community or delivery center.
- */
- public String getCity() {
- return this.city == null ? null : this.city.getValue();
- }
-
- /**
- * @param value The name of the city, town, village or other community or delivery center.
- */
- public Address setCity(String value) {
- if (Utilities.noString(value))
- this.city = null;
- else {
- if (this.city == null)
- this.city = new StringType();
- this.city.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value
- */
- public StringType getDistrictElement() {
- if (this.district == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.district");
- else if (Configuration.doAutoCreate())
- this.district = new StringType(); // bb
- return this.district;
- }
-
- public boolean hasDistrictElement() {
- return this.district != null && !this.district.isEmpty();
- }
-
- public boolean hasDistrict() {
- return this.district != null && !this.district.isEmpty();
- }
-
- /**
- * @param value {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value
- */
- public Address setDistrictElement(StringType value) {
- this.district = value;
- return this;
- }
-
- /**
- * @return The name of the administrative area (county).
- */
- public String getDistrict() {
- return this.district == null ? null : this.district.getValue();
- }
-
- /**
- * @param value The name of the administrative area (county).
- */
- public Address setDistrict(String value) {
- if (Utilities.noString(value))
- this.district = null;
- else {
- if (this.district == null)
- this.district = new StringType();
- this.district.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
- */
- public StringType getStateElement() {
- if (this.state == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.state");
- else if (Configuration.doAutoCreate())
- this.state = new StringType(); // bb
- return this.state;
- }
-
- public boolean hasStateElement() {
- return this.state != null && !this.state.isEmpty();
- }
-
- public boolean hasState() {
- return this.state != null && !this.state.isEmpty();
- }
-
- /**
- * @param value {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
- */
- public Address setStateElement(StringType value) {
- this.state = value;
- return this;
- }
-
- /**
- * @return Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
- */
- public String getState() {
- return this.state == null ? null : this.state.getValue();
- }
-
- /**
- * @param value Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
- */
- public Address setState(String value) {
- if (Utilities.noString(value))
- this.state = null;
- else {
- if (this.state == null)
- this.state = new StringType();
- this.state.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value
- */
- public StringType getPostalCodeElement() {
- if (this.postalCode == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.postalCode");
- else if (Configuration.doAutoCreate())
- this.postalCode = new StringType(); // bb
- return this.postalCode;
- }
-
- public boolean hasPostalCodeElement() {
- return this.postalCode != null && !this.postalCode.isEmpty();
- }
-
- public boolean hasPostalCode() {
- return this.postalCode != null && !this.postalCode.isEmpty();
- }
-
- /**
- * @param value {@link #postalCode} (A postal code designating a region defined by the postal service.). This is the underlying object with id, value and extensions. The accessor "getPostalCode" gives direct access to the value
- */
- public Address setPostalCodeElement(StringType value) {
- this.postalCode = value;
- return this;
- }
-
- /**
- * @return A postal code designating a region defined by the postal service.
- */
- public String getPostalCode() {
- return this.postalCode == null ? null : this.postalCode.getValue();
- }
-
- /**
- * @param value A postal code designating a region defined by the postal service.
- */
- public Address setPostalCode(String value) {
- if (Utilities.noString(value))
- this.postalCode = null;
- else {
- if (this.postalCode == null)
- this.postalCode = new StringType();
- this.postalCode.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value
- */
- public StringType getCountryElement() {
- if (this.country == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.country");
- else if (Configuration.doAutoCreate())
- this.country = new StringType(); // bb
- return this.country;
- }
-
- public boolean hasCountryElement() {
- return this.country != null && !this.country.isEmpty();
- }
-
- public boolean hasCountry() {
- return this.country != null && !this.country.isEmpty();
- }
-
- /**
- * @param value {@link #country} (Country - a nation as commonly understood or generally accepted.). This is the underlying object with id, value and extensions. The accessor "getCountry" gives direct access to the value
- */
- public Address setCountryElement(StringType value) {
- this.country = value;
- return this;
- }
-
- /**
- * @return Country - a nation as commonly understood or generally accepted.
- */
- public String getCountry() {
- return this.country == null ? null : this.country.getValue();
- }
-
- /**
- * @param value Country - a nation as commonly understood or generally accepted.
- */
- public Address setCountry(String value) {
- if (Utilities.noString(value))
- this.country = null;
- else {
- if (this.country == null)
- this.country = new StringType();
- this.country.setValue(value);
- }
- return this;
- }
-
- /**
- * @return {@link #period} (Time period when address was/is in use.)
- */
- public Period getPeriod() {
- if (this.period == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create Address.period");
- else if (Configuration.doAutoCreate())
- this.period = new Period(); // cc
- return this.period;
- }
-
- public boolean hasPeriod() {
- return this.period != null && !this.period.isEmpty();
- }
-
- /**
- * @param value {@link #period} (Time period when address was/is in use.)
- */
- public Address setPeriod(Period value) {
- this.period = value;
- return this;
- }
-
- protected void listChildren(List childrenList) {
- super.listChildren(childrenList);
- childrenList.add(new Property("use", "code", "The purpose of this address.", 0, java.lang.Integer.MAX_VALUE, use));
- childrenList.add(new Property("type", "code", "Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.", 0, java.lang.Integer.MAX_VALUE, type));
- childrenList.add(new Property("text", "string", "A full text representation of the address.", 0, java.lang.Integer.MAX_VALUE, text));
- childrenList.add(new Property("line", "string", "This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.", 0, java.lang.Integer.MAX_VALUE, line));
- childrenList.add(new Property("city", "string", "The name of the city, town, village or other community or delivery center.", 0, java.lang.Integer.MAX_VALUE, city));
- childrenList.add(new Property("district", "string", "The name of the administrative area (county).", 0, java.lang.Integer.MAX_VALUE, district));
- childrenList.add(new Property("state", "string", "Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).", 0, java.lang.Integer.MAX_VALUE, state));
- childrenList.add(new Property("postalCode", "string", "A postal code designating a region defined by the postal service.", 0, java.lang.Integer.MAX_VALUE, postalCode));
- childrenList.add(new Property("country", "string", "Country - a nation as commonly understood or generally accepted.", 0, java.lang.Integer.MAX_VALUE, country));
- childrenList.add(new Property("period", "Period", "Time period when address was/is in use.", 0, java.lang.Integer.MAX_VALUE, period));
- }
-
- @Override
- public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
- switch (hash) {
- case 116103: /*use*/ return this.use == null ? new Base[0] : new Base[] {this.use}; // Enumeration
- case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // Enumeration
- case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
- case 3321844: /*line*/ return this.line == null ? new Base[0] : this.line.toArray(new Base[this.line.size()]); // StringType
- case 3053931: /*city*/ return this.city == null ? new Base[0] : new Base[] {this.city}; // StringType
- case 288961422: /*district*/ return this.district == null ? new Base[0] : new Base[] {this.district}; // StringType
- case 109757585: /*state*/ return this.state == null ? new Base[0] : new Base[] {this.state}; // StringType
- case 2011152728: /*postalCode*/ return this.postalCode == null ? new Base[0] : new Base[] {this.postalCode}; // StringType
- case 957831062: /*country*/ return this.country == null ? new Base[0] : new Base[] {this.country}; // StringType
- 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 116103: // use
- this.use = new AddressUseEnumFactory().fromType(value); // Enumeration
- break;
- case 3575610: // type
- this.type = new AddressTypeEnumFactory().fromType(value); // Enumeration
- break;
- case 3556653: // text
- this.text = castToString(value); // StringType
- break;
- case 3321844: // line
- this.getLine().add(castToString(value)); // StringType
- break;
- case 3053931: // city
- this.city = castToString(value); // StringType
- break;
- case 288961422: // district
- this.district = castToString(value); // StringType
- break;
- case 109757585: // state
- this.state = castToString(value); // StringType
- break;
- case 2011152728: // postalCode
- this.postalCode = castToString(value); // StringType
- break;
- case 957831062: // country
- this.country = castToString(value); // StringType
- 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("use"))
- this.use = new AddressUseEnumFactory().fromType(value); // Enumeration
- else if (name.equals("type"))
- this.type = new AddressTypeEnumFactory().fromType(value); // Enumeration
- else if (name.equals("text"))
- this.text = castToString(value); // StringType
- else if (name.equals("line"))
- this.getLine().add(castToString(value));
- else if (name.equals("city"))
- this.city = castToString(value); // StringType
- else if (name.equals("district"))
- this.district = castToString(value); // StringType
- else if (name.equals("state"))
- this.state = castToString(value); // StringType
- else if (name.equals("postalCode"))
- this.postalCode = castToString(value); // StringType
- else if (name.equals("country"))
- this.country = castToString(value); // StringType
- else if (name.equals("period"))
- this.period = castToPeriod(value); // Period
- else
- super.setProperty(name, value);
- }
-
- @Override
- public Base makeProperty(int hash, String name) throws FHIRException {
- switch (hash) {
- case 116103: throw new FHIRException("Cannot make property use as it is not a complex type"); // Enumeration
- case 3575610: throw new FHIRException("Cannot make property type as it is not a complex type"); // Enumeration
- case 3556653: throw new FHIRException("Cannot make property text as it is not a complex type"); // StringType
- case 3321844: throw new FHIRException("Cannot make property line as it is not a complex type"); // StringType
- case 3053931: throw new FHIRException("Cannot make property city as it is not a complex type"); // StringType
- case 288961422: throw new FHIRException("Cannot make property district as it is not a complex type"); // StringType
- case 109757585: throw new FHIRException("Cannot make property state as it is not a complex type"); // StringType
- case 2011152728: throw new FHIRException("Cannot make property postalCode as it is not a complex type"); // StringType
- case 957831062: throw new FHIRException("Cannot make property country as it is not a complex type"); // StringType
- case -991726143: return getPeriod(); // Period
- default: return super.makeProperty(hash, name);
- }
-
- }
-
- @Override
- public Base addChild(String name) throws FHIRException {
- if (name.equals("use")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.use");
- }
- else if (name.equals("type")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.type");
- }
- else if (name.equals("text")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.text");
- }
- else if (name.equals("line")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.line");
- }
- else if (name.equals("city")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.city");
- }
- else if (name.equals("district")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.district");
- }
- else if (name.equals("state")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.state");
- }
- else if (name.equals("postalCode")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.postalCode");
- }
- else if (name.equals("country")) {
- throw new FHIRException("Cannot call addChild on a primitive type Address.country");
- }
- else if (name.equals("period")) {
- this.period = new Period();
- return this.period;
- }
- else
- return super.addChild(name);
- }
-
- public String fhirType() {
- return "Address";
-
- }
-
- public Address copy() {
- Address dst = new Address();
- copyValues(dst);
- dst.use = use == null ? null : use.copy();
- dst.type = type == null ? null : type.copy();
- dst.text = text == null ? null : text.copy();
- if (line != null) {
- dst.line = new ArrayList();
- for (StringType i : line)
- dst.line.add(i.copy());
- };
- dst.city = city == null ? null : city.copy();
- dst.district = district == null ? null : district.copy();
- dst.state = state == null ? null : state.copy();
- dst.postalCode = postalCode == null ? null : postalCode.copy();
- dst.country = country == null ? null : country.copy();
- dst.period = period == null ? null : period.copy();
- return dst;
- }
-
- protected Address typedCopy() {
- return copy();
- }
-
- @Override
- public boolean equalsDeep(Base other) {
- if (!super.equalsDeep(other))
- return false;
- if (!(other instanceof Address))
- return false;
- Address o = (Address) other;
- return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
- && compareDeep(line, o.line, true) && compareDeep(city, o.city, true) && compareDeep(district, o.district, true)
- && compareDeep(state, o.state, true) && compareDeep(postalCode, o.postalCode, true) && compareDeep(country, o.country, true)
- && compareDeep(period, o.period, true);
- }
-
- @Override
- public boolean equalsShallow(Base other) {
- if (!super.equalsShallow(other))
- return false;
- if (!(other instanceof Address))
- return false;
- Address o = (Address) other;
- return compareValues(use, o.use, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
- && compareValues(line, o.line, true) && compareValues(city, o.city, true) && compareValues(district, o.district, true)
- && compareValues(state, o.state, true) && compareValues(postalCode, o.postalCode, true) && compareValues(country, o.country, true)
- ;
- }
-
- public boolean isEmpty() {
- return super.isEmpty() && (use == null || use.isEmpty()) && (type == null || type.isEmpty())
- && (text == null || text.isEmpty()) && (line == null || line.isEmpty()) && (city == null || city.isEmpty())
- && (district == null || district.isEmpty()) && (state == null || state.isEmpty()) && (postalCode == null || postalCode.isEmpty())
- && (country == null || country.isEmpty()) && (period == null || period.isEmpty());
- }
-
-
-}
-
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Age.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Age.java
deleted file mode 100644
index daa51239c46..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/Age.java
+++ /dev/null
@@ -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())
- ;
- }
-
-
-}
-
diff --git a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/AllergyIntolerance.java b/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/AllergyIntolerance.java
deleted file mode 100644
index 9d2ea13b801..00000000000
--- a/hapi-fhir-structures-dstu2.1/src/main/oldjava/org/hl7/fhir/dstu2016may/model/AllergyIntolerance.java
+++ /dev/null
@@ -1,2653 +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.instance.model.api.IBaseBackboneElement;
-import org.hl7.fhir.utilities.Utilities;
-
-import ca.uhn.fhir.model.api.annotation.Block;
-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;
-/**
- * Risk of harmful or undesirable, physiological response which is unique to an individual and associated with exposure to a substance.
- */
-@ResourceDef(name="AllergyIntolerance", profile="http://hl7.org/fhir/Profile/AllergyIntolerance")
-public class AllergyIntolerance extends DomainResource {
-
- public enum AllergyIntoleranceStatus {
- /**
- * An active record of a reaction to the identified Substance.
- */
- ACTIVE,
- /**
- * A low level of certainty about the propensity for a reaction to the identified Substance.
- */
- UNCONFIRMED,
- /**
- * A high level of certainty about the propensity for a reaction to the identified Substance, which may include clinical evidence by testing or rechallenge.
- */
- CONFIRMED,
- /**
- * An inactive record of a reaction to the identified Substance.
- */
- INACTIVE,
- /**
- * A reaction to the identified Substance has been clinically reassessed by testing or rechallenge and considered to be resolved.
- */
- RESOLVED,
- /**
- * A propensity for a reaction to the identified Substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.
- */
- REFUTED,
- /**
- * The statement was entered in error and is not valid.
- */
- ENTEREDINERROR,
- /**
- * added to help the parsers
- */
- NULL;
- public static AllergyIntoleranceStatus fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("active".equals(codeString))
- return ACTIVE;
- if ("unconfirmed".equals(codeString))
- return UNCONFIRMED;
- if ("confirmed".equals(codeString))
- return CONFIRMED;
- if ("inactive".equals(codeString))
- return INACTIVE;
- if ("resolved".equals(codeString))
- return RESOLVED;
- if ("refuted".equals(codeString))
- return REFUTED;
- if ("entered-in-error".equals(codeString))
- return ENTEREDINERROR;
- throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case ACTIVE: return "active";
- case UNCONFIRMED: return "unconfirmed";
- case CONFIRMED: return "confirmed";
- case INACTIVE: return "inactive";
- case RESOLVED: return "resolved";
- case REFUTED: return "refuted";
- case ENTEREDINERROR: return "entered-in-error";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case ACTIVE: return "http://hl7.org/fhir/allergy-intolerance-status";
- case UNCONFIRMED: return "http://hl7.org/fhir/allergy-intolerance-status";
- case CONFIRMED: return "http://hl7.org/fhir/allergy-intolerance-status";
- case INACTIVE: return "http://hl7.org/fhir/allergy-intolerance-status";
- case RESOLVED: return "http://hl7.org/fhir/allergy-intolerance-status";
- case REFUTED: return "http://hl7.org/fhir/allergy-intolerance-status";
- case ENTEREDINERROR: return "http://hl7.org/fhir/allergy-intolerance-status";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case ACTIVE: return "An active record of a reaction to the identified Substance.";
- case UNCONFIRMED: return "A low level of certainty about the propensity for a reaction to the identified Substance.";
- case CONFIRMED: return "A high level of certainty about the propensity for a reaction to the identified Substance, which may include clinical evidence by testing or rechallenge.";
- case INACTIVE: return "An inactive record of a reaction to the identified Substance.";
- case RESOLVED: return "A reaction to the identified Substance has been clinically reassessed by testing or rechallenge and considered to be resolved.";
- case REFUTED: return "A propensity for a reaction to the identified Substance has been disproven with a high level of clinical certainty, which may include testing or rechallenge, and is refuted.";
- case ENTEREDINERROR: return "The statement was entered in error and is not valid.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case ACTIVE: return "Active";
- case UNCONFIRMED: return "Unconfirmed";
- case CONFIRMED: return "Confirmed";
- case INACTIVE: return "Inactive";
- case RESOLVED: return "Resolved";
- case REFUTED: return "Refuted";
- case ENTEREDINERROR: return "Entered In Error";
- default: return "?";
- }
- }
- }
-
- public static class AllergyIntoleranceStatusEnumFactory implements EnumFactory {
- public AllergyIntoleranceStatus fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("active".equals(codeString))
- return AllergyIntoleranceStatus.ACTIVE;
- if ("unconfirmed".equals(codeString))
- return AllergyIntoleranceStatus.UNCONFIRMED;
- if ("confirmed".equals(codeString))
- return AllergyIntoleranceStatus.CONFIRMED;
- if ("inactive".equals(codeString))
- return AllergyIntoleranceStatus.INACTIVE;
- if ("resolved".equals(codeString))
- return AllergyIntoleranceStatus.RESOLVED;
- if ("refuted".equals(codeString))
- return AllergyIntoleranceStatus.REFUTED;
- if ("entered-in-error".equals(codeString))
- return AllergyIntoleranceStatus.ENTEREDINERROR;
- throw new IllegalArgumentException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
- }
- public Enumeration fromType(Base code) throws FHIRException {
- if (code == null || code.isEmpty())
- return null;
- String codeString = ((PrimitiveType) code).asStringValue();
- if (codeString == null || "".equals(codeString))
- return null;
- if ("active".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.ACTIVE);
- if ("unconfirmed".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.UNCONFIRMED);
- if ("confirmed".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.CONFIRMED);
- if ("inactive".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.INACTIVE);
- if ("resolved".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.RESOLVED);
- if ("refuted".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.REFUTED);
- if ("entered-in-error".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceStatus.ENTEREDINERROR);
- throw new FHIRException("Unknown AllergyIntoleranceStatus code '"+codeString+"'");
- }
- public String toCode(AllergyIntoleranceStatus code) {
- if (code == AllergyIntoleranceStatus.ACTIVE)
- return "active";
- if (code == AllergyIntoleranceStatus.UNCONFIRMED)
- return "unconfirmed";
- if (code == AllergyIntoleranceStatus.CONFIRMED)
- return "confirmed";
- if (code == AllergyIntoleranceStatus.INACTIVE)
- return "inactive";
- if (code == AllergyIntoleranceStatus.RESOLVED)
- return "resolved";
- if (code == AllergyIntoleranceStatus.REFUTED)
- return "refuted";
- if (code == AllergyIntoleranceStatus.ENTEREDINERROR)
- return "entered-in-error";
- return "?";
- }
- public String toSystem(AllergyIntoleranceStatus code) {
- return code.getSystem();
- }
- }
-
- public enum AllergyIntoleranceType {
- /**
- * A propensity for hypersensitivity reaction(s) to a substance. These reactions are most typically type I hypersensitivity, plus other "allergy-like" reactions, including pseudoallergy.
- */
- ALLERGY,
- /**
- * A propensity for adverse reactions to a substance that is not judged to be allergic or "allergy-like". These reactions are typically (but not necessarily) non-immune. They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).
- */
- INTOLERANCE,
- /**
- * added to help the parsers
- */
- NULL;
- public static AllergyIntoleranceType fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("allergy".equals(codeString))
- return ALLERGY;
- if ("intolerance".equals(codeString))
- return INTOLERANCE;
- throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case ALLERGY: return "allergy";
- case INTOLERANCE: return "intolerance";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case ALLERGY: return "http://hl7.org/fhir/allergy-intolerance-type";
- case INTOLERANCE: return "http://hl7.org/fhir/allergy-intolerance-type";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case ALLERGY: return "A propensity for hypersensitivity reaction(s) to a substance. These reactions are most typically type I hypersensitivity, plus other \"allergy-like\" reactions, including pseudoallergy.";
- case INTOLERANCE: return "A propensity for adverse reactions to a substance that is not judged to be allergic or \"allergy-like\". These reactions are typically (but not necessarily) non-immune. They are to some degree idiosyncratic and/or individually specific (i.e. are not a reaction that is expected to occur with most or all patients given similar circumstances).";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case ALLERGY: return "Allergy";
- case INTOLERANCE: return "Intolerance";
- default: return "?";
- }
- }
- }
-
- public static class AllergyIntoleranceTypeEnumFactory implements EnumFactory {
- public AllergyIntoleranceType fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("allergy".equals(codeString))
- return AllergyIntoleranceType.ALLERGY;
- if ("intolerance".equals(codeString))
- return AllergyIntoleranceType.INTOLERANCE;
- throw new IllegalArgumentException("Unknown AllergyIntoleranceType code '"+codeString+"'");
- }
- public Enumeration 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 ("allergy".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceType.ALLERGY);
- if ("intolerance".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceType.INTOLERANCE);
- throw new FHIRException("Unknown AllergyIntoleranceType code '"+codeString+"'");
- }
- public String toCode(AllergyIntoleranceType code) {
- if (code == AllergyIntoleranceType.ALLERGY)
- return "allergy";
- if (code == AllergyIntoleranceType.INTOLERANCE)
- return "intolerance";
- return "?";
- }
- public String toSystem(AllergyIntoleranceType code) {
- return code.getSystem();
- }
- }
-
- public enum AllergyIntoleranceCategory {
- /**
- * Any substance consumed to provide nutritional support for the body.
- */
- FOOD,
- /**
- * Substances administered to achieve a physiological effect.
- */
- MEDICATION,
- /**
- * Substances that are encountered in the environment.
- */
- ENVIRONMENT,
- /**
- * Other substances that are not covered by any other category.
- */
- OTHER,
- /**
- * added to help the parsers
- */
- NULL;
- public static AllergyIntoleranceCategory fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("food".equals(codeString))
- return FOOD;
- if ("medication".equals(codeString))
- return MEDICATION;
- if ("environment".equals(codeString))
- return ENVIRONMENT;
- if ("other".equals(codeString))
- return OTHER;
- throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case FOOD: return "food";
- case MEDICATION: return "medication";
- case ENVIRONMENT: return "environment";
- case OTHER: return "other";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case FOOD: return "http://hl7.org/fhir/allergy-intolerance-category";
- case MEDICATION: return "http://hl7.org/fhir/allergy-intolerance-category";
- case ENVIRONMENT: return "http://hl7.org/fhir/allergy-intolerance-category";
- case OTHER: return "http://hl7.org/fhir/allergy-intolerance-category";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case FOOD: return "Any substance consumed to provide nutritional support for the body.";
- case MEDICATION: return "Substances administered to achieve a physiological effect.";
- case ENVIRONMENT: return "Substances that are encountered in the environment.";
- case OTHER: return "Other substances that are not covered by any other category.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case FOOD: return "Food";
- case MEDICATION: return "Medication";
- case ENVIRONMENT: return "Environment";
- case OTHER: return "Other";
- default: return "?";
- }
- }
- }
-
- public static class AllergyIntoleranceCategoryEnumFactory implements EnumFactory {
- public AllergyIntoleranceCategory fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("food".equals(codeString))
- return AllergyIntoleranceCategory.FOOD;
- if ("medication".equals(codeString))
- return AllergyIntoleranceCategory.MEDICATION;
- if ("environment".equals(codeString))
- return AllergyIntoleranceCategory.ENVIRONMENT;
- if ("other".equals(codeString))
- return AllergyIntoleranceCategory.OTHER;
- throw new IllegalArgumentException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
- }
- public Enumeration 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 ("food".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCategory.FOOD);
- if ("medication".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCategory.MEDICATION);
- if ("environment".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCategory.ENVIRONMENT);
- if ("other".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCategory.OTHER);
- throw new FHIRException("Unknown AllergyIntoleranceCategory code '"+codeString+"'");
- }
- public String toCode(AllergyIntoleranceCategory code) {
- if (code == AllergyIntoleranceCategory.FOOD)
- return "food";
- if (code == AllergyIntoleranceCategory.MEDICATION)
- return "medication";
- if (code == AllergyIntoleranceCategory.ENVIRONMENT)
- return "environment";
- if (code == AllergyIntoleranceCategory.OTHER)
- return "other";
- return "?";
- }
- public String toSystem(AllergyIntoleranceCategory code) {
- return code.getSystem();
- }
- }
-
- public enum AllergyIntoleranceCriticality {
- /**
- * Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.
- */
- LOW,
- /**
- * Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.
- */
- HIGH,
- /**
- * Unable to assess the worst case result of a future exposure.
- */
- UNABLETOASSESS,
- /**
- * added to help the parsers
- */
- NULL;
- public static AllergyIntoleranceCriticality fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("low".equals(codeString))
- return LOW;
- if ("high".equals(codeString))
- return HIGH;
- if ("unable-to-assess".equals(codeString))
- return UNABLETOASSESS;
- throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case LOW: return "low";
- case HIGH: return "high";
- case UNABLETOASSESS: return "unable-to-assess";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case LOW: return "http://hl7.org/fhir/allergy-intolerance-criticality";
- case HIGH: return "http://hl7.org/fhir/allergy-intolerance-criticality";
- case UNABLETOASSESS: return "http://hl7.org/fhir/allergy-intolerance-criticality";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case LOW: return "Worst case result of a future exposure is not assessed to be life-threatening or having high potential for organ system failure.";
- case HIGH: return "Worst case result of a future exposure is assessed to be life-threatening or having high potential for organ system failure.";
- case UNABLETOASSESS: return "Unable to assess the worst case result of a future exposure.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case LOW: return "Low Risk";
- case HIGH: return "High Risk";
- case UNABLETOASSESS: return "Unable to Assess Risk";
- default: return "?";
- }
- }
- }
-
- public static class AllergyIntoleranceCriticalityEnumFactory implements EnumFactory {
- public AllergyIntoleranceCriticality fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("low".equals(codeString))
- return AllergyIntoleranceCriticality.LOW;
- if ("high".equals(codeString))
- return AllergyIntoleranceCriticality.HIGH;
- if ("unable-to-assess".equals(codeString))
- return AllergyIntoleranceCriticality.UNABLETOASSESS;
- throw new IllegalArgumentException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
- }
- public Enumeration 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 ("low".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCriticality.LOW);
- if ("high".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCriticality.HIGH);
- if ("unable-to-assess".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCriticality.UNABLETOASSESS);
- throw new FHIRException("Unknown AllergyIntoleranceCriticality code '"+codeString+"'");
- }
- public String toCode(AllergyIntoleranceCriticality code) {
- if (code == AllergyIntoleranceCriticality.LOW)
- return "low";
- if (code == AllergyIntoleranceCriticality.HIGH)
- return "high";
- if (code == AllergyIntoleranceCriticality.UNABLETOASSESS)
- return "unable-to-assess";
- return "?";
- }
- public String toSystem(AllergyIntoleranceCriticality code) {
- return code.getSystem();
- }
- }
-
- public enum AllergyIntoleranceCertainty {
- /**
- * There is a low level of clinical certainty that the reaction was caused by the identified Substance.
- */
- UNLIKELY,
- /**
- * There is a high level of clinical certainty that the reaction was caused by the identified Substance.
- */
- LIKELY,
- /**
- * There is a very high level of clinical certainty that the reaction was due to the identified Substance, which may include clinical evidence by testing or rechallenge.
- */
- CONFIRMED,
- /**
- * added to help the parsers
- */
- NULL;
- public static AllergyIntoleranceCertainty fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("unlikely".equals(codeString))
- return UNLIKELY;
- if ("likely".equals(codeString))
- return LIKELY;
- if ("confirmed".equals(codeString))
- return CONFIRMED;
- throw new FHIRException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case UNLIKELY: return "unlikely";
- case LIKELY: return "likely";
- case CONFIRMED: return "confirmed";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case UNLIKELY: return "http://hl7.org/fhir/reaction-event-certainty";
- case LIKELY: return "http://hl7.org/fhir/reaction-event-certainty";
- case CONFIRMED: return "http://hl7.org/fhir/reaction-event-certainty";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case UNLIKELY: return "There is a low level of clinical certainty that the reaction was caused by the identified Substance.";
- case LIKELY: return "There is a high level of clinical certainty that the reaction was caused by the identified Substance.";
- case CONFIRMED: return "There is a very high level of clinical certainty that the reaction was due to the identified Substance, which may include clinical evidence by testing or rechallenge.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case UNLIKELY: return "Unlikely";
- case LIKELY: return "Likely";
- case CONFIRMED: return "Confirmed";
- default: return "?";
- }
- }
- }
-
- public static class AllergyIntoleranceCertaintyEnumFactory implements EnumFactory {
- public AllergyIntoleranceCertainty fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("unlikely".equals(codeString))
- return AllergyIntoleranceCertainty.UNLIKELY;
- if ("likely".equals(codeString))
- return AllergyIntoleranceCertainty.LIKELY;
- if ("confirmed".equals(codeString))
- return AllergyIntoleranceCertainty.CONFIRMED;
- throw new IllegalArgumentException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
- }
- public Enumeration 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 ("unlikely".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCertainty.UNLIKELY);
- if ("likely".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCertainty.LIKELY);
- if ("confirmed".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceCertainty.CONFIRMED);
- throw new FHIRException("Unknown AllergyIntoleranceCertainty code '"+codeString+"'");
- }
- public String toCode(AllergyIntoleranceCertainty code) {
- if (code == AllergyIntoleranceCertainty.UNLIKELY)
- return "unlikely";
- if (code == AllergyIntoleranceCertainty.LIKELY)
- return "likely";
- if (code == AllergyIntoleranceCertainty.CONFIRMED)
- return "confirmed";
- return "?";
- }
- public String toSystem(AllergyIntoleranceCertainty code) {
- return code.getSystem();
- }
- }
-
- public enum AllergyIntoleranceSeverity {
- /**
- * Causes mild physiological effects.
- */
- MILD,
- /**
- * Causes moderate physiological effects.
- */
- MODERATE,
- /**
- * Causes severe physiological effects.
- */
- SEVERE,
- /**
- * added to help the parsers
- */
- NULL;
- public static AllergyIntoleranceSeverity fromCode(String codeString) throws FHIRException {
- if (codeString == null || "".equals(codeString))
- return null;
- if ("mild".equals(codeString))
- return MILD;
- if ("moderate".equals(codeString))
- return MODERATE;
- if ("severe".equals(codeString))
- return SEVERE;
- throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
- }
- public String toCode() {
- switch (this) {
- case MILD: return "mild";
- case MODERATE: return "moderate";
- case SEVERE: return "severe";
- default: return "?";
- }
- }
- public String getSystem() {
- switch (this) {
- case MILD: return "http://hl7.org/fhir/reaction-event-severity";
- case MODERATE: return "http://hl7.org/fhir/reaction-event-severity";
- case SEVERE: return "http://hl7.org/fhir/reaction-event-severity";
- default: return "?";
- }
- }
- public String getDefinition() {
- switch (this) {
- case MILD: return "Causes mild physiological effects.";
- case MODERATE: return "Causes moderate physiological effects.";
- case SEVERE: return "Causes severe physiological effects.";
- default: return "?";
- }
- }
- public String getDisplay() {
- switch (this) {
- case MILD: return "Mild";
- case MODERATE: return "Moderate";
- case SEVERE: return "Severe";
- default: return "?";
- }
- }
- }
-
- public static class AllergyIntoleranceSeverityEnumFactory implements EnumFactory {
- public AllergyIntoleranceSeverity fromCode(String codeString) throws IllegalArgumentException {
- if (codeString == null || "".equals(codeString))
- if (codeString == null || "".equals(codeString))
- return null;
- if ("mild".equals(codeString))
- return AllergyIntoleranceSeverity.MILD;
- if ("moderate".equals(codeString))
- return AllergyIntoleranceSeverity.MODERATE;
- if ("severe".equals(codeString))
- return AllergyIntoleranceSeverity.SEVERE;
- throw new IllegalArgumentException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
- }
- public Enumeration 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 ("mild".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceSeverity.MILD);
- if ("moderate".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceSeverity.MODERATE);
- if ("severe".equals(codeString))
- return new Enumeration(this, AllergyIntoleranceSeverity.SEVERE);
- throw new FHIRException("Unknown AllergyIntoleranceSeverity code '"+codeString+"'");
- }
- public String toCode(AllergyIntoleranceSeverity code) {
- if (code == AllergyIntoleranceSeverity.MILD)
- return "mild";
- if (code == AllergyIntoleranceSeverity.MODERATE)
- return "moderate";
- if (code == AllergyIntoleranceSeverity.SEVERE)
- return "severe";
- return "?";
- }
- public String toSystem(AllergyIntoleranceSeverity code) {
- return code.getSystem();
- }
- }
-
- @Block()
- public static class AllergyIntoleranceReactionComponent extends BackboneElement implements IBaseBackboneElement {
- /**
- * Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.
- */
- @Child(name = "substance", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Specific substance considered to be responsible for event", formalDefinition="Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance." )
- protected CodeableConcept substance;
-
- /**
- * Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.
- */
- @Child(name = "certainty", type = {CodeType.class}, order=2, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="unlikely | likely | confirmed - clinical certainty about the specific substance", formalDefinition="Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event." )
- protected Enumeration certainty;
-
- /**
- * Clinical symptoms and/or signs that are observed or associated with the adverse reaction event.
- */
- @Child(name = "manifestation", type = {CodeableConcept.class}, order=3, min=1, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
- @Description(shortDefinition="Clinical symptoms/signs associated with the Event", formalDefinition="Clinical symptoms and/or signs that are observed or associated with the adverse reaction event." )
- protected List manifestation;
-
- /**
- * Text description about the reaction as a whole, including details of the manifestation if required.
- */
- @Child(name = "description", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
- @Description(shortDefinition="Description of the event as a whole", formalDefinition="Text description about the reaction as a whole, including details of the manifestation if required." )
- protected StringType description;
-
- /**
- * Record of the date and/or time of the onset of the Reaction.
- */
- @Child(name = "onset", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="Date(/time) when manifestations showed", formalDefinition="Record of the date and/or time of the onset of the Reaction." )
- protected DateTimeType onset;
-
- /**
- * Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations.
- */
- @Child(name = "severity", type = {CodeType.class}, order=6, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="mild | moderate | severe (of event as a whole)", formalDefinition="Clinical assessment of the severity of the reaction event as a whole, potentially considering multiple different manifestations." )
- protected Enumeration severity;
-
- /**
- * Identification of the route by which the subject was exposed to the substance.
- */
- @Child(name = "exposureRoute", type = {CodeableConcept.class}, order=7, min=0, max=1, modifier=false, summary=true)
- @Description(shortDefinition="How the subject was exposed to the substance", formalDefinition="Identification of the route by which the subject was exposed to the substance." )
- protected CodeableConcept exposureRoute;
-
- /**
- * Additional text about the adverse reaction event not captured in other fields.
- */
- @Child(name = "note", type = {Annotation.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
- @Description(shortDefinition="Text about event not captured in other fields", formalDefinition="Additional text about the adverse reaction event not captured in other fields." )
- protected List note;
-
- private static final long serialVersionUID = -31700461L;
-
- /**
- * Constructor
- */
- public AllergyIntoleranceReactionComponent() {
- super();
- }
-
- /**
- * @return {@link #substance} (Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.)
- */
- public CodeableConcept getSubstance() {
- if (this.substance == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.substance");
- else if (Configuration.doAutoCreate())
- this.substance = new CodeableConcept(); // cc
- return this.substance;
- }
-
- public boolean hasSubstance() {
- return this.substance != null && !this.substance.isEmpty();
- }
-
- /**
- * @param value {@link #substance} (Identification of the specific substance considered to be responsible for the Adverse Reaction event. Note: the substance for a specific reaction may be different to the substance identified as the cause of the risk, but must be consistent with it. For instance, it may be a more specific substance (e.g. a brand medication) or a composite substance that includes the identified substance. It must be clinically safe to only process the AllergyIntolerance.substance and ignore the AllergyIntolerance.event.substance.)
- */
- public AllergyIntoleranceReactionComponent setSubstance(CodeableConcept value) {
- this.substance = value;
- return this;
- }
-
- /**
- * @return {@link #certainty} (Statement about the degree of clinical certainty that the specific substance was the cause of the manifestation in this reaction event.). This is the underlying object with id, value and extensions. The accessor "getCertainty" gives direct access to the value
- */
- public Enumeration getCertaintyElement() {
- if (this.certainty == null)
- if (Configuration.errorOnAutoCreate())
- throw new Error("Attempt to auto-create AllergyIntoleranceReactionComponent.certainty");
- else if (Configuration.doAutoCreate())
- this.certainty = new Enumeration