diff --git a/.travis.yml b/.travis.yml
index 4b5b599e73a..e856f74456d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -22,4 +22,4 @@ before_script:
script:
# - mvn -e -B clean install && cd hapi-fhir-ra && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID clean test jacoco:report coveralls:report
# - mvn -Dci=true -e -B -P ALLMODULES,NOPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
- - mvn -Dci=true -e -B -P ALLMODULES,MINPARALLEL clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
+ - mvn -Dci=true -e -B -P ALLMODULES,MINPARALLEL,ERRORPRONE clean install && cd hapi-fhir-jacoco && mvn -e -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID jacoco:report coveralls:report
diff --git a/examples/src/main/java/example/ClientExamples.java b/examples/src/main/java/example/ClientExamples.java
index 1c263e23b0d..25a805d8dd8 100644
--- a/examples/src/main/java/example/ClientExamples.java
+++ b/examples/src/main/java/example/ClientExamples.java
@@ -1,5 +1,6 @@
package example;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
import org.hl7.fhir.dstu3.model.Bundle;
import ca.uhn.fhir.context.FhirContext;
@@ -8,6 +9,7 @@ import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.client.apache.GZipContentInterceptor;
import ca.uhn.fhir.rest.client.api.*;
import ca.uhn.fhir.rest.client.interceptor.*;
+import org.hl7.fhir.r4.model.Patient;
public class ClientExamples {
@@ -52,6 +54,26 @@ public class ClientExamples {
// END SNIPPET: processMessage
}
+ @SuppressWarnings("unused")
+ public void cacheControl() {
+ FhirContext ctx = FhirContext.forDstu3();
+
+ // Create the client
+ IGenericClient client = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
+
+ Bundle bundle = new Bundle();
+ // ..populate the bundle..
+
+ // START SNIPPET: cacheControl
+ Bundle response = client
+ .search()
+ .forResource(Patient.class)
+ .returnBundle(Bundle.class)
+ .cacheControl(new CacheControlDirective().setNoCache(true)) // <-- add a directive
+ .execute();
+ // END SNIPPET: cacheControl
+ }
+
@SuppressWarnings("unused")
public void createOkHttp() {
// START SNIPPET: okhttp
diff --git a/hapi-deployable-pom/pom.xml b/hapi-deployable-pom/pom.xml
index f13b998e86a..8b0168ae690 100644
--- a/hapi-deployable-pom/pom.xml
+++ b/hapi-deployable-pom/pom.xml
@@ -63,6 +63,65 @@
+
+ org.basepom.maven
+ duplicate-finder-maven-plugin
+
+
+ default
+ verify
+
+ check
+
+ true
+
+
+
+ false
+ true
+ true
+ true
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ 2
+ ${project.build.directory}/duplicate-finder-result.xml
+
+
+ javax.el
+ javax.el-api
+
+
+ javax.mail
+ javax.mail-api
+
+
+ com.phloc
+ phloc-commons
+
+
+ commons-logging
+ commons-logging
+
+
+ org.jscience
+ jscience
+
+
+ org.springframework
+ spring-jcl
+
+
+
+ changelog.txt
+ javac.bat
+
+
+
diff --git a/hapi-fhir-android/pom.xml b/hapi-fhir-android/pom.xml
index 30c6c59f62d..5437fbfd16b 100644
--- a/hapi-fhir-android/pom.xml
+++ b/hapi-fhir-android/pom.xml
@@ -35,6 +35,25 @@
commons-codec
commons-codec
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+
+
+
+
+ ca.uhn.hapi.fhir
+ hapi-fhir-client
+ ${project.version}
+
+
+ org.apache.httpcomponents
+ httpcore
+
+
+ org.apache.httpcomponents
+ httpclient
+
@@ -92,52 +111,14 @@
- dstu2_shade
+ it
integration-test
- verify
- **/*Dstu2ShadeIT.java
+ **/*IT.java
-
-
- org.codehaus.woodstox:woodstox-core-asl
- org.codehaus.woodstox:stax2-api
-
-
-
-
- dstu2
-
- integration-test
- verify
-
-
-
- **/*Dstu2IT.java
-
-
- org.codehaus.woodstox:woodstox-core-asl
- org.codehaus.woodstox:stax2-api
-
-
-
-
- dstu3
-
- integration-test
- verify
-
-
-
- **/*Dstu3IT.java
-
-
- org.codehaus.woodstox:woodstox-core-asl
- org.codehaus.woodstox:stax2-api
-
diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java
index edb29a485e7..cd10815159a 100644
--- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java
+++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/BuiltJarDstu2ShadeIT.java
@@ -9,6 +9,7 @@ import java.util.zip.ZipFile;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.WildcardFileFilter;
+import org.junit.Ignore;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
@@ -21,6 +22,7 @@ public class BuiltJarDstu2ShadeIT {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BuiltJarDstu2ShadeIT.class);
@Test
+ @Ignore
public void testParserXml() throws Exception {
FhirContext ctx = FhirContext.forDstu2();
diff --git a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java
index 9fa959270f0..aada3596319 100644
--- a/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java
+++ b/hapi-fhir-android/src/test/java/ca/uhn/fhir/android/client/GenericClientDstu3IT.java
@@ -7,7 +7,6 @@ import static org.mockito.Mockito.when;
import java.io.IOException;
import java.util.Date;
-import org.apache.http.client.ClientProtocolException;
import org.hl7.fhir.dstu3.model.*;
import org.junit.*;
import org.mockito.ArgumentCaptor;
@@ -82,6 +81,7 @@ public class GenericClientDstu3IT {
* TODO: narratives don't work without stax
*/
@Test
+ @Ignore
public void testBinaryCreateWithFhirContentType() throws Exception {
IParser p = ourCtx.newXmlParser();
@@ -142,7 +142,7 @@ public class GenericClientDstu3IT {
.returnBundle(Bundle.class)
.execute();
- assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(idx).url().toString());
+ assertEquals("http://example.com/fhir/Patient?_format=json", capt.getAllValues().get(idx).url().toString());
idx++;
}
@@ -177,12 +177,12 @@ public class GenericClientDstu3IT {
Request request = capt.getAllValues().get(0);
ourLog.info(request.headers().toString());
- assertEquals("http://example.com/fhir/Binary", request.url().toString());
+ assertEquals("http://example.com/fhir/Binary?_format=json", request.url().toString());
validateUserAgent(capt);
- assertEquals(Constants.CT_FHIR_XML_NEW + ";charset=utf-8", request.body().contentType().toString().toLowerCase().replace(" ", ""));
- assertEquals(Constants.HEADER_ACCEPT_VALUE_XML_NON_LEGACY, request.header("Accept"));
- assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourCtx.newXmlParser().parseResource(Binary.class, extractBodyAsString(capt)).getContent());
+ assertEquals(Constants.CT_FHIR_JSON_NEW + ";charset=utf-8", request.body().contentType().toString().toLowerCase().replace(" ", ""));
+ assertEquals(Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY, request.header("Accept"));
+ assertArrayEquals(new byte[] { 0, 1, 2, 3, 4 }, ourCtx.newJsonParser().parseResource(Binary.class, extractBodyAsString(capt)).getContent());
}
@@ -257,11 +257,11 @@ public class GenericClientDstu3IT {
assertNotNull(outcome.getResource());
assertEquals("FINAL VALUE
", ((Patient) outcome.getResource()).getText().getDivAsString());
- assertEquals("http://example.com/fhir/Patient", capt.getAllValues().get(0).url().toString());
+ assertEquals("http://example.com/fhir/Patient?_format=json", capt.getAllValues().get(0).url().toString());
}
- private ArgumentCaptor prepareClientForSearchResponse() throws IOException, ClientProtocolException {
+ private ArgumentCaptor prepareClientForSearchResponse() throws IOException {
final String respString = "{\"resourceType\":\"Bundle\",\"id\":null,\"base\":\"http://localhost:57931/fhir/contextDev\",\"total\":1,\"link\":[{\"relation\":\"self\",\"url\":\"http://localhost:57931/fhir/contextDev/Patient?identifier=urn%3AMultiFhirVersionTest%7CtestSubmitPatient01&_format=json\"}],\"entry\":[{\"resource\":{\"resourceType\":\"Patient\",\"id\":\"1\",\"meta\":{\"versionId\":\"1\",\"lastUpdated\":\"2014-12-20T18:41:29.706-05:00\"},\"identifier\":[{\"system\":\"urn:MultiFhirVersionTest\",\"value\":\"testSubmitPatient01\"}]}}]}";
myHttpResponse = new Response.Builder()
.request(myRequest)
diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml
index c024db6628c..87536543923 100644
--- a/hapi-fhir-base/pom.xml
+++ b/hapi-fhir-base/pom.xml
@@ -28,6 +28,7 @@
org.codehaus.woodstox
woodstox-core-asl
+ true
@@ -124,6 +125,7 @@
${argLine} -Dfile.encoding=UTF-8 -Xmx712m
+
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
index 80fcb05295c..a705ab91fd7 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirVersionEnum.java
@@ -78,6 +78,10 @@ public enum FhirVersionEnum {
return myVersionImplementation;
}
+ public boolean isEqualOrNewerThan(FhirVersionEnum theVersion) {
+ return ordinal() >= theVersion.ordinal();
+ }
+
public boolean isEquivalentTo(FhirVersionEnum theVersion) {
if (this.equals(theVersion)) {
return true;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java
index d3df0dd67e2..af1a5498a84 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/RuntimeSearchParam.java
@@ -152,7 +152,8 @@ public class RuntimeSearchParam {
public enum RuntimeSearchParamStatusEnum {
ACTIVE,
DRAFT,
- RETIRED
+ RETIRED,
+ UNKNOWN
}
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java
index 5bb5dff071f..b22008a078b 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/primitive/XhtmlDt.java
@@ -20,29 +20,29 @@ package ca.uhn.fhir.model.primitive;
* #L%
*/
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.stream.FactoryConfigurationError;
-import javax.xml.stream.XMLEventReader;
-import javax.xml.stream.XMLEventWriter;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.events.XMLEvent;
-
-import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
import ca.uhn.fhir.parser.DataFormatException;
+import ca.uhn.fhir.util.XmlDetectionUtil;
import ca.uhn.fhir.util.XmlUtil;
+import java.util.List;
+
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+
+/**
+ * Note that as of HAPI FHIR 3.1.0, this method no longer uses
+ * the StAX XMLEvent type as the XML representation, and uses a
+ * String instead. If you need to work with XML as StAX events, you
+ * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)}
+ * methods to do so.
+ */
@DatatypeDef(name = "xhtml")
-public class XhtmlDt extends BasePrimitive> {
+public class XhtmlDt extends BasePrimitive {
private static final String DECL_XMLNS = " xmlns=\"http://www.w3.org/1999/xhtml\"";
- private static final String DIV_OPEN_FIRST = "";
+ public static final String DIV_OPEN_FIRST = "
";
private static final long serialVersionUID = 1L;
/**
@@ -54,7 +54,7 @@ public class XhtmlDt extends BasePrimitive> {
/**
* Constructor which accepts a string code
- *
+ *
* @see #setValueAsString(String) for a description of how this value is applied
*/
@SimpleSetter()
@@ -63,29 +63,12 @@ public class XhtmlDt extends BasePrimitive> {
}
@Override
- protected String encode(List theValue) {
- try {
- StringWriter w = new StringWriter();
- XMLEventWriter ew = XmlUtil.createXmlFragmentWriter(w);
-
- for (XMLEvent next : getValue()) {
- if (next.isCharacters()) {
- ew.add(next);
- } else {
- ew.add(next);
- }
- }
- ew.close();
- return w.toString();
- } catch (XMLStreamException e) {
- throw new DataFormatException("Problem with the contained XML events", e);
- } catch (FactoryConfigurationError e) {
- throw new ConfigurationException(e);
- }
+ protected String encode(String theValue) {
+ return theValue;
}
public boolean hasContent() {
- return getValue() != null && getValue().size() > 0;
+ return isNotBlank(getValue());
}
@Override
@@ -94,40 +77,37 @@ public class XhtmlDt extends BasePrimitive> {
}
@Override
- protected List parse(String theValue) {
- String val = theValue.trim();
- if (!val.startsWith("<")) {
- val = DIV_OPEN_FIRST + val + "
";
- }
- boolean hasProcessingInstruction = val.startsWith("");
- if (hasProcessingInstruction && val.endsWith("?>")) {
- return null;
+ protected String parse(String theValue) {
+ if (XmlDetectionUtil.isStaxPresent()) {
+ // for validation
+ XmlUtil.parse(theValue);
}
+ return theValue;
+ }
-
- try {
- ArrayList
value = new ArrayList();
- StringReader reader = new StringReader(val);
- XMLEventReader er = XmlUtil.createXmlReader(reader);
- boolean first = true;
- while (er.hasNext()) {
- XMLEvent next = er.nextEvent();
- if (first) {
- first = false;
- continue;
- }
- if (er.hasNext()) {
- // don't add the last event
- value.add(next);
- }
- }
- return value;
- } catch (XMLStreamException e) {
- throw new DataFormatException("String does not appear to be valid XML/XHTML (error is \"" + e.getMessage() + "\"): " + theValue, e);
- } catch (FactoryConfigurationError e) {
- throw new ConfigurationException(e);
- }
+ /**
+ * Note that as of HAPI FHIR 3.1.0, this method no longer uses
+ * the StAX XMLEvent type as the XML representation, and uses a
+ * String instead. If you need to work with XML as StAX events, you
+ * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)}
+ * methods to do so.
+ */
+ @Override
+ public String getValue() {
+ return super.getValue();
+ }
+
+ /**
+ * Note that as of HAPI FHIR 3.1.0, this method no longer uses
+ * the StAX XMLEvent type as the XML representation, and uses a
+ * String instead. If you need to work with XML as StAX events, you
+ * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)}
+ * methods to do so.
+ */
+ @Override
+ public BasePrimitive setValue(String theValue) throws DataFormatException {
+ return super.setValue(theValue);
}
/**
@@ -157,7 +137,7 @@ public class XhtmlDt extends BasePrimitive> {
if (value.charAt(0) != '<') {
value = DIV_OPEN_FIRST + value + "
";
}
-
+
boolean hasProcessingInstruction = value.startsWith("");
int firstTagIndex = value.indexOf("<", hasProcessingInstruction ? 1 : 0);
if (firstTagIndex != -1) {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java
index 6e5b8290027..9dfcdb7c7da 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/BaseParser.java
@@ -43,7 +43,7 @@ public abstract class BaseParser implements IParser {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseParser.class);
private ContainedResources myContainedResources;
-
+ private boolean myEncodeElementsAppliesToChildResourcesOnly;
private FhirContext myContext;
private Set myDontEncodeElements;
private boolean myDontEncodeElementsIncludesStars;
@@ -556,6 +556,16 @@ public abstract class BaseParser implements IParser {
&& theIncludedResource == false;
}
+ @Override
+ public boolean isEncodeElementsAppliesToChildResourcesOnly() {
+ return myEncodeElementsAppliesToChildResourcesOnly;
+ }
+
+ @Override
+ public void setEncodeElementsAppliesToChildResourcesOnly(boolean theEncodeElementsAppliesToChildResourcesOnly) {
+ myEncodeElementsAppliesToChildResourcesOnly = theEncodeElementsAppliesToChildResourcesOnly;
+ }
+
@Override
public boolean isOmitResourceId() {
return myOmitResourceId;
@@ -1039,7 +1049,13 @@ public abstract class BaseParser implements IParser {
}
private boolean checkIfParentShouldBeEncodedAndBuildPath(StringBuilder thePathBuilder, boolean theStarPass) {
- return checkIfPathMatchesForEncoding(thePathBuilder, theStarPass, myEncodeElementsAppliesToResourceTypes, myEncodeElements, true);
+ Set encodeElements = myEncodeElements;
+ if (encodeElements != null && encodeElements.isEmpty() == false) {
+ if (isEncodeElementsAppliesToChildResourcesOnly() && !mySubResource) {
+ encodeElements = null;
+ }
+ }
+ return checkIfPathMatchesForEncoding(thePathBuilder, theStarPass, myEncodeElementsAppliesToResourceTypes, encodeElements, true);
}
private boolean checkIfParentShouldNotBeEncodedAndBuildPath(StringBuilder thePathBuilder, boolean theStarPass) {
@@ -1058,6 +1074,9 @@ public abstract class BaseParser implements IParser {
} else {
thePathBuilder.append(myResDef.getName());
}
+ if (theElements == null) {
+ return true;
+ }
if (theElements.contains(thePathBuilder.toString())) {
return true;
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java
index d12e681231d..54de21c62b4 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/IParser.java
@@ -206,6 +206,22 @@ public interface IParser {
*/
void setEncodeElements(Set theEncodeElements);
+ /**
+ * If set to true
(default is false), the values supplied
+ * to {@link #setEncodeElements(Set)} will not be applied to the root
+ * resource (typically a Bundle), but will be applied to any sub-resources
+ * contained within it (i.e. search result resources in that bundle)
+ */
+ void setEncodeElementsAppliesToChildResourcesOnly(boolean theEncodeElementsAppliesToChildResourcesOnly);
+
+ /**
+ * If set to true
(default is false), the values supplied
+ * to {@link #setEncodeElements(Set)} will not be applied to the root
+ * resource (typically a Bundle), but will be applied to any sub-resources
+ * contained within it (i.e. search result resources in that bundle)
+ */
+ boolean isEncodeElementsAppliesToChildResourcesOnly();
+
/**
* If provided, tells the parse which resource types to apply {@link #setEncodeElements(Set) encode elements} to. Any
* resource types not specified here will be encoded completely, with no elements excluded.
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
index 55aa0bc7a7a..f759cefa6cd 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
@@ -19,19 +19,6 @@ package ca.uhn.fhir.parser;
* limitations under the License.
* #L%
*/
-import static org.apache.commons.lang3.StringUtils.*;
-
-import java.io.*;
-import java.math.BigDecimal;
-import java.util.*;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.Validate;
-import org.apache.commons.lang3.text.WordUtils;
-import org.hl7.fhir.instance.model.api.*;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
import ca.uhn.fhir.context.*;
import ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum;
@@ -46,9 +33,27 @@ import ca.uhn.fhir.parser.json.*;
import ca.uhn.fhir.parser.json.JsonLikeValue.ScalarType;
import ca.uhn.fhir.parser.json.JsonLikeValue.ValueType;
import ca.uhn.fhir.rest.api.EncodingEnum;
+import ca.uhn.fhir.util.BinaryUtil;
import ca.uhn.fhir.util.ElementUtil;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Validate;
+import org.apache.commons.lang3.text.WordUtils;
+import org.hl7.fhir.instance.model.api.*;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+
import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.ID_DATATYPE;
import static ca.uhn.fhir.context.BaseRuntimeElementDefinition.ChildTypeEnum.PRIMITIVE_DATATYPE;
+import static org.apache.commons.lang3.StringUtils.*;
/**
* This class is the FHIR JSON parser/encoder. Users should not interact with this class directly, but should use
@@ -88,7 +93,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private boolean addToHeldExtensions(int valueIdx, List extends IBaseExtension, ?>> ext, ArrayList> list, boolean theIsModifier, CompositeChildElement theChildElem,
- CompositeChildElement theParent) {
+ CompositeChildElement theParent) {
if (ext.size() > 0) {
list.ensureCapacity(valueIdx);
while (list.size() <= valueIdx) {
@@ -139,12 +144,6 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
return retVal;
}
- @Override
- protected void doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException {
- JsonLikeWriter eventWriter = createJsonWriter(theWriter);
- doEncodeResourceToJsonLikeWriter(theResource, eventWriter);
- }
-
public void doEncodeResourceToJsonLikeWriter(IBaseResource theResource, JsonLikeWriter theEventWriter) throws IOException {
if (myPrettyPrint) {
theEventWriter.setPrettyPrint(myPrettyPrint);
@@ -156,6 +155,12 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
theEventWriter.flush();
}
+ @Override
+ protected void doEncodeResourceToWriter(IBaseResource theResource, Writer theWriter) throws IOException {
+ JsonLikeWriter eventWriter = createJsonWriter(theWriter);
+ doEncodeResourceToJsonLikeWriter(theResource, eventWriter);
+ }
+
@Override
public T doParseResource(Class theResourceType, Reader theReader) {
JsonLikeStructure jsonStructure = new GsonStructure();
@@ -191,136 +196,136 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private void encodeChildElementToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, IBase theNextValue,
- BaseRuntimeElementDefinition> theChildDef, String theChildName, boolean theContainedResource, boolean theSubResource, CompositeChildElement theChildElem,
- boolean theForceEmpty) throws IOException {
+ BaseRuntimeElementDefinition> theChildDef, String theChildName, boolean theContainedResource, boolean theSubResource, CompositeChildElement theChildElem,
+ boolean theForceEmpty) throws IOException {
switch (theChildDef.getChildType()) {
- case ID_DATATYPE: {
- IIdType value = (IIdType) theNextValue;
- String encodedValue = "id".equals(theChildName) ? value.getIdPart() : value.getValue();
- if (isBlank(encodedValue)) {
- break;
- }
- if (theChildName != null) {
- write(theEventWriter, theChildName, encodedValue);
- } else {
- theEventWriter.write(encodedValue);
- }
- break;
- }
- case PRIMITIVE_DATATYPE: {
- final IPrimitiveType> value = (IPrimitiveType>) theNextValue;
- if (isBlank(value.getValueAsString())) {
- if (theForceEmpty) {
- theEventWriter.writeNull();
+ case ID_DATATYPE: {
+ IIdType value = (IIdType) theNextValue;
+ String encodedValue = "id".equals(theChildName) ? value.getIdPart() : value.getValue();
+ if (isBlank(encodedValue)) {
+ break;
+ }
+ if (theChildName != null) {
+ write(theEventWriter, theChildName, encodedValue);
+ } else {
+ theEventWriter.write(encodedValue);
}
break;
}
-
- if (value instanceof IBaseIntegerDatatype) {
- if (theChildName != null) {
- write(theEventWriter, theChildName, ((IBaseIntegerDatatype) value).getValue());
- } else {
- theEventWriter.write(((IBaseIntegerDatatype) value).getValue());
- }
- } else if (value instanceof IBaseDecimalDatatype) {
- BigDecimal decimalValue = ((IBaseDecimalDatatype) value).getValue();
- decimalValue = new BigDecimal(decimalValue.toString()) {
- private static final long serialVersionUID = 1L;
-
- @Override
- public String toString() {
- return value.getValueAsString();
+ case PRIMITIVE_DATATYPE: {
+ final IPrimitiveType> value = (IPrimitiveType>) theNextValue;
+ if (isBlank(value.getValueAsString())) {
+ if (theForceEmpty) {
+ theEventWriter.writeNull();
}
- };
- if (theChildName != null) {
- write(theEventWriter, theChildName, decimalValue);
- } else {
- theEventWriter.write(decimalValue);
+ break;
}
- } else if (value instanceof IBaseBooleanDatatype) {
- if (theChildName != null) {
- write(theEventWriter, theChildName, ((IBaseBooleanDatatype) value).getValue());
+
+ if (value instanceof IBaseIntegerDatatype) {
+ if (theChildName != null) {
+ write(theEventWriter, theChildName, ((IBaseIntegerDatatype) value).getValue());
+ } else {
+ theEventWriter.write(((IBaseIntegerDatatype) value).getValue());
+ }
+ } else if (value instanceof IBaseDecimalDatatype) {
+ BigDecimal decimalValue = ((IBaseDecimalDatatype) value).getValue();
+ decimalValue = new BigDecimal(decimalValue.toString()) {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public String toString() {
+ return value.getValueAsString();
+ }
+ };
+ if (theChildName != null) {
+ write(theEventWriter, theChildName, decimalValue);
+ } else {
+ theEventWriter.write(decimalValue);
+ }
+ } else if (value instanceof IBaseBooleanDatatype) {
+ if (theChildName != null) {
+ write(theEventWriter, theChildName, ((IBaseBooleanDatatype) value).getValue());
+ } else {
+ Boolean booleanValue = ((IBaseBooleanDatatype) value).getValue();
+ if (booleanValue != null) {
+ theEventWriter.write(booleanValue.booleanValue());
+ }
+ }
} else {
- Boolean booleanValue = ((IBaseBooleanDatatype) value).getValue();
- if (booleanValue != null) {
- theEventWriter.write(booleanValue.booleanValue());
+ String valueStr = value.getValueAsString();
+ if (theChildName != null) {
+ write(theEventWriter, theChildName, valueStr);
+ } else {
+ theEventWriter.write(valueStr);
}
}
- } else {
- String valueStr = value.getValueAsString();
+ break;
+ }
+ case RESOURCE_BLOCK:
+ case COMPOSITE_DATATYPE: {
if (theChildName != null) {
- write(theEventWriter, theChildName, valueStr);
+ theEventWriter.beginObject(theChildName);
} else {
- theEventWriter.write(valueStr);
+ theEventWriter.beginObject();
}
+ encodeCompositeElementToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theChildElem);
+ theEventWriter.endObject();
+ break;
}
- break;
- }
- case RESOURCE_BLOCK:
- case COMPOSITE_DATATYPE: {
- if (theChildName != null) {
- theEventWriter.beginObject(theChildName);
- } else {
- theEventWriter.beginObject();
- }
- encodeCompositeElementToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theChildElem);
- theEventWriter.endObject();
- break;
- }
- case CONTAINED_RESOURCE_LIST:
- case CONTAINED_RESOURCES: {
+ case CONTAINED_RESOURCE_LIST:
+ case CONTAINED_RESOURCES: {
/*
* Disabled per #103 ContainedDt value = (ContainedDt) theNextValue; for (IResource next :
* value.getContainedResources()) { if (getContainedResources().getResourceId(next) != null) { continue; }
* encodeResourceToJsonStreamWriter(theResDef, next, theWriter, null, true,
* fixContainedResourceId(next.getId().getValue())); }
*/
- List containedResources = getContainedResources().getContainedResources();
- if (containedResources.size() > 0) {
- beginArray(theEventWriter, theChildName);
+ List containedResources = getContainedResources().getContainedResources();
+ if (containedResources.size() > 0) {
+ beginArray(theEventWriter, theChildName);
- for (IBaseResource next : containedResources) {
- IIdType resourceId = getContainedResources().getResourceId(next);
- encodeResourceToJsonStreamWriter(theResDef, next, theEventWriter, null, true, false, fixContainedResourceId(resourceId.getValue()));
- }
+ for (IBaseResource next : containedResources) {
+ IIdType resourceId = getContainedResources().getResourceId(next);
+ encodeResourceToJsonStreamWriter(theResDef, next, theEventWriter, null, true, false, fixContainedResourceId(resourceId.getValue()));
+ }
- theEventWriter.endArray();
- }
- break;
- }
- case PRIMITIVE_XHTML_HL7ORG:
- case PRIMITIVE_XHTML: {
- if (!isSuppressNarratives()) {
- IPrimitiveType> dt = (IPrimitiveType>) theNextValue;
- if (theChildName != null) {
- write(theEventWriter, theChildName, dt.getValueAsString());
- } else {
- theEventWriter.write(dt.getValueAsString());
- }
- } else {
- if (theChildName != null) {
- // do nothing
- } else {
- theEventWriter.writeNull();
+ theEventWriter.endArray();
}
+ break;
}
- break;
- }
- case RESOURCE:
- IBaseResource resource = (IBaseResource) theNextValue;
- RuntimeResourceDefinition def = myContext.getResourceDefinition(resource);
- encodeResourceToJsonStreamWriter(def, resource, theEventWriter, theChildName, false, true);
- break;
- case UNDECL_EXT:
- default:
- throw new IllegalStateException("Should not have this state here: " + theChildDef.getChildType().name());
+ case PRIMITIVE_XHTML_HL7ORG:
+ case PRIMITIVE_XHTML: {
+ if (!isSuppressNarratives()) {
+ IPrimitiveType> dt = (IPrimitiveType>) theNextValue;
+ if (theChildName != null) {
+ write(theEventWriter, theChildName, dt.getValueAsString());
+ } else {
+ theEventWriter.write(dt.getValueAsString());
+ }
+ } else {
+ if (theChildName != null) {
+ // do nothing
+ } else {
+ theEventWriter.writeNull();
+ }
+ }
+ break;
+ }
+ case RESOURCE:
+ IBaseResource resource = (IBaseResource) theNextValue;
+ RuntimeResourceDefinition def = myContext.getResourceDefinition(resource);
+ encodeResourceToJsonStreamWriter(def, resource, theEventWriter, theChildName, false, true);
+ break;
+ case UNDECL_EXT:
+ default:
+ throw new IllegalStateException("Should not have this state here: " + theChildDef.getChildType().name());
}
}
private void encodeCompositeElementChildrenToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theElement, JsonLikeWriter theEventWriter,
- boolean theContainedResource, boolean theSubResource, CompositeChildElement theParent) throws IOException {
+ boolean theContainedResource, boolean theSubResource, CompositeChildElement theParent) throws IOException {
{
String elementId = getCompositeElementId(theElement);
@@ -335,7 +340,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
BaseRuntimeChildDefinition nextChild = nextChildElem.getDef();
if (nextChildElem.getDef().getElementName().equals("extension") || nextChildElem.getDef().getElementName().equals("modifierExtension")
- || nextChild instanceof RuntimeChildDeclaredExtensionDefinition) {
+ || nextChild instanceof RuntimeChildDeclaredExtensionDefinition) {
if (!haveWrittenExtensions) {
extractAndWriteExtensionsAsDirectChild(theElement, theEventWriter, myContext.getElementDefinition(theElement.getClass()), theResDef, theResource, nextChildElem, theParent);
haveWrittenExtensions = true;
@@ -451,15 +456,15 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
if (nextChild.getMax() > 1 || nextChild.getMax() == Child.MAX_UNLIMITED) {
beginArray(theEventWriter, childName);
inArray = true;
- encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, theSubResource,nextChildElem, force);
+ encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, theSubResource, nextChildElem, force);
} else if (nextChild instanceof RuntimeChildNarrativeDefinition && theContainedResource) {
// suppress narratives from contained resources
} else {
- encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, childName, theContainedResource, theSubResource,nextChildElem, false);
+ encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, childName, theContainedResource, theSubResource, nextChildElem, false);
}
currentChildName = childName;
} else {
- encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource,theSubResource, nextChildElem, force);
+ encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, nextValue, childDef, null, theContainedResource, theSubResource, nextChildElem, force);
}
valueIdx++;
@@ -541,7 +546,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private void encodeCompositeElementToStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theNextValue, JsonLikeWriter theEventWriter, boolean theContainedResource, boolean theSubResource,
- CompositeChildElement theParent) throws IOException, DataFormatException {
+ CompositeChildElement theParent) throws IOException, DataFormatException {
writeCommentsPreAndPost(theNextValue, theEventWriter);
encodeCompositeElementChildrenToStreamWriter(theResDef, theResource, theNextValue, theEventWriter, theContainedResource, theSubResource, theParent);
@@ -554,14 +559,14 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
if (theResource.getStructureFhirVersionEnum() != myContext.getVersion().getVersion()) {
throw new IllegalArgumentException(
- "This parser is for FHIR version " + myContext.getVersion().getVersion() + " - Can not encode a structure for version " + theResource.getStructureFhirVersionEnum());
+ "This parser is for FHIR version " + myContext.getVersion().getVersion() + " - Can not encode a structure for version " + theResource.getStructureFhirVersionEnum());
}
doEncodeResourceToJsonLikeWriter(theResource, theJsonLikeWriter);
}
private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, String theObjectNameOrNull,
- boolean theContainedResource, boolean theSubResource) throws IOException {
+ boolean theContainedResource, boolean theSubResource) throws IOException {
IIdType resourceId = null;
// if (theResource instanceof IResource) {
// IResource res = (IResource) theResource;
@@ -598,7 +603,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private void encodeResourceToJsonStreamWriter(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter, String theObjectNameOrNull,
- boolean theContainedResource, boolean theSubResource, IIdType theResourceId) throws IOException {
+ boolean theContainedResource, boolean theSubResource, IIdType theResourceId) throws IOException {
if (!theContainedResource) {
super.containResourcesForEncoding(theResource);
}
@@ -612,28 +617,28 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
write(theEventWriter, "resourceType", resDef.getName());
- if (theResourceId != null && theResourceId.hasIdPart()) {
- write(theEventWriter, "id", theResourceId.getIdPart());
- final List extensions = new ArrayList(0);
- final List modifierExtensions = new ArrayList(0);
- // Undeclared extensions
- extractUndeclaredExtensions(theResourceId, extensions, modifierExtensions, null, null);
- boolean haveExtension = false;
- if (!extensions.isEmpty()) {
- haveExtension = true;
- }
+ if (theResourceId != null && theResourceId.hasIdPart()) {
+ write(theEventWriter, "id", theResourceId.getIdPart());
+ final List extensions = new ArrayList(0);
+ final List modifierExtensions = new ArrayList(0);
+ // Undeclared extensions
+ extractUndeclaredExtensions(theResourceId, extensions, modifierExtensions, null, null);
+ boolean haveExtension = false;
+ if (!extensions.isEmpty()) {
+ haveExtension = true;
+ }
- if (theResourceId.hasFormatComment() || haveExtension) {
- beginObject(theEventWriter, "_id");
- if (theResourceId.hasFormatComment()) {
- writeCommentsPreAndPost(theResourceId, theEventWriter);
- }
- if (haveExtension) {
- writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions);
- }
- theEventWriter.endObject();
- }
- }
+ if (theResourceId.hasFormatComment() || haveExtension) {
+ beginObject(theEventWriter, "_id");
+ if (theResourceId.hasFormatComment()) {
+ writeCommentsPreAndPost(theResourceId, theEventWriter);
+ }
+ if (haveExtension) {
+ writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions);
+ }
+ theEventWriter.endObject();
+ }
+ }
if (theResource instanceof IResource) {
IResource resource = (IResource) theResource;
@@ -695,19 +700,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
}
- if (theResource instanceof IBaseBinary) {
- IBaseBinary bin = (IBaseBinary) theResource;
- String contentType = bin.getContentType();
- if (isNotBlank(contentType)) {
- write(theEventWriter, "contentType", contentType);
- }
- String contentAsBase64 = bin.getContentAsBase64();
- if (isNotBlank(contentAsBase64)) {
- write(theEventWriter, "content", contentAsBase64);
- }
- } else {
- encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource));
- }
+ encodeCompositeElementToStreamWriter(theResDef, theResource, theResource, theEventWriter, theContainedResource, theSubResource, new CompositeChildElement(resDef, theSubResource));
theEventWriter.endObject();
}
@@ -715,12 +708,12 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
/**
* This is useful only for the two cases where extensions are encoded as direct children (e.g. not in some object
* called _name): resource extensions, and extension extensions
- *
+ *
* @param theChildElem
* @param theParent
*/
private void extractAndWriteExtensionsAsDirectChild(IBase theElement, JsonLikeWriter theEventWriter, BaseRuntimeElementDefinition> theElementDef, RuntimeResourceDefinition theResDef,
- IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent) throws IOException {
+ IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent) throws IOException {
List extensions = new ArrayList(0);
List modifierExtensions = new ArrayList(0);
@@ -737,7 +730,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private void extractDeclaredExtensions(IBase theResource, BaseRuntimeElementDefinition> resDef, List extensions, List modifierExtensions,
- CompositeChildElement theChildElem) {
+ CompositeChildElement theChildElem) {
for (RuntimeChildDeclaredExtensionDefinition nextDef : resDef.getExtensionsNonModifier()) {
for (IBase nextValue : nextDef.getAccessor().getValues(theResource)) {
if (nextValue != null) {
@@ -761,7 +754,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private void extractUndeclaredExtensions(IBase theElement, List extensions, List modifierExtensions, CompositeChildElement theChildElem,
- CompositeChildElement theParent) {
+ CompositeChildElement theParent) {
if (theElement instanceof ISupportsUndeclaredExtensions) {
ISupportsUndeclaredExtensions element = (ISupportsUndeclaredExtensions) theElement;
List ext = element.getUndeclaredExtensions();
@@ -1029,78 +1022,78 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
}
- private void parseExtension(ParserState> theState, JsonLikeArray theValues, boolean theIsModifier) {
- int allUnderscoreNames = 0;
- int handledUnderscoreNames = 0;
+ private void parseExtension(ParserState> theState, JsonLikeArray theValues, boolean theIsModifier) {
+ int allUnderscoreNames = 0;
+ int handledUnderscoreNames = 0;
+
+ for (int i = 0; i < theValues.size(); i++) {
+ JsonLikeObject nextExtObj = JsonLikeValue.asObject(theValues.get(i));
+ JsonLikeValue jsonElement = nextExtObj.get("url");
+ String url;
+ if (null == jsonElement || !(jsonElement.isScalar())) {
+ String parentElementName;
+ if (theIsModifier) {
+ parentElementName = "modifierExtension";
+ } else {
+ parentElementName = "extension";
+ }
+ getErrorHandler().missingRequiredElement(new ParseLocation(parentElementName), "url");
+ url = null;
+ } else {
+ url = getExtensionUrl(jsonElement.getAsString());
+ }
+ theState.enteringNewElementExtension(null, url, theIsModifier, getServerBaseUrl());
+ for (String next : nextExtObj.keySet()) {
+ if ("url".equals(next)) {
+ continue;
+ } else if ("extension".equals(next)) {
+ JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next));
+ parseExtension(theState, jsonVal, false);
+ } else if ("modifierExtension".equals(next)) {
+ JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next));
+ parseExtension(theState, jsonVal, true);
+ } else if (next.charAt(0) == '_') {
+ allUnderscoreNames++;
+ continue;
+ } else {
+ JsonLikeValue jsonVal = nextExtObj.get(next);
+ String alternateName = '_' + next;
+ JsonLikeValue alternateVal = nextExtObj.get(alternateName);
+ if (alternateVal != null) {
+ handledUnderscoreNames++;
+ }
+ parseChildren(theState, next, jsonVal, alternateVal, alternateName, false);
+ }
+ }
- for (int i = 0; i < theValues.size(); i++) {
- JsonLikeObject nextExtObj = JsonLikeValue.asObject(theValues.get(i));
- JsonLikeValue jsonElement = nextExtObj.get("url");
- String url;
- if (null == jsonElement || !(jsonElement.isScalar())) {
- String parentElementName;
- if (theIsModifier) {
- parentElementName = "modifierExtension";
- } else {
- parentElementName = "extension";
- }
- getErrorHandler().missingRequiredElement(new ParseLocation(parentElementName), "url");
- url = null;
- } else {
- url = getExtensionUrl(jsonElement.getAsString());
- }
- theState.enteringNewElementExtension(null, url, theIsModifier, getServerBaseUrl());
- for (String next : nextExtObj.keySet()) {
- if ("url".equals(next)) {
- continue;
- } else if ("extension".equals(next)) {
- JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next));
- parseExtension(theState, jsonVal, false);
- } else if ("modifierExtension".equals(next)) {
- JsonLikeArray jsonVal = JsonLikeValue.asArray(nextExtObj.get(next));
- parseExtension(theState, jsonVal, true);
- } else if (next.charAt(0) == '_') {
- allUnderscoreNames++;
- continue;
- } else {
- JsonLikeValue jsonVal = nextExtObj.get(next);
- String alternateName = '_' + next;
- JsonLikeValue alternateVal = nextExtObj.get(alternateName);
- if (alternateVal != null) {
- handledUnderscoreNames++;
- }
- parseChildren(theState, next, jsonVal, alternateVal, alternateName, false);
- }
- }
-
/*
- * This happens if an element has an extension but no actual value. I.e.
+ * This happens if an element has an extension but no actual value. I.e.
* if a resource has a "_status" element but no corresponding "status"
* element. This could be used to handle a null value with an extension
* for example.
*/
- if (allUnderscoreNames > handledUnderscoreNames) {
- for (String alternateName : nextExtObj.keySet()) {
- if (alternateName.startsWith("_") && alternateName.length() > 1) {
- JsonLikeValue nextValue = nextExtObj.get(alternateName);
- if (nextValue != null) {
- if (nextValue.isObject()) {
- String nextName = alternateName.substring(1);
- if (nextExtObj.get(nextName) == null) {
- theState.enteringNewElement(null, nextName);
- parseAlternates(nextValue, theState, alternateName, alternateName);
- theState.endingElement();
- }
- } else {
- getErrorHandler().incorrectJsonType(null, alternateName, ValueType.OBJECT, null, nextValue.getJsonType(), null);
- }
- }
- }
- }
- }
- theState.endingElement();
- }
- }
+ if (allUnderscoreNames > handledUnderscoreNames) {
+ for (String alternateName : nextExtObj.keySet()) {
+ if (alternateName.startsWith("_") && alternateName.length() > 1) {
+ JsonLikeValue nextValue = nextExtObj.get(alternateName);
+ if (nextValue != null) {
+ if (nextValue.isObject()) {
+ String nextName = alternateName.substring(1);
+ if (nextExtObj.get(nextName) == null) {
+ theState.enteringNewElement(null, nextName);
+ parseAlternates(nextValue, theState, alternateName, alternateName);
+ theState.endingElement();
+ }
+ } else {
+ getErrorHandler().incorrectJsonType(null, alternateName, ValueType.OBJECT, null, nextValue.getJsonType(), null);
+ }
+ }
+ }
+ }
+ }
+ theState.endingElement();
+ }
+ }
private void parseFhirComments(JsonLikeValue theObject, ParserState> theState) {
if (theObject.isArray()) {
@@ -1254,7 +1247,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
}
private void writeExtensionsAsDirectChild(IBaseResource theResource, JsonLikeWriter theEventWriter, RuntimeResourceDefinition resDef, List extensions,
- List modifierExtensions) throws IOException {
+ List modifierExtensions) throws IOException {
if (extensions.isEmpty() == false) {
beginArray(theEventWriter, "extension");
for (HeldExtension next : extensions) {
@@ -1328,6 +1321,28 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
return url1.compareTo(url2);
}
+ private void managePrimitiveExtension(final IBase theValue, final RuntimeResourceDefinition theResDef, final IBaseResource theResource, final JsonLikeWriter theEventWriter, final BaseRuntimeElementDefinition> def, final String childName) throws IOException {
+ if (def.getChildType().equals(ID_DATATYPE) || def.getChildType().equals(PRIMITIVE_DATATYPE)) {
+ final List extensions = new ArrayList(0);
+ final List modifierExtensions = new ArrayList(0);
+ // Undeclared extensions
+ extractUndeclaredExtensions(theValue, extensions, modifierExtensions, myParent, null);
+ // Declared extensions
+ if (def != null) {
+ extractDeclaredExtensions(theValue, def, extensions, modifierExtensions, myParent);
+ }
+ boolean haveContent = false;
+ if (!extensions.isEmpty() || !modifierExtensions.isEmpty()) {
+ haveContent = true;
+ }
+ if (haveContent) {
+ beginObject(theEventWriter, '_' + childName);
+ writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions);
+ theEventWriter.endObject();
+ }
+ }
+ }
+
public void write(RuntimeResourceDefinition theResDef, IBaseResource theResource, JsonLikeWriter theEventWriter) throws IOException {
if (myUndeclaredExtension != null) {
writeUndeclaredExtension(theResDef, theResource, theEventWriter, myUndeclaredExtension);
@@ -1341,7 +1356,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
/*
* This makes sure that even if the extension contains a reference to a contained
* resource which has a HAPI-assigned ID we'll still encode that ID.
- *
+ *
* See #327
*/
List extends IBase> preProcessedValue = preProcessValues(myDef, theResource, Collections.singletonList(myValue), myChildElem);
@@ -1367,7 +1382,7 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
} else {
String childName = myDef.getChildNameByDatatype(myValue.getClass());
encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, myValue, def, childName, false, false, myParent, false);
- managePrimitiveExtension(myValue, theResDef, theResource, theEventWriter, def, childName);
+ managePrimitiveExtension(myValue, theResDef, theResource, theEventWriter, def, childName);
}
theEventWriter.endObject();
@@ -1422,34 +1437,12 @@ public class JsonParser extends BaseParser implements IJsonLikeParser {
throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + value.getClass().getCanonicalName());
}
encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, value, childDef, childName, true, false, myParent, false);
- managePrimitiveExtension(value, theResDef, theResource, theEventWriter, childDef, childName);
+ managePrimitiveExtension(value, theResDef, theResource, theEventWriter, childDef, childName);
}
// theEventWriter.name(myUndeclaredExtension.get);
theEventWriter.endObject();
}
-
- private void managePrimitiveExtension(final IBase theValue, final RuntimeResourceDefinition theResDef, final IBaseResource theResource, final JsonLikeWriter theEventWriter, final BaseRuntimeElementDefinition> def, final String childName) throws IOException {
- if (def.getChildType().equals(ID_DATATYPE) || def.getChildType().equals(PRIMITIVE_DATATYPE)) {
- final List extensions = new ArrayList(0);
- final List modifierExtensions = new ArrayList(0);
- // Undeclared extensions
- extractUndeclaredExtensions(theValue, extensions, modifierExtensions, myParent, null);
- // Declared extensions
- if (def != null) {
- extractDeclaredExtensions(theValue, def, extensions, modifierExtensions, myParent);
- }
- boolean haveContent = false;
- if (!extensions.isEmpty() || !modifierExtensions.isEmpty()) {
- haveContent = true;
- }
- if (haveContent) {
- beginObject(theEventWriter, '_' + childName);
- writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions);
- theEventWriter.endObject();
- }
- }
- }
- }
+ }
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java
index ce00a0dcbdd..e54793602c6 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java
@@ -606,7 +606,7 @@ class ParserState {
return;
}
case RESOURCE: {
- if (myInstance instanceof IAnyResource || myInstance instanceof IBaseBackboneElement) {
+ if (myInstance instanceof IAnyResource || myInstance instanceof IBaseBackboneElement || myInstance instanceof IBaseElement) {
ParserState.PreResourceStateHl7Org state = new PreResourceStateHl7Org(myInstance, child.getMutator(), null);
push(state);
} else {
@@ -1559,7 +1559,8 @@ class ParserState {
if (theEvent.isEndElement()) {
if (myDepth == 0) {
- myDt.setValue(myEvents);
+ String eventsAsString = XmlUtil.encode(myEvents);
+ myDt.setValue(eventsAsString);
doPop();
}
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java
index 1a577c5d567..f79d1130428 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/XmlParser.java
@@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.Reader;
+import java.io.StringReader;
import java.io.Writer;
import java.util.*;
@@ -605,13 +606,16 @@ public class XmlParser extends BaseParser /* implements IParser */ {
}
}
+
private void encodeXhtml(XhtmlDt theDt, XMLStreamWriter theEventWriter) throws XMLStreamException {
if (theDt == null || theDt.getValue() == null) {
return;
}
+ List events = XmlUtil.parse(theDt.getValue());
boolean firstElement = true;
- for (XMLEvent event : theDt.getValue()) {
+
+ for (XMLEvent event : events) {
switch (event.getEventType()) {
case XMLStreamConstants.ATTRIBUTE:
Attribute attr = (Attribute) event;
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/CacheControlDirective.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/CacheControlDirective.java
new file mode 100644
index 00000000000..bb9ab1b1326
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/CacheControlDirective.java
@@ -0,0 +1,128 @@
+package ca.uhn.fhir.rest.api;
+
+/*-
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2017 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.StringTokenizer;
+
+import static org.apache.commons.lang3.StringUtils.trim;
+
+/**
+ * Parses and stores the value(s) within HTTP Cache-Control headers
+ */
+public class CacheControlDirective {
+
+ private static final String MAX_RESULTS_EQUALS = Constants.CACHE_CONTROL_MAX_RESULTS + "=";
+ private static final Logger ourLog = LoggerFactory.getLogger(CacheControlDirective.class);
+ private boolean myNoCache;
+ private boolean myNoStore;
+ private Integer myMaxResults;
+
+ /**
+ * Constructor
+ */
+ public CacheControlDirective() {
+ super();
+ }
+
+ /**
+ * If the {@link #isNoStore() no-store} directive is set, this HAPI FHIR extention
+ * to the Cache-Control
header called max-results=123
+ * specified the maximum number of results which will be fetched from the
+ * database before returning.
+ */
+ public Integer getMaxResults() {
+ return myMaxResults;
+ }
+
+ /**
+ * If the {@link #isNoStore() no-store} directive is set, this HAPI FHIR extention
+ * to the Cache-Control
header called max-results=123
+ * specified the maximum number of results which will be fetched from the
+ * database before returning.
+ */
+ public CacheControlDirective setMaxResults(Integer theMaxResults) {
+ myMaxResults = theMaxResults;
+ return this;
+ }
+
+ /**
+ * If true<
, adds the no-cache
directive to the
+ * request. This directive indicates that the cache should not be used to
+ * serve this request.
+ */
+ public boolean isNoCache() {
+ return myNoCache;
+ }
+
+ /**
+ * If true<
, adds the no-cache
directive to the
+ * request. This directive indicates that the cache should not be used to
+ * serve this request.
+ */
+ public CacheControlDirective setNoCache(boolean theNoCache) {
+ myNoCache = theNoCache;
+ return this;
+ }
+
+ public boolean isNoStore() {
+ return myNoStore;
+ }
+
+ public CacheControlDirective setNoStore(boolean theNoStore) {
+ myNoStore = theNoStore;
+ return this;
+ }
+
+ /**
+ * Parses a list of Cache-Control
header values
+ *
+ * @param theValues The Cache-Control
header values
+ */
+ public CacheControlDirective parse(List theValues) {
+ if (theValues != null) {
+ for (String nextValue : theValues) {
+ StringTokenizer tok = new StringTokenizer(nextValue, ",");
+ while (tok.hasMoreTokens()) {
+ String next = trim(tok.nextToken());
+ if (Constants.CACHE_CONTROL_NO_CACHE.equals(next)) {
+ myNoCache = true;
+ } else if (Constants.CACHE_CONTROL_NO_STORE.equals(next)) {
+ myNoStore = true;
+ } else if (next.startsWith(MAX_RESULTS_EQUALS)) {
+ String valueString = trim(next.substring(MAX_RESULTS_EQUALS.length()));
+ try {
+ myMaxResults = Integer.parseInt(valueString);
+ } catch (NumberFormatException e) {
+ ourLog.warn("Invalid {} value: {}", Constants.CACHE_CONTROL_MAX_RESULTS, valueString);
+ }
+
+ }
+ }
+ }
+ }
+
+ return this;
+ }
+}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java
index 4d067c33677..7b78de58f85 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java
@@ -25,9 +25,22 @@ import java.util.*;
public class Constants {
+ public static final String CACHE_CONTROL_MAX_RESULTS = "max-results";
+ public static final String CACHE_CONTROL_NO_CACHE = "no-cache";
+ public static final String CACHE_CONTROL_NO_STORE = "no-store";
public static final String CHARSET_NAME_UTF8 = "UTF-8";
public static final Charset CHARSET_UTF8;
public static final String CHARSET_UTF8_CTSUFFIX = "; charset=" + CHARSET_NAME_UTF8;
+ /**
+ * Contains a standard set of headers which are used by FHIR / HAPI FHIR, and therefore
+ * would make a useful set for CORS AllowedHeader declarations
+ */
+ public static final Set CORS_ALLOWED_HEADERS;
+ /**
+ * Contains a standard set of HTTP Methods which are used by FHIR / HAPI FHIR, and therefore
+ * would make a useful set for CORS AllowedMethod declarations
+ */
+ public static final Set CORS_ALLWED_METHODS;
public static final String CT_FHIR_JSON = "application/json+fhir";
public static final String CT_FHIR_JSON_NEW = "application/fhir+json";
public static final String CT_FHIR_XML = "application/xml+fhir";
@@ -67,6 +80,7 @@ public class Constants {
public static final String HEADER_AUTHORIZATION = "Authorization";
public static final String HEADER_AUTHORIZATION_VALPREFIX_BASIC = "Basic ";
public static final String HEADER_AUTHORIZATION_VALPREFIX_BEARER = "Bearer ";
+ public static final String HEADER_CACHE_CONTROL = "Cache-Control";
public static final String HEADER_CONTENT_DISPOSITION = "Content-Disposition";
public static final String HEADER_CONTENT_ENCODING = "Content-Encoding";
public static final String HEADER_CONTENT_LOCATION = "Content-Location";
@@ -172,12 +186,13 @@ public class Constants {
public static final String URL_TOKEN_METADATA = "metadata";
public static final String OO_INFOSTATUS_PROCESSING = "processing";
public static final String PARAM_GRAPHQL_QUERY = "query";
+ public static final String HEADER_X_CACHE = "X-Cache";
+ public static final String HEADER_X_SECURITY_CONTEXT = "X-Security-Context";
static {
CHARSET_UTF8 = Charset.forName(CHARSET_NAME_UTF8);
- HashMap statusNames = new HashMap();
-
+ HashMap statusNames = new HashMap<>();
statusNames.put(200, "OK");
statusNames.put(201, "Created");
statusNames.put(202, "Accepted");
@@ -242,11 +257,31 @@ public class Constants {
statusNames.put(511, "Network Authentication Required");
HTTP_STATUS_NAMES = Collections.unmodifiableMap(statusNames);
- Set formatsHtml = new HashSet();
+ Set formatsHtml = new HashSet<>();
formatsHtml.add(CT_HTML);
formatsHtml.add(FORMAT_HTML);
FORMATS_HTML = Collections.unmodifiableSet(formatsHtml);
-
+
+ // *********************************************************
+ // Update CorsInterceptor's constructor documentation if you change these:
+ // *********************************************************
+ HashSet corsAllowedHeaders = new HashSet<>();
+ corsAllowedHeaders.add("Accept");
+ corsAllowedHeaders.add("Access-Control-Request-Headers");
+ corsAllowedHeaders.add("Access-Control-Request-Method");
+ corsAllowedHeaders.add("Cache-Control");
+ corsAllowedHeaders.add("Content-Type");
+ corsAllowedHeaders.add("Origin");
+ corsAllowedHeaders.add("Prefer");
+ corsAllowedHeaders.add("X-Requested-With");
+ CORS_ALLOWED_HEADERS = Collections.unmodifiableSet(corsAllowedHeaders);
+
+ // *********************************************************
+ // Update CorsInterceptor's constructor documentation if you change these:
+ // *********************************************************
+ HashSet corsAllowedMethods = new HashSet<>();
+ corsAllowedMethods.addAll(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
+ CORS_ALLWED_METHODS = Collections.unmodifiableSet(corsAllowedMethods);
}
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java
index b9154445d6e..947044070eb 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/IVersionSpecificBundleFactory.java
@@ -35,7 +35,7 @@ public interface IVersionSpecificBundleFactory {
void addResourcesToBundle(List theResult, BundleTypeEnum theBundleType, String theServerBase, BundleInclusionRule theBundleInclusionRule, Set theIncludes);
- void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated);
+ void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType, IPrimitiveType theLastUpdated);
IBaseResource getResourceBundle();
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java
index b345a6d02b2..bb08eb5a677 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/IClientExecutable.java
@@ -1,5 +1,6 @@
package ca.uhn.fhir.rest.gclient;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.EncodingEnum;
import ca.uhn.fhir.rest.api.SummaryEnum;
import org.hl7.fhir.instance.model.api.IBaseResource;
@@ -38,6 +39,12 @@ public interface IClientExecutable, Y> {
@Deprecated
T andLogRequestAndResponse(boolean theLogRequestAndResponse);
+ /**
+ * Sets the Cache-Control
header value, which advises the server (or any cache in front of it)
+ * how to behave in terms of cached requests
+ */
+ T cacheControl(CacheControlDirective theCacheControlDirective);
+
/**
* Request that the server return subsetted resources, containing only the elements specified in the given parameters.
* For example: subsetElements("name", "identifier")
requests that the server only return
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BinaryUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BinaryUtil.java
new file mode 100644
index 00000000000..b6c4411c8f3
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/BinaryUtil.java
@@ -0,0 +1,47 @@
+package ca.uhn.fhir.util;
+
+import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
+import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.context.RuntimeResourceDefinition;
+import org.hl7.fhir.instance.model.api.IBase;
+import org.hl7.fhir.instance.model.api.IBaseBinary;
+import org.hl7.fhir.instance.model.api.IBaseReference;
+
+import java.util.List;
+
+public class BinaryUtil {
+
+ private BinaryUtil() {
+ // non instantiable
+ }
+
+ public static IBaseReference getSecurityContext(FhirContext theCtx, IBaseBinary theBinary) {
+ RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary");
+ BaseRuntimeChildDefinition child = def.getChildByName("securityContext");
+ IBaseReference retVal = null;
+ if (child != null) {
+ List values = child.getAccessor().getValues(theBinary);
+ if (values.size() > 0) {
+ retVal = (IBaseReference) values.get(0);
+ }
+ }
+ return retVal;
+ }
+
+ public static IBaseBinary newBinary(FhirContext theCtx) {
+ return (IBaseBinary) theCtx.getResourceDefinition("Binary").newInstance();
+ }
+
+ public static void setSecurityContext(FhirContext theCtx, IBaseBinary theBinary, String theSecurityContext) {
+ RuntimeResourceDefinition def = theCtx.getResourceDefinition("Binary");
+ BaseRuntimeChildDefinition child = def.getChildByName("securityContext");
+
+ BaseRuntimeElementDefinition> referenceDef = theCtx.getElementDefinition("reference");
+ IBaseReference reference = (IBaseReference) referenceDef.newInstance();
+ child.getMutator().addValue(theBinary, reference);
+
+ reference.setReference(theSecurityContext);
+ }
+
+}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java
index 620e36dbbc4..0ec0fe86848 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/PortUtil.java
@@ -21,12 +21,14 @@ package ca.uhn.fhir.util;
*/
import java.net.ServerSocket;
+import java.util.LinkedHashSet;
/**
* Provides server ports
*/
@CoverageIgnore
public class PortUtil {
+ private static LinkedHashSet ourPorts = new LinkedHashSet<>();
/*
* Non instantiable
@@ -41,9 +43,13 @@ public class PortUtil {
public static int findFreePort() {
ServerSocket server;
try {
- server = new ServerSocket(0);
- int port = server.getLocalPort();
- server.close();
+ int port;
+ do {
+ server = new ServerSocket(0);
+ port = server.getLocalPort();
+ server.close();
+ } while (!ourPorts.add(port));
+
Thread.sleep(500);
return port;
} catch (Exception e) {
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java
index a9aca692015..3e1347dafcb 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java
@@ -20,33 +20,34 @@ package ca.uhn.fhir.util;
* #L%
*/
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.i18n.HapiLocalizer;
+import ch.qos.logback.classic.Level;
+import ch.qos.logback.classic.Logger;
+import ch.qos.logback.classic.LoggerContext;
+import org.slf4j.LoggerFactory;
+
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.Locale;
import java.util.TimeZone;
-import org.slf4j.LoggerFactory;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.i18n.HapiLocalizer;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.LoggerContext;
+import static org.apache.commons.lang3.StringUtils.defaultString;
public class TestUtil {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TestUtil.class);
/**
* THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE
- *
+ *
* When we run the unit tests in cobertura, JUnit doesn't seem to clean up static fields which leads to
* tons of memory being used by the end and the JVM crashes in Travis. Manually clearing all of the
* static fields seems to solve this.
*/
public static void clearAllStaticFieldsForUnitTest() {
HapiLocalizer.setOurFailOnMissingMessage(true);
-
+
Class> theType;
try {
throw new Exception();
@@ -104,7 +105,7 @@ public class TestUtil {
* environment
*/
public static void randomizeLocale() {
- Locale[] availableLocales = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN };
+ Locale[] availableLocales = {Locale.CANADA, Locale.GERMANY, Locale.TAIWAN};
Locale.setDefault(availableLocales[(int) (Math.random() * availableLocales.length)]);
ourLog.info("Tests are running in locale: " + Locale.getDefault().getDisplayName());
if (Math.random() < 0.5) {
@@ -116,10 +117,19 @@ public class TestUtil {
System.setProperty("file.encoding", "UTF-8");
System.setProperty("line.separator", "\n");
}
- String availableTimeZones[] = { "GMT+08:00", "GMT-05:00", "GMT+00:00", "GMT+03:30" };
+ String availableTimeZones[] = {"GMT+08:00", "GMT-05:00", "GMT+00:00", "GMT+03:30"};
String timeZone = availableTimeZones[(int) (Math.random() * availableTimeZones.length)];
TimeZone.setDefault(TimeZone.getTimeZone(timeZone));
ourLog.info("Tests are using time zone: {}", TimeZone.getDefault().getID());
}
+ /**
+ * THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE
+ *
+ * Strip \r chars from a string to account for line ending platform differences
+ */
+ public static String stripReturns(String theString) {
+ return defaultString(theString).replace("\r", "");
+ }
+
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlDetectionUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlDetectionUtil.java
new file mode 100644
index 00000000000..4619418d7c8
--- /dev/null
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/XmlDetectionUtil.java
@@ -0,0 +1,57 @@
+package ca.uhn.fhir.util;
+
+/*-
+ * #%L
+ * HAPI FHIR - Core Library
+ * %%
+ * Copyright (C) 2014 - 2017 University Health Network
+ * %%
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * #L%
+ */
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.Reader;
+import java.io.StringReader;
+
+public class XmlDetectionUtil {
+
+ private static final Logger ourLog = LoggerFactory.getLogger(XmlDetectionUtil.class);
+ private static Boolean ourStaxPresent;
+
+ /**
+ * This method will return true
if a StAX XML parsing library is present
+ * on the classpath
+ */
+ public static boolean isStaxPresent() {
+ Boolean retVal = ourStaxPresent;
+ if (retVal == null) {
+ try {
+ Class.forName("javax.xml.stream.events.XMLEvent");
+ Class> xmlUtilClazz = Class.forName("ca.uhn.fhir.util.XmlUtil");
+ xmlUtilClazz.getMethod("createXmlReader", Reader.class).invoke(xmlUtilClazz, new StringReader(""));
+ ourStaxPresent = Boolean.TRUE;
+ retVal = Boolean.TRUE;
+ } catch (Throwable t) {
+ ourLog.info("StAX not detected on classpath, XML processing will be disabled");
+ ourStaxPresent = Boolean.FALSE;
+ retVal = Boolean.FALSE;
+ }
+ }
+ return retVal;
+ }
+
+
+}
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 c42fc0d42e8..301bdfe42ba 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
@@ -20,12 +20,13 @@ package ca.uhn.fhir.util;
* #L%
*/
import java.io.*;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
import javax.xml.stream.*;
+import javax.xml.stream.events.XMLEvent;
+import ca.uhn.fhir.model.primitive.XhtmlDt;
+import ca.uhn.fhir.parser.DataFormatException;
import org.apache.commons.lang3.StringEscapeUtils;
import org.codehaus.stax2.XMLOutputFactory2;
import org.codehaus.stax2.io.EscapingWriterFactory;
@@ -37,21 +38,22 @@ import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.util.jar.DependencyLogFactory;
import ca.uhn.fhir.util.jar.IDependencyLog;
+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 {
+ private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlUtil.class);
+ private static final Map VALID_ENTITY_NAMES;
+ private static final ExtendedEntityReplacingXmlResolver XML_RESOLVER = new ExtendedEntityReplacingXmlResolver();
private static XMLOutputFactory ourFragmentOutputFactory;
private static volatile boolean ourHaveLoggedStaxImplementation;
private static volatile XMLInputFactory ourInputFactory;
- private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlUtil.class);
private static Throwable ourNextException;
private static volatile XMLOutputFactory ourOutputFactory;
- private static Boolean ourStaxPresent;
- private static final Map VALID_ENTITY_NAMES;
- private static final ExtendedEntityReplacingXmlResolver XML_RESOLVER = new ExtendedEntityReplacingXmlResolver();
static {
HashMap validEntityNames = new HashMap(1448);
@@ -1517,7 +1519,7 @@ public class XmlUtil {
}
XMLOutputFactory outputFactory = newOutputFactory();
-
+
if (!ourHaveLoggedStaxImplementation) {
logStaxImplementation(outputFactory.getClass());
}
@@ -1545,7 +1547,7 @@ public class XmlUtil {
public static XMLEventReader createXmlReader(Reader reader) throws FactoryConfigurationError, XMLStreamException {
throwUnitTestExceptionIfConfiguredToDoSo();
-
+
XMLInputFactory inputFactory = getOrCreateInputFactory();
// Now.. create the reader and return it
@@ -1555,7 +1557,7 @@ public class XmlUtil {
public static XMLStreamWriter createXmlStreamWriter(Writer theWriter) throws FactoryConfigurationError, XMLStreamException {
throwUnitTestExceptionIfConfiguredToDoSo();
-
+
XMLOutputFactory outputFactory = getOrCreateOutputFactory();
XMLStreamWriter retVal = outputFactory.createXMLStreamWriter(theWriter);
return retVal;
@@ -1567,6 +1569,30 @@ public class XmlUtil {
return retVal;
}
+ /**
+ * Encode a set of StAX events into a String
+ */
+ public static String encode(List theEvents) {
+ try {
+ StringWriter w = new StringWriter();
+ XMLEventWriter ew = XmlUtil.createXmlFragmentWriter(w);
+
+ for (XMLEvent next : theEvents) {
+ if (next.isCharacters()) {
+ ew.add(next);
+ } else {
+ ew.add(next);
+ }
+ }
+ ew.close();
+ return w.toString();
+ } catch (XMLStreamException e) {
+ throw new DataFormatException("Problem with the contained XML events", e);
+ } catch (FactoryConfigurationError e) {
+ throw new ConfigurationException(e);
+ }
+ }
+
private static XMLOutputFactory getOrCreateFragmentOutputFactory() throws FactoryConfigurationError {
XMLOutputFactory retVal = ourFragmentOutputFactory;
if (retVal == null) {
@@ -1588,7 +1614,7 @@ public class XmlUtil {
} catch (ClassNotFoundException e) {
// ok
}
-
+
XMLInputFactory inputFactory = newInputFactory();
if (!ourHaveLoggedStaxImplementation) {
@@ -1596,20 +1622,20 @@ public class XmlUtil {
}
/*
- * These two properties disable external entity processing, which can
+ * These two properties disable external entity processing, which can
* be a security vulnerability.
- *
+ *
* See https://github.com/jamesagnew/hapi-fhir/issues/339
* https://www.owasp.org/index.php/XML_External_Entity_%28XXE%29_Processing
*/
inputFactory.setProperty(XMLInputFactory.SUPPORT_DTD, false); // This disables DTDs entirely for that factory
inputFactory.setProperty("javax.xml.stream.isSupportingExternalEntities", false); // disable external entities
-
+
/*
* In the following few lines, you can uncomment the first and comment the second to disable automatic
* parsing of extended entities, e.g. §
- *
+ *
* Note that these properties are Woodstox specific and they cause a crash in environments where SJSXP is
* being used (e.g. glassfish) so we don't set them there.
*/
@@ -1652,6 +1678,7 @@ public class XmlUtil {
return ourOutputFactory;
}
+
private static void logStaxImplementation(Class> theClass) {
IDependencyLog logger = DependencyLogFactory.createJarLogger();
if (logger != null) {
@@ -1683,6 +1710,49 @@ public class XmlUtil {
return outputFactory;
}
+ /**
+ * Parses an XML string into a set of StAX events
+ */
+ public static List parse(String theValue) {
+ if (isBlank(theValue)) {
+ return Collections.emptyList();
+ }
+
+ String val = theValue.trim();
+ if (!val.startsWith("<")) {
+ val = XhtmlDt.DIV_OPEN_FIRST + val + "";
+ }
+ boolean hasProcessingInstruction = val.startsWith("");
+ if (hasProcessingInstruction && val.endsWith("?>")) {
+ return null;
+ }
+
+
+ try {
+ ArrayList value = new ArrayList<>();
+ StringReader reader = new StringReader(val);
+ XMLEventReader er = XmlUtil.createXmlReader(reader);
+ boolean first = true;
+ while (er.hasNext()) {
+ XMLEvent next = er.nextEvent();
+ if (first) {
+ first = false;
+ continue;
+ }
+ if (er.hasNext()) {
+ // don't add the last event
+ value.add(next);
+ }
+ }
+ return value;
+
+ } catch (XMLStreamException e) {
+ throw new DataFormatException("String does not appear to be valid XML/XHTML (error is \"" + e.getMessage() + "\"): " + theValue, e);
+ } catch (FactoryConfigurationError e) {
+ throw new ConfigurationException(e);
+ }
+ }
+
/**
* FOR UNIT TESTS ONLY - Throw this exception for the next operation
*/
@@ -1711,26 +1781,6 @@ public class XmlUtil {
return null;
}
}
-
- /**
- * This method will return true
if a StAX XML parsing library is present
- * on the classpath
- */
- public static boolean isStaxPresent() {
- Boolean retVal = ourStaxPresent;
- if (retVal == null) {
- try {
- newInputFactory();
- ourStaxPresent = Boolean.TRUE;
- retVal = Boolean.TRUE;
- } catch (ConfigurationException e) {
- ourLog.info("StAX not detected on classpath, XML processing will be disabled");
- ourStaxPresent = Boolean.FALSE;
- retVal = Boolean.FALSE;
- }
- }
- return retVal;
- }
public static class MyEscaper implements EscapingWriterFactory {
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/DefinitionException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/DefinitionException.java
deleted file mode 100644
index 3896b1dd9b1..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/DefinitionException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class DefinitionException extends FHIRException {
-
- private static final long serialVersionUID = 8175803009974854088L;
-
- public DefinitionException() {
- super();
- }
-
- public DefinitionException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public DefinitionException(String message) {
- super(message);
- }
-
- public DefinitionException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRException.java
deleted file mode 100644
index 274864c3078..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class FHIRException extends Exception {
-
- // Note that the 4-argument constructor has been removed as it is not JDK6 compatible
-
- private static final long serialVersionUID = -1793365096090608037L;
-
- public FHIRException() {
- super();
- }
-
- public FHIRException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public FHIRException(String message) {
- super(message);
- }
-
- public FHIRException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRFormatError.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRFormatError.java
deleted file mode 100644
index 42c96577801..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/FHIRFormatError.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class FHIRFormatError extends FHIRException {
-
- private static final long serialVersionUID = 1L;
-
- public FHIRFormatError() {
- super();
- }
-
- public FHIRFormatError(String message, Throwable cause) {
- super(message, cause);
- }
-
- public FHIRFormatError(String message) {
- super(message);
- }
-
- public FHIRFormatError(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/NoTerminologyServiceException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/NoTerminologyServiceException.java
deleted file mode 100644
index 08be82d5d89..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/NoTerminologyServiceException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class NoTerminologyServiceException extends FHIRException {
-
- private static final long serialVersionUID = 8196224236579018584L;
-
- public NoTerminologyServiceException() {
- super();
- }
-
- public NoTerminologyServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public NoTerminologyServiceException(String message) {
- super(message);
- }
-
- public NoTerminologyServiceException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/PathEngineException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/PathEngineException.java
deleted file mode 100644
index b56c9d9212c..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/PathEngineException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class PathEngineException extends FHIRException {
-
- private static final long serialVersionUID = -8550234068917355391L;
-
- public PathEngineException() {
- super();
- }
-
- public PathEngineException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public PathEngineException(String message) {
- super(message);
- }
-
- public PathEngineException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/TerminologyServiceException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/TerminologyServiceException.java
deleted file mode 100644
index 2f1ae3dca5a..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/TerminologyServiceException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class TerminologyServiceException extends FHIRException {
-
- private static final long serialVersionUID = -1547510329455394225L;
-
- public TerminologyServiceException() {
- super();
- }
-
- public TerminologyServiceException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public TerminologyServiceException(String message) {
- super(message);
- }
-
- public TerminologyServiceException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/UcumException.java b/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/UcumException.java
deleted file mode 100644
index c1c2bd8a90e..00000000000
--- a/hapi-fhir-base/src/main/java/org/hl7/fhir/exceptions/UcumException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.hl7.fhir.exceptions;
-
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class UcumException extends FHIRException {
-
- private static final long serialVersionUID = -8535757334881835619L;
-
- public UcumException() {
- super();
- }
-
- public UcumException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public UcumException(String message) {
- super(message);
- }
-
- public UcumException(Throwable cause) {
- super(cause);
- }
-
-}
diff --git a/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/CacheControlDirectiveTest.java b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/CacheControlDirectiveTest.java
new file mode 100644
index 00000000000..4591b4bc1f1
--- /dev/null
+++ b/hapi-fhir-base/src/test/java/ca/uhn/fhir/rest/api/CacheControlDirectiveTest.java
@@ -0,0 +1,58 @@
+package ca.uhn.fhir.rest.api;
+
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.List;
+
+import static org.junit.Assert.*;
+
+public class CacheControlDirectiveTest {
+
+ @Test
+ public void testParseNoCache() {
+ List values = Arrays.asList(Constants.CACHE_CONTROL_NO_CACHE);
+ CacheControlDirective ccd = new CacheControlDirective();
+ ccd.parse(values);
+ assertTrue(ccd.isNoCache());
+ assertFalse(ccd.isNoStore());
+ }
+
+ @Test
+ public void testParseNoCacheNoStore() {
+ List values = Arrays.asList(Constants.CACHE_CONTROL_NO_CACHE + " , " + Constants.CACHE_CONTROL_NO_STORE);
+ CacheControlDirective ccd = new CacheControlDirective();
+ ccd.parse(values);
+ assertTrue(ccd.isNoCache());
+ assertTrue(ccd.isNoStore());
+ assertEquals(null, ccd.getMaxResults());
+ }
+
+ @Test
+ public void testParseNoCacheNoStoreMaxResults() {
+ List values = Arrays.asList(Constants.CACHE_CONTROL_NO_STORE + ", "+ Constants.CACHE_CONTROL_MAX_RESULTS + "=5");
+ CacheControlDirective ccd = new CacheControlDirective();
+ ccd.parse(values);
+ assertFalse(ccd.isNoCache());
+ assertTrue(ccd.isNoStore());
+ assertEquals(5, ccd.getMaxResults().intValue());
+ }
+
+ @Test
+ public void testParseNoCacheNoStoreMaxResultsInvalid() {
+ List values = Arrays.asList(Constants.CACHE_CONTROL_NO_STORE + ", "+ Constants.CACHE_CONTROL_MAX_RESULTS + "=A");
+ CacheControlDirective ccd = new CacheControlDirective();
+ ccd.parse(values);
+ assertFalse(ccd.isNoCache());
+ assertTrue(ccd.isNoStore());
+ assertEquals(null, ccd.getMaxResults());
+ }
+
+ @Test
+ public void testParseNull() {
+ CacheControlDirective ccd = new CacheControlDirective();
+ ccd.parse(null);
+ assertFalse(ccd.isNoCache());
+ assertFalse(ccd.isNoStore());
+ }
+}
diff --git a/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java b/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java
index 3b8c70dd639..d69ee208acf 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java
+++ b/hapi-fhir-cli/hapi-fhir-cli-app/src/main/java/ca/uhn/fhir/cli/IgPackUploader.java
@@ -73,6 +73,7 @@ public class IgPackUploader extends BaseCommand {
.and(StructureDefinition.URL.matches().value(nextResourceUrl))
.execute();
}
+ break;
default:
throw new ParseException("This command does not support FHIR version " + ctx.getVersion().getVersion());
}
diff --git a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java
index 933acbaa1d7..751eabb88d9 100644
--- a/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java
+++ b/hapi-fhir-cli/hapi-fhir-cli-jpaserver/src/main/java/ca/uhn/fhir/jpa/demo/JpaServerDemo.java
@@ -1,28 +1,36 @@
package ca.uhn.fhir.jpa.demo;
-import java.util.*;
-
-import javax.servlet.ServletException;
-
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.cors.CorsConfiguration;
-
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.jpa.dao.DaoConfig;
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
-import ca.uhn.fhir.jpa.provider.dstu3.*;
-import ca.uhn.fhir.jpa.provider.r4.*;
+import ca.uhn.fhir.jpa.provider.dstu3.JpaConformanceProviderDstu3;
+import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
+import ca.uhn.fhir.jpa.provider.dstu3.TerminologyUploaderProviderDstu3;
+import ca.uhn.fhir.jpa.provider.r4.JpaConformanceProviderR4;
+import ca.uhn.fhir.jpa.provider.r4.JpaSystemProviderR4;
+import ca.uhn.fhir.jpa.provider.r4.TerminologyUploaderProviderR4;
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
import ca.uhn.fhir.model.dstu2.resource.Bundle;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
import ca.uhn.fhir.rest.api.EncodingEnum;
-import ca.uhn.fhir.rest.server.*;
+import ca.uhn.fhir.rest.server.ETagSupportEnum;
+import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
+import ca.uhn.fhir.rest.server.IResourceProvider;
+import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.interceptor.CorsInterceptor;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
+import org.springframework.web.context.ContextLoaderListener;
+import org.springframework.web.context.WebApplicationContext;
+import org.springframework.web.cors.CorsConfiguration;
+
+import javax.servlet.ServletException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
public class JpaServerDemo extends RestfulServer {
@@ -134,19 +142,7 @@ public class JpaServerDemo extends RestfulServer {
setPagingProvider(new FifoMemoryPagingProvider(10));
// Register a CORS filter
- CorsConfiguration config = new CorsConfiguration();
- CorsInterceptor corsInterceptor = new CorsInterceptor(config);
- config.addAllowedHeader("x-fhir-starter");
- config.addAllowedHeader("Origin");
- config.addAllowedHeader("Accept");
- config.addAllowedHeader("X-Requested-With");
- config.addAllowedHeader("Content-Type");
- config.addAllowedHeader("Access-Control-Request-Method");
- config.addAllowedHeader("Access-Control-Request-Headers");
- config.addAllowedOrigin("*");
- config.addExposedHeader("Location");
- config.addExposedHeader("Content-Location");
- config.setAllowedMethods(Arrays.asList("GET","POST","PUT","DELETE","OPTIONS"));
+ CorsInterceptor corsInterceptor = new CorsInterceptor();
registerInterceptor(corsInterceptor);
/*
diff --git a/hapi-fhir-client-okhttp/pom.xml b/hapi-fhir-client-okhttp/pom.xml
index 525c8e0ceaa..d45e99e0e57 100644
--- a/hapi-fhir-client-okhttp/pom.xml
+++ b/hapi-fhir-client-okhttp/pom.xml
@@ -59,6 +59,11 @@
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+ test
+
com.google.guava
guava
@@ -125,4 +130,4 @@
-
\ No newline at end of file
+
diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java
index 17c097fdcfd..746b335b807 100644
--- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java
+++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/apache/ApacheHttpResponse.java
@@ -98,24 +98,23 @@ public class ApacheHttpResponse implements IHttpResponse {
}
if (charset == null) {
if (Constants.STATUS_HTTP_204_NO_CONTENT != myResponse.getStatusLine().getStatusCode()) {
- ourLog.warn("Response did not specify a charset.");
+ ourLog.debug("Response did not specify a charset, defaulting to utf-8");
}
charset = Charset.forName("UTF-8");
}
- Reader reader = new InputStreamReader(readEntity(), charset);
- return reader;
+ return new InputStreamReader(readEntity(), charset);
}
@Override
public Map> getAllHeaders() {
- Map> headers = new HashMap>();
+ Map> headers = new HashMap<>();
if (myResponse.getAllHeaders() != null) {
for (Header next : myResponse.getAllHeaders()) {
String name = next.getName().toLowerCase();
List list = headers.get(name);
if (list == null) {
- list = new ArrayList();
+ list = new ArrayList<>();
headers.put(name, list);
}
list.add(next.getValue());
@@ -131,7 +130,7 @@ public class ApacheHttpResponse implements IHttpResponse {
if (headers == null) {
headers = new Header[0];
}
- List retVal = new ArrayList();
+ List retVal = new ArrayList<>();
for (Header next : headers) {
retVal.add(next.getValue());
}
diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java
index 4aa1e2770df..ceafc691847 100644
--- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java
+++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/BaseClient.java
@@ -34,6 +34,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
+import ca.uhn.fhir.util.XmlDetectionUtil;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
@@ -109,7 +111,7 @@ public abstract class BaseClient implements IRestfulClient {
setKeepResponses(true);
}
- if (XmlUtil.isStaxPresent() == false) {
+ if (XmlDetectionUtil.isStaxPresent() == false) {
myEncoding = EncodingEnum.JSON;
}
@@ -135,7 +137,7 @@ public abstract class BaseClient implements IRestfulClient {
public T fetchResourceFromUrl(Class theResourceType, String theUrl) {
BaseHttpClientInvocation clientInvocation = new HttpGetClientInvocation(getFhirContext(), theUrl);
ResourceResponseHandler binding = new ResourceResponseHandler(theResourceType);
- return invokeClient(getFhirContext(), binding, clientInvocation, null, false, false, null, null);
+ return invokeClient(getFhirContext(), binding, clientInvocation, null, false, false, null, null, null);
}
void forceConformanceCheck() {
@@ -198,11 +200,11 @@ public abstract class BaseClient implements IRestfulClient {
}
T invokeClient(FhirContext theContext, IClientResponseHandler binding, BaseHttpClientInvocation clientInvocation, boolean theLogRequestAndResponse) {
- return invokeClient(theContext, binding, clientInvocation, null, null, theLogRequestAndResponse, null, null);
+ return invokeClient(theContext, binding, clientInvocation, null, null, theLogRequestAndResponse, null, null, null);
}
T invokeClient(FhirContext theContext, IClientResponseHandler binding, BaseHttpClientInvocation clientInvocation, EncodingEnum theEncoding, Boolean thePrettyPrint,
- boolean theLogRequestAndResponse, SummaryEnum theSummaryMode, Set theSubsetElements) {
+ boolean theLogRequestAndResponse, SummaryEnum theSummaryMode, Set theSubsetElements, CacheControlDirective theCacheControlDirective) {
if (!myDontValidateConformance) {
myFactory.validateServerBaseIfConfiguredToDoSo(myUrlBase, myClient, this);
@@ -244,6 +246,18 @@ public abstract class BaseClient implements IRestfulClient {
httpRequest = clientInvocation.asHttpRequest(myUrlBase, params, encoding, thePrettyPrint);
+ if (theCacheControlDirective != null) {
+ StringBuilder b = new StringBuilder();
+ addToCacheControlHeader(b, Constants.CACHE_CONTROL_NO_CACHE, theCacheControlDirective.isNoCache());
+ addToCacheControlHeader(b, Constants.CACHE_CONTROL_NO_STORE, theCacheControlDirective.isNoStore());
+ if (theCacheControlDirective.getMaxResults() != null) {
+ addToCacheControlHeader(b, Constants.CACHE_CONTROL_MAX_RESULTS+"="+ Integer.toString(theCacheControlDirective.getMaxResults().intValue()), true);
+ }
+ if (b.length() > 0) {
+ httpRequest.addHeader(Constants.HEADER_CACHE_CONTROL, b.toString());
+ }
+ }
+
if (theLogRequestAndResponse) {
ourLog.info("Client invoking: {}", httpRequest);
String body = httpRequest.getRequestBodyFromStream();
@@ -366,6 +380,15 @@ public abstract class BaseClient implements IRestfulClient {
}
}
+ private void addToCacheControlHeader(StringBuilder theBuilder, String theDirective, boolean theActive) {
+ if (theActive) {
+ if (theBuilder.length() > 0) {
+ theBuilder.append(", ");
+ }
+ theBuilder.append(theDirective);
+ }
+ }
+
/**
* For now, this is a part of the internal API of HAPI - Use with caution as this method may change!
*/
diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java
index c82d329a18e..60687a5f7b9 100644
--- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java
+++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java
@@ -120,10 +120,10 @@ public class GenericClient extends BaseClient implements IGenericClient {
ResourceResponseHandler binding = new ResourceResponseHandler(theType, (Class extends IBaseResource>) null, id, allowHtmlResponse);
if (theNotModifiedHandler == null) {
- return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements);
+ return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements, null);
}
try {
- return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements);
+ return invokeClient(myContext, binding, invocation, theEncoding, thePrettyPrint, myLogRequestAndResponse, theSummary, theSubsetElements, null);
} catch (NotModifiedException e) {
return theNotModifiedHandler.call();
}
@@ -373,6 +373,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
private boolean myQueryLogRequestAndResponse;
private HashSet mySubsetElements;
protected SummaryEnum mySummaryMode;
+ protected CacheControlDirective myCacheControlDirective;
@Deprecated // override deprecated method
@SuppressWarnings("unchecked")
@@ -382,6 +383,12 @@ public class GenericClient extends BaseClient implements IGenericClient {
return (T) this;
}
+ @Override
+ public T cacheControl(CacheControlDirective theCacheControlDirective) {
+ myCacheControlDirective = theCacheControlDirective;
+ return (T) this;
+ }
+
@SuppressWarnings("unchecked")
@Override
public T elementsSubset(String... theElements) {
@@ -434,19 +441,11 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
protected Z invoke(Map> theParams, IClientResponseHandler theHandler, BaseHttpClientInvocation theInvocation) {
- // if (myParamEncoding != null) {
- // theParams.put(Constants.PARAM_FORMAT, Collections.singletonList(myParamEncoding.getFormatContentType()));
- // }
- //
- // if (myPrettyPrint != null) {
- // theParams.put(Constants.PARAM_PRETTY, Collections.singletonList(myPrettyPrint.toString()));
- // }
-
if (isKeepResponses()) {
myLastRequest = theInvocation.asHttpRequest(getServerBase(), theParams, getEncoding(), myPrettyPrint);
}
- Z resp = invokeClient(myContext, theHandler, theInvocation, myParamEncoding, myPrettyPrint, myQueryLogRequestAndResponse || myLogRequestAndResponse, mySummaryMode, mySubsetElements);
+ Z resp = invokeClient(myContext, theHandler, theInvocation, myParamEncoding, myPrettyPrint, myQueryLogRequestAndResponse || myLogRequestAndResponse, mySummaryMode, mySubsetElements, myCacheControlDirective);
return resp;
}
diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java
index 3c0daa061b7..59f0054154e 100644
--- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java
+++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/RestfulClientFactory.java
@@ -330,6 +330,8 @@ public abstract class RestfulClientFactory implements IRestfulClientFactory {
serverFhirVersionEnum = FhirVersionEnum.DSTU2_1;
} else if (serverFhirVersionString.equals(FhirVersionEnum.DSTU3.getFhirVersionString())) {
serverFhirVersionEnum = FhirVersionEnum.DSTU3;
+ } else if (serverFhirVersionString.equals(FhirVersionEnum.R4.getFhirVersionString())) {
+ serverFhirVersionEnum = FhirVersionEnum.R4;
} else {
// we'll be lenient and accept this
ourLog.debug("Server conformance statement indicates unknown FHIR version: {}", serverFhirVersionString);
diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java
index 742c9aac7a7..c44c1878063 100644
--- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java
+++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_10_40.java
@@ -87,6 +87,1973 @@ public class VersionConvertor_10_40 {
this.advisor = advisor;
}
+ public void copyElement(org.hl7.fhir.instance.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException {
+ tgt.setId(src.getId());
+ for (org.hl7.fhir.instance.model.Extension e : src.getExtension()) {
+ tgt.addExtension(convertExtension(e));
+ }
+ }
+
+ public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException {
+ tgt.setId(src.getId());
+ for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) {
+ tgt.addExtension(convertExtension(e));
+ }
+ }
+
+ public void copyElement(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException {
+ tgt.setId(src.getId());
+ for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) {
+ tgt.addExtension(convertExtension(e));
+ }
+ }
+
+ public void copyBackboneElement(org.hl7.fhir.instance.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException {
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.Extension e : src.getModifierExtension()) {
+ tgt.addModifierExtension(convertExtension(e));
+ }
+ }
+
+ public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.instance.model.BackboneElement tgt) throws FHIRException {
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) {
+ tgt.addModifierExtension(convertExtension(e));
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.instance.model.Base64BinaryType src) throws FHIRException {
+ org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException {
+ org.hl7.fhir.instance.model.Base64BinaryType tgt = new org.hl7.fhir.instance.model.Base64BinaryType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.instance.model.BooleanType src) throws FHIRException {
+ org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException {
+ org.hl7.fhir.instance.model.BooleanType tgt = new org.hl7.fhir.instance.model.BooleanType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.instance.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.UriType convertCodeToUri(org.hl7.fhir.instance.model.CodeType src) throws FHIRException {
+ org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.CodeType convertUriToCode(org.hl7.fhir.r4.model.UriType src) throws FHIRException {
+ org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException {
+ org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException {
+ org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException {
+ org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException {
+ org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException {
+ org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException {
+ org.hl7.fhir.instance.model.DateTimeType tgt = new org.hl7.fhir.instance.model.DateTimeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.instance.model.DecimalType src) throws FHIRException {
+ org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException {
+ org.hl7.fhir.instance.model.DecimalType tgt = new org.hl7.fhir.instance.model.DecimalType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException {
+ org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException {
+ org.hl7.fhir.instance.model.IdType tgt = new org.hl7.fhir.instance.model.IdType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.instance.model.InstantType src) throws FHIRException {
+ org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException {
+ org.hl7.fhir.instance.model.InstantType tgt = new org.hl7.fhir.instance.model.InstantType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.instance.model.IntegerType src) throws FHIRException {
+ org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException {
+ org.hl7.fhir.instance.model.IntegerType tgt = new org.hl7.fhir.instance.model.IntegerType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.instance.model.MarkdownType src) throws FHIRException {
+ org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException {
+ org.hl7.fhir.instance.model.MarkdownType tgt = new org.hl7.fhir.instance.model.MarkdownType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.instance.model.OidType src) throws FHIRException {
+ org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException {
+ org.hl7.fhir.instance.model.OidType tgt = new org.hl7.fhir.instance.model.OidType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.instance.model.PositiveIntType src) throws FHIRException {
+ org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException {
+ org.hl7.fhir.instance.model.PositiveIntType tgt = new org.hl7.fhir.instance.model.PositiveIntType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.instance.model.StringType src) throws FHIRException {
+ org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException {
+ org.hl7.fhir.instance.model.StringType tgt = new org.hl7.fhir.instance.model.StringType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.instance.model.TimeType src) throws FHIRException {
+ org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException {
+ org.hl7.fhir.instance.model.TimeType tgt = new org.hl7.fhir.instance.model.TimeType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.instance.model.UnsignedIntType src) throws FHIRException {
+ org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException {
+ org.hl7.fhir.instance.model.UnsignedIntType tgt = new org.hl7.fhir.instance.model.UnsignedIntType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.instance.model.UriType src) throws FHIRException {
+ org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException {
+ org.hl7.fhir.instance.model.UriType tgt = new org.hl7.fhir.instance.model.UriType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.instance.model.UuidType src) throws FHIRException {
+ org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException {
+ org.hl7.fhir.instance.model.UuidType tgt = new org.hl7.fhir.instance.model.UuidType(src.getValue());
+ copyElement(src, tgt);
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.instance.model.Extension src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension();
+ copyElement(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setValue(convertType(src.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension();
+ copyElement(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setValue(convertType(src.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative();
+ copyElement(src, tgt);
+ tgt.setStatus(convertNarrativeStatus(src.getStatus()));
+ tgt.setDiv(src.getDiv());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative();
+ copyElement(src, tgt);
+ tgt.setStatus(convertNarrativeStatus(src.getStatus()));
+ tgt.setDiv(src.getDiv());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.instance.model.Narrative.NarrativeStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED;
+ case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS;
+ case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL;
+ case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY;
+ default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case GENERATED: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.GENERATED;
+ case EXTENSIONS: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EXTENSIONS;
+ case ADDITIONAL: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.ADDITIONAL;
+ case EMPTY: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EMPTY;
+ default: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.instance.model.Annotation src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation();
+ copyElement(src, tgt);
+ tgt.setAuthor(convertType(src.getAuthor()));
+ tgt.setTime(src.getTime());
+ tgt.setText(src.getText());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Annotation tgt = new org.hl7.fhir.instance.model.Annotation();
+ copyElement(src, tgt);
+ tgt.setAuthor(convertType(src.getAuthor()));
+ tgt.setTime(src.getTime());
+ tgt.setText(src.getText());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.instance.model.Attachment src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment();
+ copyElement(src, tgt);
+ tgt.setContentType(src.getContentType());
+ tgt.setLanguage(src.getLanguage());
+ tgt.setData(src.getData());
+ tgt.setUrl(src.getUrl());
+ tgt.setSize(src.getSize());
+ tgt.setHash(src.getHash());
+ tgt.setTitle(src.getTitle());
+ tgt.setCreation(src.getCreation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Attachment tgt = new org.hl7.fhir.instance.model.Attachment();
+ copyElement(src, tgt);
+ tgt.setContentType(src.getContentType());
+ tgt.setLanguage(src.getLanguage());
+ tgt.setData(src.getData());
+ tgt.setUrl(src.getUrl());
+ tgt.setSize(src.getSize());
+ tgt.setHash(src.getHash());
+ tgt.setTitle(src.getTitle());
+ tgt.setCreation(src.getCreation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.instance.model.CodeableConcept src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.Coding t : src.getCoding())
+ tgt.addCoding(convertCoding(t));
+ tgt.setText(src.getText());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.Coding t : src.getCoding())
+ tgt.addCoding(convertCoding(t));
+ tgt.setText(src.getText());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getSystem());
+ tgt.setVersion(src.getVersion());
+ tgt.setCode(src.getCode());
+ tgt.setDisplay(src.getDisplay());
+ tgt.setUserSelected(src.getUserSelected());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Coding tgt = new org.hl7.fhir.instance.model.Coding();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getSystem());
+ tgt.setVersion(src.getVersion());
+ tgt.setCode(src.getCode());
+ tgt.setDisplay(src.getDisplay());
+ tgt.setUserSelected(src.getUserSelected());
+ return tgt;
+ }
+
+
+
+ public org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier();
+ copyElement(src, tgt);
+ tgt.setUse(convertIdentifierUse(src.getUse()));
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setSystem(src.getSystem());
+ tgt.setValue(src.getValue());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ tgt.setAssigner(convertReference(src.getAssigner()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Identifier tgt = new org.hl7.fhir.instance.model.Identifier();
+ copyElement(src, tgt);
+ if (src.hasUse())
+ tgt.setUse(convertIdentifierUse(src.getUse()));
+ if (src.hasType())
+ tgt.setType(convertCodeableConcept(src.getType()));
+ if (src.hasSystem())
+ tgt.setSystem(src.getSystem());
+ if (src.hasValue())
+ tgt.setValue(src.getValue());
+ if (src.hasPeriod())
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ if (src.hasAssigner())
+ tgt.setAssigner(convertReference(src.getAssigner()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.instance.model.Identifier.IdentifierUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL;
+ case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL;
+ case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP;
+ case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY;
+ default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case USUAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.USUAL;
+ case OFFICIAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.OFFICIAL;
+ case TEMP: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.TEMP;
+ case SECONDARY: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.SECONDARY;
+ default: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.instance.model.Period src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period();
+ copyElement(src, tgt);
+ tgt.setStart(src.getStart());
+ tgt.setEnd(src.getEnd());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Period tgt = new org.hl7.fhir.instance.model.Period();
+ copyElement(src, tgt);
+ tgt.setStart(src.getStart());
+ tgt.setEnd(src.getEnd());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.instance.model.Quantity src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Quantity tgt = new org.hl7.fhir.instance.model.Quantity();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.instance.model.Quantity.QuantityComparator src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN;
+ case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL;
+ case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL;
+ case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN;
+ default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case LESS_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_THAN;
+ case LESS_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_OR_EQUAL;
+ case GREATER_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_OR_EQUAL;
+ case GREATER_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_THAN;
+ default: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.instance.model.Range src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range();
+ copyElement(src, tgt);
+ tgt.setLow(convertSimpleQuantity(src.getLow()));
+ tgt.setHigh(convertSimpleQuantity(src.getHigh()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Range tgt = new org.hl7.fhir.instance.model.Range();
+ copyElement(src, tgt);
+ tgt.setLow(convertSimpleQuantity(src.getLow()));
+ tgt.setHigh(convertSimpleQuantity(src.getHigh()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.instance.model.Ratio src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio();
+ copyElement(src, tgt);
+ tgt.setNumerator(convertQuantity(src.getNumerator()));
+ tgt.setDenominator(convertQuantity(src.getDenominator()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Ratio tgt = new org.hl7.fhir.instance.model.Ratio();
+ copyElement(src, tgt);
+ tgt.setNumerator(convertQuantity(src.getNumerator()));
+ tgt.setDenominator(convertQuantity(src.getDenominator()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference();
+ copyElement(src, tgt);
+ tgt.setReference(src.getReference());
+ tgt.setDisplay(src.getDisplay());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference();
+ copyElement(src, tgt);
+ tgt.setReference(src.getReference());
+ tgt.setDisplay(src.getDisplay());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.instance.model.SampledData src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData();
+ copyElement(src, tgt);
+ tgt.setOrigin(convertSimpleQuantity(src.getOrigin()));
+ tgt.setPeriod(src.getPeriod());
+ tgt.setFactor(src.getFactor());
+ tgt.setLowerLimit(src.getLowerLimit());
+ tgt.setUpperLimit(src.getUpperLimit());
+ tgt.setDimensions(src.getDimensions());
+ tgt.setData(src.getData());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.SampledData tgt = new org.hl7.fhir.instance.model.SampledData();
+ copyElement(src, tgt);
+ tgt.setOrigin(convertSimpleQuantity(src.getOrigin()));
+ tgt.setPeriod(src.getPeriod());
+ tgt.setFactor(src.getFactor());
+ tgt.setLowerLimit(src.getLowerLimit());
+ tgt.setUpperLimit(src.getUpperLimit());
+ tgt.setDimensions(src.getDimensions());
+ tgt.setData(src.getData());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.instance.model.Signature src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.Coding t : src.getType())
+ tgt.addType(convertCoding(t));
+ tgt.setWhen(src.getWhen());
+ tgt.setWho(convertType(src.getWho()));
+ tgt.setContentType(src.getContentType());
+ tgt.setBlob(src.getBlob());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Signature tgt = new org.hl7.fhir.instance.model.Signature();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.Coding t : src.getType())
+ tgt.addType(convertCoding(t));
+ tgt.setWhen(src.getWhen());
+ tgt.setWho(convertType(src.getWho()));
+ tgt.setContentType(src.getContentType());
+ tgt.setBlob(src.getBlob());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.instance.model.Address src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address();
+ copyElement(src, tgt);
+ tgt.setUse(convertAddressUse(src.getUse()));
+ tgt.setType(convertAddressType(src.getType()));
+ tgt.setText(src.getText());
+ for (org.hl7.fhir.instance.model.StringType t : src.getLine())
+ tgt.addLine(t.getValue());
+ tgt.setCity(src.getCity());
+ tgt.setDistrict(src.getDistrict());
+ tgt.setState(src.getState());
+ tgt.setPostalCode(src.getPostalCode());
+ tgt.setCountry(src.getCountry());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Address tgt = new org.hl7.fhir.instance.model.Address();
+ copyElement(src, tgt);
+ tgt.setUse(convertAddressUse(src.getUse()));
+ tgt.setType(convertAddressType(src.getType()));
+ tgt.setText(src.getText());
+ for (org.hl7.fhir.r4.model.StringType t : src.getLine())
+ tgt.addLine(t.getValue());
+ tgt.setCity(src.getCity());
+ tgt.setDistrict(src.getDistrict());
+ tgt.setState(src.getState());
+ tgt.setPostalCode(src.getPostalCode());
+ tgt.setCountry(src.getCountry());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.instance.model.Address.AddressUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME;
+ case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK;
+ case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP;
+ case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD;
+ default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HOME: return org.hl7.fhir.instance.model.Address.AddressUse.HOME;
+ case WORK: return org.hl7.fhir.instance.model.Address.AddressUse.WORK;
+ case TEMP: return org.hl7.fhir.instance.model.Address.AddressUse.TEMP;
+ case OLD: return org.hl7.fhir.instance.model.Address.AddressUse.OLD;
+ default: return org.hl7.fhir.instance.model.Address.AddressUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.instance.model.Address.AddressType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL;
+ case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL;
+ case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH;
+ default: return org.hl7.fhir.r4.model.Address.AddressType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case POSTAL: return org.hl7.fhir.instance.model.Address.AddressType.POSTAL;
+ case PHYSICAL: return org.hl7.fhir.instance.model.Address.AddressType.PHYSICAL;
+ case BOTH: return org.hl7.fhir.instance.model.Address.AddressType.BOTH;
+ default: return org.hl7.fhir.instance.model.Address.AddressType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint();
+ copyElement(src, tgt);
+ tgt.setSystem(convertContactPointSystem(src.getSystem()));
+ tgt.setValue(src.getValue());
+ tgt.setUse(convertContactPointUse(src.getUse()));
+ if (src.hasRank())
+ tgt.setRank(src.getRank());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ContactPoint tgt = new org.hl7.fhir.instance.model.ContactPoint();
+ copyElement(src, tgt);
+ if (src.hasSystem())
+ tgt.setSystem(convertContactPointSystem(src.getSystem()));
+ tgt.setValue(src.getValue());
+ tgt.setUse(convertContactPointUse(src.getUse()));
+ tgt.setRank(src.getRank());
+ if (src.hasPeriod())
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE;
+ case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX;
+ case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL;
+ case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER;
+ case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER;
+ default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PHONE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PHONE;
+ case FAX: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.FAX;
+ case EMAIL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.EMAIL;
+ case PAGER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PAGER;
+ case OTHER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER;
+ case URL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER;
+ default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.instance.model.ContactPoint.ContactPointUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME;
+ case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK;
+ case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP;
+ case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD;
+ case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE;
+ default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HOME: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.HOME;
+ case WORK: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.WORK;
+ case TEMP: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.TEMP;
+ case OLD: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.OLD;
+ case MOBILE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.MOBILE;
+ default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.instance.model.ElementDefinition src, List slicePaths, List context, int pos) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition();
+ copyElement(src, tgt);
+ tgt.setPath(src.getPath());
+ for (org.hl7.fhir.instance.model.Enumeration t : src.getRepresentation())
+ tgt.addRepresentation(convertPropertyRepresentation(t.getValue()));
+ if (src.hasName()) {
+ if (slicePaths.contains(src.getPath()))
+ tgt.setSliceName(src.getName());
+ tgt.setId(src.getName());
+ }
+ if (src.hasLabel())
+ tgt.setLabel(src.getLabel());
+ for (org.hl7.fhir.instance.model.Coding t : src.getCode())
+ tgt.addCode(convertCoding(t));
+ if (src.hasSlicing())
+ tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing(), context, pos));
+ if (src.hasShort())
+ tgt.setShort(src.getShort());
+ if (src.hasDefinition())
+ tgt.setDefinition(src.getDefinition());
+ if (src.hasComments())
+ tgt.setComment(src.getComments());
+ if (src.hasRequirements())
+ tgt.setRequirements(src.getRequirements());
+ for (org.hl7.fhir.instance.model.StringType t : src.getAlias())
+ tgt.addAlias(t.getValue());
+ if (src.hasMin())
+ tgt.setMin(src.getMin());
+ if (src.hasMax())
+ tgt.setMax(src.getMax());
+ if (src.hasBase())
+ tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
+ if (src.hasNameReference())
+ tgt.setContentReference("#"+src.getNameReference());
+ for (org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent t : src.getType())
+ tgt.addType(convertElementDefinitionTypeComponent(t));
+ if (src.hasDefaultValue())
+ tgt.setDefaultValue(convertType(src.getDefaultValue()));
+ if (src.hasMeaningWhenMissing())
+ tgt.setMeaningWhenMissing(src.getMeaningWhenMissing());
+ if (src.hasFixed())
+ tgt.setFixed(convertType(src.getFixed()));
+ if (src.hasPattern())
+ tgt.setPattern(convertType(src.getPattern()));
+ if (src.hasExample())
+ tgt.addExample().setLabel("General").setValue(convertType(src.getExample()));
+ if (src.hasMinValue())
+ tgt.setMinValue(convertType(src.getMinValue()));
+ if (src.hasMaxValue())
+ tgt.setMaxValue(convertType(src.getMaxValue()));
+ if (src.hasMaxLength())
+ tgt.setMaxLength(src.getMaxLength());
+ for (org.hl7.fhir.instance.model.IdType t : src.getCondition())
+ tgt.addCondition(t.getValue());
+ for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint())
+ tgt.addConstraint(convertElementDefinitionConstraintComponent(t));
+ if (src.hasMustSupport())
+ tgt.setMustSupport(src.getMustSupport());
+ if (src.hasIsModifier())
+ tgt.setIsModifier(src.getIsModifier());
+ if (src.hasIsSummary())
+ tgt.setIsSummary(src.getIsSummary());
+ if (src.hasBinding())
+ tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
+ for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
+ tgt.addMapping(convertElementDefinitionMappingComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition tgt = new org.hl7.fhir.instance.model.ElementDefinition();
+ copyElement(src, tgt);
+ tgt.setPath(src.getPath());
+ for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation())
+ tgt.addRepresentation(convertPropertyRepresentation(t.getValue()));
+ if (src.hasSliceName())
+ tgt.setName(src.getSliceName());
+ else
+ tgt.setName(src.getId());
+ tgt.setLabel(src.getLabel());
+ for (org.hl7.fhir.r4.model.Coding t : src.getCode())
+ tgt.addCode(convertCoding(t));
+ if (src.hasSlicing())
+ tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing()));
+ tgt.setShort(src.getShort());
+ tgt.setDefinition(src.getDefinition());
+ tgt.setComments(src.getComment());
+ tgt.setRequirements(src.getRequirements());
+ for (org.hl7.fhir.r4.model.StringType t : src.getAlias())
+ tgt.addAlias(t.getValue());
+ tgt.setMin(src.getMin());
+ tgt.setMax(src.getMax());
+ if (src.hasBase())
+ tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
+ if (src.hasContentReference())
+ tgt.setNameReference(src.getContentReference().substring(1));
+ for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType())
+ tgt.addType(convertElementDefinitionTypeComponent(t));
+ tgt.setDefaultValue(convertType(src.getDefaultValue()));
+ tgt.setMeaningWhenMissing(src.getMeaningWhenMissing());
+ tgt.setFixed(convertType(src.getFixed()));
+ tgt.setPattern(convertType(src.getPattern()));
+ if (src.hasExample())
+ tgt.setExample(convertType(src.getExampleFirstRep().getValue()));
+ tgt.setMinValue(convertType(src.getMinValue()));
+ tgt.setMaxValue(convertType(src.getMaxValue()));
+ tgt.setMaxLength(src.getMaxLength());
+ for (org.hl7.fhir.r4.model.IdType t : src.getCondition())
+ tgt.addCondition(t.getValue());
+ for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint())
+ tgt.addConstraint(convertElementDefinitionConstraintComponent(t));
+ tgt.setMustSupport(src.getMustSupport());
+ tgt.setIsModifier(src.getIsModifier());
+ tgt.setIsSummary(src.getIsSummary());
+ if (src.hasBinding())
+ tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
+ for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
+ tgt.addMapping(convertElementDefinitionMappingComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR;
+ default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case XMLATTR: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.XMLATTR;
+ default: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent src, List context, int pos) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent();
+ copyElement(src, tgt);
+ org.hl7.fhir.instance.model.ElementDefinition slicingElement = context.get(pos);
+ for (org.hl7.fhir.instance.model.StringType t : src.getDiscriminator()) {
+ boolean isExists = false;
+ if (!t.asStringValue().contains("@")) {
+ int slices = 0;
+ boolean existsSlicePresent = false;
+ boolean notExistsSlicePresent = false;
+ String existsPath = slicingElement.getPath() + "." + t.asStringValue();
+ for (int i = pos + 1; i < context.size(); i++) {
+ org.hl7.fhir.instance.model.ElementDefinition e = context.get(i);
+ if (e.getPath().equals(slicingElement.getPath()))
+ slices++;
+ else if (!e.getPath().startsWith(slicingElement.getPath() + "."))
+ break;
+ else if (e.getPath().equals(existsPath)) {
+ if (e.hasMin() && e.getMin() > 0)
+ existsSlicePresent = true;
+ else if (e.hasMax() && e.getMax().equals("0"))
+ notExistsSlicePresent = true;
+ }
+ }
+ isExists = slices==2 && existsSlicePresent && notExistsSlicePresent;
+ }
+ tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), isExists));
+ }
+ tgt.setDescription(src.getDescription());
+ tgt.setOrdered(src.getOrdered());
+ tgt.setRules(convertSlicingRules(src.getRules()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent();
+ copyElement(src, tgt);
+ for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator())
+ tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t));
+ tgt.setDescription(src.getDescription());
+ tgt.setOrdered(src.getOrdered());
+ tgt.setRules(convertSlicingRules(src.getRules()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.instance.model.ElementDefinition.SlicingRules src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED;
+ case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN;
+ case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND;
+ default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CLOSED: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.CLOSED;
+ case OPEN: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPEN;
+ case OPENATEND: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPENATEND;
+ default: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent();
+ copyElement(src, tgt);
+ tgt.setPath(src.getPath());
+ tgt.setMin(src.getMin());
+ tgt.setMax(src.getMax());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent();
+ copyElement(src, tgt);
+ tgt.setPath(src.getPath());
+ tgt.setMin(src.getMin());
+ tgt.setMax(src.getMax());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent();
+ copyElement(src, tgt);
+ tgt.setCodeElement(convertCodeToUri(src.getCodeElement()));
+ for (org.hl7.fhir.instance.model.UriType t : src.getProfile())
+ if (src.hasCode() && "Reference".equals(src.getCode()))
+ tgt.setTargetProfile(t.getValueAsString());
+ else
+ tgt.setProfile(t.getValue());
+ for (org.hl7.fhir.instance.model.Enumeration t : src.getAggregation())
+ tgt.addAggregation(convertAggregationMode(t.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent();
+ copyElement(src, tgt);
+ tgt.setCodeElement(convertUriToCode(src.getCodeElement()));
+ if (src.hasCode() && "Reference".equals(src.getCode())) {
+ if (src.hasTargetProfile())
+ tgt.addProfile(src.getTargetProfile());
+ } else if (src.hasProfile())
+ tgt.addProfile(src.getProfile());
+ for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation())
+ tgt.addAggregation(convertAggregationMode(t.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.instance.model.ElementDefinition.AggregationMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED;
+ case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED;
+ case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED;
+ default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CONTAINED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.CONTAINED;
+ case REFERENCED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.REFERENCED;
+ case BUNDLED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.BUNDLED;
+ default: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent();
+ copyElement(src, tgt);
+ tgt.setKey(src.getKey());
+ tgt.setRequirements(src.getRequirements());
+ tgt.setSeverity(convertConstraintSeverity(src.getSeverity()));
+ tgt.setHuman(src.getHuman());
+ tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION));
+ tgt.setXpath(src.getXpath());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent();
+ copyElement(src, tgt);
+ tgt.setKey(src.getKey());
+ tgt.setRequirements(src.getRequirements());
+ tgt.setSeverity(convertConstraintSeverity(src.getSeverity()));
+ tgt.setHuman(src.getHuman());
+ if (src.hasExpression())
+ ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
+ tgt.setXpath(src.getXpath());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR;
+ case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING;
+ default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ERROR: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.ERROR;
+ case WARNING: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.WARNING;
+ default: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent();
+ copyElement(src, tgt);
+ tgt.setStrength(convertBindingStrength(src.getStrength()));
+ tgt.setDescription(src.getDescription());
+ tgt.setValueSet(convertType(src.getValueSet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent();
+ copyElement(src, tgt);
+ tgt.setStrength(convertBindingStrength(src.getStrength()));
+ tgt.setDescription(src.getDescription());
+ tgt.setValueSet(convertType(src.getValueSet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.instance.model.Enumerations.BindingStrength src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED;
+ case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE;
+ case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED;
+ case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE;
+ default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUIRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.REQUIRED;
+ case EXTENSIBLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXTENSIBLE;
+ case PREFERRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.PREFERRED;
+ case EXAMPLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXAMPLE;
+ default: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent();
+ copyElement(src, tgt);
+ tgt.setIdentity(src.getIdentity());
+ tgt.setLanguage(src.getLanguage());
+ tgt.setMap(src.getMap());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent();
+ copyElement(src, tgt);
+ tgt.setIdentity(src.getIdentity());
+ tgt.setLanguage(src.getLanguage());
+ tgt.setMap(src.getMap());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName();
+ copyElement(src, tgt);
+ tgt.setUse(convertNameUse(src.getUse()));
+ tgt.setText(src.getText());
+ for (org.hl7.fhir.instance.model.StringType t : src.getFamily())
+ tgt.setFamily(t.getValue());
+ for (org.hl7.fhir.instance.model.StringType t : src.getGiven())
+ tgt.addGiven(t.getValue());
+ for (org.hl7.fhir.instance.model.StringType t : src.getPrefix())
+ tgt.addPrefix(t.getValue());
+ for (org.hl7.fhir.instance.model.StringType t : src.getSuffix())
+ tgt.addSuffix(t.getValue());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName();
+ copyElement(src, tgt);
+ tgt.setUse(convertNameUse(src.getUse()));
+ tgt.setText(src.getText());
+ if (src.hasFamily())
+ tgt.addFamily(src.getFamily());
+ for (org.hl7.fhir.r4.model.StringType t : src.getGiven())
+ tgt.addGiven(t.getValue());
+ for (org.hl7.fhir.r4.model.StringType t : src.getPrefix())
+ tgt.addPrefix(t.getValue());
+ for (org.hl7.fhir.r4.model.StringType t : src.getSuffix())
+ tgt.addSuffix(t.getValue());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.instance.model.HumanName.NameUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL;
+ case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL;
+ case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP;
+ case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME;
+ case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS;
+ case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD;
+ case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN;
+ default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case USUAL: return org.hl7.fhir.instance.model.HumanName.NameUse.USUAL;
+ case OFFICIAL: return org.hl7.fhir.instance.model.HumanName.NameUse.OFFICIAL;
+ case TEMP: return org.hl7.fhir.instance.model.HumanName.NameUse.TEMP;
+ case NICKNAME: return org.hl7.fhir.instance.model.HumanName.NameUse.NICKNAME;
+ case ANONYMOUS: return org.hl7.fhir.instance.model.HumanName.NameUse.ANONYMOUS;
+ case OLD: return org.hl7.fhir.instance.model.HumanName.NameUse.OLD;
+ case MAIDEN: return org.hl7.fhir.instance.model.HumanName.NameUse.MAIDEN;
+ default: return org.hl7.fhir.instance.model.HumanName.NameUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta();
+ copyElement(src, tgt);
+ tgt.setVersionId(src.getVersionId());
+ tgt.setLastUpdated(src.getLastUpdated());
+ for (org.hl7.fhir.instance.model.UriType t : src.getProfile())
+ tgt.addProfile(t.getValue());
+ for (org.hl7.fhir.instance.model.Coding t : src.getSecurity())
+ tgt.addSecurity(convertCoding(t));
+ for (org.hl7.fhir.instance.model.Coding t : src.getTag())
+ tgt.addTag(convertCoding(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Meta tgt = new org.hl7.fhir.instance.model.Meta();
+ copyElement(src, tgt);
+ tgt.setVersionId(src.getVersionId());
+ tgt.setLastUpdated(src.getLastUpdated());
+ for (org.hl7.fhir.r4.model.UriType t : src.getProfile())
+ tgt.addProfile(t.getValue());
+ for (org.hl7.fhir.r4.model.Coding t : src.getSecurity())
+ tgt.addSecurity(convertCoding(t));
+ for (org.hl7.fhir.r4.model.Coding t : src.getTag())
+ tgt.addTag(convertCoding(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.instance.model.Timing src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.DateTimeType t : src.getEvent())
+ tgt.addEvent(t.getValue());
+ tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat()));
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Timing tgt = new org.hl7.fhir.instance.model.Timing();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent())
+ tgt.addEvent(t.getValue());
+ tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat()));
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.instance.model.Timing.TimingRepeatComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent();
+ copyElement(src, tgt);
+ tgt.setBounds(convertType(src.getBounds()));
+ tgt.setCount(src.getCount());
+ tgt.setDuration(src.getDuration());
+ tgt.setDurationMax(src.getDurationMax());
+ tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits()));
+ tgt.setFrequency(src.getFrequency());
+ tgt.setFrequencyMax(src.getFrequencyMax());
+ tgt.setPeriod(src.getPeriod());
+ tgt.setPeriodMax(src.getPeriodMax());
+ tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits()));
+ tgt.addWhen(convertEventTiming(src.getWhen()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.instance.model.Timing.TimingRepeatComponent();
+ copyElement(src, tgt);
+ tgt.setBounds(convertType(src.getBounds()));
+ tgt.setCount(src.getCount());
+ tgt.setDuration(src.getDuration());
+ tgt.setDurationMax(src.getDurationMax());
+ tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit()));
+ tgt.setFrequency(src.getFrequency());
+ tgt.setFrequencyMax(src.getFrequencyMax());
+ tgt.setPeriod(src.getPeriod());
+ tgt.setPeriodMax(src.getPeriodMax());
+ tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit()));
+ for (Enumeration t : src.getWhen())
+ tgt.setWhen(convertEventTiming(t.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.instance.model.Timing.UnitsOfTime src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S;
+ case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN;
+ case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H;
+ case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D;
+ case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK;
+ case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO;
+ case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A;
+ default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case S: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.S;
+ case MIN: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MIN;
+ case H: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.H;
+ case D: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.D;
+ case WK: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.WK;
+ case MO: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MO;
+ case A: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.A;
+ default: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.instance.model.Timing.EventTiming src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS;
+ case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE;
+ case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C;
+ case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM;
+ case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD;
+ case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV;
+ case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC;
+ case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM;
+ case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD;
+ case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV;
+ case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC;
+ case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM;
+ case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD;
+ case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV;
+ default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HS: return org.hl7.fhir.instance.model.Timing.EventTiming.HS;
+ case WAKE: return org.hl7.fhir.instance.model.Timing.EventTiming.WAKE;
+ case C: return org.hl7.fhir.instance.model.Timing.EventTiming.C;
+ case CM: return org.hl7.fhir.instance.model.Timing.EventTiming.CM;
+ case CD: return org.hl7.fhir.instance.model.Timing.EventTiming.CD;
+ case CV: return org.hl7.fhir.instance.model.Timing.EventTiming.CV;
+ case AC: return org.hl7.fhir.instance.model.Timing.EventTiming.AC;
+ case ACM: return org.hl7.fhir.instance.model.Timing.EventTiming.ACM;
+ case ACD: return org.hl7.fhir.instance.model.Timing.EventTiming.ACD;
+ case ACV: return org.hl7.fhir.instance.model.Timing.EventTiming.ACV;
+ case PC: return org.hl7.fhir.instance.model.Timing.EventTiming.PC;
+ case PCM: return org.hl7.fhir.instance.model.Timing.EventTiming.PCM;
+ case PCD: return org.hl7.fhir.instance.model.Timing.EventTiming.PCD;
+ case PCV: return org.hl7.fhir.instance.model.Timing.EventTiming.PCV;
+ default: return org.hl7.fhir.instance.model.Timing.EventTiming.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.instance.model.Age src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Age tgt = new org.hl7.fhir.instance.model.Age();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.instance.model.Count src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Count tgt = new org.hl7.fhir.instance.model.Count();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.instance.model.Distance src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Distance tgt = new org.hl7.fhir.instance.model.Distance();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.instance.model.Duration src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Duration tgt = new org.hl7.fhir.instance.model.Duration();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.instance.model.Money src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Money tgt = new org.hl7.fhir.instance.model.Money();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.instance.model.SimpleQuantity src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.SimpleQuantity tgt = new org.hl7.fhir.instance.model.SimpleQuantity();
+ copyElement(src, tgt);
+ tgt.setValue(src.getValue());
+ tgt.setComparator(convertQuantityComparator(src.getComparator()));
+ tgt.setUnit(src.getUnit());
+ tgt.setSystem(src.getSystem());
+ tgt.setCode(src.getCode());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.instance.model.Type src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ if (src instanceof org.hl7.fhir.instance.model.Base64BinaryType)
+ return convertBase64Binary((org.hl7.fhir.instance.model.Base64BinaryType) src);
+ if (src instanceof org.hl7.fhir.instance.model.BooleanType)
+ return convertBoolean((org.hl7.fhir.instance.model.BooleanType) src);
+ if (src instanceof org.hl7.fhir.instance.model.CodeType)
+ return convertCode((org.hl7.fhir.instance.model.CodeType) src);
+ if (src instanceof org.hl7.fhir.instance.model.DateType)
+ return convertDate((org.hl7.fhir.instance.model.DateType) src);
+ if (src instanceof org.hl7.fhir.instance.model.DateTimeType)
+ return convertDateTime((org.hl7.fhir.instance.model.DateTimeType) src);
+ if (src instanceof org.hl7.fhir.instance.model.DecimalType)
+ return convertDecimal((org.hl7.fhir.instance.model.DecimalType) src);
+ if (src instanceof org.hl7.fhir.instance.model.IdType)
+ return convertId((org.hl7.fhir.instance.model.IdType) src);
+ if (src instanceof org.hl7.fhir.instance.model.InstantType)
+ return convertInstant((org.hl7.fhir.instance.model.InstantType) src);
+ if (src instanceof org.hl7.fhir.instance.model.IntegerType)
+ return convertInteger((org.hl7.fhir.instance.model.IntegerType) src);
+ if (src instanceof org.hl7.fhir.instance.model.MarkdownType)
+ return convertMarkdown((org.hl7.fhir.instance.model.MarkdownType) src);
+ if (src instanceof org.hl7.fhir.instance.model.OidType)
+ return convertOid((org.hl7.fhir.instance.model.OidType) src);
+ if (src instanceof org.hl7.fhir.instance.model.PositiveIntType)
+ return convertPositiveInt((org.hl7.fhir.instance.model.PositiveIntType) src);
+ if (src instanceof org.hl7.fhir.instance.model.StringType)
+ return convertString((org.hl7.fhir.instance.model.StringType) src);
+ if (src instanceof org.hl7.fhir.instance.model.TimeType)
+ return convertTime((org.hl7.fhir.instance.model.TimeType) src);
+ if (src instanceof org.hl7.fhir.instance.model.UnsignedIntType)
+ return convertUnsignedInt((org.hl7.fhir.instance.model.UnsignedIntType) src);
+ if (src instanceof org.hl7.fhir.instance.model.UriType)
+ return convertUri((org.hl7.fhir.instance.model.UriType) src);
+ if (src instanceof org.hl7.fhir.instance.model.UuidType)
+ return convertUuid((org.hl7.fhir.instance.model.UuidType) src);
+ if (src instanceof org.hl7.fhir.instance.model.Extension)
+ return convertExtension((org.hl7.fhir.instance.model.Extension) src);
+ if (src instanceof org.hl7.fhir.instance.model.Narrative)
+ return convertNarrative((org.hl7.fhir.instance.model.Narrative) src);
+ if (src instanceof org.hl7.fhir.instance.model.Annotation)
+ return convertAnnotation((org.hl7.fhir.instance.model.Annotation) src);
+ if (src instanceof org.hl7.fhir.instance.model.Attachment)
+ return convertAttachment((org.hl7.fhir.instance.model.Attachment) src);
+ if (src instanceof org.hl7.fhir.instance.model.CodeableConcept)
+ return convertCodeableConcept((org.hl7.fhir.instance.model.CodeableConcept) src);
+ if (src instanceof org.hl7.fhir.instance.model.Coding)
+ return convertCoding((org.hl7.fhir.instance.model.Coding) src);
+ if (src instanceof org.hl7.fhir.instance.model.Identifier)
+ return convertIdentifier((org.hl7.fhir.instance.model.Identifier) src);
+ if (src instanceof org.hl7.fhir.instance.model.Period)
+ return convertPeriod((org.hl7.fhir.instance.model.Period) src);
+ if (src instanceof org.hl7.fhir.instance.model.Quantity)
+ return convertQuantity((org.hl7.fhir.instance.model.Quantity) src);
+ if (src instanceof org.hl7.fhir.instance.model.Range)
+ return convertRange((org.hl7.fhir.instance.model.Range) src);
+ if (src instanceof org.hl7.fhir.instance.model.Ratio)
+ return convertRatio((org.hl7.fhir.instance.model.Ratio) src);
+ if (src instanceof org.hl7.fhir.instance.model.Reference)
+ return convertReference((org.hl7.fhir.instance.model.Reference) src);
+ if (src instanceof org.hl7.fhir.instance.model.SampledData)
+ return convertSampledData((org.hl7.fhir.instance.model.SampledData) src);
+ if (src instanceof org.hl7.fhir.instance.model.Signature)
+ return convertSignature((org.hl7.fhir.instance.model.Signature) src);
+ if (src instanceof org.hl7.fhir.instance.model.Address)
+ return convertAddress((org.hl7.fhir.instance.model.Address) src);
+ if (src instanceof org.hl7.fhir.instance.model.ContactPoint)
+ return convertContactPoint((org.hl7.fhir.instance.model.ContactPoint) src);
+ if (src instanceof org.hl7.fhir.instance.model.ElementDefinition)
+ return convertElementDefinition((org.hl7.fhir.instance.model.ElementDefinition) src, new ArrayList(), new ArrayList(), 0);
+ if (src instanceof org.hl7.fhir.instance.model.HumanName)
+ return convertHumanName((org.hl7.fhir.instance.model.HumanName) src);
+ if (src instanceof org.hl7.fhir.instance.model.Meta)
+ return convertMeta((org.hl7.fhir.instance.model.Meta) src);
+ if (src instanceof org.hl7.fhir.instance.model.Timing)
+ return convertTiming((org.hl7.fhir.instance.model.Timing) src);
+ if (src instanceof org.hl7.fhir.instance.model.Age)
+ return convertAge((org.hl7.fhir.instance.model.Age) src);
+ if (src instanceof org.hl7.fhir.instance.model.Count)
+ return convertCount((org.hl7.fhir.instance.model.Count) src);
+ if (src instanceof org.hl7.fhir.instance.model.Distance)
+ return convertDistance((org.hl7.fhir.instance.model.Distance) src);
+ if (src instanceof org.hl7.fhir.instance.model.Duration)
+ return convertDuration((org.hl7.fhir.instance.model.Duration) src);
+ if (src instanceof org.hl7.fhir.instance.model.Money)
+ return convertMoney((org.hl7.fhir.instance.model.Money) src);
+ if (src instanceof org.hl7.fhir.instance.model.SimpleQuantity)
+ return convertSimpleQuantity((org.hl7.fhir.instance.model.SimpleQuantity) src);
+ throw new Error("Unknown type "+src.fhirType());
+ }
+
+ public org.hl7.fhir.instance.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType)
+ return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src);
+ if (src instanceof org.hl7.fhir.r4.model.BooleanType)
+ return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src);
+ if (src instanceof org.hl7.fhir.r4.model.CodeType)
+ return convertCode((org.hl7.fhir.r4.model.CodeType) src);
+ if (src instanceof org.hl7.fhir.r4.model.DateType)
+ return convertDate((org.hl7.fhir.r4.model.DateType) src);
+ if (src instanceof org.hl7.fhir.r4.model.DateTimeType)
+ return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src);
+ if (src instanceof org.hl7.fhir.r4.model.DecimalType)
+ return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src);
+ if (src instanceof org.hl7.fhir.r4.model.IdType)
+ return convertId((org.hl7.fhir.r4.model.IdType) src);
+ if (src instanceof org.hl7.fhir.r4.model.InstantType)
+ return convertInstant((org.hl7.fhir.r4.model.InstantType) src);
+ if (src instanceof org.hl7.fhir.r4.model.IntegerType)
+ return convertInteger((org.hl7.fhir.r4.model.IntegerType) src);
+ if (src instanceof org.hl7.fhir.r4.model.MarkdownType)
+ return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src);
+ if (src instanceof org.hl7.fhir.r4.model.OidType)
+ return convertOid((org.hl7.fhir.r4.model.OidType) src);
+ if (src instanceof org.hl7.fhir.r4.model.PositiveIntType)
+ return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src);
+ if (src instanceof org.hl7.fhir.r4.model.StringType)
+ return convertString((org.hl7.fhir.r4.model.StringType) src);
+ if (src instanceof org.hl7.fhir.r4.model.TimeType)
+ return convertTime((org.hl7.fhir.r4.model.TimeType) src);
+ if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType)
+ return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src);
+ if (src instanceof org.hl7.fhir.r4.model.UriType)
+ return convertUri((org.hl7.fhir.r4.model.UriType) src);
+ if (src instanceof org.hl7.fhir.r4.model.UuidType)
+ return convertUuid((org.hl7.fhir.r4.model.UuidType) src);
+ if (src instanceof org.hl7.fhir.r4.model.Extension)
+ return convertExtension((org.hl7.fhir.r4.model.Extension) src);
+ if (src instanceof org.hl7.fhir.r4.model.Narrative)
+ return convertNarrative((org.hl7.fhir.r4.model.Narrative) src);
+ if (src instanceof org.hl7.fhir.r4.model.Annotation)
+ return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src);
+ if (src instanceof org.hl7.fhir.r4.model.Attachment)
+ return convertAttachment((org.hl7.fhir.r4.model.Attachment) src);
+ if (src instanceof org.hl7.fhir.r4.model.CodeableConcept)
+ return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src);
+ if (src instanceof org.hl7.fhir.r4.model.Coding)
+ return convertCoding((org.hl7.fhir.r4.model.Coding) src);
+ if (src instanceof org.hl7.fhir.r4.model.Identifier)
+ return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src);
+ if (src instanceof org.hl7.fhir.r4.model.Period)
+ return convertPeriod((org.hl7.fhir.r4.model.Period) src);
+ if (src instanceof org.hl7.fhir.r4.model.Quantity)
+ return convertQuantity((org.hl7.fhir.r4.model.Quantity) src);
+ if (src instanceof org.hl7.fhir.r4.model.Range)
+ return convertRange((org.hl7.fhir.r4.model.Range) src);
+ if (src instanceof org.hl7.fhir.r4.model.Ratio)
+ return convertRatio((org.hl7.fhir.r4.model.Ratio) src);
+ if (src instanceof org.hl7.fhir.r4.model.Reference)
+ return convertReference((org.hl7.fhir.r4.model.Reference) src);
+ if (src instanceof org.hl7.fhir.r4.model.SampledData)
+ return convertSampledData((org.hl7.fhir.r4.model.SampledData) src);
+ if (src instanceof org.hl7.fhir.r4.model.Signature)
+ return convertSignature((org.hl7.fhir.r4.model.Signature) src);
+ if (src instanceof org.hl7.fhir.r4.model.Address)
+ return convertAddress((org.hl7.fhir.r4.model.Address) src);
+ if (src instanceof org.hl7.fhir.r4.model.ContactPoint)
+ return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src);
+ if (src instanceof org.hl7.fhir.r4.model.ElementDefinition)
+ return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src);
+ if (src instanceof org.hl7.fhir.r4.model.HumanName)
+ return convertHumanName((org.hl7.fhir.r4.model.HumanName) src);
+ if (src instanceof org.hl7.fhir.r4.model.Meta)
+ return convertMeta((org.hl7.fhir.r4.model.Meta) src);
+ if (src instanceof org.hl7.fhir.r4.model.Timing)
+ return convertTiming((org.hl7.fhir.r4.model.Timing) src);
+ if (src instanceof org.hl7.fhir.r4.model.Age)
+ return convertAge((org.hl7.fhir.r4.model.Age) src);
+ if (src instanceof org.hl7.fhir.r4.model.Count)
+ return convertCount((org.hl7.fhir.r4.model.Count) src);
+ if (src instanceof org.hl7.fhir.r4.model.Distance)
+ return convertDistance((org.hl7.fhir.r4.model.Distance) src);
+ if (src instanceof org.hl7.fhir.r4.model.Duration)
+ return convertDuration((org.hl7.fhir.r4.model.Duration) src);
+ if (src instanceof org.hl7.fhir.r4.model.Money)
+ return convertMoney((org.hl7.fhir.r4.model.Money) src);
+ if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity)
+ return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src);
+ throw new Error("Unknown type "+src.fhirType());
+ }
+
+ public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException {
+ copyResource(src, tgt);
+ tgt.setText(convertNarrative(src.getText()));
+ for (org.hl7.fhir.instance.model.Resource t : src.getContained())
+ tgt.addContained(convertResource(t));
+ for (org.hl7.fhir.instance.model.Extension t : src.getExtension())
+ tgt.addExtension(convertExtension(t));
+ for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension())
+ tgt.addModifierExtension(convertExtension(t));
+ }
+ public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException {
+ copyResource(src, tgt);
+ tgt.setText(convertNarrative(src.getText()));
+ for (org.hl7.fhir.r4.model.Resource t : src.getContained())
+ tgt.addContained(convertResource(t));
+ for (org.hl7.fhir.r4.model.Extension t : src.getExtension())
+ tgt.addExtension(convertExtension(t));
+ for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension())
+ tgt.addModifierExtension(convertExtension(t));
+ }
+
+ public org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.instance.model.Parameters src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters();
+ copyResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getParameter())
+ tgt.addParameter(convertParametersParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Parameters tgt = new org.hl7.fhir.instance.model.Parameters();
+ copyResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter())
+ tgt.addParameter(convertParametersParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setValue(convertType(src.getValue()));
+ tgt.setResource(convertResource(src.getResource()));
+ for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getPart())
+ tgt.addPart(convertParametersParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setValue(convertType(src.getValue()));
+ tgt.setResource(convertResource(src.getResource()));
+ for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart())
+ tgt.addPart(convertParametersParameterComponent(t));
+ return tgt;
+ }
+
+ public void copyResource(org.hl7.fhir.instance.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException {
+ tgt.setId(src.getId());
+ tgt.setMeta(convertMeta(src.getMeta()));
+ tgt.setImplicitRules(src.getImplicitRules());
+ tgt.setLanguage(src.getLanguage());
+ }
+ public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.instance.model.Resource tgt) throws FHIRException {
+ tgt.setId(src.getId());
+ if (src.hasMeta())
+ tgt.setMeta(convertMeta(src.getMeta()));
+ if (src.hasImplicitRules())
+ tgt.setImplicitRules(src.getImplicitRules());
+ if (src.hasLanguage())
+ tgt.setLanguage(src.getLanguage());
+ }
+
+ public org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.instance.model.Enumerations.AdministrativeGender src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE;
+ case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE;
+ case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER;
+ case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN;
+ default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case MALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.MALE;
+ case FEMALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.FEMALE;
+ case OTHER: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.OTHER;
+ case UNKNOWN: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.UNKNOWN;
+ default: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.instance.model.Enumerations.SearchParamType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER;
+ case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE;
+ case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING;
+ case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN;
+ case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE;
+ case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE;
+ case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY;
+ case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI;
+ default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NUMBER: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NUMBER;
+ case DATE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.DATE;
+ case STRING: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.STRING;
+ case TOKEN: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.TOKEN;
+ case REFERENCE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.REFERENCE;
+ case COMPOSITE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.COMPOSITE;
+ case QUANTITY: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.QUANTITY;
+ case URI: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.URI;
+ default: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Account convertAccount(org.hl7.fhir.instance.model.Account src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -147,251 +2114,6 @@ public class VersionConvertor_10_40 {
}
}
- public org.hl7.fhir.r4.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.instance.model.ProcessRequest.ActionList src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CANCEL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.CANCEL;
- case POLL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.POLL;
- case REPROCESS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.REPROCESS;
- case STATUS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.STATUS;
- default: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.r4.model.ProcessRequest.ActionList src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CANCEL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.CANCEL;
- case POLL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.POLL;
- case REPROCESS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.REPROCESS;
- case STATUS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.STATUS;
- default: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Address convertAddress(org.hl7.fhir.instance.model.Address src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Address tgt = new org.hl7.fhir.r4.model.Address();
- copyElement(src, tgt);
- tgt.setUse(convertAddressUse(src.getUse()));
- tgt.setType(convertAddressType(src.getType()));
- tgt.setText(src.getText());
- for (org.hl7.fhir.instance.model.StringType t : src.getLine())
- tgt.addLine(t.getValue());
- tgt.setCity(src.getCity());
- tgt.setDistrict(src.getDistrict());
- tgt.setState(src.getState());
- tgt.setPostalCode(src.getPostalCode());
- tgt.setCountry(src.getCountry());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Address convertAddress(org.hl7.fhir.r4.model.Address src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Address tgt = new org.hl7.fhir.instance.model.Address();
- copyElement(src, tgt);
- tgt.setUse(convertAddressUse(src.getUse()));
- tgt.setType(convertAddressType(src.getType()));
- tgt.setText(src.getText());
- for (org.hl7.fhir.r4.model.StringType t : src.getLine())
- tgt.addLine(t.getValue());
- tgt.setCity(src.getCity());
- tgt.setDistrict(src.getDistrict());
- tgt.setState(src.getState());
- tgt.setPostalCode(src.getPostalCode());
- tgt.setCountry(src.getCountry());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Address.AddressType convertAddressType(org.hl7.fhir.instance.model.Address.AddressType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case POSTAL: return org.hl7.fhir.r4.model.Address.AddressType.POSTAL;
- case PHYSICAL: return org.hl7.fhir.r4.model.Address.AddressType.PHYSICAL;
- case BOTH: return org.hl7.fhir.r4.model.Address.AddressType.BOTH;
- default: return org.hl7.fhir.r4.model.Address.AddressType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Address.AddressType convertAddressType(org.hl7.fhir.r4.model.Address.AddressType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case POSTAL: return org.hl7.fhir.instance.model.Address.AddressType.POSTAL;
- case PHYSICAL: return org.hl7.fhir.instance.model.Address.AddressType.PHYSICAL;
- case BOTH: return org.hl7.fhir.instance.model.Address.AddressType.BOTH;
- default: return org.hl7.fhir.instance.model.Address.AddressType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Address.AddressUse convertAddressUse(org.hl7.fhir.instance.model.Address.AddressUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HOME: return org.hl7.fhir.r4.model.Address.AddressUse.HOME;
- case WORK: return org.hl7.fhir.r4.model.Address.AddressUse.WORK;
- case TEMP: return org.hl7.fhir.r4.model.Address.AddressUse.TEMP;
- case OLD: return org.hl7.fhir.r4.model.Address.AddressUse.OLD;
- default: return org.hl7.fhir.r4.model.Address.AddressUse.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Address.AddressUse convertAddressUse(org.hl7.fhir.r4.model.Address.AddressUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HOME: return org.hl7.fhir.instance.model.Address.AddressUse.HOME;
- case WORK: return org.hl7.fhir.instance.model.Address.AddressUse.WORK;
- case TEMP: return org.hl7.fhir.instance.model.Address.AddressUse.TEMP;
- case OLD: return org.hl7.fhir.instance.model.Address.AddressUse.OLD;
- default: return org.hl7.fhir.instance.model.Address.AddressUse.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.instance.model.Enumerations.AdministrativeGender src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.MALE;
- case FEMALE: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.FEMALE;
- case OTHER: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.OTHER;
- case UNKNOWN: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.UNKNOWN;
- default: return org.hl7.fhir.r4.model.Enumerations.AdministrativeGender.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Enumerations.AdministrativeGender convertAdministrativeGender(org.hl7.fhir.r4.model.Enumerations.AdministrativeGender src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.MALE;
- case FEMALE: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.FEMALE;
- case OTHER: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.OTHER;
- case UNKNOWN: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.UNKNOWN;
- default: return org.hl7.fhir.instance.model.Enumerations.AdministrativeGender.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Age convertAge(org.hl7.fhir.instance.model.Age src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Age tgt = new org.hl7.fhir.r4.model.Age();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Age convertAge(org.hl7.fhir.r4.model.Age src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Age tgt = new org.hl7.fhir.instance.model.Age();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.instance.model.Contract.ActorComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent();
- copyElement(src, tgt);
- tgt.setActor(convertReference(src.getEntity()));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole())
- tgt.addRole(convertCodeableConcept(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.ActorComponent tgt = new org.hl7.fhir.instance.model.Contract.ActorComponent();
- copyElement(src, tgt);
- tgt.setEntity(convertReference(src.getActor()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole())
- tgt.addRole(convertCodeableConcept(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.instance.model.ElementDefinition.AggregationMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CONTAINED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.CONTAINED;
- case REFERENCED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.REFERENCED;
- case BUNDLED: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.BUNDLED;
- default: return org.hl7.fhir.r4.model.ElementDefinition.AggregationMode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.AggregationMode convertAggregationMode(org.hl7.fhir.r4.model.ElementDefinition.AggregationMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CONTAINED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.CONTAINED;
- case REFERENCED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.REFERENCED;
- case BUNDLED: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.BUNDLED;
- default: return org.hl7.fhir.instance.model.ElementDefinition.AggregationMode.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.instance.model.Patient.AnimalComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Patient.AnimalComponent tgt = new org.hl7.fhir.r4.model.Patient.AnimalComponent();
- copyElement(src, tgt);
- tgt.setSpecies(convertCodeableConcept(src.getSpecies()));
- tgt.setBreed(convertCodeableConcept(src.getBreed()));
- tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Patient.AnimalComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Patient.AnimalComponent tgt = new org.hl7.fhir.instance.model.Patient.AnimalComponent();
- copyElement(src, tgt);
- tgt.setSpecies(convertCodeableConcept(src.getSpecies()));
- tgt.setBreed(convertCodeableConcept(src.getBreed()));
- tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Annotation convertAnnotation(org.hl7.fhir.instance.model.Annotation src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Annotation tgt = new org.hl7.fhir.r4.model.Annotation();
- copyElement(src, tgt);
- tgt.setAuthor(convertType(src.getAuthor()));
- tgt.setTime(src.getTime());
- tgt.setText(src.getText());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Annotation convertAnnotation(org.hl7.fhir.r4.model.Annotation src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Annotation tgt = new org.hl7.fhir.instance.model.Annotation();
- copyElement(src, tgt);
- tgt.setAuthor(convertType(src.getAuthor()));
- tgt.setTime(src.getTime());
- tgt.setText(src.getText());
- return tgt;
- }
public org.hl7.fhir.r4.model.Appointment convertAppointment(org.hl7.fhir.instance.model.Appointment src) throws FHIRException {
if (src == null || src.isEmpty())
@@ -441,68 +2163,6 @@ public class VersionConvertor_10_40 {
return tgt;
}
- public org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType())
- tgt.addType(convertCodeableConcept(t));
- tgt.setActor(convertReference(src.getActor()));
- tgt.setRequired(convertParticipantRequired(src.getRequired()));
- tgt.setStatus(convertParticipationStatus(src.getStatus()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
- tgt.addType(convertCodeableConcept(t));
- tgt.setActor(convertReference(src.getActor()));
- tgt.setRequired(convertParticipantRequired(src.getRequired()));
- tgt.setStatus(convertParticipationStatus(src.getStatus()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.instance.model.AppointmentResponse src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setAppointment(convertReference(src.getAppointment()));
- tgt.setStart(src.getStart());
- tgt.setEnd(src.getEnd());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getParticipantType())
- tgt.addParticipantType(convertCodeableConcept(t));
- tgt.setActor(convertReference(src.getActor()));
- tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus()));
- tgt.setComment(src.getComment());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.AppointmentResponse tgt = new org.hl7.fhir.instance.model.AppointmentResponse();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setAppointment(convertReference(src.getAppointment()));
- tgt.setStart(src.getStart());
- tgt.setEnd(src.getEnd());
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType())
- tgt.addParticipantType(convertCodeableConcept(t));
- tgt.setActor(convertReference(src.getActor()));
- tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus()));
- tgt.setComment(src.getComment());
- return tgt;
- }
-
public org.hl7.fhir.r4.model.Appointment.AppointmentStatus convertAppointmentStatus(org.hl7.fhir.instance.model.Appointment.AppointmentStatus src) throws FHIRException {
if (src == null)
return null;
@@ -533,131 +2193,137 @@ public class VersionConvertor_10_40 {
}
}
- public org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.instance.model.TestScript.AssertionDirectionType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE;
- case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST;
- default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case RESPONSE: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.RESPONSE;
- case REQUEST: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.REQUEST;
- default: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.instance.model.TestScript.AssertionOperatorType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS;
- case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS;
- case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN;
- case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN;
- case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN;
- case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN;
- case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY;
- case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY;
- case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS;
- case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS;
- default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case EQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EQUALS;
- case NOTEQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEQUALS;
- case IN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.IN;
- case NOTIN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTIN;
- case GREATERTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.GREATERTHAN;
- case LESSTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.LESSTHAN;
- case EMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EMPTY;
- case NOTEMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEMPTY;
- case CONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.CONTAINS;
- case NOTCONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTCONTAINS;
- default: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY;
- case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED;
- case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT;
- case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED;
- case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD;
- case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN;
- case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND;
- case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED;
- case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT;
- case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE;
- case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED;
- case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE;
- default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OKAY: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.OKAY;
- case CREATED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CREATED;
- case NOCONTENT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOCONTENT;
- case NOTMODIFIED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTMODIFIED;
- case BAD: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.BAD;
- case FORBIDDEN: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.FORBIDDEN;
- case NOTFOUND: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTFOUND;
- case METHODNOTALLOWED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED;
- case CONFLICT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CONFLICT;
- case GONE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.GONE;
- case PRECONDITIONFAILED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED;
- case UNPROCESSABLE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.UNPROCESSABLE;
- default: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Attachment convertAttachment(org.hl7.fhir.instance.model.Attachment src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Attachment tgt = new org.hl7.fhir.r4.model.Attachment();
+ org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent();
copyElement(src, tgt);
- tgt.setContentType(src.getContentType());
- tgt.setLanguage(src.getLanguage());
- tgt.setData(src.getData());
- tgt.setUrl(src.getUrl());
- tgt.setSize(src.getSize());
- tgt.setHash(src.getHash());
- tgt.setTitle(src.getTitle());
- tgt.setCreation(src.getCreation());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType())
+ tgt.addType(convertCodeableConcept(t));
+ tgt.setActor(convertReference(src.getActor()));
+ tgt.setRequired(convertParticipantRequired(src.getRequired()));
+ tgt.setStatus(convertParticipationStatus(src.getStatus()));
return tgt;
}
- public org.hl7.fhir.instance.model.Attachment convertAttachment(org.hl7.fhir.r4.model.Attachment src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent convertAppointmentParticipantComponent(org.hl7.fhir.r4.model.Appointment.AppointmentParticipantComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Attachment tgt = new org.hl7.fhir.instance.model.Attachment();
+ org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent tgt = new org.hl7.fhir.instance.model.Appointment.AppointmentParticipantComponent();
copyElement(src, tgt);
- tgt.setContentType(src.getContentType());
- tgt.setLanguage(src.getLanguage());
- tgt.setData(src.getData());
- tgt.setUrl(src.getUrl());
- tgt.setSize(src.getSize());
- tgt.setHash(src.getHash());
- tgt.setTitle(src.getTitle());
- tgt.setCreation(src.getCreation());
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
+ tgt.addType(convertCodeableConcept(t));
+ tgt.setActor(convertReference(src.getActor()));
+ tgt.setRequired(convertParticipantRequired(src.getRequired()));
+ tgt.setStatus(convertParticipationStatus(src.getStatus()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.instance.model.Appointment.ParticipantRequired src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED;
+ case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL;
+ case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY;
+ default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUIRED: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.REQUIRED;
+ case OPTIONAL: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.OPTIONAL;
+ case INFORMATIONONLY: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.INFORMATIONONLY;
+ default: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.instance.model.Appointment.ParticipationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED;
+ case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED;
+ case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE;
+ case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION;
+ default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACCEPTED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.ACCEPTED;
+ case DECLINED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.DECLINED;
+ case TENTATIVE: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.TENTATIVE;
+ case NEEDSACTION: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NEEDSACTION;
+ default: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.instance.model.AppointmentResponse src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setAppointment(convertReference(src.getAppointment()));
+ tgt.setStart(src.getStart());
+ tgt.setEnd(src.getEnd());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getParticipantType())
+ tgt.addParticipantType(convertCodeableConcept(t));
+ tgt.setActor(convertReference(src.getActor()));
+ tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus()));
+ tgt.setComment(src.getComment());
+ return tgt;
+ }
+
+ private org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus src) {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
+ case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED;
+ case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE;
+ case INPROCESS: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
+ case COMPLETED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
+ case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION;
+ default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL;
+ }
+ }
+
+ private org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACCEPTED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
+ case DECLINED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.DECLINED;
+ case TENTATIVE: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.TENTATIVE;
+ case NEEDSACTION: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NEEDSACTION;
+ default: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.AppointmentResponse tgt = new org.hl7.fhir.instance.model.AppointmentResponse();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setAppointment(convertReference(src.getAppointment()));
+ tgt.setStart(src.getStart());
+ tgt.setEnd(src.getEnd());
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType())
+ tgt.addParticipantType(convertCodeableConcept(t));
+ tgt.setActor(convertReference(src.getActor()));
+ tgt.setParticipantStatus(convertParticipantStatus(src.getParticipantStatus()));
+ tgt.setComment(src.getComment());
return tgt;
}
@@ -734,6 +2400,30 @@ public class VersionConvertor_10_40 {
}
}
+ public org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0;
+ case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4;
+ case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8;
+ case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12;
+ default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case _0: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._0;
+ case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._4;
+ case _8: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._8;
+ case _12: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._12;
+ default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentComponent convertAuditEventAgentComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -799,90 +2489,6 @@ public class VersionConvertor_10_40 {
return tgt;
}
- public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setReference(convertReference(src.getReference()));
- tgt.setType(convertCoding(src.getType()));
- tgt.setRole(convertCoding(src.getRole()));
- tgt.setLifecycle(convertCoding(src.getLifecycle()));
- for (org.hl7.fhir.instance.model.Coding t : src.getSecurityLabel())
- tgt.addSecurityLabel(convertCoding(t));
- tgt.setName(src.getName());
- tgt.setDescription(src.getDescription());
- tgt.setQuery(src.getQuery());
- for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail())
- tgt.addDetail(convertAuditEventEntityDetailComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setReference(convertReference(src.getReference()));
- tgt.setType(convertCoding(src.getType()));
- tgt.setRole(convertCoding(src.getRole()));
- tgt.setLifecycle(convertCoding(src.getLifecycle()));
- for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel())
- tgt.addSecurityLabel(convertCoding(t));
- tgt.setName(src.getName());
- tgt.setDescription(src.getDescription());
- tgt.setQuery(src.getQuery());
- for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail())
- tgt.addDetail(convertAuditEventEntityDetailComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
- tgt.setValue(new Base64BinaryType(src.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
- tgt.setValue((src.getValueBase64BinaryType().getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case _0: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._0;
- case _4: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._4;
- case _8: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._8;
- case _12: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome._12;
- default: return org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome convertAuditEventOutcome(org.hl7.fhir.r4.model.AuditEvent.AuditEventOutcome src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case _0: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._0;
- case _4: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._4;
- case _8: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._8;
- case _12: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome._12;
- default: return org.hl7.fhir.instance.model.AuditEvent.AuditEventOutcome.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.AuditEvent.AuditEventAgentNetworkType convertAuditEventParticipantNetworkType(org.hl7.fhir.instance.model.AuditEvent.AuditEventParticipantNetworkType src) throws FHIRException {
if (src == null)
return null;
@@ -933,15 +2539,63 @@ public class VersionConvertor_10_40 {
return tgt;
}
- public org.hl7.fhir.r4.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.instance.model.Base64BinaryType src) throws FHIRException {
- org.hl7.fhir.r4.model.Base64BinaryType tgt = new org.hl7.fhir.r4.model.Base64BinaryType(src.getValue());
+ public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent convertAuditEventEntityComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent();
copyElement(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setReference(convertReference(src.getReference()));
+ tgt.setType(convertCoding(src.getType()));
+ tgt.setRole(convertCoding(src.getRole()));
+ tgt.setLifecycle(convertCoding(src.getLifecycle()));
+ for (org.hl7.fhir.instance.model.Coding t : src.getSecurityLabel())
+ tgt.addSecurityLabel(convertCoding(t));
+ tgt.setName(src.getName());
+ tgt.setDescription(src.getDescription());
+ tgt.setQuery(src.getQuery());
+ for (org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent t : src.getDetail())
+ tgt.addDetail(convertAuditEventEntityDetailComponent(t));
return tgt;
}
- public org.hl7.fhir.instance.model.Base64BinaryType convertBase64Binary(org.hl7.fhir.r4.model.Base64BinaryType src) throws FHIRException {
- org.hl7.fhir.instance.model.Base64BinaryType tgt = new org.hl7.fhir.instance.model.Base64BinaryType(src.getValue());
+ public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent convertAuditEventEntityComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectComponent();
copyElement(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setReference(convertReference(src.getReference()));
+ tgt.setType(convertCoding(src.getType()));
+ tgt.setRole(convertCoding(src.getRole()));
+ tgt.setLifecycle(convertCoding(src.getLifecycle()));
+ for (org.hl7.fhir.r4.model.Coding t : src.getSecurityLabel())
+ tgt.addSecurityLabel(convertCoding(t));
+ tgt.setName(src.getName());
+ tgt.setDescription(src.getDescription());
+ tgt.setQuery(src.getQuery());
+ for (org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent t : src.getDetail())
+ tgt.addDetail(convertAuditEventEntityDetailComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent tgt = new org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setValue(new Base64BinaryType(src.getValueElement().getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent convertAuditEventEntityDetailComponent(org.hl7.fhir.r4.model.AuditEvent.AuditEventEntityDetailComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent tgt = new org.hl7.fhir.instance.model.AuditEvent.AuditEventObjectDetailComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setValue(src.getValueBase64BinaryType().getValue());
return tgt;
}
@@ -993,42 +2647,6 @@ public class VersionConvertor_10_40 {
return tgt;
}
- public org.hl7.fhir.r4.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.instance.model.Enumerations.BindingStrength src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REQUIRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.REQUIRED;
- case EXTENSIBLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXTENSIBLE;
- case PREFERRED: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.PREFERRED;
- case EXAMPLE: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.EXAMPLE;
- default: return org.hl7.fhir.r4.model.Enumerations.BindingStrength.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Enumerations.BindingStrength convertBindingStrength(org.hl7.fhir.r4.model.Enumerations.BindingStrength src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REQUIRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.REQUIRED;
- case EXTENSIBLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXTENSIBLE;
- case PREFERRED: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.PREFERRED;
- case EXAMPLE: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.EXAMPLE;
- default: return org.hl7.fhir.instance.model.Enumerations.BindingStrength.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.BooleanType convertBoolean(org.hl7.fhir.instance.model.BooleanType src) throws FHIRException {
- org.hl7.fhir.r4.model.BooleanType tgt = new org.hl7.fhir.r4.model.BooleanType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.BooleanType convertBoolean(org.hl7.fhir.r4.model.BooleanType src) throws FHIRException {
- org.hl7.fhir.instance.model.BooleanType tgt = new org.hl7.fhir.instance.model.BooleanType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
public org.hl7.fhir.r4.model.Bundle convertBundle(org.hl7.fhir.instance.model.Bundle src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1062,6 +2680,60 @@ public class VersionConvertor_10_40 {
return tgt;
}
+ public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.instance.model.Bundle.BundleType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT;
+ case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE;
+ case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION;
+ case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE;
+ case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH;
+ case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE;
+ case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY;
+ case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET;
+ case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION;
+ default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DOCUMENT: return org.hl7.fhir.instance.model.Bundle.BundleType.DOCUMENT;
+ case MESSAGE: return org.hl7.fhir.instance.model.Bundle.BundleType.MESSAGE;
+ case TRANSACTION: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTION;
+ case TRANSACTIONRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTIONRESPONSE;
+ case BATCH: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCH;
+ case BATCHRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCHRESPONSE;
+ case HISTORY: return org.hl7.fhir.instance.model.Bundle.BundleType.HISTORY;
+ case SEARCHSET: return org.hl7.fhir.instance.model.Bundle.BundleType.SEARCHSET;
+ case COLLECTION: return org.hl7.fhir.instance.model.Bundle.BundleType.COLLECTION;
+ default: return org.hl7.fhir.instance.model.Bundle.BundleType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.instance.model.Bundle.BundleLinkComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent();
+ copyElement(src, tgt);
+ tgt.setRelation(src.getRelation());
+ tgt.setUrl(src.getUrl());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleLinkComponent();
+ copyElement(src, tgt);
+ tgt.setRelation(src.getRelation());
+ tgt.setUrl(src.getUrl());
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.Bundle.BundleEntryComponent convertBundleEntryComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1101,6 +2773,48 @@ public class VersionConvertor_10_40 {
return tgt;
}
+ public org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent();
+ copyElement(src, tgt);
+ tgt.setMode(convertSearchEntryMode(src.getMode()));
+ tgt.setScore(src.getScore());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent();
+ copyElement(src, tgt);
+ tgt.setMode(convertSearchEntryMode(src.getMode()));
+ tgt.setScore(src.getScore());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.instance.model.Bundle.SearchEntryMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH;
+ case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE;
+ case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME;
+ default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case MATCH: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.MATCH;
+ case INCLUDE: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.INCLUDE;
+ case OUTCOME: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.OUTCOME;
+ default: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Bundle.BundleEntryRequestComponent convertBundleEntryRequestComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryRequestComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1129,6 +2843,30 @@ public class VersionConvertor_10_40 {
return tgt;
}
+ public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.instance.model.Bundle.HTTPVerb src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET;
+ case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST;
+ case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT;
+ case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE;
+ default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case GET: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.GET;
+ case POST: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.POST;
+ case PUT: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.PUT;
+ case DELETE: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.DELETE;
+ default: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Bundle.BundleEntryResponseComponent convertBundleEntryResponseComponent(org.hl7.fhir.instance.model.Bundle.BundleEntryResponseComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1153,80 +2891,6 @@ public class VersionConvertor_10_40 {
return tgt;
}
- public org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent();
- copyElement(src, tgt);
- tgt.setMode(convertSearchEntryMode(src.getMode()));
- tgt.setScore(src.getScore());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent convertBundleEntrySearchComponent(org.hl7.fhir.r4.model.Bundle.BundleEntrySearchComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleEntrySearchComponent();
- copyElement(src, tgt);
- tgt.setMode(convertSearchEntryMode(src.getMode()));
- tgt.setScore(src.getScore());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.instance.model.Bundle.BundleLinkComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.r4.model.Bundle.BundleLinkComponent();
- copyElement(src, tgt);
- tgt.setRelation(src.getRelation());
- tgt.setUrl(src.getUrl());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Bundle.BundleLinkComponent convertBundleLinkComponent(org.hl7.fhir.r4.model.Bundle.BundleLinkComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Bundle.BundleLinkComponent tgt = new org.hl7.fhir.instance.model.Bundle.BundleLinkComponent();
- copyElement(src, tgt);
- tgt.setRelation(src.getRelation());
- tgt.setUrl(src.getUrl());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Bundle.BundleType convertBundleType(org.hl7.fhir.instance.model.Bundle.BundleType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case DOCUMENT: return org.hl7.fhir.r4.model.Bundle.BundleType.DOCUMENT;
- case MESSAGE: return org.hl7.fhir.r4.model.Bundle.BundleType.MESSAGE;
- case TRANSACTION: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTION;
- case TRANSACTIONRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.TRANSACTIONRESPONSE;
- case BATCH: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCH;
- case BATCHRESPONSE: return org.hl7.fhir.r4.model.Bundle.BundleType.BATCHRESPONSE;
- case HISTORY: return org.hl7.fhir.r4.model.Bundle.BundleType.HISTORY;
- case SEARCHSET: return org.hl7.fhir.r4.model.Bundle.BundleType.SEARCHSET;
- case COLLECTION: return org.hl7.fhir.r4.model.Bundle.BundleType.COLLECTION;
- default: return org.hl7.fhir.r4.model.Bundle.BundleType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Bundle.BundleType convertBundleType(org.hl7.fhir.r4.model.Bundle.BundleType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case DOCUMENT: return org.hl7.fhir.instance.model.Bundle.BundleType.DOCUMENT;
- case MESSAGE: return org.hl7.fhir.instance.model.Bundle.BundleType.MESSAGE;
- case TRANSACTION: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTION;
- case TRANSACTIONRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.TRANSACTIONRESPONSE;
- case BATCH: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCH;
- case BATCHRESPONSE: return org.hl7.fhir.instance.model.Bundle.BundleType.BATCHRESPONSE;
- case HISTORY: return org.hl7.fhir.instance.model.Bundle.BundleType.HISTORY;
- case SEARCHSET: return org.hl7.fhir.instance.model.Bundle.BundleType.SEARCHSET;
- case COLLECTION: return org.hl7.fhir.instance.model.Bundle.BundleType.COLLECTION;
- default: return org.hl7.fhir.instance.model.Bundle.BundleType.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.CarePlan convertCarePlan(org.hl7.fhir.instance.model.CarePlan src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1293,6 +2957,74 @@ public class VersionConvertor_10_40 {
return tgt;
}
+ public org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PROPOSED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT;
+ case DRAFT: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT;
+ case ACTIVE: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE;
+ case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED;
+ case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.CANCELLED;
+ default: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+// case PROPOSED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.PROPOSED;
+ case DRAFT: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.DRAFT;
+ case ACTIVE: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.ACTIVE;
+ case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.COMPLETED;
+ case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.CANCELLED;
+ default: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.NULL;
+ }
+ }
+
+// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent();
+// copyElement(src, tgt);
+// tgt.setCode(convertCarePlanRelationship(src.getCode()));
+// tgt.setPlan(convertReference(src.getPlan()));
+// return tgt;
+// }
+
+// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent();
+// copyElement(src, tgt);
+// tgt.setCode(convertCarePlanRelationship(src.getCode()));
+// tgt.setPlan(convertReference(src.getPlan()));
+// return tgt;
+// }
+
+// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship src) throws FHIRException {
+// if (src == null)
+// return null;
+// switch (src) {
+// case INCLUDES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.INCLUDES;
+// case REPLACES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.REPLACES;
+// case FULFILLS: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.FULFILLS;
+// default: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.NULL;
+// }
+// }
+
+// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship src) throws FHIRException {
+// if (src == null)
+// return null;
+// switch (src) {
+// case INCLUDES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.INCLUDES;
+// case REPLACES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.REPLACES;
+// case FULFILLS: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.FULFILLS;
+// default: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.NULL;
+// }
+// }
+
// public org.hl7.fhir.r4.model.CarePlan.CarePlanParticipantComponent convertCarePlanParticipantComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanParticipantComponent src) throws FHIRException {
// if (src == null || src.isEmpty())
// return null;
@@ -1423,32 +3155,6 @@ public class VersionConvertor_10_40 {
}
}
- public org.hl7.fhir.r4.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.instance.model.CarePlan.CarePlanStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PROPOSED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT;
- case DRAFT: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.DRAFT;
- case ACTIVE: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.ACTIVE;
- case COMPLETED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.COMPLETED;
- case CANCELLED: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.CANCELLED;
- default: return org.hl7.fhir.r4.model.CarePlan.CarePlanStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.CarePlan.CarePlanStatus convertCarePlanStatus(org.hl7.fhir.r4.model.CarePlan.CarePlanStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
-// case PROPOSED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.PROPOSED;
- case DRAFT: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.DRAFT;
- case ACTIVE: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.ACTIVE;
- case COMPLETED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.COMPLETED;
- case CANCELLED: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.CANCELLED;
- default: return org.hl7.fhir.instance.model.CarePlan.CarePlanStatus.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.ClinicalImpression convertClinicalImpression(org.hl7.fhir.instance.model.ClinicalImpression src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1507,30 +3213,6 @@ public class VersionConvertor_10_40 {
return tgt;
}
- public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent();
- copyElement(src, tgt);
- tgt.setItem(convertCodeableConcept(src.getItem()));
-// tgt.setCause(src.getCause());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent();
- copyElement(src, tgt);
- if (src.hasItemCodeableConcept())
- try {
- tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept()));
- } catch (org.hl7.fhir.exceptions.FHIRException e) {
- }
-// tgt.setCause(src.getCause());
- return tgt;
- }
-
public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionStatus convertClinicalImpressionStatus(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionStatus src) throws FHIRException {
if (src == null)
return null;
@@ -1553,119 +3235,49 @@ public class VersionConvertor_10_40 {
}
}
- public org.hl7.fhir.r4.model.CodeType convertCode(org.hl7.fhir.instance.model.CodeType src) throws FHIRException {
- org.hl7.fhir.r4.model.CodeType tgt = new org.hl7.fhir.r4.model.CodeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
+// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent();
+// copyElement(src, tgt);
+// tgt.setCode(convertCodeableConcept(src.getCode()));
+// for (org.hl7.fhir.instance.model.Reference t : src.getItem())
+// tgt.addItem(convertReference(t));
+// return tgt;
+// }
+//
+// public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent();
+// copyElement(src, tgt);
+// tgt.setCode(convertCodeableConcept(src.getCode()));
+// for (org.hl7.fhir.r4.model.Reference t : src.getItem())
+// tgt.addItem(convertReference(t));
+// return tgt;
+// }
- public org.hl7.fhir.instance.model.CodeType convertCode(org.hl7.fhir.r4.model.CodeType src) throws FHIRException {
- org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException {
+ public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent();
+ org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent();
copyElement(src, tgt);
- tgt.setSystem(src.getUrl());
- tgt.setVersion(src.getVersion());
- tgt.setCaseSensitive(src.getCaseSensitive());
-
- for (ConceptDefinitionComponent cc : src.getConcept())
- tgt.addConcept(convertCodeSystemConcept(src, cc));
+ tgt.setItem(convertCodeableConcept(src.getItem()));
+// tgt.setCause(src.getCause());
return tgt;
}
-public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent convertClinicalImpressionFindingComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionFindingComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent();
+ org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionFindingComponent();
copyElement(src, tgt);
- tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src));
- tgt.setCode(src.getCode());
- tgt.setDefinition(src.getDefinition());
- tgt.setDisplay(src.getDisplay());
-
- for (ConceptDefinitionComponent cc : src.getConcept())
- tgt.addConcept(convertCodeSystemConcept(cs, cc));
- for (ConceptDefinitionDesignationComponent cc : src.getDesignation())
- tgt.addDesignation(convertCodeSystemDesignation(cc));
- return tgt;
- }
-
-public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent();
- copyElement(src, tgt);
- tgt.setUse(convertCoding(src.getUse()));
- tgt.setLanguage(src.getLanguage());
- tgt.setValue(src.getValue());
-
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.UriType convertCodeToUri(org.hl7.fhir.instance.model.CodeType src) throws FHIRException {
- org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.instance.model.CodeableConcept src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CodeableConcept tgt = new org.hl7.fhir.r4.model.CodeableConcept();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.Coding t : src.getCoding())
- tgt.addCoding(convertCoding(t));
- tgt.setText(src.getText());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.CodeableConcept convertCodeableConcept(org.hl7.fhir.r4.model.CodeableConcept src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.CodeableConcept tgt = new org.hl7.fhir.instance.model.CodeableConcept();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.Coding t : src.getCoding())
- tgt.addCoding(convertCoding(t));
- tgt.setText(src.getText());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.instance.model.CodeableConcept t) throws FHIRException {
- org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext();
- // todo: set type..
- result.setValue(convertCodeableConcept(t));
- return result;
- }
-
- public org.hl7.fhir.r4.model.Coding convertCoding(org.hl7.fhir.instance.model.Coding src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Coding tgt = new org.hl7.fhir.r4.model.Coding();
- copyElement(src, tgt);
- tgt.setSystem(src.getSystem());
- tgt.setVersion(src.getVersion());
- tgt.setCode(src.getCode());
- tgt.setDisplay(src.getDisplay());
- tgt.setUserSelected(src.getUserSelected());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Coding convertCoding(org.hl7.fhir.r4.model.Coding src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Coding tgt = new org.hl7.fhir.instance.model.Coding();
- copyElement(src, tgt);
- tgt.setSystem(src.getSystem());
- tgt.setVersion(src.getVersion());
- tgt.setCode(src.getCode());
- tgt.setDisplay(src.getDisplay());
- tgt.setUserSelected(src.getUserSelected());
+ if (src.hasItemCodeableConcept())
+ try {
+ tgt.setItem(convertCodeableConcept(src.getItemCodeableConcept()));
+ } catch (org.hl7.fhir.exceptions.FHIRException e) {
+ }
+// tgt.setCause(src.getCause());
return tgt;
}
@@ -1719,6 +3331,32 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.instance.model.Communication.CommunicationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS;
+ case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED;
+ case SUSPENDED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.SUSPENDED;
+ case REJECTED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR;
+ case FAILED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ABORTED;
+ default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.INPROGRESS;
+ case COMPLETED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.COMPLETED;
+ case SUSPENDED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.SUSPENDED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.REJECTED;
+ case ABORTED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.FAILED;
+ default: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Communication.CommunicationPayloadComponent convertCommunicationPayloadComponent(org.hl7.fhir.instance.model.Communication.CommunicationPayloadComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1764,6 +3402,20 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ private org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.instance.model.CodeableConcept priority) {
+ for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) {
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE;
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT;
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT;
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP;
+ }
+ return null;
+ }
+
public org.hl7.fhir.instance.model.CommunicationRequest convertCommunicationRequest(org.hl7.fhir.r4.model.CommunicationRequest src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -1791,22 +3443,16 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent();
- copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent();
- copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
- return tgt;
+ private org.hl7.fhir.instance.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority priority) {
+ org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept();
+ switch (priority) {
+ case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break;
+ case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break;
+ case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break;
+ case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break;
+ default: return null;
+ }
+ return cc;
}
public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestStatus convertCommunicationRequestStatus(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestStatus src) throws FHIRException {
@@ -1845,30 +3491,22 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.instance.model.Communication.CommunicationStatus src) throws FHIRException {
- if (src == null)
+ public org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.INPROGRESS;
- case COMPLETED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.COMPLETED;
- case SUSPENDED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.SUSPENDED;
- case REJECTED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ENTEREDINERROR;
- case FAILED: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.ABORTED;
- default: return org.hl7.fhir.r4.model.Communication.CommunicationStatus.NULL;
- }
+ org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
}
- public org.hl7.fhir.instance.model.Communication.CommunicationStatus convertCommunicationStatus(org.hl7.fhir.r4.model.Communication.CommunicationStatus src) throws FHIRException {
- if (src == null)
+ public org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent convertCommunicationRequestPayloadComponent(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationRequestPayloadComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.INPROGRESS;
- case COMPLETED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.COMPLETED;
- case SUSPENDED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.SUSPENDED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.REJECTED;
- case ABORTED: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.FAILED;
- default: return org.hl7.fhir.instance.model.Communication.CommunicationStatus.NULL;
- }
+ org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent tgt = new org.hl7.fhir.instance.model.CommunicationRequest.CommunicationRequestPayloadComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
}
public org.hl7.fhir.r4.model.Composition convertComposition(org.hl7.fhir.instance.model.Composition src) throws FHIRException {
@@ -1929,27 +3567,27 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.instance.model.Composition.CompositionAttestationMode src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.instance.model.Composition.CompositionStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL;
- case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL;
- case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL;
- case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL;
- default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL;
+ case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY;
+ case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL;
+ case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL;
}
}
- public org.hl7.fhir.instance.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case PERSONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PERSONAL;
- case PROFESSIONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PROFESSIONAL;
- case LEGAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.LEGAL;
- case OFFICIAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.OFFICIAL;
- default: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.NULL;
+ case PRELIMINARY: return org.hl7.fhir.instance.model.Composition.CompositionStatus.PRELIMINARY;
+ case FINAL: return org.hl7.fhir.instance.model.Composition.CompositionStatus.FINAL;
+ case AMENDED: return org.hl7.fhir.instance.model.Composition.CompositionStatus.AMENDED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.Composition.CompositionStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.instance.model.Composition.CompositionStatus.NULL;
}
}
@@ -1977,6 +3615,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.instance.model.Composition.CompositionAttestationMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PERSONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PERSONAL;
+ case PROFESSIONAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.PROFESSIONAL;
+ case LEGAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.LEGAL;
+ case OFFICIAL: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.OFFICIAL;
+ default: return org.hl7.fhir.r4.model.Composition.CompositionAttestationMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Composition.CompositionAttestationMode convertCompositionAttestationMode(org.hl7.fhir.r4.model.Composition.CompositionAttestationMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PERSONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PERSONAL;
+ case PROFESSIONAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.PROFESSIONAL;
+ case LEGAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.LEGAL;
+ case OFFICIAL: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.OFFICIAL;
+ default: return org.hl7.fhir.instance.model.Composition.CompositionAttestationMode.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Composition.CompositionEventComponent convertCompositionEventComponent(org.hl7.fhir.instance.model.Composition.CompositionEventComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2003,48 +3665,59 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.instance.model.Composition.CompositionStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PRELIMINARY: return org.hl7.fhir.r4.model.Composition.CompositionStatus.PRELIMINARY;
- case FINAL: return org.hl7.fhir.r4.model.Composition.CompositionStatus.FINAL;
- case AMENDED: return org.hl7.fhir.r4.model.Composition.CompositionStatus.AMENDED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.Composition.CompositionStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.r4.model.Composition.CompositionStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Composition.CompositionStatus convertCompositionStatus(org.hl7.fhir.r4.model.Composition.CompositionStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PRELIMINARY: return org.hl7.fhir.instance.model.Composition.CompositionStatus.PRELIMINARY;
- case FINAL: return org.hl7.fhir.instance.model.Composition.CompositionStatus.FINAL;
- case AMENDED: return org.hl7.fhir.instance.model.Composition.CompositionStatus.AMENDED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.Composition.CompositionStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.instance.model.Composition.CompositionStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.instance.model.Composition.SectionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent();
+ org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent();
copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
+ tgt.setTitle(src.getTitle());
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setText(convertNarrative(src.getText()));
+ try {
+ tgt.setMode(org.hl7.fhir.r4.model.Composition.SectionMode.fromCode(src.getMode()));
+ } catch (org.hl7.fhir.exceptions.FHIRException e) {
+ throw new FHIRException(e);
+ }
+ tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getEntry())
+ tgt.addEntry(convertReference(t));
+ tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason()));
+ for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection())
+ tgt.addSection(convertSectionComponent(t));
return tgt;
}
- public org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent();
+ org.hl7.fhir.instance.model.Composition.SectionComponent tgt = new org.hl7.fhir.instance.model.Composition.SectionComponent();
copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
+ tgt.setTitle(src.getTitle());
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setText(convertNarrative(src.getText()));
+ tgt.setMode(src.getMode().toCode());
+ tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getEntry())
+ tgt.addEntry(convertReference(t));
+ tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason()));
+ for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection())
+ tgt.addSection(convertSectionComponent(t));
return tgt;
}
+ private class SourceElementComponentWrapper {
+ public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
+ super();
+ this.source = source;
+ this.target = target;
+ this.comp = comp;
+ }
+ private String source;
+ private String target;
+ private org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp;
+
+ }
+
public org.hl7.fhir.r4.model.ConceptMap convertConceptMap(org.hl7.fhir.instance.model.ConceptMap src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2080,6 +3753,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.UsageContext convertCodeableConceptToUsageContext(org.hl7.fhir.instance.model.CodeableConcept t) throws FHIRException {
+ org.hl7.fhir.r4.model.UsageContext result = new org.hl7.fhir.r4.model.UsageContext();
+ // todo: set type..
+ result.setValue(convertCodeableConcept(t));
+ return result;
+ }
+
+
+ private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
+ for (ConceptMapGroupComponent grp : map.getGroup()) {
+ if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
+ return grp;
+ }
+ ConceptMapGroupComponent grp = map.addGroup();
+ grp.setSource(srcs);
+ grp.setTarget(tgts);
+ return grp;
+ }
+
+
public org.hl7.fhir.instance.model.ConceptMap convertConceptMap(org.hl7.fhir.r4.model.ConceptMap src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2113,6 +3806,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT;
+ case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE;
+ case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED;
+ default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DRAFT: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.DRAFT;
+ case ACTIVE: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.ACTIVE;
+ case RETIRED: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.RETIRED;
+ default: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.ContactDetail convertConceptMapContactComponent(org.hl7.fhir.instance.model.ConceptMap.ConceptMapContactComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2135,6 +3850,63 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public List convertSourceElementComponent(org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent src) throws FHIRException {
+ List res = new ArrayList();
+ if (src == null || src.isEmpty())
+ return res;
+ for (org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
+ org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent();
+ copyElement(src, tgt);
+ tgt.setCode(src.getCode());
+ tgt.addTarget(convertTargetElementComponent(t));
+ res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem()));
+ }
+ return res;
+ }
+
+ public org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent();
+ copyElement(src, tgt);
+ tgt.setCodeSystem(g.getSource());
+ tgt.setCode(src.getCode());
+ for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget())
+ tgt.addTarget(convertTargetElementComponent(t, g));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent();
+ copyElement(src, tgt);
+ tgt.setCode(src.getCode());
+ tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence()));
+ tgt.setComment(src.getComments());
+ for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
+ tgt.addDependsOn(convertOtherElementComponent(t));
+ for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getProduct())
+ tgt.addProduct(convertOtherElementComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent();
+ copyElement(src, tgt);
+ tgt.setCodeSystem(g.getTarget());
+ tgt.setCode(src.getCode());
+ tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence()));
+ tgt.setComments(src.getComment());
+ for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
+ tgt.addDependsOn(convertOtherElementComponent(t));
+ for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct())
+ tgt.addProduct(convertOtherElementComponent(t));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.Enumerations.ConceptMapEquivalence convertConceptMapEquivalence(org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence src) throws FHIRException {
if (src == null)
return null;
@@ -2169,99 +3941,25 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
+ public org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent();
+ org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent();
copyElement(src, tgt);
+ tgt.setProperty(src.getElement());
+ tgt.setSystem(src.getCodeSystem());
tgt.setCode(src.getCode());
- tgt.setDisplay(src.getDisplay());
- for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation())
- tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
return tgt;
}
- public org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent();
+ org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent();
copyElement(src, tgt);
+ tgt.setElement(src.getProperty());
+ tgt.setCodeSystem(src.getSystem());
tgt.setCode(src.getCode());
- tgt.setDisplay(src.getDisplay());
- for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
- tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent();
- copyElement(src, tgt);
- tgt.setLanguage(src.getLanguage());
- tgt.setUse(convertCoding(src.getUse()));
- tgt.setValue(src.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent();
- copyElement(src, tgt);
- tgt.setLanguage(src.getLanguage());
- tgt.setUse(convertCoding(src.getUse()));
- tgt.setValue(src.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent();
- copyElement(src, tgt);
- tgt.setSystem(src.getSystem());
- tgt.setVersion(src.getVersion());
- for (org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
- tgt.addConcept(convertConceptReferenceComponent(t));
- for (org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
- tgt.addFilter(convertConceptSetFilterComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent();
- copyElement(src, tgt);
- tgt.setSystem(src.getSystem());
- tgt.setVersion(src.getVersion());
- for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
- tgt.addConcept(convertConceptReferenceComponent(t));
- for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
- tgt.addFilter(convertConceptSetFilterComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent();
- copyElement(src, tgt);
- tgt.setProperty(src.getProperty());
- tgt.setOp(convertFilterOperator(src.getOp()));
- tgt.setValue(src.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent();
- copyElement(src, tgt);
- tgt.setProperty(src.getProperty());
- tgt.setOp(convertFilterOperator(src.getOp()));
- tgt.setValue(src.getValue());
return tgt;
}
@@ -2326,51 +4024,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent();
- copyElement(src, tgt);
- tgt.addCode(convertCodeableConcept(src.getCode()));
- for (org.hl7.fhir.instance.model.Reference t : src.getDetail())
- tgt.addDetail(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.CodeableConcept cc : src.getCode())
- tgt.setCode(convertCodeableConcept(cc));
- for (org.hl7.fhir.r4.model.Reference t : src.getDetail())
- tgt.addDetail(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.instance.model.Condition.ConditionStageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent();
- copyElement(src, tgt);
- tgt.setSummary(convertCodeableConcept(src.getSummary()));
- for (org.hl7.fhir.instance.model.Reference t : src.getAssessment())
- tgt.addAssessment(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionStageComponent();
- copyElement(src, tgt);
- tgt.setSummary(convertCodeableConcept(src.getSummary()));
- for (org.hl7.fhir.r4.model.Reference t : src.getAssessment())
- tgt.addAssessment(convertReference(t));
- return tgt;
- }
-
public org.hl7.fhir.r4.model.Condition.ConditionVerificationStatus convertConditionVerificationStatus(org.hl7.fhir.instance.model.Condition.ConditionVerificationStatus src) throws FHIRException {
if (src == null)
return null;
@@ -2399,26 +4052,49 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus src) throws FHIRException {
- if (src == null)
+ public org.hl7.fhir.r4.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.instance.model.Condition.ConditionStageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
return null;
- switch (src) {
- case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED;
- case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE;
- case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL;
- }
+ org.hl7.fhir.r4.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionStageComponent();
+ copyElement(src, tgt);
+ tgt.setSummary(convertCodeableConcept(src.getSummary()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getAssessment())
+ tgt.addAssessment(convertReference(t));
+ return tgt;
}
- public org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException {
- if (src == null)
+ public org.hl7.fhir.instance.model.Condition.ConditionStageComponent convertConditionStageComponent(org.hl7.fhir.r4.model.Condition.ConditionStageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
return null;
- switch (src) {
- case NOTSUPPORTED: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED;
- case SINGLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.SINGLE;
- case MULTIPLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.MULTIPLE;
- default: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NULL;
- }
+ org.hl7.fhir.instance.model.Condition.ConditionStageComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionStageComponent();
+ copyElement(src, tgt);
+ tgt.setSummary(convertCodeableConcept(src.getSummary()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getAssessment())
+ tgt.addAssessment(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent();
+ copyElement(src, tgt);
+ tgt.addCode(convertCodeableConcept(src.getCode()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getDetail())
+ tgt.addDetail(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent convertConditionEvidenceComponent(org.hl7.fhir.r4.model.Condition.ConditionEvidenceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent tgt = new org.hl7.fhir.instance.model.Condition.ConditionEvidenceComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.CodeableConcept cc : src.getCode())
+ tgt.setCode(convertCodeableConcept(cc));
+ for (org.hl7.fhir.r4.model.Reference t : src.getDetail())
+ tgt.addDetail(convertReference(t));
+ return tgt;
}
public org.hl7.fhir.r4.model.CapabilityStatement convertConformance(org.hl7.fhir.instance.model.Conformance src) throws FHIRException {
@@ -2496,6 +4172,52 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE;
+ case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY;
+ case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INSTANCE: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.INSTANCE;
+ case CAPABILITY: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.CAPABILITY;
+ case REQUIREMENTS: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.REQUIREMENTS;
+ default: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.instance.model.Conformance.UnknownContentCode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO;
+ case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS;
+ case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS;
+ case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NO: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NO;
+ case EXTENSIONS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.EXTENSIONS;
+ case ELEMENTS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.ELEMENTS;
+ case BOTH: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.BOTH;
+ default: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.ContactDetail convertConformanceContactComponent(org.hl7.fhir.instance.model.Conformance.ConformanceContactComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2518,48 +4240,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent src) throws FHIRException {
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent();
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
copyElement(src, tgt);
- tgt.setMode(convertDocumentMode(src.getMode()));
- tgt.setDocumentation(src.getDocumentation());
- tgt.setProfile(convertReference(src.getProfile()));
+ tgt.setName(src.getName());
+ tgt.setVersion(src.getVersion());
+ tgt.setReleaseDate(src.getReleaseDate());
return tgt;
}
- public org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent();
+ org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent();
copyElement(src, tgt);
- tgt.setMode(convertDocumentMode(src.getMode()));
- tgt.setDocumentation(src.getDocumentation());
- tgt.setProfile(convertReference(src.getProfile()));
+ tgt.setName(src.getName());
+ tgt.setVersion(src.getVersion());
+ tgt.setReleaseDate(src.getReleaseDate());
return tgt;
}
- public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.instance.model.Conformance.ConformanceEventMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER;
- case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case SENDER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.SENDER;
- case RECEIVER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.RECEIVER;
- default: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementImplementationComponent convertConformanceImplementationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceImplementationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2580,6 +4282,362 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent();
+ copyElement(src, tgt);
+ tgt.setMode(convertRestfulConformanceMode(src.getMode()));
+ tgt.setDocumentation(src.getDocumentation());
+ tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity()));
+ for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent t : src.getResource())
+ tgt.addResource(convertConformanceRestResourceComponent(t));
+ for (org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent t : src.getInteraction())
+ tgt.addInteraction(convertSystemInteractionComponent(t));
+ if (src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH)
+ tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH);
+ for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam())
+ tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
+ for (org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent t : src.getOperation())
+ tgt.addOperation(convertConformanceRestOperationComponent(t));
+ for (org.hl7.fhir.instance.model.UriType t : src.getCompartment())
+ tgt.addCompartment(t.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent();
+ copyElement(src, tgt);
+ tgt.setMode(convertRestfulConformanceMode(src.getMode()));
+ tgt.setDocumentation(src.getDocumentation());
+ tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity()));
+ for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
+ tgt.addResource(convertConformanceRestResourceComponent(t));
+ boolean batch = false;
+ boolean transaction = false;
+ for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) {
+ if (t.getCode().equals(SystemRestfulInteraction.BATCH))
+ batch = true;
+ else
+ tgt.addInteraction(convertSystemInteractionComponent(t));
+ if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION))
+ transaction = true;
+ }
+ if (batch)
+ tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH);
+ else
+ tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.instance.model.Conformance.TransactionMode.NOTSUPPORTED);
+ for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
+ tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
+ for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation())
+ tgt.addOperation(convertConformanceRestOperationComponent(t));
+ for (org.hl7.fhir.r4.model.UriType t : src.getCompartment())
+ tgt.addCompartment(t.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT;
+ case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CLIENT: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.CLIENT;
+ case SERVER: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.SERVER;
+ default: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.NULL;
+ }
+ }
+
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
+ copyElement(src, tgt);
+ tgt.setCors(src.getCors());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getService())
+ tgt.addService(convertCodeableConcept(t));
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate())
+ tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent();
+ copyElement(src, tgt);
+ tgt.setCors(src.getCors());
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService())
+ tgt.addService(convertCodeableConcept(t));
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate())
+ tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setBlob(src.getBlob());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setBlob(src.getBlob());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setProfile(convertReference(src.getProfile()));
+ for (org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent t : src.getInteraction())
+ tgt.addInteraction(convertResourceInteractionComponent(t));
+ tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning()));
+ tgt.setReadHistory(src.getReadHistory());
+ tgt.setUpdateCreate(src.getUpdateCreate());
+ tgt.setConditionalCreate(src.getConditionalCreate());
+ tgt.setConditionalUpdate(src.getConditionalUpdate());
+ tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete()));
+ for (org.hl7.fhir.instance.model.StringType t : src.getSearchInclude())
+ tgt.addSearchInclude(t.getValue());
+ for (org.hl7.fhir.instance.model.StringType t : src.getSearchRevInclude())
+ tgt.addSearchRevInclude(t.getValue());
+ for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam())
+ tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ if (src.hasProfile())
+ tgt.setProfile(convertReference(src.getProfile()));
+ for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
+ tgt.addInteraction(convertResourceInteractionComponent(t));
+ tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning()));
+ tgt.setReadHistory(src.getReadHistory());
+ tgt.setUpdateCreate(src.getUpdateCreate());
+ tgt.setConditionalCreate(src.getConditionalCreate());
+ tgt.setConditionalUpdate(src.getConditionalUpdate());
+ tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete()));
+ for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude())
+ tgt.addSearchInclude(t.getValue());
+ for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude())
+ tgt.addSearchRevInclude(t.getValue());
+ for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
+ tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION;
+ case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED;
+ case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NOVERSION: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NOVERSION;
+ case VERSIONED: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONED;
+ case VERSIONEDUPDATE: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE;
+ default: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NOTSUPPORTED: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NOTSUPPORTED;
+ case SINGLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.SINGLE;
+ case MULTIPLE: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.MULTIPLE;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus convertConditionalDeleteStatus(org.hl7.fhir.r4.model.CapabilityStatement.ConditionalDeleteStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NOTSUPPORTED: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NOTSUPPORTED;
+ case SINGLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.SINGLE;
+ case MULTIPLE: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.MULTIPLE;
+ default: return org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertTypeRestfulInteraction(src.getCode()));
+ tgt.setDocumentation(src.getDocumentation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertTypeRestfulInteraction(src.getCode()));
+ tgt.setDocumentation(src.getDocumentation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ;
+ case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD;
+ case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE;
+ case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE;
+ case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE;
+ case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE;
+ case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE;
+ case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case READ: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.READ;
+ case VREAD: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.VREAD;
+ case UPDATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.UPDATE;
+ case DELETE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.DELETE;
+ case HISTORYINSTANCE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE;
+ case HISTORYTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYTYPE;
+ case CREATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.CREATE;
+ case SEARCHTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.SEARCHTYPE;
+ default: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setDefinition(src.getDefinition());
+ tgt.setType(convertSearchParamType(src.getType()));
+ tgt.setDocumentation(src.getDocumentation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setDefinition(src.getDefinition());
+ tgt.setType(convertSearchParamType(src.getType()));
+ tgt.setDocumentation(src.getDocumentation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertSystemRestfulInteraction(src.getCode()));
+ tgt.setDocumentation(src.getDocumentation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertSystemRestfulInteraction(src.getCode()));
+ tgt.setDocumentation(src.getDocumentation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION;
+ case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM;
+ case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case TRANSACTION: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.TRANSACTION;
+ case SEARCHSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM;
+ case HISTORYSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM;
+ default: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setDefinition(convertReference(src.getDefinition()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setDefinition(convertReference(src.getDefinition()));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementMessagingComponent convertConformanceMessagingComponent(org.hl7.fhir.instance.model.Conformance.ConformanceMessagingComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -2658,422 +4716,87 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertConformanceResourceStatus(org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus src) throws FHIRException {
+ public org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT;
- case ACTIVE: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE;
- case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED;
- default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL;
+ case CONSEQUENCE: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE;
+ case CURRENCY: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY;
+ case NOTIFICATION: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NULL;
}
}
- public org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus convertConformanceResourceStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case DRAFT: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.DRAFT;
- case ACTIVE: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.ACTIVE;
- case RETIRED: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.RETIRED;
- default: return org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus.NULL;
+ case CONSEQUENCE: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CONSEQUENCE;
+ case CURRENCY: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CURRENCY;
+ case NOTIFICATION: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NOTIFICATION;
+ default: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NULL;
}
}
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent convertConformanceRestComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode convertConformanceEventMode(org.hl7.fhir.instance.model.Conformance.ConformanceEventMode src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent();
- copyElement(src, tgt);
- tgt.setMode(convertRestfulConformanceMode(src.getMode()));
- tgt.setDocumentation(src.getDocumentation());
- tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity()));
- for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent t : src.getResource())
- tgt.addResource(convertConformanceRestResourceComponent(t));
- for (org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent t : src.getInteraction())
- tgt.addInteraction(convertSystemInteractionComponent(t));
- if (src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH || src.getTransactionMode() == org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH)
- tgt.addInteraction().setCode(SystemRestfulInteraction.BATCH);
- for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam())
- tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
- for (org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent t : src.getOperation())
- tgt.addOperation(convertConformanceRestOperationComponent(t));
- for (org.hl7.fhir.instance.model.UriType t : src.getCompartment())
- tgt.addCompartment(t.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent convertConformanceRestComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent();
- copyElement(src, tgt);
- tgt.setMode(convertRestfulConformanceMode(src.getMode()));
- tgt.setDocumentation(src.getDocumentation());
- tgt.setSecurity(convertConformanceRestSecurityComponent(src.getSecurity()));
- for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent t : src.getResource())
- tgt.addResource(convertConformanceRestResourceComponent(t));
- boolean batch = false;
- boolean transaction = false;
- for (org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent t : src.getInteraction()) {
- if (t.getCode().equals(SystemRestfulInteraction.BATCH))
- batch = true;
- else
- tgt.addInteraction(convertSystemInteractionComponent(t));
- if (t.getCode().equals(SystemRestfulInteraction.TRANSACTION))
- transaction = true;
+ switch (src) {
+ case SENDER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.SENDER;
+ case RECEIVER: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.RECEIVER;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode.NULL;
}
- if (batch)
- tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.BOTH : org.hl7.fhir.instance.model.Conformance.TransactionMode.BATCH);
- else
- tgt.setTransactionMode(transaction ? org.hl7.fhir.instance.model.Conformance.TransactionMode.TRANSACTION : org.hl7.fhir.instance.model.Conformance.TransactionMode.NOTSUPPORTED);
- for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
- tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
- for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent t : src.getOperation())
- tgt.addOperation(convertConformanceRestOperationComponent(t));
- for (org.hl7.fhir.r4.model.UriType t : src.getCompartment())
- tgt.addCompartment(t.getValue());
- return tgt;
}
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.instance.model.Conformance.ConformanceEventMode convertConformanceEventMode(org.hl7.fhir.r4.model.CapabilityStatement.EventCapabilityMode src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setDefinition(convertReference(src.getDefinition()));
- return tgt;
+ switch (src) {
+ case SENDER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.SENDER;
+ case RECEIVER: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.RECEIVER;
+ default: return org.hl7.fhir.instance.model.Conformance.ConformanceEventMode.NULL;
+ }
}
- public org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent convertConformanceRestOperationComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestOperationComponent src) throws FHIRException {
+ public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestOperationComponent();
+ org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent();
copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setDefinition(convertReference(src.getDefinition()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
+ tgt.setMode(convertDocumentMode(src.getMode()));
+ tgt.setDocumentation(src.getDocumentation());
tgt.setProfile(convertReference(src.getProfile()));
- for (org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent t : src.getInteraction())
- tgt.addInteraction(convertResourceInteractionComponent(t));
- tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning()));
- tgt.setReadHistory(src.getReadHistory());
- tgt.setUpdateCreate(src.getUpdateCreate());
- tgt.setConditionalCreate(src.getConditionalCreate());
- tgt.setConditionalUpdate(src.getConditionalUpdate());
- tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete()));
- for (org.hl7.fhir.instance.model.StringType t : src.getSearchInclude())
- tgt.addSearchInclude(t.getValue());
- for (org.hl7.fhir.instance.model.StringType t : src.getSearchRevInclude())
- tgt.addSearchRevInclude(t.getValue());
- for (org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent t : src.getSearchParam())
- tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
return tgt;
}
- public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent convertConformanceRestResourceComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent convertConformanceDocumentComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementDocumentComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent();
+ org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceDocumentComponent();
copyElement(src, tgt);
- tgt.setType(src.getType());
- if (src.hasProfile())
- tgt.setProfile(convertReference(src.getProfile()));
- for (org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent t : src.getInteraction())
- tgt.addInteraction(convertResourceInteractionComponent(t));
- tgt.setVersioning(convertResourceVersionPolicy(src.getVersioning()));
- tgt.setReadHistory(src.getReadHistory());
- tgt.setUpdateCreate(src.getUpdateCreate());
- tgt.setConditionalCreate(src.getConditionalCreate());
- tgt.setConditionalUpdate(src.getConditionalUpdate());
- tgt.setConditionalDelete(convertConditionalDeleteStatus(src.getConditionalDelete()));
- for (org.hl7.fhir.r4.model.StringType t : src.getSearchInclude())
- tgt.addSearchInclude(t.getValue());
- for (org.hl7.fhir.r4.model.StringType t : src.getSearchRevInclude())
- tgt.addSearchRevInclude(t.getValue());
- for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent t : src.getSearchParam())
- tgt.addSearchParam(convertConformanceRestResourceSearchParamComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setDefinition(src.getDefinition());
- tgt.setType(convertSearchParamType(src.getType()));
+ tgt.setMode(convertDocumentMode(src.getMode()));
tgt.setDocumentation(src.getDocumentation());
+ tgt.setProfile(convertReference(src.getProfile()));
return tgt;
}
- public org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent convertConformanceRestResourceSearchParamComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestResourceSearchParamComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setDefinition(src.getDefinition());
- tgt.setType(convertSearchParamType(src.getType()));
- tgt.setDocumentation(src.getDocumentation());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
- tgt.setBlob(src.getBlob());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent convertConformanceRestSecurityCertificateComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
- tgt.setBlob(src.getBlob());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent();
- copyElement(src, tgt);
- tgt.setCors(src.getCors());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getService())
- tgt.addService(convertCodeableConcept(t));
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityCertificateComponent t : src.getCertificate())
- tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent convertConformanceRestSecurityComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceRestSecurityComponent();
- copyElement(src, tgt);
- tgt.setCors(src.getCors());
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getService())
- tgt.addService(convertCodeableConcept(t));
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementRestSecurityCertificateComponent t : src.getCertificate())
- tgt.addCertificate(convertConformanceRestSecurityCertificateComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setVersion(src.getVersion());
- tgt.setReleaseDate(src.getReleaseDate());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent convertConformanceSoftwareComponent(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementSoftwareComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent tgt = new org.hl7.fhir.instance.model.Conformance.ConformanceSoftwareComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setVersion(src.getVersion());
- tgt.setReleaseDate(src.getReleaseDate());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind convertConformanceStatementKind(org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind src) throws FHIRException {
+ public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.instance.model.Conformance.DocumentMode src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case INSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.INSTANCE;
- case CAPABILITY: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.CAPABILITY;
- case REQUIREMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.REQUIREMENTS;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind.NULL;
+ case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER;
+ case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER;
+ default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL;
}
}
- public org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind convertConformanceStatementKind(org.hl7.fhir.r4.model.CapabilityStatement.CapabilityStatementKind src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case INSTANCE: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.INSTANCE;
- case CAPABILITY: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.CAPABILITY;
- case REQUIREMENTS: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.REQUIREMENTS;
- default: return org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ERROR: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.ERROR;
- case WARNING: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.WARNING;
- default: return org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity convertConstraintSeverity(org.hl7.fhir.r4.model.ElementDefinition.ConstraintSeverity src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ERROR: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.ERROR;
- case WARNING: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.WARNING;
- default: return org.hl7.fhir.instance.model.ElementDefinition.ConstraintSeverity.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.instance.model.Patient.ContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRelationship())
- tgt.addRelationship(convertCodeableConcept(t));
- tgt.setName(convertHumanName(src.getName()));
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- tgt.setAddress(convertAddress(src.getAddress()));
- tgt.setGender(convertAdministrativeGender(src.getGender()));
- tgt.setOrganization(convertReference(src.getOrganization()));
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Patient.ContactComponent tgt = new org.hl7.fhir.instance.model.Patient.ContactComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship())
- tgt.addRelationship(convertCodeableConcept(t));
- tgt.setName(convertHumanName(src.getName()));
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- tgt.setAddress(convertAddress(src.getAddress()));
- tgt.setGender(convertAdministrativeGender(src.getGender()));
- tgt.setOrganization(convertReference(src.getOrganization()));
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactPoint convertContactPoint(org.hl7.fhir.instance.model.ContactPoint src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactPoint tgt = new org.hl7.fhir.r4.model.ContactPoint();
- copyElement(src, tgt);
- tgt.setSystem(convertContactPointSystem(src.getSystem()));
- tgt.setValue(src.getValue());
- tgt.setUse(convertContactPointUse(src.getUse()));
- if (src.hasRank())
- tgt.setRank(src.getRank());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ContactPoint convertContactPoint(org.hl7.fhir.r4.model.ContactPoint src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ContactPoint tgt = new org.hl7.fhir.instance.model.ContactPoint();
- copyElement(src, tgt);
- if (src.hasSystem())
- tgt.setSystem(convertContactPointSystem(src.getSystem()));
- tgt.setValue(src.getValue());
- tgt.setUse(convertContactPointUse(src.getUse()));
- tgt.setRank(src.getRank());
- if (src.hasPeriod())
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PHONE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PHONE;
- case FAX: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.FAX;
- case EMAIL: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.EMAIL;
- case PAGER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.PAGER;
- case OTHER: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.OTHER;
- default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem convertContactPointSystem(org.hl7.fhir.r4.model.ContactPoint.ContactPointSystem src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PHONE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PHONE;
- case FAX: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.FAX;
- case EMAIL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.EMAIL;
- case PAGER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.PAGER;
- case OTHER: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER;
- case URL: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.OTHER;
- default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.instance.model.ContactPoint.ContactPointUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HOME: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.HOME;
- case WORK: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.WORK;
- case TEMP: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.TEMP;
- case OLD: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.OLD;
- case MOBILE: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.MOBILE;
- default: return org.hl7.fhir.r4.model.ContactPoint.ContactPointUse.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ContactPoint.ContactPointUse convertContactPointUse(org.hl7.fhir.r4.model.ContactPoint.ContactPointUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HOME: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.HOME;
- case WORK: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.WORK;
- case TEMP: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.TEMP;
- case OLD: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.OLD;
- case MOBILE: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.MOBILE;
- default: return org.hl7.fhir.instance.model.ContactPoint.ContactPointUse.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.TestScript.ContentType convertContentType(org.hl7.fhir.instance.model.TestScript.ContentType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case XML: return org.hl7.fhir.r4.model.TestScript.ContentType.XML;
- case JSON: return org.hl7.fhir.r4.model.TestScript.ContentType.JSON;
- default: return org.hl7.fhir.r4.model.TestScript.ContentType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.TestScript.ContentType convertContentType(org.hl7.fhir.r4.model.TestScript.ContentType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case XML: return org.hl7.fhir.instance.model.TestScript.ContentType.XML;
- case JSON: return org.hl7.fhir.instance.model.TestScript.ContentType.JSON;
- default: return org.hl7.fhir.instance.model.TestScript.ContentType.NULL;
+ case PRODUCER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.PRODUCER;
+ case CONSUMER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.CONSUMER;
+ default: return org.hl7.fhir.instance.model.Conformance.DocumentMode.NULL;
}
}
@@ -3137,32 +4860,235 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Count convertCount(org.hl7.fhir.instance.model.Count src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Contract.AgentComponent convertAgentComponent(org.hl7.fhir.instance.model.Contract.ActorComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Count tgt = new org.hl7.fhir.r4.model.Count();
+ org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent();
copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
+ tgt.setActor(convertReference(src.getEntity()));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole())
+ tgt.addRole(convertCodeableConcept(t));
return tgt;
}
- public org.hl7.fhir.instance.model.Count convertCount(org.hl7.fhir.r4.model.Count src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Contract.ActorComponent convertAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Count tgt = new org.hl7.fhir.instance.model.Count();
+ org.hl7.fhir.instance.model.Contract.ActorComponent tgt = new org.hl7.fhir.instance.model.Contract.ActorComponent();
copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
+ tgt.setEntity(convertReference(src.getActor()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole())
+ tgt.addRole(convertCodeableConcept(t));
return tgt;
}
+ public org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.instance.model.Contract.SignatoryComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertCoding(src.getType()));
+ tgt.setParty(convertReference(src.getParty()));
+ if (src.hasSignature())
+ tgt.addSignature(new org.hl7.fhir.r4.model.Signature().setBlob(src.getSignature().getBytes()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.instance.model.Contract.SignatoryComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertCoding(src.getType()));
+ tgt.setParty(convertReference(src.getParty()));
+ for (org.hl7.fhir.r4.model.Signature t : src.getSignature())
+ tgt.setSignature(Base64.encodeBase64String(t.getBlob()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.instance.model.Contract.ValuedItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent();
+ copyElement(src, tgt);
+ tgt.setEntity(convertType(src.getEntity()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setEffectiveTime(src.getEffectiveTime());
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
+ tgt.setFactor(src.getFactor());
+ tgt.setPoints(src.getPoints());
+ tgt.setNet(convertMoney(src.getNet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.ValuedItemComponent();
+ copyElement(src, tgt);
+ tgt.setEntity(convertType(src.getEntity()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setEffectiveTime(src.getEffectiveTime());
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
+ tgt.setFactor(src.getFactor());
+ tgt.setPoints(src.getPoints());
+ tgt.setNet(convertMoney(src.getNet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.instance.model.Contract.TermComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setIssued(src.getIssued());
+ tgt.setApplies(convertPeriod(src.getApplies()));
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setSubType(convertCodeableConcept(src.getSubType()));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction())
+ tgt.addAction(convertCodeableConcept(t));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason())
+ tgt.addActionReason(convertCodeableConcept(t));
+ for (org.hl7.fhir.instance.model.Contract.TermActorComponent t : src.getActor())
+ tgt.addAgent(convertTermAgentComponent(t));
+ for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getGroup())
+ tgt.addGroup(convertTermComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.TermComponent tgt = new org.hl7.fhir.instance.model.Contract.TermComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setIssued(src.getIssued());
+ tgt.setApplies(convertPeriod(src.getApplies()));
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setSubType(convertCodeableConcept(src.getSubType()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction())
+ tgt.addAction(convertCodeableConcept(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getActionReason())
+ tgt.addActionReason(convertCodeableConcept(t));
+ for (org.hl7.fhir.r4.model.Contract.AgentComponent t : src.getAgent())
+ tgt.addActor(convertTermAgentComponent(t));
+ for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup())
+ tgt.addGroup(convertTermComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.instance.model.Contract.TermActorComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent();
+ copyElement(src, tgt);
+ tgt.setActor(convertReference(src.getEntity()));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole())
+ tgt.addRole(convertCodeableConcept(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.TermActorComponent tgt = new org.hl7.fhir.instance.model.Contract.TermActorComponent();
+ copyElement(src, tgt);
+ tgt.setEntity(convertReference(src.getActor()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole())
+ tgt.addRole(convertCodeableConcept(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.instance.model.Contract.TermValuedItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent();
+ copyElement(src, tgt);
+ tgt.setEntity(convertType(src.getEntity()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setEffectiveTime(src.getEffectiveTime());
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
+ tgt.setFactor(src.getFactor());
+ tgt.setPoints(src.getPoints());
+ tgt.setNet(convertMoney(src.getNet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.TermValuedItemComponent();
+ copyElement(src, tgt);
+ tgt.setEntity(convertType(src.getEntity()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setEffectiveTime(src.getEffectiveTime());
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
+ tgt.setFactor(src.getFactor());
+ tgt.setPoints(src.getPoints());
+ tgt.setNet(convertMoney(src.getNet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.instance.model.Contract.LegalLanguageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.LegalLanguageComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent convertComputableLanguageComponent(org.hl7.fhir.r4.model.Contract.ComputableLanguageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.ComputableLanguageComponent();
+ copyElement(src, tgt);
+ tgt.setContent(convertType(src.getContent()));
+ return tgt;
+ }
+
+
public org.hl7.fhir.r4.model.StructureDefinition convertDataElement(org.hl7.fhir.instance.model.DataElement src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3195,7 +5121,7 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) {
if (t.hasSlicing())
slicePaths.add(t.getPath());
- tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths));
+ tgt.getSnapshot().addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t)));
}
tgt.setKind(StructureDefinitionKind.LOGICAL);
tgt.setAbstract(false);
@@ -3205,6 +5131,66 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+// public org.hl7.fhir.instance.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.instance.model.DataElement tgt = new org.hl7.fhir.instance.model.DataElement();
+// copyDomainResource(src, tgt);
+// tgt.setUrl(src.getUrl());
+// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+// tgt.addIdentifier(convertIdentifier(t));
+// tgt.setVersion(src.getVersion());
+// tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+// if (src.hasExperimental())
+// tgt.setExperimental(src.getExperimental());
+// tgt.setPublisher(src.getPublisher());
+// if (src.hasDate())
+// tgt.setDate(src.getDate());
+// tgt.setName(src.getName());
+// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+// tgt.addContact(convertDataElementContactComponent(t));
+// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
+// if (t.hasValueCodeableConcept())
+// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
+// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
+// tgt.addUseContext(convertCodeableConcept(t));
+// tgt.setCopyright(src.getCopyright());
+// tgt.setStringency(convertDataElementStringency(src.getStringency()));
+// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping())
+// tgt.addMapping(convertDataElementMappingComponent(t));
+// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
+// tgt.addElement(convertElementDefinition(t));
+// return tgt;
+// }
+
+// public org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.instance.model.DataElement.DataElementStringency src) throws FHIRException {
+// if (src == null)
+// return null;
+// switch (src) {
+// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE;
+// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED;
+// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT;
+// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE;
+// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE;
+// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE;
+// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL;
+// }
+// }
+//
+// public org.hl7.fhir.instance.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException {
+// if (src == null)
+// return null;
+// switch (src) {
+// case COMPARABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.COMPARABLE;
+// case FULLYSPECIFIED: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FULLYSPECIFIED;
+// case EQUIVALENT: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.EQUIVALENT;
+// case CONVERTABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.CONVERTABLE;
+// case SCALEABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.SCALEABLE;
+// case FLEXIBLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FLEXIBLE;
+// default: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.NULL;
+// }
+// }
+
public org.hl7.fhir.r4.model.ContactDetail convertDataElementContactComponent(org.hl7.fhir.instance.model.DataElement.DataElementContactComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3239,126 +5225,18 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateType src) throws FHIRException {
- org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.DateType convertDate(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException {
- org.hl7.fhir.r4.model.DateType tgt = new org.hl7.fhir.r4.model.DateType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateType src) throws FHIRException {
- org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DateType convertDate(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException {
- org.hl7.fhir.instance.model.DateType tgt = new org.hl7.fhir.instance.model.DateType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
-// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException {
+// public org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException {
// if (src == null || src.isEmpty())
// return null;
-// org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent();
+// org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent();
// copyElement(src, tgt);
-// tgt.setCode(convertCarePlanRelationship(src.getCode()));
-// tgt.setPlan(convertReference(src.getPlan()));
+// tgt.setIdentity(src.getIdentity());
+// tgt.setUri(src.getUri());
+// tgt.setName(src.getName());
+// tgt.setComments(src.getComment());
// return tgt;
// }
-// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent convertCarePlanRelatedPlanComponent(org.hl7.fhir.r4.model.CarePlan.CarePlanRelatedPlanComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent tgt = new org.hl7.fhir.instance.model.CarePlan.CarePlanRelatedPlanComponent();
-// copyElement(src, tgt);
-// tgt.setCode(convertCarePlanRelationship(src.getCode()));
-// tgt.setPlan(convertReference(src.getPlan()));
-// return tgt;
-// }
-
-// public org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship src) throws FHIRException {
-// if (src == null)
-// return null;
-// switch (src) {
-// case INCLUDES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.INCLUDES;
-// case REPLACES: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.REPLACES;
-// case FULFILLS: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.FULFILLS;
-// default: return org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship.NULL;
-// }
-// }
-
-// public org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship convertCarePlanRelationship(org.hl7.fhir.r4.model.CarePlan.CarePlanRelationship src) throws FHIRException {
-// if (src == null)
-// return null;
-// switch (src) {
-// case INCLUDES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.INCLUDES;
-// case REPLACES: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.REPLACES;
-// case FULFILLS: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.FULFILLS;
-// default: return org.hl7.fhir.instance.model.CarePlan.CarePlanRelationship.NULL;
-// }
-// }
-
- public org.hl7.fhir.r4.model.DateTimeType convertDateTime(org.hl7.fhir.instance.model.DateTimeType src) throws FHIRException {
- org.hl7.fhir.r4.model.DateTimeType tgt = new org.hl7.fhir.r4.model.DateTimeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DateTimeType convertDateTime(org.hl7.fhir.r4.model.DateTimeType src) throws FHIRException {
- org.hl7.fhir.instance.model.DateTimeType tgt = new org.hl7.fhir.instance.model.DateTimeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON;
- case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE;
- case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED;
- case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU;
- case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI;
- case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT;
- case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN;
- default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MON: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.MON;
- case TUE: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.TUE;
- case WED: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.WED;
- case THU: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.THU;
- case FRI: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.FRI;
- case SAT: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SAT;
- case SUN: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SUN;
- default: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.DecimalType convertDecimal(org.hl7.fhir.instance.model.DecimalType src) throws FHIRException {
- org.hl7.fhir.r4.model.DecimalType tgt = new org.hl7.fhir.r4.model.DecimalType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DecimalType convertDecimal(org.hl7.fhir.r4.model.DecimalType src) throws FHIRException {
- org.hl7.fhir.instance.model.DecimalType tgt = new org.hl7.fhir.instance.model.DecimalType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
public org.hl7.fhir.r4.model.DetectedIssue convertDetectedIssue(org.hl7.fhir.instance.model.DetectedIssue src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3401,6 +5279,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH;
+ case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE;
+ case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW;
+ default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HIGH: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.HIGH;
+ case MODERATE: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.MODERATE;
+ case LOW: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.LOW;
+ default: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueMitigationComponent convertDetectedIssueMitigationComponent(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueMitigationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3425,50 +5325,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
-// public org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent();
-// copyElement(src, tgt);
-// tgt.setCode(convertCodeableConcept(src.getCode()));
-// for (org.hl7.fhir.instance.model.Reference t : src.getItem())
-// tgt.addItem(convertReference(t));
-// return tgt;
-// }
-//
-// public org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent convertClinicalImpressionInvestigationsComponent(org.hl7.fhir.r4.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent tgt = new org.hl7.fhir.instance.model.ClinicalImpression.ClinicalImpressionInvestigationsComponent();
-// copyElement(src, tgt);
-// tgt.setCode(convertCodeableConcept(src.getCode()));
-// for (org.hl7.fhir.r4.model.Reference t : src.getItem())
-// tgt.addItem(convertReference(t));
-// return tgt;
-// }
-
- public org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HIGH: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.HIGH;
- case MODERATE: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.MODERATE;
- case LOW: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.LOW;
- default: return org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity convertDetectedIssueSeverity(org.hl7.fhir.r4.model.DetectedIssue.DetectedIssueSeverity src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HIGH: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.HIGH;
- case MODERATE: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.MODERATE;
- case LOW: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.LOW;
- default: return org.hl7.fhir.instance.model.DetectedIssue.DetectedIssueSeverity.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.Device convertDevice(org.hl7.fhir.instance.model.Device src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3524,6 +5380,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.instance.model.Device.DeviceStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case AVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE;
+ case NOTAVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.AVAILABLE;
+ case INACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.NOTAVAILABLE;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.Device.DeviceStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.instance.model.Device.DeviceStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.DeviceComponent convertDeviceComponent(org.hl7.fhir.instance.model.DeviceComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3564,6 +5442,44 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OTHER: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OTHER;
+ case CHEMICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.CHEMICAL;
+ case ELECTRICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL;
+ case IMPEDANCE: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE;
+ case NUCLEAR: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NUCLEAR;
+ case OPTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OPTICAL;
+ case THERMAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.THERMAL;
+ case BIOLOGICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL;
+ case MECHANICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MECHANICAL;
+ case ACOUSTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL;
+ case MANUAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MANUAL;
+ default: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OTHER: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OTHER;
+ case CHEMICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.CHEMICAL;
+ case ELECTRICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL;
+ case IMPEDANCE: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE;
+ case NUCLEAR: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NUCLEAR;
+ case OPTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OPTICAL;
+ case THERMAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.THERMAL;
+ case BIOLOGICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL;
+ case MECHANICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MECHANICAL;
+ case ACOUSTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL;
+ case MANUAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MANUAL;
+ default: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.DeviceComponent.DeviceComponentProductionSpecificationComponent convertDeviceComponentProductionSpecificationComponent(org.hl7.fhir.instance.model.DeviceComponent.DeviceComponentProductionSpecificationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3624,97 +5540,25 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent();
- copyElement(src, tgt);
- tgt.setType(convertDeviceMetricCalibrationType(src.getType()));
- tgt.setState(convertDeviceMetricCalibrationState(src.getState()));
- tgt.setTime(src.getTime());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent();
- copyElement(src, tgt);
- tgt.setType(convertDeviceMetricCalibrationType(src.getType()));
- tgt.setState(convertDeviceMetricCalibrationState(src.getState()));
- tgt.setTime(src.getTime());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException {
+ public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED;
- case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED;
- case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED;
- case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED;
- default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL;
+ case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON;
+ case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF;
+ case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY;
+ default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL;
}
}
- public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException {
+ public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case NOTCALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED;
- case CALIBRATIONREQUIRED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED;
- case CALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED;
- case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED;
- default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED;
- case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET;
- case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN;
- case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT;
- default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED;
- case OFFSET: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET;
- case GAIN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.GAIN;
- case TWOPOINT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT;
- default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT;
- case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING;
- case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION;
- case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED;
- default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MEASUREMENT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT;
- case SETTING: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.SETTING;
- case CALCULATION: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.CALCULATION;
- case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED;
- default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.NULL;
+ case ON: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.ON;
+ case OFF: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.OFF;
+ case STANDBY: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY;
+ default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.NULL;
}
}
@@ -3750,47 +5594,97 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException {
+ public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ON: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.ON;
- case OFF: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.OFF;
- case STANDBY: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY;
- default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus.NULL;
+ case MEASUREMENT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT;
+ case SETTING: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.SETTING;
+ case CALCULATION: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.CALCULATION;
+ case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED;
+ default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory.NULL;
}
}
- public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus convertDeviceMetricOperationalStatus(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricOperationalStatus src) throws FHIRException {
+ public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory convertDeviceMetricCategory(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCategory src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ON: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.ON;
- case OFF: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.OFF;
- case STANDBY: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.STANDBY;
- default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricOperationalStatus.NULL;
+ case MEASUREMENT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.MEASUREMENT;
+ case SETTING: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.SETTING;
+ case CALCULATION: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.CALCULATION;
+ case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.UNSPECIFIED;
+ default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCategory.NULL;
}
}
- public org.hl7.fhir.r4.model.Device.FHIRDeviceStatus convertDeviceStatus(org.hl7.fhir.instance.model.Device.DeviceStatus src) throws FHIRException {
+ public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertDeviceMetricCalibrationType(src.getType()));
+ tgt.setState(convertDeviceMetricCalibrationState(src.getState()));
+ tgt.setTime(src.getTime());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent convertDeviceMetricCalibrationComponent(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent tgt = new org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertDeviceMetricCalibrationType(src.getType()));
+ tgt.setState(convertDeviceMetricCalibrationState(src.getState()));
+ tgt.setTime(src.getTime());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case AVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ACTIVE;
- case NOTAVAILABLE: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.INACTIVE;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.r4.model.Device.FHIRDeviceStatus.NULL;
+ case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED;
+ case OFFSET: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET;
+ case GAIN: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.GAIN;
+ case TWOPOINT: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT;
+ default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType.NULL;
}
}
- public org.hl7.fhir.instance.model.Device.DeviceStatus convertDeviceStatus(org.hl7.fhir.r4.model.Device.FHIRDeviceStatus src) throws FHIRException {
+ public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType convertDeviceMetricCalibrationType(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationType src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.AVAILABLE;
- case INACTIVE: return org.hl7.fhir.instance.model.Device.DeviceStatus.NOTAVAILABLE;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.Device.DeviceStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.instance.model.Device.DeviceStatus.NULL;
+ case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.UNSPECIFIED;
+ case OFFSET: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.OFFSET;
+ case GAIN: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.GAIN;
+ case TWOPOINT: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.TWOPOINT;
+ default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NOTCALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED;
+ case CALIBRATIONREQUIRED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED;
+ case CALIBRATED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED;
+ case UNSPECIFIED: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED;
+ default: return org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState convertDeviceMetricCalibrationState(org.hl7.fhir.r4.model.DeviceMetric.DeviceMetricCalibrationState src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NOTCALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NOTCALIBRATED;
+ case CALIBRATIONREQUIRED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATIONREQUIRED;
+ case CALIBRATED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.CALIBRATED;
+ case UNSPECIFIED: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.UNSPECIFIED;
+ default: return org.hl7.fhir.instance.model.DeviceMetric.DeviceMetricCalibrationState.NULL;
}
}
@@ -3835,6 +5729,49 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+// public org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException {
+// if (src ==/* null || src.isEmpty()*/)
+// return null;
+// switch (src) {
+// case PROPOSED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED;
+// case DRAFT: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT;
+// case PLANNED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED;
+// case REQUESTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED;
+// case RECEIVED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED;
+// case ACCEPTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED;
+// case INPROGRESS: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS;
+// case REVIEW: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW;
+// case COMPLETED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED;
+// case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED;
+// case SUSPENDED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED;
+// case REJECTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED;
+// case FAILED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED;
+// default: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.NULL;
+// }
+// }
+//
+// public org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException {
+// if (src ==/* null || src.isEmpty()*/)
+// return null;
+// switch (src) {
+// case PROPOSED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED;
+// case DRAFT: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT;
+// case PLANNED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED;
+// case REQUESTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED;
+// case RECEIVED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED;
+// case ACCEPTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED;
+// case INPROGRESS: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS;
+// case REVIEW: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW;
+// case COMPLETED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED;
+// case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED;
+// case SUSPENDED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED;
+// case REJECTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED;
+// case FAILED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED;
+// default: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.NULL;
+// }
+// }
+
+
public org.hl7.fhir.r4.model.DiagnosticReport convertDiagnosticReport(org.hl7.fhir.instance.model.DiagnosticReport src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -3901,26 +5838,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent();
- copyElement(src, tgt);
- tgt.setComment(src.getComment());
- tgt.setLink(convertReference(src.getLink()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent();
- copyElement(src, tgt);
- tgt.setComment(src.getComment());
- tgt.setLink(convertReference(src.getLink()));
- return tgt;
- }
-
public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportStatus convertDiagnosticReportStatus(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportStatus src) throws FHIRException {
if (src == null)
return null;
@@ -3951,79 +5868,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.instance.model.Media.DigitalMediaType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PHOTO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.PHOTO;
- case VIDEO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.VIDEO;
- case AUDIO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.AUDIO;
- default: return org.hl7.fhir.r4.model.Media.DigitalMediaType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r4.model.Media.DigitalMediaType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PHOTO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.PHOTO;
- case VIDEO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.VIDEO;
- case AUDIO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.AUDIO;
- default: return org.hl7.fhir.instance.model.Media.DigitalMediaType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Distance convertDistance(org.hl7.fhir.instance.model.Distance src) throws FHIRException {
+ public org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Distance tgt = new org.hl7.fhir.r4.model.Distance();
+ org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent();
copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
+ tgt.setComment(src.getComment());
+ tgt.setLink(convertReference(src.getLink()));
return tgt;
}
- public org.hl7.fhir.instance.model.Distance convertDistance(org.hl7.fhir.r4.model.Distance src) throws FHIRException {
+ public org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent convertDiagnosticReportImageComponent(org.hl7.fhir.r4.model.DiagnosticReport.DiagnosticReportImageComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Distance tgt = new org.hl7.fhir.instance.model.Distance();
+ org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent tgt = new org.hl7.fhir.instance.model.DiagnosticReport.DiagnosticReportImageComponent();
copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
+ tgt.setComment(src.getComment());
+ tgt.setLink(convertReference(src.getLink()));
return tgt;
}
- private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) {
- if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary"))
- return ReferredDocumentStatus.PRELIMINARY;
- if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final"))
- return ReferredDocumentStatus.FINAL;
- if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended"))
- return ReferredDocumentStatus.AMENDED;
- if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error"))
- return ReferredDocumentStatus.ENTEREDINERROR;
-
- return null;
- }
-
- private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) {
- CodeableConcept cc = new CodeableConcept ();
- switch (docStatus) {
- case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break;
- case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break;
- case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break;
- case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break;
- default: return null;
- }
- return cc;
- }
-
public org.hl7.fhir.r4.model.DocumentManifest convertDocumentManifest(org.hl7.fhir.instance.model.DocumentManifest src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -4066,6 +5930,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT;
+ case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CURRENT: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.CURRENT;
+ case SUPERSEDED: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.SUPERSEDED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.DocumentManifest.DocumentManifestRelatedComponent convertDocumentManifestRelatedComponent(org.hl7.fhir.instance.model.DocumentManifest.DocumentManifestRelatedComponent src) throws FHIRException {
@@ -4088,26 +5974,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode convertDocumentMode(org.hl7.fhir.instance.model.Conformance.DocumentMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PRODUCER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.PRODUCER;
- case CONSUMER: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.CONSUMER;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.DocumentMode convertDocumentMode(org.hl7.fhir.r4.model.CapabilityStatement.DocumentMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PRODUCER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.PRODUCER;
- case CONSUMER: return org.hl7.fhir.instance.model.Conformance.DocumentMode.CONSUMER;
- default: return org.hl7.fhir.instance.model.Conformance.DocumentMode.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.DocumentReference convertDocumentReference(org.hl7.fhir.instance.model.DocumentReference src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -4135,6 +6001,31 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ private ReferredDocumentStatus convertDocStatus(CodeableConcept cc) {
+ if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "preliminary"))
+ return ReferredDocumentStatus.PRELIMINARY;
+ if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "final"))
+ return ReferredDocumentStatus.FINAL;
+ if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "amended"))
+ return ReferredDocumentStatus.AMENDED;
+ if (hasConcept(cc, "http://hl7.org/fhir/composition-status", "entered-in-error"))
+ return ReferredDocumentStatus.ENTEREDINERROR;
+
+ return null;
+ }
+
+ private CodeableConcept convertDocStatus(ReferredDocumentStatus docStatus) {
+ CodeableConcept cc = new CodeableConcept ();
+ switch (docStatus) {
+ case AMENDED: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("amended"); break;
+ case ENTEREDINERROR: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("entered-in-error"); break;
+ case FINAL: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("final"); break;
+ case PRELIMINARY: cc.addCoding(). setSystem("http://hl7.org/fhir/composition-status").setCode("preliminary"); break;
+ default: return null;
+ }
+ return cc;
+ }
+
public org.hl7.fhir.instance.model.DocumentReference convertDocumentReference(org.hl7.fhir.r4.model.DocumentReference src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -4162,6 +6053,51 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+
+ public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertDocumentRelationshipType(src.getCode()));
+ tgt.setTarget(convertReference(src.getTarget()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertDocumentRelationshipType(src.getCode()));
+ tgt.setTarget(convertReference(src.getTarget()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES;
+ case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS;
+ case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS;
+ case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS;
+ default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REPLACES: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.REPLACES;
+ case TRANSFORMS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.TRANSFORMS;
+ case SIGNS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.SIGNS;
+ case APPENDS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.APPENDS;
+ default: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceContentComponent convertDocumentReferenceContentComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceContentComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -4237,376 +6173,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent();
- copyElement(src, tgt);
- tgt.setCode(convertDocumentRelationshipType(src.getCode()));
- tgt.setTarget(convertReference(src.getTarget()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent convertDocumentReferenceRelatesToComponent(org.hl7.fhir.r4.model.DocumentReference.DocumentReferenceRelatesToComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent tgt = new org.hl7.fhir.instance.model.DocumentReference.DocumentReferenceRelatesToComponent();
- copyElement(src, tgt);
- tgt.setCode(convertDocumentRelationshipType(src.getCode()));
- tgt.setTarget(convertReference(src.getTarget()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CURRENT: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.CURRENT;
- case SUPERSEDED: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.SUPERSEDED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus convertDocumentReferenceStatus(org.hl7.fhir.r4.model.Enumerations.DocumentReferenceStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CURRENT: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.CURRENT;
- case SUPERSEDED: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.SUPERSEDED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REPLACES: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.REPLACES;
- case TRANSFORMS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.TRANSFORMS;
- case SIGNS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.SIGNS;
- case APPENDS: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.APPENDS;
- default: return org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType convertDocumentRelationshipType(org.hl7.fhir.r4.model.DocumentReference.DocumentRelationshipType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REPLACES: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.REPLACES;
- case TRANSFORMS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.TRANSFORMS;
- case SIGNS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.SIGNS;
- case APPENDS: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.APPENDS;
- default: return org.hl7.fhir.instance.model.DocumentReference.DocumentRelationshipType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Duration convertDuration(org.hl7.fhir.instance.model.Duration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Duration tgt = new org.hl7.fhir.r4.model.Duration();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Duration convertDuration(org.hl7.fhir.r4.model.Duration src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Duration tgt = new org.hl7.fhir.instance.model.Duration();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition convertElementDefinition(org.hl7.fhir.instance.model.ElementDefinition src, List slicePaths) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition tgt = new org.hl7.fhir.r4.model.ElementDefinition();
- copyElement(src, tgt);
- tgt.setPath(src.getPath());
- for (org.hl7.fhir.instance.model.Enumeration t : src.getRepresentation())
- tgt.addRepresentation(convertPropertyRepresentation(t.getValue()));
- if (src.hasName()) {
- if (slicePaths.contains(src.getPath()))
- tgt.setSliceName(src.getName());
- tgt.setId(src.getName());
- }
- if (src.hasLabel())
- tgt.setLabel(src.getLabel());
- for (org.hl7.fhir.instance.model.Coding t : src.getCode())
- tgt.addCode(convertCoding(t));
- if (src.hasSlicing())
- tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing()));
- if (src.hasShort())
- tgt.setShort(src.getShort());
- if (src.hasDefinition())
- tgt.setDefinition(src.getDefinition());
- if (src.hasComments())
- tgt.setComment(src.getComments());
- if (src.hasRequirements())
- tgt.setRequirements(src.getRequirements());
- for (org.hl7.fhir.instance.model.StringType t : src.getAlias())
- tgt.addAlias(t.getValue());
- if (src.hasMin())
- tgt.setMin(src.getMin());
- if (src.hasMax())
- tgt.setMax(src.getMax());
- if (src.hasBase())
- tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
- if (src.hasNameReference())
- tgt.setContentReference("#"+src.getNameReference());
- for (org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent t : src.getType())
- tgt.addType(convertElementDefinitionTypeComponent(t));
- if (src.hasDefaultValue())
- tgt.setDefaultValue(convertType(src.getDefaultValue()));
- if (src.hasMeaningWhenMissing())
- tgt.setMeaningWhenMissing(src.getMeaningWhenMissing());
- if (src.hasFixed())
- tgt.setFixed(convertType(src.getFixed()));
- if (src.hasPattern())
- tgt.setPattern(convertType(src.getPattern()));
- if (src.hasExample())
- tgt.addExample().setLabel("General").setValue(convertType(src.getExample()));
- if (src.hasMinValue())
- tgt.setMinValue(convertType(src.getMinValue()));
- if (src.hasMaxValue())
- tgt.setMaxValue(convertType(src.getMaxValue()));
- if (src.hasMaxLength())
- tgt.setMaxLength(src.getMaxLength());
- for (org.hl7.fhir.instance.model.IdType t : src.getCondition())
- tgt.addCondition(t.getValue());
- for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint())
- tgt.addConstraint(convertElementDefinitionConstraintComponent(t));
- if (src.hasMustSupport())
- tgt.setMustSupport(src.getMustSupport());
- if (src.hasIsModifier())
- tgt.setIsModifier(src.getIsModifier());
- if (src.hasIsSummary())
- tgt.setIsSummary(src.getIsSummary());
- if (src.hasBinding())
- tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
- for (org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
- tgt.addMapping(convertElementDefinitionMappingComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition convertElementDefinition(org.hl7.fhir.r4.model.ElementDefinition src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition tgt = new org.hl7.fhir.instance.model.ElementDefinition();
- copyElement(src, tgt);
- tgt.setPath(src.getPath());
- for (org.hl7.fhir.r4.model.Enumeration t : src.getRepresentation())
- tgt.addRepresentation(convertPropertyRepresentation(t.getValue()));
- if (src.hasSliceName())
- tgt.setName(src.getSliceName());
- else
- tgt.setName(src.getId());
- tgt.setLabel(src.getLabel());
- for (org.hl7.fhir.r4.model.Coding t : src.getCode())
- tgt.addCode(convertCoding(t));
- if (src.hasSlicing())
- tgt.setSlicing(convertElementDefinitionSlicingComponent(src.getSlicing()));
- tgt.setShort(src.getShort());
- tgt.setDefinition(src.getDefinition());
- tgt.setComments(src.getComment());
- tgt.setRequirements(src.getRequirements());
- for (org.hl7.fhir.r4.model.StringType t : src.getAlias())
- tgt.addAlias(t.getValue());
- tgt.setMin(src.getMin());
- tgt.setMax(src.getMax());
- if (src.hasBase())
- tgt.setBase(convertElementDefinitionBaseComponent(src.getBase()));
- if (src.hasContentReference())
- tgt.setNameReference(src.getContentReference().substring(1));
- for (org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent t : src.getType())
- tgt.addType(convertElementDefinitionTypeComponent(t));
- tgt.setDefaultValue(convertType(src.getDefaultValue()));
- tgt.setMeaningWhenMissing(src.getMeaningWhenMissing());
- tgt.setFixed(convertType(src.getFixed()));
- tgt.setPattern(convertType(src.getPattern()));
- if (src.hasExample())
- tgt.setExample(convertType(src.getExampleFirstRep().getValue()));
- tgt.setMinValue(convertType(src.getMinValue()));
- tgt.setMaxValue(convertType(src.getMaxValue()));
- tgt.setMaxLength(src.getMaxLength());
- for (org.hl7.fhir.r4.model.IdType t : src.getCondition())
- tgt.addCondition(t.getValue());
- for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent t : src.getConstraint())
- tgt.addConstraint(convertElementDefinitionConstraintComponent(t));
- tgt.setMustSupport(src.getMustSupport());
- tgt.setIsModifier(src.getIsModifier());
- tgt.setIsSummary(src.getIsSummary());
- if (src.hasBinding())
- tgt.setBinding(convertElementDefinitionBindingComponent(src.getBinding()));
- for (org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent t : src.getMapping())
- tgt.addMapping(convertElementDefinitionMappingComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent();
- copyElement(src, tgt);
- tgt.setPath(src.getPath());
- tgt.setMin(src.getMin());
- tgt.setMax(src.getMax());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent convertElementDefinitionBaseComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBaseComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBaseComponent();
- copyElement(src, tgt);
- tgt.setPath(src.getPath());
- tgt.setMin(src.getMin());
- tgt.setMax(src.getMax());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent();
- copyElement(src, tgt);
- tgt.setStrength(convertBindingStrength(src.getStrength()));
- tgt.setDescription(src.getDescription());
- tgt.setValueSet(convertType(src.getValueSet()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent convertElementDefinitionBindingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionBindingComponent();
- copyElement(src, tgt);
- tgt.setStrength(convertBindingStrength(src.getStrength()));
- tgt.setDescription(src.getDescription());
- tgt.setValueSet(convertType(src.getValueSet()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent();
- copyElement(src, tgt);
- tgt.setKey(src.getKey());
- tgt.setRequirements(src.getRequirements());
- tgt.setSeverity(convertConstraintSeverity(src.getSeverity()));
- tgt.setHuman(src.getHuman());
- tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION));
- tgt.setXpath(src.getXpath());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent convertElementDefinitionConstraintComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionConstraintComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionConstraintComponent();
- copyElement(src, tgt);
- tgt.setKey(src.getKey());
- tgt.setRequirements(src.getRequirements());
- tgt.setSeverity(convertConstraintSeverity(src.getSeverity()));
- tgt.setHuman(src.getHuman());
- if (src.hasExpression())
- ToolingExtensions.addStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
- tgt.setXpath(src.getXpath());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent();
- copyElement(src, tgt);
- tgt.setIdentity(src.getIdentity());
- tgt.setLanguage(src.getLanguage());
- tgt.setMap(src.getMap());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent convertElementDefinitionMappingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionMappingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionMappingComponent();
- copyElement(src, tgt);
- tgt.setIdentity(src.getIdentity());
- tgt.setLanguage(src.getLanguage());
- tgt.setMap(src.getMap());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.StringType t : src.getDiscriminator())
- tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue()));
- tgt.setDescription(src.getDescription());
- tgt.setOrdered(src.getOrdered());
- tgt.setRules(convertSlicingRules(src.getRules()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent convertElementDefinitionSlicingComponent(org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.ElementDefinitionSlicingComponent();
- copyElement(src, tgt);
- for (ElementDefinitionSlicingDiscriminatorComponent t : src.getDiscriminator())
- tgt.addDiscriminator(ProfileUtilities.buildR2Discriminator(t));
- tgt.setDescription(src.getDescription());
- tgt.setOrdered(src.getOrdered());
- tgt.setRules(convertSlicingRules(src.getRules()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent();
- copyElement(src, tgt);
- tgt.setCodeElement(convertCodeToUri(src.getCodeElement()));
- for (org.hl7.fhir.instance.model.UriType t : src.getProfile())
- if (src.hasCode() && "Reference".equals(src.getCode()))
- tgt.setTargetProfile(t.getValueAsString());
- else
- tgt.setProfile(t.getValue());
- for (org.hl7.fhir.instance.model.Enumeration t : src.getAggregation())
- tgt.addAggregation(convertAggregationMode(t.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent convertElementDefinitionTypeComponent(org.hl7.fhir.r4.model.ElementDefinition.TypeRefComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent tgt = new org.hl7.fhir.instance.model.ElementDefinition.TypeRefComponent();
- copyElement(src, tgt);
- tgt.setCodeElement(convertUriToCode(src.getCodeElement()));
- if (src.hasCode() && "Reference".equals(src.getCode())) {
- if (src.hasTargetProfile())
- tgt.addProfile(src.getTargetProfile());
- } else if (src.hasProfile())
- tgt.addProfile(src.getProfile());
- for (org.hl7.fhir.r4.model.Enumeration t : src.getAggregation())
- tgt.addAggregation(convertAggregationMode(t.getValue()));
- return tgt;
- }
public org.hl7.fhir.r4.model.Encounter convertEncounter(org.hl7.fhir.instance.model.Encounter src) throws FHIRException {
if (src == null || src.isEmpty())
@@ -4676,6 +6242,34 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.instance.model.Encounter.EncounterState src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED;
+ case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED;
+ case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS;
+ case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE;
+ case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED;
+ case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED;
+ default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterState.PLANNED;
+ case ARRIVED: return org.hl7.fhir.instance.model.Encounter.EncounterState.ARRIVED;
+ case INPROGRESS: return org.hl7.fhir.instance.model.Encounter.EncounterState.INPROGRESS;
+ case ONLEAVE: return org.hl7.fhir.instance.model.Encounter.EncounterState.ONLEAVE;
+ case FINISHED: return org.hl7.fhir.instance.model.Encounter.EncounterState.FINISHED;
+ case CANCELLED: return org.hl7.fhir.instance.model.Encounter.EncounterState.CANCELLED;
+ default: return org.hl7.fhir.instance.model.Encounter.EncounterState.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Coding convertEncounterClass(org.hl7.fhir.instance.model.Encounter.EncounterClass src) throws FHIRException {
if (src == null)
return null;
@@ -4707,6 +6301,50 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return org.hl7.fhir.instance.model.Encounter.EncounterClass.NULL;
}
+// public org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent();
+// copyElement(src, tgt);
+// tgt.setStatus(convertEncounterState(src.getStatus()));
+// tgt.setPeriod(convertPeriod(src.getPeriod()));
+// return tgt;
+// }
+
+// public org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent();
+// copyElement(src, tgt);
+// tgt.setStatus(convertEncounterState(src.getStatus()));
+// tgt.setPeriod(convertPeriod(src.getPeriod()));
+// return tgt;
+// }
+
+ public org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType())
+ tgt.addType(convertCodeableConcept(t));
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ tgt.setIndividual(convertReference(src.getIndividual()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
+ tgt.addType(convertCodeableConcept(t));
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ tgt.setIndividual(convertReference(src.getIndividual()));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.Encounter.EncounterHospitalizationComponent convertEncounterHospitalizationComponent(org.hl7.fhir.instance.model.Encounter.EncounterHospitalizationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -4793,58 +6431,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType())
- tgt.addType(convertCodeableConcept(t));
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- tgt.setIndividual(convertReference(src.getIndividual()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent convertEncounterParticipantComponent(org.hl7.fhir.r4.model.Encounter.EncounterParticipantComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterParticipantComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getType())
- tgt.addType(convertCodeableConcept(t));
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- tgt.setIndividual(convertReference(src.getIndividual()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Encounter.EncounterStatus convertEncounterState(org.hl7.fhir.instance.model.Encounter.EncounterState src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PLANNED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.PLANNED;
- case ARRIVED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ARRIVED;
- case INPROGRESS: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.INPROGRESS;
- case ONLEAVE: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.ONLEAVE;
- case FINISHED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.FINISHED;
- case CANCELLED: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.CANCELLED;
- default: return org.hl7.fhir.r4.model.Encounter.EncounterStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Encounter.EncounterState convertEncounterState(org.hl7.fhir.r4.model.Encounter.EncounterStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PLANNED: return org.hl7.fhir.instance.model.Encounter.EncounterState.PLANNED;
- case ARRIVED: return org.hl7.fhir.instance.model.Encounter.EncounterState.ARRIVED;
- case INPROGRESS: return org.hl7.fhir.instance.model.Encounter.EncounterState.INPROGRESS;
- case ONLEAVE: return org.hl7.fhir.instance.model.Encounter.EncounterState.ONLEAVE;
- case FINISHED: return org.hl7.fhir.instance.model.Encounter.EncounterState.FINISHED;
- case CANCELLED: return org.hl7.fhir.instance.model.Encounter.EncounterState.CANCELLED;
- default: return org.hl7.fhir.instance.model.Encounter.EncounterState.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.EnrollmentRequest convertEnrollmentRequest(org.hl7.fhir.instance.model.EnrollmentRequest src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5003,115 +6589,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.instance.model.Timing.EventTiming src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HS: return org.hl7.fhir.r4.model.Timing.EventTiming.HS;
- case WAKE: return org.hl7.fhir.r4.model.Timing.EventTiming.WAKE;
- case C: return org.hl7.fhir.r4.model.Timing.EventTiming.C;
- case CM: return org.hl7.fhir.r4.model.Timing.EventTiming.CM;
- case CD: return org.hl7.fhir.r4.model.Timing.EventTiming.CD;
- case CV: return org.hl7.fhir.r4.model.Timing.EventTiming.CV;
- case AC: return org.hl7.fhir.r4.model.Timing.EventTiming.AC;
- case ACM: return org.hl7.fhir.r4.model.Timing.EventTiming.ACM;
- case ACD: return org.hl7.fhir.r4.model.Timing.EventTiming.ACD;
- case ACV: return org.hl7.fhir.r4.model.Timing.EventTiming.ACV;
- case PC: return org.hl7.fhir.r4.model.Timing.EventTiming.PC;
- case PCM: return org.hl7.fhir.r4.model.Timing.EventTiming.PCM;
- case PCD: return org.hl7.fhir.r4.model.Timing.EventTiming.PCD;
- case PCV: return org.hl7.fhir.r4.model.Timing.EventTiming.PCV;
- default: return org.hl7.fhir.r4.model.Timing.EventTiming.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Timing.EventTiming convertEventTiming(org.hl7.fhir.r4.model.Timing.EventTiming src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HS: return org.hl7.fhir.instance.model.Timing.EventTiming.HS;
- case WAKE: return org.hl7.fhir.instance.model.Timing.EventTiming.WAKE;
- case C: return org.hl7.fhir.instance.model.Timing.EventTiming.C;
- case CM: return org.hl7.fhir.instance.model.Timing.EventTiming.CM;
- case CD: return org.hl7.fhir.instance.model.Timing.EventTiming.CD;
- case CV: return org.hl7.fhir.instance.model.Timing.EventTiming.CV;
- case AC: return org.hl7.fhir.instance.model.Timing.EventTiming.AC;
- case ACM: return org.hl7.fhir.instance.model.Timing.EventTiming.ACM;
- case ACD: return org.hl7.fhir.instance.model.Timing.EventTiming.ACD;
- case ACV: return org.hl7.fhir.instance.model.Timing.EventTiming.ACV;
- case PC: return org.hl7.fhir.instance.model.Timing.EventTiming.PC;
- case PCM: return org.hl7.fhir.instance.model.Timing.EventTiming.PCM;
- case PCD: return org.hl7.fhir.instance.model.Timing.EventTiming.PCD;
- case PCV: return org.hl7.fhir.instance.model.Timing.EventTiming.PCV;
- default: return org.hl7.fhir.instance.model.Timing.EventTiming.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Extension convertExtension(org.hl7.fhir.instance.model.Extension src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Extension tgt = new org.hl7.fhir.r4.model.Extension();
- copyElement(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setValue(convertType(src.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Extension convertExtension(org.hl7.fhir.r4.model.Extension src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Extension tgt = new org.hl7.fhir.instance.model.Extension();
- copyElement(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setValue(convertType(src.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.RESOURCE;
- case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.DATATYPE;
- case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.EXTENSION;
- default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.RESOURCE;
- case DATATYPE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.DATATYPE;
- case EXTENSION: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.EXTENSION;
- default: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL;
- case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR;
- case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN;
- default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PARTIAL: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL;
- case COMPLETED: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR;
- case HEALTHUNKNOWN: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN;
- default: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.NULL;
- }
- }
public org.hl7.fhir.r4.model.FamilyMemberHistory convertFamilyMemberHistory(org.hl7.fhir.instance.model.FamilyMemberHistory src) throws FHIRException {
if (src == null || src.isEmpty())
@@ -5159,6 +6636,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PARTIAL: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL;
+ case COMPLETED: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR;
+ case HEALTHUNKNOWN: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN;
+ default: return org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus convertFamilyHistoryStatus(org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyHistoryStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PARTIAL: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.PARTIAL;
+ case COMPLETED: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.ENTEREDINERROR;
+ case HEALTHUNKNOWN: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.HEALTHUNKNOWN;
+ default: return org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyHistoryStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent convertFamilyMemberHistoryConditionComponent(org.hl7.fhir.instance.model.FamilyMemberHistory.FamilyMemberHistoryConditionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5183,34 +6684,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.instance.model.ValueSet.FilterOperator src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL;
- case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA;
- case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA;
- case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX;
- case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN;
- case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN;
- default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case EQUAL: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.EQUAL;
- case ISA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISA;
- case ISNOTA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISNOTA;
- case REGEX: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.REGEX;
- case IN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.IN;
- case NOTIN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NOTIN;
- default: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.Flag convertFlag(org.hl7.fhir.instance.model.Flag src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5267,24 +6740,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent();
- copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent convertFriendlyLanguageComponent(org.hl7.fhir.r4.model.Contract.FriendlyLanguageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.FriendlyLanguageComponent();
- copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
- return tgt;
- }
-
public org.hl7.fhir.r4.model.Group convertGroup(org.hl7.fhir.instance.model.Group src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5323,6 +6778,34 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.instance.model.Group.GroupType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON;
+ case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL;
+ case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER;
+ case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE;
+ case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION;
+ case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE;
+ default: return org.hl7.fhir.r4.model.Group.GroupType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PERSON: return org.hl7.fhir.instance.model.Group.GroupType.PERSON;
+ case ANIMAL: return org.hl7.fhir.instance.model.Group.GroupType.ANIMAL;
+ case PRACTITIONER: return org.hl7.fhir.instance.model.Group.GroupType.PRACTITIONER;
+ case DEVICE: return org.hl7.fhir.instance.model.Group.GroupType.DEVICE;
+ case MEDICATION: return org.hl7.fhir.instance.model.Group.GroupType.MEDICATION;
+ case SUBSTANCE: return org.hl7.fhir.instance.model.Group.GroupType.SUBSTANCE;
+ default: return org.hl7.fhir.instance.model.Group.GroupType.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Group.GroupCharacteristicComponent convertGroupCharacteristicComponent(org.hl7.fhir.instance.model.Group.GroupCharacteristicComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5369,182 +6852,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
-// public org.hl7.fhir.instance.model.DataElement convertDataElement(org.hl7.fhir.r4.model.DataElement src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.instance.model.DataElement tgt = new org.hl7.fhir.instance.model.DataElement();
-// copyDomainResource(src, tgt);
-// tgt.setUrl(src.getUrl());
-// for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
-// tgt.addIdentifier(convertIdentifier(t));
-// tgt.setVersion(src.getVersion());
-// tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
-// if (src.hasExperimental())
-// tgt.setExperimental(src.getExperimental());
-// tgt.setPublisher(src.getPublisher());
-// if (src.hasDate())
-// tgt.setDate(src.getDate());
-// tgt.setName(src.getName());
-// for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
-// tgt.addContact(convertDataElementContactComponent(t));
-// for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
-// if (t.hasValueCodeableConcept())
-// tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
-// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
-// tgt.addUseContext(convertCodeableConcept(t));
-// tgt.setCopyright(src.getCopyright());
-// tgt.setStringency(convertDataElementStringency(src.getStringency()));
-// for (org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent t : src.getMapping())
-// tgt.addMapping(convertDataElementMappingComponent(t));
-// for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
-// tgt.addElement(convertElementDefinition(t));
-// return tgt;
-// }
-
-// public org.hl7.fhir.r4.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.instance.model.DataElement.DataElementStringency src) throws FHIRException {
-// if (src == null)
-// return null;
-// switch (src) {
-// case COMPARABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.COMPARABLE;
-// case FULLYSPECIFIED: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FULLYSPECIFIED;
-// case EQUIVALENT: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.EQUIVALENT;
-// case CONVERTABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.CONVERTABLE;
-// case SCALEABLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.SCALEABLE;
-// case FLEXIBLE: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.FLEXIBLE;
-// default: return org.hl7.fhir.r4.model.DataElement.DataElementStringency.NULL;
-// }
-// }
-//
-// public org.hl7.fhir.instance.model.DataElement.DataElementStringency convertDataElementStringency(org.hl7.fhir.r4.model.DataElement.DataElementStringency src) throws FHIRException {
-// if (src == null)
-// return null;
-// switch (src) {
-// case COMPARABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.COMPARABLE;
-// case FULLYSPECIFIED: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FULLYSPECIFIED;
-// case EQUIVALENT: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.EQUIVALENT;
-// case CONVERTABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.CONVERTABLE;
-// case SCALEABLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.SCALEABLE;
-// case FLEXIBLE: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.FLEXIBLE;
-// default: return org.hl7.fhir.instance.model.DataElement.DataElementStringency.NULL;
-// }
-// }
-
- public org.hl7.fhir.r4.model.Group.GroupType convertGroupType(org.hl7.fhir.instance.model.Group.GroupType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PERSON: return org.hl7.fhir.r4.model.Group.GroupType.PERSON;
- case ANIMAL: return org.hl7.fhir.r4.model.Group.GroupType.ANIMAL;
- case PRACTITIONER: return org.hl7.fhir.r4.model.Group.GroupType.PRACTITIONER;
- case DEVICE: return org.hl7.fhir.r4.model.Group.GroupType.DEVICE;
- case MEDICATION: return org.hl7.fhir.r4.model.Group.GroupType.MEDICATION;
- case SUBSTANCE: return org.hl7.fhir.r4.model.Group.GroupType.SUBSTANCE;
- default: return org.hl7.fhir.r4.model.Group.GroupType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Group.GroupType convertGroupType(org.hl7.fhir.r4.model.Group.GroupType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PERSON: return org.hl7.fhir.instance.model.Group.GroupType.PERSON;
- case ANIMAL: return org.hl7.fhir.instance.model.Group.GroupType.ANIMAL;
- case PRACTITIONER: return org.hl7.fhir.instance.model.Group.GroupType.PRACTITIONER;
- case DEVICE: return org.hl7.fhir.instance.model.Group.GroupType.DEVICE;
- case MEDICATION: return org.hl7.fhir.instance.model.Group.GroupType.MEDICATION;
- case SUBSTANCE: return org.hl7.fhir.instance.model.Group.GroupType.SUBSTANCE;
- default: return org.hl7.fhir.instance.model.Group.GroupType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REFERENCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.REFERENCE;
- case INCLUSION: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.INCLUSION;
- default: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.NULL;
- }
- }
-
-// public org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent convertDataElementMappingComponent(org.hl7.fhir.r4.model.DataElement.DataElementMappingComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent tgt = new org.hl7.fhir.instance.model.DataElement.DataElementMappingComponent();
-// copyElement(src, tgt);
-// tgt.setIdentity(src.getIdentity());
-// tgt.setUri(src.getUri());
-// tgt.setName(src.getName());
-// tgt.setComments(src.getComment());
-// return tgt;
-// }
-
- public org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REFERENCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.REFERENCE;
- case INCLUSION: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.INCLUSION;
- default: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PAGE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.PAGE;
- case EXAMPLE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.EXAMPLE;
- case LIST: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.LIST;
- case INCLUDE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.INCLUDE;
- case DIRECTORY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DIRECTORY;
- case DICTIONARY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DICTIONARY;
- case TOC: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.TOC;
- case RESOURCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.RESOURCE;
- default: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PAGE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.PAGE;
- case EXAMPLE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.EXAMPLE;
- case LIST: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.LIST;
- case INCLUDE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.INCLUDE;
- case DIRECTORY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DIRECTORY;
- case DICTIONARY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DICTIONARY;
- case TOC: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.TOC;
- case RESOURCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.RESOURCE;
- default: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.instance.model.Bundle.HTTPVerb src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case GET: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.GET;
- case POST: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.POST;
- case PUT: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.PUT;
- case DELETE: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.DELETE;
- default: return org.hl7.fhir.r4.model.Bundle.HTTPVerb.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Bundle.HTTPVerb convertHTTPVerb(org.hl7.fhir.r4.model.Bundle.HTTPVerb src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case GET: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.GET;
- case POST: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.POST;
- case PUT: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.PUT;
- case DELETE: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.DELETE;
- default: return org.hl7.fhir.instance.model.Bundle.HTTPVerb.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.HealthcareService convertHealthcareService(org.hl7.fhir.instance.model.HealthcareService src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5661,6 +6968,36 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case MON: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.MON;
+ case TUE: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.TUE;
+ case WED: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.WED;
+ case THU: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.THU;
+ case FRI: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.FRI;
+ case SAT: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SAT;
+ case SUN: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.SUN;
+ default: return org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek convertDaysOfWeek(org.hl7.fhir.r4.model.HealthcareService.DaysOfWeek src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case MON: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.MON;
+ case TUE: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.TUE;
+ case WED: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.WED;
+ case THU: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.THU;
+ case FRI: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.FRI;
+ case SAT: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SAT;
+ case SUN: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.SUN;
+ default: return org.hl7.fhir.instance.model.HealthcareService.DaysOfWeek.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.HealthcareService.HealthcareServiceNotAvailableComponent convertHealthcareServiceNotAvailableComponent(org.hl7.fhir.instance.model.HealthcareService.HealthcareServiceNotAvailableComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -5681,138 +7018,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.HumanName convertHumanName(org.hl7.fhir.instance.model.HumanName src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.HumanName tgt = new org.hl7.fhir.r4.model.HumanName();
- copyElement(src, tgt);
- tgt.setUse(convertNameUse(src.getUse()));
- tgt.setText(src.getText());
- for (org.hl7.fhir.instance.model.StringType t : src.getFamily())
- tgt.setFamily(t.getValue());
- for (org.hl7.fhir.instance.model.StringType t : src.getGiven())
- tgt.addGiven(t.getValue());
- for (org.hl7.fhir.instance.model.StringType t : src.getPrefix())
- tgt.addPrefix(t.getValue());
- for (org.hl7.fhir.instance.model.StringType t : src.getSuffix())
- tgt.addSuffix(t.getValue());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.HumanName convertHumanName(org.hl7.fhir.r4.model.HumanName src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.HumanName tgt = new org.hl7.fhir.instance.model.HumanName();
- copyElement(src, tgt);
- tgt.setUse(convertNameUse(src.getUse()));
- tgt.setText(src.getText());
- if (src.hasFamily())
- tgt.addFamily(src.getFamily());
- for (org.hl7.fhir.r4.model.StringType t : src.getGiven())
- tgt.addGiven(t.getValue());
- for (org.hl7.fhir.r4.model.StringType t : src.getPrefix())
- tgt.addPrefix(t.getValue());
- for (org.hl7.fhir.r4.model.StringType t : src.getSuffix())
- tgt.addSuffix(t.getValue());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.IdType convertId(org.hl7.fhir.instance.model.IdType src) throws FHIRException {
- org.hl7.fhir.r4.model.IdType tgt = new org.hl7.fhir.r4.model.IdType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.IdType convertId(org.hl7.fhir.r4.model.IdType src) throws FHIRException {
- org.hl7.fhir.instance.model.IdType tgt = new org.hl7.fhir.instance.model.IdType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Identifier convertIdentifier(org.hl7.fhir.instance.model.Identifier src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Identifier tgt = new org.hl7.fhir.r4.model.Identifier();
- copyElement(src, tgt);
- tgt.setUse(convertIdentifierUse(src.getUse()));
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setSystem(src.getSystem());
- tgt.setValue(src.getValue());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- tgt.setAssigner(convertReference(src.getAssigner()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Identifier convertIdentifier(org.hl7.fhir.r4.model.Identifier src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Identifier tgt = new org.hl7.fhir.instance.model.Identifier();
- copyElement(src, tgt);
- if (src.hasUse())
- tgt.setUse(convertIdentifierUse(src.getUse()));
- if (src.hasType())
- tgt.setType(convertCodeableConcept(src.getType()));
- if (src.hasSystem())
- tgt.setSystem(src.getSystem());
- if (src.hasValue())
- tgt.setValue(src.getValue());
- if (src.hasPeriod())
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- if (src.hasAssigner())
- tgt.setAssigner(convertReference(src.getAssigner()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.instance.model.Identifier.IdentifierUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case USUAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.USUAL;
- case OFFICIAL: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.OFFICIAL;
- case TEMP: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.TEMP;
- case SECONDARY: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.SECONDARY;
- default: return org.hl7.fhir.r4.model.Identifier.IdentifierUse.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Identifier.IdentifierUse convertIdentifierUse(org.hl7.fhir.r4.model.Identifier.IdentifierUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case USUAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.USUAL;
- case OFFICIAL: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.OFFICIAL;
- case TEMP: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.TEMP;
- case SECONDARY: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.SECONDARY;
- default: return org.hl7.fhir.instance.model.Identifier.IdentifierUse.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1;
- case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2;
- case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3;
- case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4;
- default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case LEVEL1: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL1;
- case LEVEL2: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL2;
- case LEVEL3: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL3;
- case LEVEL4: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL4;
- default: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.NULL;
- }
- }
-
// public org.hl7.fhir.r4.model.ImagingObjectSelection convertImagingObjectSelection(org.hl7.fhir.instance.model.ImagingObjectSelection src) throws FHIRException {
// if (src == null || src.isEmpty())
// return null;
@@ -5996,6 +7201,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ONLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.ONLINE;
+ case OFFLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.OFFLINE;
+ case NEARLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NEARLINE;
+ case UNAVAILABLE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.UNAVAILABLE;
+ default: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ONLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.ONLINE;
+ case OFFLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.OFFLINE;
+ case NEARLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NEARLINE;
+ case UNAVAILABLE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.UNAVAILABLE;
+ default: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.ImagingStudy.ImagingStudySeriesComponent convertImagingStudySeriesComponent(org.hl7.fhir.instance.model.ImagingStudy.ImagingStudySeriesComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -6132,6 +7361,38 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ private org.hl7.fhir.r4.model.Reference getPerformer(List practitioner) {
+ for (ImmunizationPractitionerComponent p : practitioner) {
+ if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP"))
+ return p.getActor();
+ }
+ return null;
+ }
+
+ private org.hl7.fhir.r4.model.Reference getRequester(List practitioner) {
+ for (ImmunizationPractitionerComponent p : practitioner) {
+ if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP"))
+ return p.getActor();
+ }
+ return null;
+ }
+
+ private boolean hasConcept(org.hl7.fhir.r4.model.CodeableConcept cc, String system, String code) {
+ for (org.hl7.fhir.r4.model.Coding c : cc.getCoding()) {
+ if (system.equals(c.getSystem()) && code.equals(c.getCode()))
+ return true;
+ }
+ return false;
+ }
+
+ private boolean hasConcept(org.hl7.fhir.instance.model.CodeableConcept cc, String system, String code) {
+ for (org.hl7.fhir.instance.model.Coding c : cc.getCoding()) {
+ if (system.equals(c.getSystem()) && code.equals(c.getCode()))
+ return true;
+ }
+ return false;
+ }
+
public org.hl7.fhir.r4.model.Immunization.ImmunizationExplanationComponent convertImmunizationExplanationComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationExplanationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -6168,48 +7429,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
-// public org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus convertDiagnosticOrderStatus(org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus src) throws FHIRException {
-// if (src ==/* null || src.isEmpty()*/)
-// return null;
-// switch (src) {
-// case PROPOSED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PROPOSED;
-// case DRAFT: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.DRAFT;
-// case PLANNED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.PLANNED;
-// case REQUESTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REQUESTED;
-// case RECEIVED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.RECEIVED;
-// case ACCEPTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.ACCEPTED;
-// case INPROGRESS: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.INPROGRESS;
-// case REVIEW: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REVIEW;
-// case COMPLETED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.COMPLETED;
-// case CANCELLED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.CANCELLED;
-// case SUSPENDED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.SUSPENDED;
-// case REJECTED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.REJECTED;
-// case FAILED: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.FAILED;
-// default: return org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus.NULL;
-// }
-// }
-//
-// public org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus convertDiagnosticOrderStatus(org.hl7.fhir.r4.model.DiagnosticRequest.DiagnosticRequestStatus src) throws FHIRException {
-// if (src ==/* null || src.isEmpty()*/)
-// return null;
-// switch (src) {
-// case PROPOSED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PROPOSED;
-// case DRAFT: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.DRAFT;
-// case PLANNED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.PLANNED;
-// case REQUESTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REQUESTED;
-// case RECEIVED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.RECEIVED;
-// case ACCEPTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.ACCEPTED;
-// case INPROGRESS: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.INPROGRESS;
-// case REVIEW: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REVIEW;
-// case COMPLETED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.COMPLETED;
-// case CANCELLED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.CANCELLED;
-// case SUSPENDED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.SUSPENDED;
-// case REJECTED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.REJECTED;
-// case FAILED: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.FAILED;
-// default: return org.hl7.fhir.instance.model.DiagnosticOrder.DiagnosticOrderStatus.NULL;
-// }
-// }
-
public org.hl7.fhir.instance.model.Immunization.ImmunizationReactionComponent convertImmunizationReactionComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationReactionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -6222,6 +7441,40 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent();
+ copyElement(src, tgt);
+ tgt.setDoseSequence(src.getDoseSequence());
+ tgt.setDescription(src.getDescription());
+ tgt.setAuthority(convertReference(src.getAuthority()));
+ tgt.setSeries(src.getSeries());
+ tgt.setSeriesDoses(src.getSeriesDoses());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getTargetDisease())
+ tgt.addTargetDisease(convertCodeableConcept(t));
+ tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus()));
+ tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent();
+ copyElement(src, tgt);
+ tgt.setDoseSequence(src.getDoseSequence());
+ tgt.setDescription(src.getDescription());
+ tgt.setAuthority(convertReference(src.getAuthority()));
+ tgt.setSeries(src.getSeries());
+ tgt.setSeriesDoses(src.getSeriesDoses());
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTargetDisease())
+ tgt.addTargetDisease(convertCodeableConcept(t));
+ tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus()));
+ tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason()));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.ImmunizationRecommendation convertImmunizationRecommendation(org.hl7.fhir.instance.model.ImmunizationRecommendation src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -6332,40 +7585,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent();
- copyElement(src, tgt);
- tgt.setDoseSequence(src.getDoseSequence());
- tgt.setDescription(src.getDescription());
- tgt.setAuthority(convertReference(src.getAuthority()));
- tgt.setSeries(src.getSeries());
- tgt.setSeriesDoses(src.getSeriesDoses());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getTargetDisease())
- tgt.addTargetDisease(convertCodeableConcept(t));
- tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus()));
- tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent convertImmunizationVaccinationProtocolComponent(org.hl7.fhir.r4.model.Immunization.ImmunizationVaccinationProtocolComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent tgt = new org.hl7.fhir.instance.model.Immunization.ImmunizationVaccinationProtocolComponent();
- copyElement(src, tgt);
- tgt.setDoseSequence(src.getDoseSequence());
- tgt.setDescription(src.getDescription());
- tgt.setAuthority(convertReference(src.getAuthority()));
- tgt.setSeries(src.getSeries());
- tgt.setSeriesDoses(src.getSeriesDoses());
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getTargetDisease())
- tgt.addTargetDisease(convertCodeableConcept(t));
- tgt.setDoseStatus(convertCodeableConcept(src.getDoseStatus()));
- tgt.setDoseStatusReason(convertCodeableConcept(src.getDoseStatusReason()));
- return tgt;
- }
-
public org.hl7.fhir.r4.model.ImplementationGuide convertImplementationGuide(org.hl7.fhir.instance.model.ImplementationGuide src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -6480,24 +7699,24 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
- tgt.setProfile(convertReference(src.getProfile()));
- return tgt;
+ switch (src) {
+ case REFERENCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.REFERENCE;
+ case INCLUSION: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.INCLUSION;
+ default: return org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType.NULL;
+ }
}
- public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType convertGuideDependencyType(org.hl7.fhir.r4.model.ImplementationGuide.GuideDependencyType src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent();
- copyElement(src, tgt);
- tgt.setType(src.getType());
- tgt.setProfile(convertReference(src.getProfile()));
- return tgt;
+ switch (src) {
+ case REFERENCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.REFERENCE;
+ case INCLUSION: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.INCLUSION;
+ default: return org.hl7.fhir.instance.model.ImplementationGuide.GuideDependencyType.NULL;
+ }
}
public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuidePackageComponent convertImplementationGuidePackageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePackageComponent src) throws FHIRException {
@@ -6555,6 +7774,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setProfile(convertReference(src.getProfile()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent convertImplementationGuideGlobalComponent(org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuideGlobalComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent tgt = new org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuideGlobalComponent();
+ copyElement(src, tgt);
+ tgt.setType(src.getType());
+ tgt.setProfile(convertReference(src.getProfile()));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.ImplementationGuide.ImplementationGuidePageComponent convertImplementationGuidePageComponent(org.hl7.fhir.instance.model.ImplementationGuide.ImplementationGuidePageComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -6591,348 +7830,38 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability src) throws FHIRException {
+ public org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ONLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.ONLINE;
- case OFFLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.OFFLINE;
- case NEARLINE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NEARLINE;
- case UNAVAILABLE: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.UNAVAILABLE;
- default: return org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability.NULL;
+ case PAGE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.PAGE;
+ case EXAMPLE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.EXAMPLE;
+ case LIST: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.LIST;
+ case INCLUDE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.INCLUDE;
+ case DIRECTORY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DIRECTORY;
+ case DICTIONARY: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.DICTIONARY;
+ case TOC: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.TOC;
+ case RESOURCE: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.RESOURCE;
+ default: return org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind.NULL;
}
}
- public org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability convertInstanceAvailability(org.hl7.fhir.r4.model.ImagingStudy.InstanceAvailability src) throws FHIRException {
+ public org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind convertGuidePageKind(org.hl7.fhir.r4.model.ImplementationGuide.GuidePageKind src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ONLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.ONLINE;
- case OFFLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.OFFLINE;
- case NEARLINE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NEARLINE;
- case UNAVAILABLE: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.UNAVAILABLE;
- default: return org.hl7.fhir.instance.model.ImagingStudy.InstanceAvailability.NULL;
+ case PAGE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.PAGE;
+ case EXAMPLE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.EXAMPLE;
+ case LIST: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.LIST;
+ case INCLUDE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.INCLUDE;
+ case DIRECTORY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DIRECTORY;
+ case DICTIONARY: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.DICTIONARY;
+ case TOC: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.TOC;
+ case RESOURCE: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.RESOURCE;
+ default: return org.hl7.fhir.instance.model.ImplementationGuide.GuidePageKind.NULL;
}
}
- public org.hl7.fhir.r4.model.InstantType convertInstant(org.hl7.fhir.instance.model.InstantType src) throws FHIRException {
- org.hl7.fhir.r4.model.InstantType tgt = new org.hl7.fhir.r4.model.InstantType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.InstantType convertInstant(org.hl7.fhir.r4.model.InstantType src) throws FHIRException {
- org.hl7.fhir.instance.model.InstantType tgt = new org.hl7.fhir.instance.model.InstantType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.IntegerType convertInteger(org.hl7.fhir.instance.model.IntegerType src) throws FHIRException {
- org.hl7.fhir.r4.model.IntegerType tgt = new org.hl7.fhir.r4.model.IntegerType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.IntegerType convertInteger(org.hl7.fhir.r4.model.IntegerType src) throws FHIRException {
- org.hl7.fhir.instance.model.IntegerType tgt = new org.hl7.fhir.instance.model.IntegerType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL;
- case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR;
- case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING;
- case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION;
- default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case FATAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.FATAL;
- case ERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR;
- case WARNING: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING;
- case INFORMATION: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION;
- default: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.instance.model.OperationOutcome.IssueType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID;
- case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE;
- case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED;
- case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE;
- case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT;
- case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY;
- case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN;
- case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN;
- case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED;
- case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN;
- case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED;
- case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING;
- case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED;
- case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE;
- case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND;
- case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG;
- case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID;
- case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION;
- case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY;
- case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE;
- case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT;
- case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE;
- case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT;
- case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR;
- case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE;
- case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION;
- case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT;
- case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED;
- case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL;
- default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL;
- }
- }
-
-// public org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent();
-// copyElement(src, tgt);
-// tgt.setStatus(convertEncounterState(src.getStatus()));
-// tgt.setPeriod(convertPeriod(src.getPeriod()));
-// return tgt;
-// }
-
-// public org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent convertEncounterStatusHistoryComponent(org.hl7.fhir.r4.model.Encounter.EncounterStatusHistoryComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent tgt = new org.hl7.fhir.instance.model.Encounter.EncounterStatusHistoryComponent();
-// copyElement(src, tgt);
-// tgt.setStatus(convertEncounterState(src.getStatus()));
-// tgt.setPeriod(convertPeriod(src.getPeriod()));
-// return tgt;
-// }
-
- public org.hl7.fhir.instance.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID;
- case STRUCTURE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.STRUCTURE;
- case REQUIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.REQUIRED;
- case VALUE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.VALUE;
- case INVARIANT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVARIANT;
- case SECURITY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SECURITY;
- case LOGIN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOGIN;
- case UNKNOWN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.UNKNOWN;
- case EXPIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXPIRED;
- case FORBIDDEN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.FORBIDDEN;
- case SUPPRESSED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SUPPRESSED;
- case PROCESSING: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.PROCESSING;
- case NOTSUPPORTED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTSUPPORTED;
- case DUPLICATE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.DUPLICATE;
- case NOTFOUND: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTFOUND;
- case TOOLONG: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOLONG;
- case CODEINVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CODEINVALID;
- case EXTENSION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXTENSION;
- case TOOCOSTLY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOCOSTLY;
- case BUSINESSRULE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.BUSINESSRULE;
- case CONFLICT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CONFLICT;
- case INCOMPLETE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INCOMPLETE;
- case TRANSIENT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TRANSIENT;
- case LOCKERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOCKERROR;
- case NOSTORE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOSTORE;
- case EXCEPTION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXCEPTION;
- case TIMEOUT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TIMEOUT;
- case THROTTLED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.THROTTLED;
- case INFORMATIONAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INFORMATIONAL;
- default: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent();
- copyElement(src, tgt);
- tgt.setSequenceLinkId(src.getSequenceLinkId());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent();
- copyElement(src, tgt);
- tgt.setSequenceLinkId(src.getSequenceLinkId());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.instance.model.Contract.LegalLanguageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.r4.model.Contract.LegalLanguageComponent();
- copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.LegalLanguageComponent convertLegalLanguageComponent(org.hl7.fhir.r4.model.Contract.LegalLanguageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.LegalLanguageComponent tgt = new org.hl7.fhir.instance.model.Contract.LegalLanguageComponent();
- copyElement(src, tgt);
- tgt.setContent(convertType(src.getContent()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.instance.model.Patient.LinkType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REPLACE: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY;
- case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER;
- case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO;
- default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REPLACEDBY: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE;
- case REPLACES: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE;
- case REFER: return org.hl7.fhir.instance.model.Patient.LinkType.REFER;
- case SEEALSO: return org.hl7.fhir.instance.model.Patient.LinkType.SEEALSO;
- default: return org.hl7.fhir.instance.model.Patient.LinkType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setTitle(src.getTitle());
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setSubject(convertReference(src.getSubject()));
- tgt.setSource(convertReference(src.getSource()));
- tgt.setEncounter(convertReference(src.getEncounter()));
- tgt.setStatus(convertListStatus(src.getStatus()));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
- tgt.setMode(convertListMode(src.getMode()));
- if (src.hasNote())
- tgt.addNote(new org.hl7.fhir.r4.model.Annotation().setText(src.getNote()));
- for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry())
- tgt.addEntry(convertListEntry(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setTitle(src.getTitle());
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setSubject(convertReference(src.getSubject()));
- tgt.setSource(convertReference(src.getSource()));
- tgt.setEncounter(convertReference(src.getEncounter()));
- tgt.setStatus(convertListStatus(src.getStatus()));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
- tgt.setMode(convertListMode(src.getMode()));
- for (org.hl7.fhir.r4.model.Annotation t : src.getNote())
- tgt.setNote(t.getText());
- for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry())
- tgt.addEntry(convertListEntry(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.instance.model.List_.ListEntryComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent();
- copyBackboneElement(src, tgt);
- tgt.setFlag(convertCodeableConcept(src.getFlag()));
- tgt.setDeleted(src.getDeleted());
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setItem(convertReference(src.getItem()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.List_.ListEntryComponent tgt = new org.hl7.fhir.instance.model.List_.ListEntryComponent();
- copyBackboneElement(src, tgt);
- tgt.setFlag(convertCodeableConcept(src.getFlag()));
- tgt.setDeleted(src.getDeleted());
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setItem(convertReference(src.getItem()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.instance.model.List_.ListMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING;
- case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT;
- case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES;
- default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.List_.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case WORKING: return org.hl7.fhir.instance.model.List_.ListMode.WORKING;
- case SNAPSHOT: return org.hl7.fhir.instance.model.List_.ListMode.SNAPSHOT;
- case CHANGES: return org.hl7.fhir.instance.model.List_.ListMode.CHANGES;
- default: return org.hl7.fhir.instance.model.List_.ListMode.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.instance.model.List_.ListStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT;
- case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.List_.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CURRENT: return org.hl7.fhir.instance.model.List_.ListStatus.CURRENT;
- case RETIRED: return org.hl7.fhir.instance.model.List_.ListStatus.RETIRED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.List_.ListStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.instance.model.List_.ListStatus.NULL;
- }
- }
public org.hl7.fhir.r4.model.Location convertLocation(org.hl7.fhir.instance.model.Location src) throws FHIRException {
if (src == null || src.isEmpty())
@@ -6978,6 +7907,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.instance.model.Location.LocationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE;
+ case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED;
+ case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE;
+ default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.ACTIVE;
+ case SUSPENDED: return org.hl7.fhir.instance.model.Location.LocationStatus.SUSPENDED;
+ case INACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.INACTIVE;
+ default: return org.hl7.fhir.instance.model.Location.LocationStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Location.LocationMode convertLocationMode(org.hl7.fhir.instance.model.Location.LocationMode src) throws FHIRException {
if (src == null)
return null;
@@ -7020,78 +7971,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.instance.model.Location.LocationStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.ACTIVE;
- case SUSPENDED: return org.hl7.fhir.r4.model.Location.LocationStatus.SUSPENDED;
- case INACTIVE: return org.hl7.fhir.r4.model.Location.LocationStatus.INACTIVE;
- default: return org.hl7.fhir.r4.model.Location.LocationStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Location.LocationStatus convertLocationStatus(org.hl7.fhir.r4.model.Location.LocationStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.ACTIVE;
- case SUSPENDED: return org.hl7.fhir.instance.model.Location.LocationStatus.SUSPENDED;
- case INACTIVE: return org.hl7.fhir.instance.model.Location.LocationStatus.INACTIVE;
- default: return org.hl7.fhir.instance.model.Location.LocationStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.MarkdownType convertMarkdown(org.hl7.fhir.instance.model.MarkdownType src) throws FHIRException {
- org.hl7.fhir.r4.model.MarkdownType tgt = new org.hl7.fhir.r4.model.MarkdownType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MarkdownType convertMarkdown(org.hl7.fhir.r4.model.MarkdownType src) throws FHIRException {
- org.hl7.fhir.instance.model.MarkdownType tgt = new org.hl7.fhir.instance.model.MarkdownType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OTHER: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OTHER;
- case CHEMICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.CHEMICAL;
- case ELECTRICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL;
- case IMPEDANCE: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE;
- case NUCLEAR: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NUCLEAR;
- case OPTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.OPTICAL;
- case THERMAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.THERMAL;
- case BIOLOGICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL;
- case MECHANICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MECHANICAL;
- case ACOUSTICAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL;
- case MANUAL: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.MANUAL;
- default: return org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple convertMeasmntPrinciple(org.hl7.fhir.r4.model.DeviceComponent.MeasmntPrinciple src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OTHER: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OTHER;
- case CHEMICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.CHEMICAL;
- case ELECTRICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ELECTRICAL;
- case IMPEDANCE: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.IMPEDANCE;
- case NUCLEAR: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NUCLEAR;
- case OPTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.OPTICAL;
- case THERMAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.THERMAL;
- case BIOLOGICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.BIOLOGICAL;
- case MECHANICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MECHANICAL;
- case ACOUSTICAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.ACOUSTICAL;
- case MANUAL: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.MANUAL;
- default: return org.hl7.fhir.instance.model.DeviceComponent.MeasmntPrinciple.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.Media convertMedia(org.hl7.fhir.instance.model.Media src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -7134,6 +8013,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.instance.model.Media.DigitalMediaType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PHOTO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.PHOTO;
+ case VIDEO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.VIDEO;
+ case AUDIO: return org.hl7.fhir.r4.model.Media.DigitalMediaType.AUDIO;
+ default: return org.hl7.fhir.r4.model.Media.DigitalMediaType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Media.DigitalMediaType convertDigitalMediaType(org.hl7.fhir.r4.model.Media.DigitalMediaType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PHOTO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.PHOTO;
+ case VIDEO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.VIDEO;
+ case AUDIO: return org.hl7.fhir.instance.model.Media.DigitalMediaType.AUDIO;
+ default: return org.hl7.fhir.instance.model.Media.DigitalMediaType.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.Medication convertMedication(org.hl7.fhir.instance.model.Medication src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -7160,1128 +8061,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.instance.model.MedicationDispense src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense();
- copyDomainResource(src, tgt);
- tgt.addIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setStatus(convertMedicationDispenseStatus(src.getStatus()));
- tgt.setMedication(convertType(src.getMedication()));
- tgt.setSubject(convertReference(src.getPatient()));
-// tgt.setDispenser(convertReference(src.getDispenser()));
- for (org.hl7.fhir.instance.model.Reference t : src.getAuthorizingPrescription())
- tgt.addAuthorizingPrescription(convertReference(t));
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply()));
- tgt.setWhenPrepared(src.getWhenPrepared());
- tgt.setWhenHandedOver(src.getWhenHandedOver());
- tgt.setDestination(convertReference(src.getDestination()));
- for (org.hl7.fhir.instance.model.Reference t : src.getReceiver())
- tgt.addReceiver(convertReference(t));
- if (src.hasNote())
- tgt.addNote().setText(src.getNote());
- for (org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction())
- tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t));
- tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MedicationDispense tgt = new org.hl7.fhir.instance.model.MedicationDispense();
- copyDomainResource(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep()));
- tgt.setStatus(convertMedicationDispenseStatus(src.getStatus()));
- tgt.setMedication(convertType(src.getMedication()));
- tgt.setPatient(convertReference(src.getSubject()));
-// tgt.setDispenser(convertReference(src.getDispenser()));
- for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription())
- tgt.addAuthorizingPrescription(convertReference(t));
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply()));
- tgt.setWhenPrepared(src.getWhenPrepared());
- tgt.setWhenHandedOver(src.getWhenHandedOver());
- tgt.setDestination(convertReference(src.getDestination()));
- for (org.hl7.fhir.r4.model.Reference t : src.getReceiver())
- tgt.addReceiver(convertReference(t));
- for (org.hl7.fhir.r4.model.Annotation t : src.getNote())
- tgt.setNote(t.getText());
- for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction())
- tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t));
- tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
- copyElement(src, tgt);
- tgt.setText(src.getText());
-// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
- tgt.setTiming(convertTiming(src.getTiming()));
- tgt.setAsNeeded(convertType(src.getAsNeeded()));
- if (src.hasSiteCodeableConcept())
- tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept()));
- tgt.setRoute(convertCodeableConcept(src.getRoute()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- tgt.setDose(convertType(src.getDose()));
- tgt.setRate(convertType(src.getRate()));
- tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent();
- copyElement(src, tgt);
- tgt.setText(src.getText());
-// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
- tgt.setTiming(convertTiming(src.getTiming()));
- tgt.setAsNeeded(convertType(src.getAsNeeded()));
- tgt.setSite(convertType(src.getSite()));
- tgt.setRoute(convertCodeableConcept(src.getRoute()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- tgt.setDose(convertType(src.getDose()));
- tgt.setRate(convertType(src.getRate()));
- tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS;
- case ONHOLD: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ONHOLD;
- case COMPLETED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR;
- case STOPPED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.STOPPED;
- default: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS;
- case ONHOLD: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ONHOLD;
- case COMPLETED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR;
- case STOPPED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.STOPPED;
- default: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent();
- copyElement(src, tgt);
- tgt.setType(convertCodeableConcept(src.getType()));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason())
- tgt.addReason(convertCodeableConcept(t));
- for (org.hl7.fhir.instance.model.Reference t : src.getResponsibleParty())
- tgt.addResponsibleParty(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent();
- copyElement(src, tgt);
- tgt.setType(convertCodeableConcept(src.getType()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason())
- tgt.addReason(convertCodeableConcept(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty())
- tgt.addResponsibleParty(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
- copyElement(src, tgt);
- tgt.setText(src.getText());
-// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
- tgt.setTiming(convertTiming(src.getTiming()));
- tgt.setAsNeeded(convertType(src.getAsNeeded()));
- if (src.hasSiteCodeableConcept())
- tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept()));
- tgt.setRoute(convertCodeableConcept(src.getRoute()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- tgt.setDose(convertType(src.getDose()));
- tgt.setRate(convertType(src.getRate()));
- tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent();
- copyElement(src, tgt);
- tgt.setText(src.getText());
-// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
- tgt.setTiming(convertTiming(src.getTiming()));
- tgt.setAsNeeded(convertType(src.getAsNeeded()));
- tgt.setSite(convertType(src.getSite()));
- tgt.setRoute(convertCodeableConcept(src.getRoute()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- tgt.setDose(convertType(src.getDose()));
- tgt.setRate(convertType(src.getRate()));
- tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageComponent();
- copyElement(src, tgt);
- tgt.setContainer(convertCodeableConcept(src.getContainer()));
- for (org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent t : src.getContent())
- tgt.addContent(convertMedicationPackageContentComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageComponent();
- copyElement(src, tgt);
- tgt.setContainer(convertCodeableConcept(src.getContainer()));
- for (org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent t : src.getContent())
- tgt.addContent(convertMedicationPackageContentComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent();
- copyElement(src, tgt);
- tgt.setItem(convertType(src.getItem()));
- tgt.setAmount(convertSimpleQuantity(src.getAmount()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent();
- copyElement(src, tgt);
- if (src.hasItemReference())
- tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem()));
- tgt.setAmount(convertSimpleQuantity(src.getAmount()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.instance.model.MedicationStatement src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setStatus(convertMedicationStatementStatus(src.getStatus()));
- tgt.setMedication(convertType(src.getMedication()));
- tgt.setSubject(convertReference(src.getPatient()));
- tgt.setEffective(convertType(src.getEffective()));
- tgt.setInformationSource(convertReference(src.getInformationSource()));
- for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation())
- tgt.addDerivedFrom(convertReference(t));
- if (src.hasDateAsserted())
- tgt.setDateAsserted(src.getDateAsserted());
-// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N");
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotTaken())
- tgt.addReasonNotTaken(convertCodeableConcept(t));
-// tgt.setReasonForUse(convertType(src.getReasonForUse()));
- if (src.hasNote())
- tgt.addNote().setText(src.getNote());
- for (org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage())
- tgt.addDosage(convertMedicationStatementDosageComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MedicationStatement tgt = new org.hl7.fhir.instance.model.MedicationStatement();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setStatus(convertMedicationStatementStatus(src.getStatus()));
- tgt.setMedication(convertType(src.getMedication()));
- tgt.setPatient(convertReference(src.getSubject()));
- tgt.setEffective(convertType(src.getEffective()));
- tgt.setInformationSource(convertReference(src.getInformationSource()));
- for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom())
- tgt.addSupportingInformation(convertReference(t));
- if (src.hasDateAsserted())
- tgt.setDateAsserted(src.getDateAsserted());
-// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotTaken())
- tgt.addReasonNotTaken(convertCodeableConcept(t));
-// tgt.setReasonForUse(convertType(src.getReasonForUse()));
- for (org.hl7.fhir.r4.model.Annotation t : src.getNote())
- tgt.setNote(t.getText());
- for (org.hl7.fhir.r4.model.Dosage t : src.getDosage())
- tgt.addDosage(convertMedicationStatementDosageComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
- copyElement(src, tgt);
- tgt.setText(src.getText());
- tgt.setTiming(convertTiming(src.getTiming()));
- tgt.setAsNeeded(convertType(src.getAsNeeded()));
- if (src.hasSiteCodeableConcept())
- tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept()));
- tgt.setRoute(convertCodeableConcept(src.getRoute()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
-// tgt.setQuantity(convertType(src.getQuantity()));
- tgt.setRate(convertType(src.getRate()));
- tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent();
- copyElement(src, tgt);
- tgt.setText(src.getText());
- tgt.setTiming(convertTiming(src.getTiming()));
- tgt.setAsNeeded(convertType(src.getAsNeeded()));
- tgt.setSite(convertType(src.getSite()));
- tgt.setRoute(convertCodeableConcept(src.getRoute()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
-// tgt.setQuantity(convertType(src.getQuantity()));
- tgt.setRate(convertType(src.getRate()));
- tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE;
- case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR;
- case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED;
- default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ACTIVE: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ACTIVE;
- case COMPLETED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR;
- case INTENDED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.INTENDED;
- default: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setTarget(convertReference(src.getTarget()));
- tgt.setEndpoint(src.getEndpoint());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setTarget(convertReference(src.getTarget()));
- tgt.setEndpoint(src.getEndpoint());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.instance.model.MessageHeader src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader();
- copyDomainResource(src, tgt);
- tgt.setTimestamp(src.getTimestamp());
- tgt.setEvent(convertCoding(src.getEvent()));
- tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse()));
- tgt.setSource(convertMessageSourceComponent(src.getSource()));
- for (org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent t : src.getDestination())
- tgt.addDestination(convertMessageDestinationComponent(t));
- tgt.setEnterer(convertReference(src.getEnterer()));
- tgt.setAuthor(convertReference(src.getAuthor()));
- tgt.setResponsible(convertReference(src.getResponsible()));
- tgt.setReason(convertCodeableConcept(src.getReason()));
- for (org.hl7.fhir.instance.model.Reference t : src.getData())
- tgt.addFocus(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MessageHeader tgt = new org.hl7.fhir.instance.model.MessageHeader();
- copyDomainResource(src, tgt);
- tgt.setTimestamp(src.getTimestamp());
- tgt.setEvent(convertCoding(src.getEvent()));
- tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse()));
- tgt.setSource(convertMessageSourceComponent(src.getSource()));
- for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination())
- tgt.addDestination(convertMessageDestinationComponent(t));
- tgt.setEnterer(convertReference(src.getEnterer()));
- tgt.setAuthor(convertReference(src.getAuthor()));
- tgt.setResponsible(convertReference(src.getResponsible()));
- tgt.setReason(convertCodeableConcept(src.getReason()));
- for (org.hl7.fhir.r4.model.Reference t : src.getFocus())
- tgt.addData(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(src.getIdentifier());
- tgt.setCode(convertResponseType(src.getCode()));
- tgt.setDetails(convertReference(src.getDetails()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(src.getIdentifier());
- tgt.setCode(convertResponseType(src.getCode()));
- tgt.setDetails(convertReference(src.getDetails()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CONSEQUENCE: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CONSEQUENCE;
- case CURRENCY: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.CURRENCY;
- case NOTIFICATION: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NOTIFICATION;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory convertMessageSignificanceCategory(org.hl7.fhir.r4.model.CapabilityStatement.MessageSignificanceCategory src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CONSEQUENCE: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CONSEQUENCE;
- case CURRENCY: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.CURRENCY;
- case NOTIFICATION: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NOTIFICATION;
- default: return org.hl7.fhir.instance.model.Conformance.MessageSignificanceCategory.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setSoftware(src.getSoftware());
- tgt.setVersion(src.getVersion());
- tgt.setContact(convertContactPoint(src.getContact()));
- tgt.setEndpoint(src.getEndpoint());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setSoftware(src.getSoftware());
- tgt.setVersion(src.getVersion());
- tgt.setContact(convertContactPoint(src.getContact()));
- tgt.setEndpoint(src.getEndpoint());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Meta convertMeta(org.hl7.fhir.instance.model.Meta src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Meta tgt = new org.hl7.fhir.r4.model.Meta();
- copyElement(src, tgt);
- tgt.setVersionId(src.getVersionId());
- tgt.setLastUpdated(src.getLastUpdated());
- for (org.hl7.fhir.instance.model.UriType t : src.getProfile())
- tgt.addProfile(t.getValue());
- for (org.hl7.fhir.instance.model.Coding t : src.getSecurity())
- tgt.addSecurity(convertCoding(t));
- for (org.hl7.fhir.instance.model.Coding t : src.getTag())
- tgt.addTag(convertCoding(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Meta convertMeta(org.hl7.fhir.r4.model.Meta src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Meta tgt = new org.hl7.fhir.instance.model.Meta();
- copyElement(src, tgt);
- tgt.setVersionId(src.getVersionId());
- tgt.setLastUpdated(src.getLastUpdated());
- for (org.hl7.fhir.r4.model.UriType t : src.getProfile())
- tgt.addProfile(t.getValue());
- for (org.hl7.fhir.r4.model.Coding t : src.getSecurity())
- tgt.addSecurity(convertCoding(t));
- for (org.hl7.fhir.r4.model.Coding t : src.getTag())
- tgt.addTag(convertCoding(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Money convertMoney(org.hl7.fhir.instance.model.Money src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Money tgt = new org.hl7.fhir.r4.model.Money();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Money convertMoney(org.hl7.fhir.r4.model.Money src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Money tgt = new org.hl7.fhir.instance.model.Money();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.HumanName.NameUse convertNameUse(org.hl7.fhir.instance.model.HumanName.NameUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case USUAL: return org.hl7.fhir.r4.model.HumanName.NameUse.USUAL;
- case OFFICIAL: return org.hl7.fhir.r4.model.HumanName.NameUse.OFFICIAL;
- case TEMP: return org.hl7.fhir.r4.model.HumanName.NameUse.TEMP;
- case NICKNAME: return org.hl7.fhir.r4.model.HumanName.NameUse.NICKNAME;
- case ANONYMOUS: return org.hl7.fhir.r4.model.HumanName.NameUse.ANONYMOUS;
- case OLD: return org.hl7.fhir.r4.model.HumanName.NameUse.OLD;
- case MAIDEN: return org.hl7.fhir.r4.model.HumanName.NameUse.MAIDEN;
- default: return org.hl7.fhir.r4.model.HumanName.NameUse.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.HumanName.NameUse convertNameUse(org.hl7.fhir.r4.model.HumanName.NameUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case USUAL: return org.hl7.fhir.instance.model.HumanName.NameUse.USUAL;
- case OFFICIAL: return org.hl7.fhir.instance.model.HumanName.NameUse.OFFICIAL;
- case TEMP: return org.hl7.fhir.instance.model.HumanName.NameUse.TEMP;
- case NICKNAME: return org.hl7.fhir.instance.model.HumanName.NameUse.NICKNAME;
- case ANONYMOUS: return org.hl7.fhir.instance.model.HumanName.NameUse.ANONYMOUS;
- case OLD: return org.hl7.fhir.instance.model.HumanName.NameUse.OLD;
- case MAIDEN: return org.hl7.fhir.instance.model.HumanName.NameUse.MAIDEN;
- default: return org.hl7.fhir.instance.model.HumanName.NameUse.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.instance.model.NamingSystem src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem();
- copyDomainResource(src, tgt);
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- tgt.setKind(convertNamingSystemType(src.getKind()));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent t : src.getContact())
- tgt.addContact(convertNamingSystemContactComponent(t));
- tgt.setResponsible(src.getResponsible());
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
- if (isJurisdiction(t))
- tgt.addJurisdiction(convertCodeableConcept(t));
- else
- tgt.addUseContext(convertCodeableConceptToUsageContext(t));
- tgt.setUsage(src.getUsage());
- for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId())
- tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t));
- tgt.setReplacedBy(convertReference(src.getReplacedBy()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.NamingSystem tgt = new org.hl7.fhir.instance.model.NamingSystem();
- copyDomainResource(src, tgt);
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- tgt.setKind(convertNamingSystemType(src.getKind()));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
- tgt.addContact(convertNamingSystemContactComponent(t));
- tgt.setResponsible(src.getResponsible());
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
- if (t.hasValueCodeableConcept())
- tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
- tgt.addUseContext(convertCodeableConcept(t));
- tgt.setUsage(src.getUsage());
- for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId())
- tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t));
- tgt.setReplacedBy(convertReference(src.getReplacedBy()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID;
- case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID;
- case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI;
- case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER;
- default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OID;
- case UUID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.UUID;
- case URI: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.URI;
- case OTHER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OTHER;
- default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM;
- case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER;
- case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT;
- default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CODESYSTEM: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.CODESYSTEM;
- case IDENTIFIER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.IDENTIFIER;
- case ROOT: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.ROOT;
- default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent();
- copyElement(src, tgt);
- tgt.setType(convertNamingSystemIdentifierType(src.getType()));
- tgt.setValue(src.getValue());
- tgt.setPreferred(src.getPreferred());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent();
- copyElement(src, tgt);
- tgt.setType(convertNamingSystemIdentifierType(src.getType()));
- tgt.setValue(src.getValue());
- tgt.setPreferred(src.getPreferred());
- tgt.setPeriod(convertPeriod(src.getPeriod()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Narrative convertNarrative(org.hl7.fhir.instance.model.Narrative src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Narrative tgt = new org.hl7.fhir.r4.model.Narrative();
- copyElement(src, tgt);
- tgt.setStatus(convertNarrativeStatus(src.getStatus()));
- tgt.setDiv(src.getDiv());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Narrative convertNarrative(org.hl7.fhir.r4.model.Narrative src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Narrative tgt = new org.hl7.fhir.instance.model.Narrative();
- copyElement(src, tgt);
- tgt.setStatus(convertNarrativeStatus(src.getStatus()));
- tgt.setDiv(src.getDiv());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.instance.model.Narrative.NarrativeStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case GENERATED: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.GENERATED;
- case EXTENSIONS: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EXTENSIONS;
- case ADDITIONAL: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.ADDITIONAL;
- case EMPTY: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.EMPTY;
- default: return org.hl7.fhir.r4.model.Narrative.NarrativeStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Narrative.NarrativeStatus convertNarrativeStatus(org.hl7.fhir.r4.model.Narrative.NarrativeStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case GENERATED: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.GENERATED;
- case EXTENSIONS: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EXTENSIONS;
- case ADDITIONAL: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.ADDITIONAL;
- case EMPTY: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.EMPTY;
- default: return org.hl7.fhir.instance.model.Narrative.NarrativeStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.instance.model.Observation src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setStatus(convertObservationStatus(src.getStatus()));
- tgt.addCategory(convertCodeableConcept(src.getCategory()));
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setSubject(convertReference(src.getSubject()));
- tgt.setContext(convertReference(src.getEncounter()));
- tgt.setEffective(convertType(src.getEffective()));
- tgt.setIssued(src.getIssued());
- for (org.hl7.fhir.instance.model.Reference t : src.getPerformer())
- tgt.addPerformer(convertReference(t));
- tgt.setValue(convertType(src.getValue()));
- tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
- tgt.setInterpretation(convertCodeableConcept(src.getInterpretation()));
- tgt.setComment(src.getComments());
- tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- tgt.setSpecimen(convertReference(src.getSpecimen()));
- tgt.setDevice(convertReference(src.getDevice()));
- for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
- tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
- for (org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent t : src.getRelated())
- tgt.addRelated(convertObservationRelatedComponent(t));
- for (org.hl7.fhir.instance.model.Observation.ObservationComponentComponent t : src.getComponent())
- tgt.addComponent(convertObservationComponentComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Observation tgt = new org.hl7.fhir.instance.model.Observation();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setStatus(convertObservationStatus(src.getStatus()));
- for (org.hl7.fhir.r4.model.CodeableConcept c : src.getCategory())
- tgt.setCategory(convertCodeableConcept(c));
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setSubject(convertReference(src.getSubject()));
- tgt.setEncounter(convertReference(src.getContext()));
- tgt.setEffective(convertType(src.getEffective()));
- tgt.setIssued(src.getIssued());
- for (org.hl7.fhir.r4.model.Reference t : src.getPerformer())
- tgt.addPerformer(convertReference(t));
- tgt.setValue(convertType(src.getValue()));
- tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
- tgt.setInterpretation(convertCodeableConcept(src.getInterpretation()));
- tgt.setComments(src.getComment());
- tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- tgt.setSpecimen(convertReference(src.getSpecimen()));
- tgt.setDevice(convertReference(src.getDevice()));
- for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
- tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
- for (org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent t : src.getRelated())
- tgt.addRelated(convertObservationRelatedComponent(t));
- for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent())
- tgt.addComponent(convertObservationComponentComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.instance.model.Observation.ObservationComponentComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent();
- copyElement(src, tgt);
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setValue(convertType(src.getValue()));
- tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
- for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
- tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationComponentComponent();
- copyElement(src, tgt);
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setValue(convertType(src.getValue()));
- tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
- for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
- tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent();
- copyElement(src, tgt);
- tgt.setLow(convertSimpleQuantity(src.getLow()));
- tgt.setHigh(convertSimpleQuantity(src.getHigh()));
- tgt.setType(convertCodeableConcept(src.getMeaning()));
- tgt.setAge(convertRange(src.getAge()));
- tgt.setText(src.getText());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent();
- copyElement(src, tgt);
- tgt.setLow(convertSimpleQuantity(src.getLow()));
- tgt.setHigh(convertSimpleQuantity(src.getHigh()));
-// for (org.hl7.fhir.r4.model.CodeableConcept c : src.getMeaning())
- tgt.setMeaning(convertCodeableConcept(src.getType()));
- tgt.setAge(convertRange(src.getAge()));
- tgt.setText(src.getText());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent();
- copyElement(src, tgt);
- tgt.setType(convertObservationRelationshipType(src.getType()));
- tgt.setTarget(convertReference(src.getTarget()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent();
- copyElement(src, tgt);
- tgt.setType(convertObservationRelationshipType(src.getType()));
- tgt.setTarget(convertReference(src.getTarget()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.instance.model.Observation.ObservationRelationshipType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HASMEMBER: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.HASMEMBER;
- case DERIVEDFROM: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.DERIVEDFROM;
- case SEQUELTO: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.SEQUELTO;
- case REPLACES: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.REPLACES;
- case QUALIFIEDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.QUALIFIEDBY;
- case INTERFEREDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.INTERFEREDBY;
- default: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.r4.model.Observation.ObservationRelationshipType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case HASMEMBER: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.HASMEMBER;
- case DERIVEDFROM: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.DERIVEDFROM;
- case SEQUELTO: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.SEQUELTO;
- case REPLACES: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.REPLACES;
- case QUALIFIEDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.QUALIFIEDBY;
- case INTERFEREDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.INTERFEREDBY;
- default: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.instance.model.Observation.ObservationStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED;
- case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY;
- case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL;
- case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED;
- case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR;
- case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN;
- default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REGISTERED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.REGISTERED;
- case PRELIMINARY: return org.hl7.fhir.instance.model.Observation.ObservationStatus.PRELIMINARY;
- case FINAL: return org.hl7.fhir.instance.model.Observation.ObservationStatus.FINAL;
- case AMENDED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.AMENDED;
- case CANCELLED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.CANCELLED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.Observation.ObservationStatus.ENTEREDINERROR;
- case UNKNOWN: return org.hl7.fhir.instance.model.Observation.ObservationStatus.UNKNOWN;
- default: return org.hl7.fhir.instance.model.Observation.ObservationStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.OidType convertOid(org.hl7.fhir.instance.model.OidType src) throws FHIRException {
- org.hl7.fhir.r4.model.OidType tgt = new org.hl7.fhir.r4.model.OidType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OidType convertOid(org.hl7.fhir.r4.model.OidType src) throws FHIRException {
- org.hl7.fhir.instance.model.OidType tgt = new org.hl7.fhir.instance.model.OidType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.instance.model.OperationDefinition src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- tgt.setKind(convertOperationKind(src.getKind()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact())
- tgt.addContact(convertOperationDefinitionContactComponent(t));
- tgt.setDescription(src.getDescription());
- tgt.setPurpose(src.getRequirements());
- if (src.hasIdempotent())
- tgt.setIdempotent(src.getIdempotent());
- tgt.setCode(src.getCode());
- tgt.setComment(src.getNotes());
- tgt.setBase(convertReference(src.getBase()));
- tgt.setSystem(src.getSystem());
- for (org.hl7.fhir.instance.model.CodeType t : src.getType())
- tgt.addResource(t.getValue());
- tgt.setType(tgt.hasResource());
- tgt.setInstance(src.getInstance());
- for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter())
- tgt.addParameter(convertOperationDefinitionParameterComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.OperationDefinition tgt = new org.hl7.fhir.instance.model.OperationDefinition();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- tgt.setKind(convertOperationKind(src.getKind()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
- tgt.addContact(convertOperationDefinitionContactComponent(t));
- tgt.setDescription(src.getDescription());
- tgt.setRequirements(src.getPurpose());
- tgt.setIdempotent(src.getIdempotent());
- tgt.setCode(src.getCode());
- tgt.setNotes(src.getComment());
- if (src.hasBase())
- tgt.setBase(convertReference(src.getBase()));
- tgt.setSystem(src.getSystem());
- if (src.getType())
- for (org.hl7.fhir.r4.model.CodeType t : src.getResource())
- tgt.addType(t.getValue());
- tgt.setInstance(src.getInstance());
- for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter())
- tgt.addParameter(convertOperationDefinitionParameterComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent();
- copyElement(src, tgt);
- tgt.setStrength(convertBindingStrength(src.getStrength()));
- tgt.setValueSet(convertType(src.getValueSet()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent();
- copyElement(src, tgt);
- tgt.setStrength(convertBindingStrength(src.getStrength()));
- tgt.setValueSet(convertType(src.getValueSet()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setUse(convertOperationParameterUse(src.getUse()));
- tgt.setMin(src.getMin());
- tgt.setMax(src.getMax());
- tgt.setDocumentation(src.getDocumentation());
- tgt.setType(src.getType());
- tgt.setProfile(convertReference(src.getProfile()));
- tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding()));
- for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart())
- tgt.addPart(convertOperationDefinitionParameterComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setUse(convertOperationParameterUse(src.getUse()));
- tgt.setMin(src.getMin());
- tgt.setMax(src.getMax());
- tgt.setDocumentation(src.getDocumentation());
- if (src.hasSearchType()) {
- tgt.setType(src.getSearchType().toCode());
- tgt.setType("string");
- } else
- tgt.setType(src.getType());
- if (src.hasProfile())
- tgt.setProfile(convertReference(src.getProfile()));
- if (src.hasBinding())
- tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding()));
- for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart())
- tgt.addPart(convertOperationDefinitionParameterComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.instance.model.OperationDefinition.OperationKind src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION;
- case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY;
- default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL;
- }
- }
-
// public org.hl7.fhir.r4.model.Medication.MedicationProductComponent convertMedicationProductComponent(org.hl7.fhir.instance.model.Medication.MedicationProductComponent src) throws FHIRException {
// if (src == null || src.isEmpty())
// return null;
@@ -8349,158 +8128,191 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
// return tgt;
// }
- public org.hl7.fhir.instance.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageComponent();
+ copyElement(src, tgt);
+ tgt.setContainer(convertCodeableConcept(src.getContainer()));
+ for (org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent t : src.getContent())
+ tgt.addContent(convertMedicationPackageContentComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Medication.MedicationPackageComponent convertMedicationPackageComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Medication.MedicationPackageComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageComponent();
+ copyElement(src, tgt);
+ tgt.setContainer(convertCodeableConcept(src.getContainer()));
+ for (org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent t : src.getContent())
+ tgt.addContent(convertMedicationPackageContentComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent();
+ copyElement(src, tgt);
+ tgt.setItem(convertType(src.getItem()));
+ tgt.setAmount(convertSimpleQuantity(src.getAmount()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent convertMedicationPackageContentComponent(org.hl7.fhir.r4.model.Medication.MedicationPackageContentComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent tgt = new org.hl7.fhir.instance.model.Medication.MedicationPackageContentComponent();
+ copyElement(src, tgt);
+ if (src.hasItemReference())
+ tgt.setItem((org.hl7.fhir.instance.model.Reference) convertType(src.getItem()));
+ tgt.setAmount(convertSimpleQuantity(src.getAmount()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.instance.model.MedicationDispense src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.MedicationDispense tgt = new org.hl7.fhir.r4.model.MedicationDispense();
+ copyDomainResource(src, tgt);
+ tgt.addIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setStatus(convertMedicationDispenseStatus(src.getStatus()));
+ tgt.setMedication(convertType(src.getMedication()));
+ tgt.setSubject(convertReference(src.getPatient()));
+// tgt.setDispenser(convertReference(src.getDispenser()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getAuthorizingPrescription())
+ tgt.addAuthorizingPrescription(convertReference(t));
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply()));
+ tgt.setWhenPrepared(src.getWhenPrepared());
+ tgt.setWhenHandedOver(src.getWhenHandedOver());
+ tgt.setDestination(convertReference(src.getDestination()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getReceiver())
+ tgt.addReceiver(convertReference(t));
+ if (src.hasNote())
+ tgt.addNote().setText(src.getNote());
+ for (org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent t : src.getDosageInstruction())
+ tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t));
+ tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MedicationDispense convertMedicationDispense(org.hl7.fhir.r4.model.MedicationDispense src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.MedicationDispense tgt = new org.hl7.fhir.instance.model.MedicationDispense();
+ copyDomainResource(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifierFirstRep()));
+ tgt.setStatus(convertMedicationDispenseStatus(src.getStatus()));
+ tgt.setMedication(convertType(src.getMedication()));
+ tgt.setPatient(convertReference(src.getSubject()));
+// tgt.setDispenser(convertReference(src.getDispenser()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getAuthorizingPrescription())
+ tgt.addAuthorizingPrescription(convertReference(t));
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ tgt.setDaysSupply(convertSimpleQuantity(src.getDaysSupply()));
+ tgt.setWhenPrepared(src.getWhenPrepared());
+ tgt.setWhenHandedOver(src.getWhenHandedOver());
+ tgt.setDestination(convertReference(src.getDestination()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getReceiver())
+ tgt.addReceiver(convertReference(t));
+ for (org.hl7.fhir.r4.model.Annotation t : src.getNote())
+ tgt.setNote(t.getText());
+ for (org.hl7.fhir.r4.model.Dosage t : src.getDosageInstruction())
+ tgt.addDosageInstruction(convertMedicationDispenseDosageInstructionComponent(t));
+ tgt.setSubstitution(convertMedicationDispenseSubstitutionComponent(src.getSubstitution()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case OPERATION: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.OPERATION;
- case QUERY: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.QUERY;
- default: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.NULL;
+ case INPROGRESS: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS;
+ case ONHOLD: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ONHOLD;
+ case COMPLETED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR;
+ case STOPPED: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.STOPPED;
+ default: return org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus.NULL;
}
}
- public org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue())
- tgt.addIssue(convertOperationOutcomeIssueComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.OperationOutcome tgt = new org.hl7.fhir.instance.model.OperationOutcome();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue())
- tgt.addIssue(convertOperationOutcomeIssueComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent();
- copyElement(src, tgt);
- tgt.setSeverity(convertIssueSeverity(src.getSeverity()));
- tgt.setCode(convertIssueType(src.getCode()));
- tgt.setDetails(convertCodeableConcept(src.getDetails()));
- tgt.setDiagnostics(src.getDiagnostics());
- for (org.hl7.fhir.instance.model.StringType t : src.getLocation())
- tgt.addLocation(t.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent();
- copyElement(src, tgt);
- tgt.setSeverity(convertIssueSeverity(src.getSeverity()));
- tgt.setCode(convertIssueType(src.getCode()));
- tgt.setDetails(convertCodeableConcept(src.getDetails()));
- tgt.setDiagnostics(src.getDiagnostics());
- for (org.hl7.fhir.r4.model.StringType t : src.getLocation())
- tgt.addLocation(t.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse src) throws FHIRException {
+ public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus convertMedicationDispenseStatus(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN;
- case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT;
- default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL;
+ case INPROGRESS: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.INPROGRESS;
+ case ONHOLD: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ONHOLD;
+ case COMPLETED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.ENTEREDINERROR;
+ case STOPPED: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.STOPPED;
+ default: return org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseStatus.NULL;
}
}
- public org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case IN: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.IN;
- case OUT: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.OUT;
- default: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.instance.model.Organization src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Dosage convertMedicationDispenseDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setActive(src.getActive());
- tgt.addType(convertCodeableConcept(src.getType()));
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- for (org.hl7.fhir.instance.model.Address t : src.getAddress())
- tgt.addAddress(convertAddress(t));
- tgt.setPartOf(convertReference(src.getPartOf()));
- for (org.hl7.fhir.instance.model.Organization.OrganizationContactComponent t : src.getContact())
- tgt.addContact(convertOrganizationContactComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Organization tgt = new org.hl7.fhir.instance.model.Organization();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setActive(src.getActive());
- tgt.setType(convertCodeableConcept(src.getTypeFirstRep()));
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- for (org.hl7.fhir.r4.model.Address t : src.getAddress())
- tgt.addAddress(convertAddress(t));
- tgt.setPartOf(convertReference(src.getPartOf()));
- for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact())
- tgt.addContact(convertOrganizationContactComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.instance.model.Organization.OrganizationContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent();
+ org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
copyElement(src, tgt);
- tgt.setPurpose(convertCodeableConcept(src.getPurpose()));
- tgt.setName(convertHumanName(src.getName()));
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- tgt.setAddress(convertAddress(src.getAddress()));
+ tgt.setText(src.getText());
+// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
+ tgt.setTiming(convertTiming(src.getTiming()));
+ tgt.setAsNeeded(convertType(src.getAsNeeded()));
+ if (src.hasSiteCodeableConcept())
+ tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept()));
+ tgt.setRoute(convertCodeableConcept(src.getRoute()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ tgt.setDose(convertType(src.getDose()));
+ tgt.setRate(convertType(src.getRate()));
+ tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
return tgt;
}
- public org.hl7.fhir.instance.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent convertMedicationDispenseDosageInstructionComponent(Dosage src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.instance.model.Organization.OrganizationContactComponent();
+ org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseDosageInstructionComponent();
copyElement(src, tgt);
- tgt.setPurpose(convertCodeableConcept(src.getPurpose()));
- tgt.setName(convertHumanName(src.getName()));
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- tgt.setAddress(convertAddress(src.getAddress()));
+ tgt.setText(src.getText());
+// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
+ tgt.setTiming(convertTiming(src.getTiming()));
+ tgt.setAsNeeded(convertType(src.getAsNeeded()));
+ tgt.setSite(convertType(src.getSite()));
+ tgt.setRoute(convertCodeableConcept(src.getRoute()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ tgt.setDose(convertType(src.getDose()));
+ tgt.setRate(convertType(src.getRate()));
+ tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
return tgt;
}
- public org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent src) throws FHIRException {
+ public org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent();
+ org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent();
copyElement(src, tgt);
- tgt.setProperty(src.getElement());
- tgt.setSystem(src.getCodeSystem());
- tgt.setCode(src.getCode());
+ tgt.setType(convertCodeableConcept(src.getType()));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason())
+ tgt.addReason(convertCodeableConcept(t));
+ for (org.hl7.fhir.instance.model.Reference t : src.getResponsibleParty())
+ tgt.addResponsibleParty(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent convertMedicationDispenseSubstitutionComponent(org.hl7.fhir.r4.model.MedicationDispense.MedicationDispenseSubstitutionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent tgt = new org.hl7.fhir.instance.model.MedicationDispense.MedicationDispenseSubstitutionComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertCodeableConcept(src.getType()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReason())
+ tgt.addReason(convertCodeableConcept(t));
+ for (org.hl7.fhir.r4.model.Reference t : src.getResponsibleParty())
+ tgt.addResponsibleParty(convertReference(t));
return tgt;
}
@@ -8592,24 +8404,40 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
// }
// }
- public org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent convertOtherElementComponent(org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Dosage convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent();
+ org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
copyElement(src, tgt);
- tgt.setElement(src.getProperty());
- tgt.setCodeSystem(src.getSystem());
- tgt.setCode(src.getCode());
+ tgt.setText(src.getText());
+// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
+ tgt.setTiming(convertTiming(src.getTiming()));
+ tgt.setAsNeeded(convertType(src.getAsNeeded()));
+ if (src.hasSiteCodeableConcept())
+ tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept()));
+ tgt.setRoute(convertCodeableConcept(src.getRoute()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ tgt.setDose(convertType(src.getDose()));
+ tgt.setRate(convertType(src.getRate()));
+ tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
return tgt;
}
- public org.hl7.fhir.r4.model.Parameters convertParameters(org.hl7.fhir.instance.model.Parameters src) throws FHIRException {
+ public org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent convertMedicationOrderDosageInstructionComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Parameters tgt = new org.hl7.fhir.r4.model.Parameters();
- copyResource(src, tgt);
- for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getParameter())
- tgt.addParameter(convertParametersParameterComponent(t));
+ org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent tgt = new org.hl7.fhir.instance.model.MedicationOrder.MedicationOrderDosageInstructionComponent();
+ copyElement(src, tgt);
+ tgt.setText(src.getText());
+// tgt.setAdditionalInstructions(convertCodeableConcept(src.getAdditionalInstructions()));
+ tgt.setTiming(convertTiming(src.getTiming()));
+ tgt.setAsNeeded(convertType(src.getAsNeeded()));
+ tgt.setSite(convertType(src.getSite()));
+ tgt.setRoute(convertCodeableConcept(src.getRoute()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ tgt.setDose(convertType(src.getDose()));
+ tgt.setRate(convertType(src.getRate()));
+ tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
return tgt;
}
@@ -8659,114 +8487,1003 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
// return tgt;
// }
- public org.hl7.fhir.instance.model.Parameters convertParameters(org.hl7.fhir.r4.model.Parameters src) throws FHIRException {
+ public org.hl7.fhir.r4.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.instance.model.MedicationStatement src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Parameters tgt = new org.hl7.fhir.instance.model.Parameters();
- copyResource(src, tgt);
- for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getParameter())
- tgt.addParameter(convertParametersParameterComponent(t));
+ org.hl7.fhir.r4.model.MedicationStatement tgt = new org.hl7.fhir.r4.model.MedicationStatement();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setStatus(convertMedicationStatementStatus(src.getStatus()));
+ tgt.setMedication(convertType(src.getMedication()));
+ tgt.setSubject(convertReference(src.getPatient()));
+ tgt.setEffective(convertType(src.getEffective()));
+ tgt.setInformationSource(convertReference(src.getInformationSource()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getSupportingInformation())
+ tgt.addDerivedFrom(convertReference(t));
+ if (src.hasDateAsserted())
+ tgt.setDateAsserted(src.getDateAsserted());
+// tgt.getNotTakenElement().setValueAsString(src.getWasNotTaken() ? "Y" : "N");
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReasonNotTaken())
+ tgt.addReasonNotTaken(convertCodeableConcept(t));
+// tgt.setReasonForUse(convertType(src.getReasonForUse()));
+ if (src.hasNote())
+ tgt.addNote().setText(src.getNote());
+ for (org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent t : src.getDosage())
+ tgt.addDosage(convertMedicationStatementDosageComponent(t));
return tgt;
}
- public org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.MedicationStatement convertMedicationStatement(org.hl7.fhir.r4.model.MedicationStatement src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent();
+ org.hl7.fhir.instance.model.MedicationStatement tgt = new org.hl7.fhir.instance.model.MedicationStatement();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setStatus(convertMedicationStatementStatus(src.getStatus()));
+ tgt.setMedication(convertType(src.getMedication()));
+ tgt.setPatient(convertReference(src.getSubject()));
+ tgt.setEffective(convertType(src.getEffective()));
+ tgt.setInformationSource(convertReference(src.getInformationSource()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getDerivedFrom())
+ tgt.addSupportingInformation(convertReference(t));
+ if (src.hasDateAsserted())
+ tgt.setDateAsserted(src.getDateAsserted());
+// tgt.setWasNotTaken("Y".equals(src.getNotTakenElement().getValueAsString()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getReasonNotTaken())
+ tgt.addReasonNotTaken(convertCodeableConcept(t));
+// tgt.setReasonForUse(convertType(src.getReasonForUse()));
+ for (org.hl7.fhir.r4.model.Annotation t : src.getNote())
+ tgt.setNote(t.getText());
+ for (org.hl7.fhir.r4.model.Dosage t : src.getDosage())
+ tgt.addDosage(convertMedicationStatementDosageComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACTIVE: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ACTIVE;
+ case COMPLETED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR;
+ case INTENDED: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.INTENDED;
+ default: return org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus convertMedicationStatementStatus(org.hl7.fhir.r4.model.MedicationStatement.MedicationStatementStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACTIVE: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ACTIVE;
+ case COMPLETED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.ENTEREDINERROR;
+ case INTENDED: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.INTENDED;
+ default: return org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Dosage convertMedicationStatementDosageComponent(org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Dosage tgt = new org.hl7.fhir.r4.model.Dosage();
+ copyElement(src, tgt);
+ tgt.setText(src.getText());
+ tgt.setTiming(convertTiming(src.getTiming()));
+ tgt.setAsNeeded(convertType(src.getAsNeeded()));
+ if (src.hasSiteCodeableConcept())
+ tgt.setSite(convertCodeableConcept(src.getSiteCodeableConcept()));
+ tgt.setRoute(convertCodeableConcept(src.getRoute()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+// tgt.setQuantity(convertType(src.getQuantity()));
+ tgt.setRate(convertType(src.getRate()));
+ tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent convertMedicationStatementDosageComponent(org.hl7.fhir.r4.model.Dosage src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent tgt = new org.hl7.fhir.instance.model.MedicationStatement.MedicationStatementDosageComponent();
+ copyElement(src, tgt);
+ tgt.setText(src.getText());
+ tgt.setTiming(convertTiming(src.getTiming()));
+ tgt.setAsNeeded(convertType(src.getAsNeeded()));
+ tgt.setSite(convertType(src.getSite()));
+ tgt.setRoute(convertCodeableConcept(src.getRoute()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+// tgt.setQuantity(convertType(src.getQuantity()));
+ tgt.setRate(convertType(src.getRate()));
+ tgt.setMaxDosePerPeriod(convertRatio(src.getMaxDosePerPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MessageHeader convertMessageHeader(org.hl7.fhir.instance.model.MessageHeader src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.MessageHeader tgt = new org.hl7.fhir.r4.model.MessageHeader();
+ copyDomainResource(src, tgt);
+ tgt.setTimestamp(src.getTimestamp());
+ tgt.setEvent(convertCoding(src.getEvent()));
+ tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse()));
+ tgt.setSource(convertMessageSourceComponent(src.getSource()));
+ for (org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent t : src.getDestination())
+ tgt.addDestination(convertMessageDestinationComponent(t));
+ tgt.setEnterer(convertReference(src.getEnterer()));
+ tgt.setAuthor(convertReference(src.getAuthor()));
+ tgt.setResponsible(convertReference(src.getResponsible()));
+ tgt.setReason(convertCodeableConcept(src.getReason()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getData())
+ tgt.addFocus(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MessageHeader convertMessageHeader(org.hl7.fhir.r4.model.MessageHeader src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.MessageHeader tgt = new org.hl7.fhir.instance.model.MessageHeader();
+ copyDomainResource(src, tgt);
+ tgt.setTimestamp(src.getTimestamp());
+ tgt.setEvent(convertCoding(src.getEvent()));
+ tgt.setResponse(convertMessageHeaderResponseComponent(src.getResponse()));
+ tgt.setSource(convertMessageSourceComponent(src.getSource()));
+ for (org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent t : src.getDestination())
+ tgt.addDestination(convertMessageDestinationComponent(t));
+ tgt.setEnterer(convertReference(src.getEnterer()));
+ tgt.setAuthor(convertReference(src.getAuthor()));
+ tgt.setResponsible(convertReference(src.getResponsible()));
+ tgt.setReason(convertCodeableConcept(src.getReason()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getFocus())
+ tgt.addData(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(src.getIdentifier());
+ tgt.setCode(convertResponseType(src.getCode()));
+ tgt.setDetails(convertReference(src.getDetails()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent convertMessageHeaderResponseComponent(org.hl7.fhir.r4.model.MessageHeader.MessageHeaderResponseComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageHeaderResponseComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(src.getIdentifier());
+ tgt.setCode(convertResponseType(src.getCode()));
+ tgt.setDetails(convertReference(src.getDetails()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.instance.model.MessageHeader.ResponseType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK;
+ case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR;
+ case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR;
+ default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OK: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.OK;
+ case TRANSIENTERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.TRANSIENTERROR;
+ case FATALERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.FATALERROR;
+ default: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent();
copyElement(src, tgt);
tgt.setName(src.getName());
- tgt.setValue(convertType(src.getValue()));
- tgt.setResource(convertResource(src.getResource()));
- for (org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent t : src.getPart())
- tgt.addPart(convertParametersParameterComponent(t));
+ tgt.setSoftware(src.getSoftware());
+ tgt.setVersion(src.getVersion());
+ tgt.setContact(convertContactPoint(src.getContact()));
+ tgt.setEndpoint(src.getEndpoint());
return tgt;
}
- public org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent convertParametersParameterComponent(org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent src) throws FHIRException {
+ public org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent convertMessageSourceComponent(org.hl7.fhir.r4.model.MessageHeader.MessageSourceComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
- org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent tgt = new org.hl7.fhir.instance.model.Parameters.ParametersParameterComponent();
+ org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageSourceComponent();
copyElement(src, tgt);
tgt.setName(src.getName());
- tgt.setValue(convertType(src.getValue()));
- tgt.setResource(convertResource(src.getResource()));
- for (org.hl7.fhir.r4.model.Parameters.ParametersParameterComponent t : src.getPart())
- tgt.addPart(convertParametersParameterComponent(t));
+ tgt.setSoftware(src.getSoftware());
+ tgt.setVersion(src.getVersion());
+ tgt.setContact(convertContactPoint(src.getContact()));
+ tgt.setEndpoint(src.getEndpoint());
return tgt;
}
- public org.hl7.fhir.r4.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.instance.model.Appointment.ParticipantRequired src) throws FHIRException {
+ public org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setTarget(convertReference(src.getTarget()));
+ tgt.setEndpoint(src.getEndpoint());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent convertMessageDestinationComponent(org.hl7.fhir.r4.model.MessageHeader.MessageDestinationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent tgt = new org.hl7.fhir.instance.model.MessageHeader.MessageDestinationComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setTarget(convertReference(src.getTarget()));
+ tgt.setEndpoint(src.getEndpoint());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.NamingSystem convertNamingSystem(org.hl7.fhir.instance.model.NamingSystem src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.NamingSystem tgt = new org.hl7.fhir.r4.model.NamingSystem();
+ copyDomainResource(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ tgt.setKind(convertNamingSystemType(src.getKind()));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent t : src.getContact())
+ tgt.addContact(convertNamingSystemContactComponent(t));
+ tgt.setResponsible(src.getResponsible());
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
+ if (isJurisdiction(t))
+ tgt.addJurisdiction(convertCodeableConcept(t));
+ else
+ tgt.addUseContext(convertCodeableConceptToUsageContext(t));
+ tgt.setUsage(src.getUsage());
+ for (org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId())
+ tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t));
+ tgt.setReplacedBy(convertReference(src.getReplacedBy()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.NamingSystem convertNamingSystem(org.hl7.fhir.r4.model.NamingSystem src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.NamingSystem tgt = new org.hl7.fhir.instance.model.NamingSystem();
+ copyDomainResource(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ tgt.setKind(convertNamingSystemType(src.getKind()));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+ tgt.addContact(convertNamingSystemContactComponent(t));
+ tgt.setResponsible(src.getResponsible());
+ tgt.setType(convertCodeableConcept(src.getType()));
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
+ if (t.hasValueCodeableConcept())
+ tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
+ tgt.addUseContext(convertCodeableConcept(t));
+ tgt.setUsage(src.getUsage());
+ for (org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent t : src.getUniqueId())
+ tgt.addUniqueId(convertNamingSystemUniqueIdComponent(t));
+ tgt.setReplacedBy(convertReference(src.getReplacedBy()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemType src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case REQUIRED: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.REQUIRED;
- case OPTIONAL: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.OPTIONAL;
- case INFORMATIONONLY: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.INFORMATIONONLY;
- default: return org.hl7.fhir.r4.model.Appointment.ParticipantRequired.NULL;
+ case CODESYSTEM: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.CODESYSTEM;
+ case IDENTIFIER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.IDENTIFIER;
+ case ROOT: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.ROOT;
+ default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemType.NULL;
}
}
- public org.hl7.fhir.instance.model.Appointment.ParticipantRequired convertParticipantRequired(org.hl7.fhir.r4.model.Appointment.ParticipantRequired src) throws FHIRException {
+ public org.hl7.fhir.instance.model.NamingSystem.NamingSystemType convertNamingSystemType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemType src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case REQUIRED: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.REQUIRED;
- case OPTIONAL: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.OPTIONAL;
- case INFORMATIONONLY: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.INFORMATIONONLY;
- default: return org.hl7.fhir.instance.model.Appointment.ParticipantRequired.NULL;
+ case CODESYSTEM: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.CODESYSTEM;
+ case IDENTIFIER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.IDENTIFIER;
+ case ROOT: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.ROOT;
+ default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemType.NULL;
}
}
- private org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus src) {
+ public org.hl7.fhir.r4.model.ContactDetail convertNamingSystemContactComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent convertNamingSystemContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemContactComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertNamingSystemIdentifierType(src.getType()));
+ tgt.setValue(src.getValue());
+ tgt.setPreferred(src.getPreferred());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent convertNamingSystemUniqueIdComponent(org.hl7.fhir.r4.model.NamingSystem.NamingSystemUniqueIdComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent tgt = new org.hl7.fhir.instance.model.NamingSystem.NamingSystemUniqueIdComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertNamingSystemIdentifierType(src.getType()));
+ tgt.setValue(src.getValue());
+ tgt.setPreferred(src.getPreferred());
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ACCEPTED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
- case DECLINED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED;
- case TENTATIVE: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE;
- case INPROCESS: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
- case COMPLETED: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
- case NEEDSACTION: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION;
- default: return org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL;
+ case OID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OID;
+ case UUID: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.UUID;
+ case URI: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.URI;
+ case OTHER: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.OTHER;
+ default: return org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType.NULL;
}
}
- private org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus convertParticipantStatus(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus src) {
+ public org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType convertNamingSystemIdentifierType(org.hl7.fhir.r4.model.NamingSystem.NamingSystemIdentifierType src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ACCEPTED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.ACCEPTED;
- case DECLINED: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.DECLINED;
- case TENTATIVE: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.TENTATIVE;
- case NEEDSACTION: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NEEDSACTION;
- default: return org.hl7.fhir.instance.model.AppointmentResponse.ParticipantStatus.NULL;
+ case OID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OID;
+ case UUID: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.UUID;
+ case URI: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.URI;
+ case OTHER: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.OTHER;
+ default: return org.hl7.fhir.instance.model.NamingSystem.NamingSystemIdentifierType.NULL;
}
}
- public org.hl7.fhir.r4.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.instance.model.Appointment.ParticipationStatus src) throws FHIRException {
+ public org.hl7.fhir.r4.model.Observation convertObservation(org.hl7.fhir.instance.model.Observation src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Observation tgt = new org.hl7.fhir.r4.model.Observation();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setStatus(convertObservationStatus(src.getStatus()));
+ tgt.addCategory(convertCodeableConcept(src.getCategory()));
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setSubject(convertReference(src.getSubject()));
+ tgt.setContext(convertReference(src.getEncounter()));
+ tgt.setEffective(convertType(src.getEffective()));
+ tgt.setIssued(src.getIssued());
+ for (org.hl7.fhir.instance.model.Reference t : src.getPerformer())
+ tgt.addPerformer(convertReference(t));
+ tgt.setValue(convertType(src.getValue()));
+ tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
+ tgt.setInterpretation(convertCodeableConcept(src.getInterpretation()));
+ tgt.setComment(src.getComments());
+ tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ tgt.setSpecimen(convertReference(src.getSpecimen()));
+ tgt.setDevice(convertReference(src.getDevice()));
+ for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
+ tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
+ for (org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent t : src.getRelated())
+ tgt.addRelated(convertObservationRelatedComponent(t));
+ for (org.hl7.fhir.instance.model.Observation.ObservationComponentComponent t : src.getComponent())
+ tgt.addComponent(convertObservationComponentComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Observation convertObservation(org.hl7.fhir.r4.model.Observation src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Observation tgt = new org.hl7.fhir.instance.model.Observation();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setStatus(convertObservationStatus(src.getStatus()));
+ for (org.hl7.fhir.r4.model.CodeableConcept c : src.getCategory())
+ tgt.setCategory(convertCodeableConcept(c));
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setSubject(convertReference(src.getSubject()));
+ tgt.setEncounter(convertReference(src.getContext()));
+ tgt.setEffective(convertType(src.getEffective()));
+ tgt.setIssued(src.getIssued());
+ for (org.hl7.fhir.r4.model.Reference t : src.getPerformer())
+ tgt.addPerformer(convertReference(t));
+ tgt.setValue(convertType(src.getValue()));
+ tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
+ tgt.setInterpretation(convertCodeableConcept(src.getInterpretation()));
+ tgt.setComments(src.getComment());
+ tgt.setBodySite(convertCodeableConcept(src.getBodySite()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ tgt.setSpecimen(convertReference(src.getSpecimen()));
+ tgt.setDevice(convertReference(src.getDevice()));
+ for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
+ tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
+ for (org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent t : src.getRelated())
+ tgt.addRelated(convertObservationRelatedComponent(t));
+ for (org.hl7.fhir.r4.model.Observation.ObservationComponentComponent t : src.getComponent())
+ tgt.addComponent(convertObservationComponentComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.instance.model.Observation.ObservationStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ACCEPTED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.ACCEPTED;
- case DECLINED: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.DECLINED;
- case TENTATIVE: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.TENTATIVE;
- case NEEDSACTION: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NEEDSACTION;
- default: return org.hl7.fhir.r4.model.Appointment.ParticipationStatus.NULL;
+ case REGISTERED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.REGISTERED;
+ case PRELIMINARY: return org.hl7.fhir.r4.model.Observation.ObservationStatus.PRELIMINARY;
+ case FINAL: return org.hl7.fhir.r4.model.Observation.ObservationStatus.FINAL;
+ case AMENDED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.AMENDED;
+ case CANCELLED: return org.hl7.fhir.r4.model.Observation.ObservationStatus.CANCELLED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.Observation.ObservationStatus.ENTEREDINERROR;
+ case UNKNOWN: return org.hl7.fhir.r4.model.Observation.ObservationStatus.UNKNOWN;
+ default: return org.hl7.fhir.r4.model.Observation.ObservationStatus.NULL;
}
}
- public org.hl7.fhir.instance.model.Appointment.ParticipationStatus convertParticipationStatus(org.hl7.fhir.r4.model.Appointment.ParticipationStatus src) throws FHIRException {
+ public org.hl7.fhir.instance.model.Observation.ObservationStatus convertObservationStatus(org.hl7.fhir.r4.model.Observation.ObservationStatus src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case ACCEPTED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.ACCEPTED;
- case DECLINED: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.DECLINED;
- case TENTATIVE: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.TENTATIVE;
- case NEEDSACTION: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NEEDSACTION;
- default: return org.hl7.fhir.instance.model.Appointment.ParticipationStatus.NULL;
+ case REGISTERED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.REGISTERED;
+ case PRELIMINARY: return org.hl7.fhir.instance.model.Observation.ObservationStatus.PRELIMINARY;
+ case FINAL: return org.hl7.fhir.instance.model.Observation.ObservationStatus.FINAL;
+ case AMENDED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.AMENDED;
+ case CANCELLED: return org.hl7.fhir.instance.model.Observation.ObservationStatus.CANCELLED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.Observation.ObservationStatus.ENTEREDINERROR;
+ case UNKNOWN: return org.hl7.fhir.instance.model.Observation.ObservationStatus.UNKNOWN;
+ default: return org.hl7.fhir.instance.model.Observation.ObservationStatus.NULL;
}
}
+ public org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent();
+ copyElement(src, tgt);
+ tgt.setLow(convertSimpleQuantity(src.getLow()));
+ tgt.setHigh(convertSimpleQuantity(src.getHigh()));
+ tgt.setType(convertCodeableConcept(src.getMeaning()));
+ tgt.setAge(convertRange(src.getAge()));
+ tgt.setText(src.getText());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent convertObservationReferenceRangeComponent(org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent();
+ copyElement(src, tgt);
+ tgt.setLow(convertSimpleQuantity(src.getLow()));
+ tgt.setHigh(convertSimpleQuantity(src.getHigh()));
+// for (org.hl7.fhir.r4.model.CodeableConcept c : src.getMeaning())
+ tgt.setMeaning(convertCodeableConcept(src.getType()));
+ tgt.setAge(convertRange(src.getAge()));
+ tgt.setText(src.getText());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertObservationRelationshipType(src.getType()));
+ tgt.setTarget(convertReference(src.getTarget()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent convertObservationRelatedComponent(org.hl7.fhir.r4.model.Observation.ObservationRelatedComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationRelatedComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertObservationRelationshipType(src.getType()));
+ tgt.setTarget(convertReference(src.getTarget()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.instance.model.Observation.ObservationRelationshipType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HASMEMBER: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.HASMEMBER;
+ case DERIVEDFROM: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.DERIVEDFROM;
+ case SEQUELTO: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.SEQUELTO;
+ case REPLACES: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.REPLACES;
+ case QUALIFIEDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.QUALIFIEDBY;
+ case INTERFEREDBY: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.INTERFEREDBY;
+ default: return org.hl7.fhir.r4.model.Observation.ObservationRelationshipType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Observation.ObservationRelationshipType convertObservationRelationshipType(org.hl7.fhir.r4.model.Observation.ObservationRelationshipType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case HASMEMBER: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.HASMEMBER;
+ case DERIVEDFROM: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.DERIVEDFROM;
+ case SEQUELTO: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.SEQUELTO;
+ case REPLACES: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.REPLACES;
+ case QUALIFIEDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.QUALIFIEDBY;
+ case INTERFEREDBY: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.INTERFEREDBY;
+ default: return org.hl7.fhir.instance.model.Observation.ObservationRelationshipType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.instance.model.Observation.ObservationComponentComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.r4.model.Observation.ObservationComponentComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setValue(convertType(src.getValue()));
+ tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
+ for (org.hl7.fhir.instance.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
+ tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Observation.ObservationComponentComponent convertObservationComponentComponent(org.hl7.fhir.r4.model.Observation.ObservationComponentComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Observation.ObservationComponentComponent tgt = new org.hl7.fhir.instance.model.Observation.ObservationComponentComponent();
+ copyElement(src, tgt);
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setValue(convertType(src.getValue()));
+ tgt.setDataAbsentReason(convertCodeableConcept(src.getDataAbsentReason()));
+ for (org.hl7.fhir.r4.model.Observation.ObservationReferenceRangeComponent t : src.getReferenceRange())
+ tgt.addReferenceRange(convertObservationReferenceRangeComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.instance.model.OperationDefinition src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.OperationDefinition tgt = new org.hl7.fhir.r4.model.OperationDefinition();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ tgt.setKind(convertOperationKind(src.getKind()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent t : src.getContact())
+ tgt.addContact(convertOperationDefinitionContactComponent(t));
+ tgt.setDescription(src.getDescription());
+ tgt.setPurpose(src.getRequirements());
+ if (src.hasIdempotent())
+ tgt.setIdempotent(src.getIdempotent());
+ tgt.setCode(src.getCode());
+ tgt.setComment(src.getNotes());
+ tgt.setBase(convertReference(src.getBase()));
+ tgt.setSystem(src.getSystem());
+ for (org.hl7.fhir.instance.model.CodeType t : src.getType())
+ tgt.addResource(t.getValue());
+ tgt.setType(tgt.hasResource());
+ tgt.setInstance(src.getInstance());
+ for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter())
+ tgt.addParameter(convertOperationDefinitionParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OperationDefinition convertOperationDefinition(org.hl7.fhir.r4.model.OperationDefinition src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.OperationDefinition tgt = new org.hl7.fhir.instance.model.OperationDefinition();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ tgt.setKind(convertOperationKind(src.getKind()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+ tgt.addContact(convertOperationDefinitionContactComponent(t));
+ tgt.setDescription(src.getDescription());
+ tgt.setRequirements(src.getPurpose());
+ tgt.setIdempotent(src.getIdempotent());
+ tgt.setCode(src.getCode());
+ tgt.setNotes(src.getComment());
+ if (src.hasBase())
+ tgt.setBase(convertReference(src.getBase()));
+ tgt.setSystem(src.getSystem());
+ if (src.getType())
+ for (org.hl7.fhir.r4.model.CodeType t : src.getResource())
+ tgt.addType(t.getValue());
+ tgt.setInstance(src.getInstance());
+ for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getParameter())
+ tgt.addParameter(convertOperationDefinitionParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.instance.model.OperationDefinition.OperationKind src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OPERATION: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.OPERATION;
+ case QUERY: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.QUERY;
+ default: return org.hl7.fhir.r4.model.OperationDefinition.OperationKind.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.OperationDefinition.OperationKind convertOperationKind(org.hl7.fhir.r4.model.OperationDefinition.OperationKind src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OPERATION: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.OPERATION;
+ case QUERY: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.QUERY;
+ default: return org.hl7.fhir.instance.model.OperationDefinition.OperationKind.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ContactDetail convertOperationDefinitionContactComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent convertOperationDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionContactComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setUse(convertOperationParameterUse(src.getUse()));
+ tgt.setMin(src.getMin());
+ tgt.setMax(src.getMax());
+ tgt.setDocumentation(src.getDocumentation());
+ tgt.setType(src.getType());
+ tgt.setProfile(convertReference(src.getProfile()));
+ tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding()));
+ for (org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart())
+ tgt.addPart(convertOperationDefinitionParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent convertOperationDefinitionParameterComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setUse(convertOperationParameterUse(src.getUse()));
+ tgt.setMin(src.getMin());
+ tgt.setMax(src.getMax());
+ tgt.setDocumentation(src.getDocumentation());
+ if (src.hasSearchType()) {
+ tgt.setType(src.getSearchType().toCode());
+ tgt.setType("string");
+ } else
+ tgt.setType(src.getType());
+ if (src.hasProfile())
+ tgt.setProfile(convertReference(src.getProfile()));
+ if (src.hasBinding())
+ tgt.setBinding(convertOperationDefinitionParameterBindingComponent(src.getBinding()));
+ for (org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterComponent t : src.getPart())
+ tgt.addPart(convertOperationDefinitionParameterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case IN: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.IN;
+ case OUT: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.OUT;
+ default: return org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse convertOperationParameterUse(org.hl7.fhir.r4.model.OperationDefinition.OperationParameterUse src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case IN: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.IN;
+ case OUT: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.OUT;
+ default: return org.hl7.fhir.instance.model.OperationDefinition.OperationParameterUse.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent();
+ copyElement(src, tgt);
+ tgt.setStrength(convertBindingStrength(src.getStrength()));
+ tgt.setValueSet(convertType(src.getValueSet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent convertOperationDefinitionParameterBindingComponent(org.hl7.fhir.r4.model.OperationDefinition.OperationDefinitionParameterBindingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent tgt = new org.hl7.fhir.instance.model.OperationDefinition.OperationDefinitionParameterBindingComponent();
+ copyElement(src, tgt);
+ tgt.setStrength(convertBindingStrength(src.getStrength()));
+ tgt.setValueSet(convertType(src.getValueSet()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.instance.model.OperationOutcome src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.OperationOutcome tgt = new org.hl7.fhir.r4.model.OperationOutcome();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue())
+ tgt.addIssue(convertOperationOutcomeIssueComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OperationOutcome convertOperationOutcome(org.hl7.fhir.r4.model.OperationOutcome src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.OperationOutcome tgt = new org.hl7.fhir.instance.model.OperationOutcome();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent t : src.getIssue())
+ tgt.addIssue(convertOperationOutcomeIssueComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent();
+ copyElement(src, tgt);
+ tgt.setSeverity(convertIssueSeverity(src.getSeverity()));
+ tgt.setCode(convertIssueType(src.getCode()));
+ tgt.setDetails(convertCodeableConcept(src.getDetails()));
+ tgt.setDiagnostics(src.getDiagnostics());
+ for (org.hl7.fhir.instance.model.StringType t : src.getLocation())
+ tgt.addLocation(t.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent convertOperationOutcomeIssueComponent(org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent tgt = new org.hl7.fhir.instance.model.OperationOutcome.OperationOutcomeIssueComponent();
+ copyElement(src, tgt);
+ tgt.setSeverity(convertIssueSeverity(src.getSeverity()));
+ tgt.setCode(convertIssueType(src.getCode()));
+ tgt.setDetails(convertCodeableConcept(src.getDetails()));
+ tgt.setDiagnostics(src.getDiagnostics());
+ for (org.hl7.fhir.r4.model.StringType t : src.getLocation())
+ tgt.addLocation(t.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case FATAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.FATAL;
+ case ERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.ERROR;
+ case WARNING: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.WARNING;
+ case INFORMATION: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.INFORMATION;
+ default: return org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity convertIssueSeverity(org.hl7.fhir.r4.model.OperationOutcome.IssueSeverity src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case FATAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.FATAL;
+ case ERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.ERROR;
+ case WARNING: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.WARNING;
+ case INFORMATION: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.INFORMATION;
+ default: return org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.instance.model.OperationOutcome.IssueType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVALID;
+ case STRUCTURE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.STRUCTURE;
+ case REQUIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.REQUIRED;
+ case VALUE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.VALUE;
+ case INVARIANT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INVARIANT;
+ case SECURITY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SECURITY;
+ case LOGIN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOGIN;
+ case UNKNOWN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.UNKNOWN;
+ case EXPIRED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXPIRED;
+ case FORBIDDEN: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.FORBIDDEN;
+ case SUPPRESSED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.SUPPRESSED;
+ case PROCESSING: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.PROCESSING;
+ case NOTSUPPORTED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTSUPPORTED;
+ case DUPLICATE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.DUPLICATE;
+ case NOTFOUND: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOTFOUND;
+ case TOOLONG: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOLONG;
+ case CODEINVALID: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CODEINVALID;
+ case EXTENSION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXTENSION;
+ case TOOCOSTLY: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TOOCOSTLY;
+ case BUSINESSRULE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.BUSINESSRULE;
+ case CONFLICT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.CONFLICT;
+ case INCOMPLETE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INCOMPLETE;
+ case TRANSIENT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TRANSIENT;
+ case LOCKERROR: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.LOCKERROR;
+ case NOSTORE: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NOSTORE;
+ case EXCEPTION: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.EXCEPTION;
+ case TIMEOUT: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.TIMEOUT;
+ case THROTTLED: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.THROTTLED;
+ case INFORMATIONAL: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.INFORMATIONAL;
+ default: return org.hl7.fhir.r4.model.OperationOutcome.IssueType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.OperationOutcome.IssueType convertIssueType(org.hl7.fhir.r4.model.OperationOutcome.IssueType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID;
+ case STRUCTURE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.STRUCTURE;
+ case REQUIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.REQUIRED;
+ case VALUE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.VALUE;
+ case INVARIANT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVARIANT;
+ case SECURITY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SECURITY;
+ case LOGIN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOGIN;
+ case UNKNOWN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.UNKNOWN;
+ case EXPIRED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXPIRED;
+ case FORBIDDEN: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.FORBIDDEN;
+ case SUPPRESSED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.SUPPRESSED;
+ case PROCESSING: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.PROCESSING;
+ case NOTSUPPORTED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTSUPPORTED;
+ case DUPLICATE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.DUPLICATE;
+ case NOTFOUND: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOTFOUND;
+ case TOOLONG: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOLONG;
+ case CODEINVALID: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CODEINVALID;
+ case EXTENSION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXTENSION;
+ case TOOCOSTLY: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TOOCOSTLY;
+ case BUSINESSRULE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.BUSINESSRULE;
+ case CONFLICT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.CONFLICT;
+ case INCOMPLETE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INCOMPLETE;
+ case TRANSIENT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TRANSIENT;
+ case LOCKERROR: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.LOCKERROR;
+ case NOSTORE: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NOSTORE;
+ case EXCEPTION: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.EXCEPTION;
+ case TIMEOUT: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.TIMEOUT;
+ case THROTTLED: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.THROTTLED;
+ case INFORMATIONAL: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.INFORMATIONAL;
+ default: return org.hl7.fhir.instance.model.OperationOutcome.IssueType.NULL;
+ }
+ }
+
+
+ public org.hl7.fhir.r4.model.Organization convertOrganization(org.hl7.fhir.instance.model.Organization src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Organization tgt = new org.hl7.fhir.r4.model.Organization();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setActive(src.getActive());
+ tgt.addType(convertCodeableConcept(src.getType()));
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ for (org.hl7.fhir.instance.model.Address t : src.getAddress())
+ tgt.addAddress(convertAddress(t));
+ tgt.setPartOf(convertReference(src.getPartOf()));
+ for (org.hl7.fhir.instance.model.Organization.OrganizationContactComponent t : src.getContact())
+ tgt.addContact(convertOrganizationContactComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Organization convertOrganization(org.hl7.fhir.r4.model.Organization src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Organization tgt = new org.hl7.fhir.instance.model.Organization();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setActive(src.getActive());
+ tgt.setType(convertCodeableConcept(src.getTypeFirstRep()));
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ for (org.hl7.fhir.r4.model.Address t : src.getAddress())
+ tgt.addAddress(convertAddress(t));
+ tgt.setPartOf(convertReference(src.getPartOf()));
+ for (org.hl7.fhir.r4.model.Organization.OrganizationContactComponent t : src.getContact())
+ tgt.addContact(convertOrganizationContactComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.instance.model.Organization.OrganizationContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.r4.model.Organization.OrganizationContactComponent();
+ copyElement(src, tgt);
+ tgt.setPurpose(convertCodeableConcept(src.getPurpose()));
+ tgt.setName(convertHumanName(src.getName()));
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ tgt.setAddress(convertAddress(src.getAddress()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Organization.OrganizationContactComponent convertOrganizationContactComponent(org.hl7.fhir.r4.model.Organization.OrganizationContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Organization.OrganizationContactComponent tgt = new org.hl7.fhir.instance.model.Organization.OrganizationContactComponent();
+ copyElement(src, tgt);
+ tgt.setPurpose(convertCodeableConcept(src.getPurpose()));
+ tgt.setName(convertHumanName(src.getName()));
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ tgt.setAddress(convertAddress(src.getAddress()));
+ return tgt;
+ }
+
+
public org.hl7.fhir.r4.model.Patient convertPatient(org.hl7.fhir.instance.model.Patient src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -8835,6 +9552,62 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.instance.model.Patient.ContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Patient.ContactComponent tgt = new org.hl7.fhir.r4.model.Patient.ContactComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRelationship())
+ tgt.addRelationship(convertCodeableConcept(t));
+ tgt.setName(convertHumanName(src.getName()));
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ tgt.setAddress(convertAddress(src.getAddress()));
+ tgt.setGender(convertAdministrativeGender(src.getGender()));
+ tgt.setOrganization(convertReference(src.getOrganization()));
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Patient.ContactComponent convertContactComponent(org.hl7.fhir.r4.model.Patient.ContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Patient.ContactComponent tgt = new org.hl7.fhir.instance.model.Patient.ContactComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRelationship())
+ tgt.addRelationship(convertCodeableConcept(t));
+ tgt.setName(convertHumanName(src.getName()));
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ tgt.setAddress(convertAddress(src.getAddress()));
+ tgt.setGender(convertAdministrativeGender(src.getGender()));
+ tgt.setOrganization(convertReference(src.getOrganization()));
+ tgt.setPeriod(convertPeriod(src.getPeriod()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.instance.model.Patient.AnimalComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Patient.AnimalComponent tgt = new org.hl7.fhir.r4.model.Patient.AnimalComponent();
+ copyElement(src, tgt);
+ tgt.setSpecies(convertCodeableConcept(src.getSpecies()));
+ tgt.setBreed(convertCodeableConcept(src.getBreed()));
+ tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Patient.AnimalComponent convertAnimalComponent(org.hl7.fhir.r4.model.Patient.AnimalComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Patient.AnimalComponent tgt = new org.hl7.fhir.instance.model.Patient.AnimalComponent();
+ copyElement(src, tgt);
+ tgt.setSpecies(convertCodeableConcept(src.getSpecies()));
+ tgt.setBreed(convertCodeableConcept(src.getBreed()));
+ tgt.setGenderStatus(convertCodeableConcept(src.getGenderStatus()));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.Patient.PatientCommunicationComponent convertPatientCommunicationComponent(org.hl7.fhir.instance.model.Patient.PatientCommunicationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -8875,26 +9648,30 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Period convertPeriod(org.hl7.fhir.instance.model.Period src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.r4.model.Patient.LinkType convertLinkType(org.hl7.fhir.instance.model.Patient.LinkType src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.r4.model.Period tgt = new org.hl7.fhir.r4.model.Period();
- copyElement(src, tgt);
- tgt.setStart(src.getStart());
- tgt.setEnd(src.getEnd());
- return tgt;
+ switch (src) {
+ case REPLACE: return org.hl7.fhir.r4.model.Patient.LinkType.REPLACEDBY;
+ case REFER: return org.hl7.fhir.r4.model.Patient.LinkType.REFER;
+ case SEEALSO: return org.hl7.fhir.r4.model.Patient.LinkType.SEEALSO;
+ default: return org.hl7.fhir.r4.model.Patient.LinkType.NULL;
+ }
}
- public org.hl7.fhir.instance.model.Period convertPeriod(org.hl7.fhir.r4.model.Period src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.instance.model.Patient.LinkType convertLinkType(org.hl7.fhir.r4.model.Patient.LinkType src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.instance.model.Period tgt = new org.hl7.fhir.instance.model.Period();
- copyElement(src, tgt);
- tgt.setStart(src.getStart());
- tgt.setEnd(src.getEnd());
- return tgt;
+ switch (src) {
+ case REPLACEDBY: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE;
+ case REPLACES: return org.hl7.fhir.instance.model.Patient.LinkType.REPLACE;
+ case REFER: return org.hl7.fhir.instance.model.Patient.LinkType.REFER;
+ case SEEALSO: return org.hl7.fhir.instance.model.Patient.LinkType.SEEALSO;
+ default: return org.hl7.fhir.instance.model.Patient.LinkType.NULL;
+ }
}
+
public org.hl7.fhir.r4.model.Person convertPerson(org.hl7.fhir.instance.model.Person src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -8961,16 +9738,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.PositiveIntType convertPositiveInt(org.hl7.fhir.instance.model.PositiveIntType src) throws FHIRException {
- org.hl7.fhir.r4.model.PositiveIntType tgt = new org.hl7.fhir.r4.model.PositiveIntType(src.getValue());
- copyElement(src, tgt);
- return tgt;
+ public org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case LEVEL1: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL1;
+ case LEVEL2: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL2;
+ case LEVEL3: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL3;
+ case LEVEL4: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.LEVEL4;
+ default: return org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel.NULL;
+ }
}
- public org.hl7.fhir.instance.model.PositiveIntType convertPositiveInt(org.hl7.fhir.r4.model.PositiveIntType src) throws FHIRException {
- org.hl7.fhir.instance.model.PositiveIntType tgt = new org.hl7.fhir.instance.model.PositiveIntType(src.getValue());
- copyElement(src, tgt);
- return tgt;
+ public org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel convertIdentityAssuranceLevel(org.hl7.fhir.r4.model.Person.IdentityAssuranceLevel src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case LEVEL1: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL1;
+ case LEVEL2: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL2;
+ case LEVEL3: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL3;
+ case LEVEL4: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.LEVEL4;
+ default: return org.hl7.fhir.instance.model.Person.IdentityAssuranceLevel.NULL;
+ }
}
public org.hl7.fhir.r4.model.Practitioner convertPractitioner(org.hl7.fhir.instance.model.Practitioner src) throws FHIRException {
@@ -9027,6 +9816,40 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+// public org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent();
+// copyElement(src, tgt);
+// tgt.setOrganization(convertReference(src.getManagingOrganization()));
+// tgt.setCode(convertCodeableConcept(src.getRole()));
+// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialty())
+// tgt.addSpecialty(convertCodeableConcept(t));
+// tgt.setPeriod(convertPeriod(src.getPeriod()));
+// for (org.hl7.fhir.instance.model.Reference t : src.getLocation())
+// tgt.addLocation(convertReference(t));
+// for (org.hl7.fhir.instance.model.Reference t : src.getHealthcareService())
+// tgt.addHealthcareService(convertReference(t));
+// return tgt;
+// }
+
+// public org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent src) throws FHIRException {
+// if (src == null || src.isEmpty())
+// return null;
+// org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent();
+// copyElement(src, tgt);
+// tgt.setManagingOrganization(convertReference(src.getOrganization()));
+// tgt.setRole(convertCodeableConcept(src.getCode()));
+// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty())
+// tgt.addSpecialty(convertCodeableConcept(t));
+// tgt.setPeriod(convertPeriod(src.getPeriod()));
+// for (org.hl7.fhir.r4.model.Reference t : src.getLocation())
+// tgt.addLocation(convertReference(t));
+// for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService())
+// tgt.addHealthcareService(convertReference(t));
+// return tgt;
+// }
+
public org.hl7.fhir.r4.model.Practitioner.PractitionerQualificationComponent convertPractitionerQualificationComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerQualificationComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9053,32 +9876,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- private org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority convertPriorityCode(org.hl7.fhir.instance.model.CodeableConcept priority) {
- for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) {
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode()))
- return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ROUTINE;
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode()))
- return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.URGENT;
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode()))
- return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.STAT;
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode()))
- return org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority.ASAP;
- }
- return null;
- }
-
- private org.hl7.fhir.instance.model.CodeableConcept convertPriorityCode(org.hl7.fhir.r4.model.CommunicationRequest.CommunicationPriority priority) {
- org.hl7.fhir.instance.model.CodeableConcept cc = new org.hl7.fhir.instance.model.CodeableConcept();
- switch (priority) {
- case ROUTINE: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("routine"); break;
- case URGENT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("urgent"); break;
- case STAT: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("stat"); break;
- case ASAP: cc.addCoding().setSystem("http://hl7.org/fhir/diagnostic-order-priority").setCode("asap"); break;
- default: return null;
- }
- return cc;
- }
-
public org.hl7.fhir.r4.model.Procedure convertProcedure(org.hl7.fhir.instance.model.Procedure src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9155,24 +9952,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.instance.model.Procedure.ProcedureStatus src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent();
- copyElement(src, tgt);
- tgt.setAction(convertCodeableConcept(src.getAction()));
- tgt.setManipulated(convertReference(src.getManipulated()));
- return tgt;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS;
+ case ABORTED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ABORTED;
+ case COMPLETED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL;
+ }
}
- public org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
+ public org.hl7.fhir.instance.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException {
+ if (src == null)
return null;
- org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent();
- copyElement(src, tgt);
- tgt.setAction(convertCodeableConcept(src.getAction()));
- tgt.setManipulated(convertReference(src.getManipulated()));
- return tgt;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.INPROGRESS;
+ case ABORTED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ABORTED;
+ case COMPLETED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.COMPLETED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.NULL;
+ }
}
public org.hl7.fhir.r4.model.Procedure.ProcedurePerformerComponent convertProcedurePerformerComponent(org.hl7.fhir.instance.model.Procedure.ProcedurePerformerComponent src) throws FHIRException {
@@ -9195,6 +9996,26 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent();
+ copyElement(src, tgt);
+ tgt.setAction(convertCodeableConcept(src.getAction()));
+ tgt.setManipulated(convertReference(src.getManipulated()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent convertProcedureFocalDeviceComponent(org.hl7.fhir.r4.model.Procedure.ProcedureFocalDeviceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent tgt = new org.hl7.fhir.instance.model.Procedure.ProcedureFocalDeviceComponent();
+ copyElement(src, tgt);
+ tgt.setAction(convertCodeableConcept(src.getAction()));
+ tgt.setManipulated(convertReference(src.getManipulated()));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.ProcedureRequest convertProcedureRequest(org.hl7.fhir.instance.model.ProcedureRequest src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9246,30 +10067,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ROUTINE: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE;
- case URGENT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT;
- case STAT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT;
- case ASAP: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP;
- default: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ROUTINE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE;
- case URGENT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.URGENT;
- case STAT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.STAT;
- case ASAP: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ASAP;
- default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestStatus convertProcedureRequestStatus(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestStatus src) throws FHIRException {
if (src == null)
return null;
@@ -9306,48 +10103,73 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.instance.model.Procedure.ProcedureStatus src) throws FHIRException {
+ public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case INPROGRESS: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.INPROGRESS;
- case ABORTED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ABORTED;
- case COMPLETED: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.r4.model.Procedure.ProcedureStatus.NULL;
+ case ROUTINE: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE;
+ case URGENT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT;
+ case STAT: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT;
+ case ASAP: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP;
+ default: return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.NULL;
}
}
- public org.hl7.fhir.instance.model.Procedure.ProcedureStatus convertProcedureStatus(org.hl7.fhir.r4.model.Procedure.ProcedureStatus src) throws FHIRException {
+ public org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority convertProcedureRequestPriority(org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case INPROGRESS: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.INPROGRESS;
- case ABORTED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ABORTED;
- case COMPLETED: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.COMPLETED;
- case ENTEREDINERROR: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.ENTEREDINERROR;
- default: return org.hl7.fhir.instance.model.Procedure.ProcedureStatus.NULL;
+ case ROUTINE: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE;
+ case URGENT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.URGENT;
+ case STAT: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.STAT;
+ case ASAP: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.ASAP;
+ default: return org.hl7.fhir.instance.model.ProcedureRequest.ProcedureRequestPriority.NULL;
}
}
- public org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation src) throws FHIRException {
+
+ public org.hl7.fhir.r4.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.instance.model.ProcessRequest.ActionList src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case XMLATTR: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.XMLATTR;
- default: return org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation.NULL;
+ case CANCEL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.CANCEL;
+ case POLL: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.POLL;
+ case REPROCESS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.REPROCESS;
+ case STATUS: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.STATUS;
+ default: return org.hl7.fhir.r4.model.ProcessRequest.ActionList.NULL;
}
}
- public org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation convertPropertyRepresentation(org.hl7.fhir.r4.model.ElementDefinition.PropertyRepresentation src) throws FHIRException {
+ public org.hl7.fhir.instance.model.ProcessRequest.ActionList convertActionList(org.hl7.fhir.r4.model.ProcessRequest.ActionList src) throws FHIRException {
if (src == null)
return null;
switch (src) {
- case XMLATTR: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.XMLATTR;
- default: return org.hl7.fhir.instance.model.ElementDefinition.PropertyRepresentation.NULL;
+ case CANCEL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.CANCEL;
+ case POLL: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.POLL;
+ case REPROCESS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.REPROCESS;
+ case STATUS: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.STATUS;
+ default: return org.hl7.fhir.instance.model.ProcessRequest.ActionList.NULL;
}
}
+ public org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent();
+ copyElement(src, tgt);
+ tgt.setSequenceLinkId(src.getSequenceLinkId());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent convertItemsComponent(org.hl7.fhir.r4.model.ProcessRequest.ItemsComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent tgt = new org.hl7.fhir.instance.model.ProcessRequest.ItemsComponent();
+ copyElement(src, tgt);
+ tgt.setSequenceLinkId(src.getSequenceLinkId());
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.Provenance convertProvenance(org.hl7.fhir.instance.model.Provenance src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9356,6 +10178,7 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
for (org.hl7.fhir.instance.model.Reference t : src.getTarget())
tgt.addTarget(convertReference(t));
tgt.setRecorded(src.getRecorded());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getReason())
tgt.setLocation(convertReference(src.getLocation()));
for (org.hl7.fhir.instance.model.UriType t : src.getPolicy())
tgt.addPolicy(t.getValue());
@@ -9458,56 +10281,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
- public org.hl7.fhir.r4.model.Quantity convertQuantity(org.hl7.fhir.instance.model.Quantity src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Quantity tgt = new org.hl7.fhir.r4.model.Quantity();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Quantity convertQuantity(org.hl7.fhir.r4.model.Quantity src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Quantity tgt = new org.hl7.fhir.instance.model.Quantity();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.instance.model.Quantity.QuantityComparator src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case LESS_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_THAN;
- case LESS_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.LESS_OR_EQUAL;
- case GREATER_OR_EQUAL: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_OR_EQUAL;
- case GREATER_THAN: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.GREATER_THAN;
- default: return org.hl7.fhir.r4.model.Quantity.QuantityComparator.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Quantity.QuantityComparator convertQuantityComparator(org.hl7.fhir.r4.model.Quantity.QuantityComparator src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case LESS_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_THAN;
- case LESS_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.LESS_OR_EQUAL;
- case GREATER_OR_EQUAL: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_OR_EQUAL;
- case GREATER_THAN: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.GREATER_THAN;
- default: return org.hl7.fhir.instance.model.Quantity.QuantityComparator.NULL;
- }
- }
-
public org.hl7.fhir.r4.model.Questionnaire convertQuestionnaire(org.hl7.fhir.instance.model.Questionnaire src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9570,6 +10343,48 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
tgt.addTelecom(convertContactPoint(src));
return tgt;
}
+
+ private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT;
+ case PUBLISHED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE;
+ case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED;
+ default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL;
+ }
+ }
+
+ private static org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT;
+ case ACTIVE: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
+ case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED;
+ default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.instance.model.Questionnaire.QuestionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent();
+ copyElement(src, tgt);
+ tgt.setLinkId(src.getLinkId());
+ for (org.hl7.fhir.instance.model.Coding t : src.getConcept())
+ tgt.addCode(convertCoding(t));
+ tgt.setText(src.getText());
+ tgt.setType(convertQuestionnaireQuestionType(src.getType()));
+ tgt.setRequired(src.getRequired());
+ tgt.setRepeats(src.getRepeats());
+ tgt.setOptions(convertReference(src.getOptions()));
+ for (org.hl7.fhir.instance.model.Coding t : src.getOption())
+ tgt.addOption().setValue(convertCoding(t));
+ for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup())
+ tgt.addItem(convertQuestionnaireGroupComponent(t));
+ return tgt;
+ }
public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireGroupComponent(org.hl7.fhir.instance.model.Questionnaire.GroupComponent src) throws FHIRException {
if (src == null || src.isEmpty())
@@ -9609,76 +10424,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent();
- copyElement(src, tgt);
- tgt.setLinkId(src.getLinkId());
- tgt.setText(src.getText());
- tgt.setSubject(convertReference(src.getSubject()));
- for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem())
- if (t.hasAnswer())
- tgt.addQuestion(convertQuestionnaireItemToQuestion(t));
- else
- tgt.addGroup(convertQuestionnaireItemToGroup(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent();
- copyElement(src, tgt);
- tgt.setLinkId(src.getLinkId());
- tgt.setText(src.getText());
- for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer())
- tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case BOOLEAN: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.BOOLEAN;
- case DECIMAL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DECIMAL;
- case INTEGER: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.INTEGER;
- case DATE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATE;
- case DATETIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATETIME;
- case TIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TIME;
- case STRING: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.STRING;
- case TEXT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TEXT;
- case URL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.URL;
- case CHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.CHOICE;
- case OPENCHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.OPENCHOICE;
- case ATTACHMENT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.ATTACHMENT;
- case REFERENCE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.REFERENCE;
- case QUANTITY: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.QUANTITY;
- default: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.instance.model.Questionnaire.QuestionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent tgt = new org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent();
- copyElement(src, tgt);
- tgt.setLinkId(src.getLinkId());
- for (org.hl7.fhir.instance.model.Coding t : src.getConcept())
- tgt.addCode(convertCoding(t));
- tgt.setText(src.getText());
- tgt.setType(convertQuestionnaireQuestionType(src.getType()));
- tgt.setRequired(src.getRequired());
- tgt.setRepeats(src.getRepeats());
- tgt.setOptions(convertReference(src.getOptions()));
- for (org.hl7.fhir.instance.model.Coding t : src.getOption())
- tgt.addOption().setValue(convertCoding(t));
- for (org.hl7.fhir.instance.model.Questionnaire.GroupComponent t : src.getGroup())
- tgt.addItem(convertQuestionnaireGroupComponent(t));
- return tgt;
- }
-
public org.hl7.fhir.instance.model.Questionnaire.QuestionComponent convertQuestionnaireQuestionComponent(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9727,6 +10472,28 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
}
}
+ public org.hl7.fhir.instance.model.Questionnaire.AnswerFormat convertQuestionnaireItemType(org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case BOOLEAN: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.BOOLEAN;
+ case DECIMAL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DECIMAL;
+ case INTEGER: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.INTEGER;
+ case DATE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATE;
+ case DATETIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.DATETIME;
+ case TIME: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TIME;
+ case STRING: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.STRING;
+ case TEXT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.TEXT;
+ case URL: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.URL;
+ case CHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.CHOICE;
+ case OPENCHOICE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.OPENCHOICE;
+ case ATTACHMENT: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.ATTACHMENT;
+ case REFERENCE: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.REFERENCE;
+ case QUANTITY: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.QUANTITY;
+ default: return org.hl7.fhir.instance.model.Questionnaire.AnswerFormat.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.QuestionnaireResponse convertQuestionnaireResponse(org.hl7.fhir.instance.model.QuestionnaireResponse src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9766,6 +10533,29 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+
+ public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS;
+ case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED;
+ case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED;
+ default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS;
+ case COMPLETED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED;
+ case AMENDED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED;
+ default: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL;
+ }
+ }
+
public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseGroupComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9781,6 +10571,46 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent();
+ copyElement(src, tgt);
+ tgt.setLinkId(src.getLinkId());
+ tgt.setText(src.getText());
+ for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer())
+ tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent convertQuestionnaireItemToGroup(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.GroupComponent();
+ copyElement(src, tgt);
+ tgt.setLinkId(src.getLinkId());
+ tgt.setText(src.getText());
+ tgt.setSubject(convertReference(src.getSubject()));
+ for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent t : src.getItem())
+ if (t.hasAnswer())
+ tgt.addQuestion(convertQuestionnaireItemToQuestion(t));
+ else
+ tgt.addGroup(convertQuestionnaireItemToGroup(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent convertQuestionnaireItemToQuestion(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent tgt = new org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent();
+ copyElement(src, tgt);
+ tgt.setLinkId(src.getLinkId());
+ tgt.setText(src.getText());
+ for (org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent t : src.getAnswer())
+ tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t));
+ return tgt;
+ }
+
public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemAnswerComponent convertQuestionnaireResponseItemAnswerComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9803,148 +10633,6 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
- public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent convertQuestionnaireResponseQuestionComponent(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent tgt = new org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseItemComponent();
- copyElement(src, tgt);
- tgt.setLinkId(src.getLinkId());
- tgt.setText(src.getText());
- for (org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionAnswerComponent t : src.getAnswer())
- tgt.addAnswer(convertQuestionnaireResponseItemAnswerComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS;
- case COMPLETED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED;
- case AMENDED: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED;
- default: return org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus convertQuestionnaireResponseStatus(org.hl7.fhir.r4.model.QuestionnaireResponse.QuestionnaireResponseStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.INPROGRESS;
- case COMPLETED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.COMPLETED;
- case AMENDED: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.AMENDED;
- default: return org.hl7.fhir.instance.model.QuestionnaireResponse.QuestionnaireResponseStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Range convertRange(org.hl7.fhir.instance.model.Range src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Range tgt = new org.hl7.fhir.r4.model.Range();
- copyElement(src, tgt);
- tgt.setLow(convertSimpleQuantity(src.getLow()));
- tgt.setHigh(convertSimpleQuantity(src.getHigh()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Range convertRange(org.hl7.fhir.r4.model.Range src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Range tgt = new org.hl7.fhir.instance.model.Range();
- copyElement(src, tgt);
- tgt.setLow(convertSimpleQuantity(src.getLow()));
- tgt.setHigh(convertSimpleQuantity(src.getHigh()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Ratio convertRatio(org.hl7.fhir.instance.model.Ratio src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Ratio tgt = new org.hl7.fhir.r4.model.Ratio();
- copyElement(src, tgt);
- tgt.setNumerator(convertQuantity(src.getNumerator()));
- tgt.setDenominator(convertQuantity(src.getDenominator()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Ratio convertRatio(org.hl7.fhir.r4.model.Ratio src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Ratio tgt = new org.hl7.fhir.instance.model.Ratio();
- copyElement(src, tgt);
- tgt.setNumerator(convertQuantity(src.getNumerator()));
- tgt.setDenominator(convertQuantity(src.getDenominator()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Reference convertReference(org.hl7.fhir.instance.model.Reference src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Reference tgt = new org.hl7.fhir.r4.model.Reference();
- copyElement(src, tgt);
- tgt.setReference(src.getReference());
- tgt.setDisplay(src.getDisplay());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Reference convertReference(org.hl7.fhir.r4.model.Reference src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Reference tgt = new org.hl7.fhir.instance.model.Reference();
- copyElement(src, tgt);
- tgt.setReference(src.getReference());
- tgt.setDisplay(src.getDisplay());
- return tgt;
- }
-
-// public org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent tgt = new org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent();
-// copyElement(src, tgt);
-// tgt.setOrganization(convertReference(src.getManagingOrganization()));
-// tgt.setCode(convertCodeableConcept(src.getRole()));
-// for (org.hl7.fhir.instance.model.CodeableConcept t : src.getSpecialty())
-// tgt.addSpecialty(convertCodeableConcept(t));
-// tgt.setPeriod(convertPeriod(src.getPeriod()));
-// for (org.hl7.fhir.instance.model.Reference t : src.getLocation())
-// tgt.addLocation(convertReference(t));
-// for (org.hl7.fhir.instance.model.Reference t : src.getHealthcareService())
-// tgt.addHealthcareService(convertReference(t));
-// return tgt;
-// }
-
-// public org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent convertPractitionerPractitionerRoleComponent(org.hl7.fhir.r4.model.Practitioner.PractitionerRoleComponent src) throws FHIRException {
-// if (src == null || src.isEmpty())
-// return null;
-// org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent tgt = new org.hl7.fhir.instance.model.Practitioner.PractitionerPractitionerRoleComponent();
-// copyElement(src, tgt);
-// tgt.setManagingOrganization(convertReference(src.getOrganization()));
-// tgt.setRole(convertCodeableConcept(src.getCode()));
-// for (org.hl7.fhir.r4.model.CodeableConcept t : src.getSpecialty())
-// tgt.addSpecialty(convertCodeableConcept(t));
-// tgt.setPeriod(convertPeriod(src.getPeriod()));
-// for (org.hl7.fhir.r4.model.Reference t : src.getLocation())
-// tgt.addLocation(convertReference(t));
-// for (org.hl7.fhir.r4.model.Reference t : src.getHealthcareService())
-// tgt.addHealthcareService(convertReference(t));
-// return tgt;
-// }
-
- private org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertReferralPriorityCode(CodeableConcept priority) {
- for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) {
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode()))
- return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE;
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode()))
- return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT;
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode()))
- return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT;
- if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode()))
- return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP;
- }
- return null;
- }
-
public org.hl7.fhir.r4.model.ProcedureRequest convertReferralRequest(org.hl7.fhir.instance.model.ReferralRequest src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -9965,6 +10653,21 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ private org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority convertReferralPriorityCode(CodeableConcept priority) {
+ for (org.hl7.fhir.instance.model.Coding c : priority.getCoding()) {
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "routine".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ROUTINE;
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "urgent".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.URGENT;
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "stat".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.STAT;
+ if ("http://hl7.org/fhir/diagnostic-order-priority".equals(c.getSystem()) && "asap".equals(c.getCode()))
+ return org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestPriority.ASAP;
+ }
+ return null;
+ }
+
+
public org.hl7.fhir.r4.model.ProcedureRequest.ProcedureRequestStatus convertReferralStatus(org.hl7.fhir.instance.model.ReferralRequest.ReferralStatus src) throws FHIRException {
if (src == null)
return null;
@@ -10025,6 +10728,1998 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
return tgt;
}
+ public org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.instance.model.RiskAssessment src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment();
+ copyDomainResource(src, tgt);
+ tgt.setSubject(convertReference(src.getSubject()));
+// tgt.setDate(src.getDate());
+ tgt.setCondition(convertReference(src.getCondition()));
+ tgt.setContext(convertReference(src.getEncounter()));
+ tgt.setPerformer(convertReference(src.getPerformer()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getBasis())
+ tgt.addBasis(convertReference(t));
+ for (org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction())
+ tgt.addPrediction(convertRiskAssessmentPredictionComponent(t));
+ tgt.setMitigation(src.getMitigation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.RiskAssessment tgt = new org.hl7.fhir.instance.model.RiskAssessment();
+ copyDomainResource(src, tgt);
+ tgt.setSubject(convertReference(src.getSubject()));
+// tgt.setDateElement(src.getOccurrenceDateTimeType());
+ tgt.setCondition(convertReference(src.getCondition()));
+ tgt.setEncounter(convertReference(src.getContext()));
+ tgt.setPerformer(convertReference(src.getPerformer()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setMethod(convertCodeableConcept(src.getMethod()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getBasis())
+ tgt.addBasis(convertReference(t));
+ for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction())
+ tgt.addPrediction(convertRiskAssessmentPredictionComponent(t));
+ tgt.setMitigation(src.getMitigation());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent();
+ copyElement(src, tgt);
+ tgt.setOutcome(convertCodeableConcept(src.getOutcome()));
+ tgt.setProbability(convertType(src.getProbability()));
+ tgt.setRelativeRisk(src.getRelativeRisk());
+ tgt.setWhen(convertType(src.getWhen()));
+ tgt.setRationale(src.getRationale());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent();
+ copyElement(src, tgt);
+ tgt.setOutcome(convertCodeableConcept(src.getOutcome()));
+ tgt.setProbability(convertType(src.getProbability()));
+ tgt.setRelativeRisk(src.getRelativeRisk());
+ tgt.setWhen(convertType(src.getWhen()));
+ tgt.setRationale(src.getRationale());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.instance.model.Schedule src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType())
+ tgt.addServiceType(convertCodeableConcept(t));
+ tgt.addActor(convertReference(src.getActor()));
+ tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon()));
+ tgt.setComment(src.getComment());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Schedule tgt = new org.hl7.fhir.instance.model.Schedule();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType())
+ tgt.addType(convertCodeableConcept(t));
+ tgt.setActor(convertReference(src.getActorFirstRep()));
+ tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon()));
+ tgt.setComment(src.getComment());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.instance.model.SearchParameter src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent t : src.getContact())
+ tgt.addContact(convertSearchParameterContactComponent(t));
+ tgt.setPurpose(src.getRequirements());
+ tgt.setCode(src.getCode());
+ tgt.addBase(src.getBase());
+ tgt.setType(convertSearchParamType(src.getType()));
+ tgt.setDescription(src.getDescription());
+ tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION));
+ tgt.setXpath(src.getXpath());
+ tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage()));
+ for (org.hl7.fhir.instance.model.CodeType t : src.getTarget())
+ tgt.addTarget(t.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.SearchParameter tgt = new org.hl7.fhir.instance.model.SearchParameter();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+ tgt.addContact(convertSearchParameterContactComponent(t));
+ tgt.setRequirements(src.getPurpose());
+ tgt.setCode(src.getCode());
+ for (org.hl7.fhir.r4.model.CodeType t : src.getBase())
+ tgt.setBase(t.asStringValue());
+ tgt.setType(convertSearchParamType(src.getType()));
+ tgt.setDescription(src.getDescription());
+ org.hl7.fhir.instance.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
+ tgt.setXpath(src.getXpath());
+ tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage()));
+ for (org.hl7.fhir.r4.model.CodeType t : src.getTarget())
+ tgt.addTarget(t.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.instance.model.SearchParameter.XPathUsageType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL;
+ case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC;
+ case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY;
+ case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE;
+ case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER;
+ default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case NORMAL: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NORMAL;
+ case PHONETIC: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.PHONETIC;
+ case NEARBY: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NEARBY;
+ case DISTANCE: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.DISTANCE;
+ case OTHER: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.OTHER;
+ default: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.instance.model.Slot src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ if (src.hasType())
+ tgt.addServiceType(convertCodeableConcept(src.getType()));
+ tgt.setSchedule(convertReference(src.getSchedule()));
+ tgt.setStart(src.getStart());
+ tgt.setEnd(src.getEnd());
+ tgt.setOverbooked(src.getOverbooked());
+ tgt.setComment(src.getComment());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Slot tgt = new org.hl7.fhir.instance.model.Slot();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType())
+ tgt.setType(convertCodeableConcept(t));
+ tgt.setSchedule(convertReference(src.getSchedule()));
+ tgt.setStart(src.getStart());
+ tgt.setEnd(src.getEnd());
+ tgt.setOverbooked(src.getOverbooked());
+ tgt.setComment(src.getComment());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.instance.model.Slot.SlotStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY;
+ case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE;
+ case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE;
+ case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE;
+ default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case BUSY: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSY;
+ case FREE: return org.hl7.fhir.instance.model.Slot.SlotStatus.FREE;
+ case BUSYUNAVAILABLE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYUNAVAILABLE;
+ case BUSYTENTATIVE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYTENTATIVE;
+ default: return org.hl7.fhir.instance.model.Slot.SlotStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.instance.model.StructureDefinition src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setTitle(src.getDisplay());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact())
+ tgt.addContact(convertStructureDefinitionContactComponent(t));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
+ if (isJurisdiction(t))
+ tgt.addJurisdiction(convertCodeableConcept(t));
+ else
+ tgt.addUseContext(convertCodeableConceptToUsageContext(t));
+ tgt.setPurpose(src.getRequirements());
+ tgt.setCopyright(src.getCopyright());
+ for (org.hl7.fhir.instance.model.Coding t : src.getCode())
+ tgt.addKeyword(convertCoding(t));
+ tgt.setFhirVersion(src.getFhirVersion());
+ for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
+ tgt.addMapping(convertStructureDefinitionMappingComponent(t));
+ tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId()));
+ tgt.setAbstract(src.getAbstract());
+ tgt.setContextType(convertExtensionContext(src.getContextType()));
+ for (org.hl7.fhir.instance.model.StringType t : src.getContext())
+ tgt.addContext(t.getValue());
+ if (src.hasConstrainedType())
+ tgt.setType(src.getConstrainedType());
+ else if (src.getSnapshot().hasElement())
+ tgt.setType(src.getSnapshot().getElement().get(0).getPath());
+ else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains("."))
+ tgt.setType(src.getDifferential().getElement().get(0).getPath());
+ else
+ tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf(".")));
+ tgt.setBaseDefinition(src.getBase());
+ tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
+ tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
+ tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
+ if (tgt.hasSnapshot())
+ tgt.getSnapshot().getElementFirstRep().getType().clear();
+ if (tgt.hasDifferential())
+ tgt.getDifferential().getElementFirstRep().getType().clear();
+ if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) {
+ tgt.setDerivation(TypeDerivationRule.SPECIALIZATION);
+ tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType());
+// for (ElementDefinition ed : tgt.getSnapshot().getElement()) {
+// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+"."));
+// }
+// for (ElementDefinition ed : tgt.getDifferential().getElement()) {
+// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+"."));
+// }
+ tgt.setType(tgt.getId());
+ }
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.StructureDefinition tgt = new org.hl7.fhir.instance.model.StructureDefinition();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setDisplay(src.getTitle());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+ tgt.addContact(convertStructureDefinitionContactComponent(t));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
+ if (t.hasValueCodeableConcept())
+ tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
+ tgt.addUseContext(convertCodeableConcept(t));
+ tgt.setRequirements(src.getPurpose());
+ tgt.setCopyright(src.getCopyright());
+ for (org.hl7.fhir.r4.model.Coding t : src.getKeyword())
+ tgt.addCode(convertCoding(t));
+ tgt.setFhirVersion(src.getFhirVersion());
+ for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
+ tgt.addMapping(convertStructureDefinitionMappingComponent(t));
+ tgt.setKind(convertStructureDefinitionKind(src.getKind()));
+ tgt.setAbstract(src.getAbstract());
+ tgt.setContextType(convertExtensionContext(src.getContextType()));
+ for (org.hl7.fhir.r4.model.StringType t : src.getContext())
+ tgt.addContext(t.getValue());
+ tgt.setConstrainedType(src.getType());
+ tgt.setBase(src.getBaseDefinition());
+ tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
+ tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
+ if (tgt.hasBase()) {
+ if (tgt.hasDifferential())
+ tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase()));
+ if (tgt.hasSnapshot())
+ tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase()));
+ }
+ return tgt;
+ }
+
+ private String tail(String base) {
+ return base.substring(base.lastIndexOf("/")+1);
+ }
+
+ public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case DATATYPE:
+ if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml"))
+ return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE;
+ else
+ return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE;
+ case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE;
+ case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL;
+ default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case PRIMITIVETYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
+ case COMPLEXTYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
+ case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.RESOURCE;
+ case LOGICAL: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.LOGICAL;
+ default: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.RESOURCE;
+ case DATATYPE: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.DATATYPE;
+ case EXTENSION: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.EXTENSION;
+ default: return org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext convertExtensionContext(org.hl7.fhir.r4.model.StructureDefinition.ExtensionContext src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.RESOURCE;
+ case DATATYPE: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.DATATYPE;
+ case EXTENSION: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.EXTENSION;
+ default: return org.hl7.fhir.instance.model.StructureDefinition.ExtensionContext.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent();
+ copyElement(src, tgt);
+ tgt.setIdentity(src.getIdentity());
+ tgt.setUri(src.getUri());
+ tgt.setName(src.getName());
+ tgt.setComment(src.getComments());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent();
+ copyElement(src, tgt);
+ tgt.setIdentity(src.getIdentity());
+ tgt.setUri(src.getUri());
+ tgt.setName(src.getName());
+ tgt.setComments(src.getComment());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent();
+ copyElement(src, tgt);
+ List slicePaths = new ArrayList();
+ for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) {
+ if (t.hasSlicing())
+ slicePaths.add(t.getPath());
+ tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t)));
+ }
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
+ tgt.addElement(convertElementDefinition(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent();
+ copyElement(src, tgt);
+ List slicePaths = new ArrayList();
+ for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) {
+ if (t.hasSlicing())
+ slicePaths.add(t.getPath());
+ tgt.addElement(convertElementDefinition(t, slicePaths, src.getElement(), src.getElement().indexOf(t)));
+ }
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
+ tgt.addElement(convertElementDefinition(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.instance.model.Subscription src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription();
+ copyDomainResource(src, tgt);
+ tgt.setCriteria(src.getCriteria());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact())
+ tgt.addContact(convertContactPoint(t));
+ tgt.setReason(src.getReason());
+ tgt.setStatus(convertSubscriptionStatus(src.getStatus()));
+ tgt.setError(src.getError());
+ tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel()));
+ tgt.setEnd(src.getEnd());
+ for (org.hl7.fhir.instance.model.Coding t : src.getTag())
+ tgt.addTag(convertCoding(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Subscription tgt = new org.hl7.fhir.instance.model.Subscription();
+ copyDomainResource(src, tgt);
+ tgt.setCriteria(src.getCriteria());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact())
+ tgt.addContact(convertContactPoint(t));
+ tgt.setReason(src.getReason());
+ tgt.setStatus(convertSubscriptionStatus(src.getStatus()));
+ tgt.setError(src.getError());
+ tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel()));
+ tgt.setEnd(src.getEnd());
+ for (org.hl7.fhir.r4.model.Coding t : src.getTag())
+ tgt.addTag(convertCoding(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.instance.model.Subscription.SubscriptionStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED;
+ case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE;
+ case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR;
+ case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF;
+ default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUESTED: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.REQUESTED;
+ case ACTIVE: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ACTIVE;
+ case ERROR: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ERROR;
+ case OFF: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.OFF;
+ default: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertSubscriptionChannelType(src.getType()));
+ tgt.setEndpoint(src.getEndpoint());
+ tgt.setPayload(src.getPayload());
+ tgt.addHeader(src.getHeader());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertSubscriptionChannelType(src.getType()));
+ tgt.setEndpoint(src.getEndpoint());
+ tgt.setPayload(src.getPayload());
+ if (src.hasHeader())
+ tgt.setHeaderElement(convertString(src.getHeader().get(0)));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK;
+ case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET;
+ case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL;
+ case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS;
+ case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE;
+ default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case RESTHOOK: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.RESTHOOK;
+ case WEBSOCKET: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET;
+ case EMAIL: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.EMAIL;
+ case SMS: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.SMS;
+ case MESSAGE: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.MESSAGE;
+ default: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.instance.model.Substance src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory())
+ tgt.addCategory(convertCodeableConcept(t));
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent t : src.getInstance())
+ tgt.addInstance(convertSubstanceInstanceComponent(t));
+ for (org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent t : src.getIngredient())
+ tgt.addIngredient(convertSubstanceIngredientComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Substance tgt = new org.hl7.fhir.instance.model.Substance();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory())
+ tgt.addCategory(convertCodeableConcept(t));
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance())
+ tgt.addInstance(convertSubstanceInstanceComponent(t));
+ for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient())
+ tgt.addIngredient(convertSubstanceIngredientComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setExpiry(src.getExpiry());
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setExpiry(src.getExpiry());
+ tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent();
+ copyElement(src, tgt);
+ tgt.setQuantity(convertRatio(src.getQuantity()));
+ tgt.setSubstance(convertReference(src.getSubstance()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent();
+ copyElement(src, tgt);
+ tgt.setQuantity(convertRatio(src.getQuantity()));
+// tgt.setSubstance(convertReference(src.getSubstance()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.instance.model.SupplyDelivery src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery();
+ copyDomainResource(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus()));
+ tgt.setPatient(convertReference(src.getPatient()));
+ tgt.setType(convertCodeableConcept(src.getType()));
+// tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+// tgt.setSuppliedItem(convertReference(src.getSuppliedItem()));
+ tgt.setSupplier(convertReference(src.getSupplier()));
+// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared()));
+// tgt.setTime(src.getTime());
+ tgt.setDestination(convertReference(src.getDestination()));
+ for (org.hl7.fhir.instance.model.Reference t : src.getReceiver())
+ tgt.addReceiver(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.SupplyDelivery tgt = new org.hl7.fhir.instance.model.SupplyDelivery();
+ copyDomainResource(src, tgt);
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus()));
+ tgt.setPatient(convertReference(src.getPatient()));
+ tgt.setType(convertCodeableConcept(src.getType()));
+// tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
+// tgt.setSuppliedItem(convertReference(src.getSuppliedItem()));
+ tgt.setSupplier(convertReference(src.getSupplier()));
+// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared()));
+// tgt.setTime(src.getTime());
+ tgt.setDestination(convertReference(src.getDestination()));
+ for (org.hl7.fhir.r4.model.Reference t : src.getReceiver())
+ tgt.addReceiver(convertReference(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS;
+ case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED;
+ case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED;
+ default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case INPROGRESS: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS;
+ case COMPLETED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED;
+ case ABANDONED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED;
+ default: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.instance.model.SupplyRequest src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest();
+ copyDomainResource(src, tgt);
+// tgt.setPatient(convertReference(src.getPatient()));
+// tgt.setSource(convertReference(src.getSource()));
+// if (src.hasDate())
+// tgt.setDate(src.getDate());
+// tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+// tgt.setStatus(convertSupplyRequestStatus(src.getStatus()));
+// tgt.setKind(convertCodeableConcept(src.getKind()));
+// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem()));
+// for (org.hl7.fhir.instance.model.Reference t : src.getSupplier())
+// tgt.addSupplier(convertReference(t));
+// tgt.setReason(convertType(src.getReason()));
+// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.SupplyRequest tgt = new org.hl7.fhir.instance.model.SupplyRequest();
+// copyDomainResource(src, tgt);
+// tgt.setPatient(convertReference(src.getPatient()));
+// tgt.setSource(convertReference(src.getSource()));
+// if (src.hasDate())
+// tgt.setDate(src.getDate());
+// tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+// tgt.setStatus(convertSupplyRequestStatus(src.getStatus()));
+// tgt.setKind(convertCodeableConcept(src.getKind()));
+// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference()));
+// for (org.hl7.fhir.r4.model.Reference t : src.getSupplier())
+// tgt.addSupplier(convertReference(t));
+// tgt.setReason(convertType(src.getReason()));
+// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case REQUESTED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE;
+ case COMPLETED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED;
+ case FAILED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED;
+ case CANCELLED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED;
+ default: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case ACTIVE: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.REQUESTED;
+ case COMPLETED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.COMPLETED;
+ case CANCELLED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.CANCELLED;
+ default: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.instance.model.TestScript src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent t : src.getContact())
+ tgt.addContact(convertTestScriptContactComponent(t));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
+ if (isJurisdiction(t))
+ tgt.addJurisdiction(convertCodeableConcept(t));
+ else
+ tgt.addUseContext(convertCodeableConceptToUsageContext(t));
+ tgt.setPurpose(src.getRequirements());
+ tgt.setCopyright(src.getCopyright());
+ tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
+ tgt.addFixture(convertTestScriptFixtureComponent(t));
+ for (org.hl7.fhir.instance.model.Reference t : src.getProfile())
+ tgt.addProfile(convertReference(t));
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent t : src.getVariable())
+ tgt.addVariable(convertTestScriptVariableComponent(t));
+ tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent t : src.getTest())
+ tgt.addTest(convertTestScriptTestComponent(t));
+ tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript tgt = new org.hl7.fhir.instance.model.TestScript();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+ tgt.addContact(convertTestScriptContactComponent(t));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
+ if (t.hasValueCodeableConcept())
+ tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
+ tgt.addUseContext(convertCodeableConcept(t));
+ tgt.setRequirements(src.getPurpose());
+ tgt.setCopyright(src.getCopyright());
+ tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
+ for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
+ tgt.addFixture(convertTestScriptFixtureComponent(t));
+ for (org.hl7.fhir.r4.model.Reference t : src.getProfile())
+ tgt.addProfile(convertReference(t));
+ for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable())
+ tgt.addVariable(convertTestScriptVariableComponent(t));
+ tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
+ for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest())
+ tgt.addTest(convertTestScriptTestComponent(t));
+ tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
+ tgt.addLink(convertTestScriptMetadataLinkComponent(t));
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
+ tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
+ tgt.addLink(convertTestScriptMetadataLinkComponent(t));
+ for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
+ tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent();
+ copyElement(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setDescription(src.getDescription());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent();
+ copyElement(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.setDescription(src.getDescription());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent();
+ copyElement(src, tgt);
+ tgt.setRequired(src.getRequired());
+ tgt.setValidated(src.getValidated());
+ tgt.setDescription(src.getDescription());
+ tgt.setDestination(src.getDestination());
+ for (org.hl7.fhir.instance.model.UriType t : src.getLink())
+ tgt.addLink(t.getValue());
+ tgt.setCapabilities(convertReference(src.getConformance()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent();
+ copyElement(src, tgt);
+ tgt.setRequired(src.getRequired());
+ tgt.setValidated(src.getValidated());
+ tgt.setDescription(src.getDescription());
+ tgt.setDestination(src.getDestination());
+ for (org.hl7.fhir.r4.model.UriType t : src.getLink())
+ tgt.addLink(t.getValue());
+ tgt.setConformance(convertReference(src.getCapabilities()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent();
+ copyElement(src, tgt);
+ tgt.setAutocreate(src.getAutocreate());
+ tgt.setAutodelete(src.getAutodelete());
+ tgt.setResource(convertReference(src.getResource()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent();
+ copyElement(src, tgt);
+ tgt.setAutocreate(src.getAutocreate());
+ tgt.setAutodelete(src.getAutodelete());
+ tgt.setResource(convertReference(src.getResource()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setHeaderField(src.getHeaderField());
+ tgt.setPath(src.getPath());
+ tgt.setSourceId(src.getSourceId());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setHeaderField(src.getHeaderField());
+ tgt.setPath(src.getPath());
+ tgt.setSourceId(src.getSourceId());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent t : src.getAction())
+ tgt.addAction(convertSetupActionComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction())
+ tgt.addAction(convertSetupActionComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent();
+ copyElement(src, tgt);
+ tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
+ tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent();
+ copyElement(src, tgt);
+ tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
+ tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertCoding(src.getType()));
+ tgt.setResource(src.getResource());
+ tgt.setLabel(src.getLabel());
+ tgt.setDescription(src.getDescription());
+ tgt.setAccept(convertContentType(src.getAccept()));
+ tgt.setContentType(convertContentType(src.getContentType()));
+ tgt.setDestination(src.getDestination());
+ tgt.setEncodeRequestUrl(src.getEncodeRequestUrl());
+ tgt.setParams(src.getParams());
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
+ tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
+ tgt.setResponseId(src.getResponseId());
+ tgt.setSourceId(src.getSourceId());
+ tgt.setTargetId(src.getTargetId());
+ tgt.setUrl(src.getUrl());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent();
+ copyElement(src, tgt);
+ tgt.setType(convertCoding(src.getType()));
+ tgt.setResource(src.getResource());
+ tgt.setLabel(src.getLabel());
+ tgt.setDescription(src.getDescription());
+ tgt.setAccept(convertContentType(src.getAccept()));
+ tgt.setContentType(convertContentType(src.getContentType()));
+ tgt.setDestination(src.getDestination());
+ tgt.setEncodeRequestUrl(src.getEncodeRequestUrl());
+ tgt.setParams(src.getParams());
+ for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
+ tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
+ tgt.setResponseId(src.getResponseId());
+ tgt.setSourceId(src.getSourceId());
+ tgt.setTargetId(src.getTargetId());
+ tgt.setUrl(src.getUrl());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.ContentType convertContentType(org.hl7.fhir.instance.model.TestScript.ContentType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case XML: return org.hl7.fhir.r4.model.TestScript.ContentType.XML;
+ case JSON: return org.hl7.fhir.r4.model.TestScript.ContentType.JSON;
+ default: return org.hl7.fhir.r4.model.TestScript.ContentType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.ContentType convertContentType(org.hl7.fhir.r4.model.TestScript.ContentType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case XML: return org.hl7.fhir.instance.model.TestScript.ContentType.XML;
+ case JSON: return org.hl7.fhir.instance.model.TestScript.ContentType.JSON;
+ default: return org.hl7.fhir.instance.model.TestScript.ContentType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent();
+ copyElement(src, tgt);
+ tgt.setField(src.getField());
+ tgt.setValue(src.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent();
+ copyElement(src, tgt);
+ tgt.setField(src.getField());
+ tgt.setValue(src.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent();
+ copyElement(src, tgt);
+ tgt.setLabel(src.getLabel());
+ tgt.setDescription(src.getDescription());
+ tgt.setDirection(convertAssertionDirectionType(src.getDirection()));
+ tgt.setCompareToSourceId(src.getCompareToSourceId());
+ tgt.setCompareToSourcePath(src.getCompareToSourcePath());
+ tgt.setContentType(convertContentType(src.getContentType()));
+ tgt.setHeaderField(src.getHeaderField());
+ tgt.setMinimumId(src.getMinimumId());
+ tgt.setNavigationLinks(src.getNavigationLinks());
+ tgt.setOperator(convertAssertionOperatorType(src.getOperator()));
+ tgt.setPath(src.getPath());
+ tgt.setResource(src.getResource());
+ tgt.setResponse(convertAssertionResponseTypes(src.getResponse()));
+ tgt.setResponseCode(src.getResponseCode());
+ tgt.setSourceId(src.getSourceId());
+ tgt.setValidateProfileId(src.getValidateProfileId());
+ tgt.setValue(src.getValue());
+ tgt.setWarningOnly(src.getWarningOnly());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent();
+ copyElement(src, tgt);
+ tgt.setLabel(src.getLabel());
+ tgt.setDescription(src.getDescription());
+ tgt.setDirection(convertAssertionDirectionType(src.getDirection()));
+ tgt.setCompareToSourceId(src.getCompareToSourceId());
+ tgt.setCompareToSourcePath(src.getCompareToSourcePath());
+ tgt.setContentType(convertContentType(src.getContentType()));
+ tgt.setHeaderField(src.getHeaderField());
+ tgt.setMinimumId(src.getMinimumId());
+ tgt.setNavigationLinks(src.getNavigationLinks());
+ tgt.setOperator(convertAssertionOperatorType(src.getOperator()));
+ tgt.setPath(src.getPath());
+ tgt.setResource(src.getResource());
+ tgt.setResponse(convertAssertionResponseTypes(src.getResponse()));
+ tgt.setResponseCode(src.getResponseCode());
+ tgt.setSourceId(src.getSourceId());
+ tgt.setValidateProfileId(src.getValidateProfileId());
+ tgt.setValue(src.getValue());
+ tgt.setWarningOnly(src.getWarningOnly());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.instance.model.TestScript.AssertionDirectionType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case RESPONSE: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.RESPONSE;
+ case REQUEST: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.REQUEST;
+ default: return org.hl7.fhir.r4.model.TestScript.AssertionDirectionType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.AssertionDirectionType convertAssertionDirectionType(org.hl7.fhir.r4.model.TestScript.AssertionDirectionType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case RESPONSE: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.RESPONSE;
+ case REQUEST: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.REQUEST;
+ default: return org.hl7.fhir.instance.model.TestScript.AssertionDirectionType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.instance.model.TestScript.AssertionOperatorType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case EQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EQUALS;
+ case NOTEQUALS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEQUALS;
+ case IN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.IN;
+ case NOTIN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTIN;
+ case GREATERTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.GREATERTHAN;
+ case LESSTHAN: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.LESSTHAN;
+ case EMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.EMPTY;
+ case NOTEMPTY: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTEMPTY;
+ case CONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.CONTAINS;
+ case NOTCONTAINS: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NOTCONTAINS;
+ default: return org.hl7.fhir.r4.model.TestScript.AssertionOperatorType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.AssertionOperatorType convertAssertionOperatorType(org.hl7.fhir.r4.model.TestScript.AssertionOperatorType src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case EQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EQUALS;
+ case NOTEQUALS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEQUALS;
+ case IN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.IN;
+ case NOTIN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTIN;
+ case GREATERTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.GREATERTHAN;
+ case LESSTHAN: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.LESSTHAN;
+ case EMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.EMPTY;
+ case NOTEMPTY: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTEMPTY;
+ case CONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.CONTAINS;
+ case NOTCONTAINS: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NOTCONTAINS;
+ default: return org.hl7.fhir.instance.model.TestScript.AssertionOperatorType.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OKAY: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.OKAY;
+ case CREATED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CREATED;
+ case NOCONTENT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOCONTENT;
+ case NOTMODIFIED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTMODIFIED;
+ case BAD: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.BAD;
+ case FORBIDDEN: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.FORBIDDEN;
+ case NOTFOUND: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NOTFOUND;
+ case METHODNOTALLOWED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED;
+ case CONFLICT: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.CONFLICT;
+ case GONE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.GONE;
+ case PRECONDITIONFAILED: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED;
+ case UNPROCESSABLE: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.UNPROCESSABLE;
+ default: return org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes convertAssertionResponseTypes(org.hl7.fhir.r4.model.TestScript.AssertionResponseTypes src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case OKAY: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.OKAY;
+ case CREATED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CREATED;
+ case NOCONTENT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOCONTENT;
+ case NOTMODIFIED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTMODIFIED;
+ case BAD: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.BAD;
+ case FORBIDDEN: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.FORBIDDEN;
+ case NOTFOUND: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NOTFOUND;
+ case METHODNOTALLOWED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.METHODNOTALLOWED;
+ case CONFLICT: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.CONFLICT;
+ case GONE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.GONE;
+ case PRECONDITIONFAILED: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.PRECONDITIONFAILED;
+ case UNPROCESSABLE: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.UNPROCESSABLE;
+ default: return org.hl7.fhir.instance.model.TestScript.AssertionResponseTypes.NULL;
+ }
+ }
+
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent t : src.getAction())
+ tgt.addAction(convertTestActionComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction())
+ tgt.addAction(convertTestActionComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent();
+ copyElement(src, tgt);
+ tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
+ tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent();
+ copyElement(src, tgt);
+ tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
+ tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent t : src.getAction())
+ tgt.addAction(convertTeardownActionComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction())
+ tgt.addAction(convertTeardownActionComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent();
+ copyElement(src, tgt);
+ tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent();
+ copyElement(src, tgt);
+ tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent convertCodeSystem(org.hl7.fhir.r4.model.CodeSystem src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetCodeSystemComponent();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getUrl());
+ tgt.setVersion(src.getVersion());
+ tgt.setCaseSensitive(src.getCaseSensitive());
+
+ for (ConceptDefinitionComponent cc : src.getConcept())
+ tgt.addConcept(convertCodeSystemConcept(src, cc));
+ return tgt;
+ }
+
+public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent convertCodeSystemConcept(CodeSystem cs, ConceptDefinitionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent();
+ copyElement(src, tgt);
+ tgt.setAbstract(CodeSystemUtilities.isNotSelectable(cs, src));
+ tgt.setCode(src.getCode());
+ tgt.setDefinition(src.getDefinition());
+ tgt.setDisplay(src.getDisplay());
+
+ for (ConceptDefinitionComponent cc : src.getConcept())
+ tgt.addConcept(convertCodeSystemConcept(cs, cc));
+ for (ConceptDefinitionDesignationComponent cc : src.getDesignation())
+ tgt.addDesignation(convertCodeSystemDesignation(cc));
+ return tgt;
+ }
+
+public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertCodeSystemDesignation(ConceptDefinitionDesignationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent();
+ copyElement(src, tgt);
+ tgt.setUse(convertCoding(src.getUse()));
+ tgt.setLanguage(src.getLanguage());
+ tgt.setValue(src.getValue());
+
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.instance.model.ValueSet src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ tgt.addIdentifier(convertIdentifier(src.getIdentifier()));
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact())
+ tgt.addContact(convertValueSetContactComponent(t));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
+ if (isJurisdiction(t))
+ tgt.addJurisdiction(convertCodeableConcept(t));
+ else
+ tgt.addUseContext(convertCodeableConceptToUsageContext(t));
+ tgt.setImmutable(src.getImmutable());
+ tgt.setPurpose(src.getRequirements());
+ tgt.setCopyright(src.getCopyright());
+ tgt.setExtensible(src.getExtensible());
+ if (src.hasCompose()) {
+ tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
+ tgt.getCompose().setLockedDate(src.getLockedDate());
+ }
+ if (src.hasCodeSystem() && advisor != null) {
+ org.hl7.fhir.r4.model.CodeSystem tgtcs = new org.hl7.fhir.r4.model.CodeSystem();
+ copyDomainResource(src, tgtcs);
+ tgtcs.setUrl(src.getCodeSystem().getSystem());
+ tgtcs.setIdentifier(convertIdentifier(src.getIdentifier()));
+ tgtcs.setVersion(src.getCodeSystem().getVersion());
+ tgtcs.setName(src.getName()+" Code System");
+ tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgtcs.setExperimental(src.getExperimental());
+ tgtcs.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact())
+ tgtcs.addContact(convertValueSetContactComponent(t));
+ if (src.hasDate())
+ tgtcs.setDate(src.getDate());
+ tgtcs.setDescription(src.getDescription());
+ for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
+ if (isJurisdiction(t))
+ tgtcs.addJurisdiction(convertCodeableConcept(t));
+ else
+ tgtcs.addUseContext(convertCodeableConceptToUsageContext(t));
+ tgtcs.setPurpose(src.getRequirements());
+ tgtcs.setCopyright(src.getCopyright());
+ tgtcs.setContent(CodeSystemContentMode.COMPLETE);
+ tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive());
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept())
+ processConcept(tgtcs.getConcept(), cs, tgtcs);
+ advisor.handleCodeSystem(tgtcs, tgt);
+ tgt.setUserData("r2-cs", tgtcs);
+ tgt.getCompose().addInclude().setSystem(tgtcs.getUrl());
+ }
+ tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
+ return tgt;
+ }
+
+ private void processConcept(List concepts, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException {
+ org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent();
+ concepts.add(ct);
+ ct.setCode(cs.getCode());
+ ct.setDisplay(cs.getDisplay());
+ ct.setDefinition(cs.getDefinition());
+ if (cs.getAbstract())
+ CodeSystemUtilities.setNotSelectable(tgtcs, ct);
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
+ org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent();
+ cst.setLanguage(csd.getLanguage());
+ cst.setUse(convertCoding(csd.getUse()));
+ cst.setValue(csd.getValue());
+ }
+
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept())
+ processConcept(ct.getConcept(), csc, tgtcs);
+ }
+
+ private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException {
+ org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent();
+ concepts.add(ct);
+ ct.setCode(cs.getCode());
+ ct.setDisplay(cs.getDisplay());
+ ct.setDefinition(cs.getDefinition());
+ if (CodeSystemUtilities.isNotSelectable(srcCS, cs))
+ ct.setAbstract(true);
+ for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
+ org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent();
+ cst.setLanguage(csd.getLanguage());
+ cst.setUse(convertCoding(csd.getUse()));
+ cst.setValue(csd.getValue());
+ }
+
+ for (ConceptDefinitionComponent csc : cs.getConcept())
+ processConcept(ct.getConcept(), csc, srcCS);
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet tgt = new org.hl7.fhir.instance.model.ValueSet();
+ copyDomainResource(src, tgt);
+ tgt.setUrl(src.getUrl());
+ for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier())
+ tgt.setIdentifier(convertIdentifier(i));
+ tgt.setVersion(src.getVersion());
+ tgt.setName(src.getName());
+ tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
+ if (src.hasExperimental())
+ tgt.setExperimental(src.getExperimental());
+ tgt.setPublisher(src.getPublisher());
+ for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
+ tgt.addContact(convertValueSetContactComponent(t));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setLockedDate(src.getCompose().getLockedDate());
+ tgt.setDescription(src.getDescription());
+ for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
+ if (t.hasValueCodeableConcept())
+ tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
+ for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
+ tgt.addUseContext(convertCodeableConcept(t));
+ tgt.setImmutable(src.getImmutable());
+ tgt.setRequirements(src.getPurpose());
+ tgt.setCopyright(src.getCopyright());
+ tgt.setExtensible(src.getExtensible());
+ org.hl7.fhir.r4.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs");
+ if (srcCS == null)
+ srcCS = advisor.getCodeSystem(src);
+ if (srcCS != null) {
+ tgt.getCodeSystem().setSystem(srcCS.getUrl());
+ tgt.getCodeSystem().setVersion(srcCS.getVersion());
+ tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive());
+ for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept())
+ processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS);
+
+ }
+ tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl()));
+ tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
+ return tgt;
+ }
+
+ private static boolean isJurisdiction(CodeableConcept t) {
+ return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem())
+ || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem()));
+ }
+
+
+ public org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
+ tgt.addTelecom(convertContactPoint(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.instance.model.UriType t : src.getImport())
+ tgt.addInclude().addValueSet(t.getValue());
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getInclude())
+ tgt.addInclude(convertConceptSetComponent(t));
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getExclude())
+ tgt.addExclude(convertConceptSetComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent();
+ copyElement(src, tgt);
+ for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) {
+ for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet())
+ tgt.addImport(ti.getValue());
+ if (noSystem == null || !t.getSystem().equals(noSystem))
+ tgt.addInclude(convertConceptSetComponent(t));
+ }
+ for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude())
+ tgt.addExclude(convertConceptSetComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getSystem());
+ tgt.setVersion(src.getVersion());
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
+ tgt.addConcept(convertConceptReferenceComponent(t));
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
+ tgt.addFilter(convertConceptSetFilterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent convertConceptSetComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getSystem());
+ tgt.setVersion(src.getVersion());
+ for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent t : src.getConcept())
+ tgt.addConcept(convertConceptReferenceComponent(t));
+ for (org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent t : src.getFilter())
+ tgt.addFilter(convertConceptSetFilterComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent();
+ copyElement(src, tgt);
+ tgt.setCode(src.getCode());
+ tgt.setDisplay(src.getDisplay());
+ for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent t : src.getDesignation())
+ tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent convertConceptReferenceComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptReferenceComponent();
+ copyElement(src, tgt);
+ tgt.setCode(src.getCode());
+ tgt.setDisplay(src.getDisplay());
+ for (org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent t : src.getDesignation())
+ tgt.addDesignation(convertConceptReferenceDesignationComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent();
+ copyElement(src, tgt);
+ tgt.setLanguage(src.getLanguage());
+ tgt.setUse(convertCoding(src.getUse()));
+ tgt.setValue(src.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent convertConceptReferenceDesignationComponent(org.hl7.fhir.r4.model.ValueSet.ConceptReferenceDesignationComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent();
+ copyElement(src, tgt);
+ tgt.setLanguage(src.getLanguage());
+ tgt.setUse(convertCoding(src.getUse()));
+ tgt.setValue(src.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent();
+ copyElement(src, tgt);
+ tgt.setProperty(src.getProperty());
+ tgt.setOp(convertFilterOperator(src.getOp()));
+ tgt.setValue(src.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent convertConceptSetFilterComponent(org.hl7.fhir.r4.model.ValueSet.ConceptSetFilterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ConceptSetFilterComponent();
+ copyElement(src, tgt);
+ tgt.setProperty(src.getProperty());
+ tgt.setOp(convertFilterOperator(src.getOp()));
+ tgt.setValue(src.getValue());
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.instance.model.ValueSet.FilterOperator src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case EQUAL: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.EQUAL;
+ case ISA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISA;
+ case ISNOTA: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.ISNOTA;
+ case REGEX: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.REGEX;
+ case IN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.IN;
+ case NOTIN: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NOTIN;
+ default: return org.hl7.fhir.r4.model.ValueSet.FilterOperator.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.FilterOperator convertFilterOperator(org.hl7.fhir.r4.model.ValueSet.FilterOperator src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case EQUAL: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.EQUAL;
+ case ISA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISA;
+ case ISNOTA: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.ISNOTA;
+ case REGEX: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.REGEX;
+ case IN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.IN;
+ case NOTIN: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NOTIN;
+ default: return org.hl7.fhir.instance.model.ValueSet.FilterOperator.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(src.getIdentifier());
+ tgt.setTimestamp(src.getTimestamp());
+ tgt.setTotal(src.getTotal());
+ tgt.setOffset(src.getOffset());
+ for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
+ tgt.addParameter(convertValueSetExpansionParameterComponent(t));
+ for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
+ tgt.addContains(convertValueSetExpansionContainsComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent();
+ copyElement(src, tgt);
+ tgt.setIdentifier(src.getIdentifier());
+ tgt.setTimestamp(src.getTimestamp());
+ tgt.setTotal(src.getTotal());
+ tgt.setOffset(src.getOffset());
+ for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
+ tgt.addParameter(convertValueSetExpansionParameterComponent(t));
+ for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
+ tgt.addContains(convertValueSetExpansionContainsComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setValue(convertType(src.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent();
+ copyElement(src, tgt);
+ tgt.setName(src.getName());
+ tgt.setValue(convertType(src.getValue()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getSystem());
+ tgt.setAbstract(src.getAbstract());
+ tgt.setVersion(src.getVersion());
+ tgt.setCode(src.getCode());
+ tgt.setDisplay(src.getDisplay());
+ for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
+ tgt.addContains(convertValueSetExpansionContainsComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent();
+ copyElement(src, tgt);
+ tgt.setSystem(src.getSystem());
+ tgt.setAbstract(src.getAbstract());
+ tgt.setVersion(src.getVersion());
+ tgt.setCode(src.getCode());
+ tgt.setDisplay(src.getDisplay());
+ for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
+ tgt.addContains(convertValueSetExpansionContainsComponent(t));
+ return tgt;
+ }
+
+ public org.hl7.fhir.r4.model.ListResource convertList(org.hl7.fhir.instance.model.List_ src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ListResource tgt = new org.hl7.fhir.r4.model.ListResource();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setTitle(src.getTitle());
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setSubject(convertReference(src.getSubject()));
+ tgt.setSource(convertReference(src.getSource()));
+ tgt.setEncounter(convertReference(src.getEncounter()));
+ tgt.setStatus(convertListStatus(src.getStatus()));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
+ tgt.setMode(convertListMode(src.getMode()));
+ if (src.hasNote())
+ tgt.addNote(new org.hl7.fhir.r4.model.Annotation().setText(src.getNote()));
+ for (org.hl7.fhir.instance.model.List_.ListEntryComponent t : src.getEntry())
+ tgt.addEntry(convertListEntry(t));
+ return tgt;
+ }
+
+
+ public org.hl7.fhir.r4.model.ListResource.ListStatus convertListStatus(org.hl7.fhir.instance.model.List_.ListStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CURRENT: return org.hl7.fhir.r4.model.ListResource.ListStatus.CURRENT;
+ case RETIRED: return org.hl7.fhir.r4.model.ListResource.ListStatus.RETIRED;
+ case ENTEREDINERROR: return org.hl7.fhir.r4.model.ListResource.ListStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.r4.model.ListResource.ListStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ListResource.ListMode convertListMode(org.hl7.fhir.instance.model.List_.ListMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case WORKING: return org.hl7.fhir.r4.model.ListResource.ListMode.WORKING;
+ case SNAPSHOT: return org.hl7.fhir.r4.model.ListResource.ListMode.SNAPSHOT;
+ case CHANGES: return org.hl7.fhir.r4.model.ListResource.ListMode.CHANGES;
+ default: return org.hl7.fhir.r4.model.ListResource.ListMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.r4.model.ListResource.ListEntryComponent convertListEntry(org.hl7.fhir.instance.model.List_.ListEntryComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.r4.model.ListResource.ListEntryComponent tgt = new org.hl7.fhir.r4.model.ListResource.ListEntryComponent();
+ copyBackboneElement(src, tgt);
+ tgt.setFlag(convertCodeableConcept(src.getFlag()));
+ tgt.setDeleted(src.getDeleted());
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setItem(convertReference(src.getItem()));
+ return tgt;
+ }
+
+ public org.hl7.fhir.instance.model.List_ convertList(org.hl7.fhir.r4.model.ListResource src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.List_ tgt = new org.hl7.fhir.instance.model.List_();
+ copyDomainResource(src, tgt);
+ for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
+ tgt.addIdentifier(convertIdentifier(t));
+ tgt.setTitle(src.getTitle());
+ tgt.setCode(convertCodeableConcept(src.getCode()));
+ tgt.setSubject(convertReference(src.getSubject()));
+ tgt.setSource(convertReference(src.getSource()));
+ tgt.setEncounter(convertReference(src.getEncounter()));
+ tgt.setStatus(convertListStatus(src.getStatus()));
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
+ tgt.setMode(convertListMode(src.getMode()));
+ for (org.hl7.fhir.r4.model.Annotation t : src.getNote())
+ tgt.setNote(t.getText());
+ for (org.hl7.fhir.r4.model.ListResource.ListEntryComponent t : src.getEntry())
+ tgt.addEntry(convertListEntry(t));
+ return tgt;
+ }
+
+
+ public org.hl7.fhir.instance.model.List_.ListStatus convertListStatus(org.hl7.fhir.r4.model.ListResource.ListStatus src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case CURRENT: return org.hl7.fhir.instance.model.List_.ListStatus.CURRENT;
+ case RETIRED: return org.hl7.fhir.instance.model.List_.ListStatus.RETIRED;
+ case ENTEREDINERROR: return org.hl7.fhir.instance.model.List_.ListStatus.ENTEREDINERROR;
+ default: return org.hl7.fhir.instance.model.List_.ListStatus.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.List_.ListMode convertListMode(org.hl7.fhir.r4.model.ListResource.ListMode src) throws FHIRException {
+ if (src == null)
+ return null;
+ switch (src) {
+ case WORKING: return org.hl7.fhir.instance.model.List_.ListMode.WORKING;
+ case SNAPSHOT: return org.hl7.fhir.instance.model.List_.ListMode.SNAPSHOT;
+ case CHANGES: return org.hl7.fhir.instance.model.List_.ListMode.CHANGES;
+ default: return org.hl7.fhir.instance.model.List_.ListMode.NULL;
+ }
+ }
+
+ public org.hl7.fhir.instance.model.List_.ListEntryComponent convertListEntry(org.hl7.fhir.r4.model.ListResource.ListEntryComponent src) throws FHIRException {
+ if (src == null || src.isEmpty())
+ return null;
+ org.hl7.fhir.instance.model.List_.ListEntryComponent tgt = new org.hl7.fhir.instance.model.List_.ListEntryComponent();
+ copyBackboneElement(src, tgt);
+ tgt.setFlag(convertCodeableConcept(src.getFlag()));
+ tgt.setDeleted(src.getDeleted());
+ if (src.hasDate())
+ tgt.setDate(src.getDate());
+ tgt.setItem(convertReference(src.getItem()));
+ return tgt;
+ }
+
+
+
public org.hl7.fhir.r4.model.Resource convertResource(org.hl7.fhir.instance.model.Resource src) throws FHIRException {
if (src == null || src.isEmpty())
return null;
@@ -10319,2653 +13014,4 @@ public org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponen
throw new Error("Unknown resource "+src.fhirType());
}
- public org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent();
- copyElement(src, tgt);
- tgt.setCode(convertTypeRestfulInteraction(src.getCode()));
- tgt.setDocumentation(src.getDocumentation());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent convertResourceInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.ResourceInteractionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent();
- copyElement(src, tgt);
- tgt.setCode(convertTypeRestfulInteraction(src.getCode()));
- tgt.setDocumentation(src.getDocumentation());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NOVERSION: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NOVERSION;
- case VERSIONED: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONED;
- case VERSIONEDUPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.VERSIONEDUPDATE;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy convertResourceVersionPolicy(org.hl7.fhir.r4.model.CapabilityStatement.ResourceVersionPolicy src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NOVERSION: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NOVERSION;
- case VERSIONED: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONED;
- case VERSIONEDUPDATE: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.VERSIONEDUPDATE;
- default: return org.hl7.fhir.instance.model.Conformance.ResourceVersionPolicy.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.instance.model.MessageHeader.ResponseType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OK: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.OK;
- case TRANSIENTERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.TRANSIENTERROR;
- case FATALERROR: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.FATALERROR;
- default: return org.hl7.fhir.r4.model.MessageHeader.ResponseType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.MessageHeader.ResponseType convertResponseType(org.hl7.fhir.r4.model.MessageHeader.ResponseType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case OK: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.OK;
- case TRANSIENTERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.TRANSIENTERROR;
- case FATALERROR: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.FATALERROR;
- default: return org.hl7.fhir.instance.model.MessageHeader.ResponseType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode convertRestfulConformanceMode(org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CLIENT: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.CLIENT;
- case SERVER: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.SERVER;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode convertRestfulConformanceMode(org.hl7.fhir.r4.model.CapabilityStatement.RestfulCapabilityMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CLIENT: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.CLIENT;
- case SERVER: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.SERVER;
- default: return org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.instance.model.RiskAssessment src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.RiskAssessment tgt = new org.hl7.fhir.r4.model.RiskAssessment();
- copyDomainResource(src, tgt);
- tgt.setSubject(convertReference(src.getSubject()));
-// tgt.setDate(src.getDate());
- tgt.setCondition(convertReference(src.getCondition()));
- tgt.setContext(convertReference(src.getEncounter()));
- tgt.setPerformer(convertReference(src.getPerformer()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- for (org.hl7.fhir.instance.model.Reference t : src.getBasis())
- tgt.addBasis(convertReference(t));
- for (org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction())
- tgt.addPrediction(convertRiskAssessmentPredictionComponent(t));
- tgt.setMitigation(src.getMitigation());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.RiskAssessment convertRiskAssessment(org.hl7.fhir.r4.model.RiskAssessment src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.RiskAssessment tgt = new org.hl7.fhir.instance.model.RiskAssessment();
- copyDomainResource(src, tgt);
- tgt.setSubject(convertReference(src.getSubject()));
-// tgt.setDateElement(src.getOccurrenceDateTimeType());
- tgt.setCondition(convertReference(src.getCondition()));
- tgt.setEncounter(convertReference(src.getContext()));
- tgt.setPerformer(convertReference(src.getPerformer()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setMethod(convertCodeableConcept(src.getMethod()));
- for (org.hl7.fhir.r4.model.Reference t : src.getBasis())
- tgt.addBasis(convertReference(t));
- for (org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent t : src.getPrediction())
- tgt.addPrediction(convertRiskAssessmentPredictionComponent(t));
- tgt.setMitigation(src.getMitigation());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent();
- copyElement(src, tgt);
- tgt.setOutcome(convertCodeableConcept(src.getOutcome()));
- tgt.setProbability(convertType(src.getProbability()));
- tgt.setRelativeRisk(src.getRelativeRisk());
- tgt.setWhen(convertType(src.getWhen()));
- tgt.setRationale(src.getRationale());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent convertRiskAssessmentPredictionComponent(org.hl7.fhir.r4.model.RiskAssessment.RiskAssessmentPredictionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent tgt = new org.hl7.fhir.instance.model.RiskAssessment.RiskAssessmentPredictionComponent();
- copyElement(src, tgt);
- tgt.setOutcome(convertCodeableConcept(src.getOutcome()));
- tgt.setProbability(convertType(src.getProbability()));
- tgt.setRelativeRisk(src.getRelativeRisk());
- tgt.setWhen(convertType(src.getWhen()));
- tgt.setRationale(src.getRationale());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.SampledData convertSampledData(org.hl7.fhir.instance.model.SampledData src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.SampledData tgt = new org.hl7.fhir.r4.model.SampledData();
- copyElement(src, tgt);
- tgt.setOrigin(convertSimpleQuantity(src.getOrigin()));
- tgt.setPeriod(src.getPeriod());
- tgt.setFactor(src.getFactor());
- tgt.setLowerLimit(src.getLowerLimit());
- tgt.setUpperLimit(src.getUpperLimit());
- tgt.setDimensions(src.getDimensions());
- tgt.setData(src.getData());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.SampledData convertSampledData(org.hl7.fhir.r4.model.SampledData src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.SampledData tgt = new org.hl7.fhir.instance.model.SampledData();
- copyElement(src, tgt);
- tgt.setOrigin(convertSimpleQuantity(src.getOrigin()));
- tgt.setPeriod(src.getPeriod());
- tgt.setFactor(src.getFactor());
- tgt.setLowerLimit(src.getLowerLimit());
- tgt.setUpperLimit(src.getUpperLimit());
- tgt.setDimensions(src.getDimensions());
- tgt.setData(src.getData());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Schedule convertSchedule(org.hl7.fhir.instance.model.Schedule src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Schedule tgt = new org.hl7.fhir.r4.model.Schedule();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getType())
- tgt.addServiceType(convertCodeableConcept(t));
- tgt.addActor(convertReference(src.getActor()));
- tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon()));
- tgt.setComment(src.getComment());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Schedule convertSchedule(org.hl7.fhir.r4.model.Schedule src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Schedule tgt = new org.hl7.fhir.instance.model.Schedule();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType())
- tgt.addType(convertCodeableConcept(t));
- tgt.setActor(convertReference(src.getActorFirstRep()));
- tgt.setPlanningHorizon(convertPeriod(src.getPlanningHorizon()));
- tgt.setComment(src.getComment());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.instance.model.Bundle.SearchEntryMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MATCH: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.MATCH;
- case INCLUDE: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.INCLUDE;
- case OUTCOME: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.OUTCOME;
- default: return org.hl7.fhir.r4.model.Bundle.SearchEntryMode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Bundle.SearchEntryMode convertSearchEntryMode(org.hl7.fhir.r4.model.Bundle.SearchEntryMode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case MATCH: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.MATCH;
- case INCLUDE: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.INCLUDE;
- case OUTCOME: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.OUTCOME;
- default: return org.hl7.fhir.instance.model.Bundle.SearchEntryMode.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.instance.model.Enumerations.SearchParamType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NUMBER: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NUMBER;
- case DATE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.DATE;
- case STRING: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.STRING;
- case TOKEN: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.TOKEN;
- case REFERENCE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.REFERENCE;
- case COMPOSITE: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.COMPOSITE;
- case QUANTITY: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.QUANTITY;
- case URI: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.URI;
- default: return org.hl7.fhir.r4.model.Enumerations.SearchParamType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Enumerations.SearchParamType convertSearchParamType(org.hl7.fhir.r4.model.Enumerations.SearchParamType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NUMBER: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NUMBER;
- case DATE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.DATE;
- case STRING: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.STRING;
- case TOKEN: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.TOKEN;
- case REFERENCE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.REFERENCE;
- case COMPOSITE: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.COMPOSITE;
- case QUANTITY: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.QUANTITY;
- case URI: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.URI;
- default: return org.hl7.fhir.instance.model.Enumerations.SearchParamType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.SearchParameter convertSearchParameter(org.hl7.fhir.instance.model.SearchParameter src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.SearchParameter tgt = new org.hl7.fhir.r4.model.SearchParameter();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent t : src.getContact())
- tgt.addContact(convertSearchParameterContactComponent(t));
- tgt.setPurpose(src.getRequirements());
- tgt.setCode(src.getCode());
- tgt.addBase(src.getBase());
- tgt.setType(convertSearchParamType(src.getType()));
- tgt.setDescription(src.getDescription());
- tgt.setExpression(ToolingExtensions.readStringExtension(src, ToolingExtensions.EXT_EXPRESSION));
- tgt.setXpath(src.getXpath());
- tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage()));
- for (org.hl7.fhir.instance.model.CodeType t : src.getTarget())
- tgt.addTarget(t.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.SearchParameter convertSearchParameter(org.hl7.fhir.r4.model.SearchParameter src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.SearchParameter tgt = new org.hl7.fhir.instance.model.SearchParameter();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
- tgt.addContact(convertSearchParameterContactComponent(t));
- tgt.setRequirements(src.getPurpose());
- tgt.setCode(src.getCode());
- for (org.hl7.fhir.r4.model.CodeType t : src.getBase())
- tgt.setBase(t.asStringValue());
- tgt.setType(convertSearchParamType(src.getType()));
- tgt.setDescription(src.getDescription());
- org.hl7.fhir.instance.utils.ToolingExtensions.setStringExtension(tgt, ToolingExtensions.EXT_EXPRESSION, src.getExpression());
- tgt.setXpath(src.getXpath());
- tgt.setXpathUsage(convertXPathUsageType(src.getXpathUsage()));
- for (org.hl7.fhir.r4.model.CodeType t : src.getTarget())
- tgt.addTarget(t.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactDetail convertSearchParameterContactComponent(org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent convertSearchParameterContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent tgt = new org.hl7.fhir.instance.model.SearchParameter.SearchParameterContactComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.instance.model.Composition.SectionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Composition.SectionComponent tgt = new org.hl7.fhir.r4.model.Composition.SectionComponent();
- copyElement(src, tgt);
- tgt.setTitle(src.getTitle());
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setText(convertNarrative(src.getText()));
- try {
- tgt.setMode(org.hl7.fhir.r4.model.Composition.SectionMode.fromCode(src.getMode()));
- } catch (org.hl7.fhir.exceptions.FHIRException e) {
- throw new FHIRException(e);
- }
- tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
- for (org.hl7.fhir.instance.model.Reference t : src.getEntry())
- tgt.addEntry(convertReference(t));
- tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason()));
- for (org.hl7.fhir.instance.model.Composition.SectionComponent t : src.getSection())
- tgt.addSection(convertSectionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Composition.SectionComponent convertSectionComponent(org.hl7.fhir.r4.model.Composition.SectionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Composition.SectionComponent tgt = new org.hl7.fhir.instance.model.Composition.SectionComponent();
- copyElement(src, tgt);
- tgt.setTitle(src.getTitle());
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setText(convertNarrative(src.getText()));
- tgt.setMode(src.getMode().toCode());
- tgt.setOrderedBy(convertCodeableConcept(src.getOrderedBy()));
- for (org.hl7.fhir.r4.model.Reference t : src.getEntry())
- tgt.addEntry(convertReference(t));
- tgt.setEmptyReason(convertCodeableConcept(src.getEmptyReason()));
- for (org.hl7.fhir.r4.model.Composition.SectionComponent t : src.getSection())
- tgt.addSection(convertSectionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent();
- copyElement(src, tgt);
- tgt.setLabel(src.getLabel());
- tgt.setDescription(src.getDescription());
- tgt.setDirection(convertAssertionDirectionType(src.getDirection()));
- tgt.setCompareToSourceId(src.getCompareToSourceId());
- tgt.setCompareToSourcePath(src.getCompareToSourcePath());
- tgt.setContentType(convertContentType(src.getContentType()));
- tgt.setHeaderField(src.getHeaderField());
- tgt.setMinimumId(src.getMinimumId());
- tgt.setNavigationLinks(src.getNavigationLinks());
- tgt.setOperator(convertAssertionOperatorType(src.getOperator()));
- tgt.setPath(src.getPath());
- tgt.setResource(src.getResource());
- tgt.setResponse(convertAssertionResponseTypes(src.getResponse()));
- tgt.setResponseCode(src.getResponseCode());
- tgt.setSourceId(src.getSourceId());
- tgt.setValidateProfileId(src.getValidateProfileId());
- tgt.setValue(src.getValue());
- tgt.setWarningOnly(src.getWarningOnly());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent convertSetupActionAssertComponent(org.hl7.fhir.r4.model.TestScript.SetupActionAssertComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionAssertComponent();
- copyElement(src, tgt);
- tgt.setLabel(src.getLabel());
- tgt.setDescription(src.getDescription());
- tgt.setDirection(convertAssertionDirectionType(src.getDirection()));
- tgt.setCompareToSourceId(src.getCompareToSourceId());
- tgt.setCompareToSourcePath(src.getCompareToSourcePath());
- tgt.setContentType(convertContentType(src.getContentType()));
- tgt.setHeaderField(src.getHeaderField());
- tgt.setMinimumId(src.getMinimumId());
- tgt.setNavigationLinks(src.getNavigationLinks());
- tgt.setOperator(convertAssertionOperatorType(src.getOperator()));
- tgt.setPath(src.getPath());
- tgt.setResource(src.getResource());
- tgt.setResponse(convertAssertionResponseTypes(src.getResponse()));
- tgt.setResponseCode(src.getResponseCode());
- tgt.setSourceId(src.getSourceId());
- tgt.setValidateProfileId(src.getValidateProfileId());
- tgt.setValue(src.getValue());
- tgt.setWarningOnly(src.getWarningOnly());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.SetupActionComponent convertSetupActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.SetupActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionComponent();
- copyElement(src, tgt);
- tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
- tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent convertSetupActionComponent(org.hl7.fhir.r4.model.TestScript.SetupActionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent();
- copyElement(src, tgt);
- tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
- tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent();
- copyElement(src, tgt);
- tgt.setType(convertCoding(src.getType()));
- tgt.setResource(src.getResource());
- tgt.setLabel(src.getLabel());
- tgt.setDescription(src.getDescription());
- tgt.setAccept(convertContentType(src.getAccept()));
- tgt.setContentType(convertContentType(src.getContentType()));
- tgt.setDestination(src.getDestination());
- tgt.setEncodeRequestUrl(src.getEncodeRequestUrl());
- tgt.setParams(src.getParams());
- for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
- tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
- tgt.setResponseId(src.getResponseId());
- tgt.setSourceId(src.getSourceId());
- tgt.setTargetId(src.getTargetId());
- tgt.setUrl(src.getUrl());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent convertSetupActionOperationComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationComponent();
- copyElement(src, tgt);
- tgt.setType(convertCoding(src.getType()));
- tgt.setResource(src.getResource());
- tgt.setLabel(src.getLabel());
- tgt.setDescription(src.getDescription());
- tgt.setAccept(convertContentType(src.getAccept()));
- tgt.setContentType(convertContentType(src.getContentType()));
- tgt.setDestination(src.getDestination());
- tgt.setEncodeRequestUrl(src.getEncodeRequestUrl());
- tgt.setParams(src.getParams());
- for (org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent t : src.getRequestHeader())
- tgt.addRequestHeader(convertSetupActionOperationRequestHeaderComponent(t));
- tgt.setResponseId(src.getResponseId());
- tgt.setSourceId(src.getSourceId());
- tgt.setTargetId(src.getTargetId());
- tgt.setUrl(src.getUrl());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent();
- copyElement(src, tgt);
- tgt.setField(src.getField());
- tgt.setValue(src.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent convertSetupActionOperationRequestHeaderComponent(org.hl7.fhir.r4.model.TestScript.SetupActionOperationRequestHeaderComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionOperationRequestHeaderComponent();
- copyElement(src, tgt);
- tgt.setField(src.getField());
- tgt.setValue(src.getValue());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.instance.model.Contract.SignatoryComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.r4.model.Contract.SignatoryComponent();
- copyElement(src, tgt);
- tgt.setType(convertCoding(src.getType()));
- tgt.setParty(convertReference(src.getParty()));
- if (src.hasSignature())
- tgt.addSignature(new org.hl7.fhir.r4.model.Signature().setBlob(src.getSignature().getBytes()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.SignatoryComponent convertSignatoryComponent(org.hl7.fhir.r4.model.Contract.SignatoryComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.SignatoryComponent tgt = new org.hl7.fhir.instance.model.Contract.SignatoryComponent();
- copyElement(src, tgt);
- tgt.setType(convertCoding(src.getType()));
- tgt.setParty(convertReference(src.getParty()));
- for (org.hl7.fhir.r4.model.Signature t : src.getSignature())
- tgt.setSignature(Base64.encodeBase64String(t.getBlob()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Signature convertSignature(org.hl7.fhir.instance.model.Signature src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Signature tgt = new org.hl7.fhir.r4.model.Signature();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.Coding t : src.getType())
- tgt.addType(convertCoding(t));
- tgt.setWhen(src.getWhen());
- tgt.setWho(convertType(src.getWho()));
- tgt.setContentType(src.getContentType());
- tgt.setBlob(src.getBlob());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Signature convertSignature(org.hl7.fhir.r4.model.Signature src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Signature tgt = new org.hl7.fhir.instance.model.Signature();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.Coding t : src.getType())
- tgt.addType(convertCoding(t));
- tgt.setWhen(src.getWhen());
- tgt.setWho(convertType(src.getWho()));
- tgt.setContentType(src.getContentType());
- tgt.setBlob(src.getBlob());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.instance.model.SimpleQuantity src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.SimpleQuantity tgt = new org.hl7.fhir.r4.model.SimpleQuantity();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.SimpleQuantity convertSimpleQuantity(org.hl7.fhir.r4.model.SimpleQuantity src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.SimpleQuantity tgt = new org.hl7.fhir.instance.model.SimpleQuantity();
- copyElement(src, tgt);
- tgt.setValue(src.getValue());
- tgt.setComparator(convertQuantityComparator(src.getComparator()));
- tgt.setUnit(src.getUnit());
- tgt.setSystem(src.getSystem());
- tgt.setCode(src.getCode());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.instance.model.ElementDefinition.SlicingRules src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CLOSED: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.CLOSED;
- case OPEN: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPEN;
- case OPENATEND: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.OPENATEND;
- default: return org.hl7.fhir.r4.model.ElementDefinition.SlicingRules.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.ElementDefinition.SlicingRules convertSlicingRules(org.hl7.fhir.r4.model.ElementDefinition.SlicingRules src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case CLOSED: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.CLOSED;
- case OPEN: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPEN;
- case OPENATEND: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.OPENATEND;
- default: return org.hl7.fhir.instance.model.ElementDefinition.SlicingRules.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Slot convertSlot(org.hl7.fhir.instance.model.Slot src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Slot tgt = new org.hl7.fhir.r4.model.Slot();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- if (src.hasType())
- tgt.addServiceType(convertCodeableConcept(src.getType()));
- tgt.setSchedule(convertReference(src.getSchedule()));
- tgt.setStart(src.getStart());
- tgt.setEnd(src.getEnd());
- tgt.setOverbooked(src.getOverbooked());
- tgt.setComment(src.getComment());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Slot convertSlot(org.hl7.fhir.r4.model.Slot src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Slot tgt = new org.hl7.fhir.instance.model.Slot();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getServiceType())
- tgt.setType(convertCodeableConcept(t));
- tgt.setSchedule(convertReference(src.getSchedule()));
- tgt.setStart(src.getStart());
- tgt.setEnd(src.getEnd());
- tgt.setOverbooked(src.getOverbooked());
- tgt.setComment(src.getComment());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.instance.model.Slot.SlotStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case BUSY: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSY;
- case FREE: return org.hl7.fhir.r4.model.Slot.SlotStatus.FREE;
- case BUSYUNAVAILABLE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYUNAVAILABLE;
- case BUSYTENTATIVE: return org.hl7.fhir.r4.model.Slot.SlotStatus.BUSYTENTATIVE;
- default: return org.hl7.fhir.r4.model.Slot.SlotStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Slot.SlotStatus convertSlotStatus(org.hl7.fhir.r4.model.Slot.SlotStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case BUSY: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSY;
- case FREE: return org.hl7.fhir.instance.model.Slot.SlotStatus.FREE;
- case BUSYUNAVAILABLE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYUNAVAILABLE;
- case BUSYTENTATIVE: return org.hl7.fhir.instance.model.Slot.SlotStatus.BUSYTENTATIVE;
- default: return org.hl7.fhir.instance.model.Slot.SlotStatus.NULL;
- }
- }
-
- public List convertSourceElementComponent(org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent src) throws FHIRException {
- List res = new ArrayList();
- if (src == null || src.isEmpty())
- return res;
- for (org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent t : src.getTarget()) {
- org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent();
- copyElement(src, tgt);
- tgt.setCode(src.getCode());
- tgt.addTarget(convertTargetElementComponent(t));
- res.add(new SourceElementComponentWrapper(tgt, src.getCodeSystem(), t.getCodeSystem()));
- }
- return res;
- }
-
- public org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent convertSourceElementComponent(org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.SourceElementComponent();
- copyElement(src, tgt);
- tgt.setCodeSystem(g.getSource());
- tgt.setCode(src.getCode());
- for (org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent t : src.getTarget())
- tgt.addTarget(convertTargetElementComponent(t, g));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.StringType convertString(org.hl7.fhir.instance.model.StringType src) throws FHIRException {
- org.hl7.fhir.r4.model.StringType tgt = new org.hl7.fhir.r4.model.StringType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.StringType convertString(org.hl7.fhir.r4.model.StringType src) throws FHIRException {
- org.hl7.fhir.instance.model.StringType tgt = new org.hl7.fhir.instance.model.StringType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.instance.model.StructureDefinition src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.StructureDefinition tgt = new org.hl7.fhir.r4.model.StructureDefinition();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setTitle(src.getDisplay());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent t : src.getContact())
- tgt.addContact(convertStructureDefinitionContactComponent(t));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
- if (isJurisdiction(t))
- tgt.addJurisdiction(convertCodeableConcept(t));
- else
- tgt.addUseContext(convertCodeableConceptToUsageContext(t));
- tgt.setPurpose(src.getRequirements());
- tgt.setCopyright(src.getCopyright());
- for (org.hl7.fhir.instance.model.Coding t : src.getCode())
- tgt.addKeyword(convertCoding(t));
- tgt.setFhirVersion(src.getFhirVersion());
- for (org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
- tgt.addMapping(convertStructureDefinitionMappingComponent(t));
- tgt.setKind(convertStructureDefinitionKind(src.getKind(), tgt.getId()));
- tgt.setAbstract(src.getAbstract());
- tgt.setContextType(convertExtensionContext(src.getContextType()));
- for (org.hl7.fhir.instance.model.StringType t : src.getContext())
- tgt.addContext(t.getValue());
- if (src.hasConstrainedType())
- tgt.setType(src.getConstrainedType());
- else if (src.getSnapshot().hasElement())
- tgt.setType(src.getSnapshot().getElement().get(0).getPath());
- else if (src.getDifferential().hasElement() && !src.getDifferential().getElement().get(0).getPath().contains("."))
- tgt.setType(src.getDifferential().getElement().get(0).getPath());
- else
- tgt.setType(src.getDifferential().getElement().get(0).getPath().substring(0, src.getDifferential().getElement().get(0).getPath().indexOf(".")));
- tgt.setBaseDefinition(src.getBase());
- tgt.setDerivation(src.hasConstrainedType() ? org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.CONSTRAINT : org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule.SPECIALIZATION);
- tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
- tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
- if (tgt.hasSnapshot())
- tgt.getSnapshot().getElementFirstRep().getType().clear();
- if (tgt.hasDifferential())
- tgt.getDifferential().getElementFirstRep().getType().clear();
- if (tgt.getKind() == StructureDefinitionKind.PRIMITIVETYPE && !tgt.getType().equals(tgt.getId())) {
- tgt.setDerivation(TypeDerivationRule.SPECIALIZATION);
- tgt.setBaseDefinition("http://hl7.org/fhir/StructureDefinition/"+tgt.getType());
-// for (ElementDefinition ed : tgt.getSnapshot().getElement()) {
-// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+"."));
-// }
-// for (ElementDefinition ed : tgt.getDifferential().getElement()) {
-// ed.setPath(ed.getPath().replace(tgt.getType()+".", tgt.getId()+"."));
-// }
- tgt.setType(tgt.getId());
- }
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition convertStructureDefinition(org.hl7.fhir.r4.model.StructureDefinition src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.StructureDefinition tgt = new org.hl7.fhir.instance.model.StructureDefinition();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setDisplay(src.getTitle());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
- tgt.addContact(convertStructureDefinitionContactComponent(t));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
- if (t.hasValueCodeableConcept())
- tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
- tgt.addUseContext(convertCodeableConcept(t));
- tgt.setRequirements(src.getPurpose());
- tgt.setCopyright(src.getCopyright());
- for (org.hl7.fhir.r4.model.Coding t : src.getKeyword())
- tgt.addCode(convertCoding(t));
- tgt.setFhirVersion(src.getFhirVersion());
- for (org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent t : src.getMapping())
- tgt.addMapping(convertStructureDefinitionMappingComponent(t));
- tgt.setKind(convertStructureDefinitionKind(src.getKind()));
- tgt.setAbstract(src.getAbstract());
- tgt.setContextType(convertExtensionContext(src.getContextType()));
- for (org.hl7.fhir.r4.model.StringType t : src.getContext())
- tgt.addContext(t.getValue());
- tgt.setConstrainedType(src.getType());
- tgt.setBase(src.getBaseDefinition());
- tgt.setSnapshot(convertStructureDefinitionSnapshotComponent(src.getSnapshot()));
- tgt.setDifferential(convertStructureDefinitionDifferentialComponent(src.getDifferential()));
- if (tgt.hasBase()) {
- if (tgt.hasDifferential())
- tgt.getDifferential().getElement().get(0).addType().setCode(tail(tgt.getBase()));
- if (tgt.hasSnapshot())
- tgt.getSnapshot().getElement().get(0).addType().setCode(tail(tgt.getBase()));
- }
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactDetail convertStructureDefinitionContactComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent convertStructureDefinitionContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionContactComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent();
- copyElement(src, tgt);
- List slicePaths = new ArrayList();
- for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) {
- if (t.hasSlicing())
- slicePaths.add(t.getPath());
- tgt.addElement(convertElementDefinition(t, slicePaths));
- }
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent convertStructureDefinitionDifferentialComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionDifferentialComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionDifferentialComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
- tgt.addElement(convertElementDefinition(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind src, String dtName) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case DATATYPE:
- if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml"))
- return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE;
- else
- return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE;
- case RESOURCE: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.RESOURCE;
- case LOGICAL: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.LOGICAL;
- default: return org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind convertStructureDefinitionKind(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case PRIMITIVETYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
- case COMPLEXTYPE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.DATATYPE;
- case RESOURCE: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.RESOURCE;
- case LOGICAL: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.LOGICAL;
- default: return org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionKind.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent();
- copyElement(src, tgt);
- tgt.setIdentity(src.getIdentity());
- tgt.setUri(src.getUri());
- tgt.setName(src.getName());
- tgt.setComment(src.getComments());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent convertStructureDefinitionMappingComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionMappingComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionMappingComponent();
- copyElement(src, tgt);
- tgt.setIdentity(src.getIdentity());
- tgt.setUri(src.getUri());
- tgt.setName(src.getName());
- tgt.setComments(src.getComment());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent();
- copyElement(src, tgt);
- List slicePaths = new ArrayList();
- for (org.hl7.fhir.instance.model.ElementDefinition t : src.getElement()) {
- if (t.hasSlicing())
- slicePaths.add(t.getPath());
- tgt.addElement(convertElementDefinition(t, slicePaths));
- }
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent convertStructureDefinitionSnapshotComponent(org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionSnapshotComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent tgt = new org.hl7.fhir.instance.model.StructureDefinition.StructureDefinitionSnapshotComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.ElementDefinition t : src.getElement())
- tgt.addElement(convertElementDefinition(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Subscription convertSubscription(org.hl7.fhir.instance.model.Subscription src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Subscription tgt = new org.hl7.fhir.r4.model.Subscription();
- copyDomainResource(src, tgt);
- tgt.setCriteria(src.getCriteria());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getContact())
- tgt.addContact(convertContactPoint(t));
- tgt.setReason(src.getReason());
- tgt.setStatus(convertSubscriptionStatus(src.getStatus()));
- tgt.setError(src.getError());
- tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel()));
- tgt.setEnd(src.getEnd());
- for (org.hl7.fhir.instance.model.Coding t : src.getTag())
- tgt.addTag(convertCoding(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Subscription convertSubscription(org.hl7.fhir.r4.model.Subscription src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Subscription tgt = new org.hl7.fhir.instance.model.Subscription();
- copyDomainResource(src, tgt);
- tgt.setCriteria(src.getCriteria());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getContact())
- tgt.addContact(convertContactPoint(t));
- tgt.setReason(src.getReason());
- tgt.setStatus(convertSubscriptionStatus(src.getStatus()));
- tgt.setError(src.getError());
- tgt.setChannel(convertSubscriptionChannelComponent(src.getChannel()));
- tgt.setEnd(src.getEnd());
- for (org.hl7.fhir.r4.model.Coding t : src.getTag())
- tgt.addTag(convertCoding(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent();
- copyElement(src, tgt);
- tgt.setType(convertSubscriptionChannelType(src.getType()));
- tgt.setEndpoint(src.getEndpoint());
- tgt.setPayload(src.getPayload());
- tgt.addHeader(src.getHeader());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent convertSubscriptionChannelComponent(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent tgt = new org.hl7.fhir.instance.model.Subscription.SubscriptionChannelComponent();
- copyElement(src, tgt);
- tgt.setType(convertSubscriptionChannelType(src.getType()));
- tgt.setEndpoint(src.getEndpoint());
- tgt.setPayload(src.getPayload());
- if (src.hasHeader())
- tgt.setHeaderElement(convertString(src.getHeader().get(0)));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case RESTHOOK: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.RESTHOOK;
- case WEBSOCKET: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.WEBSOCKET;
- case EMAIL: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL;
- case SMS: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.SMS;
- case MESSAGE: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.MESSAGE;
- default: return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType convertSubscriptionChannelType(org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case RESTHOOK: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.RESTHOOK;
- case WEBSOCKET: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.WEBSOCKET;
- case EMAIL: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.EMAIL;
- case SMS: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.SMS;
- case MESSAGE: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.MESSAGE;
- default: return org.hl7.fhir.instance.model.Subscription.SubscriptionChannelType.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.instance.model.Subscription.SubscriptionStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REQUESTED: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.REQUESTED;
- case ACTIVE: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ACTIVE;
- case ERROR: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.ERROR;
- case OFF: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.OFF;
- default: return org.hl7.fhir.r4.model.Subscription.SubscriptionStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Subscription.SubscriptionStatus convertSubscriptionStatus(org.hl7.fhir.r4.model.Subscription.SubscriptionStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REQUESTED: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.REQUESTED;
- case ACTIVE: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ACTIVE;
- case ERROR: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.ERROR;
- case OFF: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.OFF;
- default: return org.hl7.fhir.instance.model.Subscription.SubscriptionStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Substance convertSubstance(org.hl7.fhir.instance.model.Substance src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Substance tgt = new org.hl7.fhir.r4.model.Substance();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.instance.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getCategory())
- tgt.addCategory(convertCodeableConcept(t));
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent t : src.getInstance())
- tgt.addInstance(convertSubstanceInstanceComponent(t));
- for (org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent t : src.getIngredient())
- tgt.addIngredient(convertSubstanceIngredientComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Substance convertSubstance(org.hl7.fhir.r4.model.Substance src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Substance tgt = new org.hl7.fhir.instance.model.Substance();
- copyDomainResource(src, tgt);
- for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
- tgt.addIdentifier(convertIdentifier(t));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getCategory())
- tgt.addCategory(convertCodeableConcept(t));
- tgt.setCode(convertCodeableConcept(src.getCode()));
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent t : src.getInstance())
- tgt.addInstance(convertSubstanceInstanceComponent(t));
- for (org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent t : src.getIngredient())
- tgt.addIngredient(convertSubstanceIngredientComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent();
- copyElement(src, tgt);
- tgt.setQuantity(convertRatio(src.getQuantity()));
- tgt.setSubstance(convertReference(src.getSubstance()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent convertSubstanceIngredientComponent(org.hl7.fhir.r4.model.Substance.SubstanceIngredientComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceIngredientComponent();
- copyElement(src, tgt);
- tgt.setQuantity(convertRatio(src.getQuantity()));
-// tgt.setSubstance(convertReference(src.getSubstance()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setExpiry(src.getExpiry());
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent convertSubstanceInstanceComponent(org.hl7.fhir.r4.model.Substance.SubstanceInstanceComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent tgt = new org.hl7.fhir.instance.model.Substance.SubstanceInstanceComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setExpiry(src.getExpiry());
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.instance.model.SupplyDelivery src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.SupplyDelivery tgt = new org.hl7.fhir.r4.model.SupplyDelivery();
- copyDomainResource(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus()));
- tgt.setPatient(convertReference(src.getPatient()));
- tgt.setType(convertCodeableConcept(src.getType()));
-// tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
-// tgt.setSuppliedItem(convertReference(src.getSuppliedItem()));
- tgt.setSupplier(convertReference(src.getSupplier()));
-// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared()));
-// tgt.setTime(src.getTime());
- tgt.setDestination(convertReference(src.getDestination()));
- for (org.hl7.fhir.instance.model.Reference t : src.getReceiver())
- tgt.addReceiver(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.SupplyDelivery convertSupplyDelivery(org.hl7.fhir.r4.model.SupplyDelivery src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.SupplyDelivery tgt = new org.hl7.fhir.instance.model.SupplyDelivery();
- copyDomainResource(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setStatus(convertSupplyDeliveryStatus(src.getStatus()));
- tgt.setPatient(convertReference(src.getPatient()));
- tgt.setType(convertCodeableConcept(src.getType()));
-// tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
-// tgt.setSuppliedItem(convertReference(src.getSuppliedItem()));
- tgt.setSupplier(convertReference(src.getSupplier()));
-// tgt.setWhenPrepared(convertPeriod(src.getWhenPrepared()));
-// tgt.setTime(src.getTime());
- tgt.setDestination(convertReference(src.getDestination()));
- for (org.hl7.fhir.r4.model.Reference t : src.getReceiver())
- tgt.addReceiver(convertReference(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS;
- case COMPLETED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED;
- case ABANDONED: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED;
- default: return org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus convertSupplyDeliveryStatus(org.hl7.fhir.r4.model.SupplyDelivery.SupplyDeliveryStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case INPROGRESS: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.INPROGRESS;
- case COMPLETED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.COMPLETED;
- case ABANDONED: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.ABANDONED;
- default: return org.hl7.fhir.instance.model.SupplyDelivery.SupplyDeliveryStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.instance.model.SupplyRequest src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.SupplyRequest tgt = new org.hl7.fhir.r4.model.SupplyRequest();
- copyDomainResource(src, tgt);
-// tgt.setPatient(convertReference(src.getPatient()));
-// tgt.setSource(convertReference(src.getSource()));
-// if (src.hasDate())
-// tgt.setDate(src.getDate());
-// tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
-// tgt.setStatus(convertSupplyRequestStatus(src.getStatus()));
-// tgt.setKind(convertCodeableConcept(src.getKind()));
-// tgt.getOrderedItem().setItem(convertReference(src.getOrderedItem()));
-// for (org.hl7.fhir.instance.model.Reference t : src.getSupplier())
-// tgt.addSupplier(convertReference(t));
-// tgt.setReason(convertType(src.getReason()));
-// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.SupplyRequest convertSupplyRequest(org.hl7.fhir.r4.model.SupplyRequest src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.SupplyRequest tgt = new org.hl7.fhir.instance.model.SupplyRequest();
-// copyDomainResource(src, tgt);
-// tgt.setPatient(convertReference(src.getPatient()));
-// tgt.setSource(convertReference(src.getSource()));
-// if (src.hasDate())
-// tgt.setDate(src.getDate());
-// tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
-// tgt.setStatus(convertSupplyRequestStatus(src.getStatus()));
-// tgt.setKind(convertCodeableConcept(src.getKind()));
-// tgt.setOrderedItem(convertReference(src.getOrderedItem().getItemReference()));
-// for (org.hl7.fhir.r4.model.Reference t : src.getSupplier())
-// tgt.addSupplier(convertReference(t));
-// tgt.setReason(convertType(src.getReason()));
-// tgt.setWhen(convertSupplyRequestWhenComponent(src.getWhen()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case REQUESTED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.ACTIVE;
- case COMPLETED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.COMPLETED;
- case FAILED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED;
- case CANCELLED: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.CANCELLED;
- default: return org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus convertSupplyRequestStatus(org.hl7.fhir.r4.model.SupplyRequest.SupplyRequestStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case ACTIVE: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.REQUESTED;
- case COMPLETED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.COMPLETED;
- case CANCELLED: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.CANCELLED;
- default: return org.hl7.fhir.instance.model.SupplyRequest.SupplyRequestStatus.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent tgt = new org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent();
- copyElement(src, tgt);
- tgt.setCode(convertSystemRestfulInteraction(src.getCode()));
- tgt.setDocumentation(src.getDocumentation());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent convertSystemInteractionComponent(org.hl7.fhir.r4.model.CapabilityStatement.SystemInteractionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent tgt = new org.hl7.fhir.instance.model.Conformance.SystemInteractionComponent();
- copyElement(src, tgt);
- tgt.setCode(convertSystemRestfulInteraction(src.getCode()));
- tgt.setDocumentation(src.getDocumentation());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case TRANSACTION: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.TRANSACTION;
- case SEARCHSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.SEARCHSYSTEM;
- case HISTORYSYSTEM: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.HISTORYSYSTEM;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction convertSystemRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.SystemRestfulInteraction src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case TRANSACTION: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.TRANSACTION;
- case SEARCHSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.SEARCHSYSTEM;
- case HISTORYSYSTEM: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.HISTORYSYSTEM;
- default: return org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent();
- copyElement(src, tgt);
- tgt.setCode(src.getCode());
- tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence()));
- tgt.setComment(src.getComments());
- for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
- tgt.addDependsOn(convertOtherElementComponent(t));
- for (org.hl7.fhir.instance.model.ConceptMap.OtherElementComponent t : src.getProduct())
- tgt.addProduct(convertOtherElementComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent convertTargetElementComponent(org.hl7.fhir.r4.model.ConceptMap.TargetElementComponent src, org.hl7.fhir.r4.model.ConceptMap.ConceptMapGroupComponent g) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent tgt = new org.hl7.fhir.instance.model.ConceptMap.TargetElementComponent();
- copyElement(src, tgt);
- tgt.setCodeSystem(g.getTarget());
- tgt.setCode(src.getCode());
- tgt.setEquivalence(convertConceptMapEquivalence(src.getEquivalence()));
- tgt.setComments(src.getComment());
- for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getDependsOn())
- tgt.addDependsOn(convertOtherElementComponent(t));
- for (org.hl7.fhir.r4.model.ConceptMap.OtherElementComponent t : src.getProduct())
- tgt.addProduct(convertOtherElementComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TeardownActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TeardownActionComponent();
- copyElement(src, tgt);
- tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent convertTeardownActionComponent(org.hl7.fhir.r4.model.TestScript.TeardownActionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent();
- copyElement(src, tgt);
- tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.AgentComponent convertTermAgentComponent(org.hl7.fhir.instance.model.Contract.TermActorComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.AgentComponent tgt = new org.hl7.fhir.r4.model.Contract.AgentComponent();
- copyElement(src, tgt);
- tgt.setActor(convertReference(src.getEntity()));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getRole())
- tgt.addRole(convertCodeableConcept(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.TermActorComponent convertTermAgentComponent(org.hl7.fhir.r4.model.Contract.AgentComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.TermActorComponent tgt = new org.hl7.fhir.instance.model.Contract.TermActorComponent();
- copyElement(src, tgt);
- tgt.setEntity(convertReference(src.getActor()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getRole())
- tgt.addRole(convertCodeableConcept(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.instance.model.Contract.TermComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.TermComponent tgt = new org.hl7.fhir.r4.model.Contract.TermComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setIssued(src.getIssued());
- tgt.setApplies(convertPeriod(src.getApplies()));
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setSubType(convertCodeableConcept(src.getSubType()));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getAction())
- tgt.addAction(convertCodeableConcept(t));
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getActionReason())
- tgt.addActionReason(convertCodeableConcept(t));
- for (org.hl7.fhir.instance.model.Contract.TermActorComponent t : src.getActor())
- tgt.addAgent(convertTermAgentComponent(t));
- for (org.hl7.fhir.instance.model.Contract.TermComponent t : src.getGroup())
- tgt.addGroup(convertTermComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.TermComponent convertTermComponent(org.hl7.fhir.r4.model.Contract.TermComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.TermComponent tgt = new org.hl7.fhir.instance.model.Contract.TermComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setIssued(src.getIssued());
- tgt.setApplies(convertPeriod(src.getApplies()));
- tgt.setType(convertCodeableConcept(src.getType()));
- tgt.setSubType(convertCodeableConcept(src.getSubType()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getAction())
- tgt.addAction(convertCodeableConcept(t));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getActionReason())
- tgt.addActionReason(convertCodeableConcept(t));
- for (org.hl7.fhir.r4.model.Contract.AgentComponent t : src.getAgent())
- tgt.addActor(convertTermAgentComponent(t));
- for (org.hl7.fhir.r4.model.Contract.TermComponent t : src.getGroup())
- tgt.addGroup(convertTermComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.instance.model.Contract.TermValuedItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent();
- copyElement(src, tgt);
- tgt.setEntity(convertType(src.getEntity()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setEffectiveTime(src.getEffectiveTime());
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
- tgt.setFactor(src.getFactor());
- tgt.setPoints(src.getPoints());
- tgt.setNet(convertMoney(src.getNet()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.TermValuedItemComponent convertTermValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.TermValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.TermValuedItemComponent();
- copyElement(src, tgt);
- tgt.setEntity(convertType(src.getEntity()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setEffectiveTime(src.getEffectiveTime());
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
- tgt.setFactor(src.getFactor());
- tgt.setPoints(src.getPoints());
- tgt.setNet(convertMoney(src.getNet()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestActionComponent convertTestActionComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestActionComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestActionComponent();
- copyElement(src, tgt);
- tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
- tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent convertTestActionComponent(org.hl7.fhir.r4.model.TestScript.TestActionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent();
- copyElement(src, tgt);
- tgt.setOperation(convertSetupActionOperationComponent(src.getOperation()));
- tgt.setAssert(convertSetupActionAssertComponent(src.getAssert()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript convertTestScript(org.hl7.fhir.instance.model.TestScript src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript tgt = new org.hl7.fhir.r4.model.TestScript();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent t : src.getContact())
- tgt.addContact(convertTestScriptContactComponent(t));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
- if (isJurisdiction(t))
- tgt.addJurisdiction(convertCodeableConcept(t));
- else
- tgt.addUseContext(convertCodeableConceptToUsageContext(t));
- tgt.setPurpose(src.getRequirements());
- tgt.setCopyright(src.getCopyright());
- tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
- for (org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
- tgt.addFixture(convertTestScriptFixtureComponent(t));
- for (org.hl7.fhir.instance.model.Reference t : src.getProfile())
- tgt.addProfile(convertReference(t));
- for (org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent t : src.getVariable())
- tgt.addVariable(convertTestScriptVariableComponent(t));
- tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
- for (org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent t : src.getTest())
- tgt.addTest(convertTestScriptTestComponent(t));
- tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript convertTestScript(org.hl7.fhir.r4.model.TestScript src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript tgt = new org.hl7.fhir.instance.model.TestScript();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
- tgt.addContact(convertTestScriptContactComponent(t));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
- if (t.hasValueCodeableConcept())
- tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
- tgt.addUseContext(convertCodeableConcept(t));
- tgt.setRequirements(src.getPurpose());
- tgt.setCopyright(src.getCopyright());
- tgt.setMetadata(convertTestScriptMetadataComponent(src.getMetadata()));
- for (org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent t : src.getFixture())
- tgt.addFixture(convertTestScriptFixtureComponent(t));
- for (org.hl7.fhir.r4.model.Reference t : src.getProfile())
- tgt.addProfile(convertReference(t));
- for (org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent t : src.getVariable())
- tgt.addVariable(convertTestScriptVariableComponent(t));
- tgt.setSetup(convertTestScriptSetupComponent(src.getSetup()));
- for (org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent t : src.getTest())
- tgt.addTest(convertTestScriptTestComponent(t));
- tgt.setTeardown(convertTestScriptTeardownComponent(src.getTeardown()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactDetail convertTestScriptContactComponent(org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent convertTestScriptContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptContactComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent();
- copyElement(src, tgt);
- tgt.setAutocreate(src.getAutocreate());
- tgt.setAutodelete(src.getAutodelete());
- tgt.setResource(convertReference(src.getResource()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent convertTestScriptFixtureComponent(org.hl7.fhir.r4.model.TestScript.TestScriptFixtureComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptFixtureComponent();
- copyElement(src, tgt);
- tgt.setAutocreate(src.getAutocreate());
- tgt.setAutodelete(src.getAutodelete());
- tgt.setResource(convertReference(src.getResource()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent();
- copyElement(src, tgt);
- tgt.setRequired(src.getRequired());
- tgt.setValidated(src.getValidated());
- tgt.setDescription(src.getDescription());
- tgt.setDestination(src.getDestination());
- for (org.hl7.fhir.instance.model.UriType t : src.getLink())
- tgt.addLink(t.getValue());
- tgt.setCapabilities(convertReference(src.getConformance()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent convertTestScriptMetadataCapabilityComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent();
- copyElement(src, tgt);
- tgt.setRequired(src.getRequired());
- tgt.setValidated(src.getValidated());
- tgt.setDescription(src.getDescription());
- tgt.setDestination(src.getDestination());
- for (org.hl7.fhir.r4.model.UriType t : src.getLink())
- tgt.addLink(t.getValue());
- tgt.setConformance(convertReference(src.getCapabilities()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
- tgt.addLink(convertTestScriptMetadataLinkComponent(t));
- for (org.hl7.fhir.instance.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
- tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent convertTestScriptMetadataComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent t : src.getLink())
- tgt.addLink(convertTestScriptMetadataLinkComponent(t));
- for (org.hl7.fhir.r4.model.TestScript.TestScriptMetadataCapabilityComponent t : src.getCapability())
- tgt.addCapability(convertTestScriptMetadataCapabilityComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent();
- copyElement(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setDescription(src.getDescription());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent convertTestScriptMetadataLinkComponent(org.hl7.fhir.r4.model.TestScript.TestScriptMetadataLinkComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptMetadataLinkComponent();
- copyElement(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.setDescription(src.getDescription());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.TestScript.TestScriptSetupActionComponent t : src.getAction())
- tgt.addAction(convertSetupActionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent convertTestScriptSetupComponent(org.hl7.fhir.r4.model.TestScript.TestScriptSetupComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptSetupComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.TestScript.SetupActionComponent t : src.getAction())
- tgt.addAction(convertSetupActionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.TestScript.TestScriptTeardownActionComponent t : src.getAction())
- tgt.addAction(convertTeardownActionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent convertTestScriptTeardownComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTeardownComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTeardownComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.TestScript.TeardownActionComponent t : src.getAction())
- tgt.addAction(convertTeardownActionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.TestScript.TestScriptTestActionComponent t : src.getAction())
- tgt.addAction(convertTestActionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent convertTestScriptTestComponent(org.hl7.fhir.r4.model.TestScript.TestScriptTestComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptTestComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.TestScript.TestActionComponent t : src.getAction())
- tgt.addAction(convertTestActionComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setHeaderField(src.getHeaderField());
- tgt.setPath(src.getPath());
- tgt.setSourceId(src.getSourceId());
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent convertTestScriptVariableComponent(org.hl7.fhir.r4.model.TestScript.TestScriptVariableComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent tgt = new org.hl7.fhir.instance.model.TestScript.TestScriptVariableComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setHeaderField(src.getHeaderField());
- tgt.setPath(src.getPath());
- tgt.setSourceId(src.getSourceId());
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.TimeType convertTime(org.hl7.fhir.instance.model.TimeType src) throws FHIRException {
- org.hl7.fhir.r4.model.TimeType tgt = new org.hl7.fhir.r4.model.TimeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.TimeType convertTime(org.hl7.fhir.r4.model.TimeType src) throws FHIRException {
- org.hl7.fhir.instance.model.TimeType tgt = new org.hl7.fhir.instance.model.TimeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Timing convertTiming(org.hl7.fhir.instance.model.Timing src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Timing tgt = new org.hl7.fhir.r4.model.Timing();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.DateTimeType t : src.getEvent())
- tgt.addEvent(t.getValue());
- tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat()));
- tgt.setCode(convertCodeableConcept(src.getCode()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Timing convertTiming(org.hl7.fhir.r4.model.Timing src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Timing tgt = new org.hl7.fhir.instance.model.Timing();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.DateTimeType t : src.getEvent())
- tgt.addEvent(t.getValue());
- tgt.setRepeat(convertTimingRepeatComponent(src.getRepeat()));
- tgt.setCode(convertCodeableConcept(src.getCode()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.instance.model.Timing.TimingRepeatComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.r4.model.Timing.TimingRepeatComponent();
- copyElement(src, tgt);
- tgt.setBounds(convertType(src.getBounds()));
- tgt.setCount(src.getCount());
- tgt.setDuration(src.getDuration());
- tgt.setDurationMax(src.getDurationMax());
- tgt.setDurationUnit(convertUnitsOfTime(src.getDurationUnits()));
- tgt.setFrequency(src.getFrequency());
- tgt.setFrequencyMax(src.getFrequencyMax());
- tgt.setPeriod(src.getPeriod());
- tgt.setPeriodMax(src.getPeriodMax());
- tgt.setPeriodUnit(convertUnitsOfTime(src.getPeriodUnits()));
- tgt.addWhen(convertEventTiming(src.getWhen()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Timing.TimingRepeatComponent convertTimingRepeatComponent(org.hl7.fhir.r4.model.Timing.TimingRepeatComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Timing.TimingRepeatComponent tgt = new org.hl7.fhir.instance.model.Timing.TimingRepeatComponent();
- copyElement(src, tgt);
- tgt.setBounds(convertType(src.getBounds()));
- tgt.setCount(src.getCount());
- tgt.setDuration(src.getDuration());
- tgt.setDurationMax(src.getDurationMax());
- tgt.setDurationUnits(convertUnitsOfTime(src.getDurationUnit()));
- tgt.setFrequency(src.getFrequency());
- tgt.setFrequencyMax(src.getFrequencyMax());
- tgt.setPeriod(src.getPeriod());
- tgt.setPeriodMax(src.getPeriodMax());
- tgt.setPeriodUnits(convertUnitsOfTime(src.getPeriodUnit()));
- for (Enumeration t : src.getWhen())
- tgt.setWhen(convertEventTiming(t.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Type convertType(org.hl7.fhir.instance.model.Type src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- if (src instanceof org.hl7.fhir.instance.model.Base64BinaryType)
- return convertBase64Binary((org.hl7.fhir.instance.model.Base64BinaryType) src);
- if (src instanceof org.hl7.fhir.instance.model.BooleanType)
- return convertBoolean((org.hl7.fhir.instance.model.BooleanType) src);
- if (src instanceof org.hl7.fhir.instance.model.CodeType)
- return convertCode((org.hl7.fhir.instance.model.CodeType) src);
- if (src instanceof org.hl7.fhir.instance.model.DateType)
- return convertDate((org.hl7.fhir.instance.model.DateType) src);
- if (src instanceof org.hl7.fhir.instance.model.DateTimeType)
- return convertDateTime((org.hl7.fhir.instance.model.DateTimeType) src);
- if (src instanceof org.hl7.fhir.instance.model.DecimalType)
- return convertDecimal((org.hl7.fhir.instance.model.DecimalType) src);
- if (src instanceof org.hl7.fhir.instance.model.IdType)
- return convertId((org.hl7.fhir.instance.model.IdType) src);
- if (src instanceof org.hl7.fhir.instance.model.InstantType)
- return convertInstant((org.hl7.fhir.instance.model.InstantType) src);
- if (src instanceof org.hl7.fhir.instance.model.IntegerType)
- return convertInteger((org.hl7.fhir.instance.model.IntegerType) src);
- if (src instanceof org.hl7.fhir.instance.model.MarkdownType)
- return convertMarkdown((org.hl7.fhir.instance.model.MarkdownType) src);
- if (src instanceof org.hl7.fhir.instance.model.OidType)
- return convertOid((org.hl7.fhir.instance.model.OidType) src);
- if (src instanceof org.hl7.fhir.instance.model.PositiveIntType)
- return convertPositiveInt((org.hl7.fhir.instance.model.PositiveIntType) src);
- if (src instanceof org.hl7.fhir.instance.model.StringType)
- return convertString((org.hl7.fhir.instance.model.StringType) src);
- if (src instanceof org.hl7.fhir.instance.model.TimeType)
- return convertTime((org.hl7.fhir.instance.model.TimeType) src);
- if (src instanceof org.hl7.fhir.instance.model.UnsignedIntType)
- return convertUnsignedInt((org.hl7.fhir.instance.model.UnsignedIntType) src);
- if (src instanceof org.hl7.fhir.instance.model.UriType)
- return convertUri((org.hl7.fhir.instance.model.UriType) src);
- if (src instanceof org.hl7.fhir.instance.model.UuidType)
- return convertUuid((org.hl7.fhir.instance.model.UuidType) src);
- if (src instanceof org.hl7.fhir.instance.model.Extension)
- return convertExtension((org.hl7.fhir.instance.model.Extension) src);
- if (src instanceof org.hl7.fhir.instance.model.Narrative)
- return convertNarrative((org.hl7.fhir.instance.model.Narrative) src);
- if (src instanceof org.hl7.fhir.instance.model.Annotation)
- return convertAnnotation((org.hl7.fhir.instance.model.Annotation) src);
- if (src instanceof org.hl7.fhir.instance.model.Attachment)
- return convertAttachment((org.hl7.fhir.instance.model.Attachment) src);
- if (src instanceof org.hl7.fhir.instance.model.CodeableConcept)
- return convertCodeableConcept((org.hl7.fhir.instance.model.CodeableConcept) src);
- if (src instanceof org.hl7.fhir.instance.model.Coding)
- return convertCoding((org.hl7.fhir.instance.model.Coding) src);
- if (src instanceof org.hl7.fhir.instance.model.Identifier)
- return convertIdentifier((org.hl7.fhir.instance.model.Identifier) src);
- if (src instanceof org.hl7.fhir.instance.model.Period)
- return convertPeriod((org.hl7.fhir.instance.model.Period) src);
- if (src instanceof org.hl7.fhir.instance.model.Quantity)
- return convertQuantity((org.hl7.fhir.instance.model.Quantity) src);
- if (src instanceof org.hl7.fhir.instance.model.Range)
- return convertRange((org.hl7.fhir.instance.model.Range) src);
- if (src instanceof org.hl7.fhir.instance.model.Ratio)
- return convertRatio((org.hl7.fhir.instance.model.Ratio) src);
- if (src instanceof org.hl7.fhir.instance.model.Reference)
- return convertReference((org.hl7.fhir.instance.model.Reference) src);
- if (src instanceof org.hl7.fhir.instance.model.SampledData)
- return convertSampledData((org.hl7.fhir.instance.model.SampledData) src);
- if (src instanceof org.hl7.fhir.instance.model.Signature)
- return convertSignature((org.hl7.fhir.instance.model.Signature) src);
- if (src instanceof org.hl7.fhir.instance.model.Address)
- return convertAddress((org.hl7.fhir.instance.model.Address) src);
- if (src instanceof org.hl7.fhir.instance.model.ContactPoint)
- return convertContactPoint((org.hl7.fhir.instance.model.ContactPoint) src);
- if (src instanceof org.hl7.fhir.instance.model.ElementDefinition)
- return convertElementDefinition((org.hl7.fhir.instance.model.ElementDefinition) src, new ArrayList());
- if (src instanceof org.hl7.fhir.instance.model.HumanName)
- return convertHumanName((org.hl7.fhir.instance.model.HumanName) src);
- if (src instanceof org.hl7.fhir.instance.model.Meta)
- return convertMeta((org.hl7.fhir.instance.model.Meta) src);
- if (src instanceof org.hl7.fhir.instance.model.Timing)
- return convertTiming((org.hl7.fhir.instance.model.Timing) src);
- if (src instanceof org.hl7.fhir.instance.model.Age)
- return convertAge((org.hl7.fhir.instance.model.Age) src);
- if (src instanceof org.hl7.fhir.instance.model.Count)
- return convertCount((org.hl7.fhir.instance.model.Count) src);
- if (src instanceof org.hl7.fhir.instance.model.Distance)
- return convertDistance((org.hl7.fhir.instance.model.Distance) src);
- if (src instanceof org.hl7.fhir.instance.model.Duration)
- return convertDuration((org.hl7.fhir.instance.model.Duration) src);
- if (src instanceof org.hl7.fhir.instance.model.Money)
- return convertMoney((org.hl7.fhir.instance.model.Money) src);
- if (src instanceof org.hl7.fhir.instance.model.SimpleQuantity)
- return convertSimpleQuantity((org.hl7.fhir.instance.model.SimpleQuantity) src);
- throw new Error("Unknown type "+src.fhirType());
- }
-
- public org.hl7.fhir.instance.model.Type convertType(org.hl7.fhir.r4.model.Type src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- if (src instanceof org.hl7.fhir.r4.model.Base64BinaryType)
- return convertBase64Binary((org.hl7.fhir.r4.model.Base64BinaryType) src);
- if (src instanceof org.hl7.fhir.r4.model.BooleanType)
- return convertBoolean((org.hl7.fhir.r4.model.BooleanType) src);
- if (src instanceof org.hl7.fhir.r4.model.CodeType)
- return convertCode((org.hl7.fhir.r4.model.CodeType) src);
- if (src instanceof org.hl7.fhir.r4.model.DateType)
- return convertDate((org.hl7.fhir.r4.model.DateType) src);
- if (src instanceof org.hl7.fhir.r4.model.DateTimeType)
- return convertDateTime((org.hl7.fhir.r4.model.DateTimeType) src);
- if (src instanceof org.hl7.fhir.r4.model.DecimalType)
- return convertDecimal((org.hl7.fhir.r4.model.DecimalType) src);
- if (src instanceof org.hl7.fhir.r4.model.IdType)
- return convertId((org.hl7.fhir.r4.model.IdType) src);
- if (src instanceof org.hl7.fhir.r4.model.InstantType)
- return convertInstant((org.hl7.fhir.r4.model.InstantType) src);
- if (src instanceof org.hl7.fhir.r4.model.IntegerType)
- return convertInteger((org.hl7.fhir.r4.model.IntegerType) src);
- if (src instanceof org.hl7.fhir.r4.model.MarkdownType)
- return convertMarkdown((org.hl7.fhir.r4.model.MarkdownType) src);
- if (src instanceof org.hl7.fhir.r4.model.OidType)
- return convertOid((org.hl7.fhir.r4.model.OidType) src);
- if (src instanceof org.hl7.fhir.r4.model.PositiveIntType)
- return convertPositiveInt((org.hl7.fhir.r4.model.PositiveIntType) src);
- if (src instanceof org.hl7.fhir.r4.model.StringType)
- return convertString((org.hl7.fhir.r4.model.StringType) src);
- if (src instanceof org.hl7.fhir.r4.model.TimeType)
- return convertTime((org.hl7.fhir.r4.model.TimeType) src);
- if (src instanceof org.hl7.fhir.r4.model.UnsignedIntType)
- return convertUnsignedInt((org.hl7.fhir.r4.model.UnsignedIntType) src);
- if (src instanceof org.hl7.fhir.r4.model.UriType)
- return convertUri((org.hl7.fhir.r4.model.UriType) src);
- if (src instanceof org.hl7.fhir.r4.model.UuidType)
- return convertUuid((org.hl7.fhir.r4.model.UuidType) src);
- if (src instanceof org.hl7.fhir.r4.model.Extension)
- return convertExtension((org.hl7.fhir.r4.model.Extension) src);
- if (src instanceof org.hl7.fhir.r4.model.Narrative)
- return convertNarrative((org.hl7.fhir.r4.model.Narrative) src);
- if (src instanceof org.hl7.fhir.r4.model.Annotation)
- return convertAnnotation((org.hl7.fhir.r4.model.Annotation) src);
- if (src instanceof org.hl7.fhir.r4.model.Attachment)
- return convertAttachment((org.hl7.fhir.r4.model.Attachment) src);
- if (src instanceof org.hl7.fhir.r4.model.CodeableConcept)
- return convertCodeableConcept((org.hl7.fhir.r4.model.CodeableConcept) src);
- if (src instanceof org.hl7.fhir.r4.model.Coding)
- return convertCoding((org.hl7.fhir.r4.model.Coding) src);
- if (src instanceof org.hl7.fhir.r4.model.Identifier)
- return convertIdentifier((org.hl7.fhir.r4.model.Identifier) src);
- if (src instanceof org.hl7.fhir.r4.model.Period)
- return convertPeriod((org.hl7.fhir.r4.model.Period) src);
- if (src instanceof org.hl7.fhir.r4.model.Quantity)
- return convertQuantity((org.hl7.fhir.r4.model.Quantity) src);
- if (src instanceof org.hl7.fhir.r4.model.Range)
- return convertRange((org.hl7.fhir.r4.model.Range) src);
- if (src instanceof org.hl7.fhir.r4.model.Ratio)
- return convertRatio((org.hl7.fhir.r4.model.Ratio) src);
- if (src instanceof org.hl7.fhir.r4.model.Reference)
- return convertReference((org.hl7.fhir.r4.model.Reference) src);
- if (src instanceof org.hl7.fhir.r4.model.SampledData)
- return convertSampledData((org.hl7.fhir.r4.model.SampledData) src);
- if (src instanceof org.hl7.fhir.r4.model.Signature)
- return convertSignature((org.hl7.fhir.r4.model.Signature) src);
- if (src instanceof org.hl7.fhir.r4.model.Address)
- return convertAddress((org.hl7.fhir.r4.model.Address) src);
- if (src instanceof org.hl7.fhir.r4.model.ContactPoint)
- return convertContactPoint((org.hl7.fhir.r4.model.ContactPoint) src);
- if (src instanceof org.hl7.fhir.r4.model.ElementDefinition)
- return convertElementDefinition((org.hl7.fhir.r4.model.ElementDefinition) src);
- if (src instanceof org.hl7.fhir.r4.model.HumanName)
- return convertHumanName((org.hl7.fhir.r4.model.HumanName) src);
- if (src instanceof org.hl7.fhir.r4.model.Meta)
- return convertMeta((org.hl7.fhir.r4.model.Meta) src);
- if (src instanceof org.hl7.fhir.r4.model.Timing)
- return convertTiming((org.hl7.fhir.r4.model.Timing) src);
- if (src instanceof org.hl7.fhir.r4.model.Age)
- return convertAge((org.hl7.fhir.r4.model.Age) src);
- if (src instanceof org.hl7.fhir.r4.model.Count)
- return convertCount((org.hl7.fhir.r4.model.Count) src);
- if (src instanceof org.hl7.fhir.r4.model.Distance)
- return convertDistance((org.hl7.fhir.r4.model.Distance) src);
- if (src instanceof org.hl7.fhir.r4.model.Duration)
- return convertDuration((org.hl7.fhir.r4.model.Duration) src);
- if (src instanceof org.hl7.fhir.r4.model.Money)
- return convertMoney((org.hl7.fhir.r4.model.Money) src);
- if (src instanceof org.hl7.fhir.r4.model.SimpleQuantity)
- return convertSimpleQuantity((org.hl7.fhir.r4.model.SimpleQuantity) src);
- throw new Error("Unknown type "+src.fhirType());
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case READ: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.READ;
- case VREAD: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.VREAD;
- case UPDATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.UPDATE;
- case DELETE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.DELETE;
- case HISTORYINSTANCE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYINSTANCE;
- case HISTORYTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.HISTORYTYPE;
- case CREATE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.CREATE;
- case SEARCHTYPE: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.SEARCHTYPE;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction convertTypeRestfulInteraction(org.hl7.fhir.r4.model.CapabilityStatement.TypeRestfulInteraction src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case READ: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.READ;
- case VREAD: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.VREAD;
- case UPDATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.UPDATE;
- case DELETE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.DELETE;
- case HISTORYINSTANCE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYINSTANCE;
- case HISTORYTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.HISTORYTYPE;
- case CREATE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.CREATE;
- case SEARCHTYPE: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.SEARCHTYPE;
- default: return org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.instance.model.Timing.UnitsOfTime src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case S: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.S;
- case MIN: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MIN;
- case H: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.H;
- case D: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.D;
- case WK: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.WK;
- case MO: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.MO;
- case A: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.A;
- default: return org.hl7.fhir.r4.model.Timing.UnitsOfTime.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Timing.UnitsOfTime convertUnitsOfTime(org.hl7.fhir.r4.model.Timing.UnitsOfTime src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case S: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.S;
- case MIN: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MIN;
- case H: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.H;
- case D: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.D;
- case WK: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.WK;
- case MO: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.MO;
- case A: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.A;
- default: return org.hl7.fhir.instance.model.Timing.UnitsOfTime.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.instance.model.Conformance.UnknownContentCode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NO: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NO;
- case EXTENSIONS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.EXTENSIONS;
- case ELEMENTS: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.ELEMENTS;
- case BOTH: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.BOTH;
- default: return org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.Conformance.UnknownContentCode convertUnknownContentCode(org.hl7.fhir.r4.model.CapabilityStatement.UnknownContentCode src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NO: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NO;
- case EXTENSIONS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.EXTENSIONS;
- case ELEMENTS: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.ELEMENTS;
- case BOTH: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.BOTH;
- default: return org.hl7.fhir.instance.model.Conformance.UnknownContentCode.NULL;
- }
- }
-
- public org.hl7.fhir.r4.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.instance.model.UnsignedIntType src) throws FHIRException {
- org.hl7.fhir.r4.model.UnsignedIntType tgt = new org.hl7.fhir.r4.model.UnsignedIntType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.UnsignedIntType convertUnsignedInt(org.hl7.fhir.r4.model.UnsignedIntType src) throws FHIRException {
- org.hl7.fhir.instance.model.UnsignedIntType tgt = new org.hl7.fhir.instance.model.UnsignedIntType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.UriType convertUri(org.hl7.fhir.instance.model.UriType src) throws FHIRException {
- org.hl7.fhir.r4.model.UriType tgt = new org.hl7.fhir.r4.model.UriType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.UriType convertUri(org.hl7.fhir.r4.model.UriType src) throws FHIRException {
- org.hl7.fhir.instance.model.UriType tgt = new org.hl7.fhir.instance.model.UriType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.CodeType convertUriToCode(org.hl7.fhir.r4.model.UriType src) throws FHIRException {
- org.hl7.fhir.instance.model.CodeType tgt = new org.hl7.fhir.instance.model.CodeType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.UuidType convertUuid(org.hl7.fhir.instance.model.UuidType src) throws FHIRException {
- org.hl7.fhir.r4.model.UuidType tgt = new org.hl7.fhir.r4.model.UuidType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.UuidType convertUuid(org.hl7.fhir.r4.model.UuidType src) throws FHIRException {
- org.hl7.fhir.instance.model.UuidType tgt = new org.hl7.fhir.instance.model.UuidType(src.getValue());
- copyElement(src, tgt);
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet convertValueSet(org.hl7.fhir.instance.model.ValueSet src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet tgt = new org.hl7.fhir.r4.model.ValueSet();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- tgt.addIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact())
- tgt.addContact(convertValueSetContactComponent(t));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
- if (isJurisdiction(t))
- tgt.addJurisdiction(convertCodeableConcept(t));
- else
- tgt.addUseContext(convertCodeableConceptToUsageContext(t));
- tgt.setImmutable(src.getImmutable());
- tgt.setPurpose(src.getRequirements());
- tgt.setCopyright(src.getCopyright());
- tgt.setExtensible(src.getExtensible());
- if (src.hasCompose()) {
- tgt.setCompose(convertValueSetComposeComponent(src.getCompose()));
- tgt.getCompose().setLockedDate(src.getLockedDate());
- }
- if (src.hasCodeSystem() && advisor != null) {
- org.hl7.fhir.r4.model.CodeSystem tgtcs = new org.hl7.fhir.r4.model.CodeSystem();
- copyDomainResource(src, tgtcs);
- tgtcs.setUrl(src.getCodeSystem().getSystem());
- tgtcs.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgtcs.setVersion(src.getCodeSystem().getVersion());
- tgtcs.setName(src.getName()+" Code System");
- tgtcs.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgtcs.setExperimental(src.getExperimental());
- tgtcs.setPublisher(src.getPublisher());
- for (org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent t : src.getContact())
- tgtcs.addContact(convertValueSetContactComponent(t));
- if (src.hasDate())
- tgtcs.setDate(src.getDate());
- tgtcs.setDescription(src.getDescription());
- for (org.hl7.fhir.instance.model.CodeableConcept t : src.getUseContext())
- if (isJurisdiction(t))
- tgtcs.addJurisdiction(convertCodeableConcept(t));
- else
- tgtcs.addUseContext(convertCodeableConceptToUsageContext(t));
- tgtcs.setPurpose(src.getRequirements());
- tgtcs.setCopyright(src.getCopyright());
- tgtcs.setContent(CodeSystemContentMode.COMPLETE);
- tgtcs.setCaseSensitive(src.getCodeSystem().getCaseSensitive());
- for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs : src.getCodeSystem().getConcept())
- processConcept(tgtcs.getConcept(), cs, tgtcs);
- advisor.handleCodeSystem(tgtcs, tgt);
- tgt.setUserData("r2-cs", tgtcs);
- tgt.getCompose().addInclude().setSystem(tgtcs.getUrl());
- }
- tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet convertValueSet(org.hl7.fhir.r4.model.ValueSet src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet tgt = new org.hl7.fhir.instance.model.ValueSet();
- copyDomainResource(src, tgt);
- tgt.setUrl(src.getUrl());
- for (org.hl7.fhir.r4.model.Identifier i : src.getIdentifier())
- tgt.setIdentifier(convertIdentifier(i));
- tgt.setVersion(src.getVersion());
- tgt.setName(src.getName());
- tgt.setStatus(convertConformanceResourceStatus(src.getStatus()));
- if (src.hasExperimental())
- tgt.setExperimental(src.getExperimental());
- tgt.setPublisher(src.getPublisher());
- for (org.hl7.fhir.r4.model.ContactDetail t : src.getContact())
- tgt.addContact(convertValueSetContactComponent(t));
- if (src.hasDate())
- tgt.setDate(src.getDate());
- tgt.setLockedDate(src.getCompose().getLockedDate());
- tgt.setDescription(src.getDescription());
- for (org.hl7.fhir.r4.model.UsageContext t : src.getUseContext())
- if (t.hasValueCodeableConcept())
- tgt.addUseContext(convertCodeableConcept(t.getValueCodeableConcept()));
- for (org.hl7.fhir.r4.model.CodeableConcept t : src.getJurisdiction())
- tgt.addUseContext(convertCodeableConcept(t));
- tgt.setImmutable(src.getImmutable());
- tgt.setRequirements(src.getPurpose());
- tgt.setCopyright(src.getCopyright());
- tgt.setExtensible(src.getExtensible());
- org.hl7.fhir.r4.model.CodeSystem srcCS = (CodeSystem) src.getUserData("r2-cs");
- if (srcCS == null)
- srcCS = advisor.getCodeSystem(src);
- if (srcCS != null) {
- tgt.getCodeSystem().setSystem(srcCS.getUrl());
- tgt.getCodeSystem().setVersion(srcCS.getVersion());
- tgt.getCodeSystem().setCaseSensitive(srcCS.getCaseSensitive());
- for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent cs : srcCS.getConcept())
- processConcept(tgt.getCodeSystem().getConcept(), cs, srcCS);
-
- }
- tgt.setCompose(convertValueSetComposeComponent(src.getCompose(), srcCS == null ? null : srcCS.getUrl()));
- tgt.setExpansion(convertValueSetExpansionComponent(src.getExpansion()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.UriType t : src.getImport())
- tgt.addInclude().addValueSet(t.getValue());
- for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getInclude())
- tgt.addInclude(convertConceptSetComponent(t));
- for (org.hl7.fhir.instance.model.ValueSet.ConceptSetComponent t : src.getExclude())
- tgt.addExclude(convertConceptSetComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent convertValueSetComposeComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetComposeComponent src, String noSystem) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetComposeComponent();
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getInclude()) {
- for (org.hl7.fhir.r4.model.UriType ti : t.getValueSet())
- tgt.addImport(ti.getValue());
- if (noSystem == null || !t.getSystem().equals(noSystem))
- tgt.addInclude(convertConceptSetComponent(t));
- }
- for (org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent t : src.getExclude())
- tgt.addExclude(convertConceptSetComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ContactDetail convertValueSetContactComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ContactDetail tgt = new org.hl7.fhir.r4.model.ContactDetail();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.instance.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent convertValueSetContactComponent(org.hl7.fhir.r4.model.ContactDetail src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetContactComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- for (org.hl7.fhir.r4.model.ContactPoint t : src.getTelecom())
- tgt.addTelecom(convertContactPoint(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(src.getIdentifier());
- tgt.setTimestamp(src.getTimestamp());
- tgt.setTotal(src.getTotal());
- tgt.setOffset(src.getOffset());
- for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
- tgt.addParameter(convertValueSetExpansionParameterComponent(t));
- for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
- tgt.addContains(convertValueSetExpansionContainsComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent convertValueSetExpansionComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionComponent();
- copyElement(src, tgt);
- tgt.setIdentifier(src.getIdentifier());
- tgt.setTimestamp(src.getTimestamp());
- tgt.setTotal(src.getTotal());
- tgt.setOffset(src.getOffset());
- for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent t : src.getParameter())
- tgt.addParameter(convertValueSetExpansionParameterComponent(t));
- for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
- tgt.addContains(convertValueSetExpansionContainsComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent();
- copyElement(src, tgt);
- tgt.setSystem(src.getSystem());
- tgt.setAbstract(src.getAbstract());
- tgt.setVersion(src.getVersion());
- tgt.setCode(src.getCode());
- tgt.setDisplay(src.getDisplay());
- for (org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
- tgt.addContains(convertValueSetExpansionContainsComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent convertValueSetExpansionContainsComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionContainsComponent();
- copyElement(src, tgt);
- tgt.setSystem(src.getSystem());
- tgt.setAbstract(src.getAbstract());
- tgt.setVersion(src.getVersion());
- tgt.setCode(src.getCode());
- tgt.setDisplay(src.getDisplay());
- for (org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionContainsComponent t : src.getContains())
- tgt.addContains(convertValueSetExpansionContainsComponent(t));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setValue(convertType(src.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent convertValueSetExpansionParameterComponent(org.hl7.fhir.r4.model.ValueSet.ValueSetExpansionParameterComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent tgt = new org.hl7.fhir.instance.model.ValueSet.ValueSetExpansionParameterComponent();
- copyElement(src, tgt);
- tgt.setName(src.getName());
- tgt.setValue(convertType(src.getValue()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.instance.model.Contract.ValuedItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.r4.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.r4.model.Contract.ValuedItemComponent();
- copyElement(src, tgt);
- tgt.setEntity(convertType(src.getEntity()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setEffectiveTime(src.getEffectiveTime());
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
- tgt.setFactor(src.getFactor());
- tgt.setPoints(src.getPoints());
- tgt.setNet(convertMoney(src.getNet()));
- return tgt;
- }
-
- public org.hl7.fhir.instance.model.Contract.ValuedItemComponent convertValuedItemComponent(org.hl7.fhir.r4.model.Contract.ValuedItemComponent src) throws FHIRException {
- if (src == null || src.isEmpty())
- return null;
- org.hl7.fhir.instance.model.Contract.ValuedItemComponent tgt = new org.hl7.fhir.instance.model.Contract.ValuedItemComponent();
- copyElement(src, tgt);
- tgt.setEntity(convertType(src.getEntity()));
- tgt.setIdentifier(convertIdentifier(src.getIdentifier()));
- tgt.setEffectiveTime(src.getEffectiveTime());
- tgt.setQuantity(convertSimpleQuantity(src.getQuantity()));
- tgt.setUnitPrice(convertMoney(src.getUnitPrice()));
- tgt.setFactor(src.getFactor());
- tgt.setPoints(src.getPoints());
- tgt.setNet(convertMoney(src.getNet()));
- return tgt;
- }
-
- public org.hl7.fhir.r4.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.instance.model.SearchParameter.XPathUsageType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NORMAL: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NORMAL;
- case PHONETIC: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.PHONETIC;
- case NEARBY: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NEARBY;
- case DISTANCE: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.DISTANCE;
- case OTHER: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.OTHER;
- default: return org.hl7.fhir.r4.model.SearchParameter.XPathUsageType.NULL;
- }
- }
-
- public org.hl7.fhir.instance.model.SearchParameter.XPathUsageType convertXPathUsageType(org.hl7.fhir.r4.model.SearchParameter.XPathUsageType src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case NORMAL: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NORMAL;
- case PHONETIC: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.PHONETIC;
- case NEARBY: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NEARBY;
- case DISTANCE: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.DISTANCE;
- case OTHER: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.OTHER;
- default: return org.hl7.fhir.instance.model.SearchParameter.XPathUsageType.NULL;
- }
- }
-
- public void copyBackboneElement(org.hl7.fhir.instance.model.BackboneElement src, org.hl7.fhir.r4.model.BackboneElement tgt) throws FHIRException {
- copyElement(src, tgt);
- for (org.hl7.fhir.instance.model.Extension e : src.getModifierExtension()) {
- tgt.addModifierExtension(convertExtension(e));
- }
- }
-
- public void copyBackboneElement(org.hl7.fhir.r4.model.BackboneElement src, org.hl7.fhir.instance.model.BackboneElement tgt) throws FHIRException {
- copyElement(src, tgt);
- for (org.hl7.fhir.r4.model.Extension e : src.getModifierExtension()) {
- tgt.addModifierExtension(convertExtension(e));
- }
- }
-
- public void copyDomainResource(org.hl7.fhir.instance.model.DomainResource src, org.hl7.fhir.r4.model.DomainResource tgt) throws FHIRException {
- copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.instance.model.Resource t : src.getContained())
- tgt.addContained(convertResource(t));
- for (org.hl7.fhir.instance.model.Extension t : src.getExtension())
- tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.instance.model.Extension t : src.getModifierExtension())
- tgt.addModifierExtension(convertExtension(t));
- }
-
- public void copyDomainResource(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.DomainResource tgt) throws FHIRException {
- copyResource(src, tgt);
- tgt.setText(convertNarrative(src.getText()));
- for (org.hl7.fhir.r4.model.Resource t : src.getContained())
- tgt.addContained(convertResource(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getExtension())
- tgt.addExtension(convertExtension(t));
- for (org.hl7.fhir.r4.model.Extension t : src.getModifierExtension())
- tgt.addModifierExtension(convertExtension(t));
- }
-
- public void copyElement(org.hl7.fhir.instance.model.Element src, org.hl7.fhir.r4.model.Element tgt) throws FHIRException {
- tgt.setId(src.getId());
- for (org.hl7.fhir.instance.model.Extension e : src.getExtension()) {
- tgt.addExtension(convertExtension(e));
- }
- }
-
- public void copyElement(org.hl7.fhir.r4.model.Element src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException {
- tgt.setId(src.getId());
- for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) {
- tgt.addExtension(convertExtension(e));
- }
- }
-
- public void copyElement(org.hl7.fhir.r4.model.DomainResource src, org.hl7.fhir.instance.model.Element tgt) throws FHIRException {
- tgt.setId(src.getId());
- for (org.hl7.fhir.r4.model.Extension e : src.getExtension()) {
- tgt.addExtension(convertExtension(e));
- }
- }
-
- public void copyResource(org.hl7.fhir.instance.model.Resource src, org.hl7.fhir.r4.model.Resource tgt) throws FHIRException {
- tgt.setId(src.getId());
- tgt.setMeta(convertMeta(src.getMeta()));
- tgt.setImplicitRules(src.getImplicitRules());
- tgt.setLanguage(src.getLanguage());
- }
-
- public void copyResource(org.hl7.fhir.r4.model.Resource src, org.hl7.fhir.instance.model.Resource tgt) throws FHIRException {
- tgt.setId(src.getId());
- if (src.hasMeta())
- tgt.setMeta(convertMeta(src.getMeta()));
- if (src.hasImplicitRules())
- tgt.setImplicitRules(src.getImplicitRules());
- if (src.hasLanguage())
- tgt.setLanguage(src.getLanguage());
- }
-
- private ConceptMapGroupComponent getGroup(ConceptMap map, String srcs, String tgts) {
- for (ConceptMapGroupComponent grp : map.getGroup()) {
- if (grp.getSource().equals(srcs) && grp.getTarget().equals(tgts))
- return grp;
- }
- ConceptMapGroupComponent grp = map.addGroup();
- grp.setSource(srcs);
- grp.setTarget(tgts);
- return grp;
- }
-
- private org.hl7.fhir.r4.model.Reference getPerformer(List practitioner) {
- for (ImmunizationPractitionerComponent p : practitioner) {
- if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "AP"))
- return p.getActor();
- }
- return null;
- }
-
- private org.hl7.fhir.r4.model.Reference getRequester(List practitioner) {
- for (ImmunizationPractitionerComponent p : practitioner) {
- if (hasConcept(p.getRole(), "http://hl7.org/fhir/v2/0443", "OP"))
- return p.getActor();
- }
- return null;
- }
-
- private boolean hasConcept(org.hl7.fhir.r4.model.CodeableConcept cc, String system, String code) {
- for (org.hl7.fhir.r4.model.Coding c : cc.getCoding()) {
- if (system.equals(c.getSystem()) && code.equals(c.getCode()))
- return true;
- }
- return false;
- }
-
- private boolean hasConcept(org.hl7.fhir.instance.model.CodeableConcept cc, String system, String code) {
- for (org.hl7.fhir.instance.model.Coding c : cc.getCoding()) {
- if (system.equals(c.getSystem()) && code.equals(c.getCode()))
- return true;
- }
- return false;
- }
-
- private void processConcept(List concepts, org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent cs, CodeSystem tgtcs) throws FHIRException {
- org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent ct = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent();
- concepts.add(ct);
- ct.setCode(cs.getCode());
- ct.setDisplay(cs.getDisplay());
- ct.setDefinition(cs.getDefinition());
- if (cs.getAbstract())
- CodeSystemUtilities.setNotSelectable(tgtcs, ct);
- for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
- org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent();
- cst.setLanguage(csd.getLanguage());
- cst.setUse(convertCoding(csd.getUse()));
- cst.setValue(csd.getValue());
- }
-
- for (org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent csc : cs.getConcept())
- processConcept(ct.getConcept(), csc, tgtcs);
- }
-
- private void processConcept(List concepts, ConceptDefinitionComponent cs, CodeSystem srcCS) throws FHIRException {
- org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent ct = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionComponent();
- concepts.add(ct);
- ct.setCode(cs.getCode());
- ct.setDisplay(cs.getDisplay());
- ct.setDefinition(cs.getDefinition());
- if (CodeSystemUtilities.isNotSelectable(srcCS, cs))
- ct.setAbstract(true);
- for (org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionDesignationComponent csd : cs.getDesignation()) {
- org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent cst = new org.hl7.fhir.instance.model.ValueSet.ConceptDefinitionDesignationComponent();
- cst.setLanguage(csd.getLanguage());
- cst.setUse(convertCoding(csd.getUse()));
- cst.setValue(csd.getValue());
- }
-
- for (ConceptDefinitionComponent csc : cs.getConcept())
- processConcept(ct.getConcept(), csc, srcCS);
- }
-
- private String tail(String base) {
- return base.substring(base.lastIndexOf("/")+1);
- }
-
- private static org.hl7.fhir.r4.model.Enumerations.PublicationStatus convertQuestionnaireStatus(org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case DRAFT: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.DRAFT;
- case PUBLISHED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.ACTIVE;
- case RETIRED: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.RETIRED;
- default: return org.hl7.fhir.r4.model.Enumerations.PublicationStatus.NULL;
- }
- }
-
- private static org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus convertQuestionnaireStatus(org.hl7.fhir.r4.model.Enumerations.PublicationStatus src) throws FHIRException {
- if (src == null)
- return null;
- switch (src) {
- case DRAFT: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.DRAFT;
- case ACTIVE: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.PUBLISHED;
- case RETIRED: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.RETIRED;
- default: return org.hl7.fhir.instance.model.Questionnaire.QuestionnaireStatus.NULL;
- }
- }
-
- private static boolean isJurisdiction(CodeableConcept t) {
- return t.hasCoding() && ("http://unstats.un.org/unsd/methods/m49/m49.htm".equals(t.getCoding().get(0).getSystem()) || "urn:iso:std:iso:3166".equals(t.getCoding().get(0).getSystem())
- || "https://www.usps.com/".equals(t.getCoding().get(0).getSystem()));
- }
-
- private class SourceElementComponentWrapper {
- private String source;
- private String target;
- private org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent comp;
- public SourceElementComponentWrapper(SourceElementComponent comp, String source, String target) {
- super();
- this.source = source;
- this.target = target;
- this.comp = comp;
- }
-
- }
-
}
diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java
index 1e0955c7aac..6a1e32f1b12 100644
--- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java
+++ b/hapi-fhir-converter/src/main/java/org/hl7/fhir/convertors/VersionConvertor_14_40.java
@@ -1346,7 +1346,7 @@ public class VersionConvertor_14_40 {
org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent tgt = new org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionSlicingComponent();
copyElement(src, tgt);
for (org.hl7.fhir.dstu2016may.model.StringType t : src.getDiscriminator())
- tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue()));
+ tgt.addDiscriminator(ProfileUtilities.interpretR2Discriminator(t.getValue(), true));
if (src.hasDescription())
tgt.setDescription(src.getDescription());
if (src.hasOrdered())
diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java
deleted file mode 100644
index 67c5bd5fd51..00000000000
--- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/OIDUtils.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.hl7.fhir.utilities;
-
-/*
- * #%L
- * HAPI FHIR - Converter
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-
-public class OIDUtils {
-
- /*
- 2.16.840.1.113883.3.72.5.2 - NIST owns this
- 2.16.840.1.113883.4.6 - National Provider Identifier
- 2.16.840.1.113883.6.21 - UB92
- 2.16.840.1.113883.6.69 - NDC
- */
-
- public static String getUriForOid(String r) {
- if (r.equals("2.16.840.1.113883.6.96"))
- return "http://snomed.info/sct";
- if (r.equals("2.16.840.1.113883.6.1"))
- return "http://loinc.org";
- if (r.equals("2.16.840.1.113883.6.8"))
- return "http://unitsofmeasure.org";
- if (r.equals("2.16.840.1.113883.6.3"))
- return "http://hl7.org/fhir/sid/icd-10";
- if (r.equals("2.16.840.1.113883.6.42"))
- return "http://hl7.org/fhir/sid/icd-9";
- if (r.equals("2.16.840.1.113883.6.104"))
- return "http://hl7.org/fhir/sid/icd-9";
- if (r.equals("2.16.840.1.113883.6.103"))
- return "http://hl7.org/fhir/sid/icd-9"; //todo: confirm this
- if (r.equals("2.16.840.1.113883.6.73"))
- return "http://hl7.org/fhir/sid/atc";
- if (r.equals("2.16.840.1.113883.3.26.1.1"))
- return "http://ncimeta.nci.nih.gov";
- if (r.equals("2.16.840.1.113883.3.26.1.1.1"))
- return "http://ncimeta.nci.nih.gov";
- if (r.equals("2.16.840.1.113883.6.88"))
- return "http://www.nlm.nih.gov/research/umls/rxnorm"; // todo: confirm this
-
- if (r.equals("2.16.840.1.113883.5.1008"))
- return "http://hl7.org/fhir/v3/NullFlavor";
- if (r.equals("2.16.840.1.113883.5.111"))
- return "http://hl7.org/fhir/v3/RoleCode";
- if (r.equals("2.16.840.1.113883.5.4"))
- return "http://hl7.org/fhir/v3/ActCode";
- if (r.equals("2.16.840.1.113883.5.8"))
- return "http://hl7.org/fhir/v3/ActReason";
- if (r.equals("2.16.840.1.113883.5.83"))
- return "http://hl7.org/fhir/v3/ObservationInterpretation";
- if (r.equals("2.16.840.1.113883.6.238"))
- return "http://hl7.org/fhir/v3/Race";
-
- if (r.equals("2.16.840.1.113883.6.59"))
- return "http://hl7.org/fhir/sid/cvx";
- if (r.equals("2.16.840.1.113883.12.292"))
- return "http://hl7.org/fhir/sid/cvx";
-
- if (r.equals("2.16.840.1.113883.6.12"))
- return "http://www.ama-assn.org/go/cpt";
-
- if (r.startsWith("2.16.840.1.113883.12."))
- return "http://hl7.org/fhir/sid/v2-"+r.substring(21);
- return null;
- }
-
-}
diff --git a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/ucum/UcumService.java b/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/ucum/UcumService.java
deleted file mode 100644
index dc39030e5b6..00000000000
--- a/hapi-fhir-converter/src/main/java/org/hl7/fhir/utilities/ucum/UcumService.java
+++ /dev/null
@@ -1,193 +0,0 @@
-package org.hl7.fhir.utilities.ucum;
-
-/*
- * #%L
- * HAPI FHIR - Converter
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-/*******************************************************************************
- * Crown Copyright (c) 2006+, Copyright (c) 2006 - 2014 Kestral Computing & Health Intersections.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kestral Computing P/L - initial implementation
- * Health Intersections - ongoing maintenance
- *******************************************************************************/
-
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import org.hl7.fhir.exceptions.UcumException;
-
-
-/**
- * General Ucum Service
- *
- * UCUM functionality that is useful for applications that make use of UCUM codes
- *
- * This is a tightly bound interface - consumers use the internal model classes
- *
- * @author Grahame Grieve
- *
- */
-public interface UcumService {
-
- public class UcumVersionDetails {
- private Date releaseDate;
- private String version;
- /**
- * @param releaseDate
- * @param version
- */
- public UcumVersionDetails(Date releaseDate, String version) {
- super();
- this.releaseDate = releaseDate;
- this.version = version;
- }
- /**
- * @return the releaseDate
- */
- public Date getReleaseDate() {
- return releaseDate;
- }
- /**
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- }
-
- /**
- * return Ucum Identification details for the version in use
- */
- public abstract UcumVersionDetails ucumIdentification();
-
-
- /**
- * Check UCUM. Note that this stands as a test of the service
- * more than UCUM itself (for version 1.7, there are no known
- * semantic errors in UCUM). But you should always run this test at least
- * once with the version of UCUM you are using to ensure that
- * the service implementation correctly understands the UCUM data
- * to which it is bound
- *
- * @return a list of internal errors in the UCUM spec.
- *
- */
- public abstract List validateUCUM();
-
-
- /**
- * return a list of the defined types of units in this UCUM version
- *
- * @return
- */
- public abstract Set getProperties();
-
- /**
- * validate whether a unit code are valid UCUM units
- *
- * @param units - the unit code to check
- * @return nil if valid, or an error message describing the problem
- */
- public abstract String validate(String unit);
-
- /**
- * given a unit, return a formal description of what the units stand for using
- * full names
- * @param units the unit code
- * @return formal description
- * @throws UcumException
- * @throws OHFException
- */
- public String analyse(String unit) throws UcumException ;
-
- /**
- * validate whether a units are valid UCUM units and additionally require that the
- * units from a particular property
- *
- * @param units - the unit code to check
- * @return nil if valid, or an error message describing the problem
- */
- public abstract String validateInProperty(String unit, String property);
-
- /**
- * validate whether a units are valid UCUM units and additionally require that the
- * units match a particular base canonical unit
- *
- * @param units - the unit code to check
- * @return nil if valid, or an error message describing the problem
- */
- public abstract String validateCanonicalUnits(String unit, String canonical);
-
- /**
- * given a set of units, return their canonical form
- * @param unit
- * @return the canonical form
- * @throws UcumException
- * @throws OHFException
- */
- public abstract String getCanonicalUnits(String unit) throws UcumException ;
-
- /**
- * given two pairs of units, return true if they sahre the same canonical base
- *
- * @param units1
- * @param units2
- * @return
- * @throws UcumException
- * @
- */
- public abstract boolean isComparable(String units1, String units2) throws UcumException ;
-
-
- /**
- * given a value and source unit, return the value in the given dest unit
- * an exception is thrown if the conversion is not possible
- *
- * @param value
- * @param sourceUnit
- * @param destUnit
- * @return the value if a conversion is possible
- * @throws UcumException
- * @throws OHFException
- */
- public abstract Decimal convert(Decimal value, String sourceUnit, String destUnit) throws UcumException ;
-
-
-
- /**
- * given a set of UCUM units, return a likely preferred human dense form
- *
- * SI units - as is.
- * Other units - improved by manual fixes, or the removal of []
- *
- * @param code
- * @return the preferred human display form
- */
- public abstract String getCommonDisplay(String code);
-
-
-
-}
diff --git a/hapi-fhir-jacoco/pom.xml b/hapi-fhir-jacoco/pom.xml
index 4fae00dd908..4069846907f 100644
--- a/hapi-fhir-jacoco/pom.xml
+++ b/hapi-fhir-jacoco/pom.xml
@@ -1,8 +1,13 @@
-
+
4.0.0
-
+
ca.uhn.hapi.fhir
hapi-deployable-pom
@@ -139,7 +144,7 @@
jetty-util
test
-
+
net.sf.json-lib
json-lib
@@ -225,14 +230,14 @@
spring-web
-
-
- javax.interceptor
- javax.interceptor-api
- provided
-
+
+ javax.interceptor
+ javax.interceptor-api
+ provided
+
@@ -253,6 +258,13 @@
+
+ org.basepom.maven
+ duplicate-finder-maven-plugin
+
+ true
+
+
org.jacoco
jacoco-maven-plugin
@@ -285,19 +297,17 @@
-
- post-integration-test
- install
-
- report
-
-
- ${project.build.directory}/jacoco.exec
- ${project.reporting.outputDirectory}/jacoco-report
-
-
-
-
+
+ post-integration-test
+ install
+
+ report
+
+
+ ${project.build.directory}/jacoco.exec
+ ${project.reporting.outputDirectory}/jacoco-report
+
+
diff --git a/hapi-fhir-jaxrsserver-base/pom.xml b/hapi-fhir-jaxrsserver-base/pom.xml
index 3f2ac2eacae..02db004dd62 100644
--- a/hapi-fhir-jaxrsserver-base/pom.xml
+++ b/hapi-fhir-jaxrsserver-base/pom.xml
@@ -74,6 +74,11 @@
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+ test
+
com.google.guava
guava
diff --git a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java
index e72726af6e0..23b16a2db4c 100644
--- a/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java
+++ b/hapi-fhir-jaxrsserver-base/src/main/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactory.java
@@ -34,13 +34,15 @@ import ca.uhn.fhir.rest.client.impl.RestfulClientFactory;
/**
* A Restful Client Factory, based on Jax Rs
- *
+ * Default Jax-Rs client is NOT thread safe in static context, you should create a new factory every time or
+ * use a specific Jax-Rs client implementation which managed connection pool.
* @author Peter Van Houte | peter.vanhoute@agfa.com | Agfa Healthcare
*/
public class JaxRsRestfulClientFactory extends RestfulClientFactory {
private Client myNativeClient;
-
+ private List> registeredComponents;
+
/**
* Constructor. Note that you must set the {@link FhirContext} manually using {@link #setFhirContext(FhirContext)} if this constructor is used!
*/
@@ -64,6 +66,12 @@ public class JaxRsRestfulClientFactory extends RestfulClientFactory {
myNativeClient = builder.build();
}
+ if (registeredComponents != null && !registeredComponents.isEmpty()) {
+ for (Class> c : registeredComponents) {
+ myNativeClient = myNativeClient.register(c);
+ }
+ }
+
return myNativeClient;
}
@@ -73,29 +81,46 @@ public class JaxRsRestfulClientFactory extends RestfulClientFactory {
return new JaxRsHttpClient(client, url, theIfNoneExistParams, theIfNoneExistString, theRequestType, theHeaders);
}
+ /***
+ * Not supported with default Jax-Rs client implementation
+ * @param theHost
+ * The host (or null to disable proxying, as is the default)
+ * @param thePort
+ */
@Override
public void setProxy(String theHost, Integer thePort) {
throw new UnsupportedOperationException("Proxies are not supported yet in JAX-RS client");
}
-
- /**
- * Only accept clients of type javax.ws.rs.client.Client
- *
- * @param theHttpClient
- */
+
+ /**
+ * Only accept clients of type javax.ws.rs.client.Client
+ * Can be used to set a specific Client implementation
+ * @param theHttpClient
+ */
@Override
public synchronized void setHttpClient(Object theHttpClient) {
this.myNativeClient = (Client) theHttpClient;
}
+ /**
+ * Register a list of Jax-Rs component (provider, filter...)
+ * @param components list of Jax-Rs components to register
+ */
+ public void register(List> components) {
+ registeredComponents = components;
+ }
+
+
@Override
protected JaxRsHttpClient getHttpClient(String theServerBase) {
return new JaxRsHttpClient(getNativeClientClient(), new StringBuilder(theServerBase), null, null, null, null);
}
-
- @Override
- protected void resetHttpClient() {
- this.myNativeClient = null;
- }
+
+ @Override
+ protected void resetHttpClient() {
+ if (myNativeClient != null)
+ myNativeClient.close(); // close client to avoid memory leak
+ myNativeClient = null;
+ }
}
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java
new file mode 100644
index 00000000000..944e0be9fe2
--- /dev/null
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/JaxRsRestfulClientFactoryTest.java
@@ -0,0 +1,53 @@
+package ca.uhn.fhir.jaxrs.client;
+
+import ca.uhn.fhir.context.FhirContext;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ws.rs.client.Client;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+/**
+ * Created by Sebastien Riviere on 31/07/2017.
+ */
+public class JaxRsRestfulClientFactoryTest {
+
+ private final FhirContext context = FhirContext.forDstu2();
+ private JaxRsRestfulClientFactory factory;
+
+ @Before
+ public void setUp() {
+ factory = new JaxRsRestfulClientFactory(context);
+ }
+
+ @Test
+ public void emptyConstructorTest() {
+ assertNotNull(new JaxRsRestfulClientFactory());
+ }
+
+ @Test
+ public void getDefaultNativeClientTest() {
+ assertNotNull(factory.getNativeClientClient());
+ }
+
+ @Test
+ public void getNativeClientEmptyRegisteredComponentListTest() {
+ factory.register(new ArrayList>());
+ final Client result = factory.getNativeClientClient();
+ assertNotNull(result);
+ assertTrue(result.getConfiguration().getClasses().isEmpty());
+ }
+
+ @Test
+ public void getNativeClientRegisteredComponentListTest() {
+ factory.register(Arrays.asList(MyFilter.class, String.class));
+ final Client result = factory.getNativeClientClient();
+ assertNotNull(result);
+ assertEquals(1, result.getConfiguration().getClasses().size());
+ }
+}
\ No newline at end of file
diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/MyFilter.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/MyFilter.java
new file mode 100644
index 00000000000..99bbe79ec96
--- /dev/null
+++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/client/MyFilter.java
@@ -0,0 +1,18 @@
+package ca.uhn.fhir.jaxrs.client;
+
+import javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import javax.ws.rs.client.ClientResponseFilter;
+import javax.ws.rs.ext.Provider;
+import java.io.IOException;
+
+/**
+ * Created by Sebastien Riviere on 31/07/2017.
+ */
+@Provider
+public class MyFilter implements ClientResponseFilter {
+ @Override
+ public void filter(final ClientRequestContext requestContext, final ClientResponseContext responseContext) throws IOException {
+
+ }
+}
diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml
index 4a434b2c881..1a68b4c4b84 100644
--- a/hapi-fhir-jpaserver-base/pom.xml
+++ b/hapi-fhir-jpaserver-base/pom.xml
@@ -1,4 +1,4 @@
-
+
4.0.0
@@ -32,6 +32,12 @@
3.5
-->
+
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+
+
net.sf.saxon
Saxon-HE
@@ -105,10 +111,12 @@
${project.version}
+
ch.qos.logback
@@ -163,7 +171,7 @@
thymeleaf-spring4
-
+
org.jscience
jscience
@@ -233,10 +241,12 @@
+
org.springframework
spring-core
@@ -358,6 +368,7 @@
javax.mail
javax.mail-api
+ provided
com.sun.mail
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
index 03a99a2bb18..37696c29c54 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/config/BaseConfig.java
@@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.graphql.JpaStorageServices;
import ca.uhn.fhir.jpa.search.*;
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
import ca.uhn.fhir.jpa.sp.SearchParamPresenceSvcImpl;
+import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor;
import ca.uhn.fhir.jpa.subscription.resthook.SubscriptionRestHookInterceptor;
import ca.uhn.fhir.jpa.subscription.websocket.SubscriptionWebsocketInterceptor;
import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices;
@@ -93,15 +94,6 @@ public class BaseConfig implements SchedulingConfigurer {
return new StaleSearchDeletingSvcImpl();
}
- // @PostConstruct
- // public void wireResourceDaos() {
- // Map daoBeans = myAppCtx.getBeansOfType(IDao.class);
- // List bean = myAppCtx.getBean("myResourceProvidersDstu2", List.class);
- // for (IDao next : daoBeans.values()) {
- // next.setResourceDaos(bean);
- // }
- // }
-
@Bean
@Lazy
public SubscriptionRestHookInterceptor subscriptionRestHookInterceptor() {
@@ -114,15 +106,23 @@ public class BaseConfig implements SchedulingConfigurer {
return new SubscriptionWebsocketInterceptor();
}
+ /**
+ * Note: If you're going to use this, you need to provide a bean
+ * of type {@link ca.uhn.fhir.jpa.subscription.email.IEmailSender}
+ * in your own Spring config
+ */
+ @Bean
+ @Lazy
+ public SubscriptionEmailInterceptor subscriptionEmailInterceptor() {
+ return new SubscriptionEmailInterceptor();
+ }
+
@Bean
public TaskScheduler taskScheduler() {
ConcurrentTaskScheduler retVal = new ConcurrentTaskScheduler();
retVal.setConcurrentExecutor(scheduledExecutorService().getObject());
retVal.setScheduledExecutor(scheduledExecutorService().getObject());
return retVal;
-// ThreadPoolTaskScheduler retVal = new ThreadPoolTaskScheduler();
-// retVal.setPoolSize(5);
-// return retVal;
}
/**
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
index 0a89964524a..4f88d75eb5b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java
@@ -29,7 +29,6 @@ import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
import ca.uhn.fhir.jpa.sp.ISearchParamPresenceSvc;
import ca.uhn.fhir.jpa.term.IHapiTerminologySvc;
import ca.uhn.fhir.jpa.util.DeleteConflict;
-import ca.uhn.fhir.jpa.util.StopWatch;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
@@ -51,10 +50,7 @@ import ca.uhn.fhir.rest.server.exceptions.*;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
-import ca.uhn.fhir.util.CoverageIgnore;
-import ca.uhn.fhir.util.FhirTerser;
-import ca.uhn.fhir.util.OperationOutcomeUtil;
-import ca.uhn.fhir.util.UrlUtil;
+import ca.uhn.fhir.util.*;
import com.google.common.base.Charsets;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Sets;
@@ -1011,14 +1007,6 @@ public abstract class BaseHapiFhirDao implements IDao {
changed = true;
}
- if (theResource instanceof IResource) {
- String title = ResourceMetadataKeyEnum.TITLE.get((IResource) theResource);
- if (title != null && title.length() > BaseHasResource.MAX_TITLE_LENGTH) {
- title = title.substring(0, BaseHasResource.MAX_TITLE_LENGTH);
- }
- theEntity.setTitle(title);
- }
-
return changed;
}
@@ -1052,10 +1040,6 @@ public abstract class BaseHapiFhirDao implements IDao {
ResourceMetadataKeyEnum.UPDATED.put(res, theEntity.getUpdated());
IDao.RESOURCE_PID.put(res, theEntity.getId());
- if (theEntity.getTitle() != null) {
- ResourceMetadataKeyEnum.TITLE.put(res, theEntity.getTitle());
- }
-
Collection extends BaseTag> tags = theEntity.getTags();
if (theEntity.isHasTags()) {
TagList tagList = new TagList();
@@ -2056,7 +2040,7 @@ public abstract class BaseHapiFhirDao implements IDao {
StringBuilder b = new StringBuilder();
if (theResource instanceof IResource) {
IResource resource = (IResource) theResource;
- List xmlEvents = resource.getText().getDiv().getValue();
+ List xmlEvents = XmlUtil.parse(resource.getText().getDiv().getValue());
if (xmlEvents != null) {
for (XMLEvent next : xmlEvents) {
if (next.isCharacters()) {
@@ -2069,8 +2053,7 @@ public abstract class BaseHapiFhirDao implements IDao {
IDomainResource resource = (IDomainResource) theResource;
try {
String divAsString = resource.getText().getDivAsString();
- XhtmlDt xhtml = new XhtmlDt(divAsString);
- List xmlEvents = xhtml.getValue();
+ List xmlEvents = XmlUtil.parse(divAsString);
if (xmlEvents != null) {
for (XMLEvent next : xmlEvents) {
if (next.isCharacters()) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
index a234e456941..1e238dce835 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirResourceDao.java
@@ -30,16 +30,14 @@ import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
import ca.uhn.fhir.jpa.entity.*;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
+import ca.uhn.fhir.jpa.search.PersistedJpaBundleProvider;
import ca.uhn.fhir.jpa.util.DeleteConflict;
import ca.uhn.fhir.jpa.util.StopWatch;
import ca.uhn.fhir.jpa.util.jsonpatch.JsonPatchUtils;
import ca.uhn.fhir.jpa.util.xmlpatch.XmlPatchUtils;
import ca.uhn.fhir.model.api.*;
import ca.uhn.fhir.model.primitive.IdDt;
-import ca.uhn.fhir.rest.api.PatchTypeEnum;
-import ca.uhn.fhir.rest.api.QualifiedParamList;
-import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
-import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
+import ca.uhn.fhir.rest.api.*;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.param.ParameterUtil;
@@ -64,6 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import javax.persistence.NoResultException;
import javax.persistence.TypedQuery;
+import javax.servlet.http.HttpServletResponse;
import java.util.*;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
@@ -897,6 +896,12 @@ public abstract class BaseHapiFhirResourceDao extends B
@Transactional(propagation = Propagation.SUPPORTS)
@Override
public IBundleProvider search(final SearchParameterMap theParams, RequestDetails theRequestDetails) {
+ return search(theParams, theRequestDetails, null);
+ }
+
+ @Transactional(propagation = Propagation.SUPPORTS)
+ @Override
+ public IBundleProvider search(final SearchParameterMap theParams, RequestDetails theRequestDetails, HttpServletResponse theServletResponse) {
if (myDaoConfig.getIndexMissingFields() == DaoConfig.IndexEnabledEnum.DISABLED) {
for (List> nextAnds : theParams.values()) {
@@ -928,7 +933,24 @@ public abstract class BaseHapiFhirResourceDao extends B
}
}
- return mySearchCoordinatorSvc.registerSearch(this, theParams, getResourceName());
+ CacheControlDirective cacheControlDirective = new CacheControlDirective();
+ if (theRequestDetails != null) {
+ cacheControlDirective.parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL));
+ }
+
+ IBundleProvider retVal = mySearchCoordinatorSvc.registerSearch(this, theParams, getResourceName(), cacheControlDirective);
+
+ if (retVal instanceof PersistedJpaBundleProvider) {
+ PersistedJpaBundleProvider provider = (PersistedJpaBundleProvider) retVal;
+ if (provider.isCacheHit()) {
+ if (theServletResponse != null && theRequestDetails != null) {
+ String value = "HIT from " + theRequestDetails.getFhirServerBase();
+ theServletResponse.addHeader(Constants.HEADER_X_CACHE, value);
+ }
+ }
+ }
+
+ return retVal;
}
@Override
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
index 1e972721644..e981581192b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/DaoConfig.java
@@ -107,6 +107,8 @@ public class DaoConfig {
private Set myTreatBaseUrlsAsLocal = new HashSet();
private Set myTreatReferencesAsLogical = new HashSet(DEFAULT_LOGICAL_BASE_URLS);
private boolean myAutoCreatePlaceholderReferenceTargets;
+ private Integer myCacheControlNoStoreMaxResultsUpperLimit = 1000;
+ private Integer myCountSearchResultsUpTo = null;
/**
* Constructor
@@ -131,6 +133,76 @@ public class DaoConfig {
myTreatReferencesAsLogical.add(theTreatReferencesAsLogical);
}
+ /**
+ * Specifies the highest number that a client is permitted to use in a
+ * Cache-Control: nostore, max-results=NNN
+ * directive. If the client tries to exceed this limit, the
+ * request will be denied. Defaults to 1000.
+ */
+ public Integer getCacheControlNoStoreMaxResultsUpperLimit() {
+ return myCacheControlNoStoreMaxResultsUpperLimit;
+ }
+
+ /**
+ * Specifies the highest number that a client is permitted to use in a
+ * Cache-Control: nostore, max-results=NNN
+ * directive. If the client tries to exceed this limit, the
+ * request will be denied. Defaults to 1000.
+ */
+ public void setCacheControlNoStoreMaxResultsUpperLimit(Integer theCacheControlNoStoreMaxResults) {
+ myCacheControlNoStoreMaxResultsUpperLimit = theCacheControlNoStoreMaxResults;
+ }
+
+ /**
+ * When searching, if set to a non-null value (default is null
) the
+ * search coordinator will attempt to find at least this many results
+ * before returning a response to the client. This parameter mainly affects
+ * whether a "total count" is included in the response bundle for searches that
+ * return large amounts of data.
+ *
+ * For a search that returns 10000 results, if this value is set to
+ * 10000 the search coordinator will find all 10000 results
+ * prior to returning, so the initial response bundle will have the
+ * total set to 10000. If this value is null (or less than 10000)
+ * the response bundle will likely return slightly faster, but will
+ * not include the total. Subsequent page requests will likely
+ * include the total however, if they are performed after the
+ * search coordinator has found all results.
+ *
+ *
+ * Set this value to 0
to always load all
+ * results before returning.
+ *
+ */
+ public Integer getCountSearchResultsUpTo() {
+ return myCountSearchResultsUpTo;
+ }
+
+ /**
+ * When searching, if set to a non-null value (default is null
) the
+ * search coordinator will attempt to find at least this many results
+ * before returning a response to the client. This parameter mainly affects
+ * whether a "total count" is included in the response bundle for searches that
+ * return large amounts of data.
+ *
+ * For a search that returns 10000 results, if this value is set to
+ * 10000 the search coordinator will find all 10000 results
+ * prior to returning, so the initial response bundle will have the
+ * total set to 10000. If this value is null (or less than 10000)
+ * the response bundle will likely return slightly faster, but will
+ * not include the total. Subsequent page requests will likely
+ * include the total however, if they are performed after the
+ * search coordinator has found all results.
+ *
+ *
+ * Set this value to 0
to always load all
+ * results before returning.
+ *
+ */
+ public void setCountSearchResultsUpTo(Integer theCountSearchResultsUpTo) {
+ myCountSearchResultsUpTo = theCountSearchResultsUpTo;
+ }
+
/**
* When a code system is added that contains more than this number of codes,
* the code system will be indexed later in an incremental process in order to
@@ -434,6 +506,11 @@ public class DaoConfig {
* This approach can improve performance, especially under heavy load, but can also mean that
* searches may potentially return slightly out-of-date results.
*
+ *
+ * Note that if this is set to a non-null value, clients may override this setting by using
+ * the Cache-Control
header. If this is set to null
, the Cache-Control
+ * header will be ignored.
+ *
*/
public Long getReuseCachedSearchResultsForMillis() {
return myReuseCachedSearchResultsForMillis;
@@ -449,6 +526,11 @@ public class DaoConfig {
* This approach can improve performance, especially under heavy load, but can also mean that
* searches may potentially return slightly out-of-date results.
*
+ *
+ * Note that if this is set to a non-null value, clients may override this setting by using
+ * the Cache-Control
header. If this is set to null
, the Cache-Control
+ * header will be ignored.
+ *
*/
public void setReuseCachedSearchResultsForMillis(Long theReuseCachedSearchResultsForMillis) {
myReuseCachedSearchResultsForMillis = theReuseCachedSearchResultsForMillis;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java
index 04932c11d79..4def0078564 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDaoPatientDstu2.java
@@ -65,7 +65,7 @@ public class FhirResourceDaoPatientDstu2 extends FhirResourceDaoDstu2im
paramMap.setLoadSynchronous(true);
}
- return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName());
+ return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL)));
}
@Override
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java
index 79fa7c4d33a..9e80aa6c8b5 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/IFhirResourceDao.java
@@ -33,6 +33,10 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.servlet.http.HttpServletResponse;
public interface IFhirResourceDao extends IDao {
@@ -179,6 +183,9 @@ public interface IFhirResourceDao extends IDao {
IBundleProvider search(SearchParameterMap theParams, RequestDetails theRequestDetails);
+ @Transactional(propagation = Propagation.SUPPORTS)
+ IBundleProvider search(SearchParameterMap theParams, RequestDetails theRequestDetails, HttpServletResponse theServletResponse);
+
Set searchForIds(SearchParameterMap theParams);
/**
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java
index 0a077f9f04b..23426709440 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchBuilder.java
@@ -1259,7 +1259,7 @@ public class SearchBuilder implements ISearchBuilder {
* Check if there is a unique key associated with the set
* of parameters passed in
*/
- ourLog.info("Checking for unique index for query: {}", theParams.toNormalizedQueryString(myContext));
+ ourLog.debug("Checking for unique index for query: {}", theParams.toNormalizedQueryString(myContext));
if (myCallingDao.getConfig().isUniqueIndexesEnabled()) {
if (myParams.getIncludes().isEmpty()) {
if (myParams.getRevIncludes().isEmpty()) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java
index 0b4a36ae41d..864f4531981 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/SearchParameterMap.java
@@ -274,14 +274,6 @@ public class SearchParameterMap extends LinkedHashMap theRevIncludes) {
myRevIncludes = theRevIncludes;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java
index fed35e6ad2a..31e320b04aa 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoPatientDstu3.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
@@ -66,7 +67,7 @@ public class FhirResourceDaoPatientDstu3 extends FhirResourceDaoDstu3im
paramMap.setLoadSynchronous(true);
}
- return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName());
+ return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL)));
}
@Override
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java
index f987a7bdfc3..20efb940c4d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3.java
@@ -29,6 +29,7 @@ import java.util.Map.Entry;
import javax.persistence.TypedQuery;
import ca.uhn.fhir.jpa.util.StopWatch;
+import ca.uhn.fhir.rest.param.ParameterUtil;
import org.apache.commons.lang3.Validate;
import org.apache.http.NameValuePair;
import org.hibernate.Session;
@@ -438,7 +439,11 @@ public class FhirSystemDaoDstu3 extends BaseHapiFhirSystemDao {
DaoMethodOutcome outcome;
UrlParts parts = UrlUtil.parseUrl(url);
if (isNotBlank(parts.getResourceId())) {
- res.setId(new IdType(parts.getResourceType(), parts.getResourceId()));
+ String version = null;
+ if (isNotBlank(nextReqEntry.getRequest().getIfMatch())) {
+ version = ParameterUtil.parseETagValue(nextReqEntry.getRequest().getIfMatch());
+ }
+ res.setId(new IdType(parts.getResourceType(), parts.getResourceId(), version));
outcome = resourceDao.update(res, null, false, theRequestDetails);
} else {
res.setId((String) null);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java
index d2c6e5cd38a..598e42ece8d 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/SearchParamRegistryDstu3.java
@@ -215,6 +215,9 @@ public class SearchParamRegistryDstu3 extends BaseSearchParamRegistry {
case RETIRED:
status = RuntimeSearchParamStatusEnum.RETIRED;
break;
+ case UNKNOWN:
+ status = RuntimeSearchParamStatusEnum.UNKNOWN;
+ break;
case NULL:
break;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java
index f9d66c30f7a..3d10dfcf1a4 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoPatientR4.java
@@ -24,6 +24,7 @@ import java.util.Collections;
import javax.servlet.http.HttpServletRequest;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
@@ -66,7 +67,7 @@ public class FhirResourceDaoPatientR4 extends FhirResourceDaoR4implemen
paramMap.setLoadSynchronous(true);
}
- return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName());
+ return mySearchCoordinatorSvc.registerSearch(this, paramMap, getResourceName(), new CacheControlDirective().parse(theRequestDetails.getHeaders(Constants.HEADER_CACHE_CONTROL)));
}
@Override
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java
index 05918c2e8f2..9e9ab48f2c6 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4.java
@@ -28,6 +28,7 @@ import java.util.Map.Entry;
import javax.persistence.TypedQuery;
+import ca.uhn.fhir.rest.param.ParameterUtil;
import org.apache.commons.lang3.Validate;
import org.apache.http.NameValuePair;
import org.hl7.fhir.r4.model.*;
@@ -435,7 +436,11 @@ public class FhirSystemDaoR4 extends BaseHapiFhirSystemDao {
DaoMethodOutcome outcome;
UrlParts parts = UrlUtil.parseUrl(url);
if (isNotBlank(parts.getResourceId())) {
- res.setId(new IdType(parts.getResourceType(), parts.getResourceId()));
+ String version = null;
+ if (isNotBlank(nextReqEntry.getRequest().getIfMatch())) {
+ version = ParameterUtil.parseETagValue(nextReqEntry.getRequest().getIfMatch());
+ }
+ res.setId(new IdType(parts.getResourceType(), parts.getResourceId(), version));
outcome = resourceDao.update(res, null, false, theRequestDetails);
} else {
res.setId((String) null);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java
index e82e575423a..2702ccfca83 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/r4/SearchParamRegistryR4.java
@@ -216,6 +216,9 @@ public class SearchParamRegistryR4 extends BaseSearchParamRegistry {
case RETIRED:
status = RuntimeSearchParamStatusEnum.RETIRED;
break;
+ case UNKNOWN:
+ status = RuntimeSearchParamStatusEnum.UNKNOWN;
+ break;
case NULL:
break;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java
index 055ed717096..fe1160c9cbf 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/BaseHasResource.java
@@ -20,52 +20,54 @@ package ca.uhn.fhir.jpa.entity;
* #L%
*/
-import java.util.Collection;
-import java.util.Date;
-
-import javax.persistence.*;
-
import ca.uhn.fhir.context.FhirVersionEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
+import org.hibernate.annotations.OptimisticLock;
+
+import javax.persistence.*;
+import java.util.Collection;
+import java.util.Date;
@MappedSuperclass
public abstract class BaseHasResource {
- public static final int MAX_TITLE_LENGTH = 100;
-
@Column(name = "RES_DELETED_AT", nullable = true)
@Temporal(TemporalType.TIMESTAMP)
private Date myDeleted;
@Column(name = "RES_ENCODING", nullable = false, length = 5)
@Enumerated(EnumType.STRING)
+ @OptimisticLock(excluded = true)
private ResourceEncodingEnum myEncoding;
@Column(name = "RES_VERSION", nullable = true, length = 7)
@Enumerated(EnumType.STRING)
+ @OptimisticLock(excluded = true)
private FhirVersionEnum myFhirVersion;
@OneToOne(optional = true, fetch = FetchType.EAGER, cascade = {}, orphanRemoval = false)
@JoinColumn(name = "FORCED_ID_PID")
+ @OptimisticLock(excluded = true)
private ForcedId myForcedId;
@Column(name = "HAS_TAGS", nullable = false)
+ @OptimisticLock(excluded = true)
private boolean myHasTags;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "RES_PUBLISHED", nullable = false)
+ @OptimisticLock(excluded = true)
private Date myPublished;
@Column(name = "RES_TEXT", length = Integer.MAX_VALUE - 1, nullable = false)
@Lob()
+ @OptimisticLock(excluded = true)
private byte[] myResource;
- @Column(name = "RES_TITLE", nullable = true, length = MAX_TITLE_LENGTH)
- private String myTitle;
-
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "RES_UPDATED", nullable = false)
+ @OptimisticLock(excluded = true)
private Date myUpdated;
public abstract BaseTag addTag(TagDefinition theDef);
@@ -74,18 +76,36 @@ public abstract class BaseHasResource {
return myDeleted;
}
+ public void setDeleted(Date theDate) {
+ myDeleted = theDate;
+ }
+
public ResourceEncodingEnum getEncoding() {
return myEncoding;
}
+ public void setEncoding(ResourceEncodingEnum theEncoding) {
+ myEncoding = theEncoding;
+ }
+
public FhirVersionEnum getFhirVersion() {
return myFhirVersion;
}
+ public void setFhirVersion(FhirVersionEnum theFhirVersion) {
+ myFhirVersion = theFhirVersion;
+ }
+
public ForcedId getForcedId() {
return myForcedId;
}
+ public void setForcedId(ForcedId theForcedId) {
+ myForcedId = theForcedId;
+ }
+
+ public abstract Long getId();
+
public abstract IdDt getIdDt();
public InstantDt getPublished() {
@@ -96,22 +116,30 @@ public abstract class BaseHasResource {
}
}
+ public void setPublished(InstantDt thePublished) {
+ myPublished = thePublished.getValue();
+ }
+
public byte[] getResource() {
return myResource;
}
+ public void setResource(byte[] theResource) {
+ myResource = theResource;
+ }
+
public abstract String getResourceType();
public abstract Collection extends BaseTag> getTags();
- public String getTitle() {
- return myTitle;
- }
-
public InstantDt getUpdated() {
return new InstantDt(myUpdated);
}
+ public void setUpdated(InstantDt theUpdated) {
+ myUpdated = theUpdated.getValue();
+ }
+
public Date getUpdatedDate() {
return myUpdated;
}
@@ -122,24 +150,6 @@ public abstract class BaseHasResource {
return myHasTags;
}
- public void setDeleted(Date theDate) {
- myDeleted = theDate;
- }
-
- public abstract Long getId();
-
- public void setEncoding(ResourceEncodingEnum theEncoding) {
- myEncoding = theEncoding;
- }
-
- public void setFhirVersion(FhirVersionEnum theFhirVersion) {
- myFhirVersion = theFhirVersion;
- }
-
- public void setForcedId(ForcedId theForcedId) {
- myForcedId = theForcedId;
- }
-
public void setHasTags(boolean theHasTags) {
myHasTags = theHasTags;
}
@@ -148,24 +158,8 @@ public abstract class BaseHasResource {
myPublished = thePublished;
}
- public void setPublished(InstantDt thePublished) {
- myPublished = thePublished.getValue();
- }
-
- public void setResource(byte[] theResource) {
- myResource = theResource;
- }
-
- public void setTitle(String theTitle) {
- myTitle = theTitle;
- }
-
public void setUpdated(Date theUpdated) {
myUpdated = theUpdated;
}
- public void setUpdated(InstantDt theUpdated) {
- myUpdated = theUpdated.getValue();
- }
-
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java
index d961168f0ab..4df1d50cfd1 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/ResourceTable.java
@@ -37,6 +37,7 @@ import org.apache.lucene.analysis.snowball.SnowballPorterFilterFactory;
import org.apache.lucene.analysis.standard.StandardFilterFactory;
import org.apache.lucene.analysis.standard.StandardTokenizerFactory;
import org.hibernate.annotations.ColumnDefault;
+import org.hibernate.annotations.OptimisticLock;
import org.hibernate.search.annotations.*;
import org.hibernate.search.annotations.Parameter;
@@ -124,12 +125,15 @@ public class ResourceTable extends BaseHasResource implements Serializable {
@Field(name = "myContentTextNGram", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompleteNGramAnalyzer")),
@Field(name = "myContentTextPhonetic", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompletePhoneticAnalyzer"))
})
+ @OptimisticLock(excluded = true)
private String myContentText;
@Column(name = "HASH_SHA256", length = 64, nullable = true)
+ @OptimisticLock(excluded = true)
private String myHashSha256;
@Column(name = "SP_HAS_LINKS")
+ @OptimisticLock(excluded = true)
private boolean myHasLinks;
@Id
@@ -139,12 +143,15 @@ public class ResourceTable extends BaseHasResource implements Serializable {
private Long myId;
@OneToMany(mappedBy = "myTargetResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myIncomingResourceLinks;
@Column(name = "SP_INDEX_STATUS", nullable = true)
+ @OptimisticLock(excluded = true)
private Long myIndexStatus;
@Column(name = "RES_LANGUAGE", length = MAX_LANGUAGE_LENGTH, nullable = true)
+ @OptimisticLock(excluded = true)
private String myLanguage;
/**
@@ -157,69 +164,100 @@ public class ResourceTable extends BaseHasResource implements Serializable {
@Field(name = "myNarrativeTextNGram", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompleteNGramAnalyzer")),
@Field(name = "myNarrativeTextPhonetic", index = org.hibernate.search.annotations.Index.YES, store = Store.NO, analyze = Analyze.YES, analyzer = @Analyzer(definition = "autocompletePhoneticAnalyzer"))
})
+ @OptimisticLock(excluded = true)
private String myNarrativeText;
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myParamsCoords;
@Column(name = "SP_COORDS_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsCoordsPopulated;
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myParamsDate;
@Column(name = "SP_DATE_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsDatePopulated;
+ @OptimisticLock(excluded = true)
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
private Collection myParamsNumber;
@Column(name = "SP_NUMBER_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsNumberPopulated;
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myParamsQuantity;
@Column(name = "SP_QUANTITY_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsQuantityPopulated;
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myParamsString;
@Column(name = "SP_STRING_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsStringPopulated;
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myParamsToken;
@Column(name = "SP_TOKEN_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsTokenPopulated;
@OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
private Collection myParamsUri;
@Column(name = "SP_URI_PRESENT")
+ @OptimisticLock(excluded = true)
private boolean myParamsUriPopulated;
@Column(name = "RES_PROFILE", length = MAX_PROFILE_LENGTH, nullable = true)
+ @OptimisticLock(excluded = true)
private String myProfile;
- @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
- private Collection myParamsCompositeStringUnique;
+
// Added in 3.0.0 - Should make this a primitive Boolean at some point
+ @OptimisticLock(excluded = true)
@Column(name = "SP_CMPSTR_UNIQ_PRESENT")
private Boolean myParamsCompositeStringUniquePresent = false;
+
+ @OneToMany(mappedBy = "myResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
+ @OptimisticLock(excluded = true)
+ private Collection myParamsCompositeStringUnique;
+
@OneToMany(mappedBy = "mySourceResource", cascade = {}, fetch = FetchType.LAZY, orphanRemoval = false)
@IndexedEmbedded()
+ @OptimisticLock(excluded = true)
private Collection myResourceLinks;
+
@Column(name = "RES_TYPE", length = RESTYPE_LEN)
@Field
+ @OptimisticLock(excluded = true)
private String myResourceType;
+
@OneToMany(mappedBy = "myResource", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
+ @OptimisticLock(excluded = true)
private Collection mySearchParamPresents;
+
@OneToMany(mappedBy = "myResource", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
+ @OptimisticLock(excluded = true)
private Set myTags;
+
@Transient
private transient boolean myUnchangedInCurrentOperation;
+
+ @Version
@Column(name = "RES_VER")
private long myVersion;
@@ -555,7 +593,6 @@ public class ResourceTable extends BaseHasResource implements Serializable {
retVal.setResourceType(myResourceType);
retVal.setVersion(myVersion);
- retVal.setTitle(getTitle());
retVal.setPublished(getPublished());
retVal.setUpdated(getUpdated());
retVal.setEncoding(getEncoding());
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java
index dfbc745c0b9..ff2086f1cbf 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/Search.java
@@ -50,6 +50,7 @@ public class Search implements Serializable {
private static final int FAILURE_MESSAGE_LENGTH = 500;
private static final long serialVersionUID = 1L;
+ public static final int MAX_SEARCH_QUERY_STRING = 10000;
@Temporal(TemporalType.TIMESTAMP)
@Column(name="CREATED", nullable=false, updatable=false)
@@ -100,8 +101,8 @@ public class Search implements Serializable {
private Date mySearchLastReturned;
@Lob()
- @Basic(fetch=FetchType.LAZY)
- @Column(name="SEARCH_QUERY_STRING", nullable=true, updatable=false)
+ @Basic(fetch=FetchType.LAZY)
+ @Column(name="SEARCH_QUERY_STRING", nullable=true, updatable=false, length = MAX_SEARCH_QUERY_STRING)
private String mySearchQueryString;
@Column(name="SEARCH_QUERY_STRING_HASH", nullable=true, updatable=false)
@@ -256,7 +257,11 @@ public class Search implements Serializable {
}
public void setSearchQueryString(String theSearchQueryString) {
- mySearchQueryString = theSearchQueryString;
+ if (theSearchQueryString != null && theSearchQueryString.length() > MAX_SEARCH_QUERY_STRING) {
+ mySearchQueryString = null;
+ } else {
+ mySearchQueryString = theSearchQueryString;
+ }
}
public void setSearchQueryStringHash(Integer theSearchQueryStringHash) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java
index cba8963940c..fce3910d95b 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/graphql/JpaStorageServices.java
@@ -115,6 +115,8 @@ public class JpaStorageServices extends BaseHapiFhirDao implement
break;
case URI:
break;
+ case HAS:
+ break;
}
params.add(nextArgument.getName(), param);
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java
index 059f34f1f24..43b9c63f48f 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/JpaSystemProviderDstu2.java
@@ -24,6 +24,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
import java.util.*;
import java.util.Map.Entry;
+import ca.uhn.fhir.jpa.provider.dstu3.JpaSystemProviderDstu3;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
@@ -47,7 +48,7 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus mySystemDao;
- @Autowired
+ @Autowired(required = false)
private IFulltextSearchSvc mySearchDao;
//@formatter:off
@@ -178,7 +179,8 @@ public class JpaSystemProviderDstu2 extends BaseJpaSystemProviderDstu2Plus keywords = mySearchDao.suggestKeywords(theContext, theSearchParam, theText);
Parameters retVal = new Parameters();
for (Suggestion next : keywords) {
- //@formatter:off
retVal.addParameter()
.addPart(new Parameter().setName("keyword").setValue(new StringDt(next.getTerm())))
.addPart(new Parameter().setName("score").setValue(new DecimalDt(next.getScore())));
- //@formatter:on
}
return retVal;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java
index dc4f88e9a6b..d4bcb91db47 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/BaseJpaResourceProviderValueSetDstu3.java
@@ -20,35 +20,42 @@ package ca.uhn.fhir.jpa.provider.dstu3;
* #L%
*/
-import static org.apache.commons.lang3.StringUtils.isNotBlank;
+import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet;
+import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult;
+import ca.uhn.fhir.rest.annotation.IdParam;
+import ca.uhn.fhir.rest.annotation.Operation;
+import ca.uhn.fhir.rest.annotation.OperationParam;
+import ca.uhn.fhir.rest.api.server.RequestDetails;
+import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import org.hl7.fhir.dstu3.model.*;
import javax.servlet.http.HttpServletRequest;
-import org.hl7.fhir.dstu3.model.*;
-
-import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet;
-import ca.uhn.fhir.jpa.dao.IFhirResourceDaoValueSet.ValidateCodeResult;
-import ca.uhn.fhir.rest.annotation.*;
-import ca.uhn.fhir.rest.api.server.RequestDetails;
-import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDstu3 {
- //@formatter:off
@Operation(name = "$expand", idempotent = true)
public ValueSet expand(
- HttpServletRequest theServletRequest,
- @IdParam(optional=true) IdType theId,
- @OperationParam(name="valueSet", min=0, max=1) ValueSet theValueSet,
- @OperationParam(name="identifier", min=0, max=1) UriType theIdentifier,
- @OperationParam(name = "filter", min=0, max=1) StringType theFilter,
- RequestDetails theRequestDetails) {
- //@formatter:on
-
+ HttpServletRequest theServletRequest,
+ @IdParam(optional = true) IdType theId,
+ @OperationParam(name = "valueSet", min = 0, max = 1) ValueSet theValueSet,
+ // Note: url is correct and identifier is not, but identifier was only added as
+ // of 3.1.0 so we'll leave url for now. See: https://groups.google.com/d/msgid/hapi-fhir/CAN2Cfy8kW%2BAOkgC6VjPsU3gRCpExCNZBmJdi-k5R_TWeyWH4tA%40mail.gmail.com?utm_medium=email&utm_source=footer
+ @OperationParam(name = "url", min = 0, max = 1) UriType theUrl,
+ @OperationParam(name = "identifier", min = 0, max = 1) UriType theIdentifier,
+ @OperationParam(name = "filter", min = 0, max = 1) StringType theFilter,
+ RequestDetails theRequestDetails) {
+
boolean haveId = theId != null && theId.hasIdPart();
- boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue());
+ UriType url = theIdentifier;
+ if (theUrl != null && isNotBlank(theUrl.getValue())) {
+ url = theUrl;
+ }
+
+ boolean haveIdentifier = url != null && isNotBlank(url.getValue());
boolean haveValueSet = theValueSet != null && theValueSet.isEmpty() == false;
-
+
if (!haveId && !haveIdentifier && !haveValueSet) {
throw new InvalidRequestException("$expand operation at the type level (no ID specified) requires an identifier or a valueSet as a part of the request");
}
@@ -56,18 +63,18 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
if (moreThanOneTrue(haveId, haveIdentifier, haveValueSet)) {
throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.");
}
-
+
startRequest(theServletRequest);
try {
IFhirResourceDaoValueSet dao = (IFhirResourceDaoValueSet) getDao();
if (haveId) {
return dao.expand(theId, toFilterString(theFilter), theRequestDetails);
} else if (haveIdentifier) {
- return dao.expandByIdentifier(theIdentifier.getValue(), toFilterString(theFilter));
+ return dao.expandByIdentifier(url.getValue(), toFilterString(theFilter));
} else {
return dao.expand(theValueSet, toFilterString(theFilter));
}
-
+
} finally {
endRequest(theServletRequest);
}
@@ -79,30 +86,34 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
}
- //@formatter:off
@SuppressWarnings("unchecked")
- @Operation(name = "$validate-code", idempotent = true, returnParameters= {
- @OperationParam(name="result", type=BooleanType.class, min=1),
- @OperationParam(name="message", type=StringType.class),
- @OperationParam(name="display", type=StringType.class)
+ @Operation(name = "$validate-code", idempotent = true, returnParameters = {
+ @OperationParam(name = "result", type = BooleanType.class, min = 1),
+ @OperationParam(name = "message", type = StringType.class),
+ @OperationParam(name = "display", type = StringType.class)
})
public Parameters validateCode(
- HttpServletRequest theServletRequest,
- @IdParam(optional=true) IdType theId,
- @OperationParam(name="identifier", min=0, max=1) UriType theValueSetIdentifier,
- @OperationParam(name="code", min=0, max=1) CodeType theCode,
- @OperationParam(name="system", min=0, max=1) UriType theSystem,
- @OperationParam(name="display", min=0, max=1) StringType theDisplay,
- @OperationParam(name="coding", min=0, max=1) Coding theCoding,
- @OperationParam(name="codeableConcept", min=0, max=1) CodeableConcept theCodeableConcept,
- RequestDetails theRequestDetails
- ) {
- //@formatter:on
-
+ HttpServletRequest theServletRequest,
+ @IdParam(optional = true) IdType theId,
+ @OperationParam(name = "identifier", min = 0, max = 1) UriType theValueSetIdentifier,
+ @OperationParam(name = "url", min = 0, max = 1) UriType theValueSetUrl,
+ @OperationParam(name = "code", min = 0, max = 1) CodeType theCode,
+ @OperationParam(name = "system", min = 0, max = 1) UriType theSystem,
+ @OperationParam(name = "display", min = 0, max = 1) StringType theDisplay,
+ @OperationParam(name = "coding", min = 0, max = 1) Coding theCoding,
+ @OperationParam(name = "codeableConcept", min = 0, max = 1) CodeableConcept theCodeableConcept,
+ RequestDetails theRequestDetails
+ ) {
+
+ UriType url = theValueSetIdentifier;
+ if (theValueSetUrl != null && isNotBlank(theValueSetUrl.getValue())) {
+ url = theValueSetUrl;
+ }
+
startRequest(theServletRequest);
try {
IFhirResourceDaoValueSet dao = (IFhirResourceDaoValueSet) getDao();
- ValidateCodeResult result = dao.validateCode(theValueSetIdentifier, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails);
+ ValidateCodeResult result = dao.validateCode(url, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails);
Parameters retVal = new Parameters();
retVal.addParameter().setName("result").setValue(new BooleanType(result.isResult()));
if (isNotBlank(result.getMessage())) {
@@ -117,8 +128,7 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
}
}
-
-
+
private static boolean moreThanOneTrue(boolean... theBooleans) {
boolean haveOne = false;
for (boolean next : theBooleans) {
@@ -133,5 +143,5 @@ public class BaseJpaResourceProviderValueSetDstu3 extends JpaResourceProviderDst
return false;
}
-
+
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java
index e2567514936..c4562a39048 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/provider/dstu3/JpaSystemProviderDstu3.java
@@ -1,5 +1,27 @@
package ca.uhn.fhir.jpa.provider.dstu3;
+import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl.Suggestion;
+import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
+import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
+import ca.uhn.fhir.jpa.provider.BaseJpaSystemProviderDstu2Plus;
+import ca.uhn.fhir.model.api.annotation.Description;
+import ca.uhn.fhir.rest.annotation.Operation;
+import ca.uhn.fhir.rest.annotation.OperationParam;
+import ca.uhn.fhir.rest.annotation.Transaction;
+import ca.uhn.fhir.rest.annotation.TransactionParam;
+import ca.uhn.fhir.rest.api.server.RequestDetails;
+import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
+import org.hl7.fhir.dstu3.model.*;
+import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.TreeMap;
+
import static org.apache.commons.lang3.StringUtils.isBlank;
/*
@@ -21,23 +43,6 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
* limitations under the License.
* #L%
*/
-import java.util.*;
-import java.util.Map.Entry;
-
-import org.hl7.fhir.dstu3.model.*;
-import org.hl7.fhir.dstu3.model.Parameters.ParametersParameterComponent;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-
-import ca.uhn.fhir.jpa.dao.FulltextSearchSvcImpl.Suggestion;
-import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
-import ca.uhn.fhir.jpa.dao.IFulltextSearchSvc;
-import ca.uhn.fhir.jpa.provider.BaseJpaSystemProviderDstu2Plus;
-import ca.uhn.fhir.model.api.annotation.Description;
-import ca.uhn.fhir.rest.annotation.*;
-import ca.uhn.fhir.rest.api.server.RequestDetails;
-import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
-import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus {
@@ -45,122 +50,122 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus mySystemDao;
- @Autowired
+ @Autowired(required = false)
private IFulltextSearchSvc mySearchDao;
-
+
//@formatter:off
// This is generated by hand:
// ls hapi-fhir-structures-dstu2/target/generated-sources/tinder/ca/uhn/fhir/model/dstu2/resource/ | sort | sed "s/.java//" | sed "s/^/@OperationParam(name=\"/" | sed "s/$/\", type=IntegerType.class, min=0, max=1),/"
- @Operation(name="$get-resource-counts", idempotent=true, returnParameters= {
- @OperationParam(name="AllergyIntolerance", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Appointment", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="AppointmentResponse", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="AuditEvent", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Basic", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Binary", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="BodySite", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Bundle", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="CarePlan", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="CarePlan2", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Claim", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ClaimResponse", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ClinicalImpression", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Communication", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="CommunicationRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Composition", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ConceptMap", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Condition", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Conformance", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Contract", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Contraindication", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Coverage", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DataElement", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Device", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DeviceComponent", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DeviceMetric", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DeviceUseRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DeviceUseStatement", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DiagnosticOrder", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DiagnosticReport", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DocumentManifest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="DocumentReference", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="EligibilityRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="EligibilityResponse", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Encounter", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="EnrollmentRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="EnrollmentResponse", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="EpisodeOfCare", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ExplanationOfBenefit", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="FamilyMemberHistory", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Flag", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Goal", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Group", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="HealthcareService", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ImagingObjectSelection", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ImagingStudy", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Immunization", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ImmunizationRecommendation", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ListResource", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Location", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Media", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Medication", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="MedicationAdministration", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="MedicationDispense", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="MedicationPrescription", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="MedicationStatement", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="MessageHeader", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="NamingSystem", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="NutritionOrder", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Observation", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="OperationDefinition", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="OperationOutcome", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Order", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="OrderResponse", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Organization", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Parameters", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Patient", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="PaymentNotice", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="PaymentReconciliation", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Person", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Practitioner", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Procedure", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ProcedureRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ProcessRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ProcessResponse", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Provenance", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Questionnaire", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="QuestionnaireAnswers", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ReferralRequest", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="RelatedPerson", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="RiskAssessment", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Schedule", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="SearchParameter", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Slot", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Specimen", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="StructureDefinition", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Subscription", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Substance", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="Supply", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="ValueSet", type=IntegerType.class, min=0, max=1),
- @OperationParam(name="VisionPrescription", type=IntegerType.class, min=0, max=1)
+ @Operation(name = "$get-resource-counts", idempotent = true, returnParameters = {
+ @OperationParam(name = "AllergyIntolerance", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Appointment", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "AppointmentResponse", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "AuditEvent", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Basic", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Binary", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "BodySite", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Bundle", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "CarePlan", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "CarePlan2", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Claim", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ClaimResponse", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ClinicalImpression", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Communication", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "CommunicationRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Composition", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ConceptMap", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Condition", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Conformance", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Contract", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Contraindication", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Coverage", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DataElement", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Device", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DeviceComponent", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DeviceMetric", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DeviceUseRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DeviceUseStatement", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DiagnosticOrder", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DiagnosticReport", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DocumentManifest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "DocumentReference", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "EligibilityRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "EligibilityResponse", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Encounter", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "EnrollmentRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "EnrollmentResponse", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "EpisodeOfCare", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ExplanationOfBenefit", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "FamilyMemberHistory", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Flag", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Goal", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Group", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "HealthcareService", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ImagingObjectSelection", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ImagingStudy", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Immunization", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ImmunizationRecommendation", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ListResource", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Location", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Media", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Medication", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "MedicationAdministration", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "MedicationDispense", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "MedicationPrescription", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "MedicationStatement", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "MessageHeader", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "NamingSystem", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "NutritionOrder", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Observation", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "OperationDefinition", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "OperationOutcome", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Order", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "OrderResponse", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Organization", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Parameters", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Patient", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "PaymentNotice", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "PaymentReconciliation", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Person", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Practitioner", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Procedure", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ProcedureRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ProcessRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ProcessResponse", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Provenance", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Questionnaire", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "QuestionnaireAnswers", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ReferralRequest", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "RelatedPerson", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "RiskAssessment", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Schedule", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "SearchParameter", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Slot", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Specimen", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "StructureDefinition", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Subscription", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Substance", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "Supply", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "ValueSet", type = IntegerType.class, min = 0, max = 1),
+ @OperationParam(name = "VisionPrescription", type = IntegerType.class, min = 0, max = 1)
})
- @Description(shortDefinition="Provides the number of resources currently stored on the server, broken down by resource type")
+ @Description(shortDefinition = "Provides the number of resources currently stored on the server, broken down by resource type")
//@formatter:on
public Parameters getResourceCounts() {
Parameters retVal = new Parameters();
-
+
Map counts = mySystemDao.getResourceCounts();
counts = new TreeMap(counts);
for (Entry nextEntry : counts.entrySet()) {
retVal.addParameter().setName((nextEntry.getKey())).setValue(new IntegerType(nextEntry.getValue().intValue()));
}
-
+
return retVal;
}
//@formatter:off
- @Operation(name="$meta", idempotent=true, returnParameters= {
- @OperationParam(name="return", type=Meta.class)
+ @Operation(name = "$meta", idempotent = true, returnParameters = {
+ @OperationParam(name = "return", type = Meta.class)
})
//@formatter:on
public Parameters meta(RequestDetails theRequestDetails) {
@@ -168,14 +173,15 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus keywords = mySearchDao.suggestKeywords(theContext, theSearchParam, theText);
-
+
Parameters retVal = new Parameters();
for (Suggestion next : keywords) {
//@formatter:off
retVal.addParameter()
- .addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm())))
- .addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore())));
+ .addPart(new ParametersParameterComponent().setName("keyword").setValue(new StringType(next.getTerm())))
+ .addPart(new ParametersParameterComponent().setName("score").setValue(new DecimalType(next.getScore())));
//@formatter:on
}
return retVal;
}
-
+
@Transaction
public Bundle transaction(RequestDetails theRequestDetails, @TransactionParam Bundle theResources) {
startRequest(((ServletRequestDetails) theRequestDetails).getServletRequest());
@@ -210,4 +216,10 @@ public class JpaSystemProviderDstu3 extends BaseJpaSystemProviderDstu2Plus {
- //@formatter:off
@Operation(name = "$expand", idempotent = true)
public ValueSet expand(
- HttpServletRequest theServletRequest,
- @IdParam(optional=true) IdType theId,
- @OperationParam(name="valueSet", min=0, max=1) ValueSet theValueSet,
- @OperationParam(name="identifier", min=0, max=1) UriType theIdentifier,
- @OperationParam(name = "filter", min=0, max=1) StringType theFilter,
- RequestDetails theRequestDetails) {
- //@formatter:on
-
+ HttpServletRequest theServletRequest,
+ @IdParam(optional = true) IdType theId,
+ @OperationParam(name = "valueSet", min = 0, max = 1) ValueSet theValueSet,
+ @OperationParam(name = "url", min = 0, max = 1) UriType theUrl,
+ @OperationParam(name = "filter", min = 0, max = 1) StringType theFilter,
+ RequestDetails theRequestDetails) {
+
boolean haveId = theId != null && theId.hasIdPart();
- boolean haveIdentifier = theIdentifier != null && isNotBlank(theIdentifier.getValue());
+ boolean haveIdentifier = theUrl != null && isNotBlank(theUrl.getValue());
boolean haveValueSet = theValueSet != null && theValueSet.isEmpty() == false;
-
+
if (!haveId && !haveIdentifier && !haveValueSet) {
- throw new InvalidRequestException("$expand operation at the type level (no ID specified) requires an identifier or a valueSet as a part of the request");
+ throw new InvalidRequestException("$expand operation at the type level (no ID specified) requires a url or a valueSet as a part of the request");
}
if (moreThanOneTrue(haveId, haveIdentifier, haveValueSet)) {
- throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.");
+ throw new InvalidRequestException("$expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options.");
}
-
+
startRequest(theServletRequest);
try {
IFhirResourceDaoValueSet dao = (IFhirResourceDaoValueSet) getDao();
if (haveId) {
return dao.expand(theId, toFilterString(theFilter), theRequestDetails);
} else if (haveIdentifier) {
- return dao.expandByIdentifier(theIdentifier.getValue(), toFilterString(theFilter));
+ return dao.expandByIdentifier(theUrl.getValue(), toFilterString(theFilter));
} else {
return dao.expand(theValueSet, toFilterString(theFilter));
}
-
+
} finally {
endRequest(theServletRequest);
}
@@ -79,30 +78,28 @@ public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4 dao = (IFhirResourceDaoValueSet) getDao();
- ValidateCodeResult result = dao.validateCode(theValueSetIdentifier, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails);
+ ValidateCodeResult result = dao.validateCode(theValueSetUrl, theId, theCode, theSystem, theDisplay, theCoding, theCodeableConcept, theRequestDetails);
Parameters retVal = new Parameters();
retVal.addParameter().setName("result").setValue(new BooleanType(result.isResult()));
if (isNotBlank(result.getMessage())) {
@@ -117,8 +114,7 @@ public class BaseJpaResourceProviderValueSetR4 extends JpaResourceProviderR4 mySystemDao;
- @Autowired
+ @Autowired(required = false)
private IFulltextSearchSvc mySearchDao;
//@formatter:off
@@ -175,6 +175,7 @@ public class JpaSystemProviderR4 extends BaseJpaSystemProviderDstu2Plus getResources(String theUuid, int theFrom, int theTo);
-
- IBundleProvider registerSearch(IDao theCallingDao, SearchParameterMap theParams, String theResourceType);
-
void cancelAllActiveSearches();
+ List getResources(String theUuid, int theFrom, int theTo);
+
+ IBundleProvider registerSearch(IDao theCallingDao, SearchParameterMap theParams, String theResourceType, CacheControlDirective theCacheControlDirective);
+
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
index 7bb742485d4..d0cece19699 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaBundleProvider.java
@@ -19,23 +19,32 @@ package ca.uhn.fhir.jpa.search;
* limitations under the License.
* #L%
*/
-import java.util.*;
-
-import javax.persistence.*;
-import javax.persistence.criteria.*;
-
-import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.springframework.transaction.PlatformTransactionManager;
-import org.springframework.transaction.TransactionStatus;
-import org.springframework.transaction.support.*;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.IDao;
import ca.uhn.fhir.jpa.dao.ISearchBuilder;
import ca.uhn.fhir.jpa.dao.data.ISearchDao;
-import ca.uhn.fhir.jpa.entity.*;
+import ca.uhn.fhir.jpa.entity.BaseHasResource;
+import ca.uhn.fhir.jpa.entity.ResourceHistoryTable;
+import ca.uhn.fhir.jpa.entity.Search;
+import ca.uhn.fhir.jpa.entity.SearchTypeEnum;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallback;
+import org.springframework.transaction.support.TransactionCallbackWithoutResult;
+import org.springframework.transaction.support.TransactionTemplate;
+
+import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
+import javax.persistence.TypedQuery;
+import javax.persistence.criteria.CriteriaBuilder;
+import javax.persistence.criteria.CriteriaQuery;
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import java.util.*;
public class PersistedJpaBundleProvider implements IBundleProvider {
@@ -47,6 +56,7 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
private ISearchDao mySearchDao;
private Search mySearchEntity;
private String myUuid;
+ private boolean myCacheHit;
public PersistedJpaBundleProvider(String theSearchUuid, IDao theDao) {
myUuid = theSearchUuid;
@@ -179,17 +189,17 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
});
switch (mySearchEntity.getSearchType()) {
- case HISTORY:
- return template.execute(new TransactionCallback>() {
- @Override
- public List doInTransaction(TransactionStatus theStatus) {
- return doHistoryInTransaction(theFromIndex, theToIndex);
- }
- });
- case SEARCH:
- case EVERYTHING:
- default:
- return doSearchOrEverything(theFromIndex, theToIndex);
+ case HISTORY:
+ return template.execute(new TransactionCallback>() {
+ @Override
+ public List doInTransaction(TransactionStatus theStatus) {
+ return doHistoryInTransaction(theFromIndex, theToIndex);
+ }
+ });
+ case SEARCH:
+ case EVERYTHING:
+ default:
+ return doSearchOrEverything(theFromIndex, theToIndex);
}
}
@@ -197,6 +207,14 @@ public class PersistedJpaBundleProvider implements IBundleProvider {
return myUuid;
}
+ public boolean isCacheHit() {
+ return myCacheHit;
+ }
+
+ public void setCacheHit(boolean theCacheHit) {
+ myCacheHit = theCacheHit;
+ }
+
@Override
public Integer preferredPageSize() {
ensureSearchEntityLoaded();
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java
index d3d5618f888..f1b63e8716c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/PersistedJpaSearchFirstPageBundleProvider.java
@@ -67,8 +67,11 @@ public class PersistedJpaSearchFirstPageBundleProvider extends PersistedJpaBundl
@Override
public Integer size() {
- mySearchTask.awaitInitialSync();
+ Integer size = mySearchTask.awaitInitialSync();
SearchCoordinatorSvcImpl.verifySearchHasntFailedOrThrowInternalErrorException(mySearch);
+ if (size != null) {
+ return size;
+ }
return super.size();
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
index e2e9cb30da6..49950d34dd3 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImpl.java
@@ -17,13 +17,15 @@ package ca.uhn.fhir.jpa.search;
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * #L%
+ * #L%family
*/
import java.util.*;
import java.util.concurrent.*;
import javax.persistence.EntityManager;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
+import ca.uhn.fhir.rest.api.Constants;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -55,7 +57,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
public static final int DEFAULT_SYNC_SIZE = 250;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SearchCoordinatorSvcImpl.class);
-
+ private final ConcurrentHashMap myIdToSearchTask = new ConcurrentHashMap();
@Autowired
private FhirContext myContext;
@Autowired
@@ -63,7 +65,6 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
@Autowired
private EntityManager myEntityManager;
private ExecutorService myExecutor;
- private final ConcurrentHashMap myIdToSearchTask = new ConcurrentHashMap();
private Integer myLoadingThrottleForUnitTests = null;
private long myMaxMillisToWaitForRemoteResults = DateUtils.MILLIS_PER_MINUTE;
private boolean myNeverUseLocalSearchForUnitTests;
@@ -78,13 +79,6 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
private int mySyncSize = DEFAULT_SYNC_SIZE;
- // @Autowired
- // private DataSource myDataSource;
- // @PostConstruct
- // public void start() {
- // JpaTransactionManager txManager = (JpaTransactionManager) myManagedTxManager;
- // }
-
/**
* Constructor
*/
@@ -186,15 +180,33 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
}
@Override
- public IBundleProvider registerSearch(final IDao theCallingDao, final SearchParameterMap theParams, String theResourceType) {
+ public IBundleProvider registerSearch(final IDao theCallingDao, final SearchParameterMap theParams, String theResourceType, CacheControlDirective theCacheControlDirective) {
StopWatch w = new StopWatch();
final String searchUuid = UUID.randomUUID().toString();
+ ourLog.debug("Registering new search {}", searchUuid);
+
Class extends IBaseResource> resourceTypeClass = myContext.getResourceDefinition(theResourceType).getImplementingClass();
final ISearchBuilder sb = theCallingDao.newSearchBuilder();
sb.setType(resourceTypeClass, theResourceType);
- if (theParams.isLoadSynchronous()) {
+ final Integer loadSynchronousUpTo;
+ if (theCacheControlDirective != null && theCacheControlDirective.isNoStore()) {
+ if (theCacheControlDirective.getMaxResults() != null) {
+ loadSynchronousUpTo = theCacheControlDirective.getMaxResults();
+ if (loadSynchronousUpTo > myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit()) {
+ throw new InvalidRequestException(Constants.HEADER_CACHE_CONTROL + " header " + Constants.CACHE_CONTROL_MAX_RESULTS + " value must not exceed " + myDaoConfig.getCacheControlNoStoreMaxResultsUpperLimit());
+ }
+ } else {
+ loadSynchronousUpTo = 100;
+ }
+ } else {
+ loadSynchronousUpTo = null;
+ }
+
+ if (theParams.isLoadSynchronous() || loadSynchronousUpTo != null) {
+
+ ourLog.debug("Search {} is loading in synchronous mode", searchUuid);
// Execute the query and make sure we return distinct results
TransactionTemplate txTemplate = new TransactionTemplate(myManagedTxManager);
@@ -209,6 +221,9 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
Iterator resultIter = sb.createQuery(theParams, searchUuid);
while (resultIter.hasNext()) {
pids.add(resultIter.next());
+ if (loadSynchronousUpTo != null && pids.size() >= loadSynchronousUpTo) {
+ break;
+ }
if (theParams.getLoadSynchronousUpTo() != null && pids.size() >= theParams.getLoadSynchronousUpTo()) {
break;
}
@@ -238,9 +253,13 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
* See if there are any cached searches whose results we can return
* instead
*/
+ boolean useCache = true;
+ if (theCacheControlDirective != null && theCacheControlDirective.isNoCache() == true) {
+ useCache = false;
+ }
final String queryString = theParams.toNormalizedQueryString(myContext);
if (theParams.getEverythingMode() == null) {
- if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) {
+ if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null && useCache) {
final Date createdCutoff = new Date(System.currentTimeMillis() - myDaoConfig.getReuseCachedSearchResultsForMillis());
final String resourceType = theResourceType;
@@ -266,6 +285,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
mySearchDao.updateSearchLastReturned(searchToUse.getId(), new Date());
retVal = new PersistedJpaBundleProvider(searchToUse.getUuid(), theCallingDao);
+ retVal.setCacheHit(true);
+
populateBundleProvider(retVal);
}
@@ -401,16 +422,16 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
public class SearchTask implements Callable {
- private boolean myAbortRequested;
private final IDao myCallingDao;
private final CountDownLatch myCompletionLatch;
- private int myCountSaved = 0;
private final CountDownLatch myInitialCollectionLatch = new CountDownLatch(1);
private final SearchParameterMap myParams;
private final String myResourceType;
private final Search mySearch;
private final ArrayList mySyncedPids = new ArrayList();
private final ArrayList myUnsyncedPids = new ArrayList();
+ private boolean myAbortRequested;
+ private int myCountSaved = 0;
private String mySearchUuid;
public SearchTask(Search theSearch, IDao theCallingDao, SearchParameterMap theParams, String theResourceType, String theSearchUuid) {
@@ -422,7 +443,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
mySearchUuid = theSearchUuid;
}
- public void awaitInitialSync() {
+ public Integer awaitInitialSync() {
ourLog.trace("Awaiting initial sync");
do {
try {
@@ -434,6 +455,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
}
} while (mySearch.getStatus() == SearchStatusEnum.LOADING);
ourLog.trace("Initial sync completed");
+
+ return mySearch.getTotalCount();
}
@Override
@@ -492,6 +515,7 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
}
myIdToSearchTask.remove(mySearch.getUuid());
+ myInitialCollectionLatch.countDown();
myCompletionLatch.countDown();
return null;
}
@@ -537,27 +561,27 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
public List getResourcePids(int theFromIndex, int theToIndex) {
ourLog.info("Requesting search PIDs from {}-{}", theFromIndex, theToIndex);
- CountDownLatch latch = null;
- synchronized (mySyncedPids) {
- if (mySyncedPids.size() < theToIndex && mySearch.getStatus() == SearchStatusEnum.LOADING) {
- int latchSize = theToIndex - mySyncedPids.size();
- ourLog.trace("Registering latch to await {} results (want {} total)", latchSize, theToIndex);
- latch = new CountDownLatch(latchSize);
- }
- }
-
- if (latch != null) {
- while (latch.getCount() > 0 && mySearch.getStatus() == SearchStatusEnum.LOADING) {
- try {
- ourLog.trace("Awaiting latch with {}", latch.getCount());
- latch.await(500, TimeUnit.MILLISECONDS);
- } catch (InterruptedException e) {
- // ok
+ boolean keepWaiting;
+ do {
+ synchronized (mySyncedPids) {
+ keepWaiting = false;
+ if (mySyncedPids.size() < theToIndex && mySearch.getStatus() == SearchStatusEnum.LOADING) {
+ keepWaiting = true;
}
}
- }
+ if (keepWaiting) {
+ ourLog.info("Waiting, as we only have {} results", mySyncedPids.size());
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException theE) {
+ // ignore
+ }
+ }
+ } while (keepWaiting);
- ArrayList retVal = new ArrayList();
+ ourLog.info("Proceeding, as we have {} results", mySyncedPids.size());
+
+ ArrayList retVal = new ArrayList<>();
synchronized (mySyncedPids) {
verifySearchHasntFailedOrThrowInternalErrorException(mySearch);
@@ -570,6 +594,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
}
}
+ ourLog.info("Done syncing results", mySyncedPids.size());
+
return retVal;
}
@@ -618,8 +644,8 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
myUnsyncedPids.clear();
if (theResultIter.hasNext() == false) {
- mySearch.setStatus(SearchStatusEnum.FINISHED);
mySearch.setTotalCount(myCountSaved);
+ mySearch.setStatus(SearchStatusEnum.FINISHED);
}
}
mySearch.setNumFound(myCountSaved);
@@ -628,7 +654,16 @@ public class SearchCoordinatorSvcImpl implements ISearchCoordinatorSvc {
}
});
- myInitialCollectionLatch.countDown();
+ int numSynced;
+ synchronized (mySyncedPids) {
+ numSynced = mySyncedPids.size();
+ }
+
+ if (myDaoConfig.getCountSearchResultsUpTo() == null ||
+ myDaoConfig.getCountSearchResultsUpTo() <= 0 ||
+ myDaoConfig.getCountSearchResultsUpTo() <= numSynced) {
+ myInitialCollectionLatch.countDown();
+ }
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java
index 9c5a2c56be7..29d12b36916 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/StaleSearchDeletingSvcImpl.java
@@ -20,8 +20,12 @@ package ca.uhn.fhir.jpa.search;
* #L%
*/
-import java.util.Date;
-
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.dao.data.ISearchDao;
+import ca.uhn.fhir.jpa.dao.data.ISearchIncludeDao;
+import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
+import ca.uhn.fhir.jpa.entity.Search;
+import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
@@ -34,11 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionCallback;
import org.springframework.transaction.support.TransactionTemplate;
-import com.google.common.annotations.VisibleForTesting;
-
-import ca.uhn.fhir.jpa.dao.DaoConfig;
-import ca.uhn.fhir.jpa.dao.data.*;
-import ca.uhn.fhir.jpa.entity.Search;
+import java.util.Date;
/**
* Deletes old searches
@@ -46,35 +46,32 @@ import ca.uhn.fhir.jpa.entity.Search;
public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc {
public static final long DEFAULT_CUTOFF_SLACK = 10 * DateUtils.MILLIS_PER_SECOND;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StaleSearchDeletingSvcImpl.class);
-
+ private static Long ourNowForUnitTests;
/*
* We give a bit of extra leeway just to avoid race conditions where a query result
* is being reused (because a new client request came in with the same params) right before
* the result is to be deleted
*/
private long myCutoffSlack = DEFAULT_CUTOFF_SLACK;
-
@Autowired
private DaoConfig myDaoConfig;
-
@Autowired
private ISearchDao mySearchDao;
-
@Autowired
private ISearchIncludeDao mySearchIncludeDao;
-
@Autowired
private ISearchResultDao mySearchResultDao;
-
@Autowired
private PlatformTransactionManager myTransactionManager;
private void deleteSearch(final Long theSearchPid) {
Search searchToDelete = mySearchDao.findOne(theSearchPid);
- ourLog.info("Deleting search {}/{} - Created[{}] -- Last returned[{}]", searchToDelete.getId(), searchToDelete.getUuid(), searchToDelete.getCreated(), searchToDelete.getSearchLastReturned());
- mySearchIncludeDao.deleteForSearch(searchToDelete.getId());
- mySearchResultDao.deleteForSearch(searchToDelete.getId());
- mySearchDao.delete(searchToDelete);
+ if (searchToDelete != null) {
+ ourLog.info("Deleting search {}/{} - Created[{}] -- Last returned[{}]", searchToDelete.getId(), searchToDelete.getUuid(), searchToDelete.getCreated(), searchToDelete.getSearchLastReturned());
+ mySearchIncludeDao.deleteForSearch(searchToDelete.getId());
+ mySearchResultDao.deleteForSearch(searchToDelete.getId());
+ mySearchDao.delete(searchToDelete);
+ }
}
@Override
@@ -85,7 +82,7 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc {
if (myDaoConfig.getReuseCachedSearchResultsForMillis() != null) {
cutoffMillis = Math.max(cutoffMillis, myDaoConfig.getReuseCachedSearchResultsForMillis());
}
- final Date cutoff = new Date((System.currentTimeMillis() - cutoffMillis) - myCutoffSlack);
+ final Date cutoff = new Date((now() - cutoffMillis) - myCutoffSlack);
ourLog.debug("Searching for searches which are before {}", cutoff);
@@ -129,4 +126,19 @@ public class StaleSearchDeletingSvcImpl implements IStaleSearchDeletingSvc {
myCutoffSlack = theCutoffSlack;
}
+ private static long now() {
+ if (ourNowForUnitTests != null) {
+ return ourNowForUnitTests;
+ }
+ return System.currentTimeMillis();
+ }
+
+ /**
+ * This is for unit tests only, do not call otherwise
+ */
+ @VisibleForTesting
+ public static void setNowForUnitTests(Long theNowForUnitTests) {
+ ourNowForUnitTests = theNowForUnitTests;
+ }
+
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java
index 41b9df3e3ab..667bf38d859 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/sp/SearchParamPresenceSvcImpl.java
@@ -89,7 +89,7 @@ public class SearchParamPresenceSvcImpl implements ISearchParamPresenceSvc {
searchParam = new SearchParam();
searchParam.setResourceName(resourceType);
searchParam.setParamName(paramName);
- searchParam = mySearchParamDao.saveAndFlush(searchParam);
+ searchParam = mySearchParamDao.save(searchParam);
ourLog.info("Added search param {} with pid {}", paramName, searchParam.getId());
// Don't add the newly saved entity to the map in case the save fails
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java
index 3f259e6cf77..5eb63a96072 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/BaseSubscriptionInterceptor.java
@@ -36,6 +36,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
import ca.uhn.fhir.rest.server.interceptor.ServerOperationInterceptorAdapter;
+import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.hl7.fhir.exceptions.FHIRException;
@@ -51,8 +52,12 @@ import org.springframework.messaging.MessageHandler;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.messaging.support.ExecutorSubscribableChannel;
import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionSynchronizationAdapter;
import org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
@@ -87,6 +92,9 @@ public abstract class BaseSubscriptionInterceptor exten
@Autowired(required = false)
@Qualifier("myEventDefinitionDaoR4")
private IFhirResourceDao myEventDefinitionDaoR4;
+ @Autowired
+ private PlatformTransactionManager myTxManager;
+
/**
* Constructor
*/
@@ -148,13 +156,11 @@ public abstract class BaseSubscriptionInterceptor exten
try {
from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM);
subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);
- bodyTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_BODY_TEMPLATE);
} catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
}
retVal.getEmailDetails().setFrom(from);
retVal.getEmailDetails().setSubjectTemplate(subjectTemplate);
- retVal.getEmailDetails().setBodyTemplate(bodyTemplate);
}
} catch (FHIRException theE) {
@@ -183,13 +189,11 @@ public abstract class BaseSubscriptionInterceptor exten
try {
from = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM);
subjectTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE);
- bodyTemplate = subscription.getChannel().getExtensionString(JpaConstants.EXT_SUBSCRIPTION_BODY_TEMPLATE);
} catch (FHIRException theE) {
throw new ConfigurationException("Failed to extract subscription extension(s): " + theE.getMessage(), theE);
}
retVal.getEmailDetails().setFrom(from);
retVal.getEmailDetails().setSubjectTemplate(subjectTemplate);
- retVal.getEmailDetails().setBodyTemplate(bodyTemplate);
}
List topicExts = subscription.getExtensionsByUrl("http://hl7.org/fhir/subscription/topics");
@@ -368,6 +372,11 @@ public abstract class BaseSubscriptionInterceptor exten
myResourceDaos = theResourceDaos;
}
+ @VisibleForTesting
+ public void setTxManager(PlatformTransactionManager theTxManager) {
+ myTxManager = theTxManager;
+ }
+
@PostConstruct
public void start() {
for (IFhirResourceDao> next : myResourceDaos) {
@@ -446,13 +455,19 @@ public abstract class BaseSubscriptionInterceptor exten
}
if (mySubscriptionActivatingSubscriber == null) {
- mySubscriptionActivatingSubscriber = new SubscriptionActivatingSubscriber(getSubscriptionDao(), getChannelType(), this);
+ mySubscriptionActivatingSubscriber = new SubscriptionActivatingSubscriber(getSubscriptionDao(), getChannelType(), this, myTxManager);
}
registerSubscriptionCheckingSubscriber();
registerDeliverySubscriber();
- initSubscriptions();
+ TransactionTemplate transactionTemplate = new TransactionTemplate(myTxManager);
+ transactionTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus status) {
+ initSubscriptions();
+ }
+ });
}
protected void submitResourceModified(final ResourceModifiedMessage theMsg) {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java
index e04bae5f58c..28ce7c5f797 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/CanonicalSubscription.java
@@ -131,10 +131,12 @@ public class CanonicalSubscription implements Serializable {
return myHeaders;
}
- public void setHeaders(String theHeaders) {
+ public void setHeaders(List extends IPrimitiveType> theHeader) {
myHeaders = new ArrayList<>();
- if (isNotBlank(theHeaders)) {
- myHeaders.add(theHeaders);
+ for (IPrimitiveType next : theHeader) {
+ if (isNotBlank(next.getValueAsString())) {
+ myHeaders.add(next.getValueAsString());
+ }
}
}
@@ -189,12 +191,10 @@ public class CanonicalSubscription implements Serializable {
}
}
- public void setHeaders(List extends IPrimitiveType> theHeader) {
+ public void setHeaders(String theHeaders) {
myHeaders = new ArrayList<>();
- for (IPrimitiveType next : theHeader) {
- if (isNotBlank(next.getValueAsString())) {
- myHeaders.add(next.getValueAsString());
- }
+ if (isNotBlank(theHeaders)) {
+ myHeaders.add(theHeaders);
}
}
@@ -212,16 +212,6 @@ public class CanonicalSubscription implements Serializable {
private String myFrom;
@JsonProperty("subjectTemplate")
private String mySubjectTemplate;
- @JsonProperty("bodyTemplate")
- private String myBodyTemplate;
-
- public String getBodyTemplate() {
- return myBodyTemplate;
- }
-
- public void setBodyTemplate(String theBodyTemplate) {
- myBodyTemplate = theBodyTemplate;
- }
public String getFrom() {
return myFrom;
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java
index 8a37edbb3f7..3d8d3f05bd5 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/SubscriptionActivatingSubscriber.java
@@ -27,18 +27,21 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.instance.model.api.IPrimitiveType;
import org.hl7.fhir.r4.model.Subscription;
-import org.hl7.fhir.utilities.ucum.Canonical;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.messaging.Message;
import org.springframework.messaging.MessagingException;
-
-import java.util.concurrent.ConcurrentHashMap;
+import org.springframework.transaction.PlatformTransactionManager;
+import org.springframework.transaction.TransactionStatus;
+import org.springframework.transaction.support.TransactionCallbackWithoutResult;
+import org.springframework.transaction.support.TransactionSynchronizationAdapter;
+import org.springframework.transaction.support.TransactionSynchronizationManager;
+import org.springframework.transaction.support.TransactionTemplate;
@SuppressWarnings("unchecked")
public class SubscriptionActivatingSubscriber {
private final IFhirResourceDao mySubscriptionDao;
private final BaseSubscriptionInterceptor mySubscriptionInterceptor;
+ private final PlatformTransactionManager myTransactionManager;
private Logger ourLog = LoggerFactory.getLogger(SubscriptionActivatingSubscriber.class);
private FhirContext myCtx;
private Subscription.SubscriptionChannelType myChannelType;
@@ -46,29 +49,36 @@ public class SubscriptionActivatingSubscriber {
/**
* Constructor
*/
- public SubscriptionActivatingSubscriber(IFhirResourceDao extends IBaseResource> theSubscriptionDao, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor) {
+ public SubscriptionActivatingSubscriber(IFhirResourceDao extends IBaseResource> theSubscriptionDao, Subscription.SubscriptionChannelType theChannelType, BaseSubscriptionInterceptor theSubscriptionInterceptor, PlatformTransactionManager theTransactionManager) {
mySubscriptionDao = theSubscriptionDao;
mySubscriptionInterceptor = theSubscriptionInterceptor;
myChannelType = theChannelType;
myCtx = theSubscriptionDao.getContext();
+ myTransactionManager = theTransactionManager;
}
- public void activateAndRegisterSubscriptionIfRequired(IBaseResource theSubscription) {
+ public void activateAndRegisterSubscriptionIfRequired(final IBaseResource theSubscription) {
boolean subscriptionTypeApplies = BaseSubscriptionSubscriber.subscriptionTypeApplies(myCtx, theSubscription, myChannelType);
if (subscriptionTypeApplies == false) {
return;
}
- IPrimitiveType> status = myCtx.newTerser().getSingleValueOrNull(theSubscription, BaseSubscriptionInterceptor.SUBSCRIPTION_STATUS, IPrimitiveType.class);
+ final IPrimitiveType> status = myCtx.newTerser().getSingleValueOrNull(theSubscription, BaseSubscriptionInterceptor.SUBSCRIPTION_STATUS, IPrimitiveType.class);
String statusString = status.getValueAsString();
- String requestedStatus = Subscription.SubscriptionStatus.REQUESTED.toCode();
- String activeStatus = Subscription.SubscriptionStatus.ACTIVE.toCode();
+ final String requestedStatus = Subscription.SubscriptionStatus.REQUESTED.toCode();
+ final String activeStatus = Subscription.SubscriptionStatus.ACTIVE.toCode();
if (requestedStatus.equals(statusString)) {
- status.setValueAsString(activeStatus);
- ourLog.info("Activating and registering subscription {} from status {} to {}", theSubscription.getIdElement().toUnqualified().getValue(), requestedStatus, activeStatus);
- mySubscriptionDao.update(theSubscription);
- mySubscriptionInterceptor.registerSubscription(theSubscription.getIdElement(), theSubscription);
+ if (TransactionSynchronizationManager.isSynchronizationActive()) {
+ TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
+ @Override
+ public void afterCommit() {
+ activateSubscription(status, activeStatus, theSubscription, requestedStatus);
+ }
+ });
+ } else {
+ activateSubscription(status, activeStatus, theSubscription, requestedStatus);
+ }
} else if (activeStatus.equals(statusString)) {
if (!mySubscriptionInterceptor.hasSubscription(theSubscription.getIdElement())) {
ourLog.info("Registering active subscription {}", theSubscription.getIdElement().toUnqualified().getValue());
@@ -82,8 +92,15 @@ public class SubscriptionActivatingSubscriber {
}
}
+ private void activateSubscription(IPrimitiveType> theStatus, String theActiveStatus, IBaseResource theSubscription, String theRequestedStatus) {
+ theStatus.setValueAsString(theActiveStatus);
+ ourLog.info("Activating and registering subscription {} from status {} to {}", theSubscription.getIdElement().toUnqualified().getValue(), theRequestedStatus, theActiveStatus);
+ mySubscriptionDao.update(theSubscription);
+ mySubscriptionInterceptor.registerSubscription(theSubscription.getIdElement(), theSubscription);
+ }
- public void handleMessage(RestOperationTypeEnum theOperationType, IIdType theId, IBaseResource theSubscription) throws MessagingException {
+
+ public void handleMessage(RestOperationTypeEnum theOperationType, IIdType theId, final IBaseResource theSubscription) throws MessagingException {
switch (theOperationType) {
case DELETE:
@@ -94,7 +111,15 @@ public class SubscriptionActivatingSubscriber {
if (!theId.getResourceType().equals("Subscription")) {
return;
}
- activateAndRegisterSubscriptionIfRequired(theSubscription);
+ TransactionTemplate txTemplate = new TransactionTemplate(myTransactionManager);
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus status) {
+ activateAndRegisterSubscriptionIfRequired(theSubscription);
+ }
+ });
+ break;
+ default:
break;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java
index 38838cb0888..96fdeac09be 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailDetails.java
@@ -20,6 +20,8 @@ package ca.uhn.fhir.jpa.subscription.email;
* #L%
*/
+import org.hl7.fhir.instance.model.api.IIdType;
+
import java.util.List;
public class EmailDetails {
@@ -27,6 +29,7 @@ public class EmailDetails {
private String myBodyTemplate;
private List myTo;
private String myFrom;
+ private IIdType mySubscription;
public String getBodyTemplate() {
return myBodyTemplate;
@@ -52,6 +55,14 @@ public class EmailDetails {
mySubjectTemplate = theSubjectTemplate;
}
+ public IIdType getSubscription() {
+ return mySubscription;
+ }
+
+ public void setSubscription(IIdType theSubscription) {
+ mySubscription = theSubscription;
+ }
+
public List getTo() {
return myTo;
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailSender.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSender.java
similarity index 56%
rename from hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailSender.java
rename to hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSender.java
index c0f8938ef18..503109ca1ff 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/EmailSender.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSender.java
@@ -22,11 +22,11 @@ package ca.uhn.fhir.jpa.subscription.email;
import ca.uhn.fhir.jpa.util.StopWatch;
import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.mail.SimpleMailMessage;
-import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.thymeleaf.context.Context;
import org.thymeleaf.spring4.SpringTemplateEngine;
@@ -35,6 +35,9 @@ import org.thymeleaf.templatemode.TemplateMode;
import org.thymeleaf.templateresolver.StringTemplateResolver;
import javax.annotation.PostConstruct;
+import javax.mail.Message;
+import javax.mail.MessagingException;
+import javax.mail.internet.MimeMessage;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -42,26 +45,57 @@ import java.util.List;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import static org.apache.commons.lang3.StringUtils.trim;
-public class EmailSender implements IEmailSender {
+public class JavaMailEmailSender implements IEmailSender {
- private static final Logger ourLog = LoggerFactory.getLogger(EmailSender.class);
- private String mySmtpServerHost;
+ private static final Logger ourLog = LoggerFactory.getLogger(JavaMailEmailSender.class);
+ private String mySmtpServerHostname;
private int mySmtpServerPort = 25;
private JavaMailSenderImpl mySender;
+ private String mySmtpServerUsername;
+ private String mySmtpServerPassword;
- @PostConstruct
- public void start() {
- Validate.notBlank(mySmtpServerHost, "No SMTP host defined");
+ public String getSmtpServerHostname() {
+ return mySmtpServerHostname;
+ }
- mySender = new JavaMailSenderImpl();
- mySender.setHost(mySmtpServerHost);
- mySender.setPort(mySmtpServerPort);
- mySender.setDefaultEncoding(Constants.CHARSET_UTF8.name());
+ /**
+ * Set the SMTP server host to use for outbound mail
+ */
+ public void setSmtpServerHostname(String theSmtpServerHostname) {
+ mySmtpServerHostname = theSmtpServerHostname;
+ }
+
+ public String getSmtpServerPassword() {
+ return mySmtpServerPassword;
+ }
+
+ public void setSmtpServerPassword(String theSmtpServerPassword) {
+ mySmtpServerPassword = theSmtpServerPassword;
+ }
+
+ public int getSmtpServerPort() {
+ return mySmtpServerPort;
+ }
+
+ /**
+ * Set the SMTP server port to use for outbound mail
+ */
+ public void setSmtpServerPort(int theSmtpServerPort) {
+ mySmtpServerPort = theSmtpServerPort;
+ }
+
+ public String getSmtpServerUsername() {
+ return mySmtpServerUsername;
+ }
+
+ public void setSmtpServerUsername(String theSmtpServerUsername) {
+ mySmtpServerUsername = theSmtpServerUsername;
}
@Override
public void send(EmailDetails theDetails) {
- ourLog.info("Sending email to recipients: {}", theDetails.getTo());
+ String subscriptionId = theDetails.getSubscription().toUnqualifiedVersionless().getValue();
+ ourLog.info("Sending email for subscription {} to recipients: {}", subscriptionId, theDetails.getTo());
StopWatch sw = new StopWatch();
StringTemplateResolver templateResolver = new StringTemplateResolver();
@@ -80,39 +114,44 @@ public class EmailSender implements IEmailSender {
String body = engine.process(theDetails.getBodyTemplate(), context);
String subject = engine.process(theDetails.getSubjectTemplate(), context);
- SimpleMailMessage email = new SimpleMailMessage();
- email.setFrom(trim(theDetails.getFrom()));
- email.setTo(toTrimmedStringArray(theDetails.getTo()));
- email.setSubject(subject);
- email.setText(body);
- email.setSentDate(new Date());
+ MimeMessage email = mySender.createMimeMessage();
+
+ try {
+ email.setFrom(trim(theDetails.getFrom()));
+ email.setRecipients(Message.RecipientType.TO, toTrimmedCommaSeparatedString(theDetails.getTo()));
+ email.setSubject(subject);
+ email.setText(body);
+ email.setSentDate(new Date());
+ email.addHeader("X-FHIR-Subscription", subscriptionId);
+ } catch (MessagingException e) {
+ throw new InternalErrorException("Failed to create email messaage", e);
+ }
mySender.send(email);
ourLog.info("Done sending email (took {}ms)", sw.getMillis());
}
- /**
- * Set the SMTP server host to use for outbound mail
- */
- public void setSmtpServerHost(String theSmtpServerHost) {
- mySmtpServerHost = theSmtpServerHost;
+ @PostConstruct
+ public void start() {
+ Validate.notBlank(mySmtpServerHostname, "No SMTP host defined");
+
+ mySender = new JavaMailSenderImpl();
+ mySender.setHost(getSmtpServerHostname());
+ mySender.setPort(getSmtpServerPort());
+ mySender.setUsername(getSmtpServerUsername());
+ mySender.setPassword(getSmtpServerPassword());
+ mySender.setDefaultEncoding(Constants.CHARSET_UTF8.name());
}
- /**
- * Set the SMTP server port to use for outbound mail
- */
- public void setSmtpServerPort(int theSmtpServerPort) {
- mySmtpServerPort = theSmtpServerPort;
- }
-
- private static String[] toTrimmedStringArray(List theTo) {
+ private static String toTrimmedCommaSeparatedString(List theTo) {
List to = new ArrayList<>();
for (String next : theTo) {
if (isNotBlank(next)) {
to.add(next);
}
}
- return to.toArray(new String[to.size()]);
+
+ return StringUtils.join(to, ",");
}
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java
index 851e3e9a541..755561a422c 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionDeliveringEmailSubscriber.java
@@ -54,32 +54,29 @@ public class SubscriptionDeliveringEmailSubscriber extends BaseSubscriptionDeliv
List destinationAddresses = new ArrayList<>();
String[] destinationAddressStrings = StringUtils.split(endpointUrl, ",");
for (String next : destinationAddressStrings) {
+ next = trim(defaultString(next));
+ if (next.startsWith("mailto:")) {
+ next = next.substring("mailto:".length());
+ }
if (isNotBlank(next)) {
- destinationAddresses.add(trim(next));
+ destinationAddresses.add(next);
}
}
- String from = defaultString(subscription.getEmailDetails().getFrom(), provideDefaultFrom());
+ String from = defaultString(subscription.getEmailDetails().getFrom(), mySubscriptionEmailInterceptor.getDefaultFromAddress());
String subjectTemplate = defaultString(subscription.getEmailDetails().getSubjectTemplate(), provideDefaultSubjectTemplate());
- String bodyTemplate = defaultString(subscription.getEmailDetails().getBodyTemplate(), provideDefaultBodyTemplate());
EmailDetails details = new EmailDetails();
details.setTo(destinationAddresses);
details.setFrom(from);
- details.setBodyTemplate(bodyTemplate);
+ details.setBodyTemplate(subscription.getPayloadString());
details.setSubjectTemplate(subjectTemplate);
+ details.setSubscription(subscription.getIdElement(getContext()));
IEmailSender emailSender = mySubscriptionEmailInterceptor.getEmailSender();
emailSender.send(details);
}
- private String provideDefaultBodyTemplate() {
- return "A subscription update has been received";
- }
-
- private String provideDefaultFrom() {
- return "unknown@sender.com";
- }
private String provideDefaultSubjectTemplate() {
return "HAPI FHIR Subscriptions";
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java
index 21fc67a5d1a..862131885e3 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/subscription/email/SubscriptionEmailInterceptor.java
@@ -20,28 +20,51 @@ package ca.uhn.fhir.jpa.subscription.email;
* #L%
*/
-import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.subscription.BaseSubscriptionInterceptor;
import org.apache.commons.lang3.Validate;
-import org.springframework.beans.factory.annotation.Required;
+import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.PostConstruct;
-import java.util.List;
public class SubscriptionEmailInterceptor extends BaseSubscriptionInterceptor {
private SubscriptionDeliveringEmailSubscriber mySubscriptionDeliverySubscriber;
+
+ /**
+ * This is set to autowired=false just so that implementors can supply this
+ * with a mechanism other than autowiring if they want
+ */
+ @Autowired(required = false)
private IEmailSender myEmailSender;
+ private String myDefaultFromAddress = "noreply@unknown.com";
@Override
public org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType getChannelType() {
return org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType.EMAIL;
}
+ /**
+ * The "from" address to use for any sent emails that to not explicitly specity a from address
+ */
+ public String getDefaultFromAddress() {
+ return myDefaultFromAddress;
+ }
+
+ /**
+ * The "from" address to use for any sent emails that to not explicitly specity a from address
+ */
+ public void setDefaultFromAddress(String theDefaultFromAddress) {
+ Validate.notBlank(theDefaultFromAddress, "theDefaultFromAddress must not be null or blank");
+ myDefaultFromAddress = theDefaultFromAddress;
+ }
+
public IEmailSender getEmailSender() {
return myEmailSender;
}
- @Required
+ /**
+ * Set the email sender (this method does not need to be explicitly called if you
+ * are using autowiring to supply the sender)
+ */
public void setEmailSender(IEmailSender theEmailSender) {
myEmailSender = theEmailSender;
}
@@ -54,12 +77,12 @@ public class SubscriptionEmailInterceptor extends BaseSubscriptionInterceptor {
getDeliveryChannel().subscribe(mySubscriptionDeliverySubscriber);
}
- @PostConstruct
- public void start() {
- Validate.notNull(myEmailSender, "emailSender has not been configured");
-
- super.start();
- }
+// @PostConstruct
+// public void start() {
+// Validate.notNull(myEmailSender, "emailSender has not been configured");
+//
+// super.start();
+// }
@Override
protected void unregisterDeliverySubscriber() {
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java
index 92ca5966565..5eb02eae95a 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/JpaConstants.java
@@ -24,8 +24,20 @@ public class JpaConstants {
public static final String EXT_SP_UNIQUE = "http://hapifhir.io/fhir/StructureDefinition/sp-unique";
+ /**
+ *
+ * This extension should be of type string
and should be
+ * placed on the Subscription.channel
element
+ *
+ */
public static final String EXT_SUBSCRIPTION_EMAIL_FROM = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-from";
+
+ /**
+ *
+ * This extension should be of type string
and should be
+ * placed on the Subscription.channel
element
+ *
+ */
public static final String EXT_SUBSCRIPTION_SUBJECT_TEMPLATE = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-subject-template";
- public static final String EXT_SUBSCRIPTION_BODY_TEMPLATE = "http://hapifhir.io/fhir/StructureDefinition/subscription-email-body-template";
}
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java
index 61d128fd36e..f4ebde30368 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/SubscriptionsRequireManualActivationInterceptorDstu2.java
@@ -42,7 +42,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class SubscriptionsRequireManualActivationInterceptorDstu2 extends ServerOperationInterceptorAdapter {
@Autowired
- @Qualifier("mySubscriptionDaoR4")
+ @Qualifier("mySubscriptionDaoDstu2")
private IFhirResourceDao myDao;
@Override
diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java
index feabf163417..b9d35c68020 100644
--- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java
+++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/util/TestUtil.java
@@ -130,4 +130,19 @@ public class TestUtil {
}
}
+ public static void sleepAtLeast(int theMillis) {
+ long start = System.currentTimeMillis();
+ while (System.currentTimeMillis() <= start + theMillis) {
+ try {
+ long timeSinceStarted = System.currentTimeMillis() - start;
+ long timeToSleep = Math.max(0, theMillis - timeSinceStarted);
+ ourLog.info("Sleeping for {}ms", timeToSleep);
+ Thread.sleep(timeToSleep);
+ } catch (InterruptedException theE) {
+ theE.printStackTrace();
+ }
+ }
+ }
+
+
}
diff --git a/hapi-fhir-jpaserver-base/src/main/resources/.keep b/hapi-fhir-jpaserver-base/src/main/resources/.keep
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java
index fe5fc0c9515..cd9fc5b444d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/ConnectionWrapper.java
@@ -97,7 +97,7 @@ public class ConnectionWrapper implements Connection {
@Override
public String getClientInfo(String theName) throws SQLException {
- return getClientInfo(theName);
+ return myWrap.getClientInfo(theName);
}
@Override
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java
index 970cbdc37fd..baa0a217359 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestDstu3Config.java
@@ -1,26 +1,29 @@
package ca.uhn.fhir.jpa.config;
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.subscription.email.IEmailSender;
+import ca.uhn.fhir.jpa.subscription.email.JavaMailEmailSender;
+import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
+import ca.uhn.fhir.validation.ResultSeverityEnum;
+import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.hibernate.jpa.HibernatePersistenceProvider;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Lazy;
+import org.springframework.context.annotation.Primary;
+import org.springframework.orm.jpa.JpaTransactionManager;
+import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+
+import javax.persistence.EntityManagerFactory;
+import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;
import java.util.concurrent.TimeUnit;
-import javax.persistence.EntityManagerFactory;
-import javax.sql.DataSource;
-
-import org.apache.commons.dbcp2.BasicDataSource;
-import org.hibernate.jpa.HibernatePersistenceProvider;
-import org.springframework.context.annotation.*;
-import org.springframework.orm.jpa.JpaTransactionManager;
-import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-
-import ca.uhn.fhir.jpa.dao.DaoConfig;
-import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
-import ca.uhn.fhir.validation.ResultSeverityEnum;
-import net.ttddyy.dsproxy.support.ProxyDataSourceBuilder;
-
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
@Configuration
@EnableTransactionManagement()
@@ -30,12 +33,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
private Exception myLastStackTrace;
@Bean()
- public DaoConfig daoConfig() {
- return new DaoConfig();
- }
-
- @Bean()
- public DataSource dataSource() {
+ public BasicDataSource basicDataSource() {
BasicDataSource retVal = new BasicDataSource() {
@@ -48,36 +46,36 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
ourLog.error("Exceeded maximum wait for connection", e);
logGetConnectionStackTrace();
// if ("true".equals(System.getProperty("ci"))) {
- fail("Exceeded maximum wait for connection: "+ e.toString());
+ fail("Exceeded maximum wait for connection: " + e.toString());
// }
// System.exit(1);
retVal = null;
}
-
+
try {
throw new Exception();
} catch (Exception e) {
myLastStackTrace = e;
}
-
+
return retVal;
}
private void logGetConnectionStackTrace() {
- StringBuilder b = new StringBuilder();
- b.append("Last connection request stack trace:");
- for (StackTraceElement next : myLastStackTrace.getStackTrace()) {
- b.append("\n ");
- b.append(next.getClassName());
- b.append(".");
- b.append(next.getMethodName());
- b.append("(");
- b.append(next.getFileName());
- b.append(":");
- b.append(next.getLineNumber());
- b.append(")");
- }
- ourLog.info(b.toString());
+ StringBuilder b = new StringBuilder();
+ b.append("Last connection request stack trace:");
+ for (StackTraceElement next : myLastStackTrace.getStackTrace()) {
+ b.append("\n ");
+ b.append(next.getClassName());
+ b.append(".");
+ b.append(next.getMethodName());
+ b.append("(");
+ b.append(next.getFileName());
+ b.append(":");
+ b.append(next.getLineNumber());
+ b.append(")");
+ }
+ ourLog.info(b.toString());
}
};
@@ -92,19 +90,39 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
* and catch any potential deadlocks caused by database connection
* starvation
*/
- int maxThreads = (int) (Math.random() * 6) + 1;
+ int maxThreads = (int) (Math.random() * 6.0) + 1;
retVal.setMaxTotal(maxThreads);
+ return retVal;
+ }
+
+ @Bean()
+ public DaoConfig daoConfig() {
+ return new DaoConfig();
+ }
+
+ @Bean()
+ @Primary()
+ public DataSource dataSource() {
+
DataSource dataSource = ProxyDataSourceBuilder
- .create(retVal)
- // .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL")
- .logSlowQueryBySlf4j(100, TimeUnit.MILLISECONDS)
- .countQuery()
- .build();
+ .create(basicDataSource())
+// .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL")
+ .logSlowQueryBySlf4j(1000, TimeUnit.MILLISECONDS)
+ .countQuery()
+ .build();
return dataSource;
}
+ @Bean
+ public IEmailSender emailSender() {
+ JavaMailEmailSender retVal = new JavaMailEmailSender();
+ retVal.setSmtpServerHostname("localhost");
+ retVal.setSmtpServerPort(3025);
+ return retVal;
+ }
+
@Bean()
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean retVal = new LocalContainerEntityManagerFactoryBean();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java
index 8794a67ebd8..82b78e27799 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java
@@ -94,12 +94,12 @@ public class TestR4Config extends BaseJavaConfigR4 {
* and catch any potential deadlocks caused by database connection
* starvation
*/
- int maxThreads = (int) (Math.random() * 6) + 1;
+ int maxThreads = (int) (Math.random() * 6.0) + 1;
retVal.setMaxTotal(maxThreads);
DataSource dataSource = ProxyDataSourceBuilder
.create(retVal)
- .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL")
+// .logQueryBySlf4j(SLF4JLogLevel.INFO, "SQL")
.logSlowQueryBySlf4j(10, TimeUnit.SECONDS)
.countQuery(new ThreadQueryCountHolder())
.build();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
index 2fd5b5fe8b1..468845de9a4 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/BaseJpaTest.java
@@ -118,8 +118,13 @@ public abstract class BaseJpaTest {
protected List toUnqualifiedVersionlessIdValues(IBundleProvider theFound) {
List retVal = new ArrayList();
- int size = theFound.size();
+ Integer size = theFound.size();
ourLog.info("Found {} results", size);
+
+ if (size == null) {
+ size = 99999;
+ }
+
List resources = theFound.getResources(0, size);
for (IBaseResource next : resources) {
retVal.add(next.getIdElement().toUnqualifiedVersionless().getValue());
@@ -298,7 +303,7 @@ public abstract class BaseJpaTest {
public static void waitForSize(int theTarget, List> theList) {
StopWatch sw = new StopWatch();
- while (theList.size() != theTarget && sw.getMillis() < 10000) {
+ while (theList.size() != theTarget && sw.getMillis() <= 15000) {
try {
Thread.sleep(50);
} catch (InterruptedException theE) {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
index a10ddb03513..a1d35f4b229 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/BaseJpaDstu2Test.java
@@ -120,7 +120,7 @@ public abstract class BaseJpaDstu2Test extends BaseJpaTest {
protected Object myResourceProviders;
@Autowired
protected ISearchCoordinatorSvc mySearchCoordinatorSvc;
- @Autowired
+ @Autowired(required = false)
protected IFulltextSearchSvc mySearchDao;
@Autowired
protected ISearchParamPresenceSvc mySearchParamPresenceSvc;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java
index f0cc7d84364..cadec9a7a90 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2SearchNoFtTest.java
@@ -921,7 +921,6 @@ public class FhirResourceDaoDstu2SearchNoFtTest extends BaseJpaDstu2Test {
List patients = toList(myPatientDao.search(params));
assertEquals(1, patients.size());
assertEquals(id1.getIdPart(), patients.get(0).getId().getIdPart());
- assertEquals("P1TITLE", ResourceMetadataKeyEnum.TITLE.get(patients.get(0)));
// Given name shouldn't return for family param
params = new SearchParameterMap();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
index c03923110a2..1c3a5d470fc 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2Test.java
@@ -56,6 +56,30 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical());
}
+ /**
+ * See #773
+ */
+ @Test
+ public void testDeleteResourceWithOutboundDeletedResources() {
+ myDaoConfig.setEnforceReferentialIntegrityOnDelete(false);
+
+ Organization org = new Organization();
+ org.setId("ORG");
+ org.setName("ORG");
+ myOrganizationDao.update(org);
+
+ Patient pat = new Patient();
+ pat.setId("PAT");
+ pat.setActive(true);
+ pat.setManagingOrganization(new ResourceReferenceDt("Organization/ORG"));
+ myPatientDao.update(pat);
+
+ myOrganizationDao.delete(new IdDt("Organization/ORG"));
+
+ myPatientDao.delete(new IdDt("Patient/PAT"));
+ }
+
+
private void assertGone(IIdType theId) {
try {
assertNotGone(theId);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java
index 76ffd1441f2..0c1e762798b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu2/FhirResourceDaoDstu2ValidateTest.java
@@ -102,6 +102,7 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
+ break;
case XML:
encoded = myFhirCtx.newXmlParser().encodeResourceToString(input);
try {
@@ -110,6 +111,7 @@ public class FhirResourceDaoDstu2ValidateTest extends BaseJpaDstu2Test {
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
+ break;
}
throw new IllegalStateException(); // shouldn't get here
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
index 1685a1c1d7f..8589e535e44 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/BaseJpaDstu3Test.java
@@ -172,7 +172,7 @@ public abstract class BaseJpaDstu3Test extends BaseJpaTest {
protected IResourceTagDao myResourceTagDao;
@Autowired
protected ISearchCoordinatorSvc mySearchCoordinatorSvc;
- @Autowired
+ @Autowired(required = false)
protected IFulltextSearchSvc mySearchDao;
@Autowired
protected ISearchDao mySearchEntityDao;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirDaoConcurrencyDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirDaoConcurrencyDstu3Test.java
new file mode 100644
index 00000000000..d6c27cb0334
--- /dev/null
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirDaoConcurrencyDstu3Test.java
@@ -0,0 +1,153 @@
+package ca.uhn.fhir.jpa.dao.dstu3;
+
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.util.StopWatch;
+import ca.uhn.fhir.rest.api.server.IBundleProvider;
+import ca.uhn.fhir.util.TestUtil;
+import com.phloc.commons.compare.ReverseComparator;
+import org.apache.commons.dbcp2.BasicDataSource;
+import org.hl7.fhir.dstu3.model.Bundle;
+import org.hl7.fhir.dstu3.model.Bundle.BundleType;
+import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
+import org.hl7.fhir.dstu3.model.IdType;
+import org.hl7.fhir.dstu3.model.Organization;
+import org.hl7.fhir.dstu3.model.Patient;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.comparator.ComparableComparator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.Future;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import static org.junit.Assert.*;
+
+public class FhirDaoConcurrencyDstu3Test extends BaseJpaDstu3SystemTest {
+
+ private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirDaoConcurrencyDstu3Test.class);
+
+ @Autowired
+ public BasicDataSource myBasicDataSource;
+ private int myMaxTotal;
+
+ @After
+ public void afterResetConnectionPool() {
+ myBasicDataSource.setMaxTotal(myMaxTotal);
+ }
+
+ @Before
+ public void beforeSetUpConnectionPool() {
+ myMaxTotal = myBasicDataSource.getMaxTotal();
+ myBasicDataSource.setMaxTotal(5);
+ }
+
+ @Test
+ public void testMultipleConcurrentWritesToSameResource() throws InterruptedException {
+
+ ThreadPoolExecutor exec = new ThreadPoolExecutor(10, 10,
+ 0L, TimeUnit.MILLISECONDS,
+ new LinkedBlockingQueue());
+
+ final AtomicInteger errors = new AtomicInteger();
+
+ List futures = new ArrayList<>();
+ for (int i = 0; i < 50; i++) {
+ final Patient p = new Patient();
+ p.setId("PID");
+ p.setActive(true);
+ p.setBirthDate(new Date());
+ p.addIdentifier().setSystem("foo1");
+ p.addIdentifier().setSystem("foo2");
+ p.addIdentifier().setSystem("foo3");
+ p.addIdentifier().setSystem("foo4");
+ p.addName().setFamily("FOO" + i);
+ p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB1");
+ p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB2");
+ p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB3");
+ p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB4");
+ p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB5");
+ p.addName().addGiven("AAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB6");
+
+ Organization o = new Organization();
+ o.setName("ORG" + i);
+
+ final Bundle t = new Bundle();
+ t.setType(BundleType.TRANSACTION);
+ t.addEntry()
+ .setResource(p)
+ .getRequest()
+ .setUrl("Patient/PID")
+ .setMethod(HTTPVerb.PUT);
+ t.addEntry()
+ .setResource(o)
+ .getRequest()
+ .setUrl("Organization")
+ .setMethod(HTTPVerb.POST);
+
+ if (i == 0) {
+ mySystemDao.transaction(mySrd, t);
+ }
+ futures.add(exec.submit(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ mySystemDao.transaction(mySrd, t);
+ } catch (Exception e) {
+ ourLog.error("Failed to update", e);
+ errors.incrementAndGet();
+ }
+ }
+ }));
+ }
+
+ ourLog.info("Shutting down excutor");
+ StopWatch sw = new StopWatch();
+ for (Future next : futures) {
+ while (!next.isDone()) {
+ Thread.sleep(20);
+ }
+ }
+ exec.shutdown();
+ ourLog.info("Shut down excutor in {}ms", sw.getMillis());
+ ourLog.info("Had {} errors", errors.get());
+
+ Patient currentPatient = myPatientDao.read(new IdType("Patient/PID"));
+ Long currentVersion = currentPatient.getIdElement().getVersionIdPartAsLong();
+ ourLog.info("Current version: {}", currentVersion);
+
+ IBundleProvider historyBundle = myPatientDao.history(new IdType("Patient/PID"),null,null,mySrd);
+ List resources = historyBundle.getResources(0, 1000);
+ List versions = new ArrayList<>();
+ for (IBaseResource next : resources) {
+ versions.add(next.getIdElement().getVersionIdPartAsLong());
+ }
+
+ String message = "Current version is " + currentVersion + " - History is: " + versions;
+ ourLog.info(message);
+
+ Collections.sort(versions, new ReverseComparator<>(new ComparableComparator()));
+ Long lastVersion = versions.get(0);
+ ourLog.info("Last version: {}", lastVersion);
+
+ //assertEquals(message, currentVersion.intValue(), versions.size());
+ assertEquals(message, currentVersion, lastVersion);
+
+ }
+
+
+ @AfterClass
+ public static void afterClassClearContext() {
+ TestUtil.clearAllStaticFieldsForUnitTest();
+ }
+
+}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java
index c6a6247d36b..ea2fd0c1158 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3SearchPageExpiryTest.java
@@ -1,12 +1,16 @@
package ca.uhn.fhir.jpa.dao.dstu3;
+import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.junit.Assert.*;
+import ca.uhn.fhir.jpa.util.StopWatch;
import org.apache.commons.lang3.Validate;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.test.util.AopTestUtils;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
@@ -18,15 +22,13 @@ import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.StringParam;
public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
- @Before
- public void beforeDisableResultReuse() {
- myDaoConfig.setReuseCachedSearchResultsForMillis(null);
- }
+ private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoDstu3SearchPageExpiryTest.class);
@After()
public void after() {
StaleSearchDeletingSvcImpl staleSearchDeletingSvc = AopTestUtils.getTargetObject(myStaleSearchDeletingSvc);
staleSearchDeletingSvc.setCutoffSlackForUnitTest(StaleSearchDeletingSvcImpl.DEFAULT_CUTOFF_SLACK);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(null);
}
@Before
@@ -35,48 +37,9 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
staleSearchDeletingSvc.setCutoffSlackForUnitTest(0);
}
- @Test
- public void testExpirePagesAfterSingleUse() throws Exception {
- IIdType pid1;
- IIdType pid2;
- {
- Patient patient = new Patient();
- patient.addName().setFamily("EXPIRE");
- pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- Thread.sleep(10);
- {
- Patient patient = new Patient();
- patient.addName().setFamily("EXPIRE");
- pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- Thread.sleep(10);
-
- SearchParameterMap params;
- params = new SearchParameterMap();
- params.add(Patient.SP_FAMILY, new StringParam("EXPIRE"));
- final IBundleProvider bundleProvider = myPatientDao.search(params);
- assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
- assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
-
- myDaoConfig.setExpireSearchResultsAfterMillis(500);
- myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
- TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
- txTemplate.execute(new TransactionCallbackWithoutResult() {
- @Override
- protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
- assertNotNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
- }
- });
-
- Thread.sleep(750);
- myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
- txTemplate.execute(new TransactionCallbackWithoutResult() {
- @Override
- protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
- assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
- }
- });
+ @Before
+ public void beforeDisableResultReuse() {
+ myDaoConfig.setReuseCachedSearchResultsForMillis(null);
}
@Test
@@ -98,6 +61,7 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
myDaoConfig.setExpireSearchResultsAfterMillis(1000L);
myDaoConfig.setReuseCachedSearchResultsForMillis(500L);
+ long start = System.currentTimeMillis();
final String searchUuid1;
{
@@ -109,7 +73,7 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
Validate.notBlank(searchUuid1);
}
- Thread.sleep(250);
+ sleepAtLeast(250);
String searchUuid2;
{
@@ -122,7 +86,7 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
}
assertEquals(searchUuid1, searchUuid2);
- Thread.sleep(500);
+ sleepAtLeast(500);
// We're now past 500ms so we shouldn't reuse the search
@@ -139,18 +103,31 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
// Search just got used so it shouldn't be deleted
- Thread.sleep(750);
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ newTxTemplate().execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNotNull(mySearchEntityDao.findByUuid(searchUuid3));
+ }
+ });
+
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 1400);
myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
newTxTemplate().execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
- assertNull(mySearchEntityDao.findByUuid(searchUuid1));
assertNotNull(mySearchEntityDao.findByUuid(searchUuid3));
}
});
+ newTxTemplate().execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNull(mySearchEntityDao.findByUuid(searchUuid1));
+ }
+ });
- Thread.sleep(300);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 2200);
myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
newTxTemplate().execute(new TransactionCallbackWithoutResult() {
@@ -162,4 +139,63 @@ public class FhirResourceDaoDstu3SearchPageExpiryTest extends BaseJpaDstu3Test {
});
}
+
+ @Test
+ public void testExpirePagesAfterSingleUse() throws Exception {
+ IIdType pid1;
+ IIdType pid2;
+ {
+ Patient patient = new Patient();
+ patient.addName().setFamily("EXPIRE");
+ pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
+ }
+ Thread.sleep(10);
+ {
+ Patient patient = new Patient();
+ patient.addName().setFamily("EXPIRE");
+ pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
+ }
+ Thread.sleep(10);
+
+ final StopWatch sw = new StopWatch();
+
+ long start = System.currentTimeMillis();
+
+ SearchParameterMap params;
+ params = new SearchParameterMap();
+ params.add(Patient.SP_FAMILY, new StringParam("EXPIRE"));
+ final IBundleProvider bundleProvider = myPatientDao.search(params);
+ assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
+ assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
+
+ myDaoConfig.setExpireSearchResultsAfterMillis(500);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start);
+
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNotNull("Failed after " + sw.toString(), mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
+ }
+ });
+
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 499);
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNotNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
+ }
+ });
+
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 600);
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
+ }
+ });
+ }
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java
index b243e95755d..3971b902474 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3UpdateTest.java
@@ -252,6 +252,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
p.setId("Patient/A");
String id = myPatientDao.update(p).getId().getValue();
assertThat(id, endsWith("Patient/A/_history/1"));
+ assertEquals("1", myPatientDao.read(new IdType("Patient/A")).getIdElement().getVersionIdPart());
// Second time should not result in an update
p = new Patient();
@@ -259,6 +260,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
p.setId("Patient/A");
id = myPatientDao.update(p).getId().getValue();
assertThat(id, endsWith("Patient/A/_history/1"));
+ assertEquals("1", myPatientDao.read(new IdType("Patient/A")).getIdElement().getVersionIdPart());
// And third time should not result in an update
p = new Patient();
@@ -266,6 +268,7 @@ public class FhirResourceDaoDstu3UpdateTest extends BaseJpaDstu3Test {
p.setId("Patient/A");
id = myPatientDao.update(p).getId().getValue();
assertThat(id, endsWith("Patient/A/_history/1"));
+ assertEquals("1", myPatientDao.read(new IdType("Patient/A")).getIdElement().getVersionIdPart());
myPatientDao.read(new IdType("Patient/A"));
myPatientDao.read(new IdType("Patient/A/_history/1"));
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java
index 47582dada07..3442f7cc87d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoDstu3ValidateTest.java
@@ -133,6 +133,7 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test {
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
+ break;
case XML:
encoded = myFhirCtx.newXmlParser().encodeResourceToString(input);
try {
@@ -141,6 +142,7 @@ public class FhirResourceDaoDstu3ValidateTest extends BaseJpaDstu3Test {
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
+ break;
}
throw new IllegalStateException(); // shouldn't get here
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java
index 681cbbf9e4c..42cd0ea6625 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/dstu3/FhirSystemDaoDstu3Test.java
@@ -62,43 +62,6 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
}
- @Test
- public void testTransactionWhichFailsPersistsNothing() {
-
- // Run a transaction which points to that practitioner
- // in a field that isn't allowed to refer to a practitioner
- Bundle input = new Bundle();
- input.setType(BundleType.TRANSACTION);
-
- Patient pt = new Patient();
- pt.setId("PT");
- pt.setActive(true);
- pt.addName().setFamily("FAMILY");
- input.addEntry()
- .setResource(pt)
- .getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/PT");
-
- Observation obs = new Observation();
- obs.setId("OBS");
- obs.getCode().addCoding().setSystem("foo").setCode("bar");
- obs.addPerformer().setReference("Practicioner/AAAAA");
- input.addEntry()
- .setResource(obs)
- .getRequest().setMethod(HTTPVerb.PUT).setUrl("Observation/OBS");
-
- try {
- mySystemDao.transaction(mySrd, input);
- fail();
- } catch (UnprocessableEntityException e) {
- assertThat(e.getMessage(), containsString("Resource type 'Practicioner' is not valid for this path"));
- }
-
- assertThat(myResourceTableDao.findAll(), empty());
- assertThat(myResourceIndexedSearchParamStringDao.findAll(), empty());
-
- }
-
-
private Bundle createInputTransactionWithPlaceholderIdInMatchUrl(HTTPVerb theVerb) {
Patient pat = new Patient();
@@ -209,6 +172,11 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
return null;
}
+ private Bundle loadBundle(String theFileName) throws IOException {
+ String req = IOUtils.toString(FhirSystemDaoDstu3Test.class.getResourceAsStream(theFileName), StandardCharsets.UTF_8);
+ return myFhirCtx.newXmlParser().parseResource(Bundle.class, req);
+ }
+
@Test
public void testBatchCreateWithBadRead() {
Bundle request = new Bundle();
@@ -1222,8 +1190,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
@Test
public void testTransactionCreateWithPutUsingUrl2() throws Exception {
- String req = IOUtils.toString(FhirSystemDaoDstu3Test.class.getResourceAsStream("/bundle-dstu3.xml"), StandardCharsets.UTF_8);
- Bundle request = myFhirCtx.newXmlParser().parseResource(Bundle.class, req);
+ Bundle request = loadBundle("/bundle-dstu3.xml");
mySystemDao.transaction(mySrd, request);
}
@@ -1702,13 +1669,13 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
//@formatter:off
/*
* Transaction Order, per the spec:
- *
+ *
* Process any DELETE interactions
* Process any POST interactions
* Process any PUT interactions
* Process any GET interactions
- *
- * This test creates a transaction bundle that includes
+ *
+ * This test creates a transaction bundle that includes
* these four operations in the reverse order and verifies
* that they are invoked correctly.
*/
@@ -1912,6 +1879,91 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
assertNull(nextEntry.getResource());
}
+ @Test
+ public void testTransactionWithIfMatch() {
+ Patient p = new Patient();
+ p.setId("P1");
+ p.setActive(true);
+ myPatientDao.update(p);
+
+ p.setActive(false);
+ Bundle b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient/P1")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.PUT)
+ .setUrl("Patient/P1")
+ .setIfMatch("2");
+
+ try {
+ mySystemDao.transaction(mySrd, b);
+ } catch (ResourceVersionConflictException e) {
+ assertEquals("Trying to update Patient/P1/_history/2 but this is not the current version", e.getMessage());
+ }
+
+ b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient/P1")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.PUT)
+ .setUrl("Patient/P1")
+ .setIfMatch("1");
+
+ Bundle resp = mySystemDao.transaction(mySrd, b);
+ assertEquals("Patient/P1/_history/2", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue());
+
+
+ }
+
+ @Test
+ public void testTransactionWithIfNoneExist() {
+ Patient p = new Patient();
+ p.setId("P1");
+ p.setActive(true);
+ myPatientDao.update(p);
+
+ p = new Patient();
+ p.setActive(true);
+ p.addName().setFamily("AAA");
+
+ Bundle b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.POST)
+ .setUrl("Patient/P1")
+ .setIfNoneExist("Patient?active=true");
+
+ Bundle resp = mySystemDao.transaction(mySrd, b);
+ assertEquals("Patient/P1/_history/1", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue());
+
+ p = new Patient();
+ p.setActive(true);
+ p.addName().setFamily("AAA");
+
+ b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.POST)
+ .setUrl("Patient/P1")
+ .setIfNoneExist("Patient?active=false");
+
+ resp = mySystemDao.transaction(mySrd, b);
+ assertThat( new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue(), matchesPattern("Patient/[0-9]+/_history/1"));
+
+
+ }
+
+
@Test
public void testTransactionSearchWithCount() {
String methodName = "testTransactionSearchWithCount";
@@ -2147,6 +2199,42 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
}
}
+ @Test
+ public void testTransactionWhichFailsPersistsNothing() {
+
+ // Run a transaction which points to that practitioner
+ // in a field that isn't allowed to refer to a practitioner
+ Bundle input = new Bundle();
+ input.setType(BundleType.TRANSACTION);
+
+ Patient pt = new Patient();
+ pt.setId("PT");
+ pt.setActive(true);
+ pt.addName().setFamily("FAMILY");
+ input.addEntry()
+ .setResource(pt)
+ .getRequest().setMethod(HTTPVerb.PUT).setUrl("Patient/PT");
+
+ Observation obs = new Observation();
+ obs.setId("OBS");
+ obs.getCode().addCoding().setSystem("foo").setCode("bar");
+ obs.addPerformer().setReference("Practicioner/AAAAA");
+ input.addEntry()
+ .setResource(obs)
+ .getRequest().setMethod(HTTPVerb.PUT).setUrl("Observation/OBS");
+
+ try {
+ mySystemDao.transaction(mySrd, input);
+ fail();
+ } catch (UnprocessableEntityException e) {
+ assertThat(e.getMessage(), containsString("Resource type 'Practicioner' is not valid for this path"));
+ }
+
+ assertThat(myResourceTableDao.findAll(), empty());
+ assertThat(myResourceIndexedSearchParamStringDao.findAll(), empty());
+
+ }
+
/**
* Format changed, source isn't valid
*/
@@ -2492,7 +2580,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
IdType medOrderId1 = new IdType(outcome.getEntry().get(1).getResponse().getLocation());
/*
- * Again!
+ * Again!
*/
bundle = new Bundle();
@@ -2815,6 +2903,7 @@ public class FhirSystemDaoDstu3Test extends BaseJpaDstu3SystemTest {
}
+
@AfterClass
public static void afterClassClearContext() {
TestUtil.clearAllStaticFieldsForUnitTest();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
index aa0be15706b..e2bccd223a3 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/BaseJpaR4Test.java
@@ -181,7 +181,7 @@ public abstract class BaseJpaR4Test extends BaseJpaTest {
protected IResourceTagDao myResourceTagDao;
@Autowired
protected ISearchCoordinatorSvc mySearchCoordinatorSvc;
- @Autowired
+ @Autowired(required = false)
protected IFulltextSearchSvc mySearchDao;
@Autowired
protected ISearchDao mySearchEntityDao;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java
index 42819bb0345..24d1ce80b8a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchNoFtTest.java
@@ -44,11 +44,92 @@ public class FhirResourceDaoR4SearchNoFtTest extends BaseJpaR4Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirResourceDaoR4SearchNoFtTest.class);
@Before
- public void beforeDisableResultReuse() {
+ public void beforeDidsableCacheReuse() {
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
+ }
+
+ @After
+ public void afterResetSearchSize() {
+ myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
myDaoConfig.setFetchSizeDefaultMaximum(new DaoConfig().getFetchSizeDefaultMaximum());
}
+ /**
+ * See #744
+ */
+ @Test
+ public void testSearchWithVeryLongUrlShorter() {
+ myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
+
+ Patient p = new Patient();
+ p.addName().setFamily("A1");
+ myPatientDao.create(p);
+
+ assertEquals(0, mySearchEntityDao.count());
+
+ SearchParameterMap map = new SearchParameterMap();
+ StringOrListParam or = new StringOrListParam();
+ or.addOr(new StringParam("A1"));
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, 'A')));
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, 'B')));
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, 'C')));
+ map.add(Patient.SP_NAME, or);
+ IBundleProvider results = myPatientDao.search(map);
+ assertEquals(1, results.getResources(0, 10).size());
+ assertEquals(1, mySearchEntityDao.count());
+
+ map = new SearchParameterMap();
+ or = new StringOrListParam();
+ or.addOr(new StringParam("A1"));
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, 'A')));
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, 'B')));
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, 'C')));
+ map.add(Patient.SP_NAME, or);
+ results = myPatientDao.search(map);
+ assertEquals(1, results.getResources(0, 10).size());
+ assertEquals(1, mySearchEntityDao.count());
+
+ }
+
+ /**
+ * See #744
+ */
+ @Test
+ public void testSearchWithVeryLongUrlLonger() {
+ myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
+
+ Patient p = new Patient();
+ p.addName().setFamily("A1");
+ myPatientDao.create(p);
+
+ assertEquals(0, mySearchEntityDao.count());
+
+ SearchParameterMap map = new SearchParameterMap();
+ StringOrListParam or = new StringOrListParam();
+ or.addOr(new StringParam("A1"));
+ for (int i = 0; i < 50; i++) {
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, (char)('A' + i))));
+ }
+ map.add(Patient.SP_NAME, or);
+ IBundleProvider results = myPatientDao.search(map);
+ assertEquals(1, results.getResources(0, 10).size());
+ assertEquals(1, mySearchEntityDao.count());
+
+ map = new SearchParameterMap();
+ or = new StringOrListParam();
+ or.addOr(new StringParam("A1"));
+ or.addOr(new StringParam("A1"));
+ for (int i = 0; i < 50; i++) {
+ or.addOr(new StringParam(StringUtils.leftPad("", 200, (char)('A' + i))));
+ }
+ map.add(Patient.SP_NAME, or);
+ results = myPatientDao.search(map);
+ assertEquals(1, results.getResources(0, 10).size());
+ // We expect a new one because we don't cache the search URL for very long search URLs
+ assertEquals(2, mySearchEntityDao.count());
+
+ }
+
/**
* See #441
*/
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java
index df856260457..aa39d50803a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4SearchPageExpiryTest.java
@@ -1,33 +1,35 @@
package ca.uhn.fhir.jpa.dao.r4;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.junit.Assert.*;
-
+import ca.uhn.fhir.jpa.dao.SearchParameterMap;
+import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl;
import ca.uhn.fhir.jpa.util.StopWatch;
+import ca.uhn.fhir.rest.api.server.IBundleProvider;
+import ca.uhn.fhir.rest.param.StringParam;
import org.apache.commons.lang3.Validate;
-import org.hl7.fhir.r4.model.Patient;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.junit.*;
+import org.hl7.fhir.r4.model.Patient;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.test.util.AopTestUtils;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
import org.springframework.transaction.support.TransactionTemplate;
-import ca.uhn.fhir.jpa.dao.SearchParameterMap;
-import ca.uhn.fhir.jpa.search.StaleSearchDeletingSvcImpl;
-import ca.uhn.fhir.rest.api.server.IBundleProvider;
-import ca.uhn.fhir.rest.param.StringParam;
+import static ca.uhn.fhir.jpa.util.TestUtil.sleepAtLeast;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.junit.Assert.*;
public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
- @Before
- public void beforeDisableResultReuse() {
- myDaoConfig.setReuseCachedSearchResultsForMillis(null);
- }
+ private static final Logger ourLog = LoggerFactory.getLogger(FhirResourceDaoR4SearchPageExpiryTest.class);
@After()
public void after() {
StaleSearchDeletingSvcImpl staleSearchDeletingSvc = AopTestUtils.getTargetObject(myStaleSearchDeletingSvc);
staleSearchDeletingSvc.setCutoffSlackForUnitTest(StaleSearchDeletingSvcImpl.DEFAULT_CUTOFF_SLACK);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(null);
}
@Before
@@ -36,50 +38,9 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
staleSearchDeletingSvc.setCutoffSlackForUnitTest(0);
}
- @Test
- public void testExpirePagesAfterSingleUse() throws Exception {
- IIdType pid1;
- IIdType pid2;
- {
- Patient patient = new Patient();
- patient.addName().setFamily("EXPIRE");
- pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- Thread.sleep(10);
- {
- Patient patient = new Patient();
- patient.addName().setFamily("EXPIRE");
- pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
- }
- Thread.sleep(10);
-
- final StopWatch sw = new StopWatch();
-
- SearchParameterMap params;
- params = new SearchParameterMap();
- params.add(Patient.SP_FAMILY, new StringParam("EXPIRE"));
- final IBundleProvider bundleProvider = myPatientDao.search(params);
- assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
- assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
-
- myDaoConfig.setExpireSearchResultsAfterMillis(500);
- myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
- TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
- txTemplate.execute(new TransactionCallbackWithoutResult() {
- @Override
- protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
- assertNotNull("Failed after " + sw.toString(), mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
- }
- });
-
- Thread.sleep(750);
- myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
- txTemplate.execute(new TransactionCallbackWithoutResult() {
- @Override
- protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
- assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
- }
- });
+ @Before
+ public void beforeDisableResultReuse() {
+ myDaoConfig.setReuseCachedSearchResultsForMillis(null);
}
@Test
@@ -101,6 +62,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
myDaoConfig.setExpireSearchResultsAfterMillis(1000L);
myDaoConfig.setReuseCachedSearchResultsForMillis(500L);
+ long start = System.currentTimeMillis();
final String searchUuid1;
{
@@ -112,7 +74,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
Validate.notBlank(searchUuid1);
}
- Thread.sleep(250);
+ sleepAtLeast(250);
String searchUuid2;
{
@@ -125,7 +87,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
}
assertEquals(searchUuid1, searchUuid2);
- Thread.sleep(500);
+ sleepAtLeast(500);
// We're now past 500ms so we shouldn't reuse the search
@@ -150,7 +112,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
}
});
- Thread.sleep(750);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 1400);
myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
newTxTemplate().execute(new TransactionCallbackWithoutResult() {
@@ -166,7 +128,7 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
}
});
- Thread.sleep(300);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 2200);
myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
newTxTemplate().execute(new TransactionCallbackWithoutResult() {
@@ -178,4 +140,63 @@ public class FhirResourceDaoR4SearchPageExpiryTest extends BaseJpaR4Test {
});
}
+
+ @Test
+ public void testExpirePagesAfterSingleUse() throws Exception {
+ IIdType pid1;
+ IIdType pid2;
+ {
+ Patient patient = new Patient();
+ patient.addName().setFamily("EXPIRE");
+ pid1 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
+ }
+ Thread.sleep(10);
+ {
+ Patient patient = new Patient();
+ patient.addName().setFamily("EXPIRE");
+ pid2 = myPatientDao.create(patient, mySrd).getId().toUnqualifiedVersionless();
+ }
+ Thread.sleep(10);
+
+ final StopWatch sw = new StopWatch();
+
+ long start = System.currentTimeMillis();
+
+ SearchParameterMap params;
+ params = new SearchParameterMap();
+ params.add(Patient.SP_FAMILY, new StringParam("EXPIRE"));
+ final IBundleProvider bundleProvider = myPatientDao.search(params);
+ assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
+ assertThat(toUnqualifiedVersionlessIds(bundleProvider), containsInAnyOrder(pid1, pid2));
+
+ myDaoConfig.setExpireSearchResultsAfterMillis(500);
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start);
+
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNotNull("Failed after " + sw.toString(), mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
+ }
+ });
+
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 499);
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNotNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
+ }
+ });
+
+ StaleSearchDeletingSvcImpl.setNowForUnitTests(start + 600);
+ myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
+ txTemplate.execute(new TransactionCallbackWithoutResult() {
+ @Override
+ protected void doInTransactionWithoutResult(TransactionStatus theArg0) {
+ assertNull(mySearchEntityDao.findByUuid(bundleProvider.getUuid()));
+ }
+ });
+ }
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
index 567aa1aa49a..04a686da42c 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4Test.java
@@ -55,6 +55,7 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
public final void after() {
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
myDaoConfig.setTreatReferencesAsLogical(new DaoConfig().getTreatReferencesAsLogical());
+ myDaoConfig.setEnforceReferentialIntegrityOnDelete(new DaoConfig().isEnforceReferentialIntegrityOnDelete());
}
private void assertGone(IIdType theId) {
@@ -98,6 +99,29 @@ public class FhirResourceDaoR4Test extends BaseJpaR4Test {
}
+ /**
+ * See #773
+ */
+ @Test
+ public void testDeleteResourceWithOutboundDeletedResources() {
+ myDaoConfig.setEnforceReferentialIntegrityOnDelete(false);
+
+ Organization org = new Organization();
+ org.setId("ORG");
+ org.setName("ORG");
+ myOrganizationDao.update(org);
+
+ Patient pat = new Patient();
+ pat.setId("PAT");
+ pat.setActive(true);
+ pat.setManagingOrganization(new Reference("Organization/ORG"));
+ myPatientDao.update(pat);
+
+ myOrganizationDao.delete(new IdType("Organization/ORG"));
+
+ myPatientDao.delete(new IdType("Patient/PAT"));
+ }
+
@Before
public void beforeDisableResultReuse() {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java
index 8679cd69864..3cf4fcd8aa8 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4UniqueSearchParamTest.java
@@ -303,7 +303,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
Patient pt1 = new Patient();
pt1.setGender(Enumerations.AdministrativeGender.MALE);
pt1.setBirthDateElement(new DateType("2011-01-01"));
- IIdType id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless();
+ String id1 = myPatientDao.create(pt1).getId().toUnqualifiedVersionless().getValue();
Patient pt2 = new Patient();
pt2.setGender(Enumerations.AdministrativeGender.MALE);
@@ -316,7 +316,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
params.add("birthdate", new DateParam("2011-01-01"));
IBundleProvider results = myPatientDao.search(params);
String searchId = results.getUuid();
- assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1.getValue()));
+ assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1));
assertEquals(SearchBuilder.HandlerTypeEnum.UNIQUE_INDEX, SearchBuilder.getLastHandlerMechanismForUnitTest());
// Other order
@@ -326,7 +326,7 @@ public class FhirResourceDaoR4UniqueSearchParamTest extends BaseJpaR4Test {
params.add("gender", new TokenParam("http://hl7.org/fhir/administrative-gender", "male"));
results = myPatientDao.search(params);
assertEquals(searchId, results.getUuid());
- assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1.getValue()));
+ assertThat(toUnqualifiedVersionlessIdValues(results), containsInAnyOrder(id1));
// Null because we just reuse the last search
assertEquals(null, SearchBuilder.getLastHandlerMechanismForUnitTest());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java
index 601d944d3c3..1bb289d2e03 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirResourceDaoR4ValidateTest.java
@@ -133,6 +133,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
+ break;
case XML:
encoded = myFhirCtx.newXmlParser().encodeResourceToString(input);
try {
@@ -141,6 +142,7 @@ public class FhirResourceDaoR4ValidateTest extends BaseJpaR4Test {
} catch (PreconditionFailedException e) {
return (OperationOutcome) e.getOperationOutcome();
}
+ break;
}
throw new IllegalStateException(); // shouldn't get here
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java
index 7d8354f5a08..4997c46e92d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/dao/r4/FhirSystemDaoR4Test.java
@@ -587,6 +587,90 @@ public class FhirSystemDaoR4Test extends BaseJpaR4SystemTest {
}
+ @Test
+ public void testTransactionWithIfMatch() {
+ Patient p = new Patient();
+ p.setId("P1");
+ p.setActive(true);
+ myPatientDao.update(p);
+
+ p.setActive(false);
+ Bundle b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient/P1")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.PUT)
+ .setUrl("Patient/P1")
+ .setIfMatch("2");
+
+ try {
+ mySystemDao.transaction(mySrd, b);
+ } catch (ResourceVersionConflictException e) {
+ assertEquals("Trying to update Patient/P1/_history/2 but this is not the current version", e.getMessage());
+ }
+
+ b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient/P1")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.PUT)
+ .setUrl("Patient/P1")
+ .setIfMatch("1");
+
+ Bundle resp = mySystemDao.transaction(mySrd, b);
+ assertEquals("Patient/P1/_history/2", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue());
+
+
+ }
+
+ @Test
+ public void testTransactionWithIfNoneExist() {
+ Patient p = new Patient();
+ p.setId("P1");
+ p.setActive(true);
+ myPatientDao.update(p);
+
+ p = new Patient();
+ p.setActive(true);
+ p.addName().setFamily("AAA");
+
+ Bundle b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.POST)
+ .setUrl("Patient/P1")
+ .setIfNoneExist("Patient?active=true");
+
+ Bundle resp = mySystemDao.transaction(mySrd, b);
+ assertEquals("Patient/P1/_history/1", new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue());
+
+ p = new Patient();
+ p.setActive(true);
+ p.addName().setFamily("AAA");
+
+ b = new Bundle();
+ b.setType(BundleType.TRANSACTION);
+ b.addEntry()
+ .setFullUrl("Patient")
+ .setResource(p)
+ .getRequest()
+ .setMethod(HTTPVerb.POST)
+ .setUrl("Patient/P1")
+ .setIfNoneExist("Patient?active=false");
+
+ resp = mySystemDao.transaction(mySrd, b);
+ assertThat( new IdType(resp.getEntry().get(0).getResponse().getLocation()).toUnqualified().getValue(), matchesPattern("Patient/[0-9]+/_history/1"));
+
+
+ }
+
@Test
public void testTransaction1() throws IOException {
String inputBundleString = loadClasspath("/david-bundle-error.json");
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java
index b1372bd99e4..b50dd291a99 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/BaseResourceProviderDstu2Test.java
@@ -24,6 +24,7 @@ import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
+import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.web.context.ContextLoader;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
@@ -47,6 +48,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
protected static GenericWebApplicationContext ourWebApplicationContext;
protected static SubscriptionRestHookInterceptor ourRestHookSubscriptionInterceptor;
protected static DatabaseBackedPagingProvider ourPagingProvider;
+ protected static PlatformTransactionManager ourTxManager;
public BaseResourceProviderDstu2Test() {
super();
@@ -98,6 +100,7 @@ public abstract class BaseResourceProviderDstu2Test extends BaseJpaDstu2Test {
ourWebApplicationContext.refresh();
ourRestHookSubscriptionInterceptor = ourWebApplicationContext.getBean(SubscriptionRestHookInterceptor.class);
+ ourTxManager = ourWebApplicationContext.getBean(PlatformTransactionManager.class);
proxyHandler.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ourWebApplicationContext);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java
index 969906c4136..516ea29df48 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/BaseResourceProviderDstu3Test.java
@@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.dao.dstu3.BaseJpaDstu3Test;
import ca.uhn.fhir.jpa.dao.dstu3.SearchParamRegistryDstu3;
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
import ca.uhn.fhir.jpa.search.ISearchCoordinatorSvc;
+import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor;
import ca.uhn.fhir.jpa.subscription.resthook.SubscriptionRestHookInterceptor;
import ca.uhn.fhir.jpa.validation.JpaValidationSupportChainDstu3;
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
@@ -58,6 +59,7 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test {
protected static SearchParamRegistryDstu3 ourSearchParamRegistry;
protected static DatabaseBackedPagingProvider ourPagingProvider;
protected static SubscriptionRestHookInterceptor ourRestHookSubscriptionInterceptor;
+ protected static SubscriptionEmailInterceptor ourEmailSubscriptionInterceptor;
protected static ISearchDao mySearchEntityDao;
protected static ISearchCoordinatorSvc mySearchCoordinatorSvc;
@@ -111,13 +113,9 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test {
ourWebApplicationContext = new GenericWebApplicationContext();
ourWebApplicationContext.setParent(myAppCtx);
ourWebApplicationContext.refresh();
- // ContextLoaderListener loaderListener = new ContextLoaderListener(webApplicationContext);
- // loaderListener.initWebApplicationContext(mock(ServletContext.class));
- //
proxyHandler.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, ourWebApplicationContext);
DispatcherServlet dispatcherServlet = new DispatcherServlet();
- // dispatcherServlet.setApplicationContext(webApplicationContext);
dispatcherServlet.setContextClass(AnnotationConfigWebApplicationContext.class);
ServletHolder subsServletHolder = new ServletHolder();
subsServletHolder.setServlet(dispatcherServlet);
@@ -150,6 +148,7 @@ public abstract class BaseResourceProviderDstu3Test extends BaseJpaDstu3Test {
mySearchCoordinatorSvc = wac.getBean(ISearchCoordinatorSvc.class);
mySearchEntityDao = wac.getBean(ISearchDao.class);
ourRestHookSubscriptionInterceptor = wac.getBean(SubscriptionRestHookInterceptor.class);
+ ourEmailSubscriptionInterceptor = wac.getBean(SubscriptionEmailInterceptor.class);
ourSearchParamRegistry = wac.getBean(SearchParamRegistryDstu3.class);
myFhirCtx.getRestfulClientFactory().setSocketTimeout(5000000);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java
index beec2e3ffe3..57993ba7915 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderDstu3ValueSetTest.java
@@ -1,13 +1,15 @@
package ca.uhn.fhir.jpa.provider.dstu3;
-import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_CODE_SYSTEM;
-import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_VALUE_SET;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-
+import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
+import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
+import ca.uhn.fhir.jpa.entity.ResourceTable;
+import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
+import ca.uhn.fhir.jpa.entity.TermConcept;
+import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
+import ca.uhn.fhir.jpa.term.IHapiTerminologySvc;
+import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
+import ca.uhn.fhir.util.TestUtil;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
@@ -19,17 +21,18 @@ import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.ValueSet.ConceptSetComponent;
import org.hl7.fhir.dstu3.model.ValueSet.FilterOperator;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.junit.*;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
import org.springframework.transaction.annotation.Transactional;
-import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
-import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
-import ca.uhn.fhir.jpa.entity.*;
-import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
-import ca.uhn.fhir.jpa.term.IHapiTerminologySvc;
-import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
-import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
-import ca.uhn.fhir.util.TestUtil;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_CODE_SYSTEM;
+import static ca.uhn.fhir.jpa.dao.dstu3.FhirResourceDaoDstu3TerminologyTest.URL_MY_VALUE_SET;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3Test {
@@ -48,73 +51,14 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
myExtensionalVsId = myValueSetDao.create(upload, mySrd).getId().toUnqualifiedVersionless();
}
- /**
- * #516
- */
- @Test
- public void testInvalidFilter() throws Exception {
- String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8);
- HttpPost post = new HttpPost(ourServerBase+"/ValueSet/%24expand");
- post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
-
- CloseableHttpResponse resp = ourHttpClient.execute(post);
- try {
-
- String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8);
- ourLog.info(respString);
-
- ourLog.info(resp.toString());
-
- assertEquals(400, resp.getStatusLine().getStatusCode());
- assertThat(respString, containsString("Unknown FilterOperator code 'n'"));
-
- }finally {
- IOUtils.closeQuietly(resp);
- }
- }
-
private CodeSystem createExternalCs() {
IFhirResourceDao codeSystemDao = myCodeSystemDao;
IResourceTableDao resourceTableDao = myResourceTableDao;
IHapiTerminologySvc termSvc = myTermSvc;
-
+
return createExternalCs(codeSystemDao, resourceTableDao, termSvc, mySrd);
}
- public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) {
- CodeSystem codeSystem = new CodeSystem();
- codeSystem.setUrl(URL_MY_CODE_SYSTEM);
- codeSystem.setContent(CodeSystemContentMode.NOTPRESENT);
- IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified();
-
- ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong());
-
- TermCodeSystemVersion cs = new TermCodeSystemVersion();
- cs.setResource(table);
- cs.setResourceVersionId(table.getVersion());
-
- TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A");
- cs.getConcepts().add(parentA);
-
- TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA");
- parentA.addChild(childAA, RelationshipTypeEnum.ISA);
-
- TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA");
- childAA.addChild(childAAA, RelationshipTypeEnum.ISA);
-
- TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB");
- childAA.addChild(childAAB, RelationshipTypeEnum.ISA);
-
- TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB");
- parentA.addChild(childAB, RelationshipTypeEnum.ISA);
-
- TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B");
- cs.getConcepts().add(parentB);
-
- theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs);
- return codeSystem;
- }
-
private void createExternalCsAndLocalVs() {
CodeSystem codeSystem = createExternalCs();
@@ -131,17 +75,17 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
//@formatter:off
CodeSystem codeSystem = new CodeSystem();
codeSystem.setUrl(URL_MY_CODE_SYSTEM);
- codeSystem.setContent(CodeSystemContentMode.COMPLETE);
+ codeSystem.setContent(CodeSystemContentMode.COMPLETE);
codeSystem
.addConcept().setCode("A").setDisplay("Code A")
- .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA")
- .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA"))
- )
- .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB"));
+ .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA")
+ .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA"))
+ )
+ .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB"));
codeSystem
.addConcept().setCode("B").setDisplay("Code B")
- .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA"))
- .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB"));
+ .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA"))
+ .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB"));
//@formatter:on
myCodeSystemDao.create(codeSystem, mySrd);
@@ -185,49 +129,25 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
- assertThat(resp, containsString(""));
+ assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
- assertThat(resp, containsString(""));
+ assertThat(resp, containsString(""));
assertThat(resp, containsString("
"));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
- assertThat(resp, containsString(""));
+ assertThat(resp, containsString(""));
assertThat(resp, containsString("
"));
assertThat(resp, containsString(""));
}
- @Test
- public void testExpandByIdentifier() {
- //@formatter:off
- Parameters respParam = ourClient
- .operation()
- .onType(ValueSet.class)
- .named("expand")
- .withParameter(Parameters.class, "identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
- .execute();
- ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
- //@formatter:on
-
- String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
- ourLog.info(resp);
- //@formatter:off
- assertThat(resp, stringContainsInOrder(
- "",
- ""));
- //@formatter:on
-
- }
-
- //
-
@Test
public void testExpandByIdWithFilter() throws IOException {
@@ -245,13 +165,56 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ourLog.info(resp);
assertThat(resp, containsString(""));
assertThat(resp, not(containsString("")));
-
+
+ }
+
+ /**
+ * $expand?identifier=foo is legacy.. It's actually not valid in FHIR as of STU3
+ * but we supported it for longer than we should have so I don't want to delete
+ * it right now.
+ *
+ * https://groups.google.com/d/msgid/hapi-fhir/CAN2Cfy8kW%2BAOkgC6VjPsU3gRCpExCNZBmJdi-k5R_TWeyWH4tA%40mail.gmail.com?utm_medium=email&utm_source=footer
+ */
+ @Test
+ public void testExpandByIdentifier() {
+ Parameters respParam = ourClient
+ .operation()
+ .onType(ValueSet.class)
+ .named("expand")
+ .withParameter(Parameters.class, "identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
+ .execute();
+ ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
+
+ String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
+ ourLog.info(resp);
+ assertThat(resp, stringContainsInOrder(
+ "",
+ ""));
+
+ }
+
+ @Test
+ public void testExpandByUrl() {
+ Parameters respParam = ourClient
+ .operation()
+ .onType(ValueSet.class)
+ .named("expand")
+ .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
+ .execute();
+ ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
+
+ String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
+ ourLog.info(resp);
+ assertThat(resp, stringContainsInOrder(
+ "",
+ ""));
+
}
@Test
public void testExpandByValueSet() throws IOException {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
-
+
//@formatter:off
Parameters respParam = ourClient
.operation()
@@ -266,8 +229,8 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
ourLog.info(resp);
//@formatter:off
assertThat(resp, stringContainsInOrder(
- "",
- ""));
+ "",
+ ""));
//@formatter:on
}
@@ -276,7 +239,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandInlineVsAgainstBuiltInCs() throws IOException {
createLocalVsPointingAtBuiltInCodeSystem();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
Parameters respParam = ourClient
.operation()
@@ -286,10 +249,10 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
}
@@ -298,7 +261,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
createExternalCsAndLocalVs();
assertNotNull(myLocalVs);
myLocalVs.setId("");
-
+
//@formatter:off
Parameters respParam = ourClient
.operation()
@@ -308,16 +271,15 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, not(containsStringIgnoringCase("")));
-
- }
+ }
@Test
public void testExpandInvalidParams() throws IOException {
@@ -373,7 +335,7 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
public void testExpandLocalVsAgainstBuiltInCs() throws IOException {
createLocalVsPointingAtBuiltInCodeSystem();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
Parameters respParam = ourClient
.operation()
@@ -383,22 +345,18 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
}
-
-
-
-
-
+
@Test
public void testExpandLocalVsAgainstExternalCs() throws IOException {
createExternalCsAndLocalVs();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
Parameters respParam = ourClient
.operation()
@@ -408,21 +366,21 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, not(containsStringIgnoringCase("")));
-
+
}
@Test
public void testExpandLocalVsCanonicalAgainstExternalCs() throws IOException {
createExternalCsAndLocalVs();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
Parameters respParam = ourClient
.operation()
@@ -432,21 +390,21 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, not(containsStringIgnoringCase("")));
-
+
}
@Test
public void testExpandLocalVsWithUnknownCode() throws IOException {
createExternalCsAndLocalVsWithUnknownCode();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
try {
ourClient
@@ -461,34 +419,31 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
//@formatter:on
}
+ /**
+ * #516
+ */
@Test
- public void testValiedateCodeAgainstBuiltInSystem() {
- //@formatter:off
- Parameters respParam = ourClient
- .operation()
- .onType(ValueSet.class)
- .named("validate-code")
- .withParameter(Parameters.class, "code", new StringType("BRN"))
- .andParameter("identifier", new StringType("http://hl7.org/fhir/ValueSet/v2-0487"))
- .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487"))
- .useHttpGet()
- .execute();
- //@formatter:on
+ public void testInvalidFilter() throws Exception {
+ String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8);
+ HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand");
+ post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
- String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
- ourLog.info(resp);
-
- assertEquals("result", respParam.getParameter().get(0).getName());
- assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).getValue().booleanValue());
-
- assertEquals("message", respParam.getParameter().get(1).getName());
- assertThat(((StringType)respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded"));
+ CloseableHttpResponse resp = ourHttpClient.execute(post);
+ try {
- assertEquals("display", respParam.getParameter().get(2).getName());
- assertEquals("Burn", ((StringType)respParam.getParameter().get(2).getValue()).getValue());
+ String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8);
+ ourLog.info(respString);
+
+ ourLog.info(resp.toString());
+
+ assertEquals(400, resp.getStatusLine().getStatusCode());
+ assertThat(respString, containsString("Unknown FilterOperator code 'n'"));
+
+ } finally {
+ IOUtils.closeQuietly(resp);
+ }
}
-
@Test
public void testValidateCodeOperationByCodeAndSystemInstance() {
//@formatter:off
@@ -503,8 +458,8 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
ourLog.info(resp);
-
- assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue());
+
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
}
@Test
@@ -521,8 +476,64 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
ourLog.info(resp);
-
- assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue());
+
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
+ }
+
+ /**
+ * Technically this is the wrong param name
+ */
+ @Test
+ public void testValiedateCodeAgainstBuiltInSystem() {
+ Parameters respParam = ourClient
+ .operation()
+ .onType(ValueSet.class)
+ .named("validate-code")
+ .withParameter(Parameters.class, "code", new StringType("BRN"))
+ .andParameter("identifier", new StringType("http://hl7.org/fhir/ValueSet/v2-0487"))
+ .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487"))
+ .useHttpGet()
+ .execute();
+
+ String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
+ ourLog.info(resp);
+
+ assertEquals("result", respParam.getParameter().get(0).getName());
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).getValue().booleanValue());
+
+ assertEquals("message", respParam.getParameter().get(1).getName());
+ assertThat(((StringType) respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded"));
+
+ assertEquals("display", respParam.getParameter().get(2).getName());
+ assertEquals("Burn", ((StringType) respParam.getParameter().get(2).getValue()).getValue());
+ }
+
+ /**
+ * Technically this is the right param name
+ */
+ @Test
+ public void testValiedateCodeAgainstBuiltInSystemByUrl() {
+ Parameters respParam = ourClient
+ .operation()
+ .onType(ValueSet.class)
+ .named("validate-code")
+ .withParameter(Parameters.class, "code", new StringType("BRN"))
+ .andParameter("url", new StringType("http://hl7.org/fhir/ValueSet/v2-0487"))
+ .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487"))
+ .useHttpGet()
+ .execute();
+
+ String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
+ ourLog.info(resp);
+
+ assertEquals("result", respParam.getParameter().get(0).getName());
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).getValue().booleanValue());
+
+ assertEquals("message", respParam.getParameter().get(1).getName());
+ assertThat(((StringType) respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded"));
+
+ assertEquals("display", respParam.getParameter().get(2).getName());
+ assertEquals("Burn", ((StringType) respParam.getParameter().get(2).getValue()).getValue());
}
@AfterClass
@@ -530,4 +541,38 @@ public class ResourceProviderDstu3ValueSetTest extends BaseResourceProviderDstu3
TestUtil.clearAllStaticFieldsForUnitTest();
}
+ public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) {
+ CodeSystem codeSystem = new CodeSystem();
+ codeSystem.setUrl(URL_MY_CODE_SYSTEM);
+ codeSystem.setContent(CodeSystemContentMode.NOTPRESENT);
+ IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified();
+
+ ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong());
+
+ TermCodeSystemVersion cs = new TermCodeSystemVersion();
+ cs.setResource(table);
+ cs.setResourceVersionId(table.getVersion());
+
+ TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A");
+ cs.getConcepts().add(parentA);
+
+ TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA");
+ parentA.addChild(childAA, RelationshipTypeEnum.ISA);
+
+ TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA");
+ childAA.addChild(childAAA, RelationshipTypeEnum.ISA);
+
+ TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB");
+ childAA.addChild(childAAB, RelationshipTypeEnum.ISA);
+
+ TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB");
+ parentA.addChild(childAB, RelationshipTypeEnum.ISA);
+
+ TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B");
+ cs.getConcepts().add(parentB);
+
+ theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs);
+ return codeSystem;
+ }
+
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java
index 29798cf84bf..2a4e87c050d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/ResourceProviderInterceptorDstu3Test.java
@@ -1,7 +1,6 @@
package ca.uhn.fhir.jpa.provider.dstu3;
import ca.uhn.fhir.jpa.provider.r4.ResourceProviderInterceptorR4Test;
-import ca.uhn.fhir.model.dstu2.resource.Conformance;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.api.Constants;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
@@ -61,8 +60,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
public void before() throws Exception {
super.before();
- myServerInterceptor = mock(IServerInterceptor.class);
- myDaoInterceptor = mock(IServerInterceptor.class);
+ myServerInterceptor = mock(IServerInterceptor.class, withSettings().verboseLogging());
+ myDaoInterceptor = mock(IServerInterceptor.class, withSettings().verboseLogging());
resetServerInterceptor();
@@ -125,6 +124,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
public void testCreateResourceInTransaction() throws IOException, ServletException {
String methodName = "testCreateResourceInTransaction";
+ ourLog.info("** Starting {}", methodName);
+
Patient pt = new Patient();
pt.addName().setFamily(methodName);
@@ -140,6 +141,11 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
resetServerInterceptor();
+ ArgumentCaptor ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class);
+ ArgumentCaptor opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
+ verify(myDaoInterceptor, times(0)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
+ verify(myServerInterceptor, times(0)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
+
HttpPost post = new HttpPost(ourServerBase + "/");
post.setEntity(new StringEntity(resource, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
CloseableHttpResponse response = ourHttpClient.execute(post);
@@ -153,8 +159,8 @@ public class ResourceProviderInterceptorDstu3Test extends BaseResourceProviderDs
* Server Interceptor
*/
- ArgumentCaptor ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class);
- ArgumentCaptor opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
+ ardCaptor = ArgumentCaptor.forClass(ActionRequestDetails.class);
+ opTypeCaptor = ArgumentCaptor.forClass(RestOperationTypeEnum.class);
verify(myServerInterceptor, times(2)).incomingRequestPreHandled(opTypeCaptor.capture(), ardCaptor.capture());
assertEquals(RestOperationTypeEnum.TRANSACTION, opTypeCaptor.getAllValues().get(0));
assertEquals(null, ardCaptor.getAllValues().get(0).getResourceType());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java
index 758c6daf735..2ac8b37a4f1 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/AuthorizationInterceptorResourceProviderR4Test.java
@@ -9,6 +9,8 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
+import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import org.apache.http.client.methods.*;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
@@ -69,19 +71,68 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
Patient patient = new Patient();
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
- IIdType id = ourClient.create().resource(patient).execute().getId();
+ IIdType id = myClient.create().resource(patient).execute().getId();
try {
- ourClient.delete().resourceById(id.toUnqualifiedVersionless()).execute();
+ myClient.delete().resourceById(id.toUnqualifiedVersionless()).execute();
fail();
} catch (ForbiddenOperationException e) {
// good
}
- patient = ourClient.read().resource(Patient.class).withId(id.toUnqualifiedVersionless()).execute();
+ patient = myClient.read().resource(Patient.class).withId(id.toUnqualifiedVersionless()).execute();
assertEquals(id.getValue(), patient.getId());
}
-
+
+ /**
+ * See #751
+ */
+ @Test
+ public void testDeleteInCompartmentIsBlocked() {
+
+ Patient patient = new Patient();
+ patient.setId("Patient/A");
+ patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
+ patient.addName().setFamily("Tester").addGiven("Raghad");
+ IIdType id = myClient.update().resource(patient).execute().getId();
+
+ Observation obs = new Observation();
+ obs.setId("Observation/B");
+ obs.getSubject().setReference("Patient/A");
+ myClient.update().resource(obs).execute();
+
+ obs = new Observation();
+ obs.setId("Observation/C");
+ obs.setStatus(ObservationStatus.FINAL);
+ myClient.update().resource(obs).execute();
+
+ ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
+ @Override
+ public List buildRuleList(RequestDetails theRequestDetails) {
+ return new RuleBuilder()
+ .allow().delete().allResources().inCompartment("Patient", new IdType("Patient/A")).andThen()
+ .allow().read().allResources().withAnyId().andThen()
+ .denyAll()
+ .build();
+ }
+ });
+
+ myClient.delete().resourceById(new IdType("Observation/B")).execute();
+
+ try {
+ myClient.read().resource(Observation.class).withId("Observation/B").execute();
+ fail();
+ } catch (ResourceGoneException e) {
+ // good
+ }
+
+ try {
+ myClient.delete().resourceById(new IdType("Observation/C")).execute();
+ fail();
+ } catch (ForbiddenOperationException e) {
+ // good
+ }
+ }
/**
* See #503
@@ -92,16 +143,16 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
Patient patient = new Patient();
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
- final IIdType id = ourClient.create().resource(patient).execute().getId();
+ final IIdType id = myClient.create().resource(patient).execute().getId();
Observation obsInCompartment = new Observation();
obsInCompartment.setStatus(ObservationStatus.FINAL);
obsInCompartment.getSubject().setReferenceElement(id.toUnqualifiedVersionless());
- IIdType obsInCompartmentId = ourClient.create().resource(obsInCompartment).execute().getId().toUnqualifiedVersionless();
+ IIdType obsInCompartmentId = myClient.create().resource(obsInCompartment).execute().getId().toUnqualifiedVersionless();
Observation obsNotInCompartment = new Observation();
obsNotInCompartment.setStatus(ObservationStatus.FINAL);
- IIdType obsNotInCompartmentId = ourClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless();
+ IIdType obsNotInCompartmentId = myClient.create().resource(obsNotInCompartment).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
@@ -114,10 +165,10 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
}
});
- ourClient.delete().resourceById(obsInCompartmentId.toUnqualifiedVersionless()).execute();
+ myClient.delete().resourceById(obsInCompartmentId.toUnqualifiedVersionless()).execute();
try {
- ourClient.delete().resourceById(obsNotInCompartmentId.toUnqualifiedVersionless()).execute();
+ myClient.delete().resourceById(obsNotInCompartmentId.toUnqualifiedVersionless()).execute();
fail();
} catch (ForbiddenOperationException e) {
// good
@@ -130,7 +181,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
Patient patient = new Patient();
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
- final MethodOutcome output1 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
+ final MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
@@ -148,7 +199,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
patient.setId(output1.getId().toUnqualifiedVersionless());
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
- MethodOutcome output2 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
+ MethodOutcome output2 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
assertEquals(output1.getId().getIdPart(), output2.getId().getIdPart());
@@ -156,7 +207,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
try {
- ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|101").execute();
+ myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|101").execute();
fail();
} catch (ForbiddenOperationException e) {
assertEquals("HTTP 403 Forbidden: Access denied by default policy (no applicable rules)", e.getMessage());
@@ -167,7 +218,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
try {
- ourClient.update().resource(patient).execute();
+ myClient.update().resource(patient).execute();
fail();
} catch (ForbiddenOperationException e) {
assertEquals("HTTP 403 Forbidden: Access denied by default policy (no applicable rules)", e.getMessage());
@@ -182,11 +233,11 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
public void testBlockUpdatingPatientUserDoesnNotHaveAccessTo() throws IOException {
Patient pt1 = new Patient();
pt1.setActive(true);
- final IIdType pid1 = ourClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless();
+ final IIdType pid1 = myClient.create().resource(pt1).execute().getId().toUnqualifiedVersionless();
Patient pt2 = new Patient();
pt2.setActive(false);
- final IIdType pid2 = ourClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless();
+ final IIdType pid2 = myClient.create().resource(pt2).execute().getId().toUnqualifiedVersionless();
ourRestServer.registerInterceptor(new AuthorizationInterceptor(PolicyEnum.DENY) {
@Override
@@ -200,7 +251,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
Observation obs = new Observation();
obs.setStatus(ObservationStatus.FINAL);
obs.setSubject(new Reference(pid1));
- IIdType oid = ourClient.create().resource(obs).execute().getId().toUnqualified();
+ IIdType oid = myClient.create().resource(obs).execute().getId().toUnqualified();
unregisterInterceptors();
@@ -224,7 +275,7 @@ public class AuthorizationInterceptorResourceProviderR4Test extends BaseResource
obs.setSubject(new Reference(pid2));
try {
- ourClient.update().resource(obs).execute();
+ myClient.update().resource(obs).execute();
fail();
} catch (ForbiddenOperationException e) {
// good
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java
index b051b94e155..12e8f7f0967 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/BaseResourceProviderR4Test.java
@@ -47,7 +47,7 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
protected static JpaValidationSupportChainR4 myValidationSupport;
- protected static IGenericClient ourClient;
+ protected IGenericClient myClient;
protected static CloseableHttpClient ourHttpClient;
protected static int ourPort;
protected static RestfulServer ourRestServer;
@@ -150,10 +150,6 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
ourSearchParamRegistry = wac.getBean(SearchParamRegistryR4.class);
myFhirCtx.getRestfulClientFactory().setSocketTimeout(5000000);
- ourClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
- if (shouldLogClient()) {
- ourClient.registerInterceptor(new LoggingInterceptor());
- }
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
HttpClientBuilder builder = HttpClientBuilder.create();
@@ -165,6 +161,11 @@ public abstract class BaseResourceProviderR4Test extends BaseJpaR4Test {
}
ourRestServer.setPagingProvider(ourPagingProvider);
+
+ myClient = myFhirCtx.newRestfulGenericClient(ourServerBase);
+ if (shouldLogClient()) {
+ myClient.registerInterceptor(new LoggingInterceptor());
+ }
}
/**
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java
index 2a554e36963..286c6d9ce0b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java
@@ -1,11 +1,11 @@
package ca.uhn.fhir.jpa.provider.r4;
+import ca.uhn.fhir.util.TestUtil;
import ca.uhn.fhir.util.UrlUtil;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Patient;
import org.junit.Test;
import org.slf4j.Logger;
@@ -31,14 +31,14 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
try {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp);
- assertEquals(resp, "{\n" +
+ assertEquals(TestUtil.stripReturns(resp), TestUtil.stripReturns("{\n" +
" \"name\":[{\n" +
" \"family\":\"FAM\",\n" +
" \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" +
" },{\n" +
" \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" +
" }]\n" +
- "}");
+ "}"));
} finally {
IOUtils.closeQuietly(response);
}
@@ -56,7 +56,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
try {
String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(resp);
- assertEquals(resp, "{\n" +
+ assertEquals(TestUtil.stripReturns(resp), TestUtil.stripReturns("{\n" +
" \"PatientList\":[{\n" +
" \"name\":[{\n" +
" \"family\":\"FAM\",\n" +
@@ -69,7 +69,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
" \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" +
" }]\n" +
" }]\n" +
- "}");
+ "}"));
} finally {
IOUtils.closeQuietly(response);
}
@@ -85,13 +85,13 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test {
p.addName()
.addGiven("GivenOnly1")
.addGiven("GivenOnly2");
- myPatientId0 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ myPatientId0 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
p = new Patient();
p.addName()
.addGiven("GivenOnlyB1")
.addGiven("GivenOnlyB2");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java
index ba0db38b0e9..37b45783b2b 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/PatientEverythingR4Test.java
@@ -57,41 +57,41 @@ public class PatientEverythingR4Test extends BaseResourceProviderR4Test {
Organization org = new Organization();
org.setName("an org");
- orgId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue();
+ orgId = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless().getValue();
ourLog.info("OrgId: {}", orgId);
Patient patient = new Patient();
patient.getManagingOrganization().setReference(orgId);
- patId = ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue();
+ patId = myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless().getValue();
Patient patient2 = new Patient();
patient2.getManagingOrganization().setReference(orgId);
- myWrongPatId = ourClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue();
+ myWrongPatId = myClient.create().resource(patient2).execute().getId().toUnqualifiedVersionless().getValue();
Encounter enc1 = new Encounter();
enc1.setStatus(EncounterStatus.CANCELLED);
enc1.getSubject().setReference(patId);
enc1.getServiceProvider().setReference(orgId);
- encId1 = ourClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue();
+ encId1 = myClient.create().resource(enc1).execute().getId().toUnqualifiedVersionless().getValue();
Encounter enc2 = new Encounter();
enc2.setStatus(EncounterStatus.ARRIVED);
enc2.getSubject().setReference(patId);
enc2.getServiceProvider().setReference(orgId);
- encId2 = ourClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue();
+ encId2 = myClient.create().resource(enc2).execute().getId().toUnqualifiedVersionless().getValue();
Encounter wrongEnc1 = new Encounter();
wrongEnc1.setStatus(EncounterStatus.ARRIVED);
wrongEnc1.getSubject().setReference(myWrongPatId);
wrongEnc1.getServiceProvider().setReference(orgId);
- myWrongEnc1 = ourClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue();
+ myWrongEnc1 = myClient.create().resource(wrongEnc1).execute().getId().toUnqualifiedVersionless().getValue();
myObsIds = new ArrayList();
for (int i = 0; i < 20; i++) {
Observation obs = new Observation();
obs.getSubject().setReference(patId);
obs.setStatus(ObservationStatus.FINAL);
- String obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue();
+ String obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless().getValue();
myObsIds.add(obsId);
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java
index c0bfdc29769..a46d3cc363f 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderCustomSearchParamR4Test.java
@@ -54,7 +54,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
sp.setTitle("Foo Param");
try {
- ourClient.create().resource(sp).execute();
+ myClient.create().resource(sp).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: SearchParameter.status is missing or invalid: null", e.getMessage());
@@ -120,7 +120,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(eyeColourSp));
- ourClient
+ myClient
.create()
.resource(eyeColourSp)
.execute();
@@ -139,7 +139,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
p2.addExtension().setUrl("http://acme.org/eyecolour").setValue(new CodeType("green"));
IIdType p2id = myPatientDao.create(p2).getId().toUnqualifiedVersionless();
- Bundle bundle = ourClient
+ Bundle bundle = myClient
.search()
.forResource(Patient.class)
.where(new TokenClientParam("eyecolour").exactly().code("blue"))
@@ -168,7 +168,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
public void testConformanceOverrideAllowed() {
myDaoConfig.setDefaultSearchParamsCanBeOverridden(true);
- CapabilityStatement conformance = ourClient
+ CapabilityStatement conformance = myClient
.fetchConformance()
.ofType(CapabilityStatement.class)
.execute();
@@ -220,7 +220,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
}
});
- conformance = ourClient
+ conformance = myClient
.fetchConformance()
.ofType(CapabilityStatement.class)
.execute();
@@ -238,7 +238,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
public void testConformanceOverrideNotAllowed() {
myDaoConfig.setDefaultSearchParamsCanBeOverridden(false);
- CapabilityStatement conformance = ourClient
+ CapabilityStatement conformance = myClient
.fetchConformance()
.ofType(CapabilityStatement.class)
.execute();
@@ -274,7 +274,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
mySearchParamRegsitry.forceRefresh();
- conformance = ourClient
+ conformance = myClient
.fetchConformance()
.ofType(CapabilityStatement.class)
.execute();
@@ -332,7 +332,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
List foundResources;
Bundle result;
- result = ourClient
+ result = myClient
.search()
.forResource(Patient.class)
.where(new TokenClientParam("foo").exactly().code("male"))
@@ -409,7 +409,7 @@ public class ResourceProviderCustomSearchParamR4Test extends BaseResourceProvide
List foundResources;
Bundle result;
- result = ourClient
+ result = myClient
.search()
.forResource(Observation.class)
.where(new ReferenceClientParam("foo").hasChainedProperty(Patient.GENDER.exactly().code("male")))
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java
index 742e097aad0..781d7040b46 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderInterceptorR4Test.java
@@ -198,7 +198,7 @@ public class ResourceProviderInterceptorR4Test extends BaseResourceProviderR4Tes
Organization org = new Organization();
org.setName("orgName");
- IIdType orgId = ourClient.create().resource(org).execute().getId().toUnqualified();
+ IIdType orgId = myClient.create().resource(org).execute().getId().toUnqualified();
assertNotNull(orgId.getVersionIdPartAsLong());
resetServerInterceptor();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java
index 78423c8552b..a3e9351442f 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderQuestionnaireResponseR4Test.java
@@ -72,7 +72,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
qr1.setStatus(QuestionnaireResponseStatus.COMPLETED);
qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123));
try {
- ourClient.create().resource(qr1).execute();
+ myClient.create().resource(qr1).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.toString(), containsString("Answer value must be of type string"));
@@ -95,7 +95,7 @@ public class ResourceProviderQuestionnaireResponseR4Test extends BaseResourcePro
qr1.setStatus(QuestionnaireResponseStatus.COMPLETED);
qr1.addItem().setLinkId("link1").addAnswer().setValue(new DecimalType(123));
try {
- ourClient.create().resource(qr1).execute();
+ myClient.create().resource(qr1).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.toString(), containsString("Answer value must be of type string"));
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java
index 075ed457670..6ea92ae282a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4BundleTest.java
@@ -34,9 +34,9 @@ public class ResourceProviderR4BundleTest extends BaseResourceProviderR4Test {
composition.setTitle("Visit Summary");
bundle.addEntry().setFullUrl("http://foo").setResource(composition);
- IIdType id = ourClient.create().resource(bundle).execute().getId();
+ IIdType id = myClient.create().resource(bundle).execute().getId();
- Bundle retBundle = ourClient.read().resource(Bundle.class).withId(id).execute();
+ Bundle retBundle = myClient.read().resource(Bundle.class).withId(id).execute();
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(retBundle));
assertEquals("http://foo", bundle.getEntry().get(0).getFullUrl());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java
new file mode 100644
index 00000000000..9ffb2e4c623
--- /dev/null
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CacheTest.java
@@ -0,0 +1,188 @@
+package ca.uhn.fhir.jpa.provider.r4;
+
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
+import ca.uhn.fhir.parser.StrictErrorHandler;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor;
+import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import ca.uhn.fhir.util.TestUtil;
+import org.hl7.fhir.r4.model.Bundle;
+import org.hl7.fhir.r4.model.Patient;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Test;
+import org.springframework.test.util.AopTestUtils;
+
+import java.io.IOException;
+import java.util.Date;
+
+import static org.hamcrest.Matchers.*;
+import static org.hamcrest.core.IsNot.not;
+import static org.junit.Assert.*;
+
+public class ResourceProviderR4CacheTest extends BaseResourceProviderR4Test {
+
+ private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR4CacheTest.class);
+ private SearchCoordinatorSvcImpl mySearchCoordinatorSvcRaw;
+ private CapturingInterceptor myCapturingInterceptor;
+
+ @Override
+ @After
+ public void after() throws Exception {
+ super.after();
+ myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
+ myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(new DaoConfig().getCacheControlNoStoreMaxResultsUpperLimit());
+
+ myClient.unregisterInterceptor(myCapturingInterceptor);
+ }
+
+ @Override
+ public void before() throws Exception {
+ super.before();
+ myFhirCtx.setParserErrorHandler(new StrictErrorHandler());
+ mySearchCoordinatorSvcRaw = AopTestUtils.getTargetObject(mySearchCoordinatorSvc);
+
+ myCapturingInterceptor = new CapturingInterceptor();
+ myClient.registerInterceptor(myCapturingInterceptor);
+ }
+
+ @Test
+ public void testCacheNoStore() throws IOException {
+
+ Patient pt1 = new Patient();
+ pt1.addName().setFamily("FAM");
+ myClient.create().resource(pt1).execute();
+
+ Bundle results = myClient
+ .search()
+ .forResource("Patient")
+ .where(Patient.FAMILY.matches().value("FAM"))
+ .returnBundle(Bundle.class)
+ .cacheControl(new CacheControlDirective().setNoStore(true))
+ .execute();
+ assertEquals(1, results.getEntry().size());
+ assertEquals(0, mySearchEntityDao.count());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty());
+
+ Patient pt2 = new Patient();
+ pt2.addName().setFamily("FAM");
+ myClient.create().resource(pt2).execute();
+
+ results = myClient
+ .search()
+ .forResource("Patient")
+ .where(Patient.FAMILY.matches().value("FAM"))
+ .returnBundle(Bundle.class)
+ .cacheControl(new CacheControlDirective().setNoStore(true))
+ .execute();
+ assertEquals(2, results.getEntry().size());
+ assertEquals(0, mySearchEntityDao.count());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty());
+
+ }
+
+ @Test
+ public void testCacheNoStoreMaxResults() throws IOException {
+
+ for (int i = 0; i < 10; i++) {
+ Patient pt1 = new Patient();
+ pt1.addName().setFamily("FAM" + i);
+ myClient.create().resource(pt1).execute();
+ }
+
+ Bundle results = myClient
+ .search()
+ .forResource("Patient")
+ .where(Patient.FAMILY.matches().value("FAM"))
+ .returnBundle(Bundle.class)
+ .cacheControl(new CacheControlDirective().setNoStore(true).setMaxResults(5))
+ .execute();
+ assertEquals(5, results.getEntry().size());
+ assertEquals(0, mySearchEntityDao.count());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty());
+
+ }
+
+ @Test
+ public void testCacheNoStoreMaxResultsWithIllegalValue() throws IOException {
+ myDaoConfig.setCacheControlNoStoreMaxResultsUpperLimit(123);
+ try {
+ myClient
+ .search()
+ .forResource("Patient")
+ .where(Patient.FAMILY.matches().value("FAM"))
+ .returnBundle(Bundle.class)
+ .cacheControl(new CacheControlDirective().setNoStore(true).setMaxResults(5000))
+ .execute();
+ fail();
+ } catch (InvalidRequestException e) {
+ assertEquals("HTTP 400 Bad Request: Cache-Control header max-results value must not exceed 123", e.getMessage());
+ }
+ }
+
+ @Test
+ public void testCacheSuppressed() throws IOException {
+
+ Patient pt1 = new Patient();
+ pt1.addName().setFamily("FAM");
+ myClient.create().resource(pt1).execute();
+
+ Bundle results = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute();
+ assertEquals(1, results.getEntry().size());
+ assertEquals(1, mySearchEntityDao.count());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty());
+
+ Patient pt2 = new Patient();
+ pt2.addName().setFamily("FAM");
+ myClient.create().resource(pt2).execute();
+
+ results = myClient
+ .search()
+ .forResource("Patient")
+ .where(Patient.FAMILY.matches().value("FAM"))
+ .returnBundle(Bundle.class)
+ .cacheControl(new CacheControlDirective().setNoCache(true))
+ .execute();
+ assertEquals(2, results.getEntry().size());
+ assertEquals(2, mySearchEntityDao.count());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty());
+
+ }
+
+ @Test
+ public void testCacheUsedNormally() throws IOException {
+
+ Patient pt1 = new Patient();
+ pt1.addName().setFamily("FAM");
+ myClient.create().resource(pt1).execute();
+
+ Date beforeFirst = new Date();
+
+ Bundle results1 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute();
+ assertEquals(1, results1.getEntry().size());
+ assertEquals(1, mySearchEntityDao.count());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), empty());
+ assertThat(results1.getMeta().getLastUpdated(), greaterThan(beforeFirst));
+ assertThat(results1.getMeta().getLastUpdated(), lessThan(new Date()));
+ assertThat(results1.getId(), not(blankOrNullString()));
+
+ Patient pt2 = new Patient();
+ pt2.addName().setFamily("FAM");
+ myClient.create().resource(pt2).execute();
+
+ Bundle results2 = myClient.search().forResource("Patient").where(Patient.FAMILY.matches().value("FAM")).returnBundle(Bundle.class).execute();
+ assertEquals(1, results2.getEntry().size());
+ assertEquals(1, mySearchEntityDao.count());
+ assertEquals("HIT from " + ourServerBase, myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE).get(0));
+ assertEquals(results1.getMeta().getLastUpdated(), results2.getMeta().getLastUpdated());
+ assertEquals(results1.getId(), results2.getId());
+ }
+
+ @AfterClass
+ public static void afterClassClearContext() {
+ TestUtil.clearAllStaticFieldsForUnitTest();
+ }
+
+}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java
index 9b04ff87ed2..a54963a5f6f 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4CodeSystemTest.java
@@ -40,7 +40,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
public void testLookupOnExternalCode() {
ResourceProviderR4ValueSetTest.createExternalCs(myCodeSystemDao, myResourceTableDao, myTermSvc, mySrd);
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -59,7 +59,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
assertEquals(false, ((BooleanType)respParam.getParameter().get(2).getValue()).getValue().booleanValue());
// With HTTP GET
- respParam = ourClient
+ respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -82,7 +82,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
@Test
public void testLookupOperationByCodeAndSystemBuiltInCode() {
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -105,7 +105,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
public void testLookupOperationByCodeAndSystemBuiltInNonexistantCode() {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -122,7 +122,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
@Test
public void testLookupOperationByCodeAndSystemUserDefinedCode() {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -146,7 +146,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
public void testLookupOperationByCodeAndSystemUserDefinedNonExistantCode() {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -163,7 +163,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
@Test
public void testLookupOperationByCoding() {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -186,7 +186,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
public void testLookupOperationByInvalidCombination() {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -205,7 +205,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
public void testLookupOperationByInvalidCombination2() {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -223,7 +223,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
public void testLookupOperationByInvalidCombination3() {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
@@ -240,7 +240,7 @@ public class ResourceProviderR4CodeSystemTest extends BaseResourceProviderR4Test
// @Ignore
public void testLookupOperationForBuiltInCode() {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(CodeSystem.class)
.named("lookup")
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java
index 9410fb8d2e6..5a458068ef2 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4Test.java
@@ -1,22 +1,29 @@
package ca.uhn.fhir.jpa.provider.r4;
-import static org.apache.commons.lang3.StringUtils.isNotBlank;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.*;
-import java.math.BigDecimal;
-import java.net.*;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.entity.Search;
+import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
+import ca.uhn.fhir.jpa.util.StopWatch;
+import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
+import ca.uhn.fhir.model.primitive.InstantDt;
+import ca.uhn.fhir.model.primitive.UriDt;
+import ca.uhn.fhir.parser.IParser;
+import ca.uhn.fhir.parser.StrictErrorHandler;
import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.api.MethodOutcome;
+import ca.uhn.fhir.rest.api.SummaryEnum;
+import ca.uhn.fhir.rest.client.api.IGenericClient;
+import ca.uhn.fhir.rest.client.interceptor.CapturingInterceptor;
+import ca.uhn.fhir.rest.gclient.StringClientParam;
+import ca.uhn.fhir.rest.param.*;
+import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import ca.uhn.fhir.rest.server.exceptions.PreconditionFailedException;
+import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
+import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
+import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
+import ca.uhn.fhir.util.TestUtil;
+import ca.uhn.fhir.util.UrlUtil;
+import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
@@ -24,8 +31,14 @@ import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
-import org.apache.http.entity.*;
+import org.apache.http.entity.ByteArrayEntity;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicNameValuePair;
+import org.hamcrest.Matchers;
+import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IIdType;
import org.hl7.fhir.r4.model.*;
import org.hl7.fhir.r4.model.Bundle.*;
import org.hl7.fhir.r4.model.Encounter.EncounterLocationComponent;
@@ -36,36 +49,31 @@ import org.hl7.fhir.r4.model.Observation.ObservationStatus;
import org.hl7.fhir.r4.model.Questionnaire.QuestionnaireItemType;
import org.hl7.fhir.r4.model.Subscription.SubscriptionChannelType;
import org.hl7.fhir.r4.model.Subscription.SubscriptionStatus;
-import org.hl7.fhir.instance.model.api.*;
import org.junit.*;
import org.springframework.test.util.AopTestUtils;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallback;
-import com.google.common.collect.Lists;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.math.BigDecimal;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketTimeoutException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.*;
-import ca.uhn.fhir.jpa.dao.DaoConfig;
-import ca.uhn.fhir.jpa.entity.Search;
-import ca.uhn.fhir.jpa.search.SearchCoordinatorSvcImpl;
-import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
-import ca.uhn.fhir.model.primitive.InstantDt;
-import ca.uhn.fhir.model.primitive.UriDt;
-import ca.uhn.fhir.parser.IParser;
-import ca.uhn.fhir.parser.StrictErrorHandler;
-import ca.uhn.fhir.rest.api.MethodOutcome;
-import ca.uhn.fhir.rest.api.SummaryEnum;
-import ca.uhn.fhir.rest.client.api.IGenericClient;
-import ca.uhn.fhir.rest.gclient.StringClientParam;
-import ca.uhn.fhir.rest.param.*;
-import ca.uhn.fhir.rest.server.exceptions.*;
-import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
-import ca.uhn.fhir.util.TestUtil;
-import ca.uhn.fhir.util.UrlUtil;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ResourceProviderR4Test.class);
private SearchCoordinatorSvcImpl mySearchCoordinatorSvcRaw;
+ private CapturingInterceptor myCapturingInterceptor = new CapturingInterceptor();
@Override
@After
@@ -75,11 +83,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
myDaoConfig.setAllowExternalReferences(new DaoConfig().isAllowExternalReferences());
myDaoConfig.setReuseCachedSearchResultsForMillis(new DaoConfig().getReuseCachedSearchResultsForMillis());
-
+ myDaoConfig.setCountSearchResultsUpTo(new DaoConfig().getCountSearchResultsUpTo());
+
mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(null);
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(SearchCoordinatorSvcImpl.DEFAULT_SYNC_SIZE);
mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(false);
+ mySearchCoordinatorSvcRaw.cancelAllActiveSearches();
+ myClient.unregisterInterceptor(myCapturingInterceptor);
}
@Override
@@ -88,6 +99,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
myFhirCtx.setParserErrorHandler(new StrictErrorHandler());
myDaoConfig.setAllowMultipleDelete(true);
+ myClient.registerInterceptor(myCapturingInterceptor);
}
@Before
@@ -102,8 +114,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
IOUtils.closeQuietly(resp.getEntity().getContent());
assertEquals(200, resp.getStatusLine().getStatusCode());
}
-
-
+
+
private ArrayList genResourcesOfType(Bundle theRes, Class extends IBaseResource> theClass) {
ArrayList retVal = new ArrayList();
for (BundleEntryComponent next : theRes.getEntry()) {
@@ -123,12 +135,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void saveAndRetrieveBasicResource() throws IOException {
String input = IOUtils.toString(getClass().getResourceAsStream("/basic-stu3.xml"), StandardCharsets.UTF_8);
- String respString = ourClient.transaction().withBundle(input).prettyPrint().execute();
+ String respString = myClient.transaction().withBundle(input).prettyPrint().execute();
ourLog.info(respString);
Bundle bundle = myFhirCtx.newXmlParser().parseResource(Bundle.class, respString);
IdType id = new IdType(bundle.getEntry().get(0).getResponse().getLocation());
- Basic basic = ourClient.read().resource(Basic.class).withId(id).execute();
+ Basic basic = myClient.read().resource(Basic.class).withId(id).execute();
List exts = basic.getExtensionsByUrl("http://localhost:1080/hapi-fhir-jpaserver-example/baseDstu2/StructureDefinition/DateID");
assertEquals(1, exts.size());
}
@@ -168,7 +180,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
// Y
@Test
public void testBundleCreate() throws Exception {
- IGenericClient client = ourClient;
+ IGenericClient client = myClient;
String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/document-father.json"), StandardCharsets.UTF_8);
IIdType id = client.create().resource(resBody).execute().getId();
@@ -182,7 +194,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
@Test
public void testBundleCreateWithTypeTransaction() throws Exception {
- IGenericClient client = ourClient;
+ IGenericClient client = myClient;
String resBody = IOUtils.toString(ResourceProviderR4Test.class.getResource("/r4/document-father.json"), StandardCharsets.UTF_8);
resBody = resBody.replace("\"type\": \"document\"", "\"type\": \"transaction\"");
@@ -200,10 +212,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
subs.setStatus(SubscriptionStatus.ACTIVE);
subs.getChannel().setType(SubscriptionChannelType.WEBSOCKET);
subs.setCriteria("Observation?");
- IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
//@formatter:off
- Bundle resp = ourClient
+ Bundle resp = myClient
.search()
.forResource(Subscription.class)
.where(Subscription.TYPE.exactly().code(SubscriptionChannelType.WEBSOCKET.toCode()))
@@ -215,7 +227,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertThat(toUnqualifiedVersionlessIds(resp), contains(id));
//@formatter:off
- resp = ourClient
+ resp = myClient
.search()
.forResource(Subscription.class)
.where(Subscription.TYPE.exactly().systemAndCode(SubscriptionChannelType.WEBSOCKET.getSystem(), SubscriptionChannelType.WEBSOCKET.toCode()))
@@ -227,7 +239,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertThat(toUnqualifiedVersionlessIds(resp), contains(id));
//@formatter:off
- resp = ourClient
+ resp = myClient
.search()
.forResource(Subscription.class)
.where(Subscription.TYPE.exactly().systemAndCode(SubscriptionChannelType.WEBSOCKET.getSystem(), SubscriptionChannelType.WEBSOCKET.toCode()))
@@ -248,13 +260,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
org.setName("rpdstu2_testCountParam_01");
resources.add(org);
}
- ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
+ myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
- Bundle found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(10).returnBundle(Bundle.class).execute();
+ Bundle found = myClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(10).returnBundle(Bundle.class).execute();
assertEquals(100, found.getTotal());
assertEquals(10, found.getEntry().size());
- found = ourClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(999).returnBundle(Bundle.class).execute();
+ found = myClient.search().forResource(Organization.class).where(Organization.NAME.matches().value("rpdstu2_testCountParam_01")).count(999).returnBundle(Bundle.class).execute();
assertEquals(100, found.getTotal());
assertEquals(50, found.getEntry().size());
@@ -265,14 +277,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
*/
@Test
public void testCreateAndUpdateBinary() throws ClientProtocolException, Exception {
- byte[] arr = { 1, 21, 74, 123, -44 };
+ byte[] arr = {1, 21, 74, 123, -44};
Binary binary = new Binary();
binary.setContent(arr);
binary.setContentType("dansk");
- IIdType resource = ourClient.create().resource(binary).execute().getId();
+ IIdType resource = myClient.create().resource(binary).execute().getId();
- Binary fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
+ Binary fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
assertEquals("1", fromDB.getIdElement().getVersionIdPart());
arr[0] = 2;
@@ -286,7 +298,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
IOUtils.closeQuietly(resp);
}
- fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
+ fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
assertEquals("2", fromDB.getIdElement().getVersionIdPart());
arr[0] = 3;
@@ -302,7 +314,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
IOUtils.closeQuietly(resp);
}
- fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
+ fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
assertEquals("3", fromDB.getIdElement().getVersionIdPart());
// Now an update with the wrong ID in the body
@@ -319,7 +331,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
IOUtils.closeQuietly(resp);
}
- fromDB = ourClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
+ fromDB = myClient.read().resource(Binary.class).withId(resource.toVersionless()).execute();
assertEquals("3", fromDB.getIdElement().getVersionIdPart());
}
@@ -331,7 +343,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testCreateBundle() throws IOException {
String input = IOUtils.toString(getClass().getResourceAsStream("/bryn-bundle.json"), StandardCharsets.UTF_8);
Validate.notNull(input);
- ourClient.create().resource(input).execute().getResource();
+ myClient.create().resource(input).execute().getResource();
}
@Test
@@ -340,13 +352,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
- MethodOutcome output1 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
+ MethodOutcome output1 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
patient = new Patient();
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.addName().setFamily("Tester").addGiven("Raghad");
- MethodOutcome output2 = ourClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
+ MethodOutcome output2 = myClient.update().resource(patient).conditionalByUrl("Patient?identifier=http://uhn.ca/mrns|100").execute();
assertEquals(output1.getId().getIdPart(), output2.getId().getIdPart());
}
@@ -362,7 +374,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
// Missing status, which is mandatory
Observation obs = new Observation();
obs.addIdentifier().setSystem("urn:foo").setValue("bar");
- IBaseResource outcome = ourClient.create().resource(obs).execute().getOperationOutcome();
+ IBaseResource outcome = myClient.create().resource(obs).execute().getOperationOutcome();
String encodedOo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info(encodedOo);
@@ -370,7 +382,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertThat(encodedOo, containsString("Successfully created resource \\\"Observation/"));
interceptor.setAddValidationResultsToResponseOperationOutcome(false);
- outcome = ourClient.create().resource(obs).execute().getOperationOutcome();
+ outcome = myClient.create().resource(obs).execute().getOperationOutcome();
encodedOo = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(outcome);
ourLog.info(encodedOo);
assertThat(encodedOo, not(containsString("cvc-complex-type.2.4.b")));
@@ -387,15 +399,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
CodeSystem cs = new CodeSystem();
cs.setUrl("http://urn/system");
cs.addConcept().setCode("code0");
- ourClient.create().resource(cs).execute();
+ myClient.create().resource(cs).execute();
ValueSet options = new ValueSet();
options.getCompose().addInclude().setSystem("http://urn/system");
- IIdType optId = ourClient.create().resource(options).execute().getId();
+ IIdType optId = myClient.create().resource(options).execute().getId();
Questionnaire q = new Questionnaire();
q.addItem().setLinkId("link0").setRequired(false).setType(QuestionnaireItemType.CHOICE).setOptions(new Reference(optId));
- IIdType qId = ourClient.create().resource(q).execute().getId();
+ IIdType qId = myClient.create().resource(q).execute().getId();
QuestionnaireResponse qa;
@@ -404,7 +416,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
qa = new QuestionnaireResponse();
qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue());
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code0"));
- ourClient.create().resource(qa).execute();
+ myClient.create().resource(qa).execute();
// Bad code
@@ -412,7 +424,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue());
qa.addItem().setLinkId("link0").addAnswer().setValue(new Coding().setSystem("urn:system").setCode("code1"));
try {
- ourClient.create().resource(qa).execute();
+ myClient.create().resource(qa).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Question with linkId[link0]"));
@@ -488,7 +500,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
// //@formatter:off
-// IIdType id3 = ourClient
+// IIdType id3 = myClient
// .update()
// .resource(pt)
// .conditionalByUrl("Patient?identifier=http://general-hospital.co.uk/Identifiers|09832345234543876876")
@@ -532,14 +544,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(400, response.getStatusLine().getStatusCode());
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString);
assertEquals("Can not create resource with ID \"2\", ID must not be supplied on a create (POST) operation (use an HTTP PUT / update operation if you wish to supply an ID)",
- oo.getIssue().get(0).getDiagnostics());
+ oo.getIssue().get(0).getDiagnostics());
} finally {
response.getEntity().getContent().close();
response.close();
}
}
-
+
@Test
public void testCreateWithForcedId() throws IOException {
String methodName = "testCreateWithForcedId";
@@ -548,7 +560,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p.addName().setFamily(methodName);
p.setId(methodName);
- IIdType optId = ourClient.update().resource(p).execute().getId();
+ IIdType optId = myClient.update().resource(p).execute().getId();
assertEquals(methodName, optId.getIdPart());
assertEquals("1", optId.getVersionIdPart());
}
@@ -557,12 +569,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testDeepChaining() {
Location l1 = new Location();
l1.getNameElement().setValue("testDeepChainingL1");
- IIdType l1id = ourClient.create().resource(l1).execute().getId();
+ IIdType l1id = myClient.create().resource(l1).execute().getId();
Location l2 = new Location();
l2.getNameElement().setValue("testDeepChainingL2");
l2.getPartOf().setReferenceElement(l1id.toVersionless().toUnqualified());
- IIdType l2id = ourClient.create().resource(l2).execute().getId();
+ IIdType l2id = myClient.create().resource(l2).execute().getId();
Encounter e1 = new Encounter();
e1.addIdentifier().setSystem("urn:foo").setValue("testDeepChainingE1");
@@ -570,10 +582,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
EncounterLocationComponent location = e1.addLocation();
location.getLocation().setReferenceElement(l2id.toUnqualifiedVersionless());
location.setPeriod(new Period().setStart(new Date(), TemporalPrecisionEnum.SECOND).setEnd(new Date(), TemporalPrecisionEnum.SECOND));
- IIdType e1id = ourClient.create().resource(e1).execute().getId();
+ IIdType e1id = myClient.create().resource(e1).execute().getId();
//@formatter:off
- Bundle res = ourClient.search()
+ Bundle res = myClient.search()
.forResource(Encounter.class)
.where(Encounter.IDENTIFIER.exactly().systemAndCode("urn:foo", "testDeepChainingE1"))
.include(Encounter.INCLUDE_LOCATION.asRecursive())
@@ -606,7 +618,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
try {
//@formatter:off
- ourClient
+ myClient
.delete()
.resourceConditionalByType(Patient.class)
.where(Patient.IDENTIFIER.exactly().code(methodName))
@@ -615,17 +627,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
fail();
} catch (PreconditionFailedException e) {
assertEquals("HTTP 412 Precondition Failed: Failed to DELETE resource with match URL \"Patient?identifier=testDeleteConditionalMultiple\" because this search matched 2 resources",
- e.getMessage());
+ e.getMessage());
}
// Not deleted yet..
- ourClient.read().resource("Patient").withId(id1).execute();
- ourClient.read().resource("Patient").withId(id2).execute();
+ myClient.read().resource("Patient").withId(id1).execute();
+ myClient.read().resource("Patient").withId(id2).execute();
myDaoConfig.setAllowMultipleDelete(true);
//@formatter:off
- IBaseOperationOutcome response = ourClient
+ IBaseOperationOutcome response = myClient
.delete()
.resourceConditionalByType(Patient.class)
.where(Patient.IDENTIFIER.exactly().code(methodName))
@@ -635,15 +647,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
String encoded = myFhirCtx.newXmlParser().encodeResourceToString(response);
ourLog.info(encoded);
assertThat(encoded, containsString(
- "
"));
+ "
"));
} finally {
IOUtils.closeQuietly(resp);
}
@@ -690,14 +702,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testDeleteNormal() {
Patient p = new Patient();
p.addName().setFamily("FAM");
- IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
- ourClient.read().resource(Patient.class).withId(id).execute();
+ myClient.read().resource(Patient.class).withId(id).execute();
- ourClient.delete().resourceById(id).execute();
+ myClient.delete().resourceById(id).execute();
try {
- ourClient.read().resource(Patient.class).withId(id).execute();
+ myClient.read().resource(Patient.class).withId(id).execute();
fail();
} catch (ResourceGoneException e) {
// good
@@ -836,9 +848,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testDeleteReturnsOperationOutcome() {
Patient p = new Patient();
p.addName().setFamily("FAM");
- IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
- IBaseOperationOutcome resp = ourClient.delete().resourceById(id).execute();
+ IBaseOperationOutcome resp = myClient.delete().resourceById(id).execute();
OperationOutcome oo = (OperationOutcome) resp;
assertThat(oo.getIssueFirstRep().getDiagnostics(), startsWith("Successfully deleted 1 resource(s) in "));
}
@@ -851,7 +863,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
myFhirCtx.getResourceDefinition(Practitioner.class);
myFhirCtx.getResourceDefinition(DocumentManifest.class);
- IGenericClient client = ourClient;
+ IGenericClient client = myClient;
int initialSize = client.search().forResource(DocumentManifest.class).returnBundle(Bundle.class).execute().getEntry().size();
@@ -869,7 +881,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
*/
@Test
public void testDocumentReferenceResources() throws Exception {
- IGenericClient client = ourClient;
+ IGenericClient client = myClient;
int initialSize = client.search().forResource(DocumentReference.class).returnBundle(Bundle.class).execute().getEntry().size();
@@ -886,13 +898,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testEmptySearch() throws Exception {
Bundle responseBundle;
- responseBundle = ourClient.search().forResource(Patient.class).returnBundle(Bundle.class).execute();
+ responseBundle = myClient.search().forResource(Patient.class).returnBundle(Bundle.class).execute();
assertEquals(0, responseBundle.getTotal());
- responseBundle = ourClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("AAA")).returnBundle(Bundle.class).execute();
+ responseBundle = myClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("AAA")).returnBundle(Bundle.class).execute();
assertEquals(0, responseBundle.getTotal());
- responseBundle = ourClient.search().forResource(Patient.class).where(new StringClientParam("_content").matches().value("AAA")).returnBundle(Bundle.class).execute();
+ responseBundle = myClient.search().forResource(Patient.class).where(new StringClientParam("_content").matches().value("AAA")).returnBundle(Bundle.class).execute();
assertEquals(0, responseBundle.getTotal());
}
@@ -904,55 +916,55 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization org1parent = new Organization();
org1parent.setId("org1parent");
org1parent.setName(methodName + "1parent");
- IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless();
Organization org1 = new Organization();
org1.setName(methodName + "1");
org1.getPartOf().setReferenceElement(orgId1parent);
- IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless();
Patient p = new Patient();
p.addName().setFamily(methodName);
p.getManagingOrganization().setReferenceElement(orgId1);
- IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
Organization org2 = new Organization();
org2.setName(methodName + "1");
- IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless();
Device dev = new Device();
dev.setModel(methodName);
dev.getOwner().setReferenceElement(orgId2);
- IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless();
+ IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless();
Location locParent = new Location();
locParent.setName(methodName + "Parent");
- IIdType locPId = ourClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless();
+ IIdType locPId = myClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless();
Location locChild = new Location();
locChild.setName(methodName);
locChild.getPartOf().setReferenceElement(locPId);
- IIdType locCId = ourClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless();
+ IIdType locCId = myClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless();
Encounter encU = new Encounter();
encU.getSubject().setReferenceElement(patientId);
encU.addLocation().getLocation().setReferenceElement(locCId);
- IIdType encUId = ourClient.create().resource(encU).execute().getId().toUnqualifiedVersionless();
+ IIdType encUId = myClient.create().resource(encU).execute().getId().toUnqualifiedVersionless();
Encounter enc = new Encounter();
enc.getSubject().setReferenceElement(patientId);
enc.addLocation().getLocation().setReferenceElement(locCId);
- IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless();
+ IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless();
Observation obs = new Observation();
obs.getSubject().setReferenceElement(patientId);
obs.getDevice().setReferenceElement(devId);
obs.getContext().setReferenceElement(encId);
- IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless();
+ IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless();
ourLog.info("IDs: EncU:" + encUId.getIdPart() + " Enc:" + encId.getIdPart() + " " + patientId.toUnqualifiedVersionless());
- Parameters output = ourClient.operation().onInstance(encId).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onInstance(encId).named("everything").withNoParameters(Parameters.class).execute();
Bundle b = (Bundle) output.getParameter().get(0).getResource();
List ids = toUnqualifiedVersionlessIds(b);
assertThat(ids, containsInAnyOrder(patientId, encId, orgId1, orgId2, orgId1parent, locPId, locCId, obsId, devId));
@@ -968,52 +980,52 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization org1parent = new Organization();
org1parent.setId("org1parent");
org1parent.setName(methodName + "1parent");
- IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless();
Organization org1 = new Organization();
org1.setName(methodName + "1");
org1.getPartOf().setReferenceElement(orgId1parent);
- IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless();
Patient p = new Patient();
p.addName().setFamily(methodName);
p.getManagingOrganization().setReferenceElement(orgId1);
- IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
Organization org2 = new Organization();
org2.setName(methodName + "1");
- IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless();
Device dev = new Device();
dev.setModel(methodName);
dev.getOwner().setReferenceElement(orgId2);
- IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless();
+ IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless();
Location locParent = new Location();
locParent.setName(methodName + "Parent");
- IIdType locPId = ourClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless();
+ IIdType locPId = myClient.create().resource(locParent).execute().getId().toUnqualifiedVersionless();
Location locChild = new Location();
locChild.setName(methodName);
locChild.getPartOf().setReferenceElement(locPId);
- IIdType locCId = ourClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless();
+ IIdType locCId = myClient.create().resource(locChild).execute().getId().toUnqualifiedVersionless();
Encounter encU = new Encounter();
encU.addIdentifier().setValue(methodName);
- IIdType encUId = ourClient.create().resource(encU).execute().getId().toUnqualifiedVersionless();
+ IIdType encUId = myClient.create().resource(encU).execute().getId().toUnqualifiedVersionless();
Encounter enc = new Encounter();
enc.getSubject().setReferenceElement(patientId);
enc.addLocation().getLocation().setReferenceElement(locCId);
- IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless();
+ IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless();
Observation obs = new Observation();
obs.getSubject().setReferenceElement(patientId);
obs.getDevice().setReferenceElement(devId);
obs.getContext().setReferenceElement(encId);
- IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless();
+ IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless();
- Parameters output = ourClient.operation().onType(Encounter.class).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onType(Encounter.class).named("everything").withNoParameters(Parameters.class).execute();
Bundle b = (Bundle) output.getParameter().get(0).getResource();
List ids = toUnqualifiedVersionlessIds(b);
assertThat(ids, containsInAnyOrder(patientId, encUId, encId, orgId1, orgId2, orgId1parent, locPId, locCId, obsId, devId));
@@ -1062,13 +1074,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
List actual;
StringAndListParam param;
- ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[] { ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart() });
+ ourLog.info("Pt1:{} Pt2:{} Obs1:{} Obs2:{} Obs3:{}", new Object[]{ptId1.getIdPart(), ptId2.getIdPart(), obsId1.getIdPart(), obsId2.getIdPart(), obsId3.getIdPart()});
param = new StringAndListParam();
param.addAnd(new StringOrListParam().addOr(new StringParam("obsvalue1")));
//@formatter:off
- Parameters response = ourClient
+ Parameters response = myClient
.operation()
.onInstance(ptId1)
.named("everything")
@@ -1090,7 +1102,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
IParser parser = myFhirCtx.newJsonParser();
b = parser.parseResource(Bundle.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/r4/bug147-bundle.json")));
- Bundle resp = ourClient.transaction().withBundle(b).execute();
+ Bundle resp = myClient.transaction().withBundle(b).execute();
List ids = new ArrayList();
for (BundleEntryComponent next : resp.getEntry()) {
IdType toAdd = new IdType(next.getResponse().getLocation()).toUnqualifiedVersionless();
@@ -1102,7 +1114,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals("Patient", patientId.getResourceType());
{
- Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute();
b = (Bundle) output.getParameter().get(0).getResource();
ids = new ArrayList();
@@ -1123,7 +1135,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
{
Parameters input = new Parameters();
input.addParameter().setName(Constants.PARAM_COUNT).setValue(new UnsignedIntType(100));
- Parameters output = ourClient.operation().onInstance(patientId).named("everything").withParameters(input).execute();
+ Parameters output = myClient.operation().onInstance(patientId).named("everything").withParameters(input).execute();
b = (Bundle) output.getParameter().get(0).getResource();
ids = new ArrayList();
@@ -1161,7 +1173,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
mo.setMedication(new Reference(medId));
IIdType moId = myMedicationRequestDao.create(mo, mySrd).getId().toUnqualifiedVersionless();
- Parameters output = ourClient.operation().onInstance(patId).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onInstance(patId).named("everything").withNoParameters(Parameters.class).execute();
Bundle b = (Bundle) output.getParameter().get(0).getResource();
List ids = toUnqualifiedVersionlessIds(b);
ourLog.info(ids.toString());
@@ -1182,14 +1194,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
c.getSubject().setReference("Patient/1");
b.addEntry().setResource(c).getRequest().setMethod(HTTPVerb.POST);
- Bundle resp = ourClient.transaction().withBundle(b).execute();
+ Bundle resp = myClient.transaction().withBundle(b).execute();
ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp));
IdType patientId = new IdType(resp.getEntry().get(0).getResponse().getLocation());
assertEquals("Patient", patientId.getResourceType());
- Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute();
b = (Bundle) output.getParameter().get(0).getResource();
List ids = new ArrayList();
@@ -1210,37 +1222,37 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization org1parent = new Organization();
org1parent.setId("org1parent");
org1parent.setName(methodName + "1parent");
- IIdType orgId1parent = ourClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId1parent = myClient.update().resource(org1parent).execute().getId().toUnqualifiedVersionless();
Organization org1 = new Organization();
org1.setName(methodName + "1");
org1.getPartOf().setReferenceElement(orgId1parent);
- IIdType orgId1 = ourClient.create().resource(org1).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId1 = myClient.create().resource(org1).execute().getId().toUnqualifiedVersionless();
Patient p = new Patient();
p.addName().setFamily(methodName);
p.getManagingOrganization().setReferenceElement(orgId1);
- IIdType patientId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType patientId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
Organization org2 = new Organization();
org2.setName(methodName + "1");
- IIdType orgId2 = ourClient.create().resource(org2).execute().getId().toUnqualifiedVersionless();
+ IIdType orgId2 = myClient.create().resource(org2).execute().getId().toUnqualifiedVersionless();
Device dev = new Device();
dev.setModel(methodName);
dev.getOwner().setReferenceElement(orgId2);
- IIdType devId = ourClient.create().resource(dev).execute().getId().toUnqualifiedVersionless();
+ IIdType devId = myClient.create().resource(dev).execute().getId().toUnqualifiedVersionless();
Observation obs = new Observation();
obs.getSubject().setReferenceElement(patientId);
obs.getDevice().setReferenceElement(devId);
- IIdType obsId = ourClient.create().resource(obs).execute().getId().toUnqualifiedVersionless();
+ IIdType obsId = myClient.create().resource(obs).execute().getId().toUnqualifiedVersionless();
Encounter enc = new Encounter();
enc.getSubject().setReferenceElement(patientId);
- IIdType encId = ourClient.create().resource(enc).execute().getId().toUnqualifiedVersionless();
+ IIdType encId = myClient.create().resource(enc).execute().getId().toUnqualifiedVersionless();
- Parameters output = ourClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onInstance(patientId).named("everything").withNoParameters(Parameters.class).execute();
Bundle b = (Bundle) output.getParameter().get(0).getResource();
List ids = toUnqualifiedVersionlessIds(b);
assertThat(ids, containsInAnyOrder(patientId, devId, obsId, encId, orgId1, orgId2, orgId1parent));
@@ -1254,32 +1266,32 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization o1 = new Organization();
o1.setName(methodName + "1");
- IIdType o1Id = ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
+ IIdType o1Id = myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
Organization o2 = new Organization();
o2.setName(methodName + "2");
- IIdType o2Id = ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless();
+ IIdType o2Id = myClient.create().resource(o2).execute().getId().toUnqualifiedVersionless();
Patient p1 = new Patient();
p1.addName().setFamily(methodName + "1");
p1.getManagingOrganization().setReferenceElement(o1Id);
- IIdType p1Id = ourClient.create().resource(p1).execute().getId().toUnqualifiedVersionless();
+ IIdType p1Id = myClient.create().resource(p1).execute().getId().toUnqualifiedVersionless();
Patient p2 = new Patient();
p2.addName().setFamily(methodName + "2");
p2.getManagingOrganization().setReferenceElement(o2Id);
- IIdType p2Id = ourClient.create().resource(p2).execute().getId().toUnqualifiedVersionless();
+ IIdType p2Id = myClient.create().resource(p2).execute().getId().toUnqualifiedVersionless();
Condition c1 = new Condition();
c1.getSubject().setReferenceElement(p1Id);
- IIdType c1Id = ourClient.create().resource(c1).execute().getId().toUnqualifiedVersionless();
+ IIdType c1Id = myClient.create().resource(c1).execute().getId().toUnqualifiedVersionless();
Condition c2 = new Condition();
c2.getSubject().setReferenceElement(p2Id);
- IIdType c2Id = ourClient.create().resource(c2).execute().getId().toUnqualifiedVersionless();
+ IIdType c2Id = myClient.create().resource(c2).execute().getId().toUnqualifiedVersionless();
Condition c3 = new Condition();
c3.addIdentifier().setValue(methodName + "3");
- IIdType c3Id = ourClient.create().resource(c3).execute().getId().toUnqualifiedVersionless();
+ IIdType c3Id = myClient.create().resource(c3).execute().getId().toUnqualifiedVersionless();
- Parameters output = ourClient.operation().onType(Patient.class).named("everything").withNoParameters(Parameters.class).execute();
+ Parameters output = myClient.operation().onType(Patient.class).named("everything").withNoParameters(Parameters.class).execute();
Bundle b = (Bundle) output.getParameter().get(0).getResource();
assertEquals(BundleType.SEARCHSET, b.getType());
@@ -1296,7 +1308,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization org = new Organization();
org.setName(methodName);
- IIdType oId = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless();
+ IIdType oId = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless();
long time1 = System.currentTimeMillis();
Thread.sleep(10);
@@ -1304,7 +1316,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p = new Patient();
p.addName().setFamily(methodName);
p.getManagingOrganization().setReferenceElement(oId);
- IIdType pId = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType pId = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
long time2 = System.currentTimeMillis();
Thread.sleep(10);
@@ -1312,7 +1324,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Condition c = new Condition();
c.getCode().setText(methodName);
c.getSubject().setReferenceElement(pId);
- IIdType cId = ourClient.create().resource(c).execute().getId().toUnqualifiedVersionless();
+ IIdType cId = myClient.create().resource(c).execute().getId().toUnqualifiedVersionless();
Thread.sleep(10);
long time3 = System.currentTimeMillis();
@@ -1334,7 +1346,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
get = new HttpGet(ourServerBase + "/Patient/" + pId.getIdPart() + "/$everything?_lastUpdated=%3E" + new InstantType(new Date(time2)).getValueAsString() + "&_lastUpdated=%3C"
- + new InstantType(new Date(time3)).getValueAsString());
+ + new InstantType(new Date(time3)).getValueAsString());
response = ourHttpClient.execute(get);
try {
assertEquals(200, response.getStatusLine().getStatusCode());
@@ -1406,14 +1418,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
mySystemDao.transaction(mySrd, inputBundle);
- Bundle responseBundle = ourClient
- .operation()
- .onInstance(new IdType("Patient/A161443"))
- .named("everything")
- .withParameter(Parameters.class, "_count", new IntegerType(20))
- .useHttpGet()
- .returnResourceType(Bundle.class)
- .execute();
+ Bundle responseBundle = myClient
+ .operation()
+ .onInstance(new IdType("Patient/A161443"))
+ .named("everything")
+ .withParameter(Parameters.class, "_count", new IntegerType(20))
+ .useHttpGet()
+ .returnResourceType(Bundle.class)
+ .execute();
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(responseBundle));
@@ -1434,7 +1446,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
String nextUrl = responseBundle.getLink("next").getUrl();
- responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl);
+ responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl);
for (int i = 0; i < responseBundle.getEntry().size(); i++) {
for (BundleEntryComponent nextEntry : responseBundle.getEntry()) {
idsSet.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue());
@@ -1442,7 +1454,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
nextUrl = responseBundle.getLink("next").getUrl();
- responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl);
+ responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl);
for (int i = 0; i < responseBundle.getEntry().size(); i++) {
for (BundleEntryComponent nextEntry : responseBundle.getEntry()) {
idsSet.add(nextEntry.getResource().getIdElement().toUnqualifiedVersionless().getValue());
@@ -1468,17 +1480,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testEverythingWithLargeSet2() throws Exception {
Patient p = new Patient();
p.setActive(true);
- IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
for (int i = 1; i < 77; i++) {
Observation obs = new Observation();
obs.setId("A" + StringUtils.leftPad(Integer.toString(i), 2, '0'));
obs.setSubject(new Reference(id));
- ourClient.update().resource(obs).execute();
+ myClient.update().resource(obs).execute();
}
- Bundle responseBundle = ourClient.operation().onInstance(id).named("everything").withParameter(Parameters.class, "_count", new IntegerType(50)).useHttpGet().returnResourceType(Bundle.class)
- .execute();
+ Bundle responseBundle = myClient.operation().onInstance(id).named("everything").withParameter(Parameters.class, "_count", new IntegerType(50)).useHttpGet().returnResourceType(Bundle.class)
+ .execute();
TreeSet ids = new TreeSet();
for (int i = 0; i < responseBundle.getEntry().size(); i++) {
@@ -1492,7 +1504,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
BundleLinkComponent nextLink = responseBundle.getLink("next");
while (nextLink != null) {
String nextUrl = nextLink.getUrl();
- responseBundle = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl);
+ responseBundle = myClient.fetchResourceFromUrl(Bundle.class, nextUrl);
for (int i = 0; i < responseBundle.getEntry().size(); i++) {
for (BundleEntryComponent nextEntry : responseBundle.getEntry()) {
ids.add(nextEntry.getResource().getIdElement().getIdPart());
@@ -1514,17 +1526,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testEverythingWithOnlyPatient() {
Patient p = new Patient();
p.setActive(true);
- IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
myFhirCtx.getRestfulClientFactory().setSocketTimeout(300 * 1000);
- Bundle response = ourClient
- .operation()
- .onInstance(id)
- .named("everything")
- .withNoParameters(Parameters.class)
- .returnResourceType(Bundle.class)
- .execute();
+ Bundle response = myClient
+ .operation()
+ .onInstance(id)
+ .named("everything")
+ .withNoParameters(Parameters.class)
+ .returnResourceType(Bundle.class)
+ .execute();
assertEquals(1, response.getEntry().size());
}
@@ -1557,38 +1569,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
}
- // private void delete(String theResourceType, String theParamName, String theParamValue) {
- // Bundle resources;
- // do {
- // IQuery forResource = ourClient.search().forResource(theResourceType);
- // if (theParamName != null) {
- // forResource = forResource.where(new StringClientParam(theParamName).matches().value(theParamValue));
- // }
- // resources = forResource.execute();
- // for (IResource next : resources.toListOfResources()) {
- // ourLog.info("Deleting resource: {}", next.getId());
- // ourClient.delete().resource(next).execute();
- // }
- // } while (resources.size() > 0);
- // }
- //
- // private void deleteToken(String theResourceType, String theParamName, String theParamSystem, String theParamValue)
- // {
- // Bundle resources = ourClient.search().forResource(theResourceType).where(new
- // TokenClientParam(theParamName).exactly().systemAndCode(theParamSystem, theParamValue)).execute();
- // for (IResource next : resources.toListOfResources()) {
- // ourLog.info("Deleting resource: {}", next.getId());
- // ourClient.delete().resource(next).execute();
- // }
- // }
-
@Test
public void testGetResourceCountsOperation() throws Exception {
String methodName = "testMetaOperations";
Patient pt = new Patient();
pt.addName().setFamily(methodName);
- ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
+ myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
HttpGet get = new HttpGet(ourServerBase + "/$get-resource-counts");
CloseableHttpResponse response = ourHttpClient.execute(get);
@@ -1603,6 +1590,31 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
}
+ // private void delete(String theResourceType, String theParamName, String theParamValue) {
+ // Bundle resources;
+ // do {
+ // IQuery forResource = myClient.search().forResource(theResourceType);
+ // if (theParamName != null) {
+ // forResource = forResource.where(new StringClientParam(theParamName).matches().value(theParamValue));
+ // }
+ // resources = forResource.execute();
+ // for (IResource next : resources.toListOfResources()) {
+ // ourLog.info("Deleting resource: {}", next.getId());
+ // myClient.delete().resource(next).execute();
+ // }
+ // } while (resources.size() > 0);
+ // }
+ //
+ // private void deleteToken(String theResourceType, String theParamName, String theParamSystem, String theParamValue)
+ // {
+ // Bundle resources = myClient.search().forResource(theResourceType).where(new
+ // TokenClientParam(theParamName).exactly().systemAndCode(theParamSystem, theParamValue)).execute();
+ // for (IResource next : resources.toListOfResources()) {
+ // ourLog.info("Deleting resource: {}", next.getId());
+ // myClient.delete().resource(next).execute();
+ // }
+ // }
+
@Test
public void testHasParameter() throws Exception {
IIdType pid0;
@@ -1639,7 +1651,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
List ids = searchAndReturnUnqualifiedVersionlessIdValues(uri);
assertThat(ids, contains(pid0.getValue()));
}
-
+
@Test
public void testHasParameterNoResults() throws Exception {
@@ -1704,12 +1716,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient patient = new Patient();
patient.addName().setFamily(methodName);
- IIdType id = ourClient.create().resource(patient).execute().getId().toVersionless();
- ourClient.delete().resourceById(id).execute();
+ IIdType id = myClient.create().resource(patient).execute().getId().toVersionless();
+ myClient.delete().resourceById(id).execute();
patient.setId(id);
- ourClient.update().resource(patient).execute();
+ myClient.update().resource(patient).execute();
- Bundle history = ourClient.history().onInstance(id).andReturnBundle(Bundle.class).prettyPrint().summaryMode(SummaryEnum.DATA).execute();
+ Bundle history = myClient.history().onInstance(id).andReturnBundle(Bundle.class).prettyPrint().summaryMode(SummaryEnum.DATA).execute();
assertEquals(3, history.getEntry().size());
assertEquals(id.withVersion("3").getValue(), history.getEntry().get(0).getResource().getId());
assertEquals(1, ((Patient) history.getEntry().get(0).getResource()).getName().size());
@@ -1810,9 +1822,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(400, response.getStatusLine().getStatusCode());
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, respString);
assertEquals(
- "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"AAA\" does not match URL ID of \""
- + id.getIdPart() + "\"",
- oo.getIssue().get(0).getDiagnostics());
+ "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"AAA\" does not match URL ID of \""
+ + id.getIdPart() + "\"",
+ oo.getIssue().get(0).getDiagnostics());
} finally {
response.close();
}
@@ -1824,7 +1836,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
*/
@Test
public void testImagingStudyResources() throws Exception {
- IGenericClient client = ourClient;
+ IGenericClient client = myClient;
int initialSize = client.search().forResource(ImagingStudy.class).returnBundle(Bundle.class).execute().getEntry().size();
@@ -1843,9 +1855,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p = new Patient();
p.getManagingOrganization().setReference("http://example.com/Organization/123");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
- Bundle b = ourClient.search().forResource("Patient").include(Patient.INCLUDE_ORGANIZATION).returnBundle(Bundle.class).execute();
+ Bundle b = myClient.search().forResource("Patient").include(Patient.INCLUDE_ORGANIZATION).returnBundle(Bundle.class).execute();
assertEquals(1, b.getEntry().size());
}
@@ -1853,18 +1865,18 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testMetaOperationWithNoMetaParameter() throws Exception {
Patient p = new Patient();
p.addName().setFamily("testMetaAddInvalid");
- IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
//@formatter:off
String input = "\n" +
- " \n" +
- " \n" +
- " \n" +
- " \n" +
- " \n" +
- "
\n" +
- " \n" +
- "";
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ " \n" +
+ "
\n" +
+ " \n" +
+ "";
//@formatter:on
HttpPost post = new HttpPost(ourServerBase + "/Patient/" + id.getIdPart() + "/$meta-add");
@@ -1899,19 +1911,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient pt = new Patient();
pt.addName().setFamily(methodName);
- IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
- Meta meta = ourClient.meta().get(Meta.class).fromResource(id).execute();
+ Meta meta = myClient.meta().get(Meta.class).fromResource(id).execute();
assertEquals(0, meta.getTag().size());
Meta inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
- meta = ourClient.meta().add().onResource(id).meta(inMeta).execute();
+ meta = myClient.meta().add().onResource(id).meta(inMeta).execute();
assertEquals(1, meta.getTag().size());
inMeta = new Meta();
inMeta.addTag().setSystem("urn:system1").setCode("urn:code1");
- meta = ourClient.meta().delete().onResource(id).meta(inMeta).execute();
+ meta = myClient.meta().delete().onResource(id).meta(inMeta).execute();
assertEquals(0, meta.getTag().size());
}
@@ -1937,14 +1949,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
StructureDefinition p = new StructureDefinition();
p.setAbstract(true);
p.setUrl("http://example.com/foo");
- IIdType id = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
- Bundle resp = ourClient
- .search()
- .forResource(StructureDefinition.class)
- .where(StructureDefinition.URL.matches().value("http://example.com/foo"))
- .returnBundle(Bundle.class)
- .execute();
+ Bundle resp = myClient
+ .search()
+ .forResource(StructureDefinition.class)
+ .where(StructureDefinition.URL.matches().value("http://example.com/foo"))
+ .returnBundle(Bundle.class)
+ .execute();
assertEquals(1, resp.getTotal());
}
@@ -1966,7 +1978,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10);
mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true);
- Bundle response = ourClient
+ Bundle response = myClient
.operation()
.onInstance(new IdType(pid))
.named("everything")
@@ -1984,7 +1996,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
// Load page 2
String nextUrl = response.getLink("next").getUrl();
- response = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl);
+ response = myClient.fetchResourceFromUrl(Bundle.class, nextUrl);
assertEquals(10, response.getEntry().size());
if (response.getTotalElement().getValueAsString() != null) {
@@ -1996,7 +2008,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Thread.sleep(2000);
nextUrl = response.getLink("next").getUrl();
- response = ourClient.fetchResourceFromUrl(Bundle.class, nextUrl);
+ response = myClient.fetchResourceFromUrl(Bundle.class, nextUrl);
assertEquals(1, response.getEntry().size());
assertEquals("21", response.getTotalElement().getValueAsString());
@@ -2023,7 +2035,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10);
mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true);
- Bundle response = ourClient
+ Bundle response = myClient
.operation()
.onInstance(new IdType(pid))
.named("everything")
@@ -2063,7 +2075,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
response.close();
}
- Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
+ Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
assertEquals("2", newPt.getIdElement().getVersionIdPart());
assertEquals(false, newPt.getActive());
}
@@ -2094,7 +2106,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
response.close();
}
- Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
+ Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
assertEquals("1", newPt.getIdElement().getVersionIdPart());
assertEquals(true, newPt.getActive());
}
@@ -2125,7 +2137,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
response.close();
}
- Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
+ Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
assertEquals("2", newPt.getIdElement().getVersionIdPart());
assertEquals(false, newPt.getActive());
}
@@ -2156,7 +2168,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
response.close();
}
- Patient newPt = ourClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
+ Patient newPt = myClient.read().resource(Patient.class).withId(pid1.getIdPart()).execute();
assertEquals("2", newPt.getIdElement().getVersionIdPart());
assertEquals(false, newPt.getActive());
}
@@ -2165,25 +2177,25 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testPreserveVersionsOnAuditEvent() {
Organization org = new Organization();
org.setName("ORG");
- IIdType orgId = ourClient.create().resource(org).execute().getId();
+ IIdType orgId = myClient.create().resource(org).execute().getId();
assertEquals("1", orgId.getVersionIdPart());
Patient patient = new Patient();
patient.addIdentifier().setSystem("http://uhn.ca/mrns").setValue("100");
patient.getManagingOrganization().setReference(orgId.toUnqualified().getValue());
- IIdType patientId = ourClient.create().resource(patient).execute().getId();
+ IIdType patientId = myClient.create().resource(patient).execute().getId();
assertEquals("1", patientId.getVersionIdPart());
AuditEvent ae = new org.hl7.fhir.r4.model.AuditEvent();
ae.addEntity().getReference().setReference(patientId.toUnqualified().getValue());
- IIdType aeId = ourClient.create().resource(ae).execute().getId();
+ IIdType aeId = myClient.create().resource(ae).execute().getId();
assertEquals("1", aeId.getVersionIdPart());
- patient = ourClient.read().resource(Patient.class).withId(patientId).execute();
+ patient = myClient.read().resource(Patient.class).withId(patientId).execute();
assertTrue(patient.getManagingOrganization().getReferenceElement().hasIdPart());
assertFalse(patient.getManagingOrganization().getReferenceElement().hasVersionIdPart());
- ae = ourClient.read().resource(AuditEvent.class).withId(aeId).execute();
+ ae = myClient.read().resource(AuditEvent.class).withId(aeId).execute();
assertTrue(ae.getEntityFirstRep().getReference().getReferenceElement().hasIdPart());
assertTrue(ae.getEntityFirstRep().getReference().getReferenceElement().hasVersionIdPart());
@@ -2194,7 +2206,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
*/
@Test
public void testProcedureRequestResources() throws Exception {
- IGenericClient client = ourClient;
+ IGenericClient client = myClient;
int initialSize = client.search().forResource(ProcedureRequest.class).returnBundle(Bundle.class).execute().getEntry().size();
@@ -2218,19 +2230,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
pat = new Patient();
pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_01");
- ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
+ myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
pat = new Patient();
pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_02");
- ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
+ myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
{
- Bundle returned = ourClient.search().forResource(Patient.class).encodedXml().returnBundle(Bundle.class).execute();
+ Bundle returned = myClient.search().forResource(Patient.class).encodedXml().returnBundle(Bundle.class).execute();
assertThat(returned.getEntry().size(), greaterThan(1));
assertEquals(BundleType.SEARCHSET, returned.getType());
}
{
- Bundle returned = ourClient.search().forResource(Patient.class).encodedJson().returnBundle(Bundle.class).execute();
+ Bundle returned = myClient.search().forResource(Patient.class).encodedJson().returnBundle(Bundle.class).execute();
assertThat(returned.getEntry().size(), greaterThan(1));
}
}
@@ -2242,9 +2254,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p1.getText().getDiv().setValueAsString("HELLO WORLD
");
p1.addIdentifier().setSystem("urn:system").setValue("testSaveAndRetrieveExistingNarrative01");
- IIdType newId = ourClient.create().resource(p1).encodedJson().execute().getId();
+ IIdType newId = myClient.create().resource(p1).encodedJson().execute().getId();
- Patient actual = ourClient.read().resource(Patient.class).withId(newId).encodedJson().execute();
+ Patient actual = myClient.read().resource(Patient.class).withId(newId).encodedJson().execute();
assertEquals("HELLO WORLD
", actual.getText().getDiv().getValueAsString());
}
@@ -2255,9 +2267,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p1.getText().getDiv().setValueAsString("HELLO WORLD
");
p1.addIdentifier().setSystem("urn:system").setValue("testSaveAndRetrieveExistingNarrative01");
- IIdType newId = ourClient.create().resource(p1).encodedXml().execute().getId();
+ IIdType newId = myClient.create().resource(p1).encodedXml().execute().getId();
- Patient actual = ourClient.read().resource(Patient.class).withId(newId).encodedXml().execute();
+ Patient actual = myClient.read().resource(Patient.class).withId(newId).encodedXml().execute();
assertEquals("HELLO WORLD
", actual.getText().getDiv().getValueAsString());
}
@@ -2266,13 +2278,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient nextPatient = new Patient();
nextPatient.setId("Patient/B");
nextPatient
- .addExtension()
- .setUrl("http://foo")
- .setValue(new Reference("Practitioner/A"));
+ .addExtension()
+ .setUrl("http://foo")
+ .setValue(new Reference("Practitioner/A"));
- ourClient.update().resource(nextPatient).execute();
+ myClient.update().resource(nextPatient).execute();
- Patient p = ourClient.read().resource(Patient.class).withId("B").execute();
+ Patient p = myClient.read().resource(Patient.class).withId("B").execute();
String encoded = myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(p);
ourLog.info(encoded);
@@ -2290,19 +2302,19 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p1.getManagingOrganization().setResource(o1);
- IIdType newId = ourClient.create().resource(p1).execute().getId();
+ IIdType newId = myClient.create().resource(p1).execute().getId();
- Patient actual = ourClient.read(Patient.class, new UriDt(newId.getValue()));
+ Patient actual = myClient.read(Patient.class, new UriDt(newId.getValue()));
assertEquals(1, actual.getContained().size());
//@formatter:off
- Bundle b = ourClient
- .search()
- .forResource("Patient")
- .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system:rpdstu2", "testSaveAndRetrieveWithContained01"))
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ Bundle b = myClient
+ .search()
+ .forResource("Patient")
+ .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system:rpdstu2", "testSaveAndRetrieveWithContained01"))
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
assertEquals(1, b.getEntry().size());
@@ -2314,9 +2326,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p1.getText().setDivAsString("Identifier | testSearchByResourceChain01 | ");
p1.addIdentifier().setSystem("urn:system").setValue("testSearchByResourceChain01");
- IdType newId = (IdType) ourClient.create().resource(p1).execute().getId();
+ IdType newId = (IdType) myClient.create().resource(p1).execute().getId();
- Patient actual = ourClient.read(Patient.class, newId.getIdPart());
+ Patient actual = myClient.read(Patient.class, newId.getIdPart());
assertThat(actual.getText().getDiv().getValueAsString(), containsString("Identifier | testSearchByResourceChain01 | "));
}
@@ -2382,68 +2394,68 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Bundle found;
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().systemAndValues(null, id1.getIdPart(), id2.getIdPart()))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().systemAndValues(null, id1.getIdPart(), id2.getIdPart()))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2));
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().systemAndValues(null, Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO")))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().systemAndValues(null, Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO")))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2));
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().systemAndCode(null, id1.getIdPart()))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().systemAndCode(null, id1.getIdPart()))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1));
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart()))
- .and(BaseResource.RES_ID.exactly().code(id1.getIdPart()))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart()))
+ .and(BaseResource.RES_ID.exactly().code(id1.getIdPart()))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1));
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().codes(Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO")))
- .and(BaseResource.RES_ID.exactly().code(id1.getIdPart()))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().codes(Arrays.asList(id1.getIdPart(), id2.getIdPart(), "FOOOOO")))
+ .and(BaseResource.RES_ID.exactly().code(id1.getIdPart()))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1));
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart(), "FOOO"))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().codes(id1.getIdPart(), id2.getIdPart(), "FOOO"))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), containsInAnyOrder(id1, id2));
- found = ourClient
- .search()
- .forResource(Patient.class)
- .where(BaseResource.RES_ID.exactly().codes("FOOO"))
- .returnBundle(Bundle.class)
- .execute();
+ found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(BaseResource.RES_ID.exactly().codes("FOOO"))
+ .returnBundle(Bundle.class)
+ .execute();
assertThat(toUnqualifiedVersionlessIds(found), empty());
@@ -2454,22 +2466,22 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testSearchByIdentifier01");
p1.addName().setFamily("testSearchByIdentifierFamily01").addGiven("testSearchByIdentifierGiven01");
- IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId();
+ IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId();
Patient p2 = new Patient();
p2.addIdentifier().setSystem("urn:system").setValue("testSearchByIdentifier02");
p2.addName().setFamily("testSearchByIdentifierFamily01").addGiven("testSearchByIdentifierGiven02");
- ourClient.create().resource(p2).execute().getId();
+ myClient.create().resource(p2).execute().getId();
//@formatter:off
- Bundle actual = ourClient
- .search()
- .forResource(Patient.class)
- .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testSearchByIdentifier01"))
- .encodedJson()
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ Bundle actual = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testSearchByIdentifier01"))
+ .encodedJson()
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
assertEquals(1, actual.getEntry().size());
@@ -2483,17 +2495,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p1 = new Patient();
p1.addIdentifier().setValue("testSearchByIdentifierWithoutSystem01");
- IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId();
+ IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId();
//@formatter:off
- Bundle actual = ourClient
- .search()
- .forResource(Patient.class)
- .where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01"))
- .encodedJson()
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ Bundle actual = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(Patient.IDENTIFIER.exactly().systemAndCode(null, "testSearchByIdentifierWithoutSystem01"))
+ .encodedJson()
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
assertEquals(1, actual.getEntry().size());
assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());
@@ -2505,16 +2517,16 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
String methodName = "testSearchByLastUpdated";
Patient p = new Patient();
- p.addName().setFamily(methodName+"1");
- IIdType pid1 = ourClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
+ p.addName().setFamily(methodName + "1");
+ IIdType pid1 = myClient.create().resource(p).execute().getId().toUnqualifiedVersionless();
Thread.sleep(10);
long time1 = System.currentTimeMillis();
Thread.sleep(10);
Patient p2 = new Patient();
- p2.addName().setFamily(methodName+"2");
- IIdType pid2 = ourClient.create().resource(p2).execute().getId().toUnqualifiedVersionless();
+ p2.addName().setFamily(methodName + "2");
+ IIdType pid2 = myClient.create().resource(p2).execute().getId().toUnqualifiedVersionless();
HttpGet get = new HttpGet(ourServerBase + "/Patient?_lastUpdated=lt" + new InstantType(new Date(time1)).getValueAsString());
CloseableHttpResponse response = ourHttpClient.execute(get);
@@ -2550,28 +2562,28 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testSearchByReferenceIds() {
Organization o1 = new Organization();
o1.setName("testSearchByResourceChainName01");
- IIdType o1id = ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
+ IIdType o1id = myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
Organization o2 = new Organization();
o2.setName("testSearchByResourceChainName02");
- IIdType o2id = ourClient.create().resource(o2).execute().getId().toUnqualifiedVersionless();
+ IIdType o2id = myClient.create().resource(o2).execute().getId().toUnqualifiedVersionless();
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testSearchByReferenceIds01");
p1.addName().setFamily("testSearchByReferenceIdsFamily01").addGiven("testSearchByReferenceIdsGiven01");
p1.setManagingOrganization(new Reference(o1id.toUnqualifiedVersionless()));
- IIdType p1Id = ourClient.create().resource(p1).execute().getId();
+ IIdType p1Id = myClient.create().resource(p1).execute().getId();
Patient p2 = new Patient();
p2.addIdentifier().setSystem("urn:system").setValue("testSearchByReferenceIds02");
p2.addName().setFamily("testSearchByReferenceIdsFamily02").addGiven("testSearchByReferenceIdsGiven02");
p2.setManagingOrganization(new Reference(o2id.toUnqualifiedVersionless()));
- IIdType p2Id = ourClient.create().resource(p2).execute().getId();
+ IIdType p2Id = myClient.create().resource(p2).execute().getId();
//@formatter:off
- Bundle actual = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.ORGANIZATION.hasAnyOfIds(Arrays.asList(o1id.getIdPart(), o2id.getIdPart())))
- .encodedJson().prettyPrint().returnBundle(Bundle.class).execute();
+ Bundle actual = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.ORGANIZATION.hasAnyOfIds(Arrays.asList(o1id.getIdPart(), o2id.getIdPart())))
+ .encodedJson().prettyPrint().returnBundle(Bundle.class).execute();
//@formatter:on
Set expectedIds = new HashSet();
expectedIds.add(p1Id.getIdPart());
@@ -2588,28 +2600,28 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization o1 = new Organization();
o1.setName("testSearchByResourceChainName01");
- IdType o1id = (IdType) ourClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
+ IdType o1id = (IdType) myClient.create().resource(o1).execute().getId().toUnqualifiedVersionless();
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testSearchByResourceChain01");
p1.addName().setFamily("testSearchByResourceChainFamily01").addGiven("testSearchByResourceChainGiven01");
p1.setManagingOrganization(new Reference(o1id.toUnqualifiedVersionless()));
- IdType p1Id = (IdType) ourClient.create().resource(p1).execute().getId();
+ IdType p1Id = (IdType) myClient.create().resource(p1).execute().getId();
//@formatter:off
- Bundle actual = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.ORGANIZATION.hasId(o1id.getIdPart()))
- .encodedJson().prettyPrint().returnBundle(Bundle.class).execute();
+ Bundle actual = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.ORGANIZATION.hasId(o1id.getIdPart()))
+ .encodedJson().prettyPrint().returnBundle(Bundle.class).execute();
//@formatter:on
assertEquals(1, actual.getEntry().size());
assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());
//@formatter:off
- actual = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.ORGANIZATION.hasId(o1id.getValue()))
- .encodedJson().prettyPrint().returnBundle(Bundle.class).execute();
+ actual = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.ORGANIZATION.hasId(o1id.getValue()))
+ .encodedJson().prettyPrint().returnBundle(Bundle.class).execute();
//@formatter:on
assertEquals(1, actual.getEntry().size());
assertEquals(p1Id.getIdPart(), actual.getEntry().get(0).getResource().getIdElement().getIdPart());
@@ -2651,14 +2663,14 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue("001");
patient.addName().setFamily(methodName).addGiven("Joe");
- id1a = (IdType) ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
+ id1a = (IdType) myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
}
IIdType id1b;
{
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue("002");
patient.addName().setFamily(methodName + "XXXX").addGiven("Joe");
- id1b = (IdType) ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
+ id1b = (IdType) myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
}
Thread.sleep(1100);
@@ -2670,40 +2682,40 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system").setValue("002");
patient.addName().setFamily(methodName).addGiven("John");
- id2 = (IdType) ourClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
+ id2 = (IdType) myClient.create().resource(patient).execute().getId().toUnqualifiedVersionless();
}
{
//@formatter:off
- Bundle found = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
List patients = toUnqualifiedVersionlessIds(found);
assertThat(patients, hasItems(id1a, id1b, id2));
}
{
//@formatter:off
- Bundle found = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
- .lastUpdated(new DateRangeParam(beforeAny, null))
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
+ .lastUpdated(new DateRangeParam(beforeAny, null))
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
List patients = toUnqualifiedVersionlessIds(found);
assertThat(patients, hasItems(id1a, id1b, id2));
}
{
//@formatter:off
- Bundle found = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
- .lastUpdated(new DateRangeParam(beforeR2, null))
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
+ .lastUpdated(new DateRangeParam(beforeR2, null))
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
List patients = toUnqualifiedVersionlessIds(found);
assertThat(patients, hasItems(id2));
@@ -2711,12 +2723,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
{
//@formatter:off
- Bundle found = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
- .lastUpdated(new DateRangeParam(beforeAny, beforeR2))
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
+ .lastUpdated(new DateRangeParam(beforeAny, beforeR2))
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
List patients = toUnqualifiedVersionlessIds(found);
assertThat(patients.toString(), patients, not(hasItems(id2)));
@@ -2724,12 +2736,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
{
//@formatter:off
- Bundle found = ourClient.search()
- .forResource(Patient.class)
- .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
- .lastUpdated(new DateRangeParam(null, beforeR2))
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient.search()
+ .forResource(Patient.class)
+ .where(Patient.NAME.matches().value("testSearchLastUpdatedParamRp"))
+ .lastUpdated(new DateRangeParam(null, beforeR2))
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
List patients = toUnqualifiedVersionlessIds(found);
assertThat(patients, (hasItems(id1a, id1b)));
@@ -2809,7 +2821,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
List linkNext = Lists.newArrayList();
for (int i = 0; i < 100; i++) {
- Bundle bundle = ourClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("testSearchPagingKeepsOldSearches")).count(5).returnBundle(Bundle.class).execute();
+ Bundle bundle = myClient.search().forResource(Patient.class).where(Patient.NAME.matches().value("testSearchPagingKeepsOldSearches")).count(5).returnBundle(Bundle.class).execute();
assertTrue(isNotBlank(bundle.getLink("next").getUrl()));
assertEquals(5, bundle.getEntry().size());
linkNext.add(bundle.getLink("next").getUrl());
@@ -2818,7 +2830,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
int index = 0;
for (String nextLink : linkNext) {
ourLog.info("Fetching index {}", index++);
- Bundle b = ourClient.fetchResourceFromUrl(Bundle.class, nextLink);
+ Bundle b = myClient.fetchResourceFromUrl(Bundle.class, nextLink);
assertEquals(5, b.getEntry().size());
}
}
@@ -2842,12 +2854,12 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Thread.sleep(1);
//@formatter:off
- Bundle found = ourClient
- .search()
- .forResource(Patient.class)
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient
+ .search()
+ .forResource(Patient.class)
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
Thread.sleep(1);
@@ -2871,23 +2883,23 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
org.setName("HELLO");
resources.add(org);
}
- ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
+ myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
myDaoConfig.setReuseCachedSearchResultsForMillis(1000L);
- Bundle result1 = ourClient
- .search()
- .forResource("Organization")
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result1 = myClient
+ .search()
+ .forResource("Organization")
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid1 = toSearchUuidFromLinkNext(result1);
- Bundle result2 = ourClient
- .search()
- .forResource("Organization")
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result2 = myClient
+ .search()
+ .forResource("Organization")
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid2 = toSearchUuidFromLinkNext(result2);
@@ -2902,37 +2914,37 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
org.setName("HELLO");
resources.add(org);
}
- ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
+ myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
myDaoConfig.setReuseCachedSearchResultsForMillis(null);
- Bundle result1 = ourClient
- .search()
- .forResource("Organization")
- .where(Organization.NAME.matches().value("HELLO"))
- .count(5)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result1 = myClient
+ .search()
+ .forResource("Organization")
+ .where(Organization.NAME.matches().value("HELLO"))
+ .count(5)
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid1 = toSearchUuidFromLinkNext(result1);
- Bundle result2 = ourClient
- .search()
- .forResource("Organization")
- .where(Organization.NAME.matches().value("HELLO"))
- .count(5)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result2 = myClient
+ .search()
+ .forResource("Organization")
+ .where(Organization.NAME.matches().value("HELLO"))
+ .count(5)
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid2 = toSearchUuidFromLinkNext(result2);
- Bundle result3 = ourClient
- .search()
- .forResource("Organization")
- .where(Organization.NAME.matches().value("HELLO"))
- .count(5)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result3 = myClient
+ .search()
+ .forResource("Organization")
+ .where(Organization.NAME.matches().value("HELLO"))
+ .count(5)
+ .returnBundle(Bundle.class)
+ .execute();
String uuid3 = toSearchUuidFromLinkNext(result3);
@@ -2948,17 +2960,17 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
org.setName("HELLO");
resources.add(org);
}
- ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
+ myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
myDaoConfig.setReuseCachedSearchResultsForMillis(1000L);
- Bundle result1 = ourClient
- .search()
- .forResource("Organization")
- .where(Organization.NAME.matches().value("HELLO"))
- .count(5)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result1 = myClient
+ .search()
+ .forResource("Organization")
+ .where(Organization.NAME.matches().value("HELLO"))
+ .count(5)
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid1 = toSearchUuidFromLinkNext(result1);
Search search1 = newTxTemplate().execute(new TransactionCallback() {
@@ -2969,13 +2981,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
});
Date lastReturned1 = search1.getSearchLastReturned();
- Bundle result2 = ourClient
- .search()
- .forResource("Organization")
- .where(Organization.NAME.matches().value("HELLO"))
- .count(5)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result2 = myClient
+ .search()
+ .forResource("Organization")
+ .where(Organization.NAME.matches().value("HELLO"))
+ .count(5)
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid2 = toSearchUuidFromLinkNext(result2);
Search search2 = newTxTemplate().execute(new TransactionCallback() {
@@ -2990,13 +3002,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Thread.sleep(1500);
- Bundle result3 = ourClient
- .search()
- .forResource("Organization")
- .where(Organization.NAME.matches().value("HELLO"))
- .count(5)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result3 = myClient
+ .search()
+ .forResource("Organization")
+ .where(Organization.NAME.matches().value("HELLO"))
+ .count(5)
+ .returnBundle(Bundle.class)
+ .execute();
String uuid3 = toSearchUuidFromLinkNext(result3);
@@ -3012,15 +3024,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
org.setName("HELLO");
resources.add(org);
}
- ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
+ myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
myDaoConfig.setReuseCachedSearchResultsForMillis(100000L);
- Bundle result1 = ourClient
- .search()
- .forResource("Organization")
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result1 = myClient
+ .search()
+ .forResource("Organization")
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid1 = toSearchUuidFromLinkNext(result1);
Search search1 = newTxTemplate().execute(new TransactionCallback() {
@@ -3031,11 +3043,11 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
});
Date lastReturned1 = search1.getSearchLastReturned();
- Bundle result2 = ourClient
- .search()
- .forResource("Organization")
- .returnBundle(Bundle.class)
- .execute();
+ Bundle result2 = myClient
+ .search()
+ .forResource("Organization")
+ .returnBundle(Bundle.class)
+ .execute();
final String uuid2 = toSearchUuidFromLinkNext(result2);
Search search2 = newTxTemplate().execute(new TransactionCallback() {
@@ -3059,34 +3071,28 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient patient = new Patient();
patient.addIdentifier().setSystem("urn:system2").setValue("testSearchTokenParam002");
patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2");
- ourClient.create().resource(patient).execute();
+ myClient.create().resource(patient).execute();
- //@formatter:off
- Bundle response = ourClient
- .search()
- .forResource(Patient.class)
- .returnBundle(Bundle.class)
- .execute();
- //@formatter:on
+ Bundle response = myClient
+ .search()
+ .forResource(Patient.class)
+ .returnBundle(Bundle.class)
+ .execute();
patient = (Patient) response.getEntry().get(0).getResource();
- //@formatter:off
- ourClient
+ myClient
.meta()
.add()
.onResource(patient.getIdElement())
.meta(new Meta().addTag("http://system", "tag1", "display"))
.execute();
- //@formatter:on
- //@formatter:off
- response = ourClient
- .search()
- .forResource(Patient.class)
- .returnBundle(Bundle.class)
- .execute();
- //@formatter:on
+ response = myClient
+ .search()
+ .forResource(Patient.class)
+ .returnBundle(Bundle.class)
+ .execute();
patient = (Patient) response.getEntry().get(0).getResource();
assertEquals(1, patient.getMeta().getTag().size());
@@ -3098,7 +3104,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
patient.addIdentifier().setSystem("urn:system").setValue("testSearchTokenParam001");
patient.addName().setFamily("Tester").addGiven("testSearchTokenParam1");
patient.addCommunication().getLanguage().setText("testSearchTokenParamComText").addCoding().setCode("testSearchTokenParamCode").setSystem("testSearchTokenParamSystem")
- .setDisplay("testSearchTokenParamDisplay");
+ .setDisplay("testSearchTokenParamDisplay");
myPatientDao.create(patient, mySrd);
patient = new Patient();
@@ -3111,25 +3117,116 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
patient.addName().setFamily("Tester").addGiven("testSearchTokenParam2");
myPatientDao.create(patient, mySrd);
- //@formatter:off
- Bundle response = ourClient
- .search()
- .forResource(Patient.class)
- .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:system"))
- .returnBundle(Bundle.class)
- .execute();
- //@formatter:on
+ Bundle response = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(Patient.IDENTIFIER.hasSystemWithAnyCode("urn:system"))
+ .returnBundle(Bundle.class)
+ .execute();
assertEquals(2, response.getEntry().size());
}
+ @Test
+ public void testSearchWithCountNotSet() throws Exception {
+ mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
+ mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200);
+
+ for (int i = 0; i < 10; i++) {
+ Patient pat = new Patient();
+ pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
+ myClient.create().resource(pat).execute();
+ }
+
+ StopWatch sw = new StopWatch();
+
+ ourLog.info("** About to search with count of 1");
+
+ Bundle found = myClient
+ .search()
+ .forResource(Patient.class)
+ .returnBundle(Bundle.class)
+ .count(1)
+ .execute();
+
+ ourLog.info("** Done searching with count of 1");
+
+ ourLog.info(myCapturingInterceptor.getLastResponse().getAllHeaders().toString());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), Matchers.empty());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE.toLowerCase()),Matchers.empty());
+
+ // If this fails under load, try increasing the throttle above
+ assertEquals(null, found.getTotalElement().getValue());
+ assertEquals(1, found.getEntry().size());
+ assertThat(sw.getMillis(), lessThan(1000L));
+
+ }
+
+ @Test
+ public void testSearchWithCountSearchResultsUpTo20() throws Exception {
+ mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
+ mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200);
+ myDaoConfig.setCountSearchResultsUpTo(20);
+
+ for (int i = 0; i < 10; i++) {
+ Patient pat = new Patient();
+ pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
+ myClient.create().resource(pat).execute();
+ }
+
+ StopWatch sw = new StopWatch();
+
+ Bundle found = myClient
+ .search()
+ .forResource(Patient.class)
+ .returnBundle(Bundle.class)
+ .count(1)
+ .execute();
+
+ assertThat(sw.getMillis(), not(lessThan(1000L)));
+
+ // If this fails under load, try increasing the throttle above
+ assertEquals(10, found.getTotalElement().getValue().intValue());
+ assertEquals(1, found.getEntry().size());
+ }
+
+ @Test
+ public void testSearchWithCountSearchResultsUpTo5() throws Exception {
+ mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(1);
+ mySearchCoordinatorSvcRaw.setLoadingThrottleForUnitTests(200);
+ myDaoConfig.setCountSearchResultsUpTo(5);
+
+ for (int i = 0; i < 10; i++) {
+ Patient pat = new Patient();
+ pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("test" + i);
+ myClient.create().resource(pat).execute();
+ }
+
+ StopWatch sw = new StopWatch();
+
+ Bundle found = myClient
+ .search()
+ .forResource(Patient.class)
+ .returnBundle(Bundle.class)
+ .count(1)
+ .execute();
+
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE), Matchers.empty());
+ assertThat(myCapturingInterceptor.getLastResponse().getHeaders(Constants.HEADER_X_CACHE.toLowerCase()),Matchers.empty());
+
+ // If this fails under load, try increasing the throttle above
+ assertEquals(null, found.getTotalElement().getValue());
+ assertEquals(1, found.getEntry().size());
+ assertThat(sw.getMillis(), lessThan(1000L));
+ }
+
@Test
public void testSearchWithEmptyParameter() throws Exception {
- Observation obs= new Observation();
+ Observation obs = new Observation();
obs.setStatus(ObservationStatus.FINAL);
obs.getCode().addCoding().setSystem("foo").setCode("bar");
- ourClient.create().resource(obs).execute();
-
+ myClient.create().resource(obs).execute();
+
testSearchWithEmptyParameter("/Observation?value-quantity=");
testSearchWithEmptyParameter("/Observation?code=bar&value-quantity=");
testSearchWithEmptyParameter("/Observation?value-date=");
@@ -3155,23 +3252,21 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testSearchWithInclude() throws Exception {
Organization org = new Organization();
org.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSearchWithInclude01");
- IdType orgId = (IdType) ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId();
+ IdType orgId = (IdType) myClient.create().resource(org).prettyPrint().encodedXml().execute().getId();
Patient pat = new Patient();
pat.addIdentifier().setSystem("urn:system:rpdstu2").setValue("testSearchWithInclude02");
pat.getManagingOrganization().setReferenceElement(orgId.toUnqualifiedVersionless());
- ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
+ myClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
- //@formatter:off
- Bundle found = ourClient
- .search()
- .forResource(Patient.class)
- .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("urn:system:rpdstu2","testSearchWithInclude02"))
- .include(Patient.INCLUDE_ORGANIZATION)
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
- //@formatter:on
+ Bundle found = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(Patient.IDENTIFIER.exactly().systemAndIdentifier("urn:system:rpdstu2", "testSearchWithInclude02"))
+ .include(Patient.INCLUDE_ORGANIZATION)
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
assertEquals(2, found.getEntry().size());
assertEquals(Patient.class, found.getEntry().get(0).getResource().getClass());
@@ -3184,13 +3279,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
public void testSearchWithInvalidNumberPrefix() throws Exception {
try {
//@formatter:off
- ourClient
- .search()
- .forResource(Encounter.class)
- .where(Encounter.LENGTH.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100))
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ myClient
+ .search()
+ .forResource(Encounter.class)
+ .where(Encounter.LENGTH.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100))
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
fail();
} catch (InvalidRequestException e) {
@@ -3205,13 +3300,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
myObservationDao.create(o, mySrd);
try {
//@formatter:off
- ourClient
- .search()
- .forResource(Observation.class)
- .where(Observation.VALUE_QUANTITY.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100).andNoUnits())
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ myClient
+ .search()
+ .forResource(Observation.class)
+ .where(Observation.VALUE_QUANTITY.withPrefix(ParamPrefixEnum.ENDS_BEFORE).number(100).andNoUnits())
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
fail();
} catch (InvalidRequestException e) {
@@ -3225,13 +3320,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
o.getCode().setText("testSearchWithInvalidSort");
myObservationDao.create(o, mySrd);
//@formatter:off
- ourClient
- .search()
- .forResource(Observation.class)
- .sort().ascending(Observation.CODE_VALUE_QUANTITY) // composite sort not supported yet
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ myClient
+ .search()
+ .forResource(Observation.class)
+ .sort().ascending(Observation.CODE_VALUE_QUANTITY) // composite sort not supported yet
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
}
@@ -3242,13 +3337,13 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
String methodName = "testSearchWithMissing";
Organization org = new Organization();
- IIdType deletedIdMissingTrue = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless();
- ourClient.delete().resourceById(deletedIdMissingTrue).execute();
+ IIdType deletedIdMissingTrue = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless();
+ myClient.delete().resourceById(deletedIdMissingTrue).execute();
org = new Organization();
org.setName("Help I'm a Bug");
- IIdType deletedIdMissingFalse = ourClient.create().resource(org).execute().getId().toUnqualifiedVersionless();
- ourClient.delete().resourceById(deletedIdMissingFalse).execute();
+ IIdType deletedIdMissingFalse = myClient.create().resource(org).execute().getId().toUnqualifiedVersionless();
+ myClient.delete().resourceById(deletedIdMissingFalse).execute();
List resources = new ArrayList();
for (int i = 0; i < 20; i++) {
@@ -3256,27 +3351,27 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
org.setName(methodName + "_0" + i);
resources.add(org);
}
- ourClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
+ myClient.transaction().withResources(resources).prettyPrint().encodedXml().execute();
org = new Organization();
org.addIdentifier().setSystem("urn:system:rpdstu2").setValue(methodName + "01");
org.setName(methodName + "name");
- IIdType orgNotMissing = ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless();
+ IIdType orgNotMissing = myClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless();
org = new Organization();
org.addIdentifier().setSystem("urn:system:rpdstu2").setValue(methodName + "01");
- IIdType orgMissing = ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless();
+ IIdType orgMissing = myClient.create().resource(org).prettyPrint().encodedXml().execute().getId().toUnqualifiedVersionless();
{
//@formatter:off
- Bundle found = ourClient
- .search()
- .forResource(Organization.class)
- .where(Organization.NAME.isMissing(false))
- .count(100)
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ Bundle found = myClient
+ .search()
+ .forResource(Organization.class)
+ .where(Organization.NAME.isMissing(false))
+ .count(100)
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
List list = toUnqualifiedVersionlessIds(found);
@@ -3288,15 +3383,15 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
//@formatter:off
- Bundle found = ourClient
- .search()
- .forResource(Organization.class)
- .where(Organization.NAME.isMissing(true))
- .count(100)
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
- //@formatter:on
+ Bundle found = myClient
+ .search()
+ .forResource(Organization.class)
+ .where(Organization.NAME.isMissing(true))
+ .count(100)
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
+ //@formatter:on
List list = toUnqualifiedVersionlessIds(found);
ourLog.info(methodName + " found: " + list.toString() + " - Wanted " + orgMissing + " but not " + orgNotMissing);
@@ -3342,7 +3437,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
/**
* See #411
- *
+ *
* Let's see if we can reproduce this issue in JPA
*/
@Test
@@ -3376,7 +3471,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Observation obs = new Observation();
obs.getCode().setText("THIS_IS_THE_TEXT");
obs.getCode().addCoding().setSystem("SYSTEM").setCode("CODE").setDisplay("THIS_IS_THE_DISPLAY");
- ourClient.create().resource(obs).execute();
+ myClient.create().resource(obs).execute();
testSearchReturnsResults("/Observation?code%3Atext=THIS_IS_THE_TEXT");
testSearchReturnsResults("/Observation?code%3Atext=THIS_IS_THE_");
@@ -3395,119 +3490,119 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Daniel").setFamily("Adams");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Aaron").setFamily("Alexis");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Carol").setFamily("Allen");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Ruth").setFamily("Black");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Brian").setFamily("Brooks");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Susan").setFamily("Clark");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Amy").setFamily("Clark");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Anthony").setFamily("Coleman");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Steven").setFamily("Coleman");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Lisa").setFamily("Coleman");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Ruth").setFamily("Cook");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Betty").setFamily("Davis");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Joshua").setFamily("Diaz");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Brian").setFamily("Gracia");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Stephan").setFamily("Graham");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
p = new Patient();
p.addIdentifier().setSystem("urn:system").setValue(methodName);
p.addName().addGiven("Sarah").setFamily("Graham");
- ourClient.create().resource(p).execute();
+ myClient.create().resource(p).execute();
- Bundle resp = ourClient
- .search()
- .forResource(Patient.class)
- .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", methodName))
- .sort().ascending(Patient.FAMILY)
- .sort().ascending(Patient.GIVEN)
- .count(100)
- .returnBundle(Bundle.class)
- .execute();
+ Bundle resp = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", methodName))
+ .sort().ascending(Patient.FAMILY)
+ .sort().ascending(Patient.GIVEN)
+ .count(100)
+ .returnBundle(Bundle.class)
+ .execute();
List names = toNameList(resp);
ourLog.info(StringUtils.join(names, '\n'));
assertThat(names, contains( // this matches in order only
- "Daniel Adams",
- "Aaron Alexis",
- "Carol Allen",
- "Ruth Black",
- "Brian Brooks",
- "Amy Clark",
- "Susan Clark",
- "Anthony Coleman",
- "Lisa Coleman",
- "Steven Coleman",
- "Ruth Cook",
- "Betty Davis",
- "Joshua Diaz",
- "Brian Gracia",
- "Sarah Graham",
- "Stephan Graham"));
+ "Daniel Adams",
+ "Aaron Alexis",
+ "Carol Allen",
+ "Ruth Black",
+ "Brian Brooks",
+ "Amy Clark",
+ "Susan Clark",
+ "Anthony Coleman",
+ "Lisa Coleman",
+ "Steven Coleman",
+ "Ruth Cook",
+ "Betty Davis",
+ "Joshua Diaz",
+ "Brian Gracia",
+ "Sarah Graham",
+ "Stephan Graham"));
}
@@ -3519,7 +3614,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Organization org = new Organization();
org.setName("測試醫院");
org.addIdentifier().setSystem("urn:system").setValue("testStoreUtf8Characters_01");
- IdType orgId = (IdType) ourClient.create().resource(org).prettyPrint().encodedXml().execute().getId();
+ IdType orgId = (IdType) myClient.create().resource(org).prettyPrint().encodedXml().execute().getId();
// Read back directly from the DAO
{
@@ -3530,7 +3625,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
}
// Read back through the HTTP API
{
- Organization returned = ourClient.read(Organization.class, orgId.getIdPart());
+ Organization returned = myClient.read(Organization.class, orgId.getIdPart());
String val = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(returned);
ourLog.info(val);
assertThat(val, containsString(""));
@@ -3560,7 +3655,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
p1.setManagingOrganization(new Reference("Organization/99999999999"));
try {
- ourClient.create().resource(p1).execute().getId();
+ myClient.create().resource(p1).execute().getId();
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), containsString("Organization/99999999999"));
@@ -3585,7 +3680,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(400, response.getStatusLine().getStatusCode());
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString);
assertThat(oo.getIssue().get(0).getDiagnostics(),
- containsString("Can not update resource, request URL must contain an ID element for update (PUT) operation (it must be of the form [base]/[resource type]/[id])"));
+ containsString("Can not update resource, request URL must contain an ID element for update (PUT) operation (it must be of the form [base]/[resource type]/[id])"));
} finally {
response.close();
}
@@ -3646,7 +3741,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes");
p1.addName().setFamily("Tester").addGiven("testUpdateRejectsInvalidTypes");
- IdType p1id = (IdType) ourClient.create().resource(p1).execute().getId();
+ IdType p1id = (IdType) myClient.create().resource(p1).execute().getId();
// Try to update with the wrong ID in the resource body
p1.setId("FOO");
@@ -3663,9 +3758,9 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(400, response.getStatusLine().getStatusCode());
OperationOutcome oo = myFhirCtx.newJsonParser().parseResource(OperationOutcome.class, new InputStreamReader(response.getEntity().getContent()));
assertEquals(
- "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"FOO\" does not match URL ID of \""
- + p1id.getIdPart() + "\"",
- oo.getIssue().get(0).getDiagnostics());
+ "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"FOO\" does not match URL ID of \""
+ + p1id.getIdPart() + "\"",
+ oo.getIssue().get(0).getDiagnostics());
} finally {
response.close();
}
@@ -3707,20 +3802,20 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateRejectsInvalidTypes");
p1.addName().setFamily("Tester").addGiven("testUpdateRejectsInvalidTypes");
- IdType p1id = (IdType) ourClient.create().resource(p1).execute().getId();
+ IdType p1id = (IdType) myClient.create().resource(p1).execute().getId();
Organization p2 = new Organization();
p2.setId(p1id.getIdPart());
p2.getNameElement().setValue("testUpdateRejectsInvalidTypes");
try {
- ourClient.update().resource(p2).withId("Organization/" + p1id.getIdPart()).execute();
+ myClient.update().resource(p2).withId("Organization/" + p1id.getIdPart()).execute();
fail();
} catch (UnprocessableEntityException e) {
// good
}
try {
- ourClient.update().resource(p2).withId("Patient/" + p1id.getIdPart()).execute();
+ myClient.update().resource(p2).withId("Patient/" + p1id.getIdPart()).execute();
fail();
} catch (UnprocessableEntityException e) {
// good
@@ -3896,21 +3991,21 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient p1 = new Patient();
p1.addIdentifier().setSystem("urn:system").setValue("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2");
- MethodOutcome outcome = ourClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute();
+ MethodOutcome outcome = myClient.update().resource(p1).withId("testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2").execute();
assertEquals(true, outcome.getCreated().booleanValue());
IdType p1Id = (IdType) outcome.getId();
assertThat(p1Id.getValue(), containsString("Patient/testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2/_history"));
//@formatter:off
- Bundle actual = ourClient
- .search()
- .forResource(Patient.class)
- .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2"))
- .encodedJson()
- .prettyPrint()
- .returnBundle(Bundle.class)
- .execute();
+ Bundle actual = myClient
+ .search()
+ .forResource(Patient.class)
+ .where(Patient.IDENTIFIER.exactly().systemAndCode("urn:system", "testUpdateWithClientSuppliedIdWhichDoesntExistRpDstu2"))
+ .encodedJson()
+ .prettyPrint()
+ .returnBundle(Bundle.class)
+ .execute();
//@formatter:on
assertEquals(1, actual.getEntry().size());
@@ -3924,7 +4019,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
Patient pt = new Patient();
pt.addName().setFamily(methodName);
- IIdType id = ourClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(pt).execute().getId().toUnqualifiedVersionless();
pt.addName().setFamily("FAM2");
pt.setId(id.toUnqualifiedVersionless());
@@ -3977,13 +4072,27 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(400, response.getStatusLine().getStatusCode());
OperationOutcome oo = myFhirCtx.newXmlParser().parseResource(OperationOutcome.class, responseString);
assertEquals(
- "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"333\" does not match URL ID of \"A2\"",
- oo.getIssue().get(0).getDiagnostics());
+ "Can not update resource, resource body must contain an ID element which matches the request URL for update (PUT) operation - Resource body ID of \"333\" does not match URL ID of \"A2\"",
+ oo.getIssue().get(0).getDiagnostics());
} finally {
response.close();
}
}
+ @Test
+ public void testUpdateWrongResourceType() throws IOException {
+ String input = IOUtils.toString(getClass().getResourceAsStream("/dstu3-person.json"), StandardCharsets.UTF_8);
+
+ try {
+ MethodOutcome resp = myClient.update().resource(input).withId("Patient/PERSON1").execute();
+ } catch (InvalidRequestException e) {
+ assertEquals("", e.getMessage());
+ }
+
+ MethodOutcome resp = myClient.update().resource(input).withId("Person/PERSON1").execute();
+ assertEquals("Person/PERSON1/_history/1", resp.getId().toUnqualified().getValue());
+ }
+
@Test
public void testValidateBadInputViaGet() throws IOException {
@@ -4043,7 +4152,7 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(412, response.getStatusLine().getStatusCode());
assertThat(resp, not(containsString("Resource has no id")));
assertThat(resp,
- stringContainsInOrder(">ERROR<", "[Patient.contact]", "SHALL at least contain a contact's details or a reference to an organization", ""));
+ stringContainsInOrder(">ERROR<", "[Patient.contact]", "SHALL at least contain a contact's details or a reference to an organization", ""));
} finally {
IOUtils.closeQuietly(response.getEntity().getContent());
response.close();
@@ -4155,8 +4264,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertThat(resp, not(containsString("Resource has no id")));
assertThat(resp, containsString("No issues detected during validation
"));
assertThat(resp,
- stringContainsInOrder("", "", "", "",
- "
"));
+ stringContainsInOrder("", "", "", "",
+ "
"));
} finally {
IOUtils.closeQuietly(response.getEntity().getContent());
response.close();
@@ -4182,8 +4291,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertThat(resp, not(containsString("Resource has no id")));
assertThat(resp, containsString("No issues detected during validation
"));
assertThat(resp,
- stringContainsInOrder("", "", "", "",
- "
"));
+ stringContainsInOrder("", "", "", "",
+ "
"));
} finally {
IOUtils.closeQuietly(response.getEntity().getContent());
response.close();
@@ -4193,10 +4302,10 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
@Test
public void testValueSetExpandOperation() throws IOException {
CodeSystem cs = myFhirCtx.newXmlParser().parseResource(CodeSystem.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/extensional-case-3-cs.xml")));
- ourClient.create().resource(cs).execute();
+ myClient.create().resource(cs).execute();
ValueSet upload = myFhirCtx.newXmlParser().parseResource(ValueSet.class, new InputStreamReader(ResourceProviderR4Test.class.getResourceAsStream("/extensional-case-3-vs.xml")));
- IIdType vsid = ourClient.create().resource(upload).execute().getId().toUnqualifiedVersionless();
+ IIdType vsid = myClient.create().resource(upload).execute().getId().toUnqualifiedVersionless();
HttpGet get = new HttpGet(ourServerBase + "/ValueSet/" + vsid.getIdPart() + "/$expand");
CloseableHttpResponse response = ourHttpClient.execute(get);
@@ -4234,8 +4343,8 @@ public class ResourceProviderR4Test extends BaseResourceProviderR4Test {
assertEquals(200, response.getStatusLine().getStatusCode());
//@formatter:off
assertThat(resp, stringContainsInOrder(
- "",
- ""));
+ "",
+ ""));
//@formatter:on
} finally {
IOUtils.closeQuietly(response.getEntity().getContent());
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java
index 2dacfaf2322..216e3c168e0 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/ResourceProviderR4ValueSetTest.java
@@ -1,35 +1,38 @@
package ca.uhn.fhir.jpa.provider.r4;
-import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_CODE_SYSTEM;
-import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_VALUE_SET;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.*;
-
-import java.io.IOException;
-import java.nio.charset.StandardCharsets;
-
-import org.apache.commons.io.IOUtils;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.ContentType;
-import org.apache.http.entity.StringEntity;
-import org.hl7.fhir.r4.model.*;
-import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode;
-import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
-import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent;
-import org.hl7.fhir.r4.model.ValueSet.FilterOperator;
-import org.hl7.fhir.instance.model.api.IIdType;
-import org.junit.*;
-import org.springframework.transaction.annotation.Transactional;
-
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.dao.data.IResourceTableDao;
-import ca.uhn.fhir.jpa.entity.*;
+import ca.uhn.fhir.jpa.entity.ResourceTable;
+import ca.uhn.fhir.jpa.entity.TermCodeSystemVersion;
+import ca.uhn.fhir.jpa.entity.TermConcept;
import ca.uhn.fhir.jpa.entity.TermConceptParentChildLink.RelationshipTypeEnum;
import ca.uhn.fhir.jpa.term.IHapiTerminologySvc;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.servlet.ServletRequestDetails;
import ca.uhn.fhir.util.TestUtil;
+import org.apache.commons.io.IOUtils;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.entity.ContentType;
+import org.apache.http.entity.StringEntity;
+import org.hl7.fhir.instance.model.api.IIdType;
+import org.hl7.fhir.r4.model.*;
+import org.hl7.fhir.r4.model.CodeSystem.CodeSystemContentMode;
+import org.hl7.fhir.r4.model.CodeSystem.ConceptDefinitionComponent;
+import org.hl7.fhir.r4.model.ValueSet.ConceptSetComponent;
+import org.hl7.fhir.r4.model.ValueSet.FilterOperator;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+
+import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_CODE_SYSTEM;
+import static ca.uhn.fhir.jpa.dao.r4.FhirResourceDaoR4TerminologyTest.URL_MY_VALUE_SET;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
@@ -48,73 +51,14 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
myExtensionalVsId = myValueSetDao.create(upload, mySrd).getId().toUnqualifiedVersionless();
}
- /**
- * #516
- */
- @Test
- public void testInvalidFilter() throws Exception {
- String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8);
- HttpPost post = new HttpPost(ourServerBase+"/ValueSet/%24expand");
- post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
-
- CloseableHttpResponse resp = ourHttpClient.execute(post);
- try {
-
- String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8);
- ourLog.info(respString);
-
- ourLog.info(resp.toString());
-
- assertEquals(400, resp.getStatusLine().getStatusCode());
- assertThat(respString, containsString("Unknown FilterOperator code 'n'"));
-
- }finally {
- IOUtils.closeQuietly(resp);
- }
- }
-
private CodeSystem createExternalCs() {
IFhirResourceDao codeSystemDao = myCodeSystemDao;
IResourceTableDao resourceTableDao = myResourceTableDao;
IHapiTerminologySvc termSvc = myTermSvc;
-
+
return createExternalCs(codeSystemDao, resourceTableDao, termSvc, mySrd);
}
- public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) {
- CodeSystem codeSystem = new CodeSystem();
- codeSystem.setUrl(URL_MY_CODE_SYSTEM);
- codeSystem.setContent(CodeSystemContentMode.NOTPRESENT);
- IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified();
-
- ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong());
-
- TermCodeSystemVersion cs = new TermCodeSystemVersion();
- cs.setResource(table);
- cs.setResourceVersionId(table.getVersion());
-
- TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A");
- cs.getConcepts().add(parentA);
-
- TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA");
- parentA.addChild(childAA, RelationshipTypeEnum.ISA);
-
- TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA");
- childAA.addChild(childAAA, RelationshipTypeEnum.ISA);
-
- TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB");
- childAA.addChild(childAAB, RelationshipTypeEnum.ISA);
-
- TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB");
- parentA.addChild(childAB, RelationshipTypeEnum.ISA);
-
- TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B");
- cs.getConcepts().add(parentB);
-
- theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs);
- return codeSystem;
- }
-
private void createExternalCsAndLocalVs() {
CodeSystem codeSystem = createExternalCs();
@@ -131,17 +75,17 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
//@formatter:off
CodeSystem codeSystem = new CodeSystem();
codeSystem.setUrl(URL_MY_CODE_SYSTEM);
- codeSystem.setContent(CodeSystemContentMode.COMPLETE);
+ codeSystem.setContent(CodeSystemContentMode.COMPLETE);
codeSystem
.addConcept().setCode("A").setDisplay("Code A")
- .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA")
- .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA"))
- )
- .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB"));
+ .addConcept(new ConceptDefinitionComponent().setCode("AA").setDisplay("Code AA")
+ .addConcept(new ConceptDefinitionComponent().setCode("AAA").setDisplay("Code AAA"))
+ )
+ .addConcept(new ConceptDefinitionComponent().setCode("AB").setDisplay("Code AB"));
codeSystem
.addConcept().setCode("B").setDisplay("Code B")
- .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA"))
- .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB"));
+ .addConcept(new ConceptDefinitionComponent().setCode("BA").setDisplay("Code BA"))
+ .addConcept(new ConceptDefinitionComponent().setCode("BB").setDisplay("Code BB"));
//@formatter:on
myCodeSystemDao.create(codeSystem, mySrd);
@@ -177,7 +121,7 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
@Test
public void testExpandById() throws IOException {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@@ -185,54 +129,30 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
- assertThat(resp, containsString(""));
+ assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
- assertThat(resp, containsString(""));
+ assertThat(resp, containsString(""));
assertThat(resp, containsString("
"));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
assertThat(resp, containsString(""));
- assertThat(resp, containsString(""));
+ assertThat(resp, containsString(""));
assertThat(resp, containsString("
"));
assertThat(resp, containsString(""));
}
- @Test
- public void testExpandByIdentifier() {
- //@formatter:off
- Parameters respParam = ourClient
- .operation()
- .onType(ValueSet.class)
- .named("expand")
- .withParameter(Parameters.class, "identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
- .execute();
- ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
- //@formatter:on
-
- String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
- ourLog.info(resp);
- //@formatter:off
- assertThat(resp, stringContainsInOrder(
- "",
- ""));
- //@formatter:on
-
- }
-
- //
-
@Test
public void testExpandByIdWithFilter() throws IOException {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
@@ -245,14 +165,32 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
ourLog.info(resp);
assertThat(resp, containsString(""));
assertThat(resp, not(containsString("")));
-
+
+ }
+
+ @Test
+ public void testExpandByUrl() {
+ Parameters respParam = myClient
+ .operation()
+ .onType(ValueSet.class)
+ .named("expand")
+ .withParameter(Parameters.class, "url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
+ .execute();
+ ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
+
+ String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
+ ourLog.info(resp);
+ assertThat(resp, stringContainsInOrder(
+ "",
+ ""));
+
}
@Test
public void testExpandByValueSet() throws IOException {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/extensional-case-3-vs.xml");
-
- Parameters respParam = ourClient
+
+ Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@@ -263,18 +201,19 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
assertThat(resp, stringContainsInOrder(
- "",
- ""));
+ "",
+ ""));
}
+
@Test
public void testExpandInlineVsAgainstBuiltInCs() throws IOException {
createLocalVsPointingAtBuiltInCodeSystem();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@@ -282,10 +221,10 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
}
@@ -294,9 +233,9 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
createExternalCsAndLocalVs();
assertNotNull(myLocalVs);
myLocalVs.setId("");
-
+
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@@ -304,22 +243,21 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, not(containsStringIgnoringCase("")));
-
- }
+ }
@Test
public void testExpandInvalidParams() throws IOException {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onType(ValueSet.class)
.named("expand")
@@ -327,39 +265,39 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
.execute();
fail();
} catch (InvalidRequestException e) {
- assertEquals("HTTP 400 Bad Request: $expand operation at the type level (no ID specified) requires an identifier or a valueSet as a part of the request", e.getMessage());
+ assertEquals("HTTP 400 Bad Request: $expand operation at the type level (no ID specified) requires a url or a valueSet as a part of the request", e.getMessage());
}
//@formatter:on
//@formatter:off
try {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/r4/extensional-case-r4.xml");
- ourClient
+ myClient
.operation()
.onType(ValueSet.class)
.named("expand")
.withParameter(Parameters.class, "valueSet", toExpand)
- .andParameter("identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
+ .andParameter("url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
.execute();
fail();
} catch (InvalidRequestException e) {
- assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
+ assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
}
//@formatter:on
//@formatter:off
try {
ValueSet toExpand = loadResourceFromClasspath(ValueSet.class, "/r4/extensional-case.xml");
- ourClient
+ myClient
.operation()
.onInstance(myExtensionalVsId)
.named("expand")
.withParameter(Parameters.class, "valueSet", toExpand)
- .andParameter("identifier", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
+ .andParameter("url", new UriType("http://www.healthintersections.com.au/fhir/ValueSet/extensional-case-2"))
.execute();
fail();
} catch (InvalidRequestException e) {
- assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have an identifier specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
+ assertEquals("HTTP 400 Bad Request: $expand must EITHER be invoked at the instance level, or have a url specified, or have a ValueSet specified. Can not combine these options.", e.getMessage());
}
//@formatter:on
@@ -369,9 +307,9 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
public void testExpandLocalVsAgainstBuiltInCs() throws IOException {
createLocalVsPointingAtBuiltInCodeSystem();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onInstance(myLocalValueSetId)
.named("expand")
@@ -379,24 +317,20 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
}
-
-
-
-
-
+
@Test
public void testExpandLocalVsAgainstExternalCs() throws IOException {
createExternalCsAndLocalVs();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onInstance(myLocalValueSetId)
.named("expand")
@@ -404,48 +338,48 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, not(containsStringIgnoringCase("")));
-
+
}
@Test
public void testExpandLocalVsCanonicalAgainstExternalCs() throws IOException {
createExternalCsAndLocalVs();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("expand")
- .withParameter(Parameters.class, "identifier", new UriType(URL_MY_VALUE_SET))
+ .withParameter(Parameters.class, "url", new UriType(URL_MY_VALUE_SET))
.execute();
ValueSet expanded = (ValueSet) respParam.getParameter().get(0).getResource();
//@formatter:on
-
+
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(expanded);
ourLog.info(resp);
-
+
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, containsStringIgnoringCase(""));
assertThat(resp, not(containsStringIgnoringCase("")));
-
+
}
@Test
public void testExpandLocalVsWithUnknownCode() throws IOException {
createExternalCsAndLocalVsWithUnknownCode();
assertNotNull(myLocalValueSetId);
-
+
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onInstance(myLocalValueSetId)
.named("expand")
@@ -457,38 +391,35 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
//@formatter:on
}
+ /**
+ * #516
+ */
@Test
- public void testValiedateCodeAgainstBuiltInSystem() {
- //@formatter:off
- Parameters respParam = ourClient
- .operation()
- .onType(ValueSet.class)
- .named("validate-code")
- .withParameter(Parameters.class, "code", new StringType("BRN"))
- .andParameter("identifier", new StringType("http://hl7.org/fhir/ValueSet/v2-0487"))
- .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487"))
- .useHttpGet()
- .execute();
- //@formatter:on
+ public void testInvalidFilter() throws Exception {
+ String string = IOUtils.toString(getClass().getResourceAsStream("/bug_516_invalid_expansion.json"), StandardCharsets.UTF_8);
+ HttpPost post = new HttpPost(ourServerBase + "/ValueSet/%24expand");
+ post.setEntity(new StringEntity(string, ContentType.parse(ca.uhn.fhir.rest.api.Constants.CT_FHIR_JSON_NEW)));
- String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
- ourLog.info(resp);
-
- assertEquals("result", respParam.getParameter().get(0).getName());
- assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).getValue().booleanValue());
-
- assertEquals("message", respParam.getParameter().get(1).getName());
- assertThat(((StringType)respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded"));
+ CloseableHttpResponse resp = ourHttpClient.execute(post);
+ try {
- assertEquals("display", respParam.getParameter().get(2).getName());
- assertEquals("Burn", ((StringType)respParam.getParameter().get(2).getValue()).getValue());
+ String respString = IOUtils.toString(resp.getEntity().getContent(), StandardCharsets.UTF_8);
+ ourLog.info(respString);
+
+ ourLog.info(resp.toString());
+
+ assertEquals(400, resp.getStatusLine().getStatusCode());
+ assertThat(respString, containsString("Unknown FilterOperator code 'n'"));
+
+ } finally {
+ IOUtils.closeQuietly(resp);
+ }
}
-
@Test
public void testValidateCodeOperationByCodeAndSystemInstance() {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onInstance(myExtensionalVsId)
.named("validate-code")
@@ -499,14 +430,14 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
ourLog.info(resp);
-
- assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue());
+
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
}
@Test
public void testValidateCodeOperationByCodeAndSystemType() {
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onType(ValueSet.class)
.named("validate-code")
@@ -517,8 +448,33 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
ourLog.info(resp);
-
- assertEquals(true, ((BooleanType)respParam.getParameter().get(0).getValue()).booleanValue());
+
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).booleanValue());
+ }
+
+ @Test
+ public void testValiedateCodeAgainstBuiltInSystem() {
+ Parameters respParam = myClient
+ .operation()
+ .onType(ValueSet.class)
+ .named("validate-code")
+ .withParameter(Parameters.class, "code", new StringType("BRN"))
+ .andParameter("url", new StringType("http://hl7.org/fhir/ValueSet/v2-0487"))
+ .andParameter("system", new StringType("http://hl7.org/fhir/v2/0487"))
+ .useHttpGet()
+ .execute();
+
+ String resp = myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(respParam);
+ ourLog.info(resp);
+
+ assertEquals("result", respParam.getParameter().get(0).getName());
+ assertEquals(true, ((BooleanType) respParam.getParameter().get(0).getValue()).getValue().booleanValue());
+
+ assertEquals("message", respParam.getParameter().get(1).getName());
+ assertThat(((StringType) respParam.getParameter().get(1).getValue()).getValue(), containsStringIgnoringCase("succeeded"));
+
+ assertEquals("display", respParam.getParameter().get(2).getName());
+ assertEquals("Burn", ((StringType) respParam.getParameter().get(2).getValue()).getValue());
}
@AfterClass
@@ -526,4 +482,38 @@ public class ResourceProviderR4ValueSetTest extends BaseResourceProviderR4Test {
TestUtil.clearAllStaticFieldsForUnitTest();
}
+ public static CodeSystem createExternalCs(IFhirResourceDao theCodeSystemDao, IResourceTableDao theResourceTableDao, IHapiTerminologySvc theTermSvc, ServletRequestDetails theRequestDetails) {
+ CodeSystem codeSystem = new CodeSystem();
+ codeSystem.setUrl(URL_MY_CODE_SYSTEM);
+ codeSystem.setContent(CodeSystemContentMode.NOTPRESENT);
+ IIdType id = theCodeSystemDao.create(codeSystem, theRequestDetails).getId().toUnqualified();
+
+ ResourceTable table = theResourceTableDao.findOne(id.getIdPartAsLong());
+
+ TermCodeSystemVersion cs = new TermCodeSystemVersion();
+ cs.setResource(table);
+ cs.setResourceVersionId(table.getVersion());
+
+ TermConcept parentA = new TermConcept(cs, "ParentA").setDisplay("Parent A");
+ cs.getConcepts().add(parentA);
+
+ TermConcept childAA = new TermConcept(cs, "childAA").setDisplay("Child AA");
+ parentA.addChild(childAA, RelationshipTypeEnum.ISA);
+
+ TermConcept childAAA = new TermConcept(cs, "childAAA").setDisplay("Child AAA");
+ childAA.addChild(childAAA, RelationshipTypeEnum.ISA);
+
+ TermConcept childAAB = new TermConcept(cs, "childAAB").setDisplay("Child AAB");
+ childAA.addChild(childAAB, RelationshipTypeEnum.ISA);
+
+ TermConcept childAB = new TermConcept(cs, "childAB").setDisplay("Child AB");
+ parentA.addChild(childAB, RelationshipTypeEnum.ISA);
+
+ TermConcept parentB = new TermConcept(cs, "ParentB").setDisplay("Parent B");
+ cs.getConcepts().add(parentB);
+
+ theTermSvc.storeNewCodeSystemVersion(table.getId(), URL_MY_CODE_SYSTEM, cs);
+ return codeSystem;
+ }
+
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java
index 8334a1d3bd8..998e8250a57 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/StaleSearchDeletingSvcR4Test.java
@@ -56,7 +56,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test {
}
//@formatter:off
- IClientExecutable, Bundle> search = ourClient
+ IClientExecutable, Bundle> search = myClient
.search()
.forResource(Patient.class)
.where(Patient.NAME.matches().value("Everything"))
@@ -74,12 +74,12 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test {
String nextLinkUrl = nextLink.getUrl();
assertThat(nextLinkUrl, not(blankOrNullString()));
- Bundle resp2 = ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute();
+ Bundle resp2 = myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute();
ourLog.info(myFhirCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp2));
myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
- ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute();
+ myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute();
Thread.sleep(20);
myDaoConfig.setExpireSearchResultsAfterMillis(10);
@@ -87,7 +87,7 @@ public class StaleSearchDeletingSvcR4Test extends BaseResourceProviderR4Test {
myStaleSearchDeletingSvc.pollForStaleSearchesAndDeleteThem();
try {
- ourClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute();
+ myClient.search().byUrl(nextLinkUrl).returnBundle(Bundle.class).execute();
fail();
} catch (ResourceGoneException e) {
assertThat(e.getMessage(), containsString("does not exist and may have expired"));
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java
index eac3edd6280..8724c3fdffa 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/SubscriptionsR4Test.java
@@ -57,7 +57,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
subs.getChannel().setEndpoint("http://localhost:8888");
subs.setCriteria("Observation?identifier=123");
try {
- ourClient.create().resource(subs).execute();
+ myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@@ -65,14 +65,14 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
subs.setId("ABC");
try {
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
}
subs.setStatus(SubscriptionStatus.REQUESTED);
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
}
@Test
@@ -84,7 +84,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
subs.setStatus(SubscriptionStatus.ACTIVE);
subs.setCriteria("Observation?identifier=123");
try {
- ourClient.create().resource(subs).execute();
+ myClient.create().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage());
@@ -92,7 +92,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
subs.setId("ABC");
try {
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: Subscription.status must be 'off' or 'requested' on a newly created subscription", e.getMessage());
@@ -109,13 +109,13 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
subs.getChannel().setEndpoint("http://localhost:8888");
subs.setStatus(SubscriptionStatus.REQUESTED);
subs.setCriteria("Observation?identifier=123");
- IIdType id = ourClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
+ IIdType id = myClient.create().resource(subs).execute().getId().toUnqualifiedVersionless();
subs.setId(id);
try {
subs.setStatus(SubscriptionStatus.ACTIVE);
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: Subscription.status can not be changed from 'requested' to 'active'", e.getMessage());
@@ -123,7 +123,7 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
try {
subs.setStatus((SubscriptionStatus) null);
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
@@ -141,12 +141,12 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
subs.getChannel().setEndpoint("http://localhost:8888");
subs.setCriteria("Observation?identifier=123");
subs.setStatus(SubscriptionStatus.REQUESTED);
- IIdType id = ourClient.create().resource(subs).execute().getId();
+ IIdType id = myClient.create().resource(subs).execute().getId();
subs.setId(id);
try {
subs.setStatus(SubscriptionStatus.ACTIVE);
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertEquals("HTTP 422 Unprocessable Entity: Subscription.status can not be changed from 'requested' to 'active'", e.getMessage());
@@ -154,14 +154,14 @@ public class SubscriptionsR4Test extends BaseResourceProviderR4Test {
try {
subs.setStatus((SubscriptionStatus) null);
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
fail();
} catch (UnprocessableEntityException e) {
assertThat(e.getMessage(), containsString("Subscription.status must be populated on this server"));
}
subs.setStatus(SubscriptionStatus.OFF);
- ourClient.update().resource(subs).execute();
+ myClient.update().resource(subs).execute();
}
@AfterClass
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java
index 708d05d6ac6..e15dee56274 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/TerminologyUploaderProviderR4Test.java
@@ -43,7 +43,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
byte[] packageBytes = createSctZip();
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onServer()
.named("upload-external-code-system")
@@ -63,7 +63,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
byte[] packageBytes = createLoincZip();
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onServer()
.named("upload-external-code-system")
@@ -82,7 +82,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
*/
//@formatter:off
- respParam = ourClient
+ respParam = myClient
.operation()
.onServer()
.named("upload-external-code-system")
@@ -107,7 +107,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
fos.close();
//@formatter:off
- Parameters respParam = ourClient
+ Parameters respParam = myClient
.operation()
.onServer()
.named("upload-external-code-system")
@@ -128,7 +128,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onServer()
.named("upload-external-code-system")
@@ -148,7 +148,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onServer()
.named("upload-external-code-system")
@@ -165,7 +165,7 @@ public class TerminologyUploaderProviderR4Test extends BaseResourceProviderR4Tes
public void testUploadMissingPackage() throws Exception {
//@formatter:off
try {
- ourClient
+ myClient
.operation()
.onServer()
.named("upload-external-code-system")
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java
index 2720e48f8f3..9126cec246a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/SearchCoordinatorSvcImplTest.java
@@ -1,41 +1,60 @@
package ca.uhn.fhir.jpa.search;
-import static org.junit.Assert.*;
-import static org.mockito.Matchers.*;
-import static org.mockito.Mockito.*;
-
-import java.util.*;
-
-import javax.persistence.EntityManager;
-
-import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.*;
-import org.junit.runner.RunWith;
-import org.mockito.*;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.runners.MockitoJUnitRunner;
-import org.mockito.stubbing.Answer;
-import org.springframework.data.domain.*;
-import org.springframework.transaction.PlatformTransactionManager;
-
-import com.google.common.collect.Lists;
-
import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.jpa.dao.*;
-import ca.uhn.fhir.jpa.dao.data.*;
-import ca.uhn.fhir.jpa.entity.*;
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.dao.IDao;
+import ca.uhn.fhir.jpa.dao.ISearchBuilder;
+import ca.uhn.fhir.jpa.dao.SearchParameterMap;
+import ca.uhn.fhir.jpa.dao.data.ISearchDao;
+import ca.uhn.fhir.jpa.dao.data.ISearchIncludeDao;
+import ca.uhn.fhir.jpa.dao.data.ISearchResultDao;
+import ca.uhn.fhir.jpa.entity.Search;
+import ca.uhn.fhir.jpa.entity.SearchResult;
+import ca.uhn.fhir.jpa.entity.SearchStatusEnum;
+import ca.uhn.fhir.jpa.entity.SearchTypeEnum;
import ca.uhn.fhir.jpa.util.BaseIterator;
import ca.uhn.fhir.model.dstu2.resource.Patient;
+import ca.uhn.fhir.rest.api.CacheControlDirective;
import ca.uhn.fhir.rest.api.server.IBundleProvider;
import ca.uhn.fhir.rest.param.StringParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.util.TestUtil;
+import com.google.common.collect.Lists;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Captor;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.mockito.stubbing.Answer;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.transaction.PlatformTransactionManager;
-@SuppressWarnings({ "unchecked" })
+import javax.persistence.EntityManager;
+import java.util.*;
+
+import static org.junit.Assert.*;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Matchers.same;
+import static org.mockito.Mockito.*;
+
+@SuppressWarnings({"unchecked"})
@RunWith(MockitoJUnitRunner.class)
public class SearchCoordinatorSvcImplTest {
private static FhirContext ourCtx = FhirContext.forDstu3();
+ @Captor
+ ArgumentCaptor> mySearchResultIterCaptor;
@Mock
private IDao myCallingDao;
@Mock
@@ -49,10 +68,6 @@ public class SearchCoordinatorSvcImplTest {
private ISearchIncludeDao mySearchIncludeDao;
@Mock
private ISearchResultDao mySearchResultDao;
- @Captor
- ArgumentCaptor> mySearchResultIterCaptor;
-
-
private SearchCoordinatorSvcImpl mySvc;
@Mock
@@ -63,9 +78,10 @@ public class SearchCoordinatorSvcImplTest {
public void after() {
verify(myCallingDao, atMost(myExpectedNumberOfSearchBuildersCreated)).newSearchBuilder();
}
+
@Before
public void before() {
-
+
mySvc = new SearchCoordinatorSvcImpl();
mySvc.setEntityManagerForUnitTest(myEntityManager);
mySvc.setTransactionManagerForUnitTest(myTxManager);
@@ -76,9 +92,9 @@ public class SearchCoordinatorSvcImplTest {
myDaoConfig = new DaoConfig();
mySvc.setDaoConfigForUnitTest(myDaoConfig);
-
+
when(myCallingDao.newSearchBuilder()).thenReturn(mySearchBuider);
-
+
doAnswer(new Answer() {
@Override
public Void answer(InvocationOnMock theInvocation) throws Throwable {
@@ -89,7 +105,8 @@ public class SearchCoordinatorSvcImplTest {
provider.setEntityManager(myEntityManager);
provider.setContext(ourCtx);
return null;
- }}).when(myCallingDao).injectDependenciesIntoBundleProvider(any(PersistedJpaBundleProvider.class));
+ }
+ }).when(myCallingDao).injectDependenciesIntoBundleProvider(any(PersistedJpaBundleProvider.class));
}
private List createPidSequence(int from, int to) {
@@ -128,7 +145,7 @@ public class SearchCoordinatorSvcImplTest {
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNotNull(result.getUuid());
assertEquals(null, result.size());
@@ -146,17 +163,17 @@ public class SearchCoordinatorSvcImplTest {
params.add("name", new StringParam("ANAME"));
List pids = createPidSequence(10, 800);
- Iterator iter = new SlowIterator(pids.iterator(), 2);
+ Iterator iter = new SlowIterator(pids.iterator(), 1);
when(mySearchBuider.createQuery(Mockito.same(params), any(String.class))).thenReturn(iter);
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNotNull(result.getUuid());
assertEquals(null, result.size());
List resources;
-
+
resources = result.getResources(0, 100000);
assertEquals(790, resources.size());
assertEquals("10", resources.get(0).getIdElement().getValueAsString());
@@ -164,18 +181,18 @@ public class SearchCoordinatorSvcImplTest {
ArgumentCaptor searchCaptor = ArgumentCaptor.forClass(Search.class);
verify(mySearchDao, atLeastOnce()).save(searchCaptor.capture());
-
+
verify(mySearchResultDao, atLeastOnce()).save(mySearchResultIterCaptor.capture());
- List allResults= new ArrayList();
+ List allResults = new ArrayList();
for (Iterable next : mySearchResultIterCaptor.getAllValues()) {
allResults.addAll(Lists.newArrayList(next));
}
-
+
assertEquals(790, allResults.size());
assertEquals(10, allResults.get(0).getResourcePid().longValue());
assertEquals(799, allResults.get(789).getResourcePid().longValue());
}
-
+
@Test
public void testAsyncSearchLargeResultSetSameCoordinator() {
SearchParameterMap params = new SearchParameterMap();
@@ -187,12 +204,12 @@ public class SearchCoordinatorSvcImplTest {
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNotNull(result.getUuid());
assertEquals(null, result.size());
List resources;
-
+
resources = result.getResources(0, 30);
assertEquals(30, resources.size());
assertEquals("10", resources.get(0).getIdElement().getValueAsString());
@@ -202,7 +219,7 @@ public class SearchCoordinatorSvcImplTest {
/**
* Subsequent requests for the same search (i.e. a request for the next
- * page) within the same JVM will not use the original bundle provider
+ * page) within the same JVM will not use the original bundle provider
*/
@Test
public void testAsyncSearchLargeResultSetSecondRequestSameCoordinator() {
@@ -215,7 +232,7 @@ public class SearchCoordinatorSvcImplTest {
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNotNull(result.getUuid());
assertEquals(null, result.size());
@@ -223,10 +240,10 @@ public class SearchCoordinatorSvcImplTest {
verify(mySearchDao, atLeast(1)).save(searchCaptor.capture());
Search search = searchCaptor.getValue();
assertEquals(SearchTypeEnum.SEARCH, search.getSearchType());
-
+
List resources;
PersistedJpaBundleProvider provider;
-
+
resources = result.getResources(0, 10);
assertNull(result.size());
assertEquals(10, resources.size());
@@ -244,7 +261,7 @@ public class SearchCoordinatorSvcImplTest {
assertEquals(10, resources.size());
assertEquals("20", resources.get(0).getIdElement().getValueAsString());
assertEquals("29", resources.get(9).getIdElement().getValueAsString());
-
+
provider = new PersistedJpaBundleProvider(result.getUuid(), myCallingDao);
resources = provider.getResources(20, 99999);
assertEquals(770, resources.size());
@@ -265,7 +282,7 @@ public class SearchCoordinatorSvcImplTest {
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNotNull(result.getUuid());
assertEquals(90, result.size().intValue());
@@ -285,18 +302,18 @@ public class SearchCoordinatorSvcImplTest {
@Test
public void testLoadSearchResultsFromDifferentCoordinator() {
final String uuid = UUID.randomUUID().toString();
-
+
final Search search = new Search();
search.setUuid(uuid);
search.setSearchType(SearchTypeEnum.SEARCH);
search.setResourceType("Patient");
-
+
when(mySearchDao.findByUuid(eq(uuid))).thenReturn(search);
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(any(List.class), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
PersistedJpaBundleProvider provider;
List resources;
-
+
new Thread() {
@Override
public void run() {
@@ -305,20 +322,21 @@ public class SearchCoordinatorSvcImplTest {
} catch (InterruptedException e) {
// ignore
}
-
+
when(mySearchResultDao.findWithSearchUuid(any(Search.class), any(Pageable.class))).thenAnswer(new Answer>() {
@Override
public Page answer(InvocationOnMock theInvocation) throws Throwable {
Pageable page = (Pageable) theInvocation.getArguments()[1];
-
+
ArrayList results = new ArrayList();
int max = (page.getPageNumber() * page.getPageSize()) + page.getPageSize();
for (int i = page.getOffset(); i < max; i++) {
results.add(new SearchResult().setResourcePid(i + 10L));
}
-
+
return new PageImpl(results);
- }});
+ }
+ });
search.setStatus(SearchStatusEnum.FINISHED);
}
}.start();
@@ -332,7 +350,7 @@ public class SearchCoordinatorSvcImplTest {
assertEquals(10, resources.size());
assertEquals("20", resources.get(0).getIdElement().getValueAsString());
assertEquals("29", resources.get(9).getIdElement().getValueAsString());
-
+
provider = new PersistedJpaBundleProvider(uuid, myCallingDao);
resources = provider.getResources(20, 40);
assertEquals(20, resources.size());
@@ -353,7 +371,7 @@ public class SearchCoordinatorSvcImplTest {
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(eq(pids), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNull(result.getUuid());
assertEquals(790, result.size().intValue());
@@ -375,7 +393,7 @@ public class SearchCoordinatorSvcImplTest {
pids = createPidSequence(10, 110);
doAnswer(loadPids()).when(mySearchBuider).loadResourcesByPid(eq(pids), any(List.class), any(Set.class), anyBoolean(), any(EntityManager.class), any(FhirContext.class), same(myCallingDao));
- IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient");
+ IBundleProvider result = mySvc.registerSearch(myCallingDao, params, "Patient", new CacheControlDirective());
assertNull(result.getUuid());
assertEquals(100, result.size().intValue());
@@ -394,7 +412,7 @@ public class SearchCoordinatorSvcImplTest {
private int myCount;
private Iterator myWrap;
-
+
public FailAfterNIterator(Iterator theWrap, int theCount) {
myWrap = theWrap;
myCount = theCount;
@@ -416,7 +434,7 @@ public class SearchCoordinatorSvcImplTest {
}
-
+
public static class SlowIterator extends BaseIterator implements Iterator {
private int myDelay;
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java
index 851f28a3dbf..121debf6f37 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/search/r4/PagingMultinodeProviderR4Test.java
@@ -61,7 +61,7 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test {
mySearchCoordinatorSvcRaw.setSyncSizeForUnitTests(10);
mySearchCoordinatorSvcRaw.setNeverUseLocalSearchForUnitTests(true);
- found = ourClient
+ found = myClient
.search()
.forResource(Patient.class)
.sort().ascending(Patient.SP_FAMILY)
@@ -70,19 +70,19 @@ public class PagingMultinodeProviderR4Test extends BaseResourceProviderR4Test {
.execute();
assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A000", "Patient/A001", "Patient/A002", "Patient/A003", "Patient/A004", "Patient/A005", "Patient/A006", "Patient/A007", "Patient/A008", "Patient/A009"));
- found = ourClient
+ found = myClient
.loadPage()
.next(found)
.execute();
assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A010", "Patient/A011", "Patient/A012", "Patient/A013", "Patient/A014", "Patient/A015", "Patient/A016", "Patient/A017", "Patient/A018", "Patient/A019"));
- found = ourClient
+ found = myClient
.loadPage()
.next(found)
.execute();
assertThat(toUnqualifiedVersionlessIdValues(found), contains("Patient/A020", "Patient/A021", "Patient/A022", "Patient/A023", "Patient/A024", "Patient/A025", "Patient/A026", "Patient/A027", "Patient/A028", "Patient/A029"));
- found = ourClient
+ found = myClient
.loadPage()
.next(found)
.execute();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java
index 82d2f6a02fe..ca346af6e6a 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/stresstest/StressTestDstu3Test.java
@@ -1,51 +1,54 @@
package ca.uhn.fhir.jpa.stresstest;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import java.util.List;
-import java.util.UUID;
-
+import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
+import ca.uhn.fhir.util.TestUtil;
+import com.google.common.base.Charsets;
+import com.google.common.collect.Lists;
import org.apache.commons.io.IOUtils;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.hl7.fhir.dstu3.hapi.validation.FhirInstanceValidator;
-import org.hl7.fhir.dstu3.model.*;
+import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Bundle.BundleType;
import org.hl7.fhir.dstu3.model.Bundle.HTTPVerb;
-import org.junit.*;
+import org.hl7.fhir.dstu3.model.CodeableConcept;
+import org.hl7.fhir.dstu3.model.Coding;
+import org.hl7.fhir.dstu3.model.Patient;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
-import com.google.common.base.Charsets;
-import com.google.common.collect.Lists;
+import java.util.List;
+import java.util.UUID;
-import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
-import ca.uhn.fhir.rest.server.interceptor.RequestValidatingInterceptor;
-import ca.uhn.fhir.util.TestUtil;
+import static org.junit.Assert.*;
public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(StressTestDstu3Test.class);
private RequestValidatingInterceptor myRequestValidatingInterceptor;
+ @After
+ public void after() throws Exception {
+ super.after();
+
+ ourRestServer.unregisterInterceptor(myRequestValidatingInterceptor);
+ }
+
@Before
public void before() throws Exception {
super.before();
-
+
myRequestValidatingInterceptor = new RequestValidatingInterceptor();
FhirInstanceValidator module = new FhirInstanceValidator();
module.setValidationSupport(myValidationSupport);
myRequestValidatingInterceptor.addValidatorModule(module);
}
- @After
- public void after() throws Exception {
- super.after();
-
- ourRestServer.unregisterInterceptor(myRequestValidatingInterceptor);
- }
-
@Test
public void testMultithreadedSearch() throws Exception {
Bundle input = new Bundle();
@@ -56,8 +59,8 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
input.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
}
ourClient.transaction().withBundle(input).execute();
-
-
+
+
List tasks = Lists.newArrayList();
try {
for (int threadIndex = 0; threadIndex < 10; threadIndex++) {
@@ -74,10 +77,9 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
validateNoErrors(tasks);
}
-
-
+
/**
- * This test prevents a deadlock that was detected with a large number of
+ * This test prevents a deadlock that was detected with a large number of
* threads creating resources and blocking on the searchparamcache refreshing
* (since this is a synchronized method) while the instance that was actually
* executing was waiting on a DB connection. This was solved by making
@@ -87,7 +89,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
@Test
public void testMultithreadedSearchWithValidation() throws Exception {
ourRestServer.registerInterceptor(myRequestValidatingInterceptor);
-
+
Bundle input = new Bundle();
input.setType(BundleType.TRANSACTION);
for (int i = 0; i < 500; i++) {
@@ -96,7 +98,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
input.addEntry().setResource(p).getRequest().setMethod(HTTPVerb.POST).setUrl("Patient");
}
ourClient.transaction().withBundle(input).execute();
-
+
CloseableHttpResponse getMeta = ourHttpClient.execute(new HttpGet(ourServerBase + "/metadata"));
try {
assertEquals(200, getMeta.getStatusLine().getStatusCode());
@@ -133,7 +135,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
}
total += next.getTaskCount();
}
-
+
ourLog.info("Loaded {} searches", total);
}
@@ -142,14 +144,14 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
TestUtil.clearAllStaticFieldsForUnitTest();
}
- public class BaseTask extends Thread {
+ public class BaseTask extends Thread {
protected Throwable myError;
protected int myTaskCount = 0;
-
+
public BaseTask() {
setDaemon(true);
}
-
+
public Throwable getError() {
return myError;
}
@@ -168,7 +170,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
for (int i = 0; i < 10; i++) {
try {
Bundle respBundle;
-
+
// Load search
HttpGet get = new HttpGet(ourServerBase + "/Patient?identifier=http%3A%2F%2Ftest%7CBAR," + UUID.randomUUID().toString());
get.addHeader(Constants.HEADER_CONTENT_TYPE, Constants.CT_FHIR_JSON_NEW);
@@ -181,7 +183,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
} finally {
IOUtils.closeQuietly(getResp);
}
-
+
// Load page 2
get = new HttpGet(respBundle.getLink("next").getUrl());
get.addHeader(Constants.HEADER_CONTENT_TYPE, Constants.CT_FHIR_JSON_NEW);
@@ -194,7 +196,7 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
} finally {
IOUtils.closeQuietly(getResp);
}
-
+
} catch (Throwable e) {
ourLog.error("Failure during search", e);
myError = e;
@@ -214,9 +216,9 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
p.addIdentifier().setSystem("http://test").setValue("BAR").setType(new CodeableConcept().addCoding(new Coding().setSystem("http://foo").setCode("bar")));
p.setGender(org.hl7.fhir.dstu3.model.Enumerations.AdministrativeGender.MALE);
ourClient.create().resource(p).execute();
-
+
ourSearchParamRegistry.forceRefresh();
-
+
} catch (Throwable e) {
ourLog.error("Failure during search", e);
myError = e;
@@ -226,4 +228,5 @@ public class StressTestDstu3Test extends BaseResourceProviderDstu3Test {
}
}
+
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java
index 007872d6992..310b8c515d3 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/EmailSubscriptionDstu2Test.java
@@ -2,10 +2,9 @@ package ca.uhn.fhir.jpa.subscription;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.jpa.provider.BaseResourceProviderDstu2Test;
-import ca.uhn.fhir.jpa.subscription.email.EmailDetails;
-import ca.uhn.fhir.jpa.subscription.email.EmailSender;
-import ca.uhn.fhir.jpa.subscription.email.IEmailSender;
+import ca.uhn.fhir.jpa.subscription.email.JavaMailEmailSender;
import ca.uhn.fhir.jpa.subscription.email.SubscriptionEmailInterceptor;
+import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
import ca.uhn.fhir.model.dstu2.composite.CodeableConceptDt;
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
import ca.uhn.fhir.model.dstu2.resource.Observation;
@@ -14,11 +13,9 @@ import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
import ca.uhn.fhir.model.dstu2.valueset.SubscriptionChannelTypeEnum;
import ca.uhn.fhir.model.dstu2.valueset.SubscriptionStatusEnum;
import ca.uhn.fhir.rest.api.MethodOutcome;
-import com.icegreen.greenmail.imap.ImapConstants;
-import com.icegreen.greenmail.store.MailFolder;
-import com.icegreen.greenmail.store.Store;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.GreenMailUtil;
+import com.icegreen.greenmail.util.ServerSetup;
import com.icegreen.greenmail.util.ServerSetupTest;
import org.hl7.fhir.instance.model.api.IIdType;
import org.junit.*;
@@ -39,6 +36,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
private static final Logger ourLog = LoggerFactory.getLogger(EmailSubscriptionDstu2Test.class);
private static GreenMail ourTestSmtp;
+ private static int ourListenerPort;
private SubscriptionEmailInterceptor mySubscriber;
private List mySubscriptionIds = new ArrayList<>();
@@ -62,15 +60,16 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
public void before() throws Exception {
super.before();
- EmailSender emailSender = new EmailSender();
- emailSender.setSmtpServerHost("localhost");
- emailSender.setSmtpServerPort(3025);
+ JavaMailEmailSender emailSender = new JavaMailEmailSender();
+ emailSender.setSmtpServerHostname("localhost");
+ emailSender.setSmtpServerPort(ourListenerPort);
emailSender.start();
mySubscriber = new SubscriptionEmailInterceptor();
mySubscriber.setEmailSender(emailSender);
mySubscriber.setResourceDaos(myResourceDaos);
mySubscriber.setFhirContext(myFhirCtx);
+ mySubscriber.setTxManager(ourTxManager);
mySubscriber.start();
ourRestServer.registerInterceptor(mySubscriber);
@@ -128,7 +127,7 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
@Test
public void testSubscribeAndDeliver() throws Exception {
- String payload = "application/json";
+ String payload = "A subscription update has been received";
String code = "1000000050";
String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
@@ -152,12 +151,12 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
ourLog.info("Received: " + GreenMailUtil.getWholeMessage(messages[msgIdx]));
assertEquals("HAPI FHIR Subscriptions", messages[msgIdx].getSubject());
assertEquals(1, messages[msgIdx].getFrom().length);
- assertEquals("unknown@sender.com", ((InternetAddress) messages[msgIdx].getFrom()[0]).getAddress());
+ assertEquals("noreply@unknown.com", ((InternetAddress) messages[msgIdx].getFrom()[0]).getAddress());
assertEquals(2, messages[msgIdx].getAllRecipients().length);
assertEquals("to1@example.com", ((InternetAddress) messages[msgIdx].getAllRecipients()[0]).getAddress());
assertEquals("to2@example.com", ((InternetAddress) messages[msgIdx].getAllRecipients()[1]).getAddress());
assertEquals(1, messages[msgIdx].getHeader("Content-Type").length);
- assertEquals("text/plain; charset=UTF-8", messages[msgIdx].getHeader("Content-Type")[0]);
+ assertEquals("text/plain; charset=us-ascii", messages[msgIdx].getHeader("Content-Type")[0]);
String foundBody = GreenMailUtil.getBody(messages[msgIdx]);
assertEquals("A subscription update has been received", foundBody);
@@ -171,7 +170,10 @@ public class EmailSubscriptionDstu2Test extends BaseResourceProviderDstu2Test {
@BeforeClass
public static void beforeClass() {
- ourTestSmtp = new GreenMail(ServerSetupTest.SMTP);
+ ourListenerPort = RandomServerPortProvider.findFreePort();
+ ServerSetup smtp = new ServerSetup(ourListenerPort, null, ServerSetup.PROTOCOL_SMTP);
+ smtp.setServerStartupTimeout(2000);
+ ourTestSmtp = new GreenMail(smtp);
ourTestSmtp.start();
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java
index aa079ac0871..46baafdadfb 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test.java
@@ -72,6 +72,8 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigDstu2Test extends B
public void beforeReset() {
ourCreatedObservations.clear();
ourUpdatedObservations.clear();
+
+ ourRestHookSubscriptionInterceptor.initSubscriptions();
}
private void waitForQueueToDrain() throws InterruptedException {
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java
new file mode 100644
index 00000000000..7e85a05d75e
--- /dev/null
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSubscriptionDstu3Test.java
@@ -0,0 +1,223 @@
+
+package ca.uhn.fhir.jpa.subscription.email;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.jpa.dao.DaoConfig;
+import ca.uhn.fhir.jpa.provider.dstu3.BaseResourceProviderDstu3Test;
+import ca.uhn.fhir.jpa.subscription.RestHookTestDstu2Test;
+import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
+import ca.uhn.fhir.jpa.util.JpaConstants;
+import ca.uhn.fhir.rest.annotation.Create;
+import ca.uhn.fhir.rest.annotation.ResourceParam;
+import ca.uhn.fhir.rest.annotation.Update;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.api.MethodOutcome;
+import ca.uhn.fhir.rest.server.IResourceProvider;
+import ca.uhn.fhir.rest.server.RestfulServer;
+import ca.uhn.fhir.util.PortUtil;
+import com.google.common.collect.Lists;
+import com.icegreen.greenmail.store.FolderException;
+import com.icegreen.greenmail.util.GreenMail;
+import com.icegreen.greenmail.util.ServerSetup;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.hl7.fhir.dstu3.model.*;
+import org.hl7.fhir.instance.model.api.IBaseResource;
+import org.hl7.fhir.instance.model.api.IIdType;
+import org.junit.*;
+
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeMessage;
+import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Callable;
+
+import static org.junit.Assert.*;
+
+/**
+ * Test the rest-hook subscriptions
+ */
+public class EmailSubscriptionDstu3Test extends BaseResourceProviderDstu3Test {
+
+ private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(EmailSubscriptionDstu3Test.class);
+ private static List ourCreatedObservations = Lists.newArrayList();
+ private static int ourListenerPort;
+ private static List ourContentTypes = new ArrayList<>();
+ private static GreenMail ourTestSmtp;
+ private List mySubscriptionIds = new ArrayList<>();
+
+ @After
+ public void afterUnregisterEmailListener() {
+ ourLog.info("**** Starting @After *****");
+
+ for (IIdType next : mySubscriptionIds){
+ ourClient.delete().resourceById(next).execute();
+ }
+ mySubscriptionIds.clear();
+
+ myDaoConfig.setAllowMultipleDelete(true);
+ ourLog.info("Deleting all subscriptions");
+ ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
+ ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
+ ourLog.info("Done deleting all subscriptions");
+ myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
+
+ ourRestServer.unregisterInterceptor(ourEmailSubscriptionInterceptor);
+
+ }
+
+ @Before
+ public void beforeRegisterEmailListener() throws FolderException {
+ ourTestSmtp.purgeEmailFromAllMailboxes();;
+ ourRestServer.registerInterceptor(ourEmailSubscriptionInterceptor);
+
+ JavaMailEmailSender emailSender = new JavaMailEmailSender();
+ emailSender.setSmtpServerHostname("localhost");
+ emailSender.setSmtpServerPort(ourListenerPort);
+ emailSender.start();
+
+ ourEmailSubscriptionInterceptor.setEmailSender(emailSender);
+ ourEmailSubscriptionInterceptor.setDefaultFromAddress("123@hapifhir.io");
+ }
+
+ @AfterClass
+ public static void afterClass() {
+ ourTestSmtp.stop();
+ }
+
+ @BeforeClass
+ public static void beforeClass() {
+ ourListenerPort = RandomServerPortProvider.findFreePort();
+ ServerSetup smtp = new ServerSetup(ourListenerPort, null, ServerSetup.PROTOCOL_SMTP);
+ smtp.setServerStartupTimeout(2000);
+ ourTestSmtp = new GreenMail(smtp);
+ ourTestSmtp.start();
+ }
+
+
+
+ private Subscription createSubscription(String theCriteria, String thePayload) throws InterruptedException {
+ Subscription subscription = new Subscription();
+ subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)");
+ subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED);
+ subscription.setCriteria(theCriteria);
+
+ Subscription.SubscriptionChannelComponent channel = new Subscription.SubscriptionChannelComponent();
+ channel.setType(Subscription.SubscriptionChannelType.EMAIL);
+ channel.setPayload(thePayload);
+ channel.setEndpoint("mailto:foo@example.com");
+ subscription.setChannel(channel);
+
+ MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
+ subscription.setId(methodOutcome.getId().getIdPart());
+ mySubscriptionIds.add(methodOutcome.getId());
+
+ waitForQueueToDrain();
+
+ return subscription;
+ }
+
+ private Observation sendObservation(String code, String system) {
+ Observation observation = new Observation();
+ CodeableConcept codeableConcept = new CodeableConcept();
+ observation.setCode(codeableConcept);
+ Coding coding = codeableConcept.addCoding();
+ coding.setCode(code);
+ coding.setSystem(system);
+
+ observation.setStatus(Observation.ObservationStatus.FINAL);
+
+ MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
+
+ String observationId = methodOutcome.getId().getIdPart();
+ observation.setId(observationId);
+
+ return observation;
+ }
+
+ @Test
+ public void testEmailSubscriptionNormal() throws Exception {
+ String payload = "This is the body";
+
+ String code = "1000000050";
+ String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
+ createSubscription(criteria1, payload);
+ waitForQueueToDrain();
+
+ sendObservation(code, "SNOMED-CT");
+ waitForQueueToDrain();
+
+ waitForSize(1, 20000, new Callable() {
+ @Override
+ public Number call() throws Exception {
+ return ourTestSmtp.getReceivedMessages().length;
+ }
+ });
+
+ List received = Arrays.asList(ourTestSmtp.getReceivedMessages());
+ assertEquals(1, received.get(0).getFrom().length);
+ assertEquals("123@hapifhir.io", ((InternetAddress)received.get(0).getFrom()[0]).getAddress());
+ assertEquals(1, received.get(0).getAllRecipients().length);
+ assertEquals("foo@example.com", ((InternetAddress)received.get(0).getAllRecipients()[0]).getAddress());
+ assertEquals("text/plain; charset=us-ascii", received.get(0).getContentType());
+ assertEquals("This is the body", received.get(0).getContent().toString().trim());
+ assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]);
+ }
+
+
+ @Test
+ public void testEmailSubscriptionWithCustom() throws Exception {
+ String payload = "This is the body";
+
+ String code = "1000000050";
+ String criteria1 = "Observation?code=SNOMED-CT|" + code + "&_format=xml";
+ Subscription sub1 = createSubscription(criteria1, payload);
+
+ Subscription subscriptionTemp = ourClient.read(Subscription.class, sub1.getId());
+ Assert.assertNotNull(subscriptionTemp);
+ subscriptionTemp.getChannel().addExtension()
+ .setUrl(JpaConstants.EXT_SUBSCRIPTION_EMAIL_FROM)
+ .setValue(new StringType("myfrom@from.com"));
+ subscriptionTemp.getChannel().addExtension()
+ .setUrl(JpaConstants.EXT_SUBSCRIPTION_SUBJECT_TEMPLATE)
+ .setValue(new StringType("This is a subject"));
+ subscriptionTemp.setIdElement(subscriptionTemp.getIdElement().toUnqualifiedVersionless());
+
+
+ ourLog.info(myFhirCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(subscriptionTemp));
+
+
+ ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
+ waitForQueueToDrain();
+
+
+ sendObservation(code, "SNOMED-CT");
+ waitForQueueToDrain();
+
+ waitForSize(1, 20000, new Callable() {
+ @Override
+ public Number call() throws Exception {
+ return ourTestSmtp.getReceivedMessages().length;
+ }
+ });
+
+ List received = Arrays.asList(ourTestSmtp.getReceivedMessages());
+ assertEquals(1, received.size());
+ assertEquals(1, received.get(0).getFrom().length);
+ assertEquals("myfrom@from.com", ((InternetAddress)received.get(0).getFrom()[0]).getAddress());
+ assertEquals(1, received.get(0).getAllRecipients().length);
+ assertEquals("foo@example.com", ((InternetAddress)received.get(0).getAllRecipients()[0]).getAddress());
+ assertEquals("text/plain; charset=us-ascii", received.get(0).getContentType());
+ assertEquals("This is a subject", received.get(0).getSubject().toString().trim());
+ assertEquals("This is the body", received.get(0).getContent().toString().trim());
+ assertEquals(mySubscriptionIds.get(0).toUnqualifiedVersionless().getValue(), received.get(0).getHeader("X-FHIR-Subscription")[0]);
+ }
+
+ private void waitForQueueToDrain() throws InterruptedException {
+ RestHookTestDstu2Test.waitForQueueToDrain(ourEmailSubscriptionInterceptor);
+ }
+
+}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSenderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSenderTest.java
similarity index 66%
rename from hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSenderTest.java
rename to hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSenderTest.java
index b86ad483d6b..828441acb29 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/EmailSenderTest.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/email/JavaMailEmailSenderTest.java
@@ -1,8 +1,10 @@
package ca.uhn.fhir.jpa.subscription.email;
+import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.GreenMailUtil;
-import com.icegreen.greenmail.util.ServerSetupTest;
+import com.icegreen.greenmail.util.ServerSetup;
+import org.hl7.fhir.dstu3.model.IdType;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -15,21 +17,25 @@ import java.util.Arrays;
import static org.junit.Assert.*;
-public class EmailSenderTest {
+public class JavaMailEmailSenderTest {
- private static final Logger ourLog = LoggerFactory.getLogger(EmailSenderTest.class);
+ private static final Logger ourLog = LoggerFactory.getLogger(JavaMailEmailSenderTest.class);
private static GreenMail ourTestSmtp;
+ private static int ourPort;
@Test
public void testSend() throws Exception {
- EmailSender sender = new EmailSender();
- sender.setSmtpServerHost("localhost");
- sender.setSmtpServerPort(3025);
+ JavaMailEmailSender sender = new JavaMailEmailSender();
+ sender.setSmtpServerHostname("localhost");
+ sender.setSmtpServerPort(ourPort);
+ sender.setSmtpServerUsername(null);
+ sender.setSmtpServerPassword(null);
sender.start();
String body = "foo";
EmailDetails details = new EmailDetails();
+ details.setSubscription(new IdType("Subscription/123"));
details.setFrom("foo@example.com ");
details.setTo(Arrays.asList(" to1@example.com", "to2@example.com "));
details.setSubjectTemplate("test subject");
@@ -46,7 +52,7 @@ public class EmailSenderTest {
assertEquals("to1@example.com", ((InternetAddress)messages[0].getAllRecipients()[0]).getAddress());
assertEquals("to2@example.com", ((InternetAddress)messages[0].getAllRecipients()[1]).getAddress());
assertEquals(1, messages[0].getHeader("Content-Type").length);
- assertEquals("text/plain; charset=UTF-8", messages[0].getHeader("Content-Type")[0]);
+ assertEquals("text/plain; charset=us-ascii", messages[0].getHeader("Content-Type")[0]);
String foundBody = GreenMailUtil.getBody(messages[0]);
assertEquals("foo", foundBody);
}
@@ -58,7 +64,10 @@ public class EmailSenderTest {
@BeforeClass
public static void beforeClass() {
- ourTestSmtp = new GreenMail(ServerSetupTest.SMTP);
+ ourPort = RandomServerPortProvider.findFreePort();
+ ServerSetup smtp = new ServerSetup(ourPort, null, ServerSetup.PROTOCOL_SMTP);
+ smtp.setServerStartupTimeout(2000);
+ ourTestSmtp = new GreenMail(smtp);
ourTestSmtp.start();
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java
index 27b6935593e..9dea424bd06 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookActivatesPreExistingSubscriptionsR4Test.java
@@ -54,7 +54,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc
channel.setPayload(thePayload);
channel.setEndpoint(theEndpoint);
- MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
waitForQueueToDrain();
@@ -71,7 +71,7 @@ public class RestHookActivatesPreExistingSubscriptionsR4Test extends BaseResourc
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java
index 515e85d82e4..a8a5d3a702d 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestR4Test.java
@@ -51,14 +51,16 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
@After
public void afterUnregisterRestHookListener() {
for (IIdType next : mySubscriptionIds) {
- ourClient.delete().resourceById(next).execute();
+ IIdType nextId = next.toUnqualifiedVersionless();
+ ourLog.info("Deleting: {}", nextId);
+ myClient.delete().resourceById(nextId).execute();
}
mySubscriptionIds.clear();
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
- ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
- ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
+ myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
+ myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@@ -89,7 +91,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
channel.setPayload(thePayload);
channel.setEndpoint(theEndpoint);
- MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
mySubscriptionIds.add(methodOutcome.getId());
@@ -107,7 +109,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@@ -154,11 +156,11 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_JSON_NEW, ourContentTypes.get(0));
- Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
+ Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
- ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
+ myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@@ -168,7 +170,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
- ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
+ myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
waitForQueueToDrain();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@@ -178,27 +180,27 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
+ myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
+ myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@@ -229,10 +231,10 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForSize(1, ourUpdatedObservations);
assertEquals(Constants.CT_FHIR_XML_NEW, ourContentTypes.get(0));
- Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
+ Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
- ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
+ myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
waitForQueueToDrain();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@@ -242,7 +244,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
- ourClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
+ myClient.delete().resourceById(new IdType("Subscription/" + subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@@ -251,27 +253,27 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
+ myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
+ myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
@@ -331,7 +333,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
subscription.getChannel().addHeader("X-Foo: FOO");
subscription.getChannel().addHeader("X-Bar: BAR");
subscription.setStatus(Subscription.SubscriptionStatus.REQUESTED);
- ourClient.update().resource(subscription).execute();
+ myClient.update().resource(subscription).execute();
waitForQueueToDrain();
sendObservation(code, "SNOMED-CT");
@@ -362,7 +364,7 @@ public class RestHookTestR4Test extends BaseResourceProviderR4Test {
// Disable
subscription.setStatus(Subscription.SubscriptionStatus.OFF);
- ourClient.update().resource(subscription).execute();
+ myClient.update().resource(subscription).execute();
waitForQueueToDrain();
// Send another object
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java
index 48c54cdedee..32e418e82a8 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookTestWithInterceptorRegisteredToDaoConfigR4Test.java
@@ -1,8 +1,6 @@
package ca.uhn.fhir.jpa.subscription.r4;
-import static org.junit.Assert.*;
-
import java.util.List;
import org.eclipse.jetty.server.Server;
@@ -46,7 +44,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
public void afterUnregisterRestHookListener() {
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
- ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
+ myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@@ -76,7 +74,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
channel.setEndpoint(endpoint);
subscription.setChannel(channel);
- MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(subscription).execute();
subscription.setId(methodOutcome.getId().getIdPart());
waitForQueueToDrain();
@@ -101,7 +99,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(observation).execute();
String observationId = methodOutcome.getId().getIdPart();
observation.setId(observationId);
@@ -129,11 +127,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
- Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
+ Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
- ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
+ myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@@ -143,7 +141,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
- ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
+ myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@@ -152,27 +150,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
+ myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
Thread.sleep(500);
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
+ myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
Thread.sleep(500);
@@ -202,11 +200,11 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
waitForSize(0, ourCreatedObservations);
waitForSize(1, ourUpdatedObservations);
- Subscription subscriptionTemp = ourClient.read(Subscription.class, subscription2.getId());
+ Subscription subscriptionTemp = myClient.read(Subscription.class, subscription2.getId());
Assert.assertNotNull(subscriptionTemp);
subscriptionTemp.setCriteria(criteria1);
- ourClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
+ myClient.update().resource(subscriptionTemp).withId(subscriptionTemp.getIdElement()).execute();
Observation observation2 = sendObservation(code, "SNOMED-CT");
@@ -216,7 +214,7 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
waitForSize(0, ourCreatedObservations);
waitForSize(3, ourUpdatedObservations);
- ourClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
+ myClient.delete().resourceById(new IdDt("Subscription", subscription2.getId())).execute();
Observation observationTemp3 = sendObservation(code, "SNOMED-CT");
@@ -225,27 +223,27 @@ public class RestHookTestWithInterceptorRegisteredToDaoConfigR4Test extends Base
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3 = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3 = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept = new CodeableConcept();
observation3.setCode(codeableConcept);
Coding coding = codeableConcept.addCoding();
coding.setCode(code + "111");
coding.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
+ myClient.update().resource(observation3).withId(observation3.getIdElement()).execute();
// Should see no subscription notification
waitForQueueToDrain();
waitForSize(0, ourCreatedObservations);
waitForSize(4, ourUpdatedObservations);
- Observation observation3a = ourClient.read(Observation.class, observationTemp3.getId());
+ Observation observation3a = myClient.read(Observation.class, observationTemp3.getId());
CodeableConcept codeableConcept1 = new CodeableConcept();
observation3a.setCode(codeableConcept1);
Coding coding1 = codeableConcept1.addCoding();
coding1.setCode(code);
coding1.setSystem("SNOMED-CT");
- ourClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
+ myClient.update().resource(observation3a).withId(observation3a.getIdElement()).execute();
// Should see only one subscription notification
waitForQueueToDrain();
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java
index 2a0eae5a583..d32b823f680 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/RestHookWithEventDefinitionR4Test.java
@@ -52,14 +52,14 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes
@After
public void afterUnregisterRestHookListener() {
for (IIdType next : mySubscriptionIds) {
- ourClient.delete().resourceById(next).execute();
+ myClient.delete().resourceById(next).execute();
}
mySubscriptionIds.clear();
myDaoConfig.setAllowMultipleDelete(true);
ourLog.info("Deleting all subscriptions");
- ourClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
- ourClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
+ myClient.delete().resourceConditionalByUrl("Subscription?status=active").execute();
+ myClient.delete().resourceConditionalByUrl("Observation?code:missing=false").execute();
ourLog.info("Done deleting all subscriptions");
myDaoConfig.setAllowMultipleDelete(new DaoConfig().isAllowMultipleDelete());
@@ -83,7 +83,7 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes
*/
Patient patient = FhirR4Util.getPatient();
- MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@@ -114,7 +114,7 @@ public class RestHookWithEventDefinitionR4Test extends BaseResourceProviderR4Tes
channel.setPayload("application/json");
subscription.setChannel(channel);
- methodOutcome = ourClient.create().resource(subscription).execute();
+ methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
}
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java
index dfe9b283c9f..316c9caeba3 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithCriteriaR4Test.java
@@ -49,7 +49,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test {
*/
Patient patient = FhirR4Util.getPatient();
- MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@@ -66,7 +66,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test {
channel.setPayload("application/json");
subscription.setChannel(channel);
- methodOutcome = ourClient.create().resource(subscription).execute();
+ methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
/*
@@ -105,7 +105,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test {
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
@@ -129,7 +129,7 @@ public class WebsocketWithCriteriaR4Test extends BaseResourceProviderR4Test {
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java
index 4aca0fcc419..90a973e69e6 100644
--- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java
+++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/subscription/r4/WebsocketWithSubscriptionIdR4Test.java
@@ -72,7 +72,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes
*/
Patient patient = FhirR4Util.getPatient();
- MethodOutcome methodOutcome = ourClient.create().resource(patient).execute();
+ MethodOutcome methodOutcome = myClient.create().resource(patient).execute();
myPatientId = methodOutcome.getId().getIdPart();
/*
@@ -89,7 +89,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes
channel.setPayload("application/json");
subscription.setChannel(channel);
- methodOutcome = ourClient.create().resource(subscription).execute();
+ methodOutcome = myClient.create().resource(subscription).execute();
mySubscriptionId = methodOutcome.getId().getIdPart();
/*
@@ -122,7 +122,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
@@ -146,7 +146,7 @@ public class WebsocketWithSubscriptionIdR4Test extends BaseResourceProviderR4Tes
observation.setSubject(reference);
observation.setStatus(Observation.ObservationStatus.FINAL);
- MethodOutcome methodOutcome2 = ourClient.create().resource(observation).execute();
+ MethodOutcome methodOutcome2 = myClient.create().resource(observation).execute();
String observationId = methodOutcome2.getId().getIdPart();
observation.setId(observationId);
diff --git a/hapi-fhir-jpaserver-base/src/test/resources/dstu3-person.json b/hapi-fhir-jpaserver-base/src/test/resources/dstu3-person.json
new file mode 100644
index 00000000000..ad7edea379b
--- /dev/null
+++ b/hapi-fhir-jpaserver-base/src/test/resources/dstu3-person.json
@@ -0,0 +1,52 @@
+ {
+ "resourceType": "Person",
+ "id": "PERSON1",
+ "meta": {
+ "versionId": "1",
+ "lastUpdated": "2017-08-17T16:19:40.109+03:00"
+ },
+ "identifier": [
+ {
+ "value": "081181-9984"
+ }
+ ],
+ "name": [
+ {
+ "text": "Anna Testi",
+ "family": "Testi",
+ "given": [
+ "Anna"
+ ]
+ },
+ {
+ "family": "asdfas"
+ }
+ ],
+ "telecom": [
+ {
+ "use": "home"
+ },
+ {
+ "system": "phone",
+ "value": "(044) 1234567",
+ "use": "work"
+ }
+ ],
+ "gender": "female",
+ "birthDate": "1981-11-08",
+ "address": [
+ {
+ "line": [
+ "Osuuspankkitie 2"
+ ],
+ "city": "Helsinki",
+ "postalCode": "00120",
+ "country": "Suomi"
+ },
+ {
+ "city": "Blo-49847020"
+ }
+ ],
+ "active": true
+ }
+
diff --git a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
index 39d8f8970a3..4bba1d9adc6 100644
--- a/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
+++ b/hapi-fhir-jpaserver-example/src/main/webapp/WEB-INF/web.xml
@@ -76,7 +76,7 @@
A comma separated list of allowed headers when making a non simple CORS request.
cors.allowed.headers
- X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers
+ X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Prefer
A comma separated list non-standard response headers that will be exposed to XHR2 object.
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt b/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt
index 21e69afe88a..1e8c7df6044 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt
+++ b/hapi-fhir-jpaserver-uhnfhirtest/derby_maintenance.txt
@@ -74,4 +74,24 @@ drop table trm_concept cascade constraints;
drop table trm_concept_pc_link cascade constraints;
drop table trm_concept_property cascade constraints;
+# Delete all resources
+update hfj_res_ver set forced_id_pid = null where res_id in (select res_id from hfj_resource);
+update hfj_resource set forced_id_pid = null where res_id in (select res_id from hfj_resource);
+delete from hfj_history_tag where res_id in (select res_id from hfj_resource);
+delete from hfj_res_ver where res_id in (select res_id from hfj_resource);
+delete from hfj_forced_id where resource_pid in (select res_id from hfj_resource);
+delete from hfj_res_link where src_resource_id in (select res_id from hfj_resource);
+delete from hfj_res_link where target_resource_id in (select res_id from hfj_resource);
+delete from hfj_spidx_coords where res_id in (select res_id from hfj_resource);
+delete from hfj_spidx_date where res_id in (select res_id from hfj_resource);
+delete from hfj_spidx_number where res_id in (select res_id from hfj_resource);
+delete from hfj_spidx_quantity where res_id in (select res_id from hfj_resource);
+delete from hfj_spidx_string where res_id in (select res_id from hfj_resource);
+delete from hfj_spidx_token where res_id in (select res_id from hfj_resource);
+delete from hfj_spidx_uri where res_id in (select res_id from hfj_resource);
+delete from hfj_res_tag where res_id in (select res_id from hfj_resource);
+delete from hfj_search_result where resource_pid in (select res_id from hfj_resource);
+delete from hfj_res_param_present where res_id in (select res_id from hfj_resource);
+delete from hfj_resource where res_id in (select res_id from hfj_resource);
+
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java
index ab5189cdbe7..a77e7c7b5de 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java
+++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/TestRestfulServer.java
@@ -173,18 +173,7 @@ public class TestRestfulServer extends RestfulServer {
/*
* Enable CORS
*/
- CorsConfiguration config = new CorsConfiguration();
- CorsInterceptor corsInterceptor = new CorsInterceptor(config);
- config.addAllowedHeader("Origin");
- config.addAllowedHeader("Accept");
- config.addAllowedHeader("X-Requested-With");
- config.addAllowedHeader("Content-Type");
- config.addAllowedHeader("Access-Control-Request-Method");
- config.addAllowedHeader("Access-Control-Request-Headers");
- config.addAllowedOrigin("*");
- config.addExposedHeader("Location");
- config.addExposedHeader("Content-Location");
- config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS", "PATCH"));
+ CorsInterceptor corsInterceptor = new CorsInterceptor();
registerInterceptor(corsInterceptor);
/*
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java
index 47380b48473..bf568c7d1c9 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java
+++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu2Config.java
@@ -67,6 +67,7 @@ public class TdlDstu2Config extends BaseJavaConfigDstu2 {
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/testDataLibraryDstu2");
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/testDataLibraryDstu2");
retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
+ retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
return retVal;
}
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java
index 052d974092d..45be4c9e38b 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java
+++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TdlDstu3Config.java
@@ -57,6 +57,7 @@ public class TdlDstu3Config extends BaseJavaConfigDstu3 {
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/testDataLibraryStu3");
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/testDataLibraryStu3");
retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
+ retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
return retVal;
}
diff --git a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java
index 609b537f500..d76e45b40f2 100644
--- a/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java
+++ b/hapi-fhir-jpaserver-uhnfhirtest/src/main/java/ca/uhn/fhirtest/config/TestR4Config.java
@@ -34,6 +34,7 @@ public class TestR4Config extends BaseJavaConfigR4 {
public static final String FHIR_DB_USERNAME = "${fhir.db.username}";
public static final String FHIR_DB_PASSWORD = "${fhir.db.password}";
public static final String FHIR_LUCENE_LOCATION_R4 = "${fhir.lucene.location.r4}";
+ public static final Integer COUNT_SEARCH_RESULTS_UP_TO = 50000;
@Value(TestR4Config.FHIR_DB_USERNAME)
private String myDbUsername;
@@ -56,6 +57,7 @@ public class TestR4Config extends BaseJavaConfigR4 {
retVal.getTreatBaseUrlsAsLocal().add("http://fhirtest.uhn.ca/baseR4");
retVal.getTreatBaseUrlsAsLocal().add("https://fhirtest.uhn.ca/baseR4");
retVal.setIndexMissingFields(DaoConfig.IndexEnabledEnum.ENABLED);
+ retVal.setCountSearchResultsUpTo(TestR4Config.COUNT_SEARCH_RESULTS_UP_TO);
return retVal;
}
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java
index 8a3910f4f5e..ca5d8cba655 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategy.java
@@ -34,6 +34,9 @@ public class IncomingRequestAddressStrategy implements IServerAddressStrategy {
@Override
public String determineServerBase(ServletContext theServletContext, HttpServletRequest theRequest) {
+ if (theRequest == null) {
+ return null;
+ }
String requestFullPath = StringUtils.defaultString(theRequest.getRequestURI());
String servletPath;
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
index a8e7e94a0ed..0dfb36051e9 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServerUtils.java
@@ -29,6 +29,7 @@ import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
+import ca.uhn.fhir.util.BinaryUtil;
import org.hl7.fhir.instance.model.api.*;
import ca.uhn.fhir.context.FhirContext;
@@ -85,10 +86,41 @@ public class RestfulServerUtils {
}
}
if (elements != null && elements.size() > 0) {
- Set newElements = new HashSet();
+ Set newElements = new HashSet<>();
for (String next : elements) {
newElements.add("*." + next);
}
+
+ /*
+ * We try to be smart about what the user is asking for
+ * when they include an _elements parameter. If we're responding
+ * to something that returns a Bundle (e.g. a search) we assume
+ * the elements don't apply to the Bundle itself, unless
+ * the client has explicitly scoped the Bundle
+ * (i.e. with Bundle.total or something like that)
+ */
+ switch (theRequestDetails.getRestOperationType()) {
+ case SEARCH_SYSTEM:
+ case SEARCH_TYPE:
+ case HISTORY_SYSTEM:
+ case HISTORY_TYPE:
+ case HISTORY_INSTANCE:
+ case GET_PAGE:
+ boolean haveExplicitBundleElement = false;
+ for (String next : newElements) {
+ if (next.startsWith("Bundle.")) {
+ haveExplicitBundleElement = true;
+ break;
+ }
+ }
+ if (!haveExplicitBundleElement) {
+ parser.setEncodeElementsAppliesToChildResourcesOnly(true);
+ }
+ break;
+ default:
+ break;
+ }
+
parser.setEncodeElements(newElements);
parser.setEncodeElementsAppliesToResourceTypes(elementsAppliesTo);
}
@@ -146,6 +178,19 @@ public class RestfulServerUtils {
b.append(theBundleType.getCode());
}
+ String paramName = Constants.PARAM_ELEMENTS;
+ String[] params = theRequestParameters.get(paramName);
+ if (params != null) {
+ for (String nextValue : params) {
+ if (isNotBlank(nextValue)) {
+ b.append('&');
+ b.append(paramName);
+ b.append('=');
+ b.append(UrlUtil.escape(nextValue));
+ }
+ }
+ }
+
return b.toString();
} catch (UnsupportedEncodingException e) {
throw new Error("UTF-8 not supported", e);// should not happen
@@ -580,10 +625,19 @@ public class RestfulServerUtils {
} else {
contentType = Constants.CT_OCTET_STREAM;
}
+
// Force binary resources to download - This is a security measure to prevent
// malicious images or HTML blocks being served up as content.
response.addHeader(Constants.HEADER_CONTENT_DISPOSITION, "Attachment;");
+ IBaseReference securityContext = BinaryUtil.getSecurityContext(theServer.getFhirContext(), bin);
+ if (securityContext != null) {
+ String securityContextRef = securityContext.getReferenceElement().getValue();
+ if (isNotBlank(securityContextRef)) {
+ response.addHeader(Constants.HEADER_X_SECURITY_CONTEXT, securityContextRef);
+ }
+ }
+
return response.sendAttachmentResponse(bin, theStausCode, contentType);
}
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java
index 795c066e328..38f7307b3bb 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java
@@ -21,10 +21,13 @@ package ca.uhn.fhir.rest.server.interceptor;
*/
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import ca.uhn.fhir.rest.api.Constants;
import org.apache.commons.lang3.Validate;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsProcessor;
@@ -43,14 +46,16 @@ public class CorsInterceptor extends InterceptorAdapter {
* a FHIR server. This includes:
*
* - Allowed Origin: *
- * - Allowed Header: Origin
* - Allowed Header: Accept
- * - Allowed Header: X-Requested-With
- * - Allowed Header: Content-Type
- * - Allowed Header: Access-Control-Request-Method
* - Allowed Header: Access-Control-Request-Headers
- * - Exposed Header: Location
+ * - Allowed Header: Access-Control-Request-Method
+ * - Allowed Header: Cache-Control
* - Exposed Header: Content-Location
+ * - Allowed Header: Content-Type
+ * - Exposed Header: Location
+ * - Allowed Header: Origin
+ * - Allowed Header: Prefer
+ * - Allowed Header: X-Requested-With
*
* Note that this configuration is useful for quickly getting CORS working, but
* in a real production system you probably want to consider whether it is
@@ -61,29 +66,9 @@ public class CorsInterceptor extends InterceptorAdapter {
this(createDefaultCorsConfig());
}
- private static CorsConfiguration createDefaultCorsConfig() {
- CorsConfiguration retVal = new CorsConfiguration();
-
- // *********************************************************
- // Update constructor documentation if you change these:
- // *********************************************************
-
- retVal.addAllowedHeader("Origin");
- retVal.addAllowedHeader("Accept");
- retVal.addAllowedHeader("X-Requested-With");
- retVal.addAllowedHeader("Content-Type");
- retVal.addAllowedHeader("Access-Control-Request-Method");
- retVal.addAllowedHeader("Access-Control-Request-Headers");
- retVal.addAllowedOrigin("*");
- retVal.addExposedHeader("Location");
- retVal.addExposedHeader("Content-Location");
-
- return retVal;
- }
-
/**
* Constructor which accepts the given configuration
- *
+ *
* @param theConfiguration
* The CORS configuration
*/
@@ -93,13 +78,6 @@ public class CorsInterceptor extends InterceptorAdapter {
setConfig(theConfiguration);
}
- /**
- * Sets the CORS configuration
- */
- public void setConfig(CorsConfiguration theConfiguration) {
- myConfig = theConfiguration;
- }
-
/**
* Gets the CORS configuration
*/
@@ -107,6 +85,13 @@ public class CorsInterceptor extends InterceptorAdapter {
return myConfig;
}
+ /**
+ * Sets the CORS configuration
+ */
+ public void setConfig(CorsConfiguration theConfiguration) {
+ myConfig = theConfiguration;
+ }
+
@Override
public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) {
if (CorsUtils.isCorsRequest(theRequest)) {
@@ -124,4 +109,19 @@ public class CorsInterceptor extends InterceptorAdapter {
return super.incomingRequestPreProcessed(theRequest, theResponse);
}
+ private static CorsConfiguration createDefaultCorsConfig() {
+ CorsConfiguration retVal = new CorsConfiguration();
+
+ retVal.setAllowedHeaders(new ArrayList<>(Constants.CORS_ALLOWED_HEADERS));
+ retVal.setAllowedMethods(new ArrayList<>(Constants.CORS_ALLWED_METHODS));
+
+ retVal.addExposedHeader("Content-Location");
+ retVal.addExposedHeader("Location");
+
+ retVal.addAllowedOrigin("*");
+
+
+ return retVal;
+ }
+
}
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java
index 9fe6ce1ed6f..60820b85046 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/BaseResourceReturningMethodBinding.java
@@ -149,24 +149,6 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi
return theRequest.getResponse().streamResponseAsResource(response, prettyPrint, summaryMode, Constants.STATUS_HTTP_200_OK, null, theRequest.isRespondGzip(), isAddContentLocationHeader());
- // DSTU1 Bundle
- // // Is this request coming from a browser
- // String uaHeader = theRequest.getHeader("user-agent");
- // boolean requestIsBrowser = false;
- // if (uaHeader != null && uaHeader.contains("Mozilla")) {
- // requestIsBrowser = true;
- // }
- //
- // for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
- // IServerInterceptor next = theServer.getInterceptors().get(i);
- // boolean continueProcessing = next.outgoingResponse(theRequest, responseObject.getDstu1Bundle());
- // if (!continueProcessing) {
- // ourLog.debug("Interceptor {} returned false, not continuing processing");
- // return null;
- // }
- // }
- //
- // return theRequest.getResponse().streamResponseAsBundle(responseObject.getDstu1Bundle(), summaryMode, theRequest.isRespondGzip(), requestIsBrowser);
}
public IBaseResource doInvokeServer(IRestfulServer> theServer, RequestDetails theRequest) {
@@ -349,8 +331,8 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi
}
}
- bundleFactory.addRootPropertiesToBundle(null, serverBase, theLinkSelf, linkPrev, linkNext, theResult.size(), theBundleType, theResult.getPublished());
- bundleFactory.addResourcesToBundle(new ArrayList(resourceList), theBundleType, serverBase, theServer.getBundleInclusionRule(), theIncludes);
+ bundleFactory.addRootPropertiesToBundle(theResult.getUuid(), serverBase, theLinkSelf, linkPrev, linkNext, theResult.size(), theBundleType, theResult.getPublished());
+ bundleFactory.addResourcesToBundle(new ArrayList<>(resourceList), theBundleType, serverBase, theServer.getBundleInclusionRule(), theIncludes);
if (theServer.getPagingProvider() != null) {
int limit;
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java
index 050e2a6d468..710c1b07c9a 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ReadMethodBinding.java
@@ -161,7 +161,7 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding {
ifNoneMatch = ParameterUtil.parseETagValue(ifNoneMatch);
if (responseResource.getIdElement() != null && responseResource.getIdElement().hasVersionIdPart()) {
if (responseResource.getIdElement().getVersionIdPart().equals(ifNoneMatch)) {
- ourLog.debug("Returning HTTP 301 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch);
+ ourLog.debug("Returning HTTP 304 because request specified {}={}", Constants.HEADER_IF_NONE_MATCH, ifNoneMatch);
throw new NotModifiedException("Not Modified");
}
}
@@ -182,8 +182,8 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding {
lastModified = responseResource.getMeta().getLastUpdated();
}
- if (lastModified != null && lastModified.getTime() > ifModifiedSinceDate.getTime()) {
- ourLog.debug("Returning HTTP 301 because If-Modified-Since does not match");
+ if (lastModified != null && lastModified.getTime() <= ifModifiedSinceDate.getTime()) {
+ ourLog.debug("Returning HTTP 304 because If-Modified-Since does not match");
throw new NotModifiedException("Not Modified");
}
}
diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java
index 03567863f67..de5abc7839c 100644
--- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java
+++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/method/ResourceParameter.java
@@ -19,7 +19,24 @@ package ca.uhn.fhir.rest.server.method;
* limitations under the License.
* #L%
*/
-import static org.apache.commons.lang3.StringUtils.isBlank;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.context.FhirVersionEnum;
+import ca.uhn.fhir.parser.DataFormatException;
+import ca.uhn.fhir.parser.IParser;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.api.EncodingEnum;
+import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
+import ca.uhn.fhir.rest.api.server.RequestDetails;
+import ca.uhn.fhir.rest.server.IResourceProvider;
+import ca.uhn.fhir.rest.server.RestfulServerUtils;
+import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
+import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import ca.uhn.fhir.util.BinaryUtil;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.Validate;
+import org.hl7.fhir.instance.model.api.IBaseBinary;
+import org.hl7.fhir.instance.model.api.IBaseResource;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -30,27 +47,8 @@ import java.lang.reflect.Modifier;
import java.nio.charset.Charset;
import java.util.Collection;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang3.Validate;
-import org.hl7.fhir.instance.model.api.IBaseBinary;
-import org.hl7.fhir.instance.model.api.IBaseResource;
-
-import ca.uhn.fhir.context.FhirContext;
-import ca.uhn.fhir.context.FhirVersionEnum;
-import ca.uhn.fhir.model.api.IResource;
-import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
-import ca.uhn.fhir.model.api.TagList;
-import ca.uhn.fhir.parser.DataFormatException;
-import ca.uhn.fhir.parser.IParser;
-import ca.uhn.fhir.rest.api.Constants;
-import ca.uhn.fhir.rest.api.EncodingEnum;
-import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
-import ca.uhn.fhir.rest.api.server.RequestDetails;
-import ca.uhn.fhir.rest.param.ParameterUtil;
-import ca.uhn.fhir.rest.server.IResourceProvider;
-import ca.uhn.fhir.rest.server.RestfulServerUtils;
-import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
-import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
+import static org.apache.commons.lang3.StringUtils.isBlank;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
public class ResourceParameter implements IParameter {
@@ -193,11 +191,22 @@ public class ResourceParameter implements IParameter {
String ct = theRequest.getHeader(Constants.HEADER_CONTENT_TYPE);
if (EncodingEnum.forContentTypeStrict(ct) == null) {
FhirContext ctx = theRequest.getServer().getFhirContext();
- IBaseBinary binary = (IBaseBinary) ctx.getResourceDefinition("Binary").newInstance();
+ IBaseBinary binary = BinaryUtil.newBinary(ctx);
binary.setId(theRequest.getId());
binary.setContentType(ct);
binary.setContent(theRequest.loadRequestContents());
retVal = binary;
+
+ /*
+ * Security context header, which is only in
+ * DSTU3+
+ */
+ if (ctx.getVersion().getVersion().isEqualOrNewerThan(FhirVersionEnum.DSTU3)) {
+ String securityContext = theRequest.getHeader(Constants.HEADER_X_SECURITY_CONTEXT);
+ if (isNotBlank(securityContext)) {
+ BinaryUtil.setSecurityContext(ctx, binary, securityContext);
+ }
+ }
}
}
diff --git a/hapi-fhir-server/src/test/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategyTest.java b/hapi-fhir-server/src/test/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategyTest.java
new file mode 100644
index 00000000000..4cc9d3682ec
--- /dev/null
+++ b/hapi-fhir-server/src/test/java/ca/uhn/fhir/rest/server/IncomingRequestAddressStrategyTest.java
@@ -0,0 +1,16 @@
+package ca.uhn.fhir.rest.server;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+public class IncomingRequestAddressStrategyTest {
+
+ @Test
+ public void testRequestWithNull() {
+ IncomingRequestAddressStrategy s = new IncomingRequestAddressStrategy();
+ String result = s.determineServerBase(null, null);
+ assertNull(result);
+ }
+
+}
diff --git a/hapi-fhir-structures-dstu2.1/pom.xml b/hapi-fhir-structures-dstu2.1/pom.xml
index e826d9f5a95..47968c3f638 100644
--- a/hapi-fhir-structures-dstu2.1/pom.xml
+++ b/hapi-fhir-structures-dstu2.1/pom.xml
@@ -29,6 +29,11 @@
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+ test
+
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu2.1
diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java
index dfc86d1d2e4..273b0c2cf8b 100644
--- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java
+++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/hapi/rest/server/Dstu2_1BundleFactory.java
@@ -226,12 +226,15 @@ public class Dstu2_1BundleFactory implements IVersionSpecificBundleFactory {
}
@Override
- public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType,
- IPrimitiveType theLastUpdated) {
+ public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType,
+ IPrimitiveType theLastUpdated) {
ensureBundle();
myBase = theServerBase;
+ if (myBundle.getIdElement().isEmpty()) {
+ myBundle.setId(theId);
+ }
if (myBundle.getIdElement().isEmpty()) {
myBundle.setId(UUID.randomUUID().toString());
}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java
index 0b116dab9c2..45c47692d64 100644
--- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java
+++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/BackboneElement.java
@@ -159,6 +159,7 @@ public abstract class BackboneElement extends Element implements IBaseBackboneEl
public abstract BackboneElement copy();
public void copyValues(BackboneElement dst) {
+ super.copyValues(dst);
if (modifierExtension != null) {
dst.modifierExtension = new ArrayList();
for (Extension i : modifierExtension)
diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java
index f2794e50265..2c243fef9d4 100644
--- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java
+++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/model/DomainResource.java
@@ -340,6 +340,7 @@ public abstract class DomainResource extends Resource implements IBaseHasExtensi
public abstract DomainResource copy();
public void copyValues(DomainResource dst) {
+ super.copyValues(dst);
dst.text = text == null ? null : text.copy();
if (contained != null) {
dst.contained = new ArrayList();
diff --git a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java
index 5758b77472b..42a4449f3bf 100644
--- a/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java
+++ b/hapi-fhir-structures-dstu2.1/src/main/java/org/hl7/fhir/dstu2016may/utils/JsonTrackingParser.java
@@ -364,6 +364,7 @@ public class JsonTrackingParser {
break;
case Eof :
throw lexer.error("Unexpected End of File");
+ case End:
default:
break;
}
@@ -407,6 +408,8 @@ public class JsonTrackingParser {
break;
case Eof :
throw lexer.error("Unexpected End of File");
+ case Boolean:
+ case End:
default:
break;
}
diff --git a/hapi-fhir-structures-dstu2.1/src/main/resources/.keep b/hapi-fhir-structures-dstu2.1/src/main/resources/.keep
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/BackboneElementDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/BackboneElementDstu2_1Test.java
new file mode 100644
index 00000000000..f5c092029a4
--- /dev/null
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/BackboneElementDstu2_1Test.java
@@ -0,0 +1,26 @@
+package ca.uhn.fhir.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.hl7.fhir.dstu2016may.model.BackboneElement;
+import org.hl7.fhir.dstu2016may.model.Patient.PatientCommunicationComponent;
+import org.junit.Test;
+
+public class BackboneElementDstu2_1Test {
+ /**
+ * Ensuring that IDs of subtypes of BackboneElement get copied when
+ * the {@link org.hl7.fhir.dstu2016may.model.BackboneElement#copy()} method is called
+ */
+ @Test
+ public void testPatientCommunicationComponentIdCopy() {
+ PatientCommunicationComponent pcc1 = new PatientCommunicationComponent();
+ pcc1.setId("1001");
+
+ PatientCommunicationComponent copiedPcc = pcc1.copy();
+ String copiedPccID = copiedPcc.getIdElement().getIdPart();
+
+ assertTrue(copiedPcc instanceof BackboneElement); // Just making sure this assumption still holds up, otherwise this test isn't very useful
+ assertEquals("1001", copiedPccID);
+ }
+}
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java
new file mode 100644
index 00000000000..f05415e1934
--- /dev/null
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/model/DomainResourceDstu2_1Test.java
@@ -0,0 +1,30 @@
+package ca.uhn.fhir.model;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.hl7.fhir.dstu2016may.model.DomainResource;
+import org.hl7.fhir.dstu2016may.model.Narrative;
+import org.hl7.fhir.dstu2016may.model.Patient;
+import org.junit.Test;
+
+public class DomainResourceDstu2_1Test {
+ /**
+ * Ensuring that Ensuring that fields defined in {@link org.hl7.fhir.dstu2016may.model.DomainResource} and {@link org.hl7.fhir.dstu2016may.model.Resource}
+ * get copied when the {@link org.hl7.fhir.dstu2016may.model.DomainResource#copy()} method is called
+ */
+ @Test
+ public void testPatientCopy() {
+ Patient p1 = new Patient();
+ p1.setId("1001");
+ p1.setText(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL));
+
+ Patient copiedPatient = p1.copy();
+ String copiedPatientID = copiedPatient.getIdElement().getIdPart();
+ Narrative.NarrativeStatus copiedPatientTextStatus = copiedPatient.getText().getStatus();
+
+ assertTrue(copiedPatient instanceof DomainResource); // Just making sure this assumption still holds up, otherwise this test isn't very useful
+ assertEquals("1001", copiedPatientID);
+ assertEquals(new Narrative().setStatus(Narrative.NarrativeStatus.ADDITIONAL).getStatus(), copiedPatientTextStatus);
+ }
+}
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java
index c4702d6d789..131d79141be 100644
--- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/JsonParserDstu2_1Test.java
@@ -1499,7 +1499,7 @@ public class JsonParserDstu2_1Test {
String val = ourCtx.newJsonParser().encodeResourceToString(patient);
- String expected = "{\"resourceType\":\"Binary\",\"id\":\"11\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}";
+ String expected = "{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}";
ourLog.info("Expected: {}", expected);
ourLog.info("Actual : {}", val);
assertEquals(expected, val);
diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java
new file mode 100644
index 00000000000..98bbae280fb
--- /dev/null
+++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2_1Test.java
@@ -0,0 +1,152 @@
+package ca.uhn.fhir.rest.client;
+
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.InputStream;
+import java.io.StringReader;
+import java.nio.charset.Charset;
+
+import ca.uhn.fhir.context.FhirVersionEnum;
+import ca.uhn.fhir.rest.api.Constants;
+import ca.uhn.fhir.rest.client.api.IGenericClient;
+import ca.uhn.fhir.rest.client.api.ServerValidationModeEnum;
+import org.apache.commons.io.input.ReaderInputStream;
+import org.apache.http.HttpResponse;
+import org.apache.http.ProtocolVersion;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.HttpUriRequest;
+import org.apache.http.message.BasicHeader;
+import org.apache.http.message.BasicStatusLine;
+import org.hl7.fhir.dstu2016may.model.Conformance;
+import org.hl7.fhir.dstu2016may.model.Patient;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Matchers;
+import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+
+import ca.uhn.fhir.context.FhirContext;
+import ca.uhn.fhir.model.primitive.UriDt;
+import ca.uhn.fhir.rest.client.exceptions.FhirClientInappropriateForServerException;
+import ca.uhn.fhir.util.TestUtil;
+
+public class ClientServerValidationDstu2_1Test {
+
+ private FhirContext myCtx;
+ private HttpClient myHttpClient;
+ private HttpResponse myHttpResponse;
+ private boolean myFirstResponse;
+
+ @Before
+ public void before() {
+ myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs());
+ myHttpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
+ myFirstResponse = true;
+
+ myCtx = FhirContext.forDstu2_1();
+ myCtx.getRestfulClientFactory().setHttpClient(myHttpClient);
+ }
+
+ @Test
+ public void testServerReturnsAppropriateVersionDstu2_1() throws Exception {
+ String appropriateFhirVersion = "1.4.0";
+ assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2_1.getFhirVersionString()));
+ Conformance conf = new Conformance();
+ conf.setFhirVersion(appropriateFhirVersion);
+ final String confResource = myCtx.newXmlParser().encodeResourceToString(conf);
+
+ ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
+
+ when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() {
+ @Override
+ public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
+ if (myFirstResponse) {
+ myFirstResponse=false;
+ return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8"));
+ } else {
+ return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8"));
+ }
+ }});
+
+ when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
+
+ myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
+ IGenericClient client = myCtx.newRestfulGenericClient("http://foo");
+
+ // don't load the conformance until the first time the client is actually used
+ assertTrue(myFirstResponse);
+ client.read(new UriDt("http://foo/Patient/123"));
+ assertFalse(myFirstResponse);
+ myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123"));
+ myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123"));
+
+ // Conformance only loaded once, then 3 reads
+ verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class));
+ }
+
+ @Test
+ public void testServerReturnsWrongVersionDstu2_1() throws Exception {
+ String wrongFhirVersion = "1.0.2";
+ assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString()));
+ Conformance conf = new Conformance();
+ conf.setFhirVersion(wrongFhirVersion);
+ String msg = myCtx.newXmlParser().encodeResourceToString(conf);
+
+ ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
+
+ when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
+
+ when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
+
+ myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
+ try {
+ myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/1"));
+ fail();
+ } catch (FhirClientInappropriateForServerException e) {
+ assertThat(e.toString(), containsString("The server at base URL \"http://foo/metadata\" returned a conformance statement indicating that it supports FHIR version \"1.0.2\" which corresponds to DSTU2, but this client is configured to use DSTU2_1 (via the FhirContext)"));
+ }
+ }
+
+ @Test
+ public void testServerReturnsRightVersionDstu2_1() throws Exception {
+ String appropriateFhirVersion = "1.4.0";
+ assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2_1.getFhirVersionString()));
+ Conformance conf = new Conformance();
+ conf.setFhirVersion(appropriateFhirVersion);
+ String msg = myCtx.newXmlParser().encodeResourceToString(conf);
+
+ ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
+
+ when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
+
+ when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
+
+ myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
+ myCtx.newRestfulGenericClient("http://foo").forceConformanceCheck();
+ }
+
+ @AfterClass
+ public static void afterClassClearContext() {
+ TestUtil.clearAllStaticFieldsForUnitTest();
+ }
+
+}
+
diff --git a/hapi-fhir-structures-dstu2/pom.xml b/hapi-fhir-structures-dstu2/pom.xml
index eb4e7e82391..1028391e59d 100644
--- a/hapi-fhir-structures-dstu2/pom.xml
+++ b/hapi-fhir-structures-dstu2/pom.xml
@@ -23,6 +23,11 @@
+
+ org.codehaus.woodstox
+ woodstox-core-asl
+ test
+
ca.uhn.hapi.fhir
hapi-fhir-validation-resources-dstu2
@@ -318,8 +323,8 @@
- test
testscript
user
valueset
diff --git a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java
index 676a1184782..cfa5a19ba74 100644
--- a/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java
+++ b/hapi-fhir-structures-dstu2/src/main/java/ca/uhn/fhir/rest/server/provider/dstu2/Dstu2BundleFactory.java
@@ -219,12 +219,15 @@ public class Dstu2BundleFactory implements IVersionSpecificBundleFactory {
}
@Override
- public void addRootPropertiesToBundle(String theAuthor, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType,
- IPrimitiveType theLastUpdated) {
+ public void addRootPropertiesToBundle(String theId, String theServerBase, String theLinkSelf, String theLinkPrev, String theLinkNext, Integer theTotalResults, BundleTypeEnum theBundleType,
+ IPrimitiveType theLastUpdated) {
ensureBundle();
myBase = theServerBase;
+ if (myBundle.getIdElement().isEmpty()) {
+ myBundle.setId(theId);
+ }
if (myBundle.getId().isEmpty()) {
myBundle.setId(UUID.randomUUID().toString());
}
diff --git a/hapi-fhir-structures-dstu2/src/main/resources/.keep b/hapi-fhir-structures-dstu2/src/main/resources/.keep
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java
index 28491dbdb7b..6400f939e23 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/ClientServerValidationDstu2Test.java
@@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.client;
import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -16,6 +17,7 @@ import java.io.InputStream;
import java.io.StringReader;
import java.nio.charset.Charset;
+import ca.uhn.fhir.context.FhirVersionEnum;
import org.apache.commons.io.input.ReaderInputStream;
import org.apache.http.*;
import org.apache.http.client.HttpClient;
@@ -67,8 +69,10 @@ public class ClientServerValidationDstu2Test {
@Test
public void testClientUsesInterceptors() throws Exception {
+ String appropriateFhirVersion = "1.0.2";
+ assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString()));
Conformance conf = new Conformance();
- conf.setFhirVersion("1.0.2");
+ conf.setFhirVersion(appropriateFhirVersion);
final String confResource = myCtx.newXmlParser().encodeResourceToString(conf);
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
@@ -109,8 +113,10 @@ public class ClientServerValidationDstu2Test {
@Test
public void testForceConformanceCheck() throws Exception {
+ String appropriateFhirVersion = "1.0.2";
+ assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString()));
Conformance conf = new Conformance();
- conf.setFhirVersion("1.0.2");
+ conf.setFhirVersion(appropriateFhirVersion);
final String confResource = myCtx.newXmlParser().encodeResourceToString(conf);
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
@@ -178,46 +184,9 @@ public class ClientServerValidationDstu2Test {
}
}
+ // This test can should stay to test the leniency of accepting unknown FHIR versions from the server
@Test
- public void testServerReturnsAppropriateVersionForDstu2_040() throws Exception {
- Conformance conf = new Conformance();
- conf.setFhirVersion("0.5.0");
- final String confResource = myCtx.newXmlParser().encodeResourceToString(conf);
-
- ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
-
- when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
- when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
- when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() {
- @Override
- public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
- if (myFirstResponse) {
- myFirstResponse = false;
- return new ReaderInputStream(new StringReader(confResource), Charset.forName("UTF-8"));
- } else {
- return new ReaderInputStream(new StringReader(myCtx.newXmlParser().encodeResourceToString(new Patient())), Charset.forName("UTF-8"));
- }
- }
- });
-
- when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
-
- myCtx.getRestfulClientFactory().setServerValidationMode(ServerValidationModeEnum.ONCE);
- IGenericClient client = myCtx.newRestfulGenericClient("http://foo");
-
- // don't load the conformance until the first time the client is actually used
- assertTrue(myFirstResponse);
- client.read(new UriDt("http://foo/Patient/123"));
- assertFalse(myFirstResponse);
- myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123"));
- myCtx.newRestfulGenericClient("http://foo").read(new UriDt("http://foo/Patient/123"));
-
- // Conformance only loaded once, then 3 reads
- verify(myHttpClient, times(4)).execute(Matchers.any(HttpUriRequest.class));
- }
-
- @Test
- public void testServerReturnsAppropriateVersionForDstu2_050() throws Exception {
+ public void testServerReturnsAppropriateVersionForUnknownVersion() throws Exception {
Conformance conf = new Conformance();
conf.setFhirVersion("0.5.0");
final String confResource = myCtx.newXmlParser().encodeResourceToString(conf);
@@ -256,8 +225,10 @@ public class ClientServerValidationDstu2Test {
@Test
public void testServerReturnsAppropriateVersionForDstu2() throws Exception {
+ String appropriateFhirVersion = "1.0.2";
+ assertThat(appropriateFhirVersion, is(FhirVersionEnum.DSTU2.getFhirVersionString()));
Conformance conf = new Conformance();
- conf.setFhirVersion("1.0.2");
+ conf.setFhirVersion(appropriateFhirVersion);
final String confResource = myCtx.newXmlParser().encodeResourceToString(conf);
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
@@ -294,8 +265,10 @@ public class ClientServerValidationDstu2Test {
@Test
public void testServerReturnsWrongVersionForDstu2() throws Exception {
+ String wrongFhirVersion = "3.0.1";
+ assertThat(wrongFhirVersion, is(FhirVersionEnum.DSTU3.getFhirVersionString())); // asserting that what we assume to be the DSTU3 FHIR version is still correct
Conformance conf = new Conformance();
- conf.setFhirVersion("3.0.1");
+ conf.setFhirVersion(wrongFhirVersion);
String msg = myCtx.newXmlParser().encodeResourceToString(conf);
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java
index 58282a11db8..86fd1e9b0a1 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ReadDstu2Test.java
@@ -57,20 +57,38 @@ public class ReadDstu2Test {
CloseableHttpResponse status;
HttpGet httpGet;
+ // Fixture was last modified at 2012-01-01T12:12:12Z
+ // thus it has changed before the later time of 2012-01-01T13:00:00Z
+ // so we expect a 304
httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2");
httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T13:00:00Z").getValue()));
status = ourClient.execute(httpGet);
try {
- assertEquals(200, status.getStatusLine().getStatusCode());
+ assertEquals(304, status.getStatusLine().getStatusCode());
} finally {
IOUtils.closeQuietly(status);
}
+ // Fixture was last modified at 2012-01-01T12:12:12Z
+ // thus it has changed at the same time of 2012-01-01T12:12:12Z
+ // so we expect a 304
+ httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2");
+ httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T12:12:12Z").getValue()));
+ status = ourClient.execute(httpGet);
+ try {
+ assertEquals(304, status.getStatusLine().getStatusCode());
+ } finally {
+ IOUtils.closeQuietly(status);
+ }
+
+ // Fixture was last modified at 2012-01-01T12:12:12Z
+ // thus it has changed after the earlier time of 2012-01-01T10:00:00Z
+ // so we expect a 200
httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2");
httpGet.addHeader(Constants.HEADER_IF_MODIFIED_SINCE, DateUtils.formatDate(new InstantDt("2012-01-01T10:00:00Z").getValue()));
status = ourClient.execute(httpGet);
try {
- assertEquals(304, status.getStatusLine().getStatusCode());
+ assertEquals(200, status.getStatusLine().getStatusCode());
} finally {
IOUtils.closeQuietly(status);
}
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java
index 9d3e17b4f8c..a72517521ef 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/LoggingInterceptorDstu2Test.java
@@ -192,7 +192,7 @@ public class LoggingInterceptorDstu2Test {
ArgumentCaptor