Merge branch 'dstu2_final' of github.com:jamesagnew/hapi-fhir into dstu2_final
This commit is contained in:
commit
b28dba3540
|
@ -13,6 +13,7 @@ Servers/
|
|||
nohup.out
|
||||
.DS_Store
|
||||
*.orig
|
||||
tmp.txt
|
||||
|
||||
# Vagrant stuff.
|
||||
.vagrant
|
||||
|
|
|
@ -13,8 +13,12 @@ cache:
|
|||
- '$HOME/.m2/repository'
|
||||
|
||||
install: /bin/true
|
||||
|
||||
# This seems to be required to get travis to set Xmx4g, per https://github.com/travis-ci/travis-ci/issues/3893
|
||||
before_script:
|
||||
- export MAVEN_SKIP_RC=true
|
||||
|
||||
script:
|
||||
- mvn -B clean install && cd hapi-fhir-cobertura && mvn -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID -P COBERTURA clean cobertura:cobertura coveralls:report
|
||||
# - mvn -B clean install -Dcobertura.skip=true && mvn -B -DTRAVIS_JOB_ID=$TRAVIS_JOB_ID -P COBERTURA clean cobertura:cobertura coveralls:report
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ hapi-fhir
|
|||
HAPI FHIR - Java API for HL7 FHIR Clients and Servers
|
||||
|
||||
[![Build Status](https://travis-ci.org/jamesagnew/hapi-fhir.svg?branch=master)](https://travis-ci.org/jamesagnew/hapi-fhir)
|
||||
[![Coverage Status](https://coveralls.io/repos/jamesagnew/hapi-fhir/badge.svg?branch=master)](https://coveralls.io/r/jamesagnew/hapi-fhir?branch=master)
|
||||
[![Coverage Status](https://coveralls.io/repos/jamesagnew/hapi-fhir/badge.svg?branch=master&service=github)](https://coveralls.io/github/jamesagnew/hapi-fhir?branch=master)
|
||||
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/ca.uhn.hapi.fhir/hapi-fhir-base/badge.svg)](http://search.maven.org/#search|ga|1|ca.uhn.hapi.fhir)
|
||||
|
||||
Complete project documentation is available here:
|
||||
|
|
|
@ -269,6 +269,7 @@ public class GenericClientExample {
|
|||
.encodedJson()
|
||||
.where(Patient.BIRTHDATE.beforeOrEquals().day("2012-01-22"))
|
||||
.and(Patient.BIRTHDATE.after().day("2011-01-01"))
|
||||
.withTag("http://acme.org/codes", "needs-review")
|
||||
.include(Patient.INCLUDE_ORGANIZATION)
|
||||
.revInclude(Provenance.INCLUDE_TARGET)
|
||||
.lastUpdated(new DateRangeParam("2011-01-01", null))
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="target/hapi-fhir-android-1.2-SNAPSHOT.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
|
|
@ -38,14 +38,13 @@
|
|||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.2-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>com.phloc</groupId>
|
||||
<artifactId>phloc-schematron</artifactId>
|
||||
|
@ -56,6 +55,7 @@
|
|||
<artifactId>phloc-commons</artifactId>
|
||||
<version>${phloc_commons_version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient-android</artifactId>
|
||||
|
@ -76,7 +76,16 @@
|
|||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons_io_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons_codec_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons_lang_version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Android does not come with the Servlet API bundled, and MethodUtil
|
||||
|
@ -113,10 +122,18 @@
|
|||
<artifactId>maven-failsafe-plugin</artifactId>
|
||||
<version>${maven_failsafe_plugin_version}</version>
|
||||
<configuration>
|
||||
<classpathDependencyScopeExclude>compile+runtime</classpathDependencyScopeExclude>
|
||||
<classpathDependencyScopeExclude>compile+runtime+test+provided</classpathDependencyScopeExclude>
|
||||
<additionalClasspathElements>
|
||||
<additionalClasspathElement>${project.build.directory}/hapi-fhir-android-${project.version}.jar</additionalClasspathElement>
|
||||
<additionalClasspathElement>${project.build.directory}/hapi-fhir-android-${project.version}-dstu2.jar</additionalClasspathElement>
|
||||
</additionalClasspathElements>
|
||||
<classpathDependencyExcludes>
|
||||
<classpathDependencyExclude>ca.uhn.hapi.fhir:hapi-fhir-base</classpathDependencyExclude>
|
||||
<!-- <classpathDependencyExclude>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu</classpathDependencyExclude> -->
|
||||
<!-- <classpathDependencyExclude>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2</classpathDependencyExclude> -->
|
||||
<classpathDependencyExclude>org.codehaus.woodstox:*</classpathDependencyExclude>
|
||||
<classpathDependencyExclude>javax.json:*</classpathDependencyExclude>
|
||||
<classpathDependencyExclude>org.glassfish:javax.json</classpathDependencyExclude>
|
||||
</classpathDependencyExcludes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -133,27 +150,33 @@
|
|||
<version>2.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>dstu</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<!-- <minimizeJar>true</minimizeJar> -->
|
||||
<createSourcesJar>true</createSourcesJar>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>dstu</shadedClassifierName>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<!--
|
||||
<include>commons-codec:commons-codec</include>
|
||||
-->
|
||||
<include>ca.uhn.hapi.fhir:hapi-fhir-base</include>
|
||||
<!--<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu</include>
|
||||
<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2</include>-->
|
||||
<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu</include>
|
||||
<include>org.glassfish:javax.json</include>
|
||||
<include>org.codehaus.woodstox:woodstox-core-asl</include>
|
||||
<include>javax.xml.stream:stax-api</include>
|
||||
<include>javax.servlet:javax.servlet-api</include>
|
||||
<!-- <include>javax.servlet:javax.servlet-api</include>-->
|
||||
<include>org.codehaus.woodstox:stax2-api</include>
|
||||
<!-- <include>org.slf4j:slf4j*</include> -->
|
||||
<!--
|
||||
<include>org.apache.commons:*</include>
|
||||
<include>org.apache.httpcomponents:*</include>
|
||||
-->
|
||||
<include>org.glassfish:javax.json</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
|
@ -178,6 +201,48 @@
|
|||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>dstu2</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<createSourcesJar>true</createSourcesJar>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>dstu2</shadedClassifierName>
|
||||
<artifactSet>
|
||||
<includes>
|
||||
<!--
|
||||
<include>commons-codec:commons-codec</include>
|
||||
-->
|
||||
<include>ca.uhn.hapi.fhir:hapi-fhir-base</include>
|
||||
<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu2</include>
|
||||
<include>org.glassfish:javax.json</include>
|
||||
<include>org.codehaus.woodstox:woodstox-core-asl</include>
|
||||
<include>javax.xml.stream:stax-api</include>
|
||||
<!-- <include>javax.servlet:javax.servlet-api</include>-->
|
||||
<include>org.codehaus.woodstox:stax2-api</include>
|
||||
<!--
|
||||
<include>org.apache.commons:*</include>
|
||||
<include>org.apache.httpcomponents:*</include>
|
||||
-->
|
||||
<include>org.glassfish:javax.json</include>
|
||||
</includes>
|
||||
</artifactSet>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>javax.xml.stream</pattern>
|
||||
<shadedPattern>ca.uhn.fhir.repackage.javax.xml.stream</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>javax.json</pattern>
|
||||
<shadedPattern>ca.uhn.fhir.repackage.javax.json</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
@ -7,6 +7,7 @@ import java.util.ArrayList;
|
|||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.Observable;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
@ -14,9 +15,15 @@ import java.util.zip.ZipFile;
|
|||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.filefilter.WildcardFileFilter;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.ctc.wstx.stax.WstxInputFactory;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||
import ca.uhn.fhir.model.dstu2.composite.QuantityDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
|
||||
|
@ -24,8 +31,16 @@ import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
|
|||
public class BuiltJarIT {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BuiltJarIT.class);
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
|
||||
System.setProperty("javax.xml.stream.XMLOutputFactory", "com.ctc.wstx.stax.WstxOutputFactory");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParser() {
|
||||
public void testParserXml() throws Exception {
|
||||
// fail("*******: " + WstxInputFactory.class.getProtectionDomain().getCodeSource().getLocation().toString());
|
||||
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
Patient p = new Patient();
|
||||
|
@ -37,6 +52,26 @@ public class BuiltJarIT {
|
|||
assertEquals("system", p2.getIdentifierFirstRep().getSystemElement().getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParserJson() {
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
Observation o = new Observation();
|
||||
o.getCode().setText("TEXT");
|
||||
o.setValue(new QuantityDt(123));
|
||||
o.addIdentifier().setSystem("system");
|
||||
|
||||
String str = ctx.newJsonParser().encodeResourceToString(o);
|
||||
Observation p2 = ctx.newJsonParser().parseResource(Observation.class, str);
|
||||
|
||||
assertEquals("TEXT", p2.getCode().getText());
|
||||
|
||||
QuantityDt dt = (QuantityDt) p2.getValue();
|
||||
dt.getComparatorElement().getValueAsEnum();
|
||||
|
||||
QuantityCompararatorEnum.GREATERTHAN.name();
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple client test - We try to connect to a server that doesn't exist, but
|
||||
* if we at least get the right exception it means we made it up to the HTTP/network stack
|
||||
|
@ -113,7 +148,7 @@ public class BuiltJarIT {
|
|||
|
||||
ourLog.info("File {} contains {} entries", file, names.size());
|
||||
ourLog.info("Total classes {} - Total methods {}", totalClasses, totalMethods);
|
||||
ourLog.info("Top classes {}", new ArrayList<ClassMethodCount>(topMethods).subList(topMethods.size() - 10, topMethods.size()));
|
||||
ourLog.info("Top classes {}", new ArrayList<ClassMethodCount>(topMethods).subList(Math.max(0,topMethods.size() - 10), topMethods.size()));
|
||||
|
||||
} finally {
|
||||
zip.close();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<dependency>
|
||||
<groupId>org.mortbay.jetty</groupId>
|
||||
<artifactId>jetty</artifactId>
|
||||
<version>6.1.26</version>
|
||||
<version>6.1.26</version> <!-- 6.1.26 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
|
|
|
@ -46,8 +46,14 @@ public interface BaseOperationOutcome extends IResource, IBaseOperationOutcome {
|
|||
|
||||
public abstract BaseIssue addLocation(String theString);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setDiagnostics(String)} instead - Field was renamed in DSTU2
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract BaseIssue setDetails(String theString);
|
||||
|
||||
public abstract BaseIssue setDiagnostics(String theString);
|
||||
|
||||
public abstract StringDt getLocationFirstRep();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
|
||||
@DatatypeDef(name = "markdown")
|
||||
@CoverageIgnore
|
||||
public class MarkdownDt extends StringDt {
|
||||
|
||||
}
|
|
@ -227,7 +227,7 @@ class ParserState<T> {
|
|||
|
||||
/**
|
||||
* @param theResourceType
|
||||
* May be null
|
||||
* May be null
|
||||
*/
|
||||
static <T extends IBaseResource> ParserState<T> getPreResourceInstance(Class<T> theResourceType, FhirContext theContext, boolean theJsonMode, IParserErrorHandler theErrorHandler)
|
||||
throws DataFormatException {
|
||||
|
@ -796,6 +796,10 @@ class ParserState<T> {
|
|||
myPreResourceState = thePreResourceState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param theValue
|
||||
* The attribute value
|
||||
*/
|
||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||
myErrorHandler.unknownAttribute(null, theName);
|
||||
}
|
||||
|
@ -804,6 +808,15 @@ class ParserState<T> {
|
|||
// ignore by default
|
||||
}
|
||||
|
||||
protected void logAndSwallowUnexpectedElement(String theLocalPart) {
|
||||
myErrorHandler.unknownElement(null, theLocalPart);
|
||||
push(new SwallowChildrenWholeState(getPreResourceState()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param theNamespaceUri
|
||||
* The XML namespace (if XML) or null
|
||||
*/
|
||||
public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException {
|
||||
myErrorHandler.unknownElement(null, theLocalPart);
|
||||
}
|
||||
|
@ -860,7 +873,7 @@ class ParserState<T> {
|
|||
|
||||
/**
|
||||
* @param theData
|
||||
* The string value
|
||||
* The string value
|
||||
*/
|
||||
public void string(String theData) {
|
||||
// ignore by default
|
||||
|
@ -872,7 +885,7 @@ class ParserState<T> {
|
|||
|
||||
/**
|
||||
* @param theNextEvent
|
||||
* The XML event
|
||||
* The XML event
|
||||
*/
|
||||
public void xmlEvent(XMLEvent theNextEvent) {
|
||||
// ignore
|
||||
|
@ -1151,13 +1164,13 @@ class ParserState<T> {
|
|||
} else if ("url".equals(theLocalPart)) {
|
||||
push(new PrimitiveState(getPreResourceState(), myEntry.getLinkSearch()));
|
||||
} else {
|
||||
ourLog.warn("Unexpected element in Bundle.entry.search: " + theLocalPart);
|
||||
push(new SwallowChildrenWholeState(getPreResourceState()));
|
||||
logAndSwallowUnexpectedElement(theLocalPart);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class BundleLinkState extends BaseState {
|
||||
|
||||
private BundleEntry myEntry;
|
||||
|
@ -1563,13 +1576,13 @@ class ParserState<T> {
|
|||
push(new SwallowChildrenWholeState(getPreResourceState()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((child.getMax() == 0 || child.getMax() == 1) && !myParsedNonRepeatableNames.add(theChildName)) {
|
||||
myErrorHandler.unexpectedRepeatingElement(null, theChildName);
|
||||
push(new SwallowChildrenWholeState(getPreResourceState()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
BaseRuntimeElementDefinition<?> target = child.getChildByName(theChildName);
|
||||
if (target == null) {
|
||||
// This is a bug with the structures and shouldn't happen..
|
||||
|
@ -2338,11 +2351,14 @@ class ParserState<T> {
|
|||
} else if ("resource".equals(theLocalPart)) {
|
||||
mySubState = ResourceReferenceSubState.REFERENCE;
|
||||
break;
|
||||
} else {
|
||||
logAndSwallowUnexpectedElement(theLocalPart);
|
||||
break;
|
||||
}
|
||||
//$FALL-THROUGH$
|
||||
case DISPLAY:
|
||||
case REFERENCE:
|
||||
throw new DataFormatException("Unexpected element: " + theLocalPart);
|
||||
logAndSwallowUnexpectedElement(theLocalPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,7 @@ import ca.uhn.fhir.rest.method.ValidateMethodBindingDstu1;
|
|||
import ca.uhn.fhir.rest.method.ValidateMethodBindingDstu2;
|
||||
import ca.uhn.fhir.rest.param.DateParam;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory;
|
||||
|
@ -1556,6 +1557,10 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
|
||||
myCriterion.populateParamList(params);
|
||||
|
||||
for (TokenParam next : myTags) {
|
||||
addParam(params, Constants.PARAM_TAG, next.getValueAsQueryToken());
|
||||
}
|
||||
|
||||
for (Include next : myInclude) {
|
||||
addParam(params, Constants.PARAM_INCLUDE, next.getValue());
|
||||
}
|
||||
|
@ -1638,7 +1643,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public IClientExecutable returnBundle(Class theClass) {
|
||||
public IQuery returnBundle(Class theClass) {
|
||||
if (theClass == null) {
|
||||
throw new NullPointerException("theClass must not be null");
|
||||
}
|
||||
|
@ -1689,6 +1694,15 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
return this;
|
||||
}
|
||||
|
||||
private List<TokenParam> myTags = new ArrayList<TokenParam>();
|
||||
|
||||
@Override
|
||||
public IQuery<Object> withTag(String theSystem, String theCode) {
|
||||
Validate.notBlank(theCode, "theCode must not be null or empty");
|
||||
myTags.add(new TokenParam(theSystem, theCode));
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
|
|
|
@ -251,6 +251,12 @@ public interface IGenericClient extends IRestfulClient {
|
|||
@Override
|
||||
void registerInterceptor(IClientInterceptor theInterceptor);
|
||||
|
||||
/**
|
||||
* Search for resources matching a given set of criteria. Searching is a very powerful
|
||||
* feature in FHIR with many features for specifying exactly what should be seaerched for
|
||||
* and how it should be returned. See the <a href="http://www.hl7.org/fhir/search.html">specification on search</a>
|
||||
* for more information.
|
||||
*/
|
||||
IUntypedQuery search();
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
public interface IBaseQuery<T> {
|
||||
public interface IBaseQuery<T extends IBaseQuery<?>> {
|
||||
|
||||
T where(ICriterion<?> theCriterion);
|
||||
|
||||
|
|
|
@ -37,6 +37,14 @@ public interface IQuery<T> extends IClientExecutable<IQuery<T>, T>, IBaseQuery<I
|
|||
|
||||
IQuery<T> limitTo(int theLimitTo);
|
||||
|
||||
/**
|
||||
* Match only resources where the resource has the given tag. This parameter corresponds to
|
||||
* the <code>_tag</code> URL parameter.
|
||||
* @param theSystem The tag code system, or <code>null</code> to match any code system (this may not be supported on all servers)
|
||||
* @param theCode The tag code. Must not be <code>null</code> or empty.
|
||||
*/
|
||||
IQuery<T> withTag(String theSystem, String theCode);
|
||||
|
||||
/**
|
||||
* Forces the query to perform the search using the given method (allowable methods are described in the
|
||||
* <a href="http://www.hl7.org/implement/standards/fhir/http.html#search">FHIR Specification Section 2.1.11</a>)
|
||||
|
@ -66,6 +74,20 @@ public interface IQuery<T> extends IClientExecutable<IQuery<T>, T>, IBaseQuery<I
|
|||
* Request that the client return the specified bundle type, e.g. <code>org.hl7.fhir.instance.model.Bundle.class</code>
|
||||
* or <code>ca.uhn.fhir.model.dstu2.resource.Bundle.class</code>
|
||||
*/
|
||||
<B extends IBaseBundle> IClientExecutable<IQuery<B>, B> returnBundle(Class<B> theClass);
|
||||
|
||||
<B extends IBaseBundle> IQuery<B> returnBundle(Class<B> theClass);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
// This is here as an overridden method to allow mocking clients with Mockito to work
|
||||
@Override
|
||||
IQuery<T> where(ICriterion<?> theCriterion);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
// This is here as an overridden method to allow mocking clients with Mockito to work
|
||||
@Override
|
||||
IQuery<T> and(ICriterion<?> theCriterion);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.rest.method;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
|
@ -29,21 +31,21 @@ import ca.uhn.fhir.model.api.IQueryParameterType;
|
|||
public class QualifiedParamList extends ArrayList<String> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private String myQualifier;
|
||||
|
||||
public QualifiedParamList() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public QualifiedParamList(int theCapacity) {
|
||||
super(theCapacity);
|
||||
}
|
||||
|
||||
public QualifiedParamList(IQueryParameterOr<?> theNextOr) {
|
||||
for (IQueryParameterType next : theNextOr.getValuesAsQueryTokens()) {
|
||||
if (myQualifier==null) {
|
||||
myQualifier=next.getQueryParameterQualifier();
|
||||
if (myQualifier == null) {
|
||||
myQualifier = next.getQueryParameterQualifier();
|
||||
}
|
||||
add(next.getValueAsQueryToken());
|
||||
}
|
||||
|
@ -60,36 +62,68 @@ public class QualifiedParamList extends ArrayList<String> {
|
|||
public static QualifiedParamList singleton(String theParamValue) {
|
||||
return singleton(null, theParamValue);
|
||||
}
|
||||
|
||||
|
||||
public static QualifiedParamList singleton(String theQualifier, String theParamValue) {
|
||||
QualifiedParamList retVal = new QualifiedParamList(1);
|
||||
retVal.setQualifier(theQualifier);
|
||||
retVal.add(theParamValue);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
public static QualifiedParamList splitQueryStringByCommasIgnoreEscape(String theQualifier, String theParams){
|
||||
QualifiedParamList retVal = new QualifiedParamList();
|
||||
retVal.setQualifier(theQualifier);
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(theParams,",");
|
||||
String prev=null;
|
||||
|
||||
public static QualifiedParamList splitQueryStringByCommasIgnoreEscape(String theQualifier, String theParams) {
|
||||
QualifiedParamList retVal = new QualifiedParamList();
|
||||
retVal.setQualifier(theQualifier);
|
||||
|
||||
StringTokenizer tok = new StringTokenizer(theParams, ",", true);
|
||||
String prev = null;
|
||||
while (tok.hasMoreElements()) {
|
||||
String str = tok.nextToken();
|
||||
if (prev!=null&&prev.endsWith("\\")) {
|
||||
int idx = retVal.size()-1;
|
||||
String existing = retVal.get(idx);
|
||||
retVal.set(idx, existing.substring(0, existing.length()-1) + "," + str);
|
||||
}else {
|
||||
retVal.add(str);
|
||||
if (isBlank(str)) {
|
||||
prev = null;
|
||||
continue;
|
||||
}
|
||||
|
||||
prev=str;
|
||||
if (str.equals(",")) {
|
||||
if (countTrailingSlashes(prev) % 2 == 1) {
|
||||
int idx = retVal.size() - 1;
|
||||
String existing = retVal.get(idx);
|
||||
prev = existing.substring(0, existing.length() - 1) + ',';
|
||||
retVal.set(idx, prev);
|
||||
} else {
|
||||
prev = null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (prev != null && prev.length() > 0 && prev.charAt(prev.length() - 1) == ',') {
|
||||
int idx = retVal.size() - 1;
|
||||
String existing = retVal.get(idx);
|
||||
prev = existing + str;
|
||||
retVal.set(idx, prev);
|
||||
} else {
|
||||
retVal.add(str);
|
||||
prev = str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private static int countTrailingSlashes(String theString) {
|
||||
if(theString==null) {
|
||||
return 0;
|
||||
}
|
||||
int retVal = 0;
|
||||
for (int i = theString.length() - 1; i >= 0; i--) {
|
||||
char nextChar = theString.charAt(i);
|
||||
if (nextChar != '\\') {
|
||||
break;
|
||||
} else {
|
||||
retVal++;
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -255,6 +255,7 @@ public class ParameterUtil {
|
|||
case '$':
|
||||
case ',':
|
||||
case '|':
|
||||
case '\\':
|
||||
continue;
|
||||
default:
|
||||
b.append(next);
|
||||
|
|
|
@ -33,10 +33,9 @@ public class Constants {
|
|||
public static final String CHARSETNAME_UTF_8 = "UTF-8";
|
||||
public static final String CT_ATOM_XML = "application/atom+xml";
|
||||
public static final String CT_FHIR_JSON = "application/json+fhir";
|
||||
|
||||
public static final String CTSUFFIX_CHARSET_UTF8 = "; charset=" + CHARSETNAME_UTF_8;
|
||||
public static final String CT_FHIR_XML = "application/xml+fhir";
|
||||
public static final String CT_HTML = "text/html";
|
||||
public static final String CTSUFFIX_CHARSET_UTF8 = "; charset=" + CHARSETNAME_UTF_8;
|
||||
public static final String CT_HTML_WITH_UTF8 = "text/html" + CTSUFFIX_CHARSET_UTF8;
|
||||
public static final String CT_JSON = "application/json";
|
||||
public static final String CT_OCTET_STREAM = "application/octet-stream";
|
||||
|
@ -82,8 +81,13 @@ public class Constants {
|
|||
public static final String HEADER_LAST_MODIFIED_LOWERCASE = HEADER_LAST_MODIFIED.toLowerCase();
|
||||
public static final String HEADER_LOCATION = "Location";
|
||||
public static final String HEADER_LOCATION_LC = HEADER_LOCATION.toLowerCase();
|
||||
public static final String HEADER_PREFER = "Prefer";
|
||||
public static final String HEADER_PREFER_RETURN = "return";
|
||||
public static final String HEADER_PREFER_RETURN_MINIMAL = "minimal";
|
||||
public static final String HEADER_PREFER_RETURN_REPRESENTATION = "representation";
|
||||
public static final String HEADER_SUFFIX_CT_UTF_8 = "; charset=UTF-8";
|
||||
public static final String HEADERVALUE_CORS_ALLOW_METHODS_ALL = "GET, POST, PUT, DELETE, OPTIONS";
|
||||
public static final Map<Integer, String> HTTP_STATUS_NAMES;
|
||||
public static final String LINK_FHIR_BASE = "fhir-base";
|
||||
public static final String LINK_FIRST = "first";
|
||||
public static final String LINK_LAST = "last";
|
||||
|
@ -109,6 +113,7 @@ public class Constants {
|
|||
public static final String PARAM_SORT = "_sort";
|
||||
public static final String PARAM_SORT_ASC = "_sort:asc";
|
||||
public static final String PARAM_SORT_DESC = "_sort:desc";
|
||||
public static final String PARAM_TAG = "_tag";
|
||||
public static final String PARAM_TAGS = "_tags";
|
||||
public static final String PARAM_VALIDATE = "_validate";
|
||||
public static final String PARAMQUALIFIER_MISSING = ":missing";
|
||||
|
@ -122,7 +127,7 @@ public class Constants {
|
|||
public static final int STATUS_HTTP_304_NOT_MODIFIED = 304;
|
||||
public static final int STATUS_HTTP_400_BAD_REQUEST = 400;
|
||||
public static final int STATUS_HTTP_401_CLIENT_UNAUTHORIZED = 401;
|
||||
public static final int STATUS_HTTP_403_FORBIDDEN= 403;
|
||||
public static final int STATUS_HTTP_403_FORBIDDEN = 403;
|
||||
public static final int STATUS_HTTP_404_NOT_FOUND = 404;
|
||||
public static final int STATUS_HTTP_405_METHOD_NOT_ALLOWED = 405;
|
||||
public static final int STATUS_HTTP_409_CONFLICT = 409;
|
||||
|
@ -133,10 +138,6 @@ public class Constants {
|
|||
public static final int STATUS_HTTP_501_NOT_IMPLEMENTED = 501;
|
||||
public static final String URL_TOKEN_HISTORY = "_history";
|
||||
public static final String URL_TOKEN_METADATA = "metadata";
|
||||
public static final String HEADER_PREFER = "Prefer";
|
||||
public static final String HEADER_PREFER_RETURN = "return";
|
||||
public static final String HEADER_PREFER_RETURN_MINIMAL = "minimal";
|
||||
public static final String HEADER_PREFER_RETURN_REPRESENTATION = "representation";
|
||||
|
||||
static {
|
||||
Map<String, EncodingEnum> valToEncoding = new HashMap<String, EncodingEnum>();
|
||||
|
@ -160,8 +161,74 @@ public class Constants {
|
|||
}
|
||||
|
||||
FORMAT_VAL_TO_ENCODING = Collections.unmodifiableMap(valToEncoding);
|
||||
|
||||
|
||||
CHARSET_UTF8 = Charset.forName(CHARSETNAME_UTF_8);
|
||||
|
||||
HashMap<Integer, String> statusNames = new HashMap<Integer, String>();
|
||||
|
||||
statusNames.put(200, "OK");
|
||||
statusNames.put(201, "Created");
|
||||
statusNames.put(202, "Accepted");
|
||||
statusNames.put(203, "Non-Authoritative Information");
|
||||
statusNames.put(204, "No Content");
|
||||
statusNames.put(205, "Reset Content");
|
||||
statusNames.put(206, "Partial Content");
|
||||
statusNames.put(207, "Multi-Status");
|
||||
statusNames.put(208, "Already Reported");
|
||||
statusNames.put(226, "IM Used");
|
||||
statusNames.put(300, "Multiple Choices");
|
||||
statusNames.put(301, "Moved Permanently");
|
||||
statusNames.put(302, "Found");
|
||||
statusNames.put(302, "Moved Temporarily");
|
||||
statusNames.put(303, "See Other");
|
||||
statusNames.put(304, "Not Modified");
|
||||
statusNames.put(305, "Use Proxy");
|
||||
statusNames.put(307, "Temporary Redirect");
|
||||
statusNames.put(308, "Permanent Redirect");
|
||||
statusNames.put(400, "Bad Request");
|
||||
statusNames.put(401, "Unauthorized");
|
||||
statusNames.put(402, "Payment Required");
|
||||
statusNames.put(403, "Forbidden");
|
||||
statusNames.put(404, "Not Found");
|
||||
statusNames.put(405, "Method Not Allowed");
|
||||
statusNames.put(406, "Not Acceptable");
|
||||
statusNames.put(407, "Proxy Authentication Required");
|
||||
statusNames.put(408, "Request Timeout");
|
||||
statusNames.put(409, "Conflict");
|
||||
statusNames.put(410, "Gone");
|
||||
statusNames.put(411, "Length Required");
|
||||
statusNames.put(412, "Precondition Failed");
|
||||
statusNames.put(413, "Payload Too Large");
|
||||
statusNames.put(413, "Request Entity Too Large");
|
||||
statusNames.put(414, "URI Too Long");
|
||||
statusNames.put(414, "Request-URI Too Long");
|
||||
statusNames.put(415, "Unsupported Media Type");
|
||||
statusNames.put(416, "Requested range not satisfiable");
|
||||
statusNames.put(417, "Expectation Failed");
|
||||
statusNames.put(418, "I'm a teapot");
|
||||
statusNames.put(419, "Insufficient Space On Resource");
|
||||
statusNames.put(420, "Method Failure");
|
||||
statusNames.put(421, "Destination Locked");
|
||||
statusNames.put(422, "Unprocessable Entity");
|
||||
statusNames.put(423, "Locked");
|
||||
statusNames.put(424, "Failed Dependency");
|
||||
statusNames.put(426, "Upgrade Required");
|
||||
statusNames.put(428, "Precondition Required");
|
||||
statusNames.put(429, "Too Many Requests");
|
||||
statusNames.put(431, "Request Header Fields Too Large");
|
||||
statusNames.put(500, "Internal Server Error");
|
||||
statusNames.put(501, "Not Implemented");
|
||||
statusNames.put(502, "Bad Gateway");
|
||||
statusNames.put(503, "Service Unavailable");
|
||||
statusNames.put(504, "Gateway Timeout");
|
||||
statusNames.put(505, "HTTP Version not supported");
|
||||
statusNames.put(506, "Variant Also Negotiates");
|
||||
statusNames.put(507, "Insufficient Storage");
|
||||
statusNames.put(508, "Loop Detected");
|
||||
statusNames.put(509, "Bandwidth Limit Exceeded");
|
||||
statusNames.put(510, "Not Extended");
|
||||
statusNames.put(511, "Network Authentication Required");
|
||||
HTTP_STATUS_NAMES = Collections.unmodifiableMap(statusNames);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,21 +35,16 @@ public class IncomingRequestAddressStrategy implements IServerAddressStrategy {
|
|||
@Override
|
||||
public String determineServerBase(ServletContext theServletContext, HttpServletRequest theRequest) {
|
||||
String requestFullPath = StringUtils.defaultString(theRequest.getRequestURI());
|
||||
|
||||
|
||||
String servletPath;
|
||||
if (myServletPath != null) {
|
||||
servletPath = myServletPath;
|
||||
} else {
|
||||
servletPath = StringUtils.defaultString(theRequest.getServletPath());
|
||||
}
|
||||
|
||||
|
||||
StringBuffer requestUrl = theRequest.getRequestURL();
|
||||
String servletContextPath = "";
|
||||
if (theServletContext != null) {
|
||||
servletContextPath = StringUtils.defaultString(theServletContext.getContextPath());
|
||||
// } else {
|
||||
// servletContextPath = servletPath;
|
||||
}
|
||||
String servletContextPath = StringUtils.defaultString(theRequest.getContextPath());
|
||||
|
||||
String requestPath = requestFullPath.substring(servletContextPath.length() + servletPath.length());
|
||||
if (requestPath.length() > 0 && requestPath.charAt(0) == '/') {
|
||||
|
@ -105,4 +100,33 @@ public class IncomingRequestAddressStrategy implements IServerAddressStrategy {
|
|||
myServletPath = theServletPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines the servlet's context path.
|
||||
*
|
||||
* This is here to try and deal with the wide variation in servers and what they return.
|
||||
*
|
||||
* getServletContext().getContextPath() is supposed to return the path to the specific servlet we are deployed as but it's not available everywhere. On some servers getServletContext() can return
|
||||
* null (old Jetty seems to suffer from this, see hapi-fhir-base-test-mindeps-server) and on other old servers (Servlet 2.4) getServletContext().getContextPath() doesn't even exist.
|
||||
*
|
||||
* theRequest.getContextPath() returns the context for the specific incoming request. It should be available everywhere, but it's likely to be less predicable if there are multiple servlet mappings
|
||||
* pointing to the same servlet, so we don't favour it. This is possibly not the best strategy (maybe we should just always use theRequest.getContextPath()?) but so far people seem happy with this
|
||||
* behavour across a wide variety of platforms.
|
||||
*
|
||||
* If you are having troubles on a given platform/configuration and want to suggest a change or even report incompatibility here, we'd love to hear about it.
|
||||
*/
|
||||
public static String determineServletContextPath(HttpServletRequest theRequest, RestfulServer server) {
|
||||
String retVal;
|
||||
if (server.getServletContext() != null) {
|
||||
if (server.getServletContext().getMajorVersion() >= 3 || (server.getServletContext().getMajorVersion() > 2 && server.getServletContext().getMinorVersion() >= 5)) {
|
||||
retVal = server.getServletContext().getContextPath();
|
||||
} else {
|
||||
retVal = theRequest.getContextPath();
|
||||
}
|
||||
} else {
|
||||
retVal = theRequest.getContextPath();
|
||||
}
|
||||
retVal = StringUtils.defaultString(retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -525,15 +525,11 @@ public class RestfulServer extends HttpServlet {
|
|||
String requestFullPath = StringUtils.defaultString(theRequest.getRequestURI());
|
||||
String servletPath = StringUtils.defaultString(theRequest.getServletPath());
|
||||
StringBuffer requestUrl = theRequest.getRequestURL();
|
||||
String servletContextPath = "";
|
||||
|
||||
// if (getServletContext().getMajorVersion() >= 3) {
|
||||
// // getServletContext is only supported in version 3+ of servlet-api
|
||||
if (getServletContext() != null) {
|
||||
servletContextPath = StringUtils.defaultString(getServletContext().getContextPath());
|
||||
}
|
||||
// }
|
||||
String servletContextPath = IncomingRequestAddressStrategy.determineServletContextPath(theRequest, this);
|
||||
|
||||
/*
|
||||
* Just for debugging..
|
||||
*/
|
||||
if (ourLog.isTraceEnabled()) {
|
||||
ourLog.trace("Request FullPath: {}", requestFullPath);
|
||||
ourLog.trace("Servlet Path: {}", servletPath);
|
||||
|
@ -752,6 +748,7 @@ public class RestfulServer extends HttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the server. Note that this method is final to avoid accidentally introducing bugs in implementations,
|
||||
* but subclasses may put initialization code in {@link #initialize()}, which is called immediately before beginning
|
||||
|
@ -842,6 +839,7 @@ public class RestfulServer extends HttpServlet {
|
|||
* (which extends {@link ServletException}), as this is a flag to the servlet container that the servlet
|
||||
* is not usable.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
protected void initialize() throws ServletException {
|
||||
// nothing by default
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
|||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
|
||||
|
@ -86,7 +87,11 @@ public class OperationOutcomeUtil {
|
|||
}
|
||||
|
||||
public static String getFirstIssueDetails(FhirContext theCtx, IBaseOperationOutcome theOutcome) {
|
||||
return getFirstIssueStringPart(theCtx, theOutcome, "details");
|
||||
if (theCtx.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
return getFirstIssueStringPart(theCtx, theOutcome, "diagnostics");
|
||||
} else {
|
||||
return getFirstIssueStringPart(theCtx, theOutcome, "details");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getFirstIssueLocation(FhirContext theCtx, IBaseOperationOutcome theOutcome) {
|
||||
|
@ -142,7 +147,12 @@ public class OperationOutcomeUtil {
|
|||
|
||||
private static void populateDetails(FhirContext theCtx, IBase theIssue, String theSeverity, String theDetails, String theLocation) {
|
||||
BaseRuntimeElementCompositeDefinition<?> issueElement = (BaseRuntimeElementCompositeDefinition<?>) theCtx.getElementDefinition(theIssue.getClass());
|
||||
BaseRuntimeChildDefinition detailsChild = issueElement.getChildByName("details");
|
||||
BaseRuntimeChildDefinition detailsChild;
|
||||
if (theCtx.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU1)) {
|
||||
detailsChild = issueElement.getChildByName("diagnostics");
|
||||
} else {
|
||||
detailsChild = issueElement.getChildByName("details");
|
||||
}
|
||||
BaseRuntimeElementDefinition<?> stringDef = theCtx.getElementDefinition("string");
|
||||
BaseRuntimeChildDefinition severityChild = issueElement.getChildByName("severity");
|
||||
BaseRuntimeChildDefinition locationChild = issueElement.getChildByName("location");
|
||||
|
|
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import java.net.MalformedURLException;
|
||||
|
@ -49,6 +50,7 @@ import org.codehaus.stax2.XMLOutputFactory2;
|
|||
import org.codehaus.stax2.io.EscapingWriterFactory;
|
||||
|
||||
import com.ctc.wstx.api.WstxInputProperties;
|
||||
import com.ctc.wstx.stax.WstxInputFactory;
|
||||
import com.ctc.wstx.stax.WstxOutputFactory;
|
||||
|
||||
/**
|
||||
|
@ -1546,7 +1548,16 @@ public class XmlUtil {
|
|||
|
||||
private static XMLInputFactory getOrCreateInputFactory() throws FactoryConfigurationError {
|
||||
if (ourInputFactory == null) {
|
||||
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
|
||||
try {
|
||||
Class.forName("ca.uhn.fhir.repackage.javax.xml.stream.XMLInputFactory");
|
||||
System.setProperty("javax.xml.stream.XMLInputFactory", "com.ctc.wstx.stax.WstxInputFactory");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// ok
|
||||
}
|
||||
|
||||
XMLInputFactory inputFactory;
|
||||
inputFactory = XMLInputFactory.newInstance();
|
||||
|
||||
if (!ourHaveLoggedStaxImplementation) {
|
||||
logStaxImplementation(inputFactory.getClass());
|
||||
|
@ -1576,6 +1587,14 @@ public class XmlUtil {
|
|||
|
||||
private static XMLOutputFactory getOrCreateOutputFactory() throws FactoryConfigurationError {
|
||||
if (ourOutputFactory == null) {
|
||||
|
||||
try {
|
||||
Class.forName("ca.uhn.fhir.repackage.javax.xml.stream.XMLOutputFactory");
|
||||
System.setProperty("javax.xml.stream.XMLOutputFactory", "com.ctc.wstx.stax.WstxOutputFactory");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// ok
|
||||
}
|
||||
|
||||
XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
|
||||
|
||||
if (!ourHaveLoggedStaxImplementation) {
|
||||
|
@ -1668,8 +1687,8 @@ public class XmlUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Character.toString((char) 167));
|
||||
public static void main(String[] args) throws FactoryConfigurationError, XMLStreamException {
|
||||
createXmlWriter(new StringWriter());
|
||||
}
|
||||
|
||||
private static final class ExtendedEntityReplacingXmlResolver implements XMLResolver {
|
||||
|
|
|
@ -83,6 +83,7 @@ import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamString;
|
|||
import ca.uhn.fhir.jpa.entity.ResourceIndexedSearchParamToken;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceLink;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceTable;
|
||||
import ca.uhn.fhir.jpa.entity.ResourceTag;
|
||||
import ca.uhn.fhir.jpa.entity.TagDefinition;
|
||||
import ca.uhn.fhir.jpa.entity.TagTypeEnum;
|
||||
import ca.uhn.fhir.jpa.util.StopWatch;
|
||||
|
@ -290,7 +291,78 @@ public abstract class BaseHapiFhirResourceDao<T extends IResource> extends BaseH
|
|||
return new HashSet<Long>(q.getResultList());
|
||||
}
|
||||
|
||||
private boolean addPredicateMissingFalseIfPresent(CriteriaBuilder theBuilder, String theParamName, Root<? extends BaseResourceIndexedSearchParam> from, List<Predicate> codePredicates, IQueryParameterType nextOr) {
|
||||
private Set<Long> addPredicateTag(Set<Long> thePids, List<List<? extends IQueryParameterType>> theList) {
|
||||
Set<Long> pids = thePids;
|
||||
if (theList == null || theList.isEmpty()) {
|
||||
return pids;
|
||||
}
|
||||
|
||||
for (List<? extends IQueryParameterType> nextAndParams : theList) {
|
||||
boolean haveTags = false;
|
||||
for (IQueryParameterType nextParamUncasted : nextAndParams) {
|
||||
TokenParam nextParam = (TokenParam) nextParamUncasted;
|
||||
if (isNotBlank(nextParam.getValue())) {
|
||||
haveTags = true;
|
||||
} else if (isNotBlank(nextParam.getSystem())) {
|
||||
throw new InvalidRequestException("Invalid _tag parameter (must supply a value/code and not just a system): " + nextParam.getValueAsQueryToken());
|
||||
}
|
||||
}
|
||||
if (!haveTags) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
|
||||
CriteriaQuery<Long> cq = builder.createQuery(Long.class);
|
||||
Root<ResourceTag> from = cq.from(ResourceTag.class);
|
||||
cq.select(from.get("myResourceId").as(Long.class));
|
||||
|
||||
List<Predicate> andPredicates = new ArrayList<Predicate>();
|
||||
andPredicates.add(builder.equal(from.get("myResourceType"), myResourceName));
|
||||
|
||||
List<Predicate> orPredicates = new ArrayList<Predicate>();
|
||||
for (IQueryParameterType nextOrParams : nextAndParams) {
|
||||
TokenParam nextParam = (TokenParam) nextOrParams;
|
||||
|
||||
From<ResourceTag, TagDefinition> defJoin = from.join("myTag");
|
||||
Predicate codePrediate = builder.equal(defJoin.get("myCode"), nextParam.getValue());
|
||||
if (isBlank(nextParam.getValue())) {
|
||||
continue;
|
||||
}
|
||||
if (isNotBlank(nextParam.getSystem())) {
|
||||
Predicate systemPrediate = builder.equal(defJoin.get("mySystem"), nextParam.getSystem());
|
||||
orPredicates.add(builder.and(systemPrediate, codePrediate));
|
||||
} else {
|
||||
orPredicates.add(codePrediate);
|
||||
}
|
||||
|
||||
}
|
||||
if (orPredicates.isEmpty() == false) {
|
||||
andPredicates.add(builder.or(orPredicates.toArray(new Predicate[0])));
|
||||
}
|
||||
|
||||
Predicate masterCodePredicate = builder.and(andPredicates.toArray(new Predicate[0]));
|
||||
|
||||
if (pids.size() > 0) {
|
||||
Predicate inPids = (from.get("myResourceId").in(pids));
|
||||
cq.where(builder.and(masterCodePredicate, inPids));
|
||||
} else {
|
||||
cq.where(masterCodePredicate);
|
||||
}
|
||||
|
||||
TypedQuery<Long> q = myEntityManager.createQuery(cq);
|
||||
pids = new HashSet<Long>(q.getResultList());
|
||||
}
|
||||
|
||||
return pids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Long> processMatchUrl(String theMatchUrl) {
|
||||
return processMatchUrl(theMatchUrl, getResourceType());
|
||||
}
|
||||
|
||||
private boolean addPredicateMissingFalseIfPresent(CriteriaBuilder theBuilder, String theParamName, Root<? extends BaseResourceIndexedSearchParam> from, List<Predicate> codePredicates,
|
||||
IQueryParameterType nextOr) {
|
||||
boolean missingFalse = false;
|
||||
if (nextOr.getMissing() != null) {
|
||||
if (nextOr.getMissing().booleanValue() == true) {
|
||||
|
@ -1009,10 +1081,12 @@ public abstract class BaseHapiFhirResourceDao<T extends IResource> extends BaseH
|
|||
}
|
||||
|
||||
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
|
||||
throw new InvalidRequestException("Parameter[" + theParamName + "] has system (" + system.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + system);
|
||||
throw new InvalidRequestException(
|
||||
"Parameter[" + theParamName + "] has system (" + system.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + system);
|
||||
}
|
||||
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
|
||||
throw new InvalidRequestException("Parameter[" + theParamName + "] has code (" + code.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + code);
|
||||
throw new InvalidRequestException(
|
||||
"Parameter[" + theParamName + "] has code (" + code.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + code);
|
||||
}
|
||||
|
||||
ArrayList<Predicate> singleCodePredicates = (new ArrayList<Predicate>());
|
||||
|
@ -1582,7 +1656,8 @@ public abstract class BaseHapiFhirResourceDao<T extends IResource> extends BaseH
|
|||
|
||||
if (entity == null) {
|
||||
if (theId.hasVersionIdPart()) {
|
||||
TypedQuery<ResourceHistoryTable> q = myEntityManager.createQuery("SELECT t from ResourceHistoryTable t WHERE t.myResourceId = :RID AND t.myResourceType = :RTYP AND t.myResourceVersion = :RVER", ResourceHistoryTable.class);
|
||||
TypedQuery<ResourceHistoryTable> q = myEntityManager
|
||||
.createQuery("SELECT t from ResourceHistoryTable t WHERE t.myResourceId = :RID AND t.myResourceType = :RTYP AND t.myResourceVersion = :RVER", ResourceHistoryTable.class);
|
||||
q.setParameter("RID", pid);
|
||||
q.setParameter("RTYP", myResourceName);
|
||||
q.setParameter("RVER", Long.parseLong(theId.getVersionIdPart()));
|
||||
|
@ -1916,6 +1991,10 @@ public abstract class BaseHapiFhirResourceDao<T extends IResource> extends BaseH
|
|||
|
||||
pids = addPredicateLanguage(pids, nextParamEntry.getValue());
|
||||
|
||||
} else if (nextParamName.equals("_tag")) {
|
||||
|
||||
pids = addPredicateTag(pids, nextParamEntry.getValue());
|
||||
|
||||
} else {
|
||||
|
||||
RuntimeSearchParam nextParamDef = resourceDef.getSearchParam(nextParamName);
|
||||
|
@ -2147,7 +2226,8 @@ public abstract class BaseHapiFhirResourceDao<T extends IResource> extends BaseH
|
|||
|
||||
private void validateResourceType(BaseHasResource entity) {
|
||||
if (!myResourceName.equals(entity.getResourceType())) {
|
||||
throw new ResourceNotFoundException("Resource with ID " + entity.getIdDt().getIdPart() + " exists but it is not of type " + myResourceName + ", found resource of type " + entity.getResourceType());
|
||||
throw new ResourceNotFoundException(
|
||||
"Resource with ID " + entity.getIdDt().getIdPart() + " exists but it is not of type " + myResourceName + ", found resource of type " + entity.getResourceType());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,5 @@ public class FhirResourceDaoDstu1<T extends IResource> extends BaseHapiFhirResou
|
|||
oo.getIssueFirstRep().getDetailsElement().setValue(theMessage);
|
||||
return oo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,16 +28,16 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
|
||||
import ca.uhn.fhir.model.dstu2.resource.ValueSet;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
import ca.uhn.fhir.validation.FhirQuestionnaireAnswersValidator;
|
||||
import ca.uhn.fhir.validation.FhirQuestionnaireResponseValidator;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
import ca.uhn.fhir.validation.IResourceLoader;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
|
||||
public class FhirResourceDaoQuestionnaireAnswersDstu2 extends FhirResourceDaoDstu2<QuestionnaireAnswers> {
|
||||
public class FhirResourceDaoQuestionnaireResponseDstu2 extends FhirResourceDaoDstu2<QuestionnaireResponse> {
|
||||
|
||||
private FhirContext myRefImplCtx = FhirContext.forDstu2Hl7Org();
|
||||
|
||||
|
@ -45,8 +45,8 @@ public class FhirResourceDaoQuestionnaireAnswersDstu2 extends FhirResourceDaoDst
|
|||
protected void validateResourceForStorage(IResource theResource) {
|
||||
super.validateResourceForStorage(theResource);
|
||||
|
||||
QuestionnaireAnswers qa = (QuestionnaireAnswers) theResource;
|
||||
if (qa.getQuestionnaire().getReference().isEmpty()) {
|
||||
QuestionnaireResponse qa = (QuestionnaireResponse) theResource;
|
||||
if (qa == null || qa.getQuestionnaire() == null || qa.getQuestionnaire().getReference() == null || qa.getQuestionnaire().getReference().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ public class FhirResourceDaoQuestionnaireAnswersDstu2 extends FhirResourceDaoDst
|
|||
val.setValidateAgainstStandardSchema(false);
|
||||
val.setValidateAgainstStandardSchematron(false);
|
||||
|
||||
FhirQuestionnaireAnswersValidator module = new FhirQuestionnaireAnswersValidator();
|
||||
FhirQuestionnaireResponseValidator module = new FhirQuestionnaireResponseValidator();
|
||||
module.setResourceLoader(new JpaResourceLoader());
|
||||
val.registerValidatorModule(module);
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class FhirResourceDaoQuestionnaireAnswersDstu2 extends FhirResourceDaoDst
|
|||
@Override
|
||||
public <T extends IBaseResource> T load(Class<T> theType, IIdType theId) throws ResourceNotFoundException {
|
||||
/*
|
||||
* The QuestionnaireAnswers validator uses RI structures, so for now we need
|
||||
* The QuestionnaireResponse validator uses RI structures, so for now we need
|
||||
* to convert between that and HAPI structures. This is a bit hackish, but
|
||||
* hopefully it will go away at some point.
|
||||
*/
|
|
@ -19,7 +19,9 @@ package ca.uhn.fhir.jpa.dao;
|
|||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
@ -31,8 +33,13 @@ import java.util.Set;
|
|||
import javax.persistence.TypedQuery;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.TransactionStatus;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallback;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.jpa.entity.TagDefinition;
|
||||
|
@ -47,18 +54,24 @@ import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
|||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.IssueTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.rest.method.MethodUtil;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
import ca.uhn.fhir.util.FhirTerser;
|
||||
|
||||
public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirSystemDaoDstu2.class);
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager myTxManager;
|
||||
|
||||
private String extractTransactionUrlOrThrowException(Entry nextEntry, HTTPVerbEnum verb) {
|
||||
String url = nextEntry.getRequest().getUrl();
|
||||
if (isBlank(url)) {
|
||||
|
@ -67,6 +80,79 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
return url;
|
||||
}
|
||||
|
||||
private Bundle batch(Bundle theRequest) {
|
||||
ourLog.info("Beginning batch with {} resources", theRequest.getEntry().size());
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
TransactionTemplate txTemplate = new TransactionTemplate(myTxManager);
|
||||
txTemplate.setPropagationBehavior(TransactionTemplate.PROPAGATION_REQUIRES_NEW);
|
||||
|
||||
Bundle resp = new Bundle();
|
||||
resp.setType(BundleTypeEnum.BATCH_RESPONSE);
|
||||
OperationOutcome ooResp = new OperationOutcome();
|
||||
resp.addEntry().setResource(ooResp);
|
||||
|
||||
/*
|
||||
* For batch, we handle each entry as a mini-transaction in its own
|
||||
* database transaction so that if one fails, it doesn't prevent others
|
||||
*/
|
||||
|
||||
for (final Entry nextRequestEntry : theRequest.getEntry()) {
|
||||
|
||||
TransactionCallback<Bundle> callback = new TransactionCallback<Bundle>() {
|
||||
@Override
|
||||
public Bundle doInTransaction(TransactionStatus theStatus) {
|
||||
Bundle subRequestBundle = new Bundle();
|
||||
subRequestBundle.setType(BundleTypeEnum.TRANSACTION);
|
||||
subRequestBundle.addEntry(nextRequestEntry);
|
||||
|
||||
Bundle subResponseBundle = transaction(subRequestBundle, "Batch sub-request");
|
||||
return subResponseBundle;
|
||||
}
|
||||
};
|
||||
|
||||
BaseServerResponseException caughtEx;
|
||||
try {
|
||||
Bundle nextResponseBundle = txTemplate.execute(callback);
|
||||
caughtEx = null;
|
||||
|
||||
Entry subResponseEntry = nextResponseBundle.getEntry().get(1);
|
||||
resp.addEntry(subResponseEntry);
|
||||
/*
|
||||
* If the individual entry didn't have a resource in its response, bring the
|
||||
* sub-transaction's OperationOutcome across so the client can see it
|
||||
*/
|
||||
if (subResponseEntry.getResource() == null) {
|
||||
subResponseEntry.setResource(nextResponseBundle.getEntry().get(0).getResource());
|
||||
}
|
||||
|
||||
} catch (BaseServerResponseException e) {
|
||||
caughtEx = e;
|
||||
} catch (Throwable t) {
|
||||
ourLog.error("Failure during BATCH sub transaction processing", t);
|
||||
caughtEx = new InternalErrorException(t);
|
||||
}
|
||||
|
||||
if (caughtEx != null) {
|
||||
Entry nextEntry = resp.addEntry();
|
||||
|
||||
OperationOutcome oo = new OperationOutcome();
|
||||
oo.addIssue().setSeverity(IssueSeverityEnum.ERROR).setDetails(caughtEx.getMessage());
|
||||
nextEntry.setResource(oo);
|
||||
|
||||
EntryResponse nextEntryResp = nextEntry.getResponse();
|
||||
nextEntryResp.setStatus(toStatusString(caughtEx.getStatusCode()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long delay = System.currentTimeMillis() - start;
|
||||
ourLog.info("Batch completed in {}ms", new Object[] { delay });
|
||||
ooResp.addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails("Batch completed in " + delay + "ms");
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MetaDt metaGetOperation() {
|
||||
|
||||
|
@ -148,11 +234,33 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Transactional(propagation = Propagation.REQUIRED)
|
||||
@Override
|
||||
public Bundle transaction(Bundle theResources) {
|
||||
ourLog.info("Beginning transaction with {} resources", theResources.getEntry().size());
|
||||
public Bundle transaction(Bundle theRequest) {
|
||||
String theActionName = "Transaction";
|
||||
return transaction(theRequest, theActionName);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private Bundle transaction(Bundle theRequest, String theActionName) {
|
||||
BundleTypeEnum transactionType = theRequest.getTypeElement().getValueAsEnum();
|
||||
if (transactionType == BundleTypeEnum.BATCH) {
|
||||
return batch(theRequest);
|
||||
}
|
||||
|
||||
OperationOutcome statusOperationOutcome = new OperationOutcome();
|
||||
if (transactionType == null) {
|
||||
String message = "Transactiion Bundle did not specify valid Bundle.type, assuming " + BundleTypeEnum.TRANSACTION.getCode();
|
||||
statusOperationOutcome.addIssue().setCode(IssueTypeEnum.INVALID_CONTENT).setSeverity(IssueSeverityEnum.WARNING).setDetails(message);
|
||||
ourLog.warn(message);
|
||||
transactionType = BundleTypeEnum.TRANSACTION;
|
||||
}
|
||||
if (transactionType != BundleTypeEnum.TRANSACTION) {
|
||||
throw new InvalidRequestException("Unable to process transaction where incoming Bundle.type = " + transactionType.getCode());
|
||||
}
|
||||
|
||||
ourLog.info("Beginning {} with {} resources", theActionName, theRequest.getEntry().size());
|
||||
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
Set<IdDt> allIds = new LinkedHashSet<IdDt>();
|
||||
|
@ -160,11 +268,12 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
Map<IdDt, DaoMethodOutcome> idToPersistedOutcome = new HashMap<IdDt, DaoMethodOutcome>();
|
||||
|
||||
Bundle response = new Bundle();
|
||||
OperationOutcome oo = new OperationOutcome();
|
||||
response.addEntry().setResource(oo);
|
||||
response.addEntry().setResource(statusOperationOutcome);
|
||||
|
||||
for (int i = 0; i < theResources.getEntry().size(); i++) {
|
||||
Entry nextEntry = theResources.getEntry().get(i);
|
||||
// TODO: process verbs in the correct order
|
||||
|
||||
for (int i = 0; i < theRequest.getEntry().size(); i++) {
|
||||
Entry nextEntry = theRequest.getEntry().get(i);
|
||||
IResource res = nextEntry.getResource();
|
||||
IdDt nextResourceId = null;
|
||||
if (res != null) {
|
||||
|
@ -221,7 +330,7 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
parts.getDao().deleteByUrl(parts.getResourceType() + '?' + parts.getParams());
|
||||
}
|
||||
|
||||
newEntry.getResponse().setStatus(Integer.toString(Constants.STATUS_HTTP_204_NO_CONTENT));
|
||||
newEntry.getResponse().setStatus(toStatusString(Constants.STATUS_HTTP_204_NO_CONTENT));
|
||||
break;
|
||||
}
|
||||
case PUT: {
|
||||
|
@ -258,7 +367,7 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
if (isNotBlank(ifNoneMatch)) {
|
||||
ifNoneMatch = MethodUtil.parseETagValue(ifNoneMatch);
|
||||
}
|
||||
|
||||
|
||||
if (parts.getResourceId() != null && parts.getParams() == null) {
|
||||
IResource found;
|
||||
boolean notChanged = false;
|
||||
|
@ -281,9 +390,9 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
resp.setLocation(found.getId().toUnqualified().getValue());
|
||||
resp.setEtag(found.getId().getVersionIdPart());
|
||||
if (!notChanged) {
|
||||
resp.setStatus(Integer.toString(Constants.STATUS_HTTP_200_OK));
|
||||
resp.setStatus(toStatusString(Constants.STATUS_HTTP_200_OK));
|
||||
} else {
|
||||
resp.setStatus(Integer.toString(Constants.STATUS_HTTP_304_NOT_MODIFIED));
|
||||
resp.setStatus(toStatusString(Constants.STATUS_HTTP_304_NOT_MODIFIED));
|
||||
}
|
||||
} else if (parts.getParams() != null) {
|
||||
RuntimeResourceDefinition def = getContext().getResourceDefinition(parts.getDao().getResourceType());
|
||||
|
@ -295,7 +404,7 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
|
||||
int configuredMax = 100; // this should probably be configurable or something
|
||||
if (bundle.size() > configuredMax) {
|
||||
oo.addIssue().setSeverity(IssueSeverityEnum.WARNING)
|
||||
statusOperationOutcome.addIssue().setSeverity(IssueSeverityEnum.WARNING)
|
||||
.setDetails("Search nested within transaction found more than " + configuredMax + " matches, but paging is not supported in nested transactions");
|
||||
}
|
||||
List<IBaseResource> resourcesToAdd = bundle.getResources(0, Math.min(bundle.size(), configuredMax));
|
||||
|
@ -305,7 +414,7 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
|
||||
Entry newEntry = response.addEntry();
|
||||
newEntry.setResource(searchBundle);
|
||||
newEntry.getResponse().setStatus(Integer.toString(Constants.STATUS_HTTP_200_OK));
|
||||
newEntry.getResponse().setStatus(toStatusString(Constants.STATUS_HTTP_200_OK));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -314,6 +423,10 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
|
||||
FhirTerser terser = getContext().newTerser();
|
||||
|
||||
/*
|
||||
* Perform ID substitutions and then index each resource we have saved
|
||||
*/
|
||||
|
||||
for (DaoMethodOutcome nextOutcome : idToPersistedOutcome.values()) {
|
||||
IResource nextResource = (IResource) nextOutcome.getResource();
|
||||
if (nextResource == null) {
|
||||
|
@ -337,10 +450,29 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
updateEntity(nextResource, nextOutcome.getEntity(), false, deletedTimestampOrNull, true, false);
|
||||
}
|
||||
|
||||
long delay = System.currentTimeMillis() - start;
|
||||
ourLog.info("Transaction completed in {}ms", new Object[] { delay });
|
||||
myEntityManager.flush();
|
||||
|
||||
oo.addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails("Transaction completed in " + delay + "ms");
|
||||
/*
|
||||
* Double check we didn't allow any duplicates we shouldn't have
|
||||
*/
|
||||
for (Entry nextEntry : theRequest.getEntry()) {
|
||||
if (nextEntry.getRequest().getMethodElement().getValueAsEnum() == HTTPVerbEnum.POST) {
|
||||
String matchUrl = nextEntry.getRequest().getIfNoneExist();
|
||||
if (isNotBlank(matchUrl)) {
|
||||
IFhirResourceDao<?> resourceDao = getDao(nextEntry.getResource().getClass());
|
||||
Set<Long> val = resourceDao.processMatchUrl(matchUrl);
|
||||
if (val.size() > 1) {
|
||||
throw new InvalidRequestException(
|
||||
"Unable to process " + theActionName + " - Request would cause multiple resources to match URL: \"" + matchUrl + "\". Does transaction request contain duplicates?");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long delay = System.currentTimeMillis() - start;
|
||||
ourLog.info(theActionName + " completed in {}ms", new Object[] { delay });
|
||||
|
||||
statusOperationOutcome.addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails(theActionName + " completed in " + delay + "ms");
|
||||
|
||||
for (IdDt next : allIds) {
|
||||
IdDt replacement = idSubstitutions.get(next);
|
||||
|
@ -350,7 +482,7 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
if (replacement.equals(next)) {
|
||||
continue;
|
||||
}
|
||||
oo.addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails("Placeholder resource ID \"" + next + "\" was replaced with permanent ID \"" + replacement + "\"");
|
||||
statusOperationOutcome.addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails("Placeholder resource ID \"" + next + "\" was replaced with permanent ID \"" + replacement + "\"");
|
||||
}
|
||||
|
||||
notifyWriteCompleted();
|
||||
|
@ -374,9 +506,9 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
}
|
||||
idToPersistedOutcome.put(newId, outcome);
|
||||
if (outcome.getCreated().booleanValue()) {
|
||||
newEntry.getResponse().setStatus(Long.toString(Constants.STATUS_HTTP_201_CREATED));
|
||||
newEntry.getResponse().setStatus(toStatusString(Constants.STATUS_HTTP_201_CREATED));
|
||||
} else {
|
||||
newEntry.getResponse().setStatus(Long.toString(Constants.STATUS_HTTP_200_OK));
|
||||
newEntry.getResponse().setStatus(toStatusString(Constants.STATUS_HTTP_200_OK));
|
||||
}
|
||||
newEntry.getResponse().setLocation(outcome.getId().toUnqualified().getValue());
|
||||
newEntry.getResponse().setEtag(outcome.getId().getVersionIdPart());
|
||||
|
@ -389,6 +521,10 @@ public class FhirSystemDaoDstu2 extends BaseHapiFhirSystemDao<Bundle> {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static String toStatusString(int theStatusCode) {
|
||||
return Integer.toString(theStatusCode) + " " + defaultString(Constants.HTTP_STATUS_NAMES.get(theStatusCode));
|
||||
}
|
||||
|
||||
private static class UrlParts {
|
||||
private IFhirResourceDao<? extends IBaseResource> myDao;
|
||||
private String myParams;
|
||||
|
|
|
@ -90,6 +90,8 @@ public interface IFhirResourceDao<T extends IBaseResource> extends IDao {
|
|||
*/
|
||||
MetaDt metaGetOperation(IIdType theId);
|
||||
|
||||
Set<Long> processMatchUrl(String theMatchUrl);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param theId
|
||||
|
|
|
@ -44,12 +44,12 @@ public class ResourceTag extends BaseTag {
|
|||
@JoinColumn(name = "RES_ID", referencedColumnName = "RES_ID")
|
||||
private ResourceTable myResource;
|
||||
|
||||
@Column(name = "RES_TYPE", length = ResourceTable.RESTYPE_LEN,nullable=false)
|
||||
@Column(name = "RES_TYPE", length = ResourceTable.RESTYPE_LEN, nullable = false)
|
||||
private String myResourceType;
|
||||
|
||||
@Column(name="RES_ID", insertable=false,updatable=false)
|
||||
@Column(name = "RES_ID", insertable = false, updatable = false)
|
||||
private Long myResourceId;
|
||||
|
||||
|
||||
public Long getResourceId() {
|
||||
return myResourceId;
|
||||
}
|
||||
|
|
|
@ -39,9 +39,7 @@ import ca.uhn.fhir.model.api.Tag;
|
|||
|
||||
//@formatter:on
|
||||
@Entity
|
||||
@Table(name = "HFJ_TAG_DEF", uniqueConstraints = {
|
||||
@UniqueConstraint(columnNames = { "TAG_TYPE", "TAG_SYSTEM", "TAG_CODE" })
|
||||
})
|
||||
@Table(name = "HFJ_TAG_DEF", uniqueConstraints = { @UniqueConstraint(columnNames = { "TAG_TYPE", "TAG_SYSTEM", "TAG_CODE" }) })
|
||||
//@formatter:off
|
||||
public class TagDefinition implements Serializable {
|
||||
|
||||
|
@ -89,6 +87,10 @@ public class TagDefinition implements Serializable {
|
|||
return myDisplay;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return myId;
|
||||
}
|
||||
|
||||
public String getSystem() {
|
||||
return mySystem;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
|||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
|
@ -73,6 +73,7 @@ import ca.uhn.fhir.rest.param.NumberParam;
|
|||
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
|
@ -96,7 +97,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaTest {
|
|||
private static IFhirResourceDao<Organization> ourOrganizationDao;
|
||||
private static IFhirResourceDao<Patient> ourPatientDao;
|
||||
@SuppressWarnings("unused")
|
||||
private static IFhirResourceDao<QuestionnaireAnswers> ourQuestionnaireAnswersDao;
|
||||
private static IFhirResourceDao<QuestionnaireResponse> ourQuestionnaireResponseDao;
|
||||
private static IFhirResourceDao<Questionnaire> ourQuestionnaireDao;
|
||||
private static IFhirSystemDao<Bundle> ourSystemDao;
|
||||
private static IFhirResourceDao<Practitioner> ourPractitionerDao;
|
||||
|
@ -1926,6 +1927,80 @@ public class FhirResourceDaoDstu2Test extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchWithTagParameter() {
|
||||
String methodName = "testSearchWithTagParameter";
|
||||
|
||||
IIdType tag1id;
|
||||
{
|
||||
Organization org = new Organization();
|
||||
org.getNameElement().setValue("FOO");
|
||||
TagList tagList = new TagList();
|
||||
tagList.addTag("urn:taglist", methodName + "1a");
|
||||
tagList.addTag("urn:taglist", methodName + "1b");
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put(org, tagList);
|
||||
tag1id = ourOrganizationDao.create(org).getId().toUnqualifiedVersionless();
|
||||
}
|
||||
IIdType tag2id;
|
||||
{
|
||||
Organization org = new Organization();
|
||||
org.getNameElement().setValue("FOO");
|
||||
TagList tagList = new TagList();
|
||||
tagList.addTag("urn:taglist", methodName + "2a");
|
||||
tagList.addTag("urn:taglist", methodName + "2b");
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put(org, tagList);
|
||||
tag2id = ourOrganizationDao.create(org).getId().toUnqualifiedVersionless();
|
||||
}
|
||||
|
||||
{
|
||||
// One tag
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
params.add("_tag", new TokenParam("urn:taglist", methodName + "1a"));
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(ourOrganizationDao.search(params));
|
||||
assertThat(patients, containsInAnyOrder(tag1id));
|
||||
}
|
||||
{
|
||||
// Code only
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
params.add("_tag", new TokenParam(null, methodName + "1a"));
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(ourOrganizationDao.search(params));
|
||||
assertThat(patients, containsInAnyOrder(tag1id));
|
||||
}
|
||||
{
|
||||
// Or tags
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
TokenOrListParam orListParam = new TokenOrListParam();
|
||||
orListParam.add(new TokenParam("urn:taglist", methodName + "1a"));
|
||||
orListParam.add(new TokenParam("urn:taglist", methodName + "2a"));
|
||||
params.add("_tag", orListParam);
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(ourOrganizationDao.search(params));
|
||||
assertThat(patients, containsInAnyOrder(tag1id, tag2id));
|
||||
}
|
||||
// TODO: get multiple/AND working
|
||||
{
|
||||
// And tags
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
TokenAndListParam andListParam = new TokenAndListParam();
|
||||
andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "1a"));
|
||||
andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "2a"));
|
||||
params.add("_tag", andListParam);
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(ourOrganizationDao.search(params));
|
||||
assertEquals(0, patients.size());
|
||||
}
|
||||
|
||||
{
|
||||
// And tags
|
||||
SearchParameterMap params = new SearchParameterMap();
|
||||
TokenAndListParam andListParam = new TokenAndListParam();
|
||||
andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "1a"));
|
||||
andListParam.addValue(new TokenOrListParam("urn:taglist", methodName + "1b"));
|
||||
params.add("_tag", andListParam);
|
||||
List<IIdType> patients = toUnqualifiedVersionlessIds(ourOrganizationDao.search(params));
|
||||
assertThat(patients, containsInAnyOrder(tag1id));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchWithIncludes() {
|
||||
IIdType parentOrgId;
|
||||
|
@ -2959,7 +3034,7 @@ public class FhirResourceDaoDstu2Test extends BaseJpaTest {
|
|||
ourEncounterDao = ourCtx.getBean("myEncounterDaoDstu2", IFhirResourceDao.class);
|
||||
ourSystemDao = ourCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class);
|
||||
ourQuestionnaireDao = ourCtx.getBean("myQuestionnaireDaoDstu2", IFhirResourceDao.class);
|
||||
ourQuestionnaireAnswersDao = ourCtx.getBean("myQuestionnaireAnswersDaoDstu2", IFhirResourceDao.class);
|
||||
ourQuestionnaireResponseDao = ourCtx.getBean("myQuestionnaireResponseDaoDstu2", IFhirResourceDao.class);
|
||||
ourFhirCtx = ourCtx.getBean(FhirContext.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,13 +29,16 @@ import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
|||
import ca.uhn.fhir.model.dstu2.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.EntryResponse;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.IssueSeverityEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
@ -172,12 +175,12 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals(3, resp.getEntry().size());
|
||||
|
||||
Entry respEntry = resp.getEntry().get(1);
|
||||
assertEquals(Constants.STATUS_HTTP_200_OK + "", respEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_200_OK + " OK", respEntry.getResponse().getStatus());
|
||||
assertThat(respEntry.getResponse().getLocation(), endsWith("Patient/" + id.getIdPart() + "/_history/1"));
|
||||
assertEquals("1", respEntry.getResponse().getEtag());
|
||||
|
||||
respEntry = resp.getEntry().get(2);
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + "", respEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", respEntry.getResponse().getStatus());
|
||||
assertThat(respEntry.getResponse().getLocation(), containsString("Observation/"));
|
||||
assertThat(respEntry.getResponse().getLocation(), endsWith("/_history/1"));
|
||||
assertEquals("1", respEntry.getResponse().getEtag());
|
||||
|
@ -188,6 +191,116 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionWithInvalidType() {
|
||||
Bundle request = new Bundle();
|
||||
request.setType(BundleTypeEnum.SEARCH_RESULTS);
|
||||
Patient p = new Patient();
|
||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerbEnum.POST);
|
||||
|
||||
try {
|
||||
ourSystemDao.transaction(request);
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals("Unable to process transaction where incoming Bundle.type = searchset", e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionBatchWithFailingRead() {
|
||||
String methodName = "testTransactionBatchWithFailingRead";
|
||||
Bundle request = new Bundle();
|
||||
request.setType(BundleTypeEnum.BATCH);
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addName().addFamily(methodName);
|
||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerbEnum.POST);
|
||||
|
||||
request.addEntry().getRequest().setMethod(HTTPVerbEnum.GET).setUrl("Patient/THIS_ID_DOESNT_EXIST");
|
||||
|
||||
Bundle resp = ourSystemDao.transaction(request);
|
||||
assertEquals(3, resp.getEntry().size());
|
||||
|
||||
ourLog.info(ourFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
|
||||
EntryResponse respEntry;
|
||||
|
||||
// Bundle.entry[0] is operation outcome
|
||||
assertEquals(OperationOutcome.class, resp.getEntry().get(0).getResource().getClass());
|
||||
assertEquals(IssueSeverityEnum.INFORMATION, ((OperationOutcome)resp.getEntry().get(0).getResource()).getIssue().get(0).getSeverityElement().getValueAsEnum());
|
||||
assertThat(((OperationOutcome)resp.getEntry().get(0).getResource()).getIssue().get(0).getDiagnostics(), startsWith("Batch completed in "));
|
||||
|
||||
// Bundle.entry[1] is create response
|
||||
assertEquals(OperationOutcome.class, resp.getEntry().get(1).getResource().getClass());
|
||||
assertEquals(IssueSeverityEnum.INFORMATION, ((OperationOutcome)resp.getEntry().get(1).getResource()).getIssue().get(0).getSeverityElement().getValueAsEnum());
|
||||
assertThat(((OperationOutcome)resp.getEntry().get(1).getResource()).getIssue().get(0).getDiagnostics(), startsWith("Batch sub-request completed in"));
|
||||
assertEquals("201 Created", resp.getEntry().get(1).getResponse().getStatus());
|
||||
assertThat(resp.getEntry().get(1).getResponse().getLocation(), startsWith("Patient/"));
|
||||
|
||||
// Bundle.entry[2] is failed read response
|
||||
assertEquals(OperationOutcome.class, resp.getEntry().get(2).getResource().getClass());
|
||||
assertEquals(IssueSeverityEnum.ERROR, ((OperationOutcome)resp.getEntry().get(2).getResource()).getIssue().get(0).getSeverityElement().getValueAsEnum());
|
||||
assertEquals("Resource Patient/THIS_ID_DOESNT_EXIST is not known", ((OperationOutcome)resp.getEntry().get(2).getResource()).getIssue().get(0).getDiagnostics());
|
||||
assertEquals("404 Not Found", resp.getEntry().get(2).getResponse().getStatus());
|
||||
|
||||
// Check POST
|
||||
respEntry = resp.getEntry().get(1).getResponse();
|
||||
assertThat(respEntry.getStatus(), startsWith("201"));
|
||||
IdDt createdId = new IdDt(respEntry.getLocation());
|
||||
assertEquals("Patient", createdId.getResourceType());
|
||||
ourPatientDao.read(createdId); // shouldn't fail
|
||||
|
||||
// Check GET
|
||||
respEntry = resp.getEntry().get(2).getResponse();
|
||||
assertThat(respEntry.getStatus(), startsWith("404"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionCreateWithDuplicateMatchUrl01() {
|
||||
String methodName = "testTransactionCreateWithDuplicateMatchUrl01";
|
||||
Bundle request = new Bundle();
|
||||
|
||||
Patient p;
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerbEnum.POST).setIfNoneExist("Patient?identifier=urn%3Asystem%7C" + methodName);
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerbEnum.POST).setIfNoneExist("Patient?identifier=urn%3Asystem%7C" + methodName);
|
||||
|
||||
try {
|
||||
ourSystemDao.transaction(request);
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals(e.getMessage(),
|
||||
"Unable to process Transaction - Request would cause multiple resources to match URL: \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateWithDuplicateMatchUrl01\". Does transaction request contain duplicates?");
|
||||
}
|
||||
}
|
||||
|
||||
public void testTransactionCreateWithDuplicateMatchUrl02() {
|
||||
String methodName = "testTransactionCreateWithDuplicateMatchUrl02";
|
||||
Bundle request = new Bundle();
|
||||
|
||||
Patient p;
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerbEnum.POST).setIfNoneExist("Patient?identifier=urn%3Asystem%7C" + methodName);
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
request.addEntry().setResource(p).getRequest().setMethod(HTTPVerbEnum.POST);
|
||||
|
||||
try {
|
||||
ourSystemDao.transaction(request);
|
||||
fail();
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals(e.getMessage(),
|
||||
"Unable to process Transaction - Request would cause multiple resources to match URL: \"Patient?identifier=urn%3Asystem%7CtestTransactionCreateWithDuplicateMatchUrl02\". Does transaction request contain duplicates?");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionCreateMatchUrlWithTwoMatch() {
|
||||
String methodName = "testTransactionCreateMatchUrlWithTwoMatch";
|
||||
|
@ -239,10 +352,11 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
request.addEntry().setResource(o).getRequest().setMethod(HTTPVerbEnum.POST);
|
||||
|
||||
Bundle resp = ourSystemDao.transaction(request);
|
||||
assertEquals(BundleTypeEnum.TRANSACTION_RESPONSE, resp.getTypeElement().getValueAsEnum());
|
||||
assertEquals(3, resp.getEntry().size());
|
||||
|
||||
Entry respEntry = resp.getEntry().get(1);
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + "", respEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", respEntry.getResponse().getStatus());
|
||||
String patientId = respEntry.getResponse().getLocation();
|
||||
assertThat(patientId, not(endsWith("Patient/" + methodName + "/_history/1")));
|
||||
assertThat(patientId, (endsWith("/_history/1")));
|
||||
|
@ -250,7 +364,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals("1", respEntry.getResponse().getEtag());
|
||||
|
||||
respEntry = resp.getEntry().get(2);
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + "", respEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", respEntry.getResponse().getStatus());
|
||||
assertThat(respEntry.getResponse().getLocation(), containsString("Observation/"));
|
||||
assertThat(respEntry.getResponse().getLocation(), endsWith("/_history/1"));
|
||||
assertEquals("1", respEntry.getResponse().getEtag());
|
||||
|
@ -273,7 +387,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals(2, resp.getEntry().size());
|
||||
|
||||
Entry respEntry = resp.getEntry().get(1);
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + "", respEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", respEntry.getResponse().getStatus());
|
||||
String patientId = respEntry.getResponse().getLocation();
|
||||
assertThat(patientId, not(containsString("test")));
|
||||
}
|
||||
|
@ -342,8 +456,8 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
Bundle resp = ourSystemDao.transaction(request);
|
||||
|
||||
assertEquals(3, resp.getEntry().size());
|
||||
assertEquals("204", resp.getEntry().get(1).getResponse().getStatus());
|
||||
assertEquals("204", resp.getEntry().get(2).getResponse().getStatus());
|
||||
assertEquals("204 No Content", resp.getEntry().get(1).getResponse().getStatus());
|
||||
assertEquals("204 No Content", resp.getEntry().get(2).getResponse().getStatus());
|
||||
|
||||
try {
|
||||
ourPatientDao.read(id1.toVersionless());
|
||||
|
@ -361,7 +475,6 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testTransactionDeleteMatchUrlWithOneMatch() {
|
||||
String methodName = "testTransactionDeleteMatchUrlWithOneMatch";
|
||||
|
@ -378,7 +491,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals(2, resp.getEntry().size());
|
||||
|
||||
Entry nextEntry = resp.getEntry().get(1);
|
||||
assertEquals(Constants.STATUS_HTTP_204_NO_CONTENT + "", nextEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_204_NO_CONTENT + " No Content", nextEntry.getResponse().getStatus());
|
||||
|
||||
try {
|
||||
ourPatientDao.read(id.toVersionless());
|
||||
|
@ -464,7 +577,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
Bundle res = ourSystemDao.transaction(request);
|
||||
assertEquals(2, res.getEntry().size());
|
||||
|
||||
assertEquals(Constants.STATUS_HTTP_204_NO_CONTENT + "", res.getEntry().get(1).getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_204_NO_CONTENT + " No Content", res.getEntry().get(1).getResponse().getStatus());
|
||||
|
||||
try {
|
||||
ourPatientDao.read(id.toVersionless());
|
||||
|
@ -584,17 +697,17 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertThat(respBundle.getTotal().intValue(), greaterThan(0));
|
||||
|
||||
// Invalid _count
|
||||
|
||||
|
||||
request = new Bundle();
|
||||
request.addEntry().getRequest().setMethod(HTTPVerbEnum.GET).setUrl("Patient?" + Constants.PARAM_COUNT + "=GKJGKJG");
|
||||
try {
|
||||
ourSystemDao.transaction(request);
|
||||
ourSystemDao.transaction(request);
|
||||
} catch (InvalidRequestException e) {
|
||||
assertEquals(e.getMessage(), ("Invalid _count value: GKJGKJG"));
|
||||
}
|
||||
|
||||
// Empty _count
|
||||
|
||||
|
||||
request = new Bundle();
|
||||
request.addEntry().getRequest().setMethod(HTTPVerbEnum.GET).setUrl("Patient?" + Constants.PARAM_COUNT + "=");
|
||||
respBundle = ourSystemDao.transaction(request);
|
||||
|
@ -622,7 +735,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
request.addEntry().getRequest().setMethod(HTTPVerbEnum.GET).setUrl(idv1.toUnqualifiedVersionless().getValue());
|
||||
request.addEntry().getRequest().setMethod(HTTPVerbEnum.GET).setUrl(idv1.toUnqualifiedVersionless().getValue()).setIfNoneMatch("W/\"" + idv1.getVersionIdPart() + "\"");
|
||||
request.addEntry().getRequest().setMethod(HTTPVerbEnum.GET).setUrl(idv1.toUnqualifiedVersionless().getValue()).setIfNoneMatch("W/\"" + idv2.getVersionIdPart() + "\"");
|
||||
|
||||
|
||||
Bundle resp = ourSystemDao.transaction(request);
|
||||
|
||||
assertEquals(4, resp.getEntry().size());
|
||||
|
@ -633,17 +746,17 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertNotNull(nextEntry.getResource());
|
||||
assertEquals(Patient.class, nextEntry.getResource().getClass());
|
||||
assertEquals(idv2.toUnqualified(), nextEntry.getResource().getId().toUnqualified());
|
||||
assertEquals("200", nextEntry.getResponse().getStatus());
|
||||
assertEquals("200 OK", nextEntry.getResponse().getStatus());
|
||||
|
||||
nextEntry = resp.getEntry().get(2);
|
||||
assertNotNull(nextEntry.getResource());
|
||||
assertEquals(Patient.class, nextEntry.getResource().getClass());
|
||||
assertEquals(idv2.toUnqualified(), nextEntry.getResource().getId().toUnqualified());
|
||||
assertEquals("200", nextEntry.getResponse().getStatus());
|
||||
assertEquals("200 OK", nextEntry.getResponse().getStatus());
|
||||
|
||||
nextEntry = resp.getEntry().get(3);
|
||||
assertNull(nextEntry.getResource());
|
||||
assertEquals("304", nextEntry.getResponse().getStatus());
|
||||
assertEquals("304 Not Modified", nextEntry.getResponse().getStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -671,14 +784,14 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals(3, resp.getEntry().size());
|
||||
|
||||
Entry nextEntry = resp.getEntry().get(1);
|
||||
assertEquals("200", nextEntry.getResponse().getStatus());
|
||||
assertEquals("200 OK", nextEntry.getResponse().getStatus());
|
||||
assertThat(nextEntry.getResponse().getLocation(), not(containsString("test")));
|
||||
assertEquals(id.toVersionless(), p.getId().toVersionless());
|
||||
assertNotEquals(id, p.getId());
|
||||
assertThat(p.getId().toString(), endsWith("/_history/2"));
|
||||
|
||||
nextEntry = resp.getEntry().get(1);
|
||||
assertEquals("" + Constants.STATUS_HTTP_200_OK, nextEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_200_OK + " OK", nextEntry.getResponse().getStatus());
|
||||
assertThat(nextEntry.getResponse().getLocation(), not(emptyString()));
|
||||
|
||||
nextEntry = resp.getEntry().get(2);
|
||||
|
@ -745,7 +858,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals(3, resp.getEntry().size());
|
||||
|
||||
Entry nextEntry = resp.getEntry().get(1);
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + "", nextEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", nextEntry.getResponse().getStatus());
|
||||
IdDt patientId = new IdDt(nextEntry.getResponse().getLocation());
|
||||
|
||||
assertThat(nextEntry.getResponse().getLocation(), not(containsString("test")));
|
||||
|
@ -785,7 +898,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertEquals(3, resp.getEntry().size());
|
||||
|
||||
Entry nextEntry = resp.getEntry().get(1);
|
||||
assertEquals("200", nextEntry.getResponse().getStatus());
|
||||
assertEquals("200 OK", nextEntry.getResponse().getStatus());
|
||||
|
||||
assertThat(nextEntry.getResponse().getLocation(), (containsString("test")));
|
||||
assertEquals(id.toVersionless(), new IdDt(nextEntry.getResponse().getLocation()).toVersionless());
|
||||
|
@ -793,7 +906,7 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
assertThat(nextEntry.getResponse().getLocation(), endsWith("/_history/2"));
|
||||
|
||||
nextEntry = resp.getEntry().get(2);
|
||||
assertEquals("" + Constants.STATUS_HTTP_201_CREATED, nextEntry.getResponse().getStatus());
|
||||
assertEquals(Constants.STATUS_HTTP_201_CREATED + " Created", nextEntry.getResponse().getStatus());
|
||||
|
||||
o = ourObservationDao.read(new IdDt(resp.getEntry().get(2).getResponse().getLocation()));
|
||||
assertEquals(id.toVersionless(), o.getSubject().getReference());
|
||||
|
@ -925,17 +1038,17 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
||||
|
||||
Bundle resp = ourSystemDao.transaction(res);
|
||||
|
||||
|
||||
ourLog.info(ourFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
|
||||
|
||||
|
||||
assertEquals(BundleTypeEnum.TRANSACTION_RESPONSE, resp.getTypeElement().getValueAsEnum());
|
||||
assertEquals(4, resp.getEntry().size());
|
||||
|
||||
assertEquals(OperationOutcome.class, resp.getEntry().get(0).getResource().getClass());
|
||||
|
||||
|
||||
OperationOutcome outcome = (OperationOutcome) resp.getEntry().get(0).getResource();
|
||||
assertThat(outcome.getIssue().get(1).getDetails(), containsString("Placeholder resource ID \"urn:oid:0.1.2.3\" was replaced with permanent ID \"Patient/"));
|
||||
|
||||
assertThat(outcome.getIssue().get(1).getDiagnostics(), containsString("Placeholder resource ID \"urn:oid:0.1.2.3\" was replaced with permanent ID \"Patient/"));
|
||||
|
||||
assertTrue(resp.getEntry().get(1).getResponse().getLocation(), new IdDt(resp.getEntry().get(1).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
|
||||
assertTrue(resp.getEntry().get(2).getResponse().getLocation(), new IdDt(resp.getEntry().get(2).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
|
||||
assertTrue(resp.getEntry().get(3).getResponse().getLocation(), new IdDt(resp.getEntry().get(3).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
|
||||
|
@ -973,17 +1086,17 @@ public class FhirSystemDaoDstu2Test extends BaseJpaTest {
|
|||
res.addEntry().setResource(o2).getRequest().setMethod(HTTPVerbEnum.POST).setUrl("Observation");
|
||||
|
||||
Bundle resp = ourSystemDao.transaction(res);
|
||||
|
||||
|
||||
ourLog.info(ourFhirContext.newXmlParser().setPrettyPrint(true).encodeResourceToString(resp));
|
||||
|
||||
|
||||
assertEquals(BundleTypeEnum.TRANSACTION_RESPONSE, resp.getTypeElement().getValueAsEnum());
|
||||
assertEquals(4, resp.getEntry().size());
|
||||
|
||||
assertEquals(OperationOutcome.class, resp.getEntry().get(0).getResource().getClass());
|
||||
|
||||
|
||||
OperationOutcome outcome = (OperationOutcome) resp.getEntry().get(0).getResource();
|
||||
assertThat(outcome.getIssue().get(1).getDetails(), containsString("Placeholder resource ID \"urn:oid:0.1.2.3\" was replaced with permanent ID \"Patient/"));
|
||||
|
||||
assertThat(outcome.getIssue().get(1).getDiagnostics(), containsString("Placeholder resource ID \"urn:oid:0.1.2.3\" was replaced with permanent ID \"Patient/"));
|
||||
|
||||
assertTrue(resp.getEntry().get(1).getResponse().getLocation(), new IdDt(resp.getEntry().get(1).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
|
||||
assertTrue(resp.getEntry().get(2).getResponse().getLocation(), new IdDt(resp.getEntry().get(2).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
|
||||
assertTrue(resp.getEntry().get(3).getResponse().getLocation(), new IdDt(resp.getEntry().get(3).getResponse().getLocation()).getIdPart().matches("^[0-9]+$"));
|
||||
|
|
|
@ -1,8 +1,22 @@
|
|||
package ca.uhn.fhir.jpa.provider;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.hamcrest.Matchers.contains;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.containsInRelativeOrder;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.hasItems;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
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.BufferedReader;
|
||||
import java.io.IOException;
|
||||
|
@ -37,14 +51,12 @@ import org.hl7.fhir.instance.model.api.IIdType;
|
|||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.experimental.theories.suppliers.TestedOn;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.jpa.dao.BaseJpaTest;
|
||||
import ca.uhn.fhir.jpa.dao.DaoConfig;
|
||||
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
|
||||
import ca.uhn.fhir.jpa.dao.SearchParameterMap;
|
||||
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.BundleEntry;
|
||||
|
@ -70,7 +82,7 @@ import ca.uhn.fhir.model.dstu2.resource.Organization;
|
|||
import ca.uhn.fhir.model.dstu2.resource.Parameters;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Questionnaire;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
|
||||
import ca.uhn.fhir.model.dstu2.resource.ValueSet;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.AnswerFormatEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.EncounterClassEnum;
|
||||
|
@ -86,7 +98,6 @@ import ca.uhn.fhir.model.valueset.BundleEntrySearchModeEnum;
|
|||
import ca.uhn.fhir.model.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
import ca.uhn.fhir.rest.client.ServerValidationModeEnum;
|
||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||
|
@ -94,7 +105,6 @@ import ca.uhn.fhir.rest.gclient.IQuery;
|
|||
import ca.uhn.fhir.rest.gclient.StringClientParam;
|
||||
import ca.uhn.fhir.rest.gclient.TokenClientParam;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
|
||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||
|
@ -417,8 +427,8 @@ public class ResourceProviderDstu2Test extends BaseJpaTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testCreateQuestionnaireAnswersWithValidation() throws IOException {
|
||||
String methodName = "testCreateQuestionnaireAnswersWithValidation";
|
||||
public void testCreateQuestionnaireResponseWithValidation() throws IOException {
|
||||
String methodName = "testCreateQuestionnaireResponseWithValidation";
|
||||
|
||||
ValueSet options = new ValueSet();
|
||||
options.getCodeSystem().setSystem("urn:system").addConcept().setCode("code0");
|
||||
|
@ -428,18 +438,18 @@ public class ResourceProviderDstu2Test extends BaseJpaTest {
|
|||
q.getGroup().addQuestion().setLinkId("link0").setRequired(false).setType(AnswerFormatEnum.CHOICE).setOptions(new ResourceReferenceDt(optId));
|
||||
IIdType qId = ourClient.create().resource(q).execute().getId();
|
||||
|
||||
QuestionnaireAnswers qa;
|
||||
QuestionnaireResponse qa;
|
||||
|
||||
// Good code
|
||||
|
||||
qa = new QuestionnaireAnswers();
|
||||
qa = new QuestionnaireResponse();
|
||||
qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue());
|
||||
qa.getGroup().addQuestion().setLinkId("link0").addAnswer().setValue(new CodingDt().setSystem("urn:system").setCode("code0"));
|
||||
ourClient.create().resource(qa).execute();
|
||||
|
||||
// Bad code
|
||||
|
||||
qa = new QuestionnaireAnswers();
|
||||
qa = new QuestionnaireResponse();
|
||||
qa.getQuestionnaire().setReference(qId.toUnqualifiedVersionless().getValue());
|
||||
qa.getGroup().addQuestion().setLinkId("link0").addAnswer().setValue(new CodingDt().setSystem("urn:system").setCode("code1"));
|
||||
try {
|
||||
|
|
|
@ -82,13 +82,13 @@ public class JsonParserTest {
|
|||
|
||||
private void parseAndEncode(String name) throws IOException {
|
||||
String msg = IOUtils.toString(XmlParser.class.getResourceAsStream(name));
|
||||
// ourLog.info(msg);
|
||||
// ourLog.info(msg);
|
||||
|
||||
IParser p = ourCtx.newJsonParser();
|
||||
Profile res = p.parseResource(Profile.class, msg);
|
||||
|
||||
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(res);
|
||||
// ourLog.info(encoded);
|
||||
// ourLog.info(encoded);
|
||||
|
||||
JSON expected = JSONSerializer.toJSON(msg.trim());
|
||||
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
||||
|
@ -101,18 +101,18 @@ public class JsonParserTest {
|
|||
|
||||
assertEquals(exp, act);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDecimalPrecisionPreserved() {
|
||||
String number = "52.3779939997090374535378485873776474764643249869328698436986235758587";
|
||||
|
||||
|
||||
Location loc = new Location();
|
||||
// This is far more precision than is realistic, but let's see if we preserve it
|
||||
loc.getPosition().setLatitude(new DecimalDt(number));
|
||||
|
||||
|
||||
String encoded = ourCtx.newJsonParser().encodeResourceToString(loc);
|
||||
Location parsed = ourCtx.newJsonParser().parseResource(Location.class, encoded);
|
||||
|
||||
|
||||
assertEquals(number, parsed.getPosition().getLatitude().getValueAsString());
|
||||
}
|
||||
|
||||
|
@ -202,37 +202,13 @@ public class JsonParserTest {
|
|||
String enc = ourCtx.newJsonParser().encodeResourceToString(patient);
|
||||
assertThat(enc, org.hamcrest.Matchers.stringContainsInOrder("{\"resourceType\":\"Patient\",",
|
||||
"\"extension\":[{\"url\":\"http://example.com/extensions#someext\",\"valueDateTime\":\"2011-01-02T11:13:15\"}",
|
||||
"{\"url\":\"http://example.com#parent\",\"extension\":[{\"url\":\"http://example.com#child\",\"valueString\":\"value1\"},{\"url\":\"http://example.com#child\",\"valueString\":\"value2\"}]}"
|
||||
));
|
||||
assertThat(enc, org.hamcrest.Matchers.stringContainsInOrder("\"modifierExtension\":[" +
|
||||
"{" +
|
||||
"\"url\":\"http://example.com/extensions#modext\"," +
|
||||
"\"valueDate\":\"1995-01-02\"" +
|
||||
"}" +
|
||||
"],"));
|
||||
assertThat(enc, containsString("\"_given\":[" +
|
||||
"{" +
|
||||
"\"extension\":[" +
|
||||
"{" +
|
||||
"\"url\":\"http://examples.com#givenext\"," +
|
||||
"\"valueString\":\"given\"" +
|
||||
"}" +
|
||||
"]" +
|
||||
"}," +
|
||||
"{" +
|
||||
"\"extension\":[" +
|
||||
"{" +
|
||||
"\"url\":\"http://examples.com#givenext_parent\"," +
|
||||
"\"extension\":[" +
|
||||
"{" +
|
||||
"\"url\":\"http://examples.com#givenext_child\"," +
|
||||
"\"valueString\":\"CHILD\"" +
|
||||
"}" +
|
||||
"]" +
|
||||
"}" +
|
||||
"]" +
|
||||
"}"));
|
||||
|
||||
"{\"url\":\"http://example.com#parent\",\"extension\":[{\"url\":\"http://example.com#child\",\"valueString\":\"value1\"},{\"url\":\"http://example.com#child\",\"valueString\":\"value2\"}]}"));
|
||||
assertThat(enc, org.hamcrest.Matchers.stringContainsInOrder("\"modifierExtension\":[" + "{" + "\"url\":\"http://example.com/extensions#modext\"," + "\"valueDate\":\"1995-01-02\"" + "}" + "],"));
|
||||
assertThat(enc,
|
||||
containsString("\"_given\":[" + "{" + "\"extension\":[" + "{" + "\"url\":\"http://examples.com#givenext\"," + "\"valueString\":\"given\"" + "}" + "]" + "}," + "{" + "\"extension\":[" + "{"
|
||||
+ "\"url\":\"http://examples.com#givenext_parent\"," + "\"extension\":[" + "{" + "\"url\":\"http://examples.com#givenext_child\"," + "\"valueString\":\"CHILD\"" + "}" + "]" + "}"
|
||||
+ "]" + "}"));
|
||||
|
||||
/*
|
||||
* Now parse this back
|
||||
*/
|
||||
|
@ -270,8 +246,6 @@ public class JsonParserTest {
|
|||
assertEquals("CHILD", ((StringDt) given2ext2.getValue()).getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBinaryResource() {
|
||||
|
@ -285,8 +259,6 @@ public class JsonParserTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBundle() throws InterruptedException {
|
||||
Bundle b = new Bundle();
|
||||
|
@ -329,12 +301,11 @@ public class JsonParserTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBundleCategory() {
|
||||
|
||||
Bundle b = new Bundle();
|
||||
|
||||
|
||||
BundleEntry e = b.addEntry();
|
||||
e.setResource(new Patient());
|
||||
b.addCategory("scheme", "term", "label");
|
||||
|
@ -354,8 +325,7 @@ public class JsonParserTest {
|
|||
assertNull(b.getEntries().get(0).getResource());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBundleEntryCategory() {
|
||||
|
||||
|
@ -378,11 +348,11 @@ public class JsonParserTest {
|
|||
assertNull(b.getEntries().get(0).getResource());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeContained() {
|
||||
IParser xmlParser = ourCtx.newJsonParser().setPrettyPrint(true);
|
||||
|
||||
|
||||
// Create an organization, note that the organization does not have an ID
|
||||
Organization org = new Organization();
|
||||
org.getName().setValue("Contained Test Organization");
|
||||
|
@ -391,33 +361,33 @@ public class JsonParserTest {
|
|||
Patient patient = new Patient();
|
||||
patient.setId("Patient/1333");
|
||||
patient.addIdentifier("urn:mrns", "253345");
|
||||
|
||||
|
||||
// Put the organization as a reference in the patient resource
|
||||
patient.getManagingOrganization().setResource(org);
|
||||
|
||||
|
||||
String encoded = xmlParser.encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\"")));
|
||||
|
||||
|
||||
// Create a bundle with just the patient resource
|
||||
List<IResource> resources = new ArrayList<IResource>();
|
||||
resources.add(patient);
|
||||
Bundle b = Bundle.withResources(resources, ourCtx, "http://example.com/base");
|
||||
|
||||
|
||||
// Encode the bundle
|
||||
encoded = xmlParser.encodeBundleToString(b);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\"")));
|
||||
|
||||
|
||||
// Re-parse the bundle
|
||||
patient = (Patient) xmlParser.parseResource(xmlParser.encodeResourceToString(patient));
|
||||
assertEquals("#1", patient.getManagingOrganization().getReference().getValue());
|
||||
|
||||
|
||||
assertNotNull(patient.getManagingOrganization().getResource());
|
||||
org = (Organization) patient.getManagingOrganization().getResource();
|
||||
assertEquals("#1", org.getId().getValue());
|
||||
assertEquals("Contained Test Organization", org.getName().getValue());
|
||||
|
||||
|
||||
// And re-encode a second time
|
||||
encoded = xmlParser.encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
|
@ -426,7 +396,7 @@ public class JsonParserTest {
|
|||
|
||||
// And re-encode once more, with the references cleared
|
||||
patient.getContained().getContainedResources().clear();
|
||||
patient.getManagingOrganization().setReference((IdDt)null);
|
||||
patient.getManagingOrganization().setReference((IdDt) null);
|
||||
encoded = xmlParser.encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"1\"", "\"identifier\"", "\"reference\":\"#1\"")));
|
||||
|
@ -434,13 +404,13 @@ public class JsonParserTest {
|
|||
|
||||
// And re-encode once more, with the references cleared and a manually set local ID
|
||||
patient.getContained().getContainedResources().clear();
|
||||
patient.getManagingOrganization().setReference((IdDt)null);
|
||||
patient.getManagingOrganization().setReference((IdDt) null);
|
||||
patient.getManagingOrganization().getResource().setId(new IdDt("#333"));
|
||||
encoded = xmlParser.encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\":[", "\"id\":\"333\"", "\"identifier\"", "\"reference\":\"#333\"")));
|
||||
assertThat(encoded, not(stringContainsInOrder(Arrays.asList("\"contained\":", "[", "\"contained\":"))));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -454,18 +424,18 @@ public class JsonParserTest {
|
|||
patient.setId("Patient/1333");
|
||||
patient.addIdentifier("urn:mrns", "253345");
|
||||
patient.getManagingOrganization().setResource(org);
|
||||
|
||||
|
||||
// Create a bundle with just the patient resource
|
||||
List<IResource> resources = new ArrayList<IResource>();
|
||||
resources.add(patient);
|
||||
Bundle b = Bundle.withResources(resources, ourCtx, "http://example.com/base");
|
||||
|
||||
|
||||
// Encode the buntdle
|
||||
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\"", "resourceType\":\"Organization", "id\":\"1\"")));
|
||||
assertThat(encoded, containsString("reference\":\"#1\""));
|
||||
|
||||
|
||||
encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, stringContainsInOrder(Arrays.asList("\"contained\"", "resourceType\":\"Organization", "id\":\"1\"")));
|
||||
|
@ -484,7 +454,6 @@ public class JsonParserTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeContainedResourcesMore() {
|
||||
|
||||
|
@ -529,7 +498,7 @@ public class JsonParserTest {
|
|||
ourLog.info(encoded);
|
||||
assertThat(encoded, not(containsString("FOOBAR")));
|
||||
assertThat(encoded, (containsString("BARFOO")));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -586,8 +555,7 @@ public class JsonParserTest {
|
|||
ourLog.info(encoded);
|
||||
|
||||
assertThat(encoded, not(containsString("123456")));
|
||||
assertEquals(
|
||||
"{\"resourceType\":\"ValueSet\",\"define\":{\"concept\":[{\"extension\":[{\"url\":\"urn:alt\",\"valueString\":\"alt name\"}],\"code\":\"someCode\",\"display\":\"someDisplay\"}]}}",
|
||||
assertEquals("{\"resourceType\":\"ValueSet\",\"define\":{\"concept\":[{\"extension\":[{\"url\":\"urn:alt\",\"valueString\":\"alt name\"}],\"code\":\"someCode\",\"display\":\"someDisplay\"}]}}",
|
||||
encoded);
|
||||
|
||||
}
|
||||
|
@ -686,27 +654,26 @@ public class JsonParserTest {
|
|||
|
||||
@Test
|
||||
public void testEncodeIds() {
|
||||
Patient pt =new Patient();
|
||||
Patient pt = new Patient();
|
||||
pt.addIdentifier("sys", "val");
|
||||
|
||||
|
||||
ListResource list = new ListResource();
|
||||
list.setId("listId");
|
||||
list.addEntry().setItem(new ResourceReferenceDt(pt));
|
||||
|
||||
|
||||
String enc = ourCtx.newJsonParser().encodeResourceToString(list);
|
||||
ourLog.info(enc);
|
||||
|
||||
|
||||
assertThat(enc, containsString("\"id\":\"1\""));
|
||||
|
||||
ListResource parsed = ourCtx.newJsonParser().parseResource(ListResource.class,enc);
|
||||
|
||||
ListResource parsed = ourCtx.newJsonParser().parseResource(ListResource.class, enc);
|
||||
assertEquals(Patient.class, parsed.getEntryFirstRep().getItem().getResource().getClass());
|
||||
|
||||
enc = enc.replace("\"id\"", "\"_id\"");
|
||||
parsed = ourCtx.newJsonParser().parseResource(ListResource.class,enc);
|
||||
parsed = ourCtx.newJsonParser().parseResource(ListResource.class, enc);
|
||||
assertEquals(Patient.class, parsed.getEntryFirstRep().getItem().getResource().getClass());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeInvalidChildGoodException() {
|
||||
Observation obs = new Observation();
|
||||
|
@ -743,7 +710,7 @@ public class JsonParserTest {
|
|||
assertThat(out, containsString("<xhtml:div xmlns:xhtml=\\\"http://www.w3.org/1999/xhtml\\\">hello</xhtml:div>"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeNonContained() {
|
||||
Organization org = new Organization();
|
||||
|
@ -754,30 +721,30 @@ public class JsonParserTest {
|
|||
patient.setId("Patient/1333");
|
||||
patient.addIdentifier("urn:mrns", "253345");
|
||||
patient.getManagingOrganization().setResource(org);
|
||||
|
||||
Bundle b = Bundle.withResources(Collections.singletonList((IResource)patient), ourCtx, "http://foo");
|
||||
|
||||
Bundle b = Bundle.withResources(Collections.singletonList((IResource) patient), ourCtx, "http://foo");
|
||||
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, not(containsString("contained")));
|
||||
assertThat(encoded, containsString("\"reference\":\"Organization/65546\""));
|
||||
|
||||
|
||||
encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, not(containsString("contained")));
|
||||
assertThat(encoded, containsString("\"reference\":\"Organization/65546\""));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeOmitsVersionAndBase() {
|
||||
Patient p = new Patient();
|
||||
p.getManagingOrganization().setReference("http://example.com/base/Patient/1/_history/2");
|
||||
|
||||
|
||||
String enc;
|
||||
|
||||
|
||||
enc = ourCtx.newJsonParser().encodeResourceToString(p);
|
||||
ourLog.info(enc);
|
||||
assertThat(enc, containsString("\"http://example.com/base/Patient/1\""));
|
||||
|
||||
|
||||
enc = ourCtx.newJsonParser().setServerBaseUrl("http://example.com/base").encodeResourceToString(p);
|
||||
ourLog.info(enc);
|
||||
assertThat(enc, containsString("\"Patient/1\""));
|
||||
|
@ -786,10 +753,7 @@ public class JsonParserTest {
|
|||
ourLog.info(enc);
|
||||
assertThat(enc, containsString("\"http://example.com/base/Patient/1\""));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeQuery() {
|
||||
Query q = new Query();
|
||||
|
@ -958,11 +922,11 @@ public class JsonParserTest {
|
|||
Questionnaire parsed = ourCtx.newJsonParser().parseResource(Questionnaire.class, res);
|
||||
assertEquals("Note: This is an anonymous survey, which means you cannot be identified.", parsed.getGroup().getHeader().getValue());
|
||||
assertEquals(1, parsed.getGroup().getHeader().getUndeclaredExtensionsByUrl("http://hl7.org/fhir/Profile/iso-21090#language").size());
|
||||
|
||||
|
||||
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(parsed);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, containsString("\"_header\":{"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -999,8 +963,9 @@ public class JsonParserTest {
|
|||
@Override
|
||||
public void setFhirContext(FhirContext theFhirContext) {
|
||||
// nothing
|
||||
}};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
FhirContext context = ourCtx;
|
||||
context.setNarrativeGenerator(gen);
|
||||
IParser p = context.newJsonParser();
|
||||
|
@ -1016,7 +981,7 @@ public class JsonParserTest {
|
|||
public void before() {
|
||||
ourCtx.setNarrativeGenerator(null);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testNestedContainedResources() {
|
||||
|
||||
|
@ -1078,8 +1043,8 @@ public class JsonParserTest {
|
|||
String encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(bundle);
|
||||
ourLog.info(encoded);
|
||||
|
||||
assertEquals("http://fhir.healthintersections.com.au/open/DiagnosticReport/_search?_format=application/json+fhir&search-id=46d5f0e7-9240-4d4f-9f51-f8ac975c65&search-sort=_id", bundle
|
||||
.getLinkSelf().getValue());
|
||||
assertEquals("http://fhir.healthintersections.com.au/open/DiagnosticReport/_search?_format=application/json+fhir&search-id=46d5f0e7-9240-4d4f-9f51-f8ac975c65&search-sort=_id",
|
||||
bundle.getLinkSelf().getValue());
|
||||
assertEquals("urn:uuid:0b754ff9-03cf-4322-a119-15019af8a3", bundle.getBundleId().getValue());
|
||||
|
||||
BundleEntry entry = bundle.getEntries().get(0);
|
||||
|
|
|
@ -108,39 +108,14 @@ public class XmlParserTest {
|
|||
String str = ourCtx.newXmlParser().encodeResourceToString(patient);
|
||||
ourLog.info(str);
|
||||
|
||||
assertThat(
|
||||
str,
|
||||
Matchers.stringContainsInOrder("<Patient xmlns=\"http://hl7.org/fhir\"><extension url=\"http://foo/someOrg\"><valueResource><reference value=\"#1\"/></valueResource></extension><contained><Organization xmlns=\"http://hl7.org/fhir\" id=\"1\"><name value=\"OrgName\"/></Organization></contained><name><family value=\"PatientName\"/></name></Patient>"));
|
||||
assertThat(str, Matchers.stringContainsInOrder(
|
||||
"<Patient xmlns=\"http://hl7.org/fhir\"><extension url=\"http://foo/someOrg\"><valueResource><reference value=\"#1\"/></valueResource></extension><contained><Organization xmlns=\"http://hl7.org/fhir\" id=\"1\"><name value=\"OrgName\"/></Organization></contained><name><family value=\"PatientName\"/></name></Patient>"));
|
||||
|
||||
MyPatient parse = ourCtx.newXmlParser().parseResource(MyPatient.class, str);
|
||||
assertEquals("PatientName", parse.getNameFirstRep().getFamilyAsSingleString());
|
||||
assertEquals("OrgName", ((MyOrganization) parse.getSomeOrganization().getResource()).getName().getValue());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testParseAndEncodeHugeValue() {
|
||||
int len = 1000000;
|
||||
byte[] bytes = new byte[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
bytes[i] = (byte) (Math.random() * Byte.MAX_VALUE);
|
||||
}
|
||||
|
||||
AttachmentDt att = new AttachmentDt();
|
||||
att.setData(bytes);
|
||||
|
||||
Observation obs = new Observation();
|
||||
obs.setValue(att);
|
||||
|
||||
String str = ourCtx.newXmlParser().encodeResourceToString(obs);
|
||||
assertThat(str.length(), Matchers.greaterThan(len));
|
||||
|
||||
obs = ourCtx.newXmlParser().parseResource(Observation.class, str);
|
||||
att = (AttachmentDt) obs.getValue();
|
||||
assertArrayEquals(bytes, att.getData().getValue());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test for #82 - Not yet enabled because the test won't pass
|
||||
*/
|
||||
|
@ -157,9 +132,8 @@ public class XmlParserTest {
|
|||
String str = ourCtx.newXmlParser().encodeResourceToString(patient);
|
||||
ourLog.info(str);
|
||||
|
||||
assertThat(
|
||||
str,
|
||||
Matchers.stringContainsInOrder("<Patient xmlns=\"http://hl7.org/fhir\"><contained><Organization xmlns=\"http://hl7.org/fhir\" id=\"1\"><name value=\"OrgName\"/></Organization></contained><name><family value=\"PatientName\"/></name><managingOrganization><reference value=\"#1\"/></managingOrganization></Patient>"));
|
||||
assertThat(str, Matchers.stringContainsInOrder(
|
||||
"<Patient xmlns=\"http://hl7.org/fhir\"><contained><Organization xmlns=\"http://hl7.org/fhir\" id=\"1\"><name value=\"OrgName\"/></Organization></contained><name><family value=\"PatientName\"/></name><managingOrganization><reference value=\"#1\"/></managingOrganization></Patient>"));
|
||||
|
||||
MyPatient parse = ourCtx.newXmlParser().parseResource(MyPatient.class, str);
|
||||
assertEquals("PatientName", parse.getNameFirstRep().getFamilyAsSingleString());
|
||||
|
@ -251,13 +225,11 @@ public class XmlParserTest {
|
|||
String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
|
||||
assertThat(enc, containsString("<Patient xmlns=\"http://hl7.org/fhir\"><extension url=\"http://example.com/extensions#someext\"><valueDateTime value=\"2011-01-02T11:13:15\"/></extension>"));
|
||||
assertThat(enc, containsString("<modifierExtension url=\"http://example.com/extensions#modext\"><valueDate value=\"1995-01-02\"/></modifierExtension>"));
|
||||
assertThat(
|
||||
enc,
|
||||
containsString("<extension url=\"http://example.com#parent\"><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension><extension url=\"http://example.com#child\"><valueString value=\"value2\"/></extension></extension>"));
|
||||
assertThat(enc, containsString(
|
||||
"<extension url=\"http://example.com#parent\"><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension><extension url=\"http://example.com#child\"><valueString value=\"value2\"/></extension></extension>"));
|
||||
assertThat(enc, containsString("<given value=\"Joe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"given\"/></extension></given>"));
|
||||
assertThat(
|
||||
enc,
|
||||
containsString("<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
|
||||
assertThat(enc, containsString(
|
||||
"<given value=\"Shmoe\"><extension url=\"http://examples.com#givenext_parent\"><extension url=\"http://examples.com#givenext_child\"><valueString value=\"CHILD\"/></extension></extension></given>"));
|
||||
|
||||
/*
|
||||
* Now parse this back
|
||||
|
@ -306,9 +278,9 @@ public class XmlParserTest {
|
|||
comp.addSection().getContent().setResource(new AllergyIntolerance().addIdentifier("foo", "bar"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().addIdentifier("foo", "bar"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().addIdentifier("foo", "bar"));
|
||||
|
||||
|
||||
IParser parser = ourCtx.newJsonParser().setPrettyPrint(true);
|
||||
|
||||
|
||||
String string = parser.encodeResourceToString(comp);
|
||||
ourLog.info(string);
|
||||
|
||||
|
@ -331,9 +303,9 @@ public class XmlParserTest {
|
|||
comp.addSection().getContent().setResource(new AllergyIntolerance().addIdentifier("foo", "bar"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().addIdentifier("foo", "bar"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().addIdentifier("foo", "bar"));
|
||||
|
||||
|
||||
IParser parser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
|
||||
String string = parser.encodeResourceToString(comp);
|
||||
ourLog.info(string);
|
||||
|
||||
|
@ -500,28 +472,6 @@ public class XmlParserTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeContainedWithSelfReference() {
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
// Create an organization, note that the organization does not have an ID
|
||||
Organization org = new Organization();
|
||||
org.getName().setValue("Contained Test Organization");
|
||||
org.setPartOf(new ResourceReferenceDt(org));
|
||||
|
||||
// Create a patient
|
||||
Patient patient = new Patient();
|
||||
patient.getManagingOrganization().setResource(org);
|
||||
|
||||
String encoded = xmlParser.encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, containsString("<contained>"));
|
||||
assertThat(encoded, containsString("<reference value=\"#1\"/>"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeContained() {
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
@ -673,6 +623,25 @@ public class XmlParserTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeContainedWithSelfReference() {
|
||||
IParser xmlParser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
// Create an organization, note that the organization does not have an ID
|
||||
Organization org = new Organization();
|
||||
org.getName().setValue("Contained Test Organization");
|
||||
org.setPartOf(new ResourceReferenceDt(org));
|
||||
|
||||
// Create a patient
|
||||
Patient patient = new Patient();
|
||||
patient.getManagingOrganization().setResource(org);
|
||||
|
||||
String encoded = xmlParser.encodeResourceToString(patient);
|
||||
ourLog.info(encoded);
|
||||
assertThat(encoded, containsString("<contained>"));
|
||||
assertThat(encoded, containsString("<reference value=\"#1\"/>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeDeclaredExtensionWithAddressContent() {
|
||||
IParser parser = ourCtx.newXmlParser();
|
||||
|
@ -1265,9 +1234,8 @@ public class XmlParserTest {
|
|||
|
||||
String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
|
||||
assertThat(enc, containsString("<Patient xmlns=\"http://hl7.org/fhir\"><extension url=\"http://example.com/extensions#someext\"><valueDateTime value=\"2011-01-02T11:13:15\"/></extension>"));
|
||||
assertThat(
|
||||
enc,
|
||||
containsString("<extension url=\"http://example.com#parent\"><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension></extension>"));
|
||||
assertThat(enc, containsString(
|
||||
"<extension url=\"http://example.com#parent\"><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension></extension>"));
|
||||
assertThat(enc, containsString("<given value=\"Joe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"given\"/></extension></given>"));
|
||||
}
|
||||
|
||||
|
@ -1360,6 +1328,28 @@ public class XmlParserTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseAndEncodeHugeValue() {
|
||||
int len = 1000000;
|
||||
byte[] bytes = new byte[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
bytes[i] = (byte) (Math.random() * Byte.MAX_VALUE);
|
||||
}
|
||||
|
||||
AttachmentDt att = new AttachmentDt();
|
||||
att.setData(bytes);
|
||||
|
||||
Observation obs = new Observation();
|
||||
obs.setValue(att);
|
||||
|
||||
String str = ourCtx.newXmlParser().encodeResourceToString(obs);
|
||||
assertThat(str.length(), Matchers.greaterThan(len));
|
||||
|
||||
obs = ourCtx.newXmlParser().parseResource(Observation.class, str);
|
||||
att = (AttachmentDt) obs.getValue();
|
||||
assertArrayEquals(bytes, att.getData().getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* See #131
|
||||
*/
|
||||
|
@ -1685,6 +1675,20 @@ public class XmlParserTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseErrorHandlerDuplicateElement() {
|
||||
String input = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
|
||||
try {
|
||||
ourCtx.newXmlParser().setParserErrorHandler(new StrictErrorHandler()).parseResource(Patient.class, input);
|
||||
fail();
|
||||
} catch (DataFormatException e) {
|
||||
assertThat(e.getMessage(), containsString("Multiple repetitions"));
|
||||
}
|
||||
|
||||
Patient p = ourCtx.newXmlParser().setParserErrorHandler(new LenientErrorHandler()).parseResource(Patient.class, input);
|
||||
assertEquals("true", p.getActive().getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseErrorHandlerNoError() {
|
||||
String input = "<Patient></Patient>";
|
||||
|
@ -1719,20 +1723,6 @@ public class XmlParserTest {
|
|||
assertEquals(p.getName().get(0).getFamily().get(0).getValue(), "AAA");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseErrorHandlerDuplicateElement() {
|
||||
String input = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
|
||||
try {
|
||||
ourCtx.newXmlParser().setParserErrorHandler(new StrictErrorHandler()).parseResource(Patient.class, input);
|
||||
fail();
|
||||
} catch (DataFormatException e) {
|
||||
assertThat(e.getMessage(), containsString("Multiple repetitions"));
|
||||
}
|
||||
|
||||
Patient p = ourCtx.newXmlParser().setParserErrorHandler(new LenientErrorHandler()).parseResource(Patient.class, input);
|
||||
assertEquals("true", p.getActive().getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseFeedWithListResource() throws ConfigurationException, DataFormatException, IOException {
|
||||
|
||||
|
@ -1781,18 +1771,35 @@ public class XmlParserTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseReferenceWithUnexpectedChild() {
|
||||
//@formatter:off
|
||||
String input =
|
||||
"<Patient xmlns=\"http://hl7.org/fhir\">"
|
||||
+ " <managingOrganization>"
|
||||
+ " <reference value=\"Patient/123\"/>"
|
||||
+ " <text value=\"BLAH\"/>"
|
||||
+ " </managingOrganization>"
|
||||
+ "</Patient>";
|
||||
//@formatter:on
|
||||
|
||||
Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, input);
|
||||
String output = ourCtx.newXmlParser().encodeResourceToString(parsed);
|
||||
|
||||
assertEquals("<Patient xmlns=\"http://hl7.org/fhir\"><managingOrganization><reference value=\"Patient/123\"/></managingOrganization></Patient>", output);
|
||||
}
|
||||
|
||||
/**
|
||||
* #175
|
||||
*/
|
||||
// @Test
|
||||
// @Test
|
||||
public void testParseTextWithUnknownEntity() {
|
||||
String msg = "<Patient xmlns=\"http://hl7.org/fhir\"><text><status value=\"generated\"/>"
|
||||
+ "<div xmlns=\"http://www.w3.org/1999/xhtml\">Trade ™</div></text></Patient>";
|
||||
String msg = "<Patient xmlns=\"http://hl7.org/fhir\"><text><status value=\"generated\"/>" + "<div xmlns=\"http://www.w3.org/1999/xhtml\">Trade ™</div></text></Patient>";
|
||||
Patient pt = ourCtx.newXmlParser().parseResource(Patient.class, msg);
|
||||
|
||||
ourLog.info(pt.getText().getDiv().getValueAsString());
|
||||
assertThat(pt.getText().getDiv().getValueAsString(), containsString("Trade ™"));
|
||||
|
||||
|
||||
String enc = ourCtx.newXmlParser().encodeResourceToString(pt);
|
||||
ourLog.info(enc);
|
||||
assertThat(enc, containsString("Trade ™"));
|
||||
|
|
|
@ -693,6 +693,34 @@ public class GenericClientTest {
|
|||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void testSearchByTag() throws Exception {
|
||||
|
||||
String msg = getPatientFeedWithOneResult();
|
||||
|
||||
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
|
||||
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
|
||||
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")));
|
||||
|
||||
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
|
||||
|
||||
//@formatter:off
|
||||
Bundle response = client.search()
|
||||
.forResource(Patient.class)
|
||||
.withTag("urn:foo", "123")
|
||||
.withTag("urn:bar", "456")
|
||||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals(
|
||||
"http://example.com/fhir/Patient?_tag=urn%3Afoo%7C123&_tag=urn%3Abar%7C456",
|
||||
capt.getValue().getURI().toString());
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@Test
|
||||
public void testSearchWithReverseInclude() throws Exception {
|
||||
|
|
|
@ -220,6 +220,8 @@ public class IncomingRequestAddressStrategyTest {
|
|||
|
||||
private static class MyServlet extends HttpServlet {
|
||||
|
||||
private static final long serialVersionUID = -8903322104434705422L;
|
||||
|
||||
@Override
|
||||
protected void doGet(HttpServletRequest theReq, HttpServletResponse theResp) throws ServletException, IOException {
|
||||
|
||||
|
|
|
@ -0,0 +1,188 @@
|
|||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.client.ClientProtocolException;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
import ca.uhn.fhir.rest.annotation.Read;
|
||||
import ca.uhn.fhir.util.RandomServerPortProvider;
|
||||
|
||||
public class ServletContextParsingTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static IdDt ourLastId;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServletContextParsingTest.class);
|
||||
|
||||
private Server myServer;
|
||||
|
||||
public void after() throws Exception {
|
||||
if (myServer != null) {
|
||||
myServer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
ourLastId = null;
|
||||
}
|
||||
|
||||
private void httpGet(String url) throws IOException, ClientProtocolException {
|
||||
ourLastId = null;
|
||||
|
||||
HttpGet httpget = new HttpGet(url);
|
||||
HttpResponse status = ourClient.execute(httpget);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
ourLog.info(responseContent);
|
||||
}
|
||||
|
||||
private void startServer(int port, String contextPath, String servletPath) throws Exception {
|
||||
myServer = new Server(port);
|
||||
|
||||
org.eclipse.jetty.servlet.ServletContextHandler proxyHandler = new org.eclipse.jetty.servlet.ServletContextHandler();
|
||||
proxyHandler.setContextPath(contextPath);
|
||||
|
||||
ServletHolder handler = new ServletHolder();
|
||||
handler.setServlet(new MyServlet());
|
||||
proxyHandler.addServlet(handler, servletPath);
|
||||
|
||||
myServer.setHandler(proxyHandler);
|
||||
myServer.start();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnderJettyWithContextPathServletRoot() throws Exception {
|
||||
int port = RandomServerPortProvider.findFreePort();
|
||||
|
||||
String contextPath = "/ctx";
|
||||
String servletPath = "/*";
|
||||
|
||||
startServer(port, contextPath, servletPath);
|
||||
|
||||
httpGet("http://localhost:" + port + "/ctx/Patient/123/_history/234?_pretty=true");
|
||||
assertEquals("Patient/123/_history/234", ourLastId.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUnderJettyWithContextPathServletRoot2() throws Exception {
|
||||
int port = RandomServerPortProvider.findFreePort();
|
||||
|
||||
String contextPath = "/ctx";
|
||||
String servletPath = "/foo/bar/*"; // not /* but still this should work
|
||||
|
||||
startServer(port, contextPath, servletPath);
|
||||
|
||||
httpGet("http://localhost:" + port + "/ctx/foo/bar/Patient/123/_history/222");
|
||||
assertEquals("Patient/123/_history/222", ourLastId.getValue());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnderJettyWithContextPathServletPath() throws Exception {
|
||||
int port = RandomServerPortProvider.findFreePort();
|
||||
|
||||
String contextPath = "/ctx";
|
||||
String servletPath = "/servlet/*";
|
||||
|
||||
startServer(port, contextPath, servletPath);
|
||||
|
||||
httpGet("http://localhost:" + port + "/ctx/servlet/Patient/123/_history/222");
|
||||
assertEquals("Patient/123/_history/222", ourLastId.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnderJettyWithMultiplePaths() throws Exception {
|
||||
int port = RandomServerPortProvider.findFreePort();
|
||||
|
||||
myServer = new Server(port);
|
||||
|
||||
org.eclipse.jetty.servlet.ServletContextHandler proxyHandler = new org.eclipse.jetty.servlet.ServletContextHandler();
|
||||
proxyHandler.setContextPath("/ctx");
|
||||
|
||||
proxyHandler.addServlet(new ServletHolder(new MyServlet()), "/servlet/*");
|
||||
proxyHandler.addServlet(new ServletHolder(new MyServlet()), "/foo/bar/*");
|
||||
|
||||
myServer.setHandler(proxyHandler);
|
||||
myServer.start();
|
||||
|
||||
httpGet("http://localhost:" + port + "/ctx/servlet/Patient/123/_history/222");
|
||||
assertEquals("Patient/123/_history/222", ourLastId.getValue());
|
||||
|
||||
httpGet("http://localhost:" + port + "/ctx/foo/bar/Patient/123/_history/222");
|
||||
assertEquals("Patient/123/_history/222", ourLastId.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnderJettyWithContextRootServletRoot() throws Exception {
|
||||
int port = RandomServerPortProvider.findFreePort();
|
||||
|
||||
String contextPath = "/";
|
||||
String servletPath = "/*";
|
||||
|
||||
startServer(port, contextPath, servletPath);
|
||||
|
||||
httpGet("http://localhost:" + port + "/Patient/123/_history/222");
|
||||
assertEquals("Patient/123/_history/222", ourLastId.getValue());
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
builder.setConnectionManager(connectionManager);
|
||||
ourClient = builder.build();
|
||||
}
|
||||
|
||||
private static class MyServlet extends RestfulServer {
|
||||
|
||||
private static final long serialVersionUID = -8903322104434705422L;
|
||||
|
||||
@Override
|
||||
protected void initialize() throws ServletException {
|
||||
setResourceProviders(new MyPatientProvider());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class MyPatientProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Read(version=true)
|
||||
public Patient read(@IdParam IdDt theId) {
|
||||
ourLastId = theId;
|
||||
Patient retVal = new Patient();
|
||||
retVal.setId(theId);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -49,16 +49,90 @@ public class TokenParameterTest {
|
|||
* Test #192
|
||||
*/
|
||||
@Test
|
||||
public void testOrListWithEscapedValue() throws Exception {
|
||||
public void testOrListWithEscapedValue1() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=" + UrlUtil.escape("system|code-include-but-not-end-with-comma\\,suffix"));
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals("system", ourLastOrList.getListAsCodings().get(0).getSystemElement().getValue());
|
||||
assertEquals("code-include-but-not-end-with-comma,suffix", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
assertEquals(1, ourLastOrList.getListAsCodings().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test #192
|
||||
*/
|
||||
@Test
|
||||
public void testOrListWithEscapedValue2() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=" + UrlUtil.escape("system|code-include-end-with-comma\\,"));
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(1, ourLastOrList.getListAsCodings().size());
|
||||
assertEquals("system", ourLastOrList.getListAsCodings().get(0).getSystemElement().getValue());
|
||||
assertEquals("code-include-but-not-end-with-comma,suffix", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
assertEquals("code-include-end-with-comma,", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test #192
|
||||
*/
|
||||
@Test
|
||||
public void testOrListWithEscapedValue3() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=" + UrlUtil.escape("system|code-include-end-with-comma1,system|code-include-end-with-comma2,,,,,"));
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(2, ourLastOrList.getListAsCodings().size());
|
||||
assertEquals("system", ourLastOrList.getListAsCodings().get(0).getSystemElement().getValue());
|
||||
assertEquals("code-include-end-with-comma1", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
assertEquals("system", ourLastOrList.getListAsCodings().get(1).getSystemElement().getValue());
|
||||
assertEquals("code-include-end-with-comma2", ourLastOrList.getListAsCodings().get(1).getCodeElement().getValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test #192
|
||||
*/
|
||||
@Test
|
||||
public void testOrListWithEscapedValue4() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=" + UrlUtil.escape("\\,\\,\\,value1\\,\\,\\,with\\,\\,\\,commas\\,\\,\\,,,,\\,\\,\\,value2\\,\\,\\,with\\,\\,\\,commas,,,\\,"));
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(null, ourLastOrList.getListAsCodings().get(0).getSystemElement().getValue());
|
||||
assertEquals(",,,value1,,,with,,,commas,,,", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
assertEquals(null, ourLastOrList.getListAsCodings().get(1).getSystemElement().getValue());
|
||||
assertEquals(",,,value2,,,with,,,commas", ourLastOrList.getListAsCodings().get(1).getCodeElement().getValue());
|
||||
assertEquals(null, ourLastOrList.getListAsCodings().get(2).getSystemElement().getValue());
|
||||
assertEquals(",", ourLastOrList.getListAsCodings().get(2).getCodeElement().getValue());
|
||||
assertEquals(3, ourLastOrList.getListAsCodings().size());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test #192
|
||||
*/
|
||||
@Test
|
||||
public void testOrListWithEscapedValue5() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=" + UrlUtil.escape("A\\\\,B,\\$"));
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(null, ourLastOrList.getListAsCodings().get(0).getSystemElement().getValue());
|
||||
assertEquals("A\\", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
assertEquals(null, ourLastOrList.getListAsCodings().get(1).getSystemElement().getValue());
|
||||
assertEquals("B", ourLastOrList.getListAsCodings().get(1).getCodeElement().getValue());
|
||||
assertEquals(null, ourLastOrList.getListAsCodings().get(2).getSystemElement().getValue());
|
||||
assertEquals("$", ourLastOrList.getListAsCodings().get(2).getCodeElement().getValue());
|
||||
assertEquals(3, ourLastOrList.getListAsCodings().size());
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
|
|
|
@ -180,109 +180,122 @@
|
|||
<version>1.2-SNAPSHOT</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>generate</id>
|
||||
<goals>
|
||||
<goal>generate-structures</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<baseResourceNames>
|
||||
<baseResourceName>supplyrequest</baseResourceName>
|
||||
<baseResourceName>supplydelivery</baseResourceName>
|
||||
<baseResourceName>clinicalimpression</baseResourceName>
|
||||
<baseResourceName>familymemberhistory</baseResourceName>
|
||||
<baseResourceName>flag</baseResourceName>
|
||||
<baseResourceName>processresponse</baseResourceName>
|
||||
<baseResourceName>Condition</baseResourceName>
|
||||
<baseResourceName>DeviceComponent</baseResourceName>
|
||||
<baseResourceName>Communication</baseResourceName>
|
||||
<baseResourceName>Group</baseResourceName>
|
||||
<baseResourceName>ValueSet</baseResourceName>
|
||||
<baseResourceName>Coverage</baseResourceName>
|
||||
<baseResourceName>Appointment</baseResourceName>
|
||||
<baseResourceName>Slot</baseResourceName>
|
||||
<baseResourceName>Contraindication</baseResourceName>
|
||||
<baseResourceName>Composition</baseResourceName>
|
||||
<baseResourceName>EpisodeOfCare</baseResourceName>
|
||||
<baseResourceName>Conformance</baseResourceName>
|
||||
<baseResourceName>NamingSystem</baseResourceName>
|
||||
<baseResourceName>HealthcareService</baseResourceName>
|
||||
<baseResourceName>OrderResponse</baseResourceName>
|
||||
<baseResourceName>ConceptMap</baseResourceName>
|
||||
<baseResourceName>Practitioner</baseResourceName>
|
||||
<baseResourceName>CarePlan</baseResourceName>
|
||||
<baseResourceName>Substance</baseResourceName>
|
||||
<baseResourceName>DeviceUseRequest</baseResourceName>
|
||||
<baseResourceName>Schedule</baseResourceName>
|
||||
<baseResourceName>EligibilityRequest</baseResourceName>
|
||||
<baseResourceName>QuestionnaireResponse</baseResourceName>
|
||||
<baseResourceName>PaymentReconciliation</baseResourceName>
|
||||
<baseResourceName>ImagingObjectSelection</baseResourceName>
|
||||
<baseResourceName>OperationDefinition</baseResourceName>
|
||||
<baseResourceName>ClaimResponse</baseResourceName>
|
||||
<baseResourceName>BodySite</baseResourceName>
|
||||
<baseResourceName>CommunicationRequest</baseResourceName>
|
||||
<baseResourceName>RiskAssessment</baseResourceName>
|
||||
<baseResourceName>Observation</baseResourceName>
|
||||
<baseResourceName>AllergyIntolerance</baseResourceName>
|
||||
<baseResourceName>ExplanationOfBenefit</baseResourceName>
|
||||
<baseResourceName>RelatedPerson</baseResourceName>
|
||||
<baseResourceName>AuditEvent</baseResourceName>
|
||||
<baseResourceName>EligibilityResponse</baseResourceName>
|
||||
<baseResourceName>Person</baseResourceName>
|
||||
<baseResourceName>ProcedureRequest</baseResourceName>
|
||||
<baseResourceName>ProcessRequest</baseResourceName>
|
||||
<baseResourceName>Claim</baseResourceName>
|
||||
<baseResourceName>DeviceMetric</baseResourceName>
|
||||
<baseResourceName>Organization</baseResourceName>
|
||||
<baseResourceName>ImmunizationRecommendation</baseResourceName>
|
||||
<baseResourceName>MedicationDispense</baseResourceName>
|
||||
<baseResourceName>MedicationPrescription</baseResourceName>
|
||||
<baseResourceName>PaymentNotice</baseResourceName>
|
||||
<baseResourceName>MedicationStatement</baseResourceName>
|
||||
<baseResourceName>AppointmentResponse</baseResourceName>
|
||||
<baseResourceName>Questionnaire</baseResourceName>
|
||||
<baseResourceName>OperationOutcome</baseResourceName>
|
||||
<baseResourceName>Media</baseResourceName>
|
||||
<baseResourceName>Binary</baseResourceName>
|
||||
<baseResourceName>VisionPrescription</baseResourceName>
|
||||
<baseResourceName>DocumentReference</baseResourceName>
|
||||
<baseResourceName>Immunization</baseResourceName>
|
||||
<baseResourceName>Bundle</baseResourceName>
|
||||
<baseResourceName>Subscription</baseResourceName>
|
||||
<baseResourceName>ImagingStudy</baseResourceName>
|
||||
<baseResourceName>Provenance</baseResourceName>
|
||||
<baseResourceName>Device</baseResourceName>
|
||||
<baseResourceName>StructureDefinition</baseResourceName>
|
||||
<baseResourceName>Order</baseResourceName>
|
||||
<baseResourceName>Procedure</baseResourceName>
|
||||
<baseResourceName>DiagnosticReport</baseResourceName>
|
||||
<baseResourceName>Medication</baseResourceName>
|
||||
<baseResourceName>MessageHeader</baseResourceName>
|
||||
<baseResourceName>DataElement</baseResourceName>
|
||||
<baseResourceName>DocumentManifest</baseResourceName>
|
||||
<baseResourceName>MedicationAdministration</baseResourceName>
|
||||
<baseResourceName>Encounter</baseResourceName>
|
||||
<baseResourceName>List</baseResourceName>
|
||||
<baseResourceName>DeviceUseStatement</baseResourceName>
|
||||
<baseResourceName>Goal</baseResourceName>
|
||||
<baseResourceName>NutritionOrder</baseResourceName>
|
||||
<baseResourceName>SearchParameter</baseResourceName>
|
||||
<baseResourceName>ReferralRequest</baseResourceName>
|
||||
<baseResourceName>EnrollmentRequest</baseResourceName>
|
||||
<baseResourceName>Location</baseResourceName>
|
||||
<baseResourceName>Contract</baseResourceName>
|
||||
<baseResourceName>Basic</baseResourceName>
|
||||
<baseResourceName>Specimen</baseResourceName>
|
||||
<baseResourceName>EnrollmentResponse</baseResourceName>
|
||||
<baseResourceName>Patient</baseResourceName>
|
||||
<baseResourceName>DiagnosticOrder</baseResourceName>
|
||||
<baseResourceName>Parameters</baseResourceName>
|
||||
</baseResourceNames>
|
||||
<package>ca.uhn.fhir.model.dstu2</package>
|
||||
<version>dstu2</version>
|
||||
<buildDatatypes>true</buildDatatypes>
|
||||
</configuration>
|
||||
</execution>
|
||||
<!--
|
||||
<execution>
|
||||
<id>clean_source</id>
|
||||
<goals>
|
||||
<goal>minimize-resources</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<fhirVersion>DSTU2</fhirVersion>
|
||||
<targetDirectory>${project.baseDir}/../hapi-tinder-plugin/</targetDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
-->
|
||||
</executions>
|
||||
<configuration>
|
||||
<package>ca.uhn.fhir.model.dstu2</package>
|
||||
<version>dstu2</version>
|
||||
<baseResourceNames>
|
||||
<baseResourceName>clinicalimpression</baseResourceName>
|
||||
<baseResourceName>familymemberhistory</baseResourceName>
|
||||
<baseResourceName>flag</baseResourceName>
|
||||
<baseResourceName>processresponse</baseResourceName>
|
||||
<baseResourceName>Condition</baseResourceName>
|
||||
<baseResourceName>Supply</baseResourceName>
|
||||
<baseResourceName>DeviceComponent</baseResourceName>
|
||||
<baseResourceName>Communication</baseResourceName>
|
||||
<baseResourceName>Group</baseResourceName>
|
||||
<baseResourceName>ValueSet</baseResourceName>
|
||||
<baseResourceName>Coverage</baseResourceName>
|
||||
<baseResourceName>Appointment</baseResourceName>
|
||||
<baseResourceName>Slot</baseResourceName>
|
||||
<baseResourceName>Contraindication</baseResourceName>
|
||||
<baseResourceName>Composition</baseResourceName>
|
||||
<baseResourceName>EpisodeOfCare</baseResourceName>
|
||||
<baseResourceName>Conformance</baseResourceName>
|
||||
<baseResourceName>NamingSystem</baseResourceName>
|
||||
<baseResourceName>HealthcareService</baseResourceName>
|
||||
<baseResourceName>OrderResponse</baseResourceName>
|
||||
<baseResourceName>ConceptMap</baseResourceName>
|
||||
<baseResourceName>Practitioner</baseResourceName>
|
||||
<baseResourceName>CarePlan</baseResourceName>
|
||||
<baseResourceName>Substance</baseResourceName>
|
||||
<baseResourceName>DeviceUseRequest</baseResourceName>
|
||||
<baseResourceName>Schedule</baseResourceName>
|
||||
<baseResourceName>EligibilityRequest</baseResourceName>
|
||||
<baseResourceName>QuestionnaireAnswers</baseResourceName>
|
||||
<baseResourceName>PaymentReconciliation</baseResourceName>
|
||||
<baseResourceName>ImagingObjectSelection</baseResourceName>
|
||||
<baseResourceName>OperationDefinition</baseResourceName>
|
||||
<baseResourceName>ClaimResponse</baseResourceName>
|
||||
<baseResourceName>BodySite</baseResourceName>
|
||||
<baseResourceName>CommunicationRequest</baseResourceName>
|
||||
<baseResourceName>RiskAssessment</baseResourceName>
|
||||
<baseResourceName>Observation</baseResourceName>
|
||||
<baseResourceName>AllergyIntolerance</baseResourceName>
|
||||
<baseResourceName>ExplanationOfBenefit</baseResourceName>
|
||||
<baseResourceName>RelatedPerson</baseResourceName>
|
||||
<baseResourceName>AuditEvent</baseResourceName>
|
||||
<baseResourceName>EligibilityResponse</baseResourceName>
|
||||
<baseResourceName>Person</baseResourceName>
|
||||
<baseResourceName>ProcedureRequest</baseResourceName>
|
||||
<baseResourceName>ProcessRequest</baseResourceName>
|
||||
<baseResourceName>Claim</baseResourceName>
|
||||
<baseResourceName>DeviceMetric</baseResourceName>
|
||||
<baseResourceName>Organization</baseResourceName>
|
||||
<baseResourceName>ImmunizationRecommendation</baseResourceName>
|
||||
<baseResourceName>MedicationDispense</baseResourceName>
|
||||
<baseResourceName>MedicationPrescription</baseResourceName>
|
||||
<baseResourceName>PaymentNotice</baseResourceName>
|
||||
<baseResourceName>MedicationStatement</baseResourceName>
|
||||
<baseResourceName>AppointmentResponse</baseResourceName>
|
||||
<baseResourceName>Questionnaire</baseResourceName>
|
||||
<baseResourceName>OperationOutcome</baseResourceName>
|
||||
<baseResourceName>Media</baseResourceName>
|
||||
<baseResourceName>Binary</baseResourceName>
|
||||
<baseResourceName>VisionPrescription</baseResourceName>
|
||||
<baseResourceName>DocumentReference</baseResourceName>
|
||||
<baseResourceName>Immunization</baseResourceName>
|
||||
<baseResourceName>Bundle</baseResourceName>
|
||||
<baseResourceName>Subscription</baseResourceName>
|
||||
<baseResourceName>ImagingStudy</baseResourceName>
|
||||
<baseResourceName>Provenance</baseResourceName>
|
||||
<baseResourceName>Device</baseResourceName>
|
||||
<baseResourceName>StructureDefinition</baseResourceName>
|
||||
<baseResourceName>Order</baseResourceName>
|
||||
<baseResourceName>Procedure</baseResourceName>
|
||||
<baseResourceName>DiagnosticReport</baseResourceName>
|
||||
<baseResourceName>Medication</baseResourceName>
|
||||
<baseResourceName>MessageHeader</baseResourceName>
|
||||
<baseResourceName>DataElement</baseResourceName>
|
||||
<baseResourceName>DocumentManifest</baseResourceName>
|
||||
<baseResourceName>MedicationAdministration</baseResourceName>
|
||||
<baseResourceName>Encounter</baseResourceName>
|
||||
<baseResourceName>List</baseResourceName>
|
||||
<baseResourceName>DeviceUseStatement</baseResourceName>
|
||||
<baseResourceName>Goal</baseResourceName>
|
||||
<baseResourceName>NutritionOrder</baseResourceName>
|
||||
<baseResourceName>SearchParameter</baseResourceName>
|
||||
<baseResourceName>ReferralRequest</baseResourceName>
|
||||
<baseResourceName>EnrollmentRequest</baseResourceName>
|
||||
<baseResourceName>Location</baseResourceName>
|
||||
<baseResourceName>Contract</baseResourceName>
|
||||
<baseResourceName>Basic</baseResourceName>
|
||||
<baseResourceName>Specimen</baseResourceName>
|
||||
<baseResourceName>EnrollmentResponse</baseResourceName>
|
||||
<baseResourceName>Patient</baseResourceName>
|
||||
<baseResourceName>CarePlan2</baseResourceName>
|
||||
<baseResourceName>DiagnosticOrder</baseResourceName>
|
||||
<baseResourceName>Parameters</baseResourceName>
|
||||
</baseResourceNames>
|
||||
<buildDatatypes>true</buildDatatypes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
|
|
|
@ -162,10 +162,11 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
retVal.setPublisher(myPublisher);
|
||||
retVal.setDate(DateTimeDt.withCurrentTime());
|
||||
retVal.setFhirVersion("0.5.0"); // TODO: pull from model
|
||||
retVal.setAcceptUnknown(false); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||
retVal.setAcceptUnknown("extensions"); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||
// needs to be modified to actually allow it
|
||||
|
||||
retVal.getImplementation().setDescription(myRestfulServer.getImplementationDescription());
|
||||
retVal.setKind("instance");
|
||||
retVal.getSoftware().setName(myRestfulServer.getServerName());
|
||||
retVal.getSoftware().setVersion(myRestfulServer.getServerVersion());
|
||||
retVal.addFormat(Constants.CT_FHIR_XML);
|
||||
|
|
|
@ -57,9 +57,15 @@
|
|||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Composition/f:section">
|
||||
<sch:assert test="(exists(f:content) and not(exists(f:section))) or (exists(f:section) and not(exists(f:content)))">cmp-1: A section must have either subsections or content</sch:assert>
|
||||
<sch:assert test="exists(f:text) or exists(f:entry) or exists(f:section)">cmp-1: A section must at least one of text, entries, or sub-sections</sch:assert>
|
||||
<sch:assert test="not(exists(f:emptyReason) and exists(f:entry))">cmp-2: A section can only have an emptyReason if it is empty</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Composition/f:section/f:content">
|
||||
<sch:rule context="f:Composition/f:section/f:text/f:div">
|
||||
<sch:assert test="not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])">txt-3: The narrative SHALL contain only the basic html formatting attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes</sch:assert>
|
||||
<sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes</sch:assert>
|
||||
<sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Composition/f:section/f:entry">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
|
|
|
@ -88,20 +88,5 @@
|
|||
<sch:rule context="f:Condition/f:evidence/f:detail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Condition/f:location/f:siteReference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Condition/f:dueTo">
|
||||
<sch:assert test="exists(f:code) != exists(f:target)">con-4: Relationship SHALL have either a code or a target</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Condition/f:dueTo/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Condition/f:occurredFollowing">
|
||||
<sch:assert test="exists(f:code) != exists(f:target)">con-5: Relationship SHALL have either a code or a target</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Condition/f:occurredFollowing/f:target">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
||||
|
|
|
@ -32,10 +32,10 @@
|
|||
<sch:rule context="f:Conformance">
|
||||
<sch:assert test="count(f:rest)=count(distinct-values(f:rest/f:mode/@value))">cnf-8: There can only be one REST declaration per mode</sch:assert>
|
||||
<sch:assert test="count(f:document[f:mode='producer'])=count(distinct-values(f:document[f:mode='producer']/f:profile/@value)) and count(f:document[f:mode='consumer'])=count(distinct-values(f:document[f:mode='consumer']/f:profile/@value))">cnf-7: The set of documents must be unique by the combination of profile & mode</sch:assert>
|
||||
<sch:assert test="count(f:messaging)<=1 or not(f:messaging[not(f:endpoint)])">cnf-4: If there is more than one messaging element, endpoint must be specified for each one</sch:assert>
|
||||
<sch:assert test="count(f:messaging/f:endpoint)=count(distinct-values(f:messaging/f:endpoint/@value))">cnf-5: The set of end points listed for messaging must be unique</sch:assert>
|
||||
<sch:assert test="count(f:software | f:implementation | f:description) > 0">cnf-2: A Conformance statement SHALL have at least one of description, software, or implementation</sch:assert>
|
||||
<sch:assert test="exists(f:rest) or exists(f:messaging) or exists(f:document)">cnf-1: A Conformance statement SHALL have at least one of rest, messaging or document</sch:assert>
|
||||
<sch:assert test="not(exists(f:software) or exists(f:implementation)) or (f:kind/@value != 'requirements')">cnf-14: Conformance statements of kind 'requirements' do not have software or implementation elements</sch:assert>
|
||||
<sch:assert test="not(exists(f:implementation)) or (f:kind/@value != 'capability')">cnf-15: Conformance statements of kind 'software' do not have implementation elements</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Conformance/f:contact/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">cpt-2: A system is required if a value is provided.</sch:assert>
|
||||
|
@ -57,12 +57,14 @@
|
|||
<sch:rule context="f:Conformance/f:rest/f:resource/f:profile">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Conformance/f:rest/f:resource/f:searchParam">
|
||||
<sch:assert test="not(exists(f:chain)) or (f:type/@value = 'reference')">cnf-13: Search parameters can only have chain names when the search parameter type is 'reference'</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Conformance/f:rest/f:operation/f:definition">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Conformance/f:messaging">
|
||||
<sch:assert test="count(f:event[f:mode='sender'])=count(distinct-values(f:event[f:mode='sender']/f:code/@value)) and count(f:event[f:mode='receiver'])=count(distinct-values(f:event[f:mode='receiver']/f:code/@value))">cnf-6: The set of events per messaging endpoint must be unique by the combination of code & mode</sch:assert>
|
||||
<sch:assert test="exists(f:endpoint) = exists(parent::f:Conformance/f:implementation)">cnf-3: Messaging end point is required (and is only permitted) when statement is for an implementation</sch:assert>
|
||||
<sch:assert test="exists(f:endpoint) = (f:kind/@value = 'implementation')">cnf-3: Messaging end point is required (and is only permitted) when statement is for an implementation</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Conformance/f:messaging/f:event/f:request">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
</sch:rule>
|
||||
<sch:rule context="f:DataElement/f:element">
|
||||
<sch:assert test="not(exists(f:base))">dae-1: No base allowed</sch:assert>
|
||||
<sch:assert test="not(exists(f:slicing))">dae-2: No slicing allowed</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DataElement/f:element">
|
||||
<sch:assert test="(not(f:max/@value) and not(f:min/@value)) or (f:max/@value = '*') or (f:max/@value >= f:min/@value)">eld-2: Min <= Max</sch:assert>
|
||||
|
|
|
@ -56,7 +56,7 @@
|
|||
<sch:rule context="f:DiagnosticOrder/f:item/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticOrder/f:item/f:bodySiteReference">
|
||||
<sch:rule context="f:DiagnosticOrder/f:note/f:authorReference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
|
|
|
@ -29,27 +29,27 @@
|
|||
<sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes</sch:assert>
|
||||
<sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:requestDetail">
|
||||
<sch:rule context="f:DiagnosticReport/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:effectivePeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:requestDetail">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:DiagnosticReport/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -41,6 +41,9 @@
|
|||
<sch:rule context="f:Flag/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Flag/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Flag/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
|
|
|
@ -31,7 +31,6 @@
|
|||
</sch:rule>
|
||||
<sch:rule context="f:Group">
|
||||
<sch:assert test="f:actual/@value='true' or not(exists(f:member))">grp-1: Can only have members if group is "actual"</sch:assert>
|
||||
<sch:assert test="not(f:quantity) or not(f:member) or not(f:quantity>count(f:member))">grp-4: Can't have more members associated with the group than the value specified for "quantity"</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Group/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
|
@ -52,11 +51,14 @@
|
|||
<sch:rule context="f:Group/f:characteristic/f:valueRange/f:high">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Group/f:member">
|
||||
<sch:assert test="lower-case(f:type/@value)=parent::f:Group/f:type/@value or (f:type/@value='Patient' and parent::f:Group/f:type/@value=('animal','person'))">grp-3: Member resource types SHALL agree with group type</sch:assert>
|
||||
<sch:rule context="f:Group/f:characteristic/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Group/f:member">
|
||||
<sch:rule context="f:Group/f:member/f:entity">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Group/f:member/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
||||
|
|
|
@ -35,5 +35,8 @@
|
|||
<sch:rule context="f:ImagingObjectSelection/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:ImagingObjectSelection/f:study/f:imagingStudy">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
</sch:schema>
|
||||
|
|
|
@ -35,13 +35,13 @@
|
|||
<sch:rule context="f:ImplementationGuide/f:contact/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:ImplementationGuide/f:package/f:item/f:content">
|
||||
<sch:rule context="f:ImplementationGuide/f:package/f:resource/f:sourceReference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:ImplementationGuide/f:package/f:item/f:example/f:target">
|
||||
<sch:rule context="f:ImplementationGuide/f:package/f:resource/f:exampleFor">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:ImplementationGuide/f:default/f:profile">
|
||||
<sch:rule context="f:ImplementationGuide/f:global/f:profile">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
||||
|
|
|
@ -34,15 +34,15 @@
|
|||
<sch:assert test="not(f:replacedBy) or f:status/@value='retired'">nsd-3: Can only have replacedBy if namingsystem is retired</sch:assert>
|
||||
<sch:assert test="not(exists(for $type in distinct-values(f:uniqueId/f:type) return if (count(f:uniqueId[f:type/@value=$type and f:primary/@value='true'])>1) then $type else ()))">nsd-2: Can't have more than one preferred identifier for a type</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:NamingSystem/f:uniqueId/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:NamingSystem/f:contact/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">cpt-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:NamingSystem/f:contact/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:NamingSystem/f:uniqueId/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:NamingSystem/f:replacedBy">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
|
|
|
@ -33,6 +33,24 @@
|
|||
<sch:assert test="f:code/@value != f:component.code/@value">obs-7: Component code Shall not be same as observation code</sch:assert>
|
||||
<sch:assert test="not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))">obs-6: Shall only be present if Observation.value[x] is not present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:effectivePeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:valueQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
|
@ -64,33 +82,12 @@
|
|||
<sch:rule context="f:Observation/f:valuePeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:effectivePeriod">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:bodySiteReference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:specimen">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:performer">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:device">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Observation/f:referenceRange">
|
||||
<sch:assert test="(exists(f:low) or exists(f:high)or exists(f:text))">obs-3: Must have at least a low or a high or text</sch:assert>
|
||||
</sch:rule>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<sch:ns prefix="f" uri="http://hl7.org/fhir"/>
|
||||
<sch:ns prefix="h" uri="http://www.w3.org/1999/xhtml"/>
|
||||
<!--
|
||||
This file contains just the constraints for the resource QuestionnaireAnswers
|
||||
This file contains just the constraints for the resource QuestionnaireResponse
|
||||
It is provided for documentation purposes. When actually validating,
|
||||
always use fhir-invariants.sch (because of the way containment works)
|
||||
Alternatively you can use this file to build a smaller version of
|
||||
|
@ -17,52 +17,52 @@
|
|||
</sch:rule>
|
||||
</sch:pattern>
|
||||
<sch:pattern>
|
||||
<sch:title>QuestionnaireAnswers</sch:title>
|
||||
<sch:rule context="f:QuestionnaireAnswers">
|
||||
<sch:title>QuestionnaireResponse</sch:title>
|
||||
<sch:rule context="f:QuestionnaireResponse">
|
||||
<sch:assert test="not(parent::f:contained and f:contained)">dom-2: If the resource is contained in another resource, it SHALL NOT contain nested Resources</sch:assert>
|
||||
<sch:assert test="not(parent::f:contained and f:text)">dom-1: If the resource is contained in another resource, it SHALL NOT contain any narrative</sch:assert>
|
||||
<sch:assert test="not(exists(f:contained/f:meta/f:versionId)) and not(exists(f:contained/f:meta/f:lastUpdated))">dom-4: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated</sch:assert>
|
||||
<sch:assert test="not(exists(for $id in f:contained/*/@id return $id[not(ancestor::f:contained/parent::*/descendant::f:reference/@value=concat('#', $id))]))">dom-3: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:text/f:div">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:text/f:div">
|
||||
<sch:assert test="not(descendant-or-self::*/@*[not(name(.)=('abbr', 'accesskey', 'align', 'alt', 'axis', 'bgcolor', 'border', 'cellhalign', 'cellpadding', 'cellspacing', 'cellvalign', 'char', 'charoff', 'charset', 'cite', 'class', 'colspan', 'compact', 'coords', 'dir', 'frame', 'headers', 'height', 'href', 'hreflang', 'hspace', 'id', 'lang', 'longdesc', 'name', 'nowrap', 'rel', 'rev', 'rowspan', 'rules', 'scope', 'shape', 'span', 'src', 'start', 'style', 'summary', 'tabindex', 'title', 'type', 'valign', 'value', 'vspace', 'width'))])">txt-3: The narrative SHALL contain only the basic html formatting attributes described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes</sch:assert>
|
||||
<sch:assert test="not(descendant-or-self::*[not(local-name(.)=('a', 'abbr', 'acronym', 'b', 'big', 'blockquote', 'br', 'caption', 'cite', 'code', 'colgroup', 'dd', 'dfn', 'div', 'dl', 'dt', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'li', 'ol', 'p', 'pre', 'q', 'samp', 'small', 'span', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'tt', 'ul', 'var'))])">txt-1: The narrative SHALL contain only the basic html formatting elements described in chapters 7-11 (except section 4 of chapter 9) and 15 of the HTML 4.0 standard, <a> elements (either name or href), images and internally contained style attributes</sch:assert>
|
||||
<sch:assert test="descendant::text()[normalize-space(.)!=''] or descendant::h:img[@src]">txt-2: The narrative SHALL have some non-whitespace content</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:identifier/f:period">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:identifier/f:assigner">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:identifier/f:assigner">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:questionnaire">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:questionnaire">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:subject">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:author">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:author">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:source">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:source">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:encounter">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:encounter">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:group">
|
||||
<sch:assert test="not(exists(f:group) and exists(f:question))">qan-1: Groups may either contain questions or groups but not both</sch:assert>
|
||||
<sch:rule context="f:QuestionnaireResponse/f:group">
|
||||
<sch:assert test="not(exists(f:group) and exists(f:question))">qrs-1: Groups may either contain questions or groups but not both</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:group/f:subject">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:group/f:subject">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:group/f:question/f:answer/f:valueAttachment">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:group/f:question/f:answer/f:valueAttachment">
|
||||
<sch:assert test="not(exists(f:data)) or exists(f:contentType)">att-1: It the Attachment has data, it SHALL have a contentType</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:group/f:question/f:answer/f:valueQuantity">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:group/f:question/f:answer/f:valueQuantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:QuestionnaireAnswers/f:group/f:question/f:answer/f:valueReference">
|
||||
<sch:rule context="f:QuestionnaireResponse/f:group/f:question/f:answer/f:valueReference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
</sch:pattern>
|
|
@ -56,9 +56,6 @@
|
|||
<sch:rule context="f:Specimen/f:collection/f:quantity">
|
||||
<sch:assert test="not(exists(f:code)) or exists(f:system)">qty-3: If a code for the units is present, the system SHALL also be present</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Specimen/f:collection/f:bodySiteReference">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:Specimen/f:treatment/f:additive">
|
||||
<sch:assert test="not(starts-with(f:reference/@value, '#')) or exists(ancestor::*[self::f:entry or self::f:parameter]/f:resource/f:*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')]|/*/f:contained/f:*[f:id/@value=substring-after(current()/f:reference/@value, '#')])">ref-1: SHALL have a local reference if the resource is provided inline</sch:assert>
|
||||
</sch:rule>
|
||||
|
|
|
@ -33,6 +33,12 @@
|
|||
<sch:assert test="not(f:assert)">inv-16: Assertions SHALL be present in TestScript.setup.action and TestScript.test.action only.</sch:assert>
|
||||
<sch:assert test="not(f:operation)">inv-15: Operations SHALL be present in TestScript.setup.action, TestScript.test.action and TestScript.teardown.action only.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:TestScript/f:contact/f:telecom">
|
||||
<sch:assert test="not(exists(f:value)) or exists(f:system)">cpt-2: A system is required if a value is provided.</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:TestScript/f:contact/f:telecom/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:TestScript/f:metadata">
|
||||
<sch:assert test="f:capabilities/f:required or f:capabilities/f:validated or (f:capabilities/f:required and f:capabilities/f:validated)">inv-5: TestScript metadata capabilities SHALL contain required or validated or both.</sch:assert>
|
||||
</sch:rule>
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<sch:rule context="f:ValueSet">
|
||||
<sch:assert test="not(f:define/f:system/@value = f:identifier/@value)">vsd-7: A defined code system (if present) SHALL have a different identifier to the value set itself</sch:assert>
|
||||
<sch:assert test="not(exists(f:compose)) or (count(f:compose/f:import)!=1 or exists(f:compose/f:include) or exists(f:compose/f:exclude) or exists(f:define))">vsd-2: A value set with only one import SHALL also have an include and/or an exclude unless the value set defines its own codes</sch:assert>
|
||||
<sch:assert test="exists(f:define) or exists(f:compose) or exists(f:expansion)">vsd-5: Value set SHALL contain either a define, a compose, or an expansion element</sch:assert>
|
||||
<sch:assert test="exists(f:define) or exists(f:compose) or exists(f:expansion)">vsd-5: Value set SHALL contain at least one of a define, a compose, or an expansion element</sch:assert>
|
||||
</sch:rule>
|
||||
<sch:rule context="f:ValueSet/f:identifier/f:period">
|
||||
<sch:assert test="not(exists(f:start)) or not(exists(f:end)) or (f:start/@value <= f:end/@value)">per-1: If present, start SHALL have a lower value than end</sch:assert>
|
||||
|
|
|
@ -14,10 +14,6 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONSerializer;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Assert;
|
||||
|
@ -43,17 +39,19 @@ import ca.uhn.fhir.model.dstu2.resource.Medication;
|
|||
import ca.uhn.fhir.model.dstu2.resource.MedicationPrescription;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireAnswers;
|
||||
import ca.uhn.fhir.model.dstu2.resource.QuestionnaireResponse;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.AdministrativeGenderEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ObservationReliabilityEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ObservationStatusEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONSerializer;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
||||
public class JsonParserDstu2Test {
|
||||
private static final FhirContext ourCtx = FhirContext.forDstu2();
|
||||
|
@ -200,24 +198,6 @@ public class JsonParserDstu2Test {
|
|||
assertEquals(new Tag("scheme2", "term2", "label2"), tagList.get(1));
|
||||
}
|
||||
|
||||
/**
|
||||
* #158
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeEmptyTag2() {
|
||||
TagList tagList = new TagList();
|
||||
tagList.addTag("scheme", "code", null);
|
||||
tagList.addTag(null, null, "Label");
|
||||
|
||||
Patient p = new Patient();
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put(p, tagList);
|
||||
|
||||
String encoded = ourCtx.newJsonParser().encodeResourceToString(p);
|
||||
assertThat(encoded, containsString("tag"));
|
||||
assertThat(encoded, containsString("scheme"));
|
||||
assertThat(encoded, not(containsString("Label")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodeAndParseSecurityLabels() {
|
||||
Patient p = new Patient();
|
||||
|
@ -279,7 +259,6 @@ public class JsonParserDstu2Test {
|
|||
assertEquals("VERSION2", label.getVersion());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBundleNewBundleNoText() {
|
||||
|
||||
|
@ -301,7 +280,6 @@ public class JsonParserDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testEncodeBundleOldBundleNoText() {
|
||||
|
||||
|
@ -321,6 +299,7 @@ public class JsonParserDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fixing #89
|
||||
*/
|
||||
|
@ -340,6 +319,7 @@ public class JsonParserDstu2Test {
|
|||
//@formatter:on
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* #158
|
||||
*/
|
||||
|
@ -356,6 +336,43 @@ public class JsonParserDstu2Test {
|
|||
assertThat(encoded, not(containsString("tag")));
|
||||
}
|
||||
|
||||
/**
|
||||
* #158
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeEmptyTag2() {
|
||||
TagList tagList = new TagList();
|
||||
tagList.addTag("scheme", "code", null);
|
||||
tagList.addTag(null, null, "Label");
|
||||
|
||||
Patient p = new Patient();
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put(p, tagList);
|
||||
|
||||
String encoded = ourCtx.newJsonParser().encodeResourceToString(p);
|
||||
assertThat(encoded, containsString("tag"));
|
||||
assertThat(encoded, containsString("scheme"));
|
||||
assertThat(encoded, not(containsString("Label")));
|
||||
}
|
||||
|
||||
/**
|
||||
* See #205
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeTags() {
|
||||
Patient pt = new Patient();
|
||||
pt.addIdentifier().setSystem("sys").setValue("val");
|
||||
|
||||
TagList tagList = new TagList();
|
||||
tagList.addTag("scheme", "term", "display");
|
||||
ResourceMetadataKeyEnum.TAG_LIST.put(pt, tagList);
|
||||
|
||||
String enc = ourCtx.newJsonParser().encodeResourceToString(pt);
|
||||
ourLog.info(enc);
|
||||
|
||||
assertEquals("{\"resourceType\":\"Patient\",\"meta\":{\"tag\":[{\"system\":\"scheme\",\"code\":\"term\",\"display\":\"display\"}]},\"identifier\":[{\"system\":\"sys\",\"value\":\"val\"}]}", enc);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodingNullExtension() {
|
||||
Patient p = new Patient();
|
||||
|
@ -383,7 +400,7 @@ public class JsonParserDstu2Test {
|
|||
@Test
|
||||
public void testJsonPrimitiveWithExtensionEncoding() {
|
||||
|
||||
QuestionnaireAnswers parsed = new QuestionnaireAnswers();
|
||||
QuestionnaireResponse parsed = new QuestionnaireResponse();
|
||||
parsed.getGroup().setLinkId("value123");
|
||||
parsed.getGroup().getLinkIdElement().addUndeclaredExtension(false, "http://123", new StringDt("HELLO"));
|
||||
|
||||
|
@ -830,7 +847,6 @@ public class JsonParserDstu2Test {
|
|||
obsv.getCode().addCoding().setCode("name");
|
||||
obsv.setValue(new StringDt("value test"));
|
||||
obsv.setStatus(ObservationStatusEnum.FINAL);
|
||||
obsv.setReliability(ObservationReliabilityEnum.OK);
|
||||
obsv.addIdentifier().setSystem("System").setValue("id value");
|
||||
|
||||
DiagnosticReport report = new DiagnosticReport();
|
||||
|
@ -853,7 +869,6 @@ public class JsonParserDstu2Test {
|
|||
obsv.getCode().addCoding().setCode("name");
|
||||
obsv.setValue(new StringDt("value test"));
|
||||
obsv.setStatus(ObservationStatusEnum.FINAL);
|
||||
obsv.setReliability(ObservationReliabilityEnum.OK);
|
||||
obsv.addIdentifier().setSystem("System").setValue("id value");
|
||||
|
||||
DiagnosticReport report = new DiagnosticReport();
|
||||
|
|
|
@ -1,7 +1,16 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.emptyOrNullString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
|
@ -122,14 +131,14 @@ public class XmlParserDstu2Test {
|
|||
public void testDuration() {
|
||||
Encounter enc = new Encounter();
|
||||
DurationDt duration = new DurationDt();
|
||||
duration.setUnits("day").setValue(123L);
|
||||
duration.setUnit("day").setValue(123L);
|
||||
enc.setLength(duration);
|
||||
|
||||
String str = ourCtx.newXmlParser().encodeResourceToString(enc);
|
||||
ourLog.info(str);
|
||||
|
||||
assertThat(str, not(containsString("meta")));
|
||||
assertThat(str, containsString("<length><value value=\"123\"/><units value=\"day\"/></length>"));
|
||||
assertThat(str, containsString("<length><value value=\"123\"/><unit value=\"day\"/></length>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -494,9 +503,9 @@ public class XmlParserDstu2Test {
|
|||
@Test
|
||||
public void testEncodeAndReEncodeContainedJson() {
|
||||
Composition comp = new Composition();
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().setComment("Section0_Allergy0"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().setComment("Section1_Allergy0"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().setComment("Section2_Allergy0"));
|
||||
comp.addSection().addEntry().setResource(new AllergyIntolerance().setComment("Section0_Allergy0"));
|
||||
comp.addSection().addEntry().setResource(new AllergyIntolerance().setComment("Section1_Allergy0"));
|
||||
comp.addSection().addEntry().setResource(new AllergyIntolerance().setComment("Section2_Allergy0"));
|
||||
|
||||
IParser parser = ourCtx.newJsonParser().setPrettyPrint(true);
|
||||
|
||||
|
@ -519,9 +528,9 @@ public class XmlParserDstu2Test {
|
|||
@Test
|
||||
public void testEncodeAndReEncodeContainedXml() {
|
||||
Composition comp = new Composition();
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().setComment("Section0_Allergy0"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().setComment("Section1_Allergy0"));
|
||||
comp.addSection().getContent().setResource(new AllergyIntolerance().setComment("Section2_Allergy0"));
|
||||
comp.addSection().addEntry().setResource(new AllergyIntolerance().setComment("Section0_Allergy0"));
|
||||
comp.addSection().addEntry().setResource(new AllergyIntolerance().setComment("Section1_Allergy0"));
|
||||
comp.addSection().addEntry().setResource(new AllergyIntolerance().setComment("Section2_Allergy0"));
|
||||
|
||||
IParser parser = ourCtx.newXmlParser().setPrettyPrint(true);
|
||||
|
||||
|
@ -985,8 +994,8 @@ public class XmlParserDstu2Test {
|
|||
"<id value=\"2179414\"/>"+
|
||||
"<url value=\"2179414\"/>"+
|
||||
"<version value=\"1.0\"/>"+
|
||||
"<description value=\"All codes representing the gender of a person.\"/>"+
|
||||
"<status value=\"active\"/>"+
|
||||
"<description value=\"All codes representing the gender of a person.\"/>"+
|
||||
"<compose>"+
|
||||
"<include>"+
|
||||
"<system value=\"http://ncit.nci.nih.gov\"/>"+
|
||||
|
@ -1077,6 +1086,8 @@ public class XmlParserDstu2Test {
|
|||
"</identifier>"+
|
||||
"<version value=\"1.0\"/>"+
|
||||
"<name value=\"Gender Code\"/>"+
|
||||
"<status value=\"active\"/>"+
|
||||
"<publisher value=\"DCP\"/>"+
|
||||
"<useContext>"+
|
||||
"<coding>"+
|
||||
"<system value=\"http://example.org/FBPP\"/>"+
|
||||
|
@ -1143,8 +1154,6 @@ public class XmlParserDstu2Test {
|
|||
"<display value=\"Sulindac for Breast\"/>"+
|
||||
"</coding>"+
|
||||
"</useContext>"+
|
||||
"<status value=\"active\"/>"+
|
||||
"<publisher value=\"DCP\"/>"+
|
||||
"<element>"+
|
||||
"<extension url=\"http://hl7.org/fhir/StructureDefinition/minLength\">"+
|
||||
"<valueInteger value=\"1\"/>"+
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package ca.uhn.fhir.rest.client;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.junit.Test;
|
||||
import org.mockito.internal.stubbing.defaultanswers.ReturnsDeepStubs;
|
||||
import org.mockito.internal.stubbing.defaultanswers.ReturnsSmartNulls;
|
||||
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Condition;
|
||||
import ca.uhn.fhir.rest.gclient.ICriterion;
|
||||
import ca.uhn.fhir.rest.gclient.IQuery;
|
||||
|
||||
public class ClientMockingTest {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testMockingDeepStubs() {
|
||||
|
||||
IGenericClient client = mock(IGenericClient.class, new ReturnsDeepStubs());
|
||||
|
||||
// System.out.println(stub.getClass());
|
||||
// System.out.println(stub.getClass());
|
||||
|
||||
Bundle retVal = new Bundle();
|
||||
|
||||
//@formatter:off
|
||||
when((Object)client
|
||||
.search()
|
||||
.forResource(eq(Condition.class))
|
||||
.where(any(ICriterion.class))
|
||||
.returnBundle((Class<IBaseBundle>)any())
|
||||
.execute())
|
||||
.thenReturn(retVal);
|
||||
//@formatter:off
|
||||
|
||||
Bundle actual = client.search().forResource(Condition.class).where(Condition.ASSERTER.hasId("123")).returnBundle(Bundle.class).execute();
|
||||
assertSame(retVal, actual);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -51,6 +51,7 @@ import ca.uhn.fhir.rest.method.SearchParameter;
|
|||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
|
||||
public class ServerConformanceProviderDstu2Test {
|
||||
|
||||
|
@ -437,7 +438,8 @@ public class ServerConformanceProviderDstu2Test {
|
|||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
assertTrue(ourCtx.newValidator().validateWithResult(conformance).isSuccessful());
|
||||
ValidationResult result = ourCtx.newValidator().validateWithResult(conformance);
|
||||
assertTrue(result.getMessages().toString(), result.isSuccessful());
|
||||
}
|
||||
|
||||
public static class ConditionalProvider implements IResourceProvider {
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ResponseHighlightingInterceptorTest {
|
|||
reqDetails.setServletRequest(req);
|
||||
|
||||
ResourceNotFoundException exception = new ResourceNotFoundException("Not found");
|
||||
exception.setOperationOutcome(new OperationOutcome().addIssue(new Issue().setDetails("Hello")));
|
||||
exception.setOperationOutcome(new OperationOutcome().addIssue(new Issue().setDiagnostics("Hello")));
|
||||
|
||||
assertFalse(ic.handleException(reqDetails, exception, req, resp));
|
||||
|
||||
|
|
|
@ -10,11 +10,9 @@ import static org.junit.Assert.fail;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hamcrest.core.StringContains;
|
||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
|
@ -27,7 +25,6 @@ import ca.uhn.fhir.model.dstu2.resource.Patient;
|
|||
import ca.uhn.fhir.model.dstu2.valueset.ContactPointSystemEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.UnitsOfTimeEnum;
|
||||
import ca.uhn.fhir.model.primitive.DateDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
|
||||
public class ResourceValidatorDstu2Test {
|
||||
|
||||
|
@ -182,7 +179,7 @@ public class ResourceValidatorDstu2Test {
|
|||
OperationOutcome operationOutcome = (OperationOutcome) validationResult.getOperationOutcome();
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(operationOutcome));
|
||||
assertEquals(1, operationOutcome.getIssue().size());
|
||||
assertThat(operationOutcome.getIssueFirstRep().getDetails(), containsString("cpt-2:"));
|
||||
assertThat(operationOutcome.getIssueFirstRep().getDiagnostics(), containsString("cpt-2:"));
|
||||
|
||||
p.getTelecomFirstRep().setSystem(ContactPointSystemEnum.EMAIL);
|
||||
validationResult = val.validateWithResult(p);
|
||||
|
|
|
@ -1,35 +1,39 @@
|
|||
package ca.uhn.fhir.validation;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.OperationOutcome.IssueSeverity;
|
||||
import org.hl7.fhir.instance.model.Questionnaire;
|
||||
import org.hl7.fhir.instance.model.QuestionnaireAnswers;
|
||||
import org.hl7.fhir.instance.model.QuestionnaireResponse;
|
||||
import org.hl7.fhir.instance.model.ValueSet;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.valuesets.IssueType;
|
||||
import org.hl7.fhir.instance.utils.WorkerContext;
|
||||
import org.hl7.fhir.instance.validation.QuestionnaireAnswersValidator;
|
||||
import org.hl7.fhir.instance.validation.QuestionnaireResponseValidator;
|
||||
import org.hl7.fhir.instance.validation.ValidationMessage;
|
||||
import org.hl7.fhir.instance.validation.ValidationMessage.Source;
|
||||
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.util.ResourceReferenceInfo;
|
||||
|
||||
public class FhirQuestionnaireAnswersValidator extends BaseValidatorBridge {
|
||||
public class FhirQuestionnaireResponseValidator extends BaseValidatorBridge {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirQuestionnaireAnswersValidator.class);
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirQuestionnaireResponseValidator.class);
|
||||
private IResourceLoader myResourceLoader;
|
||||
|
||||
/**
|
||||
* Set the class which will be used to load linked resources from the <code>QuestionnaireAnswers</code>. Specifically, if the <code>QuestionnaireAnswers</code> refers to an external (non-contained)
|
||||
* Set the class which will be used to load linked resources from the <code>QuestionnaireResponse</code>. Specifically, if the <code>QuestionnaireResponse</code> refers to an external (non-contained)
|
||||
* <code>Questionnaire</code>, or to any external (non-contained) <code>ValueSet</code>, the resource loader will be used to fetch those resources during the validation.
|
||||
*
|
||||
* @param theResourceLoader
|
||||
* The resourceloader to use. May be <code>null</code> if no resource loader should be used (in which case any <code>QuestionaireAnswers</code> with external references will fail to
|
||||
* The resourceloader to use. May be <code>null</code> if no resource loader should be used (in which case any <code>QuestionaireResponse</code> with external references will fail to
|
||||
* validate.)
|
||||
*/
|
||||
public void setResourceLoader(IResourceLoader theResourceLoader) {
|
||||
|
@ -44,12 +48,12 @@ public class FhirQuestionnaireAnswersValidator extends BaseValidatorBridge {
|
|||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
if (resource instanceof QuestionnaireAnswers) {
|
||||
return doValidate(theCtx, (QuestionnaireAnswers) resource);
|
||||
if (resource instanceof QuestionnaireResponse) {
|
||||
return doValidate(theCtx, (QuestionnaireResponse) resource);
|
||||
}
|
||||
|
||||
RuntimeResourceDefinition def = theCtx.getFhirContext().getResourceDefinition((IBaseResource) resource);
|
||||
if ("QuestionnaireAnswers".equals(def.getName()) == false) {
|
||||
if ("QuestionnaireResponse".equals(def.getName()) == false) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
@ -59,12 +63,12 @@ public class FhirQuestionnaireAnswersValidator extends BaseValidatorBridge {
|
|||
|
||||
IParser p = theCtx.getFhirContext().newJsonParser();
|
||||
String string = p.encodeResourceToString((IBaseResource) resource);
|
||||
QuestionnaireAnswers qa = p.parseResource(QuestionnaireAnswers.class, string);
|
||||
QuestionnaireResponse qa = p.parseResource(QuestionnaireResponse.class, string);
|
||||
|
||||
return doValidate(theCtx, qa);
|
||||
}
|
||||
|
||||
private List<ValidationMessage> doValidate(IValidationContext<?> theValCtx, QuestionnaireAnswers theResource) {
|
||||
private List<ValidationMessage> doValidate(IValidationContext<?> theValCtx, QuestionnaireResponse theResource) {
|
||||
|
||||
WorkerContext workerCtx = new WorkerContext();
|
||||
ArrayList<ValidationMessage> retVal = new ArrayList<ValidationMessage>();
|
||||
|
@ -73,7 +77,7 @@ public class FhirQuestionnaireAnswersValidator extends BaseValidatorBridge {
|
|||
return retVal;
|
||||
}
|
||||
|
||||
QuestionnaireAnswersValidator val = new QuestionnaireAnswersValidator(workerCtx);
|
||||
QuestionnaireResponseValidator val = new QuestionnaireResponseValidator(workerCtx);
|
||||
|
||||
val.validate(retVal, theResource);
|
||||
return retVal;
|
||||
|
@ -87,7 +91,9 @@ public class FhirQuestionnaireAnswersValidator extends BaseValidatorBridge {
|
|||
for (ResourceReferenceInfo nextRefInfo : refs) {
|
||||
IIdType nextRef = nextRefInfo.getResourceReference().getReferenceElement();
|
||||
String resourceType = nextRef.getResourceType();
|
||||
if ("ValueSet".equals(resourceType)) {
|
||||
if (isBlank(resourceType)) {
|
||||
theMessages.add(new ValidationMessage(Source.QuestionnaireResponseValidator, org.hl7.fhir.instance.model.OperationOutcome.IssueType.INVALID, "Invalid reference '" + nextRef.getValue() + "' - Does not identify resource type", IssueSeverity.FATAL));
|
||||
} else if ("ValueSet".equals(resourceType)) {
|
||||
if (!theWorkerCtx.getValueSets().containsKey(nextRef.getValue())) {
|
||||
ValueSet resource = tryToLoad(ValueSet.class, nextRef, theMessages);
|
||||
if (resource == null) {
|
|
@ -406,4 +406,12 @@ public interface IFHIRClient {
|
|||
* @return
|
||||
*/
|
||||
public <T extends Resource> Parameters operateType(Class<T> resourceClass, String name, Parameters params);
|
||||
|
||||
|
||||
/**
|
||||
* for debugging- the server address that the client is using
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAddress();
|
||||
}
|
||||
|
|
|
@ -44,10 +44,13 @@ import org.hl7.fhir.instance.model.Conformance.ConditionalDeleteStatus;
|
|||
import org.hl7.fhir.instance.model.Conformance.ConformanceRestComponent;
|
||||
import org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceComponent;
|
||||
import org.hl7.fhir.instance.model.Conformance.ConformanceRestResourceSearchParamComponent;
|
||||
import org.hl7.fhir.instance.model.Conformance.ConformanceStatementKind;
|
||||
import org.hl7.fhir.instance.model.Conformance.ResourceInteractionComponent;
|
||||
import org.hl7.fhir.instance.model.Conformance.RestfulConformanceMode;
|
||||
import org.hl7.fhir.instance.model.Conformance.SystemRestfulInteraction;
|
||||
import org.hl7.fhir.instance.model.Conformance.TypeRestfulInteraction;
|
||||
import org.hl7.fhir.instance.model.Conformance.UnknownContentCode;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalence;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ResourceType;
|
||||
import org.hl7.fhir.instance.model.OperationDefinition;
|
||||
|
@ -81,478 +84,484 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|||
* Server FHIR Provider which serves the conformance statement for a RESTful server implementation
|
||||
*
|
||||
* <p>
|
||||
* Note: This class is safe to extend, but it is important to note that the same instance of {@link Conformance} is
|
||||
* always returned unless {@link #setCache(boolean)} is called with a value of <code>false</code>. This means that if
|
||||
* you are adding anything to the returned conformance instance on each call you should call
|
||||
* <code>setCache(false)</code> in your provider constructor.
|
||||
* Note: This class is safe to extend, but it is important to note that the same instance of {@link Conformance} is always returned unless
|
||||
* {@link #setCache(boolean)} is called with a value of <code>false</code>. This means that if you are adding anything to the returned conformance instance on
|
||||
* each call you should call <code>setCache(false)</code> in your provider constructor.
|
||||
* </p>
|
||||
*/
|
||||
public class ServerConformanceProvider implements IServerConformanceProvider<Conformance> {
|
||||
|
||||
private boolean myCache = true;
|
||||
private volatile Conformance myConformance;
|
||||
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
||||
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
||||
private String myPublisher = "Not provided";
|
||||
private final RestfulServer myRestfulServer;
|
||||
private boolean myCache = true;
|
||||
private volatile Conformance myConformance;
|
||||
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
||||
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
||||
private String myPublisher = "Not provided";
|
||||
private final RestfulServer myRestfulServer;
|
||||
|
||||
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
||||
myRestfulServer = theRestfulServer;
|
||||
}
|
||||
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
||||
myRestfulServer = theRestfulServer;
|
||||
}
|
||||
|
||||
private void checkBindingForSystemOps(ConformanceRestComponent rest, Set<SystemRestfulInteraction> systemOps, BaseMethodBinding<?> nextMethodBinding) {
|
||||
if (nextMethodBinding.getSystemOperationType() != null) {
|
||||
String sysOpCode = nextMethodBinding.getSystemOperationType().getCode();
|
||||
if (sysOpCode != null) {
|
||||
SystemRestfulInteraction sysOp;
|
||||
try {
|
||||
sysOp = SystemRestfulInteraction.fromCode(sysOpCode);
|
||||
} catch (Exception e) {
|
||||
sysOp = null;
|
||||
}
|
||||
if (sysOp == null) {
|
||||
throw new InternalErrorException("Unknown system-restful-interaction: " + sysOpCode);
|
||||
}
|
||||
if (systemOps.contains(sysOp) == false) {
|
||||
systemOps.add(sysOp);
|
||||
rest.addInteraction().setCode(sysOp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkBindingForSystemOps(ConformanceRestComponent rest, Set<SystemRestfulInteraction> systemOps,
|
||||
BaseMethodBinding<?> nextMethodBinding) {
|
||||
if (nextMethodBinding.getSystemOperationType() != null) {
|
||||
String sysOpCode = nextMethodBinding.getSystemOperationType().getCode();
|
||||
if (sysOpCode != null) {
|
||||
SystemRestfulInteraction sysOp;
|
||||
try {
|
||||
sysOp = SystemRestfulInteraction.fromCode(sysOpCode);
|
||||
} catch (Exception e) {
|
||||
sysOp = null;
|
||||
}
|
||||
if (sysOp == null) {
|
||||
throw new InternalErrorException("Unknown system-restful-interaction: " + sysOpCode);
|
||||
}
|
||||
if (systemOps.contains(sysOp) == false) {
|
||||
systemOps.add(sysOp);
|
||||
rest.addInteraction().setCode(sysOp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
||||
for (ResourceBinding next : myRestfulServer.getResourceBindings()) {
|
||||
String resourceName = next.getResourceName();
|
||||
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
||||
}
|
||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||
}
|
||||
}
|
||||
for (BaseMethodBinding<?> nextMethodBinding : myRestfulServer.getServerBindings()) {
|
||||
String resourceName = "";
|
||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
||||
}
|
||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||
}
|
||||
return resourceToMethods;
|
||||
}
|
||||
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
||||
for (ResourceBinding next : myRestfulServer.getResourceBindings()) {
|
||||
String resourceName = next.getResourceName();
|
||||
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
||||
}
|
||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||
}
|
||||
}
|
||||
for (BaseMethodBinding<?> nextMethodBinding : myRestfulServer.getServerBindings()) {
|
||||
String resourceName = "";
|
||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
||||
}
|
||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||
}
|
||||
return resourceToMethods;
|
||||
}
|
||||
|
||||
private String createOperationName(OperationMethodBinding theMethodBinding) {
|
||||
return theMethodBinding.getName().substring(1);
|
||||
}
|
||||
private String createOperationName(OperationMethodBinding theMethodBinding) {
|
||||
return theMethodBinding.getName().substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the "publisher" that will be placed in the generated conformance statement. As this is a
|
||||
* mandatory element, the value should not be null (although this is not enforced). The value defaults to
|
||||
* "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
*/
|
||||
public String getPublisher() {
|
||||
return myPublisher;
|
||||
}
|
||||
/**
|
||||
* Gets the value of the "publisher" that will be placed in the generated conformance statement. As this is a mandatory element, the value should not be null
|
||||
* (although this is not enforced). The value defaults to "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
*/
|
||||
public String getPublisher() {
|
||||
return myPublisher;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Metadata
|
||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||
if (myConformance != null && myCache) {
|
||||
return myConformance;
|
||||
}
|
||||
@Override
|
||||
@Metadata
|
||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||
if (myConformance != null && myCache) {
|
||||
return myConformance;
|
||||
}
|
||||
|
||||
Conformance retVal = new Conformance();
|
||||
Conformance retVal = new Conformance();
|
||||
|
||||
retVal.setPublisher(myPublisher);
|
||||
retVal.setDate(new Date());
|
||||
retVal.setFhirVersion("0.5.0"); // TODO: pull from model
|
||||
retVal.setAcceptUnknown(false); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||
// needs to be modified to actually allow it
|
||||
retVal.setPublisher(myPublisher);
|
||||
retVal.setDate(new Date());
|
||||
retVal.setFhirVersion("0.5.0"); // TODO: pull from model
|
||||
retVal.setAcceptUnknown(UnknownContentCode.EXTENSIONS); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||
// needs to be modified to actually allow it
|
||||
|
||||
retVal.getImplementation().setDescription(myRestfulServer.getImplementationDescription());
|
||||
retVal.getSoftware().setName(myRestfulServer.getServerName());
|
||||
retVal.getSoftware().setVersion(myRestfulServer.getServerVersion());
|
||||
retVal.addFormat(Constants.CT_FHIR_XML);
|
||||
retVal.addFormat(Constants.CT_FHIR_JSON);
|
||||
retVal.getImplementation().setDescription(myRestfulServer.getImplementationDescription());
|
||||
retVal.setKind(ConformanceStatementKind.INSTANCE);
|
||||
retVal.getSoftware().setName(myRestfulServer.getServerName());
|
||||
retVal.getSoftware().setVersion(myRestfulServer.getServerVersion());
|
||||
retVal.addFormat(Constants.CT_FHIR_XML);
|
||||
retVal.addFormat(Constants.CT_FHIR_JSON);
|
||||
|
||||
ConformanceRestComponent rest = retVal.addRest();
|
||||
rest.setMode(RestfulConformanceMode.SERVER);
|
||||
ConformanceRestComponent rest = retVal.addRest();
|
||||
rest.setMode(RestfulConformanceMode.SERVER);
|
||||
|
||||
Set<SystemRestfulInteraction> systemOps = new HashSet<SystemRestfulInteraction>();
|
||||
Set<String> operationNames = new HashSet<String>();
|
||||
Set<SystemRestfulInteraction> systemOps = new HashSet<SystemRestfulInteraction>();
|
||||
Set<String> operationNames = new HashSet<String>();
|
||||
|
||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||
|
||||
if (nextEntry.getKey().isEmpty() == false) {
|
||||
Set<TypeRestfulInteraction> resourceOps = new HashSet<TypeRestfulInteraction>();
|
||||
ConformanceRestResourceComponent resource = rest.addResource();
|
||||
String resourceName = nextEntry.getKey();
|
||||
RuntimeResourceDefinition def = myRestfulServer.getFhirContext().getResourceDefinition(resourceName);
|
||||
resource.getTypeElement().setValue(def.getName());
|
||||
resource.getProfile().setReference((def.getResourceProfile(myRestfulServer.getServerBaseForRequest(theRequest))));
|
||||
if (nextEntry.getKey().isEmpty() == false) {
|
||||
Set<TypeRestfulInteraction> resourceOps = new HashSet<TypeRestfulInteraction>();
|
||||
ConformanceRestResourceComponent resource = rest.addResource();
|
||||
String resourceName = nextEntry.getKey();
|
||||
RuntimeResourceDefinition def = myRestfulServer.getFhirContext().getResourceDefinition(resourceName);
|
||||
resource.getTypeElement().setValue(def.getName());
|
||||
resource.getProfile()
|
||||
.setReference((def.getResourceProfile(myRestfulServer.getServerBaseForRequest(theRequest))));
|
||||
|
||||
TreeSet<String> includes = new TreeSet<String>();
|
||||
TreeSet<String> includes = new TreeSet<String>();
|
||||
|
||||
// Map<String, Conformance.RestResourceSearchParam> nameToSearchParam = new HashMap<String,
|
||||
// Conformance.RestResourceSearchParam>();
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextEntry.getValue()) {
|
||||
if (nextMethodBinding.getResourceOperationType() != null) {
|
||||
String resOpCode = nextMethodBinding.getResourceOperationType().getCode();
|
||||
if (resOpCode != null) {
|
||||
TypeRestfulInteraction resOp;
|
||||
try {
|
||||
resOp = TypeRestfulInteraction.fromCode(resOpCode);
|
||||
} catch (Exception e) {
|
||||
resOp = null;
|
||||
}
|
||||
if (resOp == null) {
|
||||
throw new InternalErrorException("Unknown type-restful-interaction: " + resOpCode);
|
||||
}
|
||||
if (resourceOps.contains(resOp) == false) {
|
||||
resourceOps.add(resOp);
|
||||
resource.addInteraction().setCode(resOp);
|
||||
}
|
||||
if ("vread".equals(resOpCode)) {
|
||||
// vread implies read
|
||||
resOp = TypeRestfulInteraction.READ;
|
||||
if (resourceOps.contains(resOp) == false) {
|
||||
resourceOps.add(resOp);
|
||||
resource.addInteraction().setCode(resOp);
|
||||
}
|
||||
}
|
||||
// Map<String, Conformance.RestResourceSearchParam> nameToSearchParam = new HashMap<String,
|
||||
// Conformance.RestResourceSearchParam>();
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextEntry.getValue()) {
|
||||
if (nextMethodBinding.getResourceOperationType() != null) {
|
||||
String resOpCode = nextMethodBinding.getResourceOperationType().getCode();
|
||||
if (resOpCode != null) {
|
||||
TypeRestfulInteraction resOp;
|
||||
try {
|
||||
resOp = TypeRestfulInteraction.fromCode(resOpCode);
|
||||
} catch (Exception e) {
|
||||
resOp = null;
|
||||
}
|
||||
if (resOp == null) {
|
||||
throw new InternalErrorException("Unknown type-restful-interaction: " + resOpCode);
|
||||
}
|
||||
if (resourceOps.contains(resOp) == false) {
|
||||
resourceOps.add(resOp);
|
||||
resource.addInteraction().setCode(resOp);
|
||||
}
|
||||
if ("vread".equals(resOpCode)) {
|
||||
// vread implies read
|
||||
resOp = TypeRestfulInteraction.READ;
|
||||
if (resourceOps.contains(resOp) == false) {
|
||||
resourceOps.add(resOp);
|
||||
resource.addInteraction().setCode(resOp);
|
||||
}
|
||||
}
|
||||
|
||||
if (nextMethodBinding.isSupportsConditional()) {
|
||||
switch (resOp) {
|
||||
case CREATE:
|
||||
resource.setConditionalCreate(true);
|
||||
break;
|
||||
case DELETE:
|
||||
resource.setConditionalDelete(ConditionalDeleteStatus.SINGLE);
|
||||
break;
|
||||
case UPDATE:
|
||||
resource.setConditionalUpdate(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (nextMethodBinding.isSupportsConditional()) {
|
||||
switch (resOp) {
|
||||
case CREATE:
|
||||
resource.setConditionalCreate(true);
|
||||
break;
|
||||
case DELETE:
|
||||
resource.setConditionalDelete(ConditionalDeleteStatus.SINGLE);
|
||||
break;
|
||||
case UPDATE:
|
||||
resource.setConditionalUpdate(true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkBindingForSystemOps(rest, systemOps, nextMethodBinding);
|
||||
checkBindingForSystemOps(rest, systemOps, nextMethodBinding);
|
||||
|
||||
if (nextMethodBinding instanceof SearchMethodBinding) {
|
||||
handleSearchMethodBinding(rest, resource, resourceName, def, includes, (SearchMethodBinding) nextMethodBinding);
|
||||
} else if (nextMethodBinding instanceof DynamicSearchMethodBinding) {
|
||||
handleDynamicSearchMethodBinding(resource, def, includes, (DynamicSearchMethodBinding) nextMethodBinding);
|
||||
} else if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
String opName = myOperationBindingToName.get(methodBinding);
|
||||
if (operationNames.add(opName)) {
|
||||
// Only add each operation (by name) once
|
||||
rest.addOperation().setName(methodBinding.getName()).getDefinition().setReference("OperationDefinition/" + opName);
|
||||
}
|
||||
}
|
||||
if (nextMethodBinding instanceof SearchMethodBinding) {
|
||||
handleSearchMethodBinding(rest, resource, resourceName, def, includes,
|
||||
(SearchMethodBinding) nextMethodBinding);
|
||||
} else if (nextMethodBinding instanceof DynamicSearchMethodBinding) {
|
||||
handleDynamicSearchMethodBinding(resource, def, includes, (DynamicSearchMethodBinding) nextMethodBinding);
|
||||
} else if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
String opName = myOperationBindingToName.get(methodBinding);
|
||||
if (operationNames.add(opName)) {
|
||||
// Only add each operation (by name) once
|
||||
rest.addOperation().setName(methodBinding.getName()).getDefinition()
|
||||
.setReference("OperationDefinition/" + opName);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(resource.getInteraction(), new Comparator<ResourceInteractionComponent>() {
|
||||
@Override
|
||||
public int compare(ResourceInteractionComponent theO1, ResourceInteractionComponent theO2) {
|
||||
TypeRestfulInteraction o1 = theO1.getCode();
|
||||
TypeRestfulInteraction o2 = theO2.getCode();
|
||||
if (o1 == null && o2 == null) {
|
||||
return 0;
|
||||
}
|
||||
if (o1 == null) {
|
||||
return 1;
|
||||
}
|
||||
if (o2 == null) {
|
||||
return -1;
|
||||
}
|
||||
return o1.ordinal() - o2.ordinal();
|
||||
}
|
||||
});
|
||||
Collections.sort(resource.getInteraction(), new Comparator<ResourceInteractionComponent>() {
|
||||
@Override
|
||||
public int compare(ResourceInteractionComponent theO1, ResourceInteractionComponent theO2) {
|
||||
TypeRestfulInteraction o1 = theO1.getCode();
|
||||
TypeRestfulInteraction o2 = theO2.getCode();
|
||||
if (o1 == null && o2 == null) {
|
||||
return 0;
|
||||
}
|
||||
if (o1 == null) {
|
||||
return 1;
|
||||
}
|
||||
if (o2 == null) {
|
||||
return -1;
|
||||
}
|
||||
return o1.ordinal() - o2.ordinal();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
for (String nextInclude : includes) {
|
||||
resource.addSearchInclude(nextInclude);
|
||||
}
|
||||
} else {
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextEntry.getValue()) {
|
||||
checkBindingForSystemOps(rest, systemOps, nextMethodBinding);
|
||||
if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
String opName = myOperationBindingToName.get(methodBinding);
|
||||
if (operationNames.add(opName)) {
|
||||
rest.addOperation().setName(methodBinding.getName()).getDefinition().setReference("OperationDefinition/" + opName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String nextInclude : includes) {
|
||||
resource.addSearchInclude(nextInclude);
|
||||
}
|
||||
} else {
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextEntry.getValue()) {
|
||||
checkBindingForSystemOps(rest, systemOps, nextMethodBinding);
|
||||
if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
String opName = myOperationBindingToName.get(methodBinding);
|
||||
if (operationNames.add(opName)) {
|
||||
rest.addOperation().setName(methodBinding.getName()).getDefinition()
|
||||
.setReference("OperationDefinition/" + opName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
myConformance = retVal;
|
||||
return retVal;
|
||||
}
|
||||
myConformance = retVal;
|
||||
return retVal;
|
||||
}
|
||||
|
||||
private void handleDynamicSearchMethodBinding(ConformanceRestResourceComponent resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
||||
includes.addAll(searchMethodBinding.getIncludes());
|
||||
private void handleDynamicSearchMethodBinding(ConformanceRestResourceComponent resource,
|
||||
RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
||||
includes.addAll(searchMethodBinding.getIncludes());
|
||||
|
||||
List<RuntimeSearchParam> searchParameters = new ArrayList<RuntimeSearchParam>();
|
||||
searchParameters.addAll(searchMethodBinding.getSearchParams());
|
||||
sortRuntimeSearchParameters(searchParameters);
|
||||
List<RuntimeSearchParam> searchParameters = new ArrayList<RuntimeSearchParam>();
|
||||
searchParameters.addAll(searchMethodBinding.getSearchParams());
|
||||
sortRuntimeSearchParameters(searchParameters);
|
||||
|
||||
if (!searchParameters.isEmpty()) {
|
||||
if (!searchParameters.isEmpty()) {
|
||||
|
||||
for (RuntimeSearchParam nextParameter : searchParameters) {
|
||||
for (RuntimeSearchParam nextParameter : searchParameters) {
|
||||
|
||||
String nextParamName = nextParameter.getName();
|
||||
String nextParamName = nextParameter.getName();
|
||||
|
||||
// String chain = null;
|
||||
String nextParamUnchainedName = nextParamName;
|
||||
if (nextParamName.contains(".")) {
|
||||
// chain = nextParamName.substring(nextParamName.indexOf('.') + 1);
|
||||
nextParamUnchainedName = nextParamName.substring(0, nextParamName.indexOf('.'));
|
||||
}
|
||||
// String chain = null;
|
||||
String nextParamUnchainedName = nextParamName;
|
||||
if (nextParamName.contains(".")) {
|
||||
// chain = nextParamName.substring(nextParamName.indexOf('.') + 1);
|
||||
nextParamUnchainedName = nextParamName.substring(0, nextParamName.indexOf('.'));
|
||||
}
|
||||
|
||||
String nextParamDescription = nextParameter.getDescription();
|
||||
String nextParamDescription = nextParameter.getDescription();
|
||||
|
||||
/*
|
||||
* If the parameter has no description, default to the one from the resource
|
||||
*/
|
||||
if (StringUtils.isBlank(nextParamDescription)) {
|
||||
RuntimeSearchParam paramDef = def.getSearchParam(nextParamUnchainedName);
|
||||
if (paramDef != null) {
|
||||
nextParamDescription = paramDef.getDescription();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If the parameter has no description, default to the one from the resource
|
||||
*/
|
||||
if (StringUtils.isBlank(nextParamDescription)) {
|
||||
RuntimeSearchParam paramDef = def.getSearchParam(nextParamUnchainedName);
|
||||
if (paramDef != null) {
|
||||
nextParamDescription = paramDef.getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
ConformanceRestResourceSearchParamComponent param = resource.addSearchParam();
|
||||
ConformanceRestResourceSearchParamComponent param = resource.addSearchParam();
|
||||
|
||||
param.setName(nextParamName);
|
||||
// if (StringUtils.isNotBlank(chain)) {
|
||||
// param.addChain(chain);
|
||||
// }
|
||||
param.setDocumentation(nextParamDescription);
|
||||
// param.setType(nextParameter.getParamType());
|
||||
}
|
||||
}
|
||||
}
|
||||
param.setName(nextParamName);
|
||||
// if (StringUtils.isNotBlank(chain)) {
|
||||
// param.addChain(chain);
|
||||
// }
|
||||
param.setDocumentation(nextParamDescription);
|
||||
// param.setType(nextParameter.getParamType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSearchMethodBinding(ConformanceRestComponent rest, ConformanceRestResourceComponent resource, String resourceName, RuntimeResourceDefinition def, TreeSet<String> includes, SearchMethodBinding searchMethodBinding) {
|
||||
includes.addAll(searchMethodBinding.getIncludes());
|
||||
private void handleSearchMethodBinding(ConformanceRestComponent rest, ConformanceRestResourceComponent resource,
|
||||
String resourceName, RuntimeResourceDefinition def, TreeSet<String> includes,
|
||||
SearchMethodBinding searchMethodBinding) {
|
||||
includes.addAll(searchMethodBinding.getIncludes());
|
||||
|
||||
List<IParameter> params = searchMethodBinding.getParameters();
|
||||
List<SearchParameter> searchParameters = new ArrayList<SearchParameter>();
|
||||
for (IParameter nextParameter : params) {
|
||||
if ((nextParameter instanceof SearchParameter)) {
|
||||
searchParameters.add((SearchParameter) nextParameter);
|
||||
}
|
||||
}
|
||||
sortSearchParameters(searchParameters);
|
||||
if (!searchParameters.isEmpty()) {
|
||||
// boolean allOptional = searchParameters.get(0).isRequired() == false;
|
||||
//
|
||||
// OperationDefinition query = null;
|
||||
// if (!allOptional) {
|
||||
// RestOperation operation = rest.addOperation();
|
||||
// query = new OperationDefinition();
|
||||
// operation.setDefinition(new ResourceReferenceDt(query));
|
||||
// query.getDescriptionElement().setValue(searchMethodBinding.getDescription());
|
||||
// query.addUndeclaredExtension(false, ExtensionConstants.QUERY_RETURN_TYPE, new CodeDt(resourceName));
|
||||
// for (String nextInclude : searchMethodBinding.getIncludes()) {
|
||||
// query.addUndeclaredExtension(false, ExtensionConstants.QUERY_ALLOWED_INCLUDE, new StringDt(nextInclude));
|
||||
// }
|
||||
// }
|
||||
List<IParameter> params = searchMethodBinding.getParameters();
|
||||
List<SearchParameter> searchParameters = new ArrayList<SearchParameter>();
|
||||
for (IParameter nextParameter : params) {
|
||||
if ((nextParameter instanceof SearchParameter)) {
|
||||
searchParameters.add((SearchParameter) nextParameter);
|
||||
}
|
||||
}
|
||||
sortSearchParameters(searchParameters);
|
||||
if (!searchParameters.isEmpty()) {
|
||||
// boolean allOptional = searchParameters.get(0).isRequired() == false;
|
||||
//
|
||||
// OperationDefinition query = null;
|
||||
// if (!allOptional) {
|
||||
// RestOperation operation = rest.addOperation();
|
||||
// query = new OperationDefinition();
|
||||
// operation.setDefinition(new ResourceReferenceDt(query));
|
||||
// query.getDescriptionElement().setValue(searchMethodBinding.getDescription());
|
||||
// query.addUndeclaredExtension(false, ExtensionConstants.QUERY_RETURN_TYPE, new CodeDt(resourceName));
|
||||
// for (String nextInclude : searchMethodBinding.getIncludes()) {
|
||||
// query.addUndeclaredExtension(false, ExtensionConstants.QUERY_ALLOWED_INCLUDE, new StringDt(nextInclude));
|
||||
// }
|
||||
// }
|
||||
|
||||
for (SearchParameter nextParameter : searchParameters) {
|
||||
for (SearchParameter nextParameter : searchParameters) {
|
||||
|
||||
String nextParamName = nextParameter.getName();
|
||||
String nextParamName = nextParameter.getName();
|
||||
|
||||
String chain = null;
|
||||
String nextParamUnchainedName = nextParamName;
|
||||
if (nextParamName.contains(".")) {
|
||||
chain = nextParamName.substring(nextParamName.indexOf('.') + 1);
|
||||
nextParamUnchainedName = nextParamName.substring(0, nextParamName.indexOf('.'));
|
||||
}
|
||||
String chain = null;
|
||||
String nextParamUnchainedName = nextParamName;
|
||||
if (nextParamName.contains(".")) {
|
||||
chain = nextParamName.substring(nextParamName.indexOf('.') + 1);
|
||||
nextParamUnchainedName = nextParamName.substring(0, nextParamName.indexOf('.'));
|
||||
}
|
||||
|
||||
String nextParamDescription = nextParameter.getDescription();
|
||||
String nextParamDescription = nextParameter.getDescription();
|
||||
|
||||
/*
|
||||
* If the parameter has no description, default to the one from the resource
|
||||
*/
|
||||
if (StringUtils.isBlank(nextParamDescription)) {
|
||||
RuntimeSearchParam paramDef = def.getSearchParam(nextParamUnchainedName);
|
||||
if (paramDef != null) {
|
||||
nextParamDescription = paramDef.getDescription();
|
||||
}
|
||||
}
|
||||
/*
|
||||
* If the parameter has no description, default to the one from the resource
|
||||
*/
|
||||
if (StringUtils.isBlank(nextParamDescription)) {
|
||||
RuntimeSearchParam paramDef = def.getSearchParam(nextParamUnchainedName);
|
||||
if (paramDef != null) {
|
||||
nextParamDescription = paramDef.getDescription();
|
||||
}
|
||||
}
|
||||
|
||||
ConformanceRestResourceSearchParamComponent param = resource.addSearchParam();
|
||||
param.setName(nextParamUnchainedName);
|
||||
if (StringUtils.isNotBlank(chain)) {
|
||||
param.addChain(chain);
|
||||
}
|
||||
param.setDocumentation(nextParamDescription);
|
||||
if (nextParameter.getParamType() != null) {
|
||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||
}
|
||||
for (Class<? extends IResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
||||
RuntimeResourceDefinition targetDef = myRestfulServer.getFhirContext().getResourceDefinition(nextTarget);
|
||||
if (targetDef != null) {
|
||||
ResourceType code;
|
||||
try {
|
||||
code = ResourceType.fromCode(targetDef.getName());
|
||||
} catch (Exception e) {
|
||||
code = null;
|
||||
}
|
||||
if (code != null) {
|
||||
param.addTarget(code.toCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ConformanceRestResourceSearchParamComponent param = resource.addSearchParam();
|
||||
param.setName(nextParamUnchainedName);
|
||||
if (StringUtils.isNotBlank(chain)) {
|
||||
param.addChain(chain);
|
||||
}
|
||||
param.setDocumentation(nextParamDescription);
|
||||
if (nextParameter.getParamType() != null) {
|
||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||
}
|
||||
for (Class<? extends IResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
||||
RuntimeResourceDefinition targetDef = myRestfulServer.getFhirContext().getResourceDefinition(nextTarget);
|
||||
if (targetDef != null) {
|
||||
ResourceType code;
|
||||
try {
|
||||
code = ResourceType.fromCode(targetDef.getName());
|
||||
} catch (Exception e) {
|
||||
code = null;
|
||||
}
|
||||
if (code != null) {
|
||||
param.addTarget(code.toCode());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Initialize
|
||||
public void initializeOperations() {
|
||||
myOperationBindingToName = new IdentityHashMap<OperationMethodBinding, String>();
|
||||
myOperationNameToBindings = new HashMap<String, List<OperationMethodBinding>>();
|
||||
@Initialize
|
||||
public void initializeOperations() {
|
||||
myOperationBindingToName = new IdentityHashMap<OperationMethodBinding, String>();
|
||||
myOperationNameToBindings = new HashMap<String, List<OperationMethodBinding>>();
|
||||
|
||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||
List<BaseMethodBinding<?>> nextMethodBindings = nextEntry.getValue();
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextMethodBindings) {
|
||||
if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
if (myOperationBindingToName.containsKey(methodBinding)) {
|
||||
continue;
|
||||
}
|
||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||
List<BaseMethodBinding<?>> nextMethodBindings = nextEntry.getValue();
|
||||
for (BaseMethodBinding<?> nextMethodBinding : nextMethodBindings) {
|
||||
if (nextMethodBinding instanceof OperationMethodBinding) {
|
||||
OperationMethodBinding methodBinding = (OperationMethodBinding) nextMethodBinding;
|
||||
if (myOperationBindingToName.containsKey(methodBinding)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = createOperationName(methodBinding);
|
||||
myOperationBindingToName.put(methodBinding, name);
|
||||
if (myOperationNameToBindings.containsKey(name) == false) {
|
||||
myOperationNameToBindings.put(name, new ArrayList<OperationMethodBinding>());
|
||||
}
|
||||
myOperationNameToBindings.get(name).add(methodBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String name = createOperationName(methodBinding);
|
||||
myOperationBindingToName.put(methodBinding, name);
|
||||
if (myOperationNameToBindings.containsKey(name) == false) {
|
||||
myOperationNameToBindings.put(name, new ArrayList<OperationMethodBinding>());
|
||||
}
|
||||
myOperationNameToBindings.get(name).add(methodBinding);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Read(type = OperationDefinition.class)
|
||||
public OperationDefinition readOperationDefinition(@IdParam IdDt theId) {
|
||||
if (theId == null || theId.hasIdPart() == false) {
|
||||
throw new ResourceNotFoundException(theId);
|
||||
}
|
||||
List<OperationMethodBinding> sharedDescriptions = myOperationNameToBindings.get(theId.getIdPart());
|
||||
if (sharedDescriptions == null || sharedDescriptions.isEmpty()) {
|
||||
throw new ResourceNotFoundException(theId);
|
||||
}
|
||||
@Read(type = OperationDefinition.class)
|
||||
public OperationDefinition readOperationDefinition(@IdParam IdDt theId) {
|
||||
if (theId == null || theId.hasIdPart() == false) {
|
||||
throw new ResourceNotFoundException(theId);
|
||||
}
|
||||
List<OperationMethodBinding> sharedDescriptions = myOperationNameToBindings.get(theId.getIdPart());
|
||||
if (sharedDescriptions == null || sharedDescriptions.isEmpty()) {
|
||||
throw new ResourceNotFoundException(theId);
|
||||
}
|
||||
|
||||
OperationDefinition op = new OperationDefinition();
|
||||
op.setStatus(ConformanceResourceStatus.ACTIVE);
|
||||
op.setIdempotent(true);
|
||||
OperationDefinition op = new OperationDefinition();
|
||||
op.setStatus(ConformanceResourceStatus.ACTIVE);
|
||||
op.setIdempotent(true);
|
||||
|
||||
Set<String> inParams = new HashSet<String>();
|
||||
Set<String> outParams = new HashSet<String>();
|
||||
Set<String> inParams = new HashSet<String>();
|
||||
Set<String> outParams = new HashSet<String>();
|
||||
|
||||
for (OperationMethodBinding sharedDescription : sharedDescriptions) {
|
||||
if (isNotBlank(sharedDescription.getDescription())) {
|
||||
op.setDescription(sharedDescription.getDescription());
|
||||
}
|
||||
if (!sharedDescription.isIdempotent()) {
|
||||
op.setIdempotent(sharedDescription.isIdempotent());
|
||||
}
|
||||
op.setCode(sharedDescription.getName());
|
||||
if (sharedDescription.isCanOperateAtInstanceLevel()) {
|
||||
op.setInstance(sharedDescription.isCanOperateAtInstanceLevel());
|
||||
}
|
||||
if (sharedDescription.isCanOperateAtServerLevel()) {
|
||||
op.setSystem(sharedDescription.isCanOperateAtServerLevel());
|
||||
}
|
||||
if (isNotBlank(sharedDescription.getResourceName())) {
|
||||
op.addTypeElement().setValue(sharedDescription.getResourceName());
|
||||
}
|
||||
for (OperationMethodBinding sharedDescription : sharedDescriptions) {
|
||||
if (isNotBlank(sharedDescription.getDescription())) {
|
||||
op.setDescription(sharedDescription.getDescription());
|
||||
}
|
||||
if (!sharedDescription.isIdempotent()) {
|
||||
op.setIdempotent(sharedDescription.isIdempotent());
|
||||
}
|
||||
op.setCode(sharedDescription.getName());
|
||||
if (sharedDescription.isCanOperateAtInstanceLevel()) {
|
||||
op.setInstance(sharedDescription.isCanOperateAtInstanceLevel());
|
||||
}
|
||||
if (sharedDescription.isCanOperateAtServerLevel()) {
|
||||
op.setSystem(sharedDescription.isCanOperateAtServerLevel());
|
||||
}
|
||||
if (isNotBlank(sharedDescription.getResourceName())) {
|
||||
op.addTypeElement().setValue(sharedDescription.getResourceName());
|
||||
}
|
||||
|
||||
for (IParameter nextParamUntyped : sharedDescription.getParameters()) {
|
||||
if (nextParamUntyped instanceof OperationParameter) {
|
||||
OperationParameter nextParam = (OperationParameter) nextParamUntyped;
|
||||
OperationDefinitionParameterComponent param = op.addParameter();
|
||||
if (!inParams.add(nextParam.getName())) {
|
||||
continue;
|
||||
}
|
||||
param.setUse(OperationParameterUse.IN);
|
||||
if (nextParam.getParamType() != null) {
|
||||
param.setType(nextParam.getParamType());
|
||||
}
|
||||
param.setMin(nextParam.getMin());
|
||||
param.setMax(nextParam.getMax() == -1 ? "*" : Integer.toString(nextParam.getMax()));
|
||||
param.setName(nextParam.getName());
|
||||
}
|
||||
}
|
||||
for (IParameter nextParamUntyped : sharedDescription.getParameters()) {
|
||||
if (nextParamUntyped instanceof OperationParameter) {
|
||||
OperationParameter nextParam = (OperationParameter) nextParamUntyped;
|
||||
OperationDefinitionParameterComponent param = op.addParameter();
|
||||
if (!inParams.add(nextParam.getName())) {
|
||||
continue;
|
||||
}
|
||||
param.setUse(OperationParameterUse.IN);
|
||||
if (nextParam.getParamType() != null) {
|
||||
param.setType(nextParam.getParamType());
|
||||
}
|
||||
param.setMin(nextParam.getMin());
|
||||
param.setMax(nextParam.getMax() == -1 ? "*" : Integer.toString(nextParam.getMax()));
|
||||
param.setName(nextParam.getName());
|
||||
}
|
||||
}
|
||||
|
||||
for (ReturnType nextParam : sharedDescription.getReturnParams()) {
|
||||
if (!outParams.add(nextParam.getName())) {
|
||||
continue;
|
||||
}
|
||||
OperationDefinitionParameterComponent param = op.addParameter();
|
||||
param.setUse(OperationParameterUse.OUT);
|
||||
if (nextParam.getType() != null) {
|
||||
param.setType(nextParam.getType());
|
||||
}
|
||||
param.setMin(nextParam.getMin());
|
||||
param.setMax(nextParam.getMax() == -1 ? "*" : Integer.toString(nextParam.getMax()));
|
||||
param.setName(nextParam.getName());
|
||||
}
|
||||
}
|
||||
for (ReturnType nextParam : sharedDescription.getReturnParams()) {
|
||||
if (!outParams.add(nextParam.getName())) {
|
||||
continue;
|
||||
}
|
||||
OperationDefinitionParameterComponent param = op.addParameter();
|
||||
param.setUse(OperationParameterUse.OUT);
|
||||
if (nextParam.getType() != null) {
|
||||
param.setType(nextParam.getType());
|
||||
}
|
||||
param.setMin(nextParam.getMin());
|
||||
param.setMax(nextParam.getMax() == -1 ? "*" : Integer.toString(nextParam.getMax()));
|
||||
param.setName(nextParam.getName());
|
||||
}
|
||||
}
|
||||
|
||||
return op;
|
||||
}
|
||||
return op;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the cache property (default is true). If set to true, the same response will be returned for each invocation.
|
||||
* <p>
|
||||
* See the class documentation for an important note if you are extending this class
|
||||
* </p>
|
||||
*/
|
||||
public void setCache(boolean theCache) {
|
||||
myCache = theCache;
|
||||
}
|
||||
/**
|
||||
* Sets the cache property (default is true). If set to true, the same response will be returned for each invocation.
|
||||
* <p>
|
||||
* See the class documentation for an important note if you are extending this class
|
||||
* </p>
|
||||
*/
|
||||
public void setCache(boolean theCache) {
|
||||
myCache = theCache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the "publisher" that will be placed in the generated conformance statement. As this is a
|
||||
* mandatory element, the value should not be null (although this is not enforced). The value defaults to
|
||||
* "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
*/
|
||||
public void setPublisher(String thePublisher) {
|
||||
myPublisher = thePublisher;
|
||||
}
|
||||
/**
|
||||
* Sets the value of the "publisher" that will be placed in the generated conformance statement. As this is a mandatory element, the value should not be null
|
||||
* (although this is not enforced). The value defaults to "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
*/
|
||||
public void setPublisher(String thePublisher) {
|
||||
myPublisher = thePublisher;
|
||||
}
|
||||
|
||||
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<RuntimeSearchParam>() {
|
||||
@Override
|
||||
public int compare(RuntimeSearchParam theO1, RuntimeSearchParam theO2) {
|
||||
return theO1.getName().compareTo(theO2.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<RuntimeSearchParam>() {
|
||||
@Override
|
||||
public int compare(RuntimeSearchParam theO1, RuntimeSearchParam theO2) {
|
||||
return theO1.getName().compareTo(theO2.getName());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortSearchParameters(List<SearchParameter> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<SearchParameter>() {
|
||||
@Override
|
||||
public int compare(SearchParameter theO1, SearchParameter theO2) {
|
||||
if (theO1.isRequired() == theO2.isRequired()) {
|
||||
return theO1.getName().compareTo(theO2.getName());
|
||||
}
|
||||
if (theO1.isRequired()) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
private void sortSearchParameters(List<SearchParameter> searchParameters) {
|
||||
Collections.sort(searchParameters, new Comparator<SearchParameter>() {
|
||||
@Override
|
||||
public int compare(SearchParameter theO1, SearchParameter theO2) {
|
||||
if (theO1.isRequired() == theO2.isRequired()) {
|
||||
return theO1.getName().compareTo(theO2.getName());
|
||||
}
|
||||
if (theO1.isRequired()) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -253,11 +253,10 @@ public class Address extends Type implements ICompositeType {
|
|||
protected StringType text;
|
||||
|
||||
/**
|
||||
* This component contains the house number, apartment number, street name, street direction,
|
||||
P.O. Box number, delivery hints, and similar address information.
|
||||
* This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.
|
||||
*/
|
||||
@Child(name = "line", type = {StringType.class}, order=3, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Street name, number, direction & P.O. Box etc", formalDefinition="This component contains the house number, apartment number, street name, street direction, \nP.O. Box number, delivery hints, and similar address information." )
|
||||
@Description(shortDefinition="Street name, number, direction & P.O. Box etc", formalDefinition="This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information." )
|
||||
protected List<StringType> line;
|
||||
|
||||
/**
|
||||
|
@ -267,35 +266,42 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
@Description(shortDefinition="Name of city, town etc.", formalDefinition="The name of the city, town, village or other community or delivery center." )
|
||||
protected StringType city;
|
||||
|
||||
/**
|
||||
* The name of the administrative area (county).
|
||||
*/
|
||||
@Child(name = "district", type = {StringType.class}, order=5, min=0, max=1)
|
||||
@Description(shortDefinition="District name (aka county)", formalDefinition="The name of the administrative area (county)." )
|
||||
protected StringType district;
|
||||
|
||||
/**
|
||||
* Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).
|
||||
*/
|
||||
@Child(name = "state", type = {StringType.class}, order=5, min=0, max=1)
|
||||
@Child(name = "state", type = {StringType.class}, order=6, min=0, max=1)
|
||||
@Description(shortDefinition="Sub-unit of country (abreviations ok)", formalDefinition="Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes)." )
|
||||
protected StringType state;
|
||||
|
||||
/**
|
||||
* A postal code designating a region defined by the postal service.
|
||||
*/
|
||||
@Child(name = "postalCode", type = {StringType.class}, order=6, min=0, max=1)
|
||||
@Child(name = "postalCode", type = {StringType.class}, order=7, min=0, max=1)
|
||||
@Description(shortDefinition="Postal code for area", formalDefinition="A postal code designating a region defined by the postal service." )
|
||||
protected StringType postalCode;
|
||||
|
||||
/**
|
||||
* Country - a nation as commonly understood or generally accepted.
|
||||
*/
|
||||
@Child(name = "country", type = {StringType.class}, order=7, min=0, max=1)
|
||||
@Child(name = "country", type = {StringType.class}, order=8, min=0, max=1)
|
||||
@Description(shortDefinition="Country (can be ISO 3166 3 letter code)", formalDefinition="Country - a nation as commonly understood or generally accepted." )
|
||||
protected StringType country;
|
||||
|
||||
/**
|
||||
* Time period when address was/is in use.
|
||||
*/
|
||||
@Child(name = "period", type = {Period.class}, order=8, min=0, max=1)
|
||||
@Child(name = "period", type = {Period.class}, order=9, min=0, max=1)
|
||||
@Description(shortDefinition="Time period when address was/is in use", formalDefinition="Time period when address was/is in use." )
|
||||
protected Period period;
|
||||
|
||||
private static final long serialVersionUID = 1890613287L;
|
||||
private static final long serialVersionUID = 561490318L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
|
@ -452,8 +458,7 @@ P.O. Box number, delivery hints, and similar address information.
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #line} (This component contains the house number, apartment number, street name, street direction,
|
||||
P.O. Box number, delivery hints, and similar address information.)
|
||||
* @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
|
||||
*/
|
||||
public List<StringType> getLine() {
|
||||
if (this.line == null)
|
||||
|
@ -471,8 +476,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #line} (This component contains the house number, apartment number, street name, street direction,
|
||||
P.O. Box number, delivery hints, and similar address information.)
|
||||
* @return {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public StringType addLineElement() {//2
|
||||
|
@ -484,8 +488,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction,
|
||||
P.O. Box number, delivery hints, and similar address information.)
|
||||
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
|
||||
*/
|
||||
public Address addLine(String value) { //1
|
||||
StringType t = new StringType();
|
||||
|
@ -497,8 +500,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction,
|
||||
P.O. Box number, delivery hints, and similar address information.)
|
||||
* @param value {@link #line} (This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.)
|
||||
*/
|
||||
public boolean hasLine(String value) {
|
||||
if (this.line == null)
|
||||
|
@ -558,6 +560,55 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value
|
||||
*/
|
||||
public StringType getDistrictElement() {
|
||||
if (this.district == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create Address.district");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.district = new StringType(); // bb
|
||||
return this.district;
|
||||
}
|
||||
|
||||
public boolean hasDistrictElement() {
|
||||
return this.district != null && !this.district.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDistrict() {
|
||||
return this.district != null && !this.district.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #district} (The name of the administrative area (county).). This is the underlying object with id, value and extensions. The accessor "getDistrict" gives direct access to the value
|
||||
*/
|
||||
public Address setDistrictElement(StringType value) {
|
||||
this.district = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The name of the administrative area (county).
|
||||
*/
|
||||
public String getDistrict() {
|
||||
return this.district == null ? null : this.district.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The name of the administrative area (county).
|
||||
*/
|
||||
public Address setDistrict(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.district = null;
|
||||
else {
|
||||
if (this.district == null)
|
||||
this.district = new StringType();
|
||||
this.district.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #state} (Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).). This is the underlying object with id, value and extensions. The accessor "getState" gives direct access to the value
|
||||
*/
|
||||
|
@ -734,8 +785,9 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
childrenList.add(new Property("use", "code", "The purpose of this address.", 0, java.lang.Integer.MAX_VALUE, use));
|
||||
childrenList.add(new Property("type", "code", "Distinguishes between physical addresses (those you can visit) and mailing addresses (e.g. PO Boxes and care-of addresses). Most addresses are both.", 0, java.lang.Integer.MAX_VALUE, type));
|
||||
childrenList.add(new Property("text", "string", "A full text representation of the address.", 0, java.lang.Integer.MAX_VALUE, text));
|
||||
childrenList.add(new Property("line", "string", "This component contains the house number, apartment number, street name, street direction, \nP.O. Box number, delivery hints, and similar address information.", 0, java.lang.Integer.MAX_VALUE, line));
|
||||
childrenList.add(new Property("line", "string", "This component contains the house number, apartment number, street name, street direction, P.O. Box number, delivery hints, and similar address information.", 0, java.lang.Integer.MAX_VALUE, line));
|
||||
childrenList.add(new Property("city", "string", "The name of the city, town, village or other community or delivery center.", 0, java.lang.Integer.MAX_VALUE, city));
|
||||
childrenList.add(new Property("district", "string", "The name of the administrative area (county).", 0, java.lang.Integer.MAX_VALUE, district));
|
||||
childrenList.add(new Property("state", "string", "Sub-unit of a country with limited sovereignty in a federally organized country. A code may be used if codes are in common use (i.e. US 2 letter state codes).", 0, java.lang.Integer.MAX_VALUE, state));
|
||||
childrenList.add(new Property("postalCode", "string", "A postal code designating a region defined by the postal service.", 0, java.lang.Integer.MAX_VALUE, postalCode));
|
||||
childrenList.add(new Property("country", "string", "Country - a nation as commonly understood or generally accepted.", 0, java.lang.Integer.MAX_VALUE, country));
|
||||
|
@ -754,6 +806,7 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
dst.line.add(i.copy());
|
||||
};
|
||||
dst.city = city == null ? null : city.copy();
|
||||
dst.district = district == null ? null : district.copy();
|
||||
dst.state = state == null ? null : state.copy();
|
||||
dst.postalCode = postalCode == null ? null : postalCode.copy();
|
||||
dst.country = country == null ? null : country.copy();
|
||||
|
@ -773,9 +826,9 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
return false;
|
||||
Address o = (Address) other;
|
||||
return compareDeep(use, o.use, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
|
||||
&& compareDeep(line, o.line, true) && compareDeep(city, o.city, true) && compareDeep(state, o.state, true)
|
||||
&& compareDeep(postalCode, o.postalCode, true) && compareDeep(country, o.country, true) && compareDeep(period, o.period, true)
|
||||
;
|
||||
&& compareDeep(line, o.line, true) && compareDeep(city, o.city, true) && compareDeep(district, o.district, true)
|
||||
&& compareDeep(state, o.state, true) && compareDeep(postalCode, o.postalCode, true) && compareDeep(country, o.country, true)
|
||||
&& compareDeep(period, o.period, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -786,15 +839,16 @@ P.O. Box number, delivery hints, and similar address information.)
|
|||
return false;
|
||||
Address o = (Address) other;
|
||||
return compareValues(use, o.use, true) && compareValues(type, o.type, true) && compareValues(text, o.text, true)
|
||||
&& compareValues(line, o.line, true) && compareValues(city, o.city, true) && compareValues(state, o.state, true)
|
||||
&& compareValues(postalCode, o.postalCode, true) && compareValues(country, o.country, true);
|
||||
&& compareValues(line, o.line, true) && compareValues(city, o.city, true) && compareValues(district, o.district, true)
|
||||
&& compareValues(state, o.state, true) && compareValues(postalCode, o.postalCode, true) && compareValues(country, o.country, true)
|
||||
;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (use == null || use.isEmpty()) && (type == null || type.isEmpty())
|
||||
&& (text == null || text.isEmpty()) && (line == null || line.isEmpty()) && (city == null || city.isEmpty())
|
||||
&& (state == null || state.isEmpty()) && (postalCode == null || postalCode.isEmpty()) && (country == null || country.isEmpty())
|
||||
&& (period == null || period.isEmpty());
|
||||
&& (district == null || district.isEmpty()) && (state == null || state.isEmpty()) && (postalCode == null || postalCode.isEmpty())
|
||||
&& (country == null || country.isEmpty()) && (period == null || period.isEmpty());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
|
@ -40,14 +40,14 @@ import org.hl7.fhir.instance.model.api.*;
|
|||
@DatatypeDef(name="Age")
|
||||
public class Age extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
private static final long serialVersionUID = 1069574054L;
|
||||
|
||||
public Age copy() {
|
||||
Age dst = new Age();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
dst.comparator = comparator == null ? null : comparator.copy();
|
||||
dst.units = units == null ? null : units.copy();
|
||||
dst.unit = unit == null ? null : unit.copy();
|
||||
dst.system = system == null ? null : system.copy();
|
||||
dst.code = code == null ? null : code.copy();
|
||||
return dst;
|
||||
|
@ -64,7 +64,7 @@ public class Age extends Quantity {
|
|||
if (!(other instanceof Age))
|
||||
return false;
|
||||
Age o = (Age) other;
|
||||
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
|
||||
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
|
||||
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,13 @@ public class Age extends Quantity {
|
|||
if (!(other instanceof Age))
|
||||
return false;
|
||||
Age o = (Age) other;
|
||||
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
|
||||
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
|
||||
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
|
||||
&& (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
|
||||
&& (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -3543,8 +3543,6 @@ public class AuditEvent extends DomainResource {
|
|||
public static final String SP_DATE = "date";
|
||||
@SearchParamDefinition(name="address", path="AuditEvent.participant.network.identifier", description="Identifier for the network access point of the user device", type="token" )
|
||||
public static final String SP_ADDRESS = "address";
|
||||
@SearchParamDefinition(name="patientid", path="", description="The id of the patient (one of multiple kinds of participations)", type="token" )
|
||||
public static final String SP_PATIENTID = "patientid";
|
||||
@SearchParamDefinition(name="source", path="AuditEvent.source.identifier", description="The id of source where event originated", type="token" )
|
||||
public static final String SP_SOURCE = "source";
|
||||
@SearchParamDefinition(name="type", path="AuditEvent.event.type", description="Type/identifier of event", type="token" )
|
||||
|
@ -3561,7 +3559,7 @@ public class AuditEvent extends DomainResource {
|
|||
public static final String SP_SUBTYPE = "subtype";
|
||||
@SearchParamDefinition(name="identity", path="AuditEvent.object.identifier", description="Specific instance of object (e.g. versioned)", type="token" )
|
||||
public static final String SP_IDENTITY = "identity";
|
||||
@SearchParamDefinition(name="patient", path="", description="A patient that the .object.reference refers to", type="reference" )
|
||||
@SearchParamDefinition(name="patient", path="AuditEvent.participant.reference|AuditEvent.object.reference", description="Direct reference to resource", type="reference" )
|
||||
public static final String SP_PATIENT = "patient";
|
||||
@SearchParamDefinition(name="object-type", path="AuditEvent.object.type", description="Type of object involved", type="token" )
|
||||
public static final String SP_OBJECTTYPE = "object-type";
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -19,7 +19,12 @@ private Map<String, Object> userData;
|
|||
/**
|
||||
* Round tracking xml comments for testing convenience
|
||||
*/
|
||||
private List<String> formatComments;
|
||||
private List<String> formatCommentsPre;
|
||||
|
||||
/**
|
||||
* Round tracking xml comments for testing convenience
|
||||
*/
|
||||
private List<String> formatCommentsPost;
|
||||
|
||||
|
||||
public Object getUserData(String name) {
|
||||
|
@ -61,13 +66,19 @@ private Map<String, Object> userData;
|
|||
}
|
||||
|
||||
public boolean hasFormatComment() {
|
||||
return (formatComments != null && !formatComments.isEmpty());
|
||||
return (formatCommentsPre != null && !formatCommentsPre.isEmpty()) || (formatCommentsPost != null && !formatCommentsPost.isEmpty());
|
||||
}
|
||||
|
||||
public List<String> getFormatComments() {
|
||||
if (formatComments == null)
|
||||
formatComments = new ArrayList<String>();
|
||||
return formatComments;
|
||||
public List<String> getFormatCommentsPre() {
|
||||
if (formatCommentsPre == null)
|
||||
formatCommentsPre = new ArrayList<String>();
|
||||
return formatCommentsPre;
|
||||
}
|
||||
|
||||
public List<String> getFormatCommentsPost() {
|
||||
if (formatCommentsPost == null)
|
||||
formatCommentsPost = new ArrayList<String>();
|
||||
return formatCommentsPost;
|
||||
}
|
||||
|
||||
protected abstract void listChildren(List<Property> result) ;
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -2067,11 +2067,11 @@ public class Bundle extends Resource implements IBaseBundle {
|
|||
return ResourceType.Bundle;
|
||||
}
|
||||
|
||||
@SearchParamDefinition(name="composition", path="", description="The first resource in the bundle, if the bundle type is 'document' - this is a composition, and this parameter provides access to searches its contents", type="reference" )
|
||||
@SearchParamDefinition(name="composition", path="Bundle.entry.resource(0)", description="The first resource in the bundle, if the bundle type is 'document' - this is a composition, and this parameter provides access to searches its contents", type="reference" )
|
||||
public static final String SP_COMPOSITION = "composition";
|
||||
@SearchParamDefinition(name="type", path="Bundle.type", description="document | message | transaction | transaction-response | batch | batch-response | history | searchset | collection", type="token" )
|
||||
public static final String SP_TYPE = "type";
|
||||
@SearchParamDefinition(name="message", path="", description="The first resource in the bundle, if the bundle type is 'message' - this is a message header, and this parameter provides access to search its contents", type="reference" )
|
||||
@SearchParamDefinition(name="message", path="Bundle.entry.resource(0)", description="The first resource in the bundle, if the bundle type is 'message' - this is a message header, and this parameter provides access to search its contents", type="reference" )
|
||||
public static final String SP_MESSAGE = "message";
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -568,7 +568,7 @@ public class CarePlan extends DomainResource {
|
|||
/**
|
||||
* The details of the proposed activity represented in a specific resource.
|
||||
*/
|
||||
@Child(name = "reference", type = {Appointment.class, CommunicationRequest.class, DeviceUseRequest.class, DiagnosticOrder.class, MedicationPrescription.class, NutritionOrder.class, Order.class, ProcedureRequest.class, ProcessRequest.class, ReferralRequest.class, Supply.class, VisionPrescription.class}, order=3, min=0, max=1)
|
||||
@Child(name = "reference", type = {Appointment.class, CommunicationRequest.class, DeviceUseRequest.class, DiagnosticOrder.class, MedicationPrescription.class, NutritionOrder.class, Order.class, ProcedureRequest.class, ProcessRequest.class, ReferralRequest.class, SupplyRequest.class, VisionPrescription.class}, order=3, min=0, max=1)
|
||||
@Description(shortDefinition="Activity details defined in specific resource", formalDefinition="The details of the proposed activity represented in a specific resource." )
|
||||
protected Reference reference;
|
||||
|
||||
|
@ -758,7 +758,7 @@ public class CarePlan extends DomainResource {
|
|||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("actionResulting", "Reference(Any)", "Resources that describe follow-on actions resulting from the plan, such as drug prescriptions, encounter records, appointments, etc.", 0, java.lang.Integer.MAX_VALUE, actionResulting));
|
||||
childrenList.add(new Property("notes", "string", "Notes about the execution of the activity.", 0, java.lang.Integer.MAX_VALUE, notes));
|
||||
childrenList.add(new Property("reference", "Reference(Appointment|CommunicationRequest|DeviceUseRequest|DiagnosticOrder|MedicationPrescription|NutritionOrder|Order|ProcedureRequest|ProcessRequest|ReferralRequest|Supply|VisionPrescription)", "The details of the proposed activity represented in a specific resource.", 0, java.lang.Integer.MAX_VALUE, reference));
|
||||
childrenList.add(new Property("reference", "Reference(Appointment|CommunicationRequest|DeviceUseRequest|DiagnosticOrder|MedicationPrescription|NutritionOrder|Order|ProcedureRequest|ProcessRequest|ReferralRequest|SupplyRequest|VisionPrescription)", "The details of the proposed activity represented in a specific resource.", 0, java.lang.Integer.MAX_VALUE, reference));
|
||||
childrenList.add(new Property("detail", "", "A simple summary of a planned activity suitable for a general care plan system (e.g. form driven) that doesn't know about specific resources such as procedure etc.", 0, java.lang.Integer.MAX_VALUE, detail));
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -144,7 +144,7 @@ public class ClinicalImpression extends DomainResource {
|
|||
/**
|
||||
* A record of a specific investigation that was undertaken.
|
||||
*/
|
||||
@Child(name = "item", type = {Observation.class, QuestionnaireAnswers.class, FamilyMemberHistory.class, DiagnosticReport.class}, order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Child(name = "item", type = {Observation.class, QuestionnaireResponse.class, FamilyMemberHistory.class, DiagnosticReport.class}, order=2, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Record of a specific investigation", formalDefinition="A record of a specific investigation that was undertaken." )
|
||||
protected List<Reference> item;
|
||||
/**
|
||||
|
@ -246,7 +246,7 @@ public class ClinicalImpression extends DomainResource {
|
|||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("code", "CodeableConcept", "A name/code for the group ('set') of investigations. Typically, this will be something like 'signs', 'symptoms', 'clinical', 'diagnostic', but the list is not constrained, and others such groups such as (exposure|family|travel|nutitirional) history may be used.", 0, java.lang.Integer.MAX_VALUE, code));
|
||||
childrenList.add(new Property("item", "Reference(Observation|QuestionnaireAnswers|FamilyMemberHistory|DiagnosticReport)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item));
|
||||
childrenList.add(new Property("item", "Reference(Observation|QuestionnaireResponse|FamilyMemberHistory|DiagnosticReport)", "A record of a specific investigation that was undertaken.", 0, java.lang.Integer.MAX_VALUE, item));
|
||||
}
|
||||
|
||||
public ClinicalImpressionInvestigationsComponent copy() {
|
||||
|
@ -710,7 +710,7 @@ public class ClinicalImpression extends DomainResource {
|
|||
/**
|
||||
* Plan of action after assessment.
|
||||
*/
|
||||
@Child(name = "plan", type = {CarePlan.class, Appointment.class, CommunicationRequest.class, DeviceUseRequest.class, DiagnosticOrder.class, MedicationPrescription.class, NutritionOrder.class, Order.class, ProcedureRequest.class, ProcessRequest.class, ReferralRequest.class, Supply.class, VisionPrescription.class}, order=15, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Child(name = "plan", type = {CarePlan.class, Appointment.class, CommunicationRequest.class, DeviceUseRequest.class, DiagnosticOrder.class, MedicationPrescription.class, NutritionOrder.class, Order.class, ProcedureRequest.class, ProcessRequest.class, ReferralRequest.class, SupplyRequest.class, VisionPrescription.class}, order=15, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Plan of action after assessment", formalDefinition="Plan of action after assessment." )
|
||||
protected List<Reference> plan;
|
||||
/**
|
||||
|
@ -722,7 +722,7 @@ public class ClinicalImpression extends DomainResource {
|
|||
/**
|
||||
* Actions taken during assessment.
|
||||
*/
|
||||
@Child(name = "action", type = {ReferralRequest.class, ProcedureRequest.class, Procedure.class, MedicationPrescription.class, DiagnosticOrder.class, NutritionOrder.class, Supply.class, Appointment.class}, order=16, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Child(name = "action", type = {ReferralRequest.class, ProcedureRequest.class, Procedure.class, MedicationPrescription.class, DiagnosticOrder.class, NutritionOrder.class, SupplyRequest.class, Appointment.class}, order=16, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Actions taken during assessment", formalDefinition="Actions taken during assessment." )
|
||||
protected List<Reference> action;
|
||||
/**
|
||||
|
@ -1540,8 +1540,8 @@ public class ClinicalImpression extends DomainResource {
|
|||
childrenList.add(new Property("resolved", "CodeableConcept", "Diagnoses/conditions resolved since the last assessment.", 0, java.lang.Integer.MAX_VALUE, resolved));
|
||||
childrenList.add(new Property("ruledOut", "", "Diagnosis considered not possible.", 0, java.lang.Integer.MAX_VALUE, ruledOut));
|
||||
childrenList.add(new Property("prognosis", "string", "Estimate of likely outcome.", 0, java.lang.Integer.MAX_VALUE, prognosis));
|
||||
childrenList.add(new Property("plan", "Reference(CarePlan|Appointment|CommunicationRequest|DeviceUseRequest|DiagnosticOrder|MedicationPrescription|NutritionOrder|Order|ProcedureRequest|ProcessRequest|ReferralRequest|Supply|VisionPrescription)", "Plan of action after assessment.", 0, java.lang.Integer.MAX_VALUE, plan));
|
||||
childrenList.add(new Property("action", "Reference(ReferralRequest|ProcedureRequest|Procedure|MedicationPrescription|DiagnosticOrder|NutritionOrder|Supply|Appointment)", "Actions taken during assessment.", 0, java.lang.Integer.MAX_VALUE, action));
|
||||
childrenList.add(new Property("plan", "Reference(CarePlan|Appointment|CommunicationRequest|DeviceUseRequest|DiagnosticOrder|MedicationPrescription|NutritionOrder|Order|ProcedureRequest|ProcessRequest|ReferralRequest|SupplyRequest|VisionPrescription)", "Plan of action after assessment.", 0, java.lang.Integer.MAX_VALUE, plan));
|
||||
childrenList.add(new Property("action", "Reference(ReferralRequest|ProcedureRequest|Procedure|MedicationPrescription|DiagnosticOrder|NutritionOrder|SupplyRequest|Appointment)", "Actions taken during assessment.", 0, java.lang.Integer.MAX_VALUE, action));
|
||||
}
|
||||
|
||||
public ClinicalImpression copy() {
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -706,25 +706,53 @@ public class Composition extends DomainResource {
|
|||
protected CodeableConcept code;
|
||||
|
||||
/**
|
||||
* The content (narrative and data entries) associated with the section.
|
||||
* A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.
|
||||
*/
|
||||
@Child(name = "content", type = {List_.class}, order=3, min=0, max=1)
|
||||
@Description(shortDefinition="The Content of the section (narrative + data entries)", formalDefinition="The content (narrative and data entries) associated with the section." )
|
||||
protected Reference content;
|
||||
@Child(name = "text", type = {Narrative.class}, order=3, min=0, max=1)
|
||||
@Description(shortDefinition="Text summary of the section, for human interpretation", formalDefinition="A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it 'clinically safe' for a human to just read the narrative." )
|
||||
protected Narrative text;
|
||||
|
||||
/**
|
||||
* The actual object that is the target of the reference (The content (narrative and data entries) associated with the section.)
|
||||
* How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
|
||||
*/
|
||||
protected List_ contentTarget;
|
||||
@Child(name = "mode", type = {CodeType.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="working | snapshot | changes", formalDefinition="How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted." )
|
||||
protected CodeType mode;
|
||||
|
||||
/**
|
||||
* What order applies to the items in the section entries.
|
||||
*/
|
||||
@Child(name = "orderedBy", type = {CodeableConcept.class}, order=5, min=0, max=1)
|
||||
@Description(shortDefinition="What order the section entries are in", formalDefinition="What order applies to the items in the section entries." )
|
||||
protected CodeableConcept orderedBy;
|
||||
|
||||
/**
|
||||
* A reference to the actual resource from which the narrative in the section is derived.
|
||||
*/
|
||||
@Child(name = "entry", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="A reference to data that supports this section", formalDefinition="A reference to the actual resource from which the narrative in the section is derived." )
|
||||
protected List<Reference> entry;
|
||||
/**
|
||||
* The actual objects that are the target of the reference (A reference to the actual resource from which the narrative in the section is derived.)
|
||||
*/
|
||||
protected List<Resource> entryTarget;
|
||||
|
||||
|
||||
/**
|
||||
* If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.
|
||||
*/
|
||||
@Child(name = "emptyReason", type = {CodeableConcept.class}, order=7, min=0, max=1)
|
||||
@Description(shortDefinition="Why the section is empty", formalDefinition="If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason." )
|
||||
protected CodeableConcept emptyReason;
|
||||
|
||||
/**
|
||||
* A nested sub-section within this section.
|
||||
*/
|
||||
@Child(name = "section", type = {SectionComponent.class}, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Child(name = "section", type = {SectionComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Nested Section", formalDefinition="A nested sub-section within this section." )
|
||||
protected List<SectionComponent> section;
|
||||
|
||||
private static final long serialVersionUID = -1683518435L;
|
||||
private static final long serialVersionUID = -726390626L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
|
@ -807,46 +835,172 @@ public class Composition extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #content} (The content (narrative and data entries) associated with the section.)
|
||||
* @return {@link #text} (A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.)
|
||||
*/
|
||||
public Reference getContent() {
|
||||
if (this.content == null)
|
||||
public Narrative getText() {
|
||||
if (this.text == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create SectionComponent.content");
|
||||
throw new Error("Attempt to auto-create SectionComponent.text");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.content = new Reference(); // cc
|
||||
return this.content;
|
||||
this.text = new Narrative(); // cc
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public boolean hasContent() {
|
||||
return this.content != null && !this.content.isEmpty();
|
||||
public boolean hasText() {
|
||||
return this.text != null && !this.text.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #content} (The content (narrative and data entries) associated with the section.)
|
||||
* @param value {@link #text} (A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative.)
|
||||
*/
|
||||
public SectionComponent setContent(Reference value) {
|
||||
this.content = value;
|
||||
public SectionComponent setText(Narrative value) {
|
||||
this.text = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #content} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The content (narrative and data entries) associated with the section.)
|
||||
* @return {@link #mode} (How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
|
||||
*/
|
||||
public List_ getContentTarget() {
|
||||
if (this.contentTarget == null)
|
||||
public CodeType getModeElement() {
|
||||
if (this.mode == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create SectionComponent.content");
|
||||
throw new Error("Attempt to auto-create SectionComponent.mode");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.contentTarget = new List_(); // aa
|
||||
return this.contentTarget;
|
||||
this.mode = new CodeType(); // bb
|
||||
return this.mode;
|
||||
}
|
||||
|
||||
public boolean hasModeElement() {
|
||||
return this.mode != null && !this.mode.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasMode() {
|
||||
return this.mode != null && !this.mode.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #content} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The content (narrative and data entries) associated with the section.)
|
||||
* @param value {@link #mode} (How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.). This is the underlying object with id, value and extensions. The accessor "getMode" gives direct access to the value
|
||||
*/
|
||||
public SectionComponent setContentTarget(List_ value) {
|
||||
this.contentTarget = value;
|
||||
public SectionComponent setModeElement(CodeType value) {
|
||||
this.mode = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
|
||||
*/
|
||||
public String getMode() {
|
||||
return this.mode == null ? null : this.mode.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.
|
||||
*/
|
||||
public SectionComponent setMode(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.mode = null;
|
||||
else {
|
||||
if (this.mode == null)
|
||||
this.mode = new CodeType();
|
||||
this.mode.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #orderedBy} (What order applies to the items in the section entries.)
|
||||
*/
|
||||
public CodeableConcept getOrderedBy() {
|
||||
if (this.orderedBy == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create SectionComponent.orderedBy");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.orderedBy = new CodeableConcept(); // cc
|
||||
return this.orderedBy;
|
||||
}
|
||||
|
||||
public boolean hasOrderedBy() {
|
||||
return this.orderedBy != null && !this.orderedBy.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #orderedBy} (What order applies to the items in the section entries.)
|
||||
*/
|
||||
public SectionComponent setOrderedBy(CodeableConcept value) {
|
||||
this.orderedBy = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #entry} (A reference to the actual resource from which the narrative in the section is derived.)
|
||||
*/
|
||||
public List<Reference> getEntry() {
|
||||
if (this.entry == null)
|
||||
this.entry = new ArrayList<Reference>();
|
||||
return this.entry;
|
||||
}
|
||||
|
||||
public boolean hasEntry() {
|
||||
if (this.entry == null)
|
||||
return false;
|
||||
for (Reference item : this.entry)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #entry} (A reference to the actual resource from which the narrative in the section is derived.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public Reference addEntry() { //3
|
||||
Reference t = new Reference();
|
||||
if (this.entry == null)
|
||||
this.entry = new ArrayList<Reference>();
|
||||
this.entry.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public SectionComponent addEntry(Reference t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.entry == null)
|
||||
this.entry = new ArrayList<Reference>();
|
||||
this.entry.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #entry} (The actual objects that are the target of the reference. The reference library doesn't populate this, but you can use this to hold the resources if you resolvethemt. A reference to the actual resource from which the narrative in the section is derived.)
|
||||
*/
|
||||
public List<Resource> getEntryTarget() {
|
||||
if (this.entryTarget == null)
|
||||
this.entryTarget = new ArrayList<Resource>();
|
||||
return this.entryTarget;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #emptyReason} (If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.)
|
||||
*/
|
||||
public CodeableConcept getEmptyReason() {
|
||||
if (this.emptyReason == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create SectionComponent.emptyReason");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.emptyReason = new CodeableConcept(); // cc
|
||||
return this.emptyReason;
|
||||
}
|
||||
|
||||
public boolean hasEmptyReason() {
|
||||
return this.emptyReason != null && !this.emptyReason.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #emptyReason} (If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.)
|
||||
*/
|
||||
public SectionComponent setEmptyReason(CodeableConcept value) {
|
||||
this.emptyReason = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -894,7 +1048,11 @@ public class Composition extends DomainResource {
|
|||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("title", "string", "The label for this particular section. This will be part of the rendered content for the document, and is often used to build a table of contents.", 0, java.lang.Integer.MAX_VALUE, title));
|
||||
childrenList.add(new Property("code", "CodeableConcept", "A code identifying the kind of content contained within the section. This must be consistent with the section title.", 0, java.lang.Integer.MAX_VALUE, code));
|
||||
childrenList.add(new Property("content", "Reference(List)", "The content (narrative and data entries) associated with the section.", 0, java.lang.Integer.MAX_VALUE, content));
|
||||
childrenList.add(new Property("text", "Narrative", "A human-readable narrative that contains the attested content of the section, used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it 'clinically safe' for a human to just read the narrative.", 0, java.lang.Integer.MAX_VALUE, text));
|
||||
childrenList.add(new Property("mode", "code", "How the entry list was prepared - whether it is a working list that is suitable for being maintained on an ongoing basis, or if it represents a snapshot of a list of items from another source, or whether it is a prepared list where items may be marked as added, modified or deleted.", 0, java.lang.Integer.MAX_VALUE, mode));
|
||||
childrenList.add(new Property("orderedBy", "CodeableConcept", "What order applies to the items in the section entries.", 0, java.lang.Integer.MAX_VALUE, orderedBy));
|
||||
childrenList.add(new Property("entry", "Reference(Any)", "A reference to the actual resource from which the narrative in the section is derived.", 0, java.lang.Integer.MAX_VALUE, entry));
|
||||
childrenList.add(new Property("emptyReason", "CodeableConcept", "If the section is empty, why the list is empty. An empty section typically has some text explaining the empty reason.", 0, java.lang.Integer.MAX_VALUE, emptyReason));
|
||||
childrenList.add(new Property("section", "@Composition.section", "A nested sub-section within this section.", 0, java.lang.Integer.MAX_VALUE, section));
|
||||
}
|
||||
|
||||
|
@ -903,7 +1061,15 @@ public class Composition extends DomainResource {
|
|||
copyValues(dst);
|
||||
dst.title = title == null ? null : title.copy();
|
||||
dst.code = code == null ? null : code.copy();
|
||||
dst.content = content == null ? null : content.copy();
|
||||
dst.text = text == null ? null : text.copy();
|
||||
dst.mode = mode == null ? null : mode.copy();
|
||||
dst.orderedBy = orderedBy == null ? null : orderedBy.copy();
|
||||
if (entry != null) {
|
||||
dst.entry = new ArrayList<Reference>();
|
||||
for (Reference i : entry)
|
||||
dst.entry.add(i.copy());
|
||||
};
|
||||
dst.emptyReason = emptyReason == null ? null : emptyReason.copy();
|
||||
if (section != null) {
|
||||
dst.section = new ArrayList<SectionComponent>();
|
||||
for (SectionComponent i : section)
|
||||
|
@ -919,8 +1085,9 @@ public class Composition extends DomainResource {
|
|||
if (!(other instanceof SectionComponent))
|
||||
return false;
|
||||
SectionComponent o = (SectionComponent) other;
|
||||
return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(content, o.content, true)
|
||||
&& compareDeep(section, o.section, true);
|
||||
return compareDeep(title, o.title, true) && compareDeep(code, o.code, true) && compareDeep(text, o.text, true)
|
||||
&& compareDeep(mode, o.mode, true) && compareDeep(orderedBy, o.orderedBy, true) && compareDeep(entry, o.entry, true)
|
||||
&& compareDeep(emptyReason, o.emptyReason, true) && compareDeep(section, o.section, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -930,12 +1097,14 @@ public class Composition extends DomainResource {
|
|||
if (!(other instanceof SectionComponent))
|
||||
return false;
|
||||
SectionComponent o = (SectionComponent) other;
|
||||
return compareValues(title, o.title, true);
|
||||
return compareValues(title, o.title, true) && compareValues(mode, o.mode, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (title == null || title.isEmpty()) && (code == null || code.isEmpty())
|
||||
&& (content == null || content.isEmpty()) && (section == null || section.isEmpty());
|
||||
&& (text == null || text.isEmpty()) && (mode == null || mode.isEmpty()) && (orderedBy == null || orderedBy.isEmpty())
|
||||
&& (entry == null || entry.isEmpty()) && (emptyReason == null || emptyReason.isEmpty()) && (section == null || section.isEmpty())
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1744,9 +1913,7 @@ public class Composition extends DomainResource {
|
|||
public static final String SP_AUTHOR = "author";
|
||||
@SearchParamDefinition(name="confidentiality", path="Composition.confidentiality", description="As defined by affinity domain", type="token" )
|
||||
public static final String SP_CONFIDENTIALITY = "confidentiality";
|
||||
@SearchParamDefinition(name="section-code", path="Composition.section.code", description="Classification of section (recommended)", type="token" )
|
||||
public static final String SP_SECTIONCODE = "section-code";
|
||||
@SearchParamDefinition(name="section", path="Composition.section.content", description="The Content of the section (narrative + data entries)", type="reference" )
|
||||
@SearchParamDefinition(name="section", path="Composition.section.code", description="Classification of section (recommended)", type="token" )
|
||||
public static final String SP_SECTION = "section";
|
||||
@SearchParamDefinition(name="encounter", path="Composition.encounter", description="Context of the conposition", type="reference" )
|
||||
public static final String SP_ENCOUNTER = "encounter";
|
||||
|
@ -1756,6 +1923,8 @@ public class Composition extends DomainResource {
|
|||
public static final String SP_TITLE = "title";
|
||||
@SearchParamDefinition(name="attester", path="Composition.attester.party", description="Who attested the composition", type="reference" )
|
||||
public static final String SP_ATTESTER = "attester";
|
||||
@SearchParamDefinition(name="entry", path="Composition.section.entry", description="A reference to data that supports this section", type="reference" )
|
||||
public static final String SP_ENTRY = "entry";
|
||||
@SearchParamDefinition(name="patient", path="Composition.subject", description="Who and/or what the composition is about", type="reference" )
|
||||
public static final String SP_PATIENT = "patient";
|
||||
@SearchParamDefinition(name="context", path="Composition.event.code", description="Code(s) that apply to the event being documented", type="token" )
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -1041,10 +1041,10 @@ public class ConceptMap extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).
|
||||
* An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published.
|
||||
*/
|
||||
@Child(name = "url", type = {UriType.class}, order=0, min=0, max=1)
|
||||
@Description(shortDefinition="Globally unique logical id for concept map", formalDefinition="An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:)." )
|
||||
@Description(shortDefinition="Globally unique logical id for concept map", formalDefinition="An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published." )
|
||||
protected UriType url;
|
||||
|
||||
/**
|
||||
|
@ -1068,69 +1068,69 @@ public class ConceptMap extends DomainResource {
|
|||
@Description(shortDefinition="Informal name for this concept map", formalDefinition="A free text natural language name describing the concept map." )
|
||||
protected StringType name;
|
||||
|
||||
/**
|
||||
* The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.
|
||||
*/
|
||||
@Child(name = "useContext", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps." )
|
||||
protected List<CodeableConcept> useContext;
|
||||
|
||||
/**
|
||||
* The name of the individual or organization that published the concept map.
|
||||
*/
|
||||
@Child(name = "publisher", type = {StringType.class}, order=5, min=0, max=1)
|
||||
@Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the concept map." )
|
||||
protected StringType publisher;
|
||||
|
||||
/**
|
||||
* Contacts to assist a user in finding and communicating with the publisher.
|
||||
*/
|
||||
@Child(name = "contact", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
|
||||
protected List<ConceptMapContactComponent> contact;
|
||||
|
||||
/**
|
||||
* A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
|
||||
*/
|
||||
@Child(name = "description", type = {StringType.class}, order=7, min=0, max=1)
|
||||
@Description(shortDefinition="Human language description of the concept map", formalDefinition="A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc." )
|
||||
protected StringType description;
|
||||
|
||||
/**
|
||||
* Explains why this concept map is needed and why it's been constrained as it has.
|
||||
*/
|
||||
@Child(name = "requirements", type = {StringType.class}, order=8, min=0, max=1)
|
||||
@Description(shortDefinition="Why is this needed?", formalDefinition="Explains why this concept map is needed and why it's been constrained as it has." )
|
||||
protected StringType requirements;
|
||||
|
||||
/**
|
||||
* A copyright statement relating to the concept map and/or its contents.
|
||||
*/
|
||||
@Child(name = "copyright", type = {StringType.class}, order=9, min=0, max=1)
|
||||
@Description(shortDefinition="Use and/or Publishing restrictions", formalDefinition="A copyright statement relating to the concept map and/or its contents." )
|
||||
protected StringType copyright;
|
||||
|
||||
/**
|
||||
* The status of the concept map.
|
||||
*/
|
||||
@Child(name = "status", type = {CodeType.class}, order=10, min=1, max=1)
|
||||
@Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1)
|
||||
@Description(shortDefinition="draft | active | retired", formalDefinition="The status of the concept map." )
|
||||
protected Enumeration<ConformanceResourceStatus> status;
|
||||
|
||||
/**
|
||||
* This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
@Child(name = "experimental", type = {BooleanType.class}, order=11, min=0, max=1)
|
||||
@Child(name = "experimental", type = {BooleanType.class}, order=5, min=0, max=1)
|
||||
@Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
|
||||
protected BooleanType experimental;
|
||||
|
||||
/**
|
||||
* The date that the concept map status was last changed.
|
||||
* The name of the individual or organization that published the concept map.
|
||||
*/
|
||||
@Child(name = "date", type = {DateTimeType.class}, order=12, min=0, max=1)
|
||||
@Description(shortDefinition="Date for given status", formalDefinition="The date that the concept map status was last changed." )
|
||||
@Child(name = "publisher", type = {StringType.class}, order=6, min=0, max=1)
|
||||
@Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the concept map." )
|
||||
protected StringType publisher;
|
||||
|
||||
/**
|
||||
* Contacts to assist a user in finding and communicating with the publisher.
|
||||
*/
|
||||
@Child(name = "contact", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
|
||||
protected List<ConceptMapContactComponent> contact;
|
||||
|
||||
/**
|
||||
* The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes.
|
||||
*/
|
||||
@Child(name = "date", type = {DateTimeType.class}, order=8, min=0, max=1)
|
||||
@Description(shortDefinition="Date for given status", formalDefinition="The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes." )
|
||||
protected DateTimeType date;
|
||||
|
||||
/**
|
||||
* A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.
|
||||
*/
|
||||
@Child(name = "description", type = {StringType.class}, order=9, min=0, max=1)
|
||||
@Description(shortDefinition="Human language description of the concept map", formalDefinition="A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc." )
|
||||
protected StringType description;
|
||||
|
||||
/**
|
||||
* The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.
|
||||
*/
|
||||
@Child(name = "useContext", type = {CodeableConcept.class}, order=10, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps." )
|
||||
protected List<CodeableConcept> useContext;
|
||||
|
||||
/**
|
||||
* Explains why this concept map is needed and why it's been constrained as it has.
|
||||
*/
|
||||
@Child(name = "requirements", type = {StringType.class}, order=11, min=0, max=1)
|
||||
@Description(shortDefinition="Why is this needed?", formalDefinition="Explains why this concept map is needed and why it's been constrained as it has." )
|
||||
protected StringType requirements;
|
||||
|
||||
/**
|
||||
* A copyright statement relating to the concept map and/or its contents.
|
||||
*/
|
||||
@Child(name = "copyright", type = {StringType.class}, order=12, min=0, max=1)
|
||||
@Description(shortDefinition="Use and/or Publishing restrictions", formalDefinition="A copyright statement relating to the concept map and/or its contents." )
|
||||
protected StringType copyright;
|
||||
|
||||
/**
|
||||
* The source value set that specifies the concepts that are being mapped.
|
||||
*/
|
||||
|
@ -1152,7 +1152,7 @@ public class ConceptMap extends DomainResource {
|
|||
@Description(shortDefinition="Mappings for a concept from the source set", formalDefinition="Mappings for an individual concept in the source to one or more concepts in the target." )
|
||||
protected List<SourceElementComponent> element;
|
||||
|
||||
private static final long serialVersionUID = -1713063390L;
|
||||
private static final long serialVersionUID = 1687563642L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
|
@ -1172,7 +1172,7 @@ public class ConceptMap extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #url} (An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
* @return {@link #url} (An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
*/
|
||||
public UriType getUrlElement() {
|
||||
if (this.url == null)
|
||||
|
@ -1192,7 +1192,7 @@ public class ConceptMap extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #url} (An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
* @param value {@link #url} (An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
*/
|
||||
public ConceptMap setUrlElement(UriType value) {
|
||||
this.url = value;
|
||||
|
@ -1200,14 +1200,14 @@ public class ConceptMap extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).
|
||||
* @return An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published.
|
||||
*/
|
||||
public String getUrl() {
|
||||
return this.url == null ? null : this.url.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).
|
||||
* @param value An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published.
|
||||
*/
|
||||
public ConceptMap setUrl(String value) {
|
||||
if (Utilities.noString(value))
|
||||
|
@ -1343,42 +1343,92 @@ public class ConceptMap extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.)
|
||||
* @return {@link #status} (The status of the concept map.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
|
||||
*/
|
||||
public List<CodeableConcept> getUseContext() {
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
return this.useContext;
|
||||
public Enumeration<ConformanceResourceStatus> getStatusElement() {
|
||||
if (this.status == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ConceptMap.status");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public boolean hasUseContext() {
|
||||
if (this.useContext == null)
|
||||
return false;
|
||||
for (CodeableConcept item : this.useContext)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
public boolean hasStatusElement() {
|
||||
return this.status != null && !this.status.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasStatus() {
|
||||
return this.status != null && !this.status.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.)
|
||||
* @param value {@link #status} (The status of the concept map.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
|
||||
*/
|
||||
// syntactic sugar
|
||||
public CodeableConcept addUseContext() { //3
|
||||
CodeableConcept t = new CodeableConcept();
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return t;
|
||||
public ConceptMap setStatusElement(Enumeration<ConformanceResourceStatus> value) {
|
||||
this.status = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public ConceptMap addUseContext(CodeableConcept t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
/**
|
||||
* @return The status of the concept map.
|
||||
*/
|
||||
public ConformanceResourceStatus getStatus() {
|
||||
return this.status == null ? null : this.status.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The status of the concept map.
|
||||
*/
|
||||
public ConceptMap setStatus(ConformanceResourceStatus value) {
|
||||
if (this.status == null)
|
||||
this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
|
||||
this.status.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #experimental} (This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public BooleanType getExperimentalElement() {
|
||||
if (this.experimental == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ConceptMap.experimental");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.experimental = new BooleanType(); // bb
|
||||
return this.experimental;
|
||||
}
|
||||
|
||||
public boolean hasExperimentalElement() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasExperimental() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #experimental} (This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public ConceptMap setExperimentalElement(BooleanType value) {
|
||||
this.experimental = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public boolean getExperimental() {
|
||||
return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public ConceptMap setExperimental(boolean value) {
|
||||
if (this.experimental == null)
|
||||
this.experimental = new BooleanType();
|
||||
this.experimental.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1471,6 +1521,55 @@ public class ConceptMap extends DomainResource {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #date} (The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
*/
|
||||
public DateTimeType getDateElement() {
|
||||
if (this.date == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ConceptMap.date");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.date = new DateTimeType(); // bb
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public boolean hasDateElement() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDate() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #date} (The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
*/
|
||||
public ConceptMap setDateElement(DateTimeType value) {
|
||||
this.date = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes.
|
||||
*/
|
||||
public Date getDate() {
|
||||
return this.date == null ? null : this.date.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes.
|
||||
*/
|
||||
public ConceptMap setDate(Date value) {
|
||||
if (value == null)
|
||||
this.date = null;
|
||||
else {
|
||||
if (this.date == null)
|
||||
this.date = new DateTimeType();
|
||||
this.date.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #description} (A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.). This is the underlying object with id, value and extensions. The accessor "getDescription" gives direct access to the value
|
||||
*/
|
||||
|
@ -1520,6 +1619,46 @@ public class ConceptMap extends DomainResource {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.)
|
||||
*/
|
||||
public List<CodeableConcept> getUseContext() {
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
return this.useContext;
|
||||
}
|
||||
|
||||
public boolean hasUseContext() {
|
||||
if (this.useContext == null)
|
||||
return false;
|
||||
for (CodeableConcept item : this.useContext)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public CodeableConcept addUseContext() { //3
|
||||
CodeableConcept t = new CodeableConcept();
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public ConceptMap addUseContext(CodeableConcept t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #requirements} (Explains why this concept map is needed and why it's been constrained as it has.). This is the underlying object with id, value and extensions. The accessor "getRequirements" gives direct access to the value
|
||||
*/
|
||||
|
@ -1618,145 +1757,6 @@ public class ConceptMap extends DomainResource {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #status} (The status of the concept map.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
|
||||
*/
|
||||
public Enumeration<ConformanceResourceStatus> getStatusElement() {
|
||||
if (this.status == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ConceptMap.status");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory()); // bb
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public boolean hasStatusElement() {
|
||||
return this.status != null && !this.status.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasStatus() {
|
||||
return this.status != null && !this.status.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #status} (The status of the concept map.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
|
||||
*/
|
||||
public ConceptMap setStatusElement(Enumeration<ConformanceResourceStatus> value) {
|
||||
this.status = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The status of the concept map.
|
||||
*/
|
||||
public ConformanceResourceStatus getStatus() {
|
||||
return this.status == null ? null : this.status.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The status of the concept map.
|
||||
*/
|
||||
public ConceptMap setStatus(ConformanceResourceStatus value) {
|
||||
if (this.status == null)
|
||||
this.status = new Enumeration<ConformanceResourceStatus>(new ConformanceResourceStatusEnumFactory());
|
||||
this.status.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #experimental} (This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public BooleanType getExperimentalElement() {
|
||||
if (this.experimental == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ConceptMap.experimental");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.experimental = new BooleanType(); // bb
|
||||
return this.experimental;
|
||||
}
|
||||
|
||||
public boolean hasExperimentalElement() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasExperimental() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #experimental} (This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public ConceptMap setExperimentalElement(BooleanType value) {
|
||||
this.experimental = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public boolean getExperimental() {
|
||||
return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public ConceptMap setExperimental(boolean value) {
|
||||
if (this.experimental == null)
|
||||
this.experimental = new BooleanType();
|
||||
this.experimental.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #date} (The date that the concept map status was last changed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
*/
|
||||
public DateTimeType getDateElement() {
|
||||
if (this.date == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ConceptMap.date");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.date = new DateTimeType(); // bb
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public boolean hasDateElement() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDate() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #date} (The date that the concept map status was last changed.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
*/
|
||||
public ConceptMap setDateElement(DateTimeType value) {
|
||||
this.date = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The date that the concept map status was last changed.
|
||||
*/
|
||||
public Date getDate() {
|
||||
return this.date == null ? null : this.date.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The date that the concept map status was last changed.
|
||||
*/
|
||||
public ConceptMap setDate(Date value) {
|
||||
if (value == null)
|
||||
this.date = null;
|
||||
else {
|
||||
if (this.date == null)
|
||||
this.date = new DateTimeType();
|
||||
this.date.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #source} (The source value set that specifies the concepts that are being mapped.)
|
||||
*/
|
||||
|
@ -1889,19 +1889,19 @@ public class ConceptMap extends DomainResource {
|
|||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("url", "uri", "An absolute uri that is used to identify this concept map when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).", 0, java.lang.Integer.MAX_VALUE, url));
|
||||
childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this concept map when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this concept map is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
|
||||
childrenList.add(new Property("identifier", "Identifier", "Formal identifier that is used to identify this concept map when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
|
||||
childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the concept map when it is referenced in a specification, model, design or instance. This is an arbitrary value managed by the profile author manually and the value should be a timestamp.", 0, java.lang.Integer.MAX_VALUE, version));
|
||||
childrenList.add(new Property("name", "string", "A free text natural language name describing the concept map.", 0, java.lang.Integer.MAX_VALUE, name));
|
||||
childrenList.add(new Property("useContext", "CodeableConcept", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.", 0, java.lang.Integer.MAX_VALUE, useContext));
|
||||
childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the concept map.", 0, java.lang.Integer.MAX_VALUE, publisher));
|
||||
childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
|
||||
childrenList.add(new Property("description", "string", "A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.", 0, java.lang.Integer.MAX_VALUE, description));
|
||||
childrenList.add(new Property("requirements", "string", "Explains why this concept map is needed and why it's been constrained as it has.", 0, java.lang.Integer.MAX_VALUE, requirements));
|
||||
childrenList.add(new Property("copyright", "string", "A copyright statement relating to the concept map and/or its contents.", 0, java.lang.Integer.MAX_VALUE, copyright));
|
||||
childrenList.add(new Property("status", "code", "The status of the concept map.", 0, java.lang.Integer.MAX_VALUE, status));
|
||||
childrenList.add(new Property("experimental", "boolean", "This ConceptMap was authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
|
||||
childrenList.add(new Property("date", "dateTime", "The date that the concept map status was last changed.", 0, java.lang.Integer.MAX_VALUE, date));
|
||||
childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the concept map.", 0, java.lang.Integer.MAX_VALUE, publisher));
|
||||
childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
|
||||
childrenList.add(new Property("date", "dateTime", "The date that this version of the concept map was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the concept map changes.", 0, java.lang.Integer.MAX_VALUE, date));
|
||||
childrenList.add(new Property("description", "string", "A free text natural language description of the use of the concept map - reason for definition, conditions of use, etc.", 0, java.lang.Integer.MAX_VALUE, description));
|
||||
childrenList.add(new Property("useContext", "CodeableConcept", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of concept maps.", 0, java.lang.Integer.MAX_VALUE, useContext));
|
||||
childrenList.add(new Property("requirements", "string", "Explains why this concept map is needed and why it's been constrained as it has.", 0, java.lang.Integer.MAX_VALUE, requirements));
|
||||
childrenList.add(new Property("copyright", "string", "A copyright statement relating to the concept map and/or its contents.", 0, java.lang.Integer.MAX_VALUE, copyright));
|
||||
childrenList.add(new Property("source[x]", "uri|Reference(ValueSet|StructureDefinition)", "The source value set that specifies the concepts that are being mapped.", 0, java.lang.Integer.MAX_VALUE, source));
|
||||
childrenList.add(new Property("target[x]", "uri|Reference(ValueSet|StructureDefinition)", "The target value set provides context to the mappings. Note that the mapping is made between concepts, not between value sets, but the value set provides important context about how the concept mapping choices are made.", 0, java.lang.Integer.MAX_VALUE, target));
|
||||
childrenList.add(new Property("element", "", "Mappings for an individual concept in the source to one or more concepts in the target.", 0, java.lang.Integer.MAX_VALUE, element));
|
||||
|
@ -1914,23 +1914,23 @@ public class ConceptMap extends DomainResource {
|
|||
dst.identifier = identifier == null ? null : identifier.copy();
|
||||
dst.version = version == null ? null : version.copy();
|
||||
dst.name = name == null ? null : name.copy();
|
||||
if (useContext != null) {
|
||||
dst.useContext = new ArrayList<CodeableConcept>();
|
||||
for (CodeableConcept i : useContext)
|
||||
dst.useContext.add(i.copy());
|
||||
};
|
||||
dst.status = status == null ? null : status.copy();
|
||||
dst.experimental = experimental == null ? null : experimental.copy();
|
||||
dst.publisher = publisher == null ? null : publisher.copy();
|
||||
if (contact != null) {
|
||||
dst.contact = new ArrayList<ConceptMapContactComponent>();
|
||||
for (ConceptMapContactComponent i : contact)
|
||||
dst.contact.add(i.copy());
|
||||
};
|
||||
dst.date = date == null ? null : date.copy();
|
||||
dst.description = description == null ? null : description.copy();
|
||||
if (useContext != null) {
|
||||
dst.useContext = new ArrayList<CodeableConcept>();
|
||||
for (CodeableConcept i : useContext)
|
||||
dst.useContext.add(i.copy());
|
||||
};
|
||||
dst.requirements = requirements == null ? null : requirements.copy();
|
||||
dst.copyright = copyright == null ? null : copyright.copy();
|
||||
dst.status = status == null ? null : status.copy();
|
||||
dst.experimental = experimental == null ? null : experimental.copy();
|
||||
dst.date = date == null ? null : date.copy();
|
||||
dst.source = source == null ? null : source.copy();
|
||||
dst.target = target == null ? null : target.copy();
|
||||
if (element != null) {
|
||||
|
@ -1953,11 +1953,12 @@ public class ConceptMap extends DomainResource {
|
|||
return false;
|
||||
ConceptMap o = (ConceptMap) other;
|
||||
return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
|
||||
&& compareDeep(name, o.name, true) && compareDeep(useContext, o.useContext, true) && compareDeep(publisher, o.publisher, true)
|
||||
&& compareDeep(contact, o.contact, true) && compareDeep(description, o.description, true) && compareDeep(requirements, o.requirements, true)
|
||||
&& compareDeep(copyright, o.copyright, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
|
||||
&& compareDeep(date, o.date, true) && compareDeep(source, o.source, true) && compareDeep(target, o.target, true)
|
||||
&& compareDeep(element, o.element, true);
|
||||
&& compareDeep(name, o.name, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
|
||||
&& compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true)
|
||||
&& compareDeep(description, o.description, true) && compareDeep(useContext, o.useContext, true)
|
||||
&& compareDeep(requirements, o.requirements, true) && compareDeep(copyright, o.copyright, true)
|
||||
&& compareDeep(source, o.source, true) && compareDeep(target, o.target, true) && compareDeep(element, o.element, true)
|
||||
;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1968,18 +1969,18 @@ public class ConceptMap extends DomainResource {
|
|||
return false;
|
||||
ConceptMap o = (ConceptMap) other;
|
||||
return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
|
||||
&& compareValues(publisher, o.publisher, true) && compareValues(description, o.description, true) && compareValues(requirements, o.requirements, true)
|
||||
&& compareValues(copyright, o.copyright, true) && compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true)
|
||||
&& compareValues(date, o.date, true);
|
||||
&& compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true) && compareValues(publisher, o.publisher, true)
|
||||
&& compareValues(date, o.date, true) && compareValues(description, o.description, true) && compareValues(requirements, o.requirements, true)
|
||||
&& compareValues(copyright, o.copyright, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
|
||||
&& (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (useContext == null || useContext.isEmpty())
|
||||
&& (publisher == null || publisher.isEmpty()) && (contact == null || contact.isEmpty()) && (description == null || description.isEmpty())
|
||||
&& (requirements == null || requirements.isEmpty()) && (copyright == null || copyright.isEmpty())
|
||||
&& (status == null || status.isEmpty()) && (experimental == null || experimental.isEmpty())
|
||||
&& (date == null || date.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty())
|
||||
&& (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (status == null || status.isEmpty())
|
||||
&& (experimental == null || experimental.isEmpty()) && (publisher == null || publisher.isEmpty())
|
||||
&& (contact == null || contact.isEmpty()) && (date == null || date.isEmpty()) && (description == null || description.isEmpty())
|
||||
&& (useContext == null || useContext.isEmpty()) && (requirements == null || requirements.isEmpty())
|
||||
&& (copyright == null || copyright.isEmpty()) && (source == null || source.isEmpty()) && (target == null || target.isEmpty())
|
||||
&& (element == null || element.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -2000,7 +2001,7 @@ public class ConceptMap extends DomainResource {
|
|||
public static final String SP_DESCRIPTION = "description";
|
||||
@SearchParamDefinition(name="targetsystem", path="ConceptMap.element.target.codeSystem", description="System of the target (if necessary)", type="uri" )
|
||||
public static final String SP_TARGETSYSTEM = "targetsystem";
|
||||
@SearchParamDefinition(name="source", path="ConceptMap.source[x]", description="The system for any concepts mapped by this concept map", type="reference" )
|
||||
@SearchParamDefinition(name="source", path="ConceptMap.sourceReference", description="Identifies the source of the concepts which are being mapped", type="reference" )
|
||||
public static final String SP_SOURCE = "source";
|
||||
@SearchParamDefinition(name="version", path="ConceptMap.version", description="The version identifier of the concept map", type="token" )
|
||||
public static final String SP_VERSION = "version";
|
||||
|
@ -2012,6 +2013,8 @@ public class ConceptMap extends DomainResource {
|
|||
public static final String SP_TARGET = "target";
|
||||
@SearchParamDefinition(name="sourcecode", path="ConceptMap.element.code", description="Identifies element being mapped", type="token" )
|
||||
public static final String SP_SOURCECODE = "sourcecode";
|
||||
@SearchParamDefinition(name="sourceuri", path="ConceptMap.sourceUri", description="Identifies the source of the concepts which are being mapped", type="reference" )
|
||||
public static final String SP_SOURCEURI = "sourceuri";
|
||||
@SearchParamDefinition(name="name", path="ConceptMap.name", description="Name of the concept map", type="string" )
|
||||
public static final String SP_NAME = "name";
|
||||
@SearchParamDefinition(name="context", path="ConceptMap.useContext", description="A use context assigned to the concept map", type="token" )
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -29,12 +29,12 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
|
||||
public class Constants {
|
||||
|
||||
public final static String VERSION = "0.5.0";
|
||||
public final static String REVISION = "5924";
|
||||
public final static String DATE = "Tue Jul 21 10:37:59 EDT 2015";
|
||||
public final static String REVISION = "6166";
|
||||
public final static String DATE = "Fri Aug 07 06:45:35 EDT 2015";
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -294,14 +294,21 @@ public class ContactPoint extends Type implements ICompositeType {
|
|||
@Description(shortDefinition="home | work | temp | old | mobile - purpose of this contact point", formalDefinition="Identifies the purpose for the contact point." )
|
||||
protected Enumeration<ContactPointUse> use;
|
||||
|
||||
/**
|
||||
* Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
|
||||
*/
|
||||
@Child(name = "rank", type = {PositiveIntType.class}, order=3, min=0, max=1)
|
||||
@Description(shortDefinition="Specify preferred order of use (1 = highest)", formalDefinition="Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values." )
|
||||
protected PositiveIntType rank;
|
||||
|
||||
/**
|
||||
* Time period when the contact point was/is in use.
|
||||
*/
|
||||
@Child(name = "period", type = {Period.class}, order=3, min=0, max=1)
|
||||
@Child(name = "period", type = {Period.class}, order=4, min=0, max=1)
|
||||
@Description(shortDefinition="Time period when the contact point was/is in use", formalDefinition="Time period when the contact point was/is in use." )
|
||||
protected Period period;
|
||||
|
||||
private static final long serialVersionUID = 1972725348L;
|
||||
private static final long serialVersionUID = 1509610874L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
|
@ -457,6 +464,51 @@ public class ContactPoint extends Type implements ICompositeType {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
|
||||
*/
|
||||
public PositiveIntType getRankElement() {
|
||||
if (this.rank == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create ContactPoint.rank");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.rank = new PositiveIntType(); // bb
|
||||
return this.rank;
|
||||
}
|
||||
|
||||
public boolean hasRankElement() {
|
||||
return this.rank != null && !this.rank.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasRank() {
|
||||
return this.rank != null && !this.rank.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #rank} (Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.). This is the underlying object with id, value and extensions. The accessor "getRank" gives direct access to the value
|
||||
*/
|
||||
public ContactPoint setRankElement(PositiveIntType value) {
|
||||
this.rank = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
|
||||
*/
|
||||
public int getRank() {
|
||||
return this.rank == null || this.rank.isEmpty() ? 0 : this.rank.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.
|
||||
*/
|
||||
public ContactPoint setRank(int value) {
|
||||
if (this.rank == null)
|
||||
this.rank = new PositiveIntType();
|
||||
this.rank.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #period} (Time period when the contact point was/is in use.)
|
||||
*/
|
||||
|
@ -486,6 +538,7 @@ public class ContactPoint extends Type implements ICompositeType {
|
|||
childrenList.add(new Property("system", "code", "Telecommunications form for contact point - what communications system is required to make use of the contact.", 0, java.lang.Integer.MAX_VALUE, system));
|
||||
childrenList.add(new Property("value", "string", "The actual contact point details, in a form that is meaningful to the designated communication system (i.e. phone number or email address).", 0, java.lang.Integer.MAX_VALUE, value));
|
||||
childrenList.add(new Property("use", "code", "Identifies the purpose for the contact point.", 0, java.lang.Integer.MAX_VALUE, use));
|
||||
childrenList.add(new Property("rank", "positiveInt", "Specifies a preferred order in which to use a set of contacts. Contacts are ranked with lower values coming before higher values.", 0, java.lang.Integer.MAX_VALUE, rank));
|
||||
childrenList.add(new Property("period", "Period", "Time period when the contact point was/is in use.", 0, java.lang.Integer.MAX_VALUE, period));
|
||||
}
|
||||
|
||||
|
@ -495,6 +548,7 @@ public class ContactPoint extends Type implements ICompositeType {
|
|||
dst.system = system == null ? null : system.copy();
|
||||
dst.value = value == null ? null : value.copy();
|
||||
dst.use = use == null ? null : use.copy();
|
||||
dst.rank = rank == null ? null : rank.copy();
|
||||
dst.period = period == null ? null : period.copy();
|
||||
return dst;
|
||||
}
|
||||
|
@ -511,7 +565,7 @@ public class ContactPoint extends Type implements ICompositeType {
|
|||
return false;
|
||||
ContactPoint o = (ContactPoint) other;
|
||||
return compareDeep(system, o.system, true) && compareDeep(value, o.value, true) && compareDeep(use, o.use, true)
|
||||
&& compareDeep(period, o.period, true);
|
||||
&& compareDeep(rank, o.rank, true) && compareDeep(period, o.period, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -522,12 +576,13 @@ public class ContactPoint extends Type implements ICompositeType {
|
|||
return false;
|
||||
ContactPoint o = (ContactPoint) other;
|
||||
return compareValues(system, o.system, true) && compareValues(value, o.value, true) && compareValues(use, o.use, true)
|
||||
;
|
||||
&& compareValues(rank, o.rank, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (system == null || system.isEmpty()) && (value == null || value.isEmpty())
|
||||
&& (use == null || use.isEmpty()) && (period == null || period.isEmpty());
|
||||
&& (use == null || use.isEmpty()) && (rank == null || rank.isEmpty()) && (period == null || period.isEmpty())
|
||||
;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -52,7 +52,7 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Who or what actors are assigned roles in this Contract.
|
||||
*/
|
||||
@Child(name = "entity", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class, Supply.class}, order=1, min=1, max=1)
|
||||
@Child(name = "entity", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Contract Actor Type", formalDefinition="Who or what actors are assigned roles in this Contract." )
|
||||
protected Reference entity;
|
||||
|
||||
|
@ -166,7 +166,7 @@ public class Contract extends DomainResource {
|
|||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("entity", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance|Supply)", "Who or what actors are assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, entity));
|
||||
childrenList.add(new Property("entity", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "Who or what actors are assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, entity));
|
||||
childrenList.add(new Property("role", "CodeableConcept", "Role type of actors assigned roles in this Contract.", 0, java.lang.Integer.MAX_VALUE, role));
|
||||
}
|
||||
|
||||
|
@ -1447,7 +1447,7 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* The actor assigned a role in this Contract Provision.
|
||||
*/
|
||||
@Child(name = "entity", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class, Supply.class}, order=1, min=1, max=1)
|
||||
@Child(name = "entity", type = {Contract.class, Device.class, Group.class, Location.class, Organization.class, Patient.class, Practitioner.class, RelatedPerson.class, Substance.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Contract Term Actor", formalDefinition="The actor assigned a role in this Contract Provision." )
|
||||
protected Reference entity;
|
||||
|
||||
|
@ -1561,7 +1561,7 @@ public class Contract extends DomainResource {
|
|||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("entity", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance|Supply)", "The actor assigned a role in this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, entity));
|
||||
childrenList.add(new Property("entity", "Reference(Contract|Device|Group|Location|Organization|Patient|Practitioner|RelatedPerson|Substance)", "The actor assigned a role in this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, entity));
|
||||
childrenList.add(new Property("role", "CodeableConcept", "Role played by the actor assigned this role in this Contract Provision.", 0, java.lang.Integer.MAX_VALUE, role));
|
||||
}
|
||||
|
||||
|
@ -2022,7 +2022,7 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.
|
||||
*/
|
||||
@Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireAnswers.class}, order=1, min=1, max=1)
|
||||
@Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Easily comprehended representation of this Contract", formalDefinition="Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability." )
|
||||
protected Type content;
|
||||
|
||||
|
@ -2090,7 +2090,7 @@ public class Contract extends DomainResource {
|
|||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireAnswers)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, java.lang.Integer.MAX_VALUE, content));
|
||||
childrenList.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Human readable rendering of this Contract in a format and representation intended to enhance comprehension and ensure understandability.", 0, java.lang.Integer.MAX_VALUE, content));
|
||||
}
|
||||
|
||||
public FriendlyLanguageComponent copy() {
|
||||
|
@ -2131,7 +2131,7 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Contract legal text in human renderable form.
|
||||
*/
|
||||
@Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireAnswers.class}, order=1, min=1, max=1)
|
||||
@Child(name = "content", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=1, min=1, max=1)
|
||||
@Description(shortDefinition="Contract Legal Text", formalDefinition="Contract legal text in human renderable form." )
|
||||
protected Type content;
|
||||
|
||||
|
@ -2199,7 +2199,7 @@ public class Contract extends DomainResource {
|
|||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireAnswers)", "Contract legal text in human renderable form.", 0, java.lang.Integer.MAX_VALUE, content));
|
||||
childrenList.add(new Property("content[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Contract legal text in human renderable form.", 0, java.lang.Integer.MAX_VALUE, content));
|
||||
}
|
||||
|
||||
public LegalLanguageComponent copy() {
|
||||
|
@ -2460,7 +2460,7 @@ public class Contract extends DomainResource {
|
|||
/**
|
||||
* Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the "source of truth" and which would be the basis for legal action related to enforcement of this Contract.
|
||||
*/
|
||||
@Child(name = "binding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireAnswers.class}, order=14, min=0, max=1)
|
||||
@Child(name = "binding", type = {Attachment.class, Composition.class, DocumentReference.class, QuestionnaireResponse.class}, order=14, min=0, max=1)
|
||||
@Description(shortDefinition="Binding Contract", formalDefinition="Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the 'source of truth' and which would be the basis for legal action related to enforcement of this Contract." )
|
||||
protected Type binding;
|
||||
|
||||
|
@ -3247,7 +3247,7 @@ public class Contract extends DomainResource {
|
|||
childrenList.add(new Property("valuedItem", "", "Contract Valued Item List.", 0, java.lang.Integer.MAX_VALUE, valuedItem));
|
||||
childrenList.add(new Property("signer", "", "Party signing this Contract.", 0, java.lang.Integer.MAX_VALUE, signer));
|
||||
childrenList.add(new Property("term", "", "One or more Contract Provisions, which may be related and conveyed as a group, and may contain nested groups.", 0, java.lang.Integer.MAX_VALUE, term));
|
||||
childrenList.add(new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireAnswers)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the 'source of truth' and which would be the basis for legal action related to enforcement of this Contract.", 0, java.lang.Integer.MAX_VALUE, binding));
|
||||
childrenList.add(new Property("binding[x]", "Attachment|Reference(Composition|DocumentReference|QuestionnaireResponse)", "Legally binding Contract: This is the signed and legally recognized representation of the Contract, which is considered the 'source of truth' and which would be the basis for legal action related to enforcement of this Contract.", 0, java.lang.Integer.MAX_VALUE, binding));
|
||||
childrenList.add(new Property("friendly", "", "The 'patient friendly language' versionof the Contract in whole or in parts. 'Patient friendly language' means the representation of the Contract and Contract Provisions in a manner that is readily accessible and understandable by a layperson in accordance with best practices for communication styles that ensure that those agreeing to or signing the Contract understand the roles, actions, obligations, responsibilities, and implication of the agreement.", 0, java.lang.Integer.MAX_VALUE, friendly));
|
||||
childrenList.add(new Property("legal", "", "List of Legal expressions or representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, legal));
|
||||
childrenList.add(new Property("rule", "", "List of Computable Policy Rule Language Representations of this Contract.", 0, java.lang.Integer.MAX_VALUE, rule));
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
|
||||
import org.hl7.fhir.instance.model.annotations.Block;
|
||||
|
@ -40,14 +40,14 @@ import org.hl7.fhir.instance.model.api.*;
|
|||
@DatatypeDef(name="Count")
|
||||
public class Count extends Quantity {
|
||||
|
||||
private static final long serialVersionUID = -483422721L;
|
||||
private static final long serialVersionUID = 1069574054L;
|
||||
|
||||
public Count copy() {
|
||||
Count dst = new Count();
|
||||
copyValues(dst);
|
||||
dst.value = value == null ? null : value.copy();
|
||||
dst.comparator = comparator == null ? null : comparator.copy();
|
||||
dst.units = units == null ? null : units.copy();
|
||||
dst.unit = unit == null ? null : unit.copy();
|
||||
dst.system = system == null ? null : system.copy();
|
||||
dst.code = code == null ? null : code.copy();
|
||||
return dst;
|
||||
|
@ -64,7 +64,7 @@ public class Count extends Quantity {
|
|||
if (!(other instanceof Count))
|
||||
return false;
|
||||
Count o = (Count) other;
|
||||
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(units, o.units, true)
|
||||
return compareDeep(value, o.value, true) && compareDeep(comparator, o.comparator, true) && compareDeep(unit, o.unit, true)
|
||||
&& compareDeep(system, o.system, true) && compareDeep(code, o.code, true);
|
||||
}
|
||||
|
||||
|
@ -75,13 +75,13 @@ public class Count extends Quantity {
|
|||
if (!(other instanceof Count))
|
||||
return false;
|
||||
Count o = (Count) other;
|
||||
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(units, o.units, true)
|
||||
return compareValues(value, o.value, true) && compareValues(comparator, o.comparator, true) && compareValues(unit, o.unit, true)
|
||||
&& compareValues(system, o.system, true) && compareValues(code, o.code, true);
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (value == null || value.isEmpty()) && (comparator == null || comparator.isEmpty())
|
||||
&& (units == null || units.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
|
||||
&& (unit == null || unit.isEmpty()) && (system == null || system.isEmpty()) && (code == null || code.isEmpty())
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
*/
|
||||
|
||||
// Generated on Tue, Jul 21, 2015 10:37-0400 for FHIR v0.5.0
|
||||
// Generated on Fri, Aug 7, 2015 06:45-0400 for FHIR v0.5.0
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
@ -47,7 +47,7 @@ import org.hl7.fhir.instance.model.api.*;
|
|||
@ResourceDef(name="DataElement", profile="http://hl7.org/fhir/Profile/DataElement")
|
||||
public class DataElement extends DomainResource {
|
||||
|
||||
public enum DataElementSpecificity {
|
||||
public enum DataElementStringency {
|
||||
/**
|
||||
* The data element is sufficiently well-constrained that multiple pieces of data captured according to the constraints of the data element will be comparable (though in some cases, a degree of automated conversion/normalization may be required).
|
||||
*/
|
||||
|
@ -76,7 +76,7 @@ public class DataElement extends DomainResource {
|
|||
* added to help the parsers
|
||||
*/
|
||||
NULL;
|
||||
public static DataElementSpecificity fromCode(String codeString) throws Exception {
|
||||
public static DataElementStringency fromCode(String codeString) throws Exception {
|
||||
if (codeString == null || "".equals(codeString))
|
||||
return null;
|
||||
if ("comparable".equals(codeString))
|
||||
|
@ -91,7 +91,7 @@ public class DataElement extends DomainResource {
|
|||
return SCALEABLE;
|
||||
if ("flexible".equals(codeString))
|
||||
return FLEXIBLE;
|
||||
throw new Exception("Unknown DataElementSpecificity code '"+codeString+"'");
|
||||
throw new Exception("Unknown DataElementStringency code '"+codeString+"'");
|
||||
}
|
||||
public String toCode() {
|
||||
switch (this) {
|
||||
|
@ -106,12 +106,12 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
public String getSystem() {
|
||||
switch (this) {
|
||||
case COMPARABLE: return "http://hl7.org/fhir/dataelement-specificity";
|
||||
case FULLYSPECIFIED: return "http://hl7.org/fhir/dataelement-specificity";
|
||||
case EQUIVALENT: return "http://hl7.org/fhir/dataelement-specificity";
|
||||
case CONVERTABLE: return "http://hl7.org/fhir/dataelement-specificity";
|
||||
case SCALEABLE: return "http://hl7.org/fhir/dataelement-specificity";
|
||||
case FLEXIBLE: return "http://hl7.org/fhir/dataelement-specificity";
|
||||
case COMPARABLE: return "http://hl7.org/fhir/dataelement-stringency";
|
||||
case FULLYSPECIFIED: return "http://hl7.org/fhir/dataelement-stringency";
|
||||
case EQUIVALENT: return "http://hl7.org/fhir/dataelement-stringency";
|
||||
case CONVERTABLE: return "http://hl7.org/fhir/dataelement-stringency";
|
||||
case SCALEABLE: return "http://hl7.org/fhir/dataelement-stringency";
|
||||
case FLEXIBLE: return "http://hl7.org/fhir/dataelement-stringency";
|
||||
default: return "?";
|
||||
}
|
||||
}
|
||||
|
@ -139,37 +139,37 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
}
|
||||
|
||||
public static class DataElementSpecificityEnumFactory implements EnumFactory<DataElementSpecificity> {
|
||||
public DataElementSpecificity fromCode(String codeString) throws IllegalArgumentException {
|
||||
public static class DataElementStringencyEnumFactory implements EnumFactory<DataElementStringency> {
|
||||
public DataElementStringency fromCode(String codeString) throws IllegalArgumentException {
|
||||
if (codeString == null || "".equals(codeString))
|
||||
if (codeString == null || "".equals(codeString))
|
||||
return null;
|
||||
if ("comparable".equals(codeString))
|
||||
return DataElementSpecificity.COMPARABLE;
|
||||
return DataElementStringency.COMPARABLE;
|
||||
if ("fully-specified".equals(codeString))
|
||||
return DataElementSpecificity.FULLYSPECIFIED;
|
||||
return DataElementStringency.FULLYSPECIFIED;
|
||||
if ("equivalent".equals(codeString))
|
||||
return DataElementSpecificity.EQUIVALENT;
|
||||
return DataElementStringency.EQUIVALENT;
|
||||
if ("convertable".equals(codeString))
|
||||
return DataElementSpecificity.CONVERTABLE;
|
||||
return DataElementStringency.CONVERTABLE;
|
||||
if ("scaleable".equals(codeString))
|
||||
return DataElementSpecificity.SCALEABLE;
|
||||
return DataElementStringency.SCALEABLE;
|
||||
if ("flexible".equals(codeString))
|
||||
return DataElementSpecificity.FLEXIBLE;
|
||||
throw new IllegalArgumentException("Unknown DataElementSpecificity code '"+codeString+"'");
|
||||
return DataElementStringency.FLEXIBLE;
|
||||
throw new IllegalArgumentException("Unknown DataElementStringency code '"+codeString+"'");
|
||||
}
|
||||
public String toCode(DataElementSpecificity code) {
|
||||
if (code == DataElementSpecificity.COMPARABLE)
|
||||
public String toCode(DataElementStringency code) {
|
||||
if (code == DataElementStringency.COMPARABLE)
|
||||
return "comparable";
|
||||
if (code == DataElementSpecificity.FULLYSPECIFIED)
|
||||
if (code == DataElementStringency.FULLYSPECIFIED)
|
||||
return "fully-specified";
|
||||
if (code == DataElementSpecificity.EQUIVALENT)
|
||||
if (code == DataElementStringency.EQUIVALENT)
|
||||
return "equivalent";
|
||||
if (code == DataElementSpecificity.CONVERTABLE)
|
||||
if (code == DataElementStringency.CONVERTABLE)
|
||||
return "convertable";
|
||||
if (code == DataElementSpecificity.SCALEABLE)
|
||||
if (code == DataElementStringency.SCALEABLE)
|
||||
return "scaleable";
|
||||
if (code == DataElementSpecificity.FLEXIBLE)
|
||||
if (code == DataElementStringency.FLEXIBLE)
|
||||
return "flexible";
|
||||
return "?";
|
||||
}
|
||||
|
@ -621,18 +621,18 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).
|
||||
* An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published.
|
||||
*/
|
||||
@Child(name = "url", type = {UriType.class}, order=0, min=0, max=1)
|
||||
@Description(shortDefinition="Globally unique logical id for data element", formalDefinition="An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:)." )
|
||||
@Description(shortDefinition="Globally unique logical id for data element", formalDefinition="An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published." )
|
||||
protected UriType url;
|
||||
|
||||
/**
|
||||
* Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.
|
||||
*/
|
||||
@Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=1)
|
||||
@Child(name = "identifier", type = {Identifier.class}, order=1, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Logical id to reference this data element", formalDefinition="Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance." )
|
||||
protected Identifier identifier;
|
||||
protected List<Identifier> identifier;
|
||||
|
||||
/**
|
||||
* The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.
|
||||
|
@ -649,11 +649,11 @@ public class DataElement extends DomainResource {
|
|||
protected StringType name;
|
||||
|
||||
/**
|
||||
* The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.
|
||||
* The status of the data element.
|
||||
*/
|
||||
@Child(name = "useContext", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions." )
|
||||
protected List<CodeableConcept> useContext;
|
||||
@Child(name = "status", type = {CodeType.class}, order=4, min=1, max=1)
|
||||
@Description(shortDefinition="draft | active | retired", formalDefinition="The status of the data element." )
|
||||
protected Enumeration<ConformanceResourceStatus> status;
|
||||
|
||||
/**
|
||||
* A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
|
@ -662,47 +662,47 @@ public class DataElement extends DomainResource {
|
|||
@Description(shortDefinition="If for testing purposes, not real usage", formalDefinition="A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage." )
|
||||
protected BooleanType experimental;
|
||||
|
||||
/**
|
||||
* The status of the data element.
|
||||
*/
|
||||
@Child(name = "status", type = {CodeType.class}, order=6, min=1, max=1)
|
||||
@Description(shortDefinition="draft | active | retired", formalDefinition="The status of the data element." )
|
||||
protected Enumeration<ConformanceResourceStatus> status;
|
||||
|
||||
/**
|
||||
* The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired).
|
||||
*/
|
||||
@Child(name = "date", type = {DateTimeType.class}, order=7, min=0, max=1)
|
||||
@Description(shortDefinition="Date for this version of the data element", formalDefinition="The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired)." )
|
||||
protected DateTimeType date;
|
||||
|
||||
/**
|
||||
* A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
|
||||
*/
|
||||
@Child(name = "copyright", type = {StringType.class}, order=8, min=0, max=1)
|
||||
@Description(shortDefinition="Use and/or Publishing restrictions", formalDefinition="A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element." )
|
||||
protected StringType copyright;
|
||||
|
||||
/**
|
||||
* The name of the individual or organization that published the data element.
|
||||
*/
|
||||
@Child(name = "publisher", type = {StringType.class}, order=9, min=0, max=1)
|
||||
@Child(name = "publisher", type = {StringType.class}, order=6, min=0, max=1)
|
||||
@Description(shortDefinition="Name of the publisher (Organization or individual)", formalDefinition="The name of the individual or organization that published the data element." )
|
||||
protected StringType publisher;
|
||||
|
||||
/**
|
||||
* Contacts to assist a user in finding and communicating with the publisher.
|
||||
*/
|
||||
@Child(name = "contact", type = {}, order=10, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Child(name = "contact", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Contact details of the publisher", formalDefinition="Contacts to assist a user in finding and communicating with the publisher." )
|
||||
protected List<DataElementContactComponent> contact;
|
||||
|
||||
/**
|
||||
* The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes.
|
||||
*/
|
||||
@Child(name = "date", type = {DateTimeType.class}, order=8, min=0, max=1)
|
||||
@Description(shortDefinition="Date for this version of the data element", formalDefinition="The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes." )
|
||||
protected DateTimeType date;
|
||||
|
||||
/**
|
||||
* The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.
|
||||
*/
|
||||
@Child(name = "useContext", type = {CodeableConcept.class}, order=9, min=0, max=Child.MAX_UNLIMITED)
|
||||
@Description(shortDefinition="Content intends to support these contexts", formalDefinition="The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions." )
|
||||
protected List<CodeableConcept> useContext;
|
||||
|
||||
/**
|
||||
* A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
|
||||
*/
|
||||
@Child(name = "copyright", type = {StringType.class}, order=10, min=0, max=1)
|
||||
@Description(shortDefinition="Use and/or Publishing restrictions", formalDefinition="A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element." )
|
||||
protected StringType copyright;
|
||||
|
||||
/**
|
||||
* Identifies how precise the data element is in its definition.
|
||||
*/
|
||||
@Child(name = "specificity", type = {CodeType.class}, order=11, min=0, max=1)
|
||||
@Child(name = "stringency", type = {CodeType.class}, order=11, min=0, max=1)
|
||||
@Description(shortDefinition="comparable | fully-specified | equivalent | convertable | scaleable | flexible", formalDefinition="Identifies how precise the data element is in its definition." )
|
||||
protected Enumeration<DataElementSpecificity> specificity;
|
||||
protected Enumeration<DataElementStringency> stringency;
|
||||
|
||||
/**
|
||||
* Identifies a specification (other than a terminology) that the elements that make up the DataElement hav some correspondance with.
|
||||
|
@ -718,7 +718,7 @@ public class DataElement extends DomainResource {
|
|||
@Description(shortDefinition="Definition of element", formalDefinition="Defines the structure, type, allowed values and other constraining characteristics of the data element." )
|
||||
protected List<ElementDefinition> element;
|
||||
|
||||
private static final long serialVersionUID = 576052437L;
|
||||
private static final long serialVersionUID = 2017352331L;
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
|
@ -736,7 +736,7 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #url} (An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
* @return {@link #url} (An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
*/
|
||||
public UriType getUrlElement() {
|
||||
if (this.url == null)
|
||||
|
@ -756,7 +756,7 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #url} (An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
* @param value {@link #url} (An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published.). This is the underlying object with id, value and extensions. The accessor "getUrl" gives direct access to the value
|
||||
*/
|
||||
public DataElement setUrlElement(UriType value) {
|
||||
this.url = value;
|
||||
|
@ -764,14 +764,14 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).
|
||||
* @return An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published.
|
||||
*/
|
||||
public String getUrl() {
|
||||
return this.url == null ? null : this.url.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).
|
||||
* @param value An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published.
|
||||
*/
|
||||
public DataElement setUrl(String value) {
|
||||
if (Utilities.noString(value))
|
||||
|
@ -787,24 +787,40 @@ public class DataElement extends DomainResource {
|
|||
/**
|
||||
* @return {@link #identifier} (Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.)
|
||||
*/
|
||||
public Identifier getIdentifier() {
|
||||
public List<Identifier> getIdentifier() {
|
||||
if (this.identifier == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.identifier");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.identifier = new Identifier(); // cc
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
return this.identifier;
|
||||
}
|
||||
|
||||
public boolean hasIdentifier() {
|
||||
return this.identifier != null && !this.identifier.isEmpty();
|
||||
if (this.identifier == null)
|
||||
return false;
|
||||
for (Identifier item : this.identifier)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #identifier} (Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.)
|
||||
* @return {@link #identifier} (Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.)
|
||||
*/
|
||||
public DataElement setIdentifier(Identifier value) {
|
||||
this.identifier = value;
|
||||
// syntactic sugar
|
||||
public Identifier addIdentifier() { //3
|
||||
Identifier t = new Identifier();
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DataElement addIdentifier(Identifier t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.identifier == null)
|
||||
this.identifier = new ArrayList<Identifier>();
|
||||
this.identifier.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -906,91 +922,6 @@ public class DataElement extends DomainResource {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.)
|
||||
*/
|
||||
public List<CodeableConcept> getUseContext() {
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
return this.useContext;
|
||||
}
|
||||
|
||||
public boolean hasUseContext() {
|
||||
if (this.useContext == null)
|
||||
return false;
|
||||
for (CodeableConcept item : this.useContext)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public CodeableConcept addUseContext() { //3
|
||||
CodeableConcept t = new CodeableConcept();
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DataElement addUseContext(CodeableConcept t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #experimental} (A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public BooleanType getExperimentalElement() {
|
||||
if (this.experimental == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.experimental");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.experimental = new BooleanType(); // bb
|
||||
return this.experimental;
|
||||
}
|
||||
|
||||
public boolean hasExperimentalElement() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasExperimental() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #experimental} (A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public DataElement setExperimentalElement(BooleanType value) {
|
||||
this.experimental = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public boolean getExperimental() {
|
||||
return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public DataElement setExperimental(boolean value) {
|
||||
if (this.experimental == null)
|
||||
this.experimental = new BooleanType();
|
||||
this.experimental.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #status} (The status of the data element.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
|
||||
*/
|
||||
|
@ -1037,100 +968,47 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #date} (The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired).). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
* @return {@link #experimental} (A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public DateTimeType getDateElement() {
|
||||
if (this.date == null)
|
||||
public BooleanType getExperimentalElement() {
|
||||
if (this.experimental == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.date");
|
||||
throw new Error("Attempt to auto-create DataElement.experimental");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.date = new DateTimeType(); // bb
|
||||
return this.date;
|
||||
this.experimental = new BooleanType(); // bb
|
||||
return this.experimental;
|
||||
}
|
||||
|
||||
public boolean hasDateElement() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
public boolean hasExperimentalElement() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasDate() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
public boolean hasExperimental() {
|
||||
return this.experimental != null && !this.experimental.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #date} (The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired).). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
* @param value {@link #experimental} (A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.). This is the underlying object with id, value and extensions. The accessor "getExperimental" gives direct access to the value
|
||||
*/
|
||||
public DataElement setDateElement(DateTimeType value) {
|
||||
this.date = value;
|
||||
public DataElement setExperimentalElement(BooleanType value) {
|
||||
this.experimental = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired).
|
||||
* @return A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public Date getDate() {
|
||||
return this.date == null ? null : this.date.getValue();
|
||||
public boolean getExperimental() {
|
||||
return this.experimental == null || this.experimental.isEmpty() ? false : this.experimental.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired).
|
||||
* @param value A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.
|
||||
*/
|
||||
public DataElement setDate(Date value) {
|
||||
if (value == null)
|
||||
this.date = null;
|
||||
else {
|
||||
if (this.date == null)
|
||||
this.date = new DateTimeType();
|
||||
this.date.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #copyright} (A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
|
||||
*/
|
||||
public StringType getCopyrightElement() {
|
||||
if (this.copyright == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.copyright");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.copyright = new StringType(); // bb
|
||||
return this.copyright;
|
||||
}
|
||||
|
||||
public boolean hasCopyrightElement() {
|
||||
return this.copyright != null && !this.copyright.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCopyright() {
|
||||
return this.copyright != null && !this.copyright.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #copyright} (A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
|
||||
*/
|
||||
public DataElement setCopyrightElement(StringType value) {
|
||||
this.copyright = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
|
||||
*/
|
||||
public String getCopyright() {
|
||||
return this.copyright == null ? null : this.copyright.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
|
||||
*/
|
||||
public DataElement setCopyright(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.copyright = null;
|
||||
else {
|
||||
if (this.copyright == null)
|
||||
this.copyright = new StringType();
|
||||
this.copyright.setValue(value);
|
||||
}
|
||||
public DataElement setExperimental(boolean value) {
|
||||
if (this.experimental == null)
|
||||
this.experimental = new BooleanType();
|
||||
this.experimental.setValue(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -1224,50 +1102,188 @@ public class DataElement extends DomainResource {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return {@link #specificity} (Identifies how precise the data element is in its definition.). This is the underlying object with id, value and extensions. The accessor "getSpecificity" gives direct access to the value
|
||||
* @return {@link #date} (The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
*/
|
||||
public Enumeration<DataElementSpecificity> getSpecificityElement() {
|
||||
if (this.specificity == null)
|
||||
public DateTimeType getDateElement() {
|
||||
if (this.date == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.specificity");
|
||||
throw new Error("Attempt to auto-create DataElement.date");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.specificity = new Enumeration<DataElementSpecificity>(new DataElementSpecificityEnumFactory()); // bb
|
||||
return this.specificity;
|
||||
this.date = new DateTimeType(); // bb
|
||||
return this.date;
|
||||
}
|
||||
|
||||
public boolean hasSpecificityElement() {
|
||||
return this.specificity != null && !this.specificity.isEmpty();
|
||||
public boolean hasDateElement() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasSpecificity() {
|
||||
return this.specificity != null && !this.specificity.isEmpty();
|
||||
public boolean hasDate() {
|
||||
return this.date != null && !this.date.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #specificity} (Identifies how precise the data element is in its definition.). This is the underlying object with id, value and extensions. The accessor "getSpecificity" gives direct access to the value
|
||||
* @param value {@link #date} (The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
|
||||
*/
|
||||
public DataElement setSpecificityElement(Enumeration<DataElementSpecificity> value) {
|
||||
this.specificity = value;
|
||||
public DataElement setDateElement(DateTimeType value) {
|
||||
this.date = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes.
|
||||
*/
|
||||
public Date getDate() {
|
||||
return this.date == null ? null : this.date.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes.
|
||||
*/
|
||||
public DataElement setDate(Date value) {
|
||||
if (value == null)
|
||||
this.date = null;
|
||||
else {
|
||||
if (this.date == null)
|
||||
this.date = new DateTimeType();
|
||||
this.date.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.)
|
||||
*/
|
||||
public List<CodeableConcept> getUseContext() {
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
return this.useContext;
|
||||
}
|
||||
|
||||
public boolean hasUseContext() {
|
||||
if (this.useContext == null)
|
||||
return false;
|
||||
for (CodeableConcept item : this.useContext)
|
||||
if (!item.isEmpty())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #useContext} (The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.)
|
||||
*/
|
||||
// syntactic sugar
|
||||
public CodeableConcept addUseContext() { //3
|
||||
CodeableConcept t = new CodeableConcept();
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
// syntactic sugar
|
||||
public DataElement addUseContext(CodeableConcept t) { //3
|
||||
if (t == null)
|
||||
return this;
|
||||
if (this.useContext == null)
|
||||
this.useContext = new ArrayList<CodeableConcept>();
|
||||
this.useContext.add(t);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #copyright} (A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
|
||||
*/
|
||||
public StringType getCopyrightElement() {
|
||||
if (this.copyright == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.copyright");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.copyright = new StringType(); // bb
|
||||
return this.copyright;
|
||||
}
|
||||
|
||||
public boolean hasCopyrightElement() {
|
||||
return this.copyright != null && !this.copyright.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasCopyright() {
|
||||
return this.copyright != null && !this.copyright.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #copyright} (A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.). This is the underlying object with id, value and extensions. The accessor "getCopyright" gives direct access to the value
|
||||
*/
|
||||
public DataElement setCopyrightElement(StringType value) {
|
||||
this.copyright = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
|
||||
*/
|
||||
public String getCopyright() {
|
||||
return this.copyright == null ? null : this.copyright.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.
|
||||
*/
|
||||
public DataElement setCopyright(String value) {
|
||||
if (Utilities.noString(value))
|
||||
this.copyright = null;
|
||||
else {
|
||||
if (this.copyright == null)
|
||||
this.copyright = new StringType();
|
||||
this.copyright.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #stringency} (Identifies how precise the data element is in its definition.). This is the underlying object with id, value and extensions. The accessor "getStringency" gives direct access to the value
|
||||
*/
|
||||
public Enumeration<DataElementStringency> getStringencyElement() {
|
||||
if (this.stringency == null)
|
||||
if (Configuration.errorOnAutoCreate())
|
||||
throw new Error("Attempt to auto-create DataElement.stringency");
|
||||
else if (Configuration.doAutoCreate())
|
||||
this.stringency = new Enumeration<DataElementStringency>(new DataElementStringencyEnumFactory()); // bb
|
||||
return this.stringency;
|
||||
}
|
||||
|
||||
public boolean hasStringencyElement() {
|
||||
return this.stringency != null && !this.stringency.isEmpty();
|
||||
}
|
||||
|
||||
public boolean hasStringency() {
|
||||
return this.stringency != null && !this.stringency.isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value {@link #stringency} (Identifies how precise the data element is in its definition.). This is the underlying object with id, value and extensions. The accessor "getStringency" gives direct access to the value
|
||||
*/
|
||||
public DataElement setStringencyElement(Enumeration<DataElementStringency> value) {
|
||||
this.stringency = value;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Identifies how precise the data element is in its definition.
|
||||
*/
|
||||
public DataElementSpecificity getSpecificity() {
|
||||
return this.specificity == null ? null : this.specificity.getValue();
|
||||
public DataElementStringency getStringency() {
|
||||
return this.stringency == null ? null : this.stringency.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value Identifies how precise the data element is in its definition.
|
||||
*/
|
||||
public DataElement setSpecificity(DataElementSpecificity value) {
|
||||
public DataElement setStringency(DataElementStringency value) {
|
||||
if (value == null)
|
||||
this.specificity = null;
|
||||
this.stringency = null;
|
||||
else {
|
||||
if (this.specificity == null)
|
||||
this.specificity = new Enumeration<DataElementSpecificity>(new DataElementSpecificityEnumFactory());
|
||||
this.specificity.setValue(value);
|
||||
if (this.stringency == null)
|
||||
this.stringency = new Enumeration<DataElementStringency>(new DataElementStringencyEnumFactory());
|
||||
this.stringency.setValue(value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -1354,18 +1370,18 @@ public class DataElement extends DomainResource {
|
|||
|
||||
protected void listChildren(List<Property> childrenList) {
|
||||
super.listChildren(childrenList);
|
||||
childrenList.add(new Property("url", "uri", "An absolute uri that is used to identify this element when it is referenced in a specification, model, design or an instance (should be globally unique URI, and can be urn:uuid: or urn:oid:).", 0, java.lang.Integer.MAX_VALUE, url));
|
||||
childrenList.add(new Property("url", "uri", "An absolute URL that is used to identify this data element when it is referenced in a specification, model, design or an instance. This SHALL be a URL, SHOULD be globally unique, and SHOULD be an address at which this data element is (or will be) published.", 0, java.lang.Integer.MAX_VALUE, url));
|
||||
childrenList.add(new Property("identifier", "Identifier", "Formal identifier that is used to identify this data element when it is represented in other formats, or referenced in a specification, model, design or an instance.", 0, java.lang.Integer.MAX_VALUE, identifier));
|
||||
childrenList.add(new Property("version", "string", "The identifier that is used to identify this version of the data element when it is referenced in a StructureDefinition, Questionnaire or instance. This is an arbitrary value managed by the definition author manually.", 0, java.lang.Integer.MAX_VALUE, version));
|
||||
childrenList.add(new Property("name", "string", "The term used by humans to refer to the data element. Should ideally be unique within the context in which the data element is expected to be used.", 0, java.lang.Integer.MAX_VALUE, name));
|
||||
childrenList.add(new Property("useContext", "CodeableConcept", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
|
||||
childrenList.add(new Property("experimental", "boolean", "A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
|
||||
childrenList.add(new Property("status", "code", "The status of the data element.", 0, java.lang.Integer.MAX_VALUE, status));
|
||||
childrenList.add(new Property("date", "dateTime", "The date that the status for this business version of the data element became effective. (I.e. Date the draft was created, date element became active or date element became retired).", 0, java.lang.Integer.MAX_VALUE, date));
|
||||
childrenList.add(new Property("copyright", "string", "A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.", 0, java.lang.Integer.MAX_VALUE, copyright));
|
||||
childrenList.add(new Property("experimental", "boolean", "A flag to indicate that this search data elemnt definition is authored for testing purposes (or education/evaluation/marketing), and is not intended to be used for genuine usage.", 0, java.lang.Integer.MAX_VALUE, experimental));
|
||||
childrenList.add(new Property("publisher", "string", "The name of the individual or organization that published the data element.", 0, java.lang.Integer.MAX_VALUE, publisher));
|
||||
childrenList.add(new Property("contact", "", "Contacts to assist a user in finding and communicating with the publisher.", 0, java.lang.Integer.MAX_VALUE, contact));
|
||||
childrenList.add(new Property("specificity", "code", "Identifies how precise the data element is in its definition.", 0, java.lang.Integer.MAX_VALUE, specificity));
|
||||
childrenList.add(new Property("date", "dateTime", "The date that this version of the Data Element was published. The date must change when the business version changes, if it does, and it must change if the status code changes. in addition, it should change when the substantiative content of the data element changes.", 0, java.lang.Integer.MAX_VALUE, date));
|
||||
childrenList.add(new Property("useContext", "CodeableConcept", "The content was developed with a focus and intent of supporting the contexts that are listed. These terms may be used to assist with indexing and searching of data element definitions.", 0, java.lang.Integer.MAX_VALUE, useContext));
|
||||
childrenList.add(new Property("copyright", "string", "A copyright statement relating to the definition of the data element. Copyright statements are generally legal restrictions on the use and publishing of the details of the definition of the data element.", 0, java.lang.Integer.MAX_VALUE, copyright));
|
||||
childrenList.add(new Property("stringency", "code", "Identifies how precise the data element is in its definition.", 0, java.lang.Integer.MAX_VALUE, stringency));
|
||||
childrenList.add(new Property("mapping", "", "Identifies a specification (other than a terminology) that the elements that make up the DataElement hav some correspondance with.", 0, java.lang.Integer.MAX_VALUE, mapping));
|
||||
childrenList.add(new Property("element", "ElementDefinition", "Defines the structure, type, allowed values and other constraining characteristics of the data element.", 0, java.lang.Integer.MAX_VALUE, element));
|
||||
}
|
||||
|
@ -1374,25 +1390,29 @@ public class DataElement extends DomainResource {
|
|||
DataElement dst = new DataElement();
|
||||
copyValues(dst);
|
||||
dst.url = url == null ? null : url.copy();
|
||||
dst.identifier = identifier == null ? null : identifier.copy();
|
||||
if (identifier != null) {
|
||||
dst.identifier = new ArrayList<Identifier>();
|
||||
for (Identifier i : identifier)
|
||||
dst.identifier.add(i.copy());
|
||||
};
|
||||
dst.version = version == null ? null : version.copy();
|
||||
dst.name = name == null ? null : name.copy();
|
||||
if (useContext != null) {
|
||||
dst.useContext = new ArrayList<CodeableConcept>();
|
||||
for (CodeableConcept i : useContext)
|
||||
dst.useContext.add(i.copy());
|
||||
};
|
||||
dst.experimental = experimental == null ? null : experimental.copy();
|
||||
dst.status = status == null ? null : status.copy();
|
||||
dst.date = date == null ? null : date.copy();
|
||||
dst.copyright = copyright == null ? null : copyright.copy();
|
||||
dst.experimental = experimental == null ? null : experimental.copy();
|
||||
dst.publisher = publisher == null ? null : publisher.copy();
|
||||
if (contact != null) {
|
||||
dst.contact = new ArrayList<DataElementContactComponent>();
|
||||
for (DataElementContactComponent i : contact)
|
||||
dst.contact.add(i.copy());
|
||||
};
|
||||
dst.specificity = specificity == null ? null : specificity.copy();
|
||||
dst.date = date == null ? null : date.copy();
|
||||
if (useContext != null) {
|
||||
dst.useContext = new ArrayList<CodeableConcept>();
|
||||
for (CodeableConcept i : useContext)
|
||||
dst.useContext.add(i.copy());
|
||||
};
|
||||
dst.copyright = copyright == null ? null : copyright.copy();
|
||||
dst.stringency = stringency == null ? null : stringency.copy();
|
||||
if (mapping != null) {
|
||||
dst.mapping = new ArrayList<DataElementMappingComponent>();
|
||||
for (DataElementMappingComponent i : mapping)
|
||||
|
@ -1418,9 +1438,9 @@ public class DataElement extends DomainResource {
|
|||
return false;
|
||||
DataElement o = (DataElement) other;
|
||||
return compareDeep(url, o.url, true) && compareDeep(identifier, o.identifier, true) && compareDeep(version, o.version, true)
|
||||
&& compareDeep(name, o.name, true) && compareDeep(useContext, o.useContext, true) && compareDeep(experimental, o.experimental, true)
|
||||
&& compareDeep(status, o.status, true) && compareDeep(date, o.date, true) && compareDeep(copyright, o.copyright, true)
|
||||
&& compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true) && compareDeep(specificity, o.specificity, true)
|
||||
&& compareDeep(name, o.name, true) && compareDeep(status, o.status, true) && compareDeep(experimental, o.experimental, true)
|
||||
&& compareDeep(publisher, o.publisher, true) && compareDeep(contact, o.contact, true) && compareDeep(date, o.date, true)
|
||||
&& compareDeep(useContext, o.useContext, true) && compareDeep(copyright, o.copyright, true) && compareDeep(stringency, o.stringency, true)
|
||||
&& compareDeep(mapping, o.mapping, true) && compareDeep(element, o.element, true);
|
||||
}
|
||||
|
||||
|
@ -1432,17 +1452,17 @@ public class DataElement extends DomainResource {
|
|||
return false;
|
||||
DataElement o = (DataElement) other;
|
||||
return compareValues(url, o.url, true) && compareValues(version, o.version, true) && compareValues(name, o.name, true)
|
||||
&& compareValues(experimental, o.experimental, true) && compareValues(status, o.status, true) && compareValues(date, o.date, true)
|
||||
&& compareValues(copyright, o.copyright, true) && compareValues(publisher, o.publisher, true) && compareValues(specificity, o.specificity, true)
|
||||
&& compareValues(status, o.status, true) && compareValues(experimental, o.experimental, true) && compareValues(publisher, o.publisher, true)
|
||||
&& compareValues(date, o.date, true) && compareValues(copyright, o.copyright, true) && compareValues(stringency, o.stringency, true)
|
||||
;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return super.isEmpty() && (url == null || url.isEmpty()) && (identifier == null || identifier.isEmpty())
|
||||
&& (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (useContext == null || useContext.isEmpty())
|
||||
&& (experimental == null || experimental.isEmpty()) && (status == null || status.isEmpty())
|
||||
&& (date == null || date.isEmpty()) && (copyright == null || copyright.isEmpty()) && (publisher == null || publisher.isEmpty())
|
||||
&& (contact == null || contact.isEmpty()) && (specificity == null || specificity.isEmpty())
|
||||
&& (version == null || version.isEmpty()) && (name == null || name.isEmpty()) && (status == null || status.isEmpty())
|
||||
&& (experimental == null || experimental.isEmpty()) && (publisher == null || publisher.isEmpty())
|
||||
&& (contact == null || contact.isEmpty()) && (date == null || date.isEmpty()) && (useContext == null || useContext.isEmpty())
|
||||
&& (copyright == null || copyright.isEmpty()) && (stringency == null || stringency.isEmpty())
|
||||
&& (mapping == null || mapping.isEmpty()) && (element == null || element.isEmpty());
|
||||
}
|
||||
|
||||
|
@ -1457,6 +1477,8 @@ public class DataElement extends DomainResource {
|
|||
public static final String SP_IDENTIFIER = "identifier";
|
||||
@SearchParamDefinition(name="code", path="DataElement.element.code", description="A code for the data element (server may choose to do subsumption)", type="token" )
|
||||
public static final String SP_CODE = "code";
|
||||
@SearchParamDefinition(name="stringency", path="DataElement.stringency", description="The stringency of the data element definition", type="token" )
|
||||
public static final String SP_STRINGENCY = "stringency";
|
||||
@SearchParamDefinition(name="name", path="DataElement.name", description="Name of the data element", type="string" )
|
||||
public static final String SP_NAME = "name";
|
||||
@SearchParamDefinition(name="context", path="DataElement.useContext", description="A use context assigned to the data element", type="token" )
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue