Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
9c89eb2dee
|
@ -0,0 +1,20 @@
|
|||
# Use docker-based build environment (instead of openvz)
|
||||
sudo: false
|
||||
|
||||
language: java
|
||||
jdk:
|
||||
- oraclejdk7
|
||||
env:
|
||||
global:
|
||||
- MAVEN_OPTS="-XX:MaxPermSize=512m -Xmx4g"
|
||||
|
||||
cache:
|
||||
directories:
|
||||
- '$HOME/.m2/repository'
|
||||
|
||||
install: /bin/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
|
||||
|
||||
|
|
@ -3,6 +3,10 @@ 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)
|
||||
[![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:
|
||||
http://jamesagnew.github.io/hapi-fhir/
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
|
@ -42,6 +43,19 @@
|
|||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>${maven_project_info_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
|
|
@ -19,7 +19,7 @@ public class ClientExamples {
|
|||
@SuppressWarnings("unused")
|
||||
public void createProxy() {
|
||||
// START SNIPPET: proxy
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
// Set connections to access the network via the HTTP proxy at
|
||||
// example.com : 8888
|
||||
|
@ -36,7 +36,7 @@ public class ClientExamples {
|
|||
@SuppressWarnings("unused")
|
||||
public void createTimeouts() {
|
||||
// START SNIPPET: timeouts
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
// Set how long to try and establish the initial TCP connection (in ms)
|
||||
ctx.getRestfulClientFactory().setConnectTimeout(20 * 1000);
|
||||
|
@ -53,7 +53,7 @@ public class ClientExamples {
|
|||
public void createSecurity() {
|
||||
// START SNIPPET: security
|
||||
// Create a context and get the client factory so it can be configured
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();
|
||||
|
||||
// Create an HTTP basic auth interceptor
|
||||
|
@ -74,7 +74,7 @@ public class ClientExamples {
|
|||
public void createCookie() {
|
||||
// START SNIPPET: cookie
|
||||
// Create a context and get the client factory so it can be configured
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();
|
||||
|
||||
// Create a cookie interceptor. This cookie will have the name "mycookie" and
|
||||
|
@ -95,7 +95,7 @@ public class ClientExamples {
|
|||
public void createSecurityBearer() {
|
||||
// START SNIPPET: securityBearer
|
||||
// Create a context and get the client factory so it can be configured
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();
|
||||
|
||||
// In reality the token would have come from an authorization server
|
||||
|
@ -117,7 +117,7 @@ public class ClientExamples {
|
|||
{
|
||||
// START SNIPPET: logging
|
||||
// Create a context and get the client factory so it can be configured
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();
|
||||
|
||||
// Create a logging interceptor
|
||||
|
@ -141,7 +141,7 @@ public class ClientExamples {
|
|||
{
|
||||
// START SNIPPET: clientConfig
|
||||
// Create a client
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
IPatientClient client = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/");
|
||||
|
||||
// Request JSON encoding from the server (_format=json)
|
||||
|
|
|
@ -37,7 +37,7 @@ public class CompleteExampleClient {
|
|||
public static void main(String[] args) throws IOException {
|
||||
|
||||
// Create a client factory
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
// Create the client
|
||||
String serverBase = "http://fhir.healthintersections.com.au/open";
|
||||
|
|
|
@ -11,7 +11,7 @@ public class ExampleRestfulClient {
|
|||
|
||||
//START SNIPPET: client
|
||||
public static void main(String[] args) {
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
String serverBase = "http://foo.com/fhirServerBase";
|
||||
|
||||
// Create the client
|
||||
|
|
|
@ -49,7 +49,8 @@ ExtensionDt givenExt = new ExtensionDt(false, "http://examples.com#moreext", new
|
|||
given.addUndeclaredExtension(givenExt);
|
||||
//END SNIPPET: resourceStringExtension
|
||||
|
||||
String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
String output = ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
|
||||
System.out.println(output);
|
||||
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class HttpProxy {
|
|||
.disableCookieManagement();
|
||||
CloseableHttpClient httpClient = clientBuilder.build();
|
||||
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
String serverBase = "http://spark.furore.com/fhir/";
|
||||
ctx.getRestfulClientFactory().setHttpClient(httpClient);
|
||||
IGenericClient client = ctx.newRestfulGenericClient(serverBase);
|
||||
|
|
|
@ -65,19 +65,19 @@ patient.getImportantDates().add(new DateTimeDt("2014-01-26T11:11:11"));
|
|||
|
||||
patient.addName().addFamily("Smith").addGiven("John").addGiven("Quincy").addSuffix("Jr");
|
||||
|
||||
IParser p = new FhirContext().newXmlParser().setPrettyPrint(true);
|
||||
IParser p = FhirContext.forDstu2().newXmlParser().setPrettyPrint(true);
|
||||
String messageString = p.encodeResourceToString(patient);
|
||||
|
||||
System.out.println(messageString);
|
||||
//END SNIPPET: patientUse
|
||||
|
||||
//START SNIPPET: patientParse
|
||||
IParser parser = new FhirContext().newXmlParser();
|
||||
IParser parser = FhirContext.forDstu2().newXmlParser();
|
||||
MyPatient newPatient = parser.parseResource(MyPatient.class, messageString);
|
||||
//END SNIPPET: patientParse
|
||||
|
||||
{
|
||||
FhirContext ctx2 = new FhirContext();
|
||||
FhirContext ctx2 = FhirContext.forDstu2();
|
||||
RuntimeResourceDefinition def = ctx2.getResourceDefinition(patient);
|
||||
System.out.println(ctx2.newXmlParser().setPrettyPrint(true).encodeResourceToString(def.toProfile()));
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ patient.addIdentifier().setSystem("urn:foo").setValue("7000135");
|
|||
patient.addName().addFamily("Smith").addGiven("John").addGiven("Edward");
|
||||
patient.addAddress().addLine("742 Evergreen Terrace").setCity("Springfield").setState("ZZ");
|
||||
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
// Use the narrative generator
|
||||
ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
|
||||
|
|
|
@ -16,7 +16,7 @@ public class NarrativeGenerator {
|
|||
String propFile = "classpath:/com/foo/customnarrative.properties";
|
||||
CustomThymeleafNarrativeGenerator gen = new CustomThymeleafNarrativeGenerator(propFile);
|
||||
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
ctx.setNarrativeGenerator(gen);
|
||||
//END SNIPPET: gen
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ patient.addName().addFamily("Smith").addGiven("John").addGiven("Q").addSuffix("J
|
|||
patient.setGender(AdministrativeGenderEnum.MALE);
|
||||
|
||||
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
String xmlEncoded = ctx.newXmlParser().encodeResourceToString(patient);
|
||||
String jsonEncoded = ctx.newJsonParser().encodeResourceToString(patient);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import ca.uhn.fhir.model.dstu2.resource.Patient;
|
|||
|
||||
public class ResourceRefs {
|
||||
|
||||
private static FhirContext ourCtx = new FhirContext();
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
|
||||
public static void main(String[] args) {
|
||||
manualContained();
|
||||
|
|
|
@ -933,7 +933,7 @@ public interface HistoryClient extends IBasicClient {
|
|||
|
||||
public void bbbbb() throws DataFormatException, IOException {
|
||||
//START SNIPPET: metadataClientUsage
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
MetadataClient client = ctx.newRestfulClient(MetadataClient.class, "http://spark.furore.com/fhir");
|
||||
Conformance metadata = client.getServerMetadata();
|
||||
System.out.println(ctx.newXmlParser().encodeResourceToString(metadata));
|
||||
|
@ -973,7 +973,7 @@ private interface IPatientClient extends IBasicClient
|
|||
|
||||
public void clientRead() {
|
||||
//START SNIPPET: clientReadTags
|
||||
IPatientClient client = new FhirContext().newRestfulClient(IPatientClient.class, "http://foo/fhir");
|
||||
IPatientClient client = FhirContext.forDstu2().newRestfulClient(IPatientClient.class, "http://foo/fhir");
|
||||
Patient patient = client.readPatient(new IdDt("1234"));
|
||||
|
||||
// Access the tag list
|
||||
|
|
|
@ -43,7 +43,7 @@ ExtensionDt ext2 = new ExtensionDt(false, "http://examples.com#moreext", new Str
|
|||
given.addUndeclaredExtension(ext2);
|
||||
//END SNIPPET: resourceStringExtension
|
||||
|
||||
String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
|
||||
String output = FhirContext.forDstu2().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
|
||||
System.out.println(output);
|
||||
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class TagsExamples {
|
|||
@SuppressWarnings("unused")
|
||||
public void getResourceTags() {
|
||||
// START SNIPPET: getResourceTags
|
||||
IGenericClient client = new FhirContext().newRestfulGenericClient("http://fhir.healthintersections.com.au/open");
|
||||
IGenericClient client = FhirContext.forDstu2().newRestfulGenericClient("http://fhir.healthintersections.com.au/open");
|
||||
Patient p = client.read(Patient.class, "1");
|
||||
|
||||
// Retrieve the list of tags from the resource metadata
|
||||
|
|
|
@ -37,7 +37,7 @@ public class ValidatorExamples {
|
|||
public void validateResource() {
|
||||
// START SNIPPET: basicValidation
|
||||
// As always, you need a context
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
// Create and populate a new patient object
|
||||
Patient p = new Patient();
|
||||
|
@ -73,7 +73,7 @@ public class ValidatorExamples {
|
|||
|
||||
private static void validateFiles() throws Exception {
|
||||
// START SNIPPET: validateFiles
|
||||
FhirContext ctx = new FhirContext();
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
|
||||
// Create a validator and configure it
|
||||
FhirValidator validator = ctx.newValidator();
|
||||
|
|
|
@ -18,14 +18,10 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>2.7</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>scm</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
<version>${maven_project_info_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
|
|
@ -160,7 +160,7 @@
|
|||
<version>${junit_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -180,7 +180,7 @@
|
|||
<id>SITE</id>
|
||||
<reporting>
|
||||
<plugins>
|
||||
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
|
@ -192,16 +192,15 @@
|
|||
</reportSet>
|
||||
</reportSets>
|
||||
<configuration>
|
||||
<linkXRef>false</linkXRef>
|
||||
<sourceDirectories>
|
||||
<sourceDirectory>hapi-fhir-base/src/main/java</sourceDirectory>
|
||||
</sourceDirectories>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<configuration>
|
||||
</configuration>
|
||||
</plugin>-->
|
||||
-->
|
||||
<!--<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>3.0.0</version> <configuration> </configuration> </plugin> -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jxr-plugin</artifactId>
|
||||
|
@ -213,20 +212,11 @@
|
|||
<report>jxr</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
<!--
|
||||
<reportSet>
|
||||
<id>restful-server-example</id>
|
||||
<reports>
|
||||
<report>jxr</report>
|
||||
</reports>
|
||||
<configuration>
|
||||
<sourcePath>../restful-server-example/src/main/java</sourcePath>
|
||||
<destDir>${project.reporting.outputDirectory}/rse-xref</destDir>
|
||||
<outputDirectory>tmp</outputDirectory>
|
||||
<reportOutputDirectory>rse-xref</reportOutputDirectory>
|
||||
</configuration>
|
||||
</reportSet>
|
||||
-->
|
||||
<!-- <reportSet> <id>restful-server-example</id> <reports> <report>jxr</report>
|
||||
</reports> <configuration> <sourcePath>../restful-server-example/src/main/java</sourcePath>
|
||||
<destDir>${project.reporting.outputDirectory}/rse-xref</destDir> <outputDirectory>tmp</outputDirectory>
|
||||
<reportOutputDirectory>rse-xref</reportOutputDirectory> </configuration>
|
||||
</reportSet> -->
|
||||
</reportSets>
|
||||
</plugin>
|
||||
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-linkcheck-plugin</artifactId>
|
||||
|
|
|
@ -41,14 +41,15 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
|||
|
||||
public BaseRuntimeChildDatatypeDefinition(Field theField, String theElementName, Child theChildAnnotation, Description theDescriptionAnnotation, Class<? extends IBase> theDatatype) {
|
||||
super(theField, theChildAnnotation, theDescriptionAnnotation, theElementName);
|
||||
assert Modifier.isInterface(theDatatype.getModifiers()) == false : "Type of " + theDatatype + " shouldn't be here"; // should use RuntimeChildAny
|
||||
// should use RuntimeChildAny
|
||||
assert Modifier.isInterface(theDatatype.getModifiers()) == false : "Type of " + theDatatype + " shouldn't be here";
|
||||
myDatatype = theDatatype;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getChildNameByDatatype(Class<? extends IBase> theDatatype) {
|
||||
Class<?> nextType = theDatatype;
|
||||
while(nextType.equals(Object.class)==false) {
|
||||
while (nextType.equals(Object.class) == false) {
|
||||
if (myDatatype.equals(nextType)) {
|
||||
return getElementName();
|
||||
}
|
||||
|
@ -60,7 +61,7 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
|||
@Override
|
||||
public BaseRuntimeElementDefinition<?> getChildElementDefinitionByDatatype(Class<? extends IBase> theDatatype) {
|
||||
Class<?> nextType = theDatatype;
|
||||
while(nextType.equals(Object.class)==false) {
|
||||
while (nextType.equals(Object.class) == false) {
|
||||
if (myDatatype.equals(nextType)) {
|
||||
return myElementDefinition;
|
||||
}
|
||||
|
@ -102,11 +103,10 @@ public abstract class BaseRuntimeChildDatatypeDefinition extends BaseRuntimeDecl
|
|||
}
|
||||
myCodeType = theType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName() + "[" + getElementName() + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ public abstract class BaseRuntimeChildDefinition {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getClass().getSimpleName()+"[" + getElementName() + "]";
|
||||
return getClass().getSimpleName() + "[" + getElementName() + "]";
|
||||
}
|
||||
|
||||
public abstract BaseRuntimeElementDefinition<?> getChildByName(String theName);
|
||||
|
@ -52,11 +52,11 @@ public abstract class BaseRuntimeChildDefinition {
|
|||
}
|
||||
|
||||
public abstract String getElementName();
|
||||
|
||||
|
||||
public abstract int getMax();
|
||||
|
||||
|
||||
public abstract int getMin();
|
||||
|
||||
|
||||
public interface IMutator {
|
||||
void setValue(Object theTarget, IBase theValue);
|
||||
|
||||
|
@ -71,7 +71,7 @@ public abstract class BaseRuntimeChildDefinition {
|
|||
return null;
|
||||
}
|
||||
|
||||
// public String getExtensionUrl() {
|
||||
// return null;
|
||||
// }
|
||||
// public String getExtensionUrl() {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ public abstract class BaseRuntimeElementCompositeDefinition<T extends IBase> ext
|
|||
super(theName, theImplementingClass, theStandardType);
|
||||
}
|
||||
|
||||
public void addChild(BaseRuntimeChildDefinition theNext) {
|
||||
void addChild(BaseRuntimeChildDefinition theNext) {
|
||||
if (theNext == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
|
|
@ -30,9 +30,6 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
public abstract class BaseRuntimeElementDefinition<T extends IBase> {
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ import ca.uhn.fhir.model.api.IResource;
|
|||
import ca.uhn.fhir.model.view.ViewGenerator;
|
||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
import ca.uhn.fhir.parser.IParserErrorHandler;
|
||||
import ca.uhn.fhir.parser.IParser;
|
||||
import ca.uhn.fhir.parser.IParserErrorHandler;
|
||||
import ca.uhn.fhir.parser.JsonParser;
|
||||
import ca.uhn.fhir.parser.LenientErrorHandler;
|
||||
import ca.uhn.fhir.parser.XmlParser;
|
||||
|
|
|
@ -48,21 +48,21 @@ import java.util.Set;
|
|||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
import org.hl7.fhir.instance.model.api.IBaseExtension;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseXhtml;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.model.api.CodeableConceptElement;
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
|
|
|
@ -20,7 +20,8 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.ProvidesResources;
|
||||
|
||||
/**
|
||||
|
@ -30,42 +31,48 @@ import ca.uhn.fhir.model.api.annotation.ProvidesResources;
|
|||
* @see ca.uhn.fhir.model.api.annotation.ProvidesResources
|
||||
*/
|
||||
public class ProvidedResourceScanner {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ModelScanner.class);
|
||||
private FhirContext myContext;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ProvidedResourceScanner.class);
|
||||
private FhirContext myContext;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param theContext - context whose resource definition list is to be updated by the scanner
|
||||
*/
|
||||
public ProvidedResourceScanner(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param theContext
|
||||
* - context whose resource definition list is to be updated by the scanner
|
||||
*/
|
||||
public ProvidedResourceScanner(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
/**
|
||||
* If {@code theProvider} is tagged with the {@code ProvidesResources} annotation, this method will add every resource listed
|
||||
* by the {@code resources} method.
|
||||
* <p>
|
||||
* Notes:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>if {@code theProvider} isn't annotated with {@code resources} nothing is done; it's expected that most RestfulServers and
|
||||
* ResourceProviders won't be annotated.</li>
|
||||
* <li>any object listed in {@code resources} that doesn't implement {@code IResource} will generate a warning in the log.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param theProvider - Normally, either a {@link ca.uhn.fhir.rest.server.RestfulServer} or a {@link ca.uhn.fhir.rest.server.IResourceProvider}
|
||||
* that might be annotated with {@link ca.uhn.fhir.model.api.annotation.ProvidesResources}
|
||||
*/
|
||||
public void scanForProvidedResources(Object theProvider) {
|
||||
ProvidesResources annotation = theProvider.getClass().getAnnotation(ProvidesResources.class);
|
||||
if (annotation == null)
|
||||
return;
|
||||
for (Class clazz : annotation.resources()) {
|
||||
if (IResource.class.isAssignableFrom(clazz)) {
|
||||
myContext.getResourceDefinition(clazz);
|
||||
} else {
|
||||
ourLog.warn(clazz.getSimpleName() + "is not assignable from IResource");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* If {@code theProvider} is tagged with the {@code ProvidesResources} annotation, this method will add every
|
||||
* resource listed by the {@code resources} method.
|
||||
* <p>
|
||||
* Notes:
|
||||
* </p>
|
||||
* <ul>
|
||||
* <li>if {@code theProvider} isn't annotated with {@code resources} nothing is done; it's expected that most
|
||||
* RestfulServers and ResourceProviders won't be annotated.</li>
|
||||
* <li>any object listed in {@code resources} that doesn't implement {@code IResource} will generate a warning in the
|
||||
* log.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param theProvider
|
||||
* - Normally, either a {@link ca.uhn.fhir.rest.server.RestfulServer} or a
|
||||
* {@link ca.uhn.fhir.rest.server.IResourceProvider} that might be annotated with
|
||||
* {@link ca.uhn.fhir.model.api.annotation.ProvidesResources}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public void scanForProvidedResources(Object theProvider) {
|
||||
ProvidesResources annotation = theProvider.getClass().getAnnotation(ProvidesResources.class);
|
||||
if (annotation == null)
|
||||
return;
|
||||
for (Class<?> clazz : annotation.resources()) {
|
||||
if (IBaseResource.class.isAssignableFrom(clazz)) {
|
||||
myContext.getResourceDefinition((Class<? extends IBaseResource>) clazz);
|
||||
} else {
|
||||
ourLog.warn(clazz.getSimpleName() + "is not assignable from IResource");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ import java.util.Map;
|
|||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumeration;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
|||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
||||
|
||||
public class RuntimeChildDirectResource extends BaseRuntimeDeclaredChildDefinition {
|
||||
|
||||
|
|
|
@ -26,17 +26,14 @@ import java.util.Collections;
|
|||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
||||
|
||||
public class RuntimeChildResourceDefinition extends BaseRuntimeDeclaredChildDefinition {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.context;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
|
@ -27,9 +27,9 @@ import java.util.LinkedHashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
|
|
@ -24,9 +24,9 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
||||
|
|
|
@ -20,6 +20,10 @@ package ca.uhn.fhir.model.api;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
||||
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
|
||||
|
@ -27,12 +31,6 @@ import ca.uhn.fhir.model.base.resource.ResourceMetadataMap;
|
|||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
/**
|
||||
* This interface is the parent interface for all FHIR Resource definition
|
||||
* classes. Classes implementing this interface should be annotated
|
||||
|
|
|
@ -26,6 +26,8 @@ import java.lang.annotation.RetentionPolicy;
|
|||
import java.lang.annotation.Target;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseEnumFactory;
|
||||
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
|
@ -106,17 +108,21 @@ public @interface Child {
|
|||
*/
|
||||
Class<? extends IBaseEnumFactory<?>> enumFactory() default NoEnumFactory.class;
|
||||
|
||||
@CoverageIgnore
|
||||
public static class NoEnumFactory implements IBaseEnumFactory<Enum<?>> {
|
||||
|
||||
@CoverageIgnore
|
||||
private NoEnumFactory() {
|
||||
// non instantiable
|
||||
}
|
||||
|
||||
@CoverageIgnore
|
||||
@Override
|
||||
public Enum<?> fromCode(String theCodeString) throws IllegalArgumentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@CoverageIgnore
|
||||
@Override
|
||||
public String toCode(Enum<?> theCode) {
|
||||
return null;
|
||||
|
|
|
@ -34,7 +34,6 @@ import ca.uhn.fhir.model.primitive.DecimalDt;
|
|||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.param.QuantityParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
|
||||
public abstract class BaseQuantityDt extends BaseIdentifiableElement implements ICompositeDatatype, IQueryParameterType {
|
||||
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.dstu.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum QuantityCompararatorEnum {
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.dstu.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum RestfulOperationSystemEnum {
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.dstu.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum RestfulOperationTypeEnum {
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.dstu.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum SecurityEventObjectSensitivityEnum {
|
||||
|
||||
;
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.dstu.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum SecurityEventObjectTypeEnum {
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,11 +20,7 @@ package ca.uhn.fhir.model.primitive;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.DAY;
|
||||
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.MILLI;
|
||||
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.MONTH;
|
||||
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.SECOND;
|
||||
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.YEAR;
|
||||
import static ca.uhn.fhir.model.api.TemporalPrecisionEnum.*;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -29,8 +29,8 @@ import org.apache.commons.lang3.ObjectUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||
|
|
|
@ -20,11 +20,13 @@ package ca.uhn.fhir.model.primitive;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "positiveInt")
|
||||
@CoverageIgnore
|
||||
public class PositiveIntDt extends IntegerDt {
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,11 +20,13 @@ package ca.uhn.fhir.model.primitive;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "unsignedInt")
|
||||
@CoverageIgnore
|
||||
public class UnsignedIntDt extends IntegerDt {
|
||||
|
||||
/**
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum BundleEntrySearchModeEnum {
|
||||
|
||||
MATCH("match", "http://hl7.org/fhir/search-entry-mode"),
|
||||
|
|
|
@ -24,6 +24,7 @@ package ca.uhn.fhir.model.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
/**
|
||||
|
@ -31,6 +32,7 @@ import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
|||
* on a DSTU2 server. It is preferably to use the new DSTU2 Bundle (<code>ca.uhn.fhir.model.dstu2.resource.Bundle</code>)
|
||||
* for this purpose.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public enum BundleEntryTransactionMethodEnum {
|
||||
|
||||
GET("GET", "http://hl7.org/fhir/http-verb"),
|
||||
|
|
|
@ -24,8 +24,10 @@ package ca.uhn.fhir.model.valueset;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
|
||||
|
||||
@CoverageIgnore
|
||||
public enum BundleTypeEnum {
|
||||
|
||||
TRANSACTION("transaction", "http://hl7.org/fhir/bundle-type"),
|
||||
|
|
|
@ -32,7 +32,6 @@ import ca.uhn.fhir.context.RuntimeChildDeclaredExtensionDefinition;
|
|||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.BaseElement;
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
||||
public class ViewGenerator {
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.narrative;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -292,6 +292,7 @@ public abstract class BaseThymeleafNarrativeGenerator implements INarrativeGener
|
|||
loadProperties(next);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ourLog.info("Failed to load property file " + propFileName, e);
|
||||
throw new ConfigurationException("Can not load property file " + propFileName, e);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ import java.util.Set;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IDomainResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
|
||||
|
|
|
@ -20,9 +20,7 @@ package ca.uhn.fhir.parser;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
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 static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
@ -50,11 +48,8 @@ import javax.json.stream.JsonGeneratorFactory;
|
|||
import javax.json.stream.JsonParsingException;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
import org.hl7.fhir.instance.model.api.IAnyResource;
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBinary;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBooleanDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatype;
|
||||
|
@ -63,8 +58,10 @@ import org.hl7.fhir.instance.model.api.IBaseExtension;
|
|||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasModifierExtensions;
|
||||
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseReference;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.hl7.fhir.instance.model.api.IPrimitiveType;
|
||||
|
||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||
import ca.uhn.fhir.context.BaseRuntimeElementCompositeDefinition;
|
||||
|
@ -82,7 +79,6 @@ import ca.uhn.fhir.model.api.BaseBundle;
|
|||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.BundleEntry;
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.IIdentifiableElement;
|
||||
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -94,18 +90,13 @@ import ca.uhn.fhir.model.api.annotation.Child;
|
|||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||
import ca.uhn.fhir.model.base.composite.BaseContainedDt;
|
||||
import ca.uhn.fhir.model.base.composite.BaseNarrativeDt;
|
||||
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.model.primitive.XhtmlDt;
|
||||
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||
import ca.uhn.fhir.util.ElementUtil;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
|
||||
/**
|
||||
* This class is the FHIR JSON parser/encoder. Users should not interact with this class directly, but should use {@link FhirContext#newJsonParser()} to get an instance.
|
||||
|
|
|
@ -91,7 +91,8 @@ import ca.uhn.fhir.util.PrettyPrintWriterWrapper;
|
|||
import ca.uhn.fhir.util.XmlUtil;
|
||||
|
||||
/**
|
||||
* This class is the FHIR XML parser/encoder. Users should not interact with this class directly, but should use {@link FhirContext#newXmlParser()} to get an instance.
|
||||
* This class is the FHIR XML parser/encoder. Users should not interact with this class directly, but should use
|
||||
* {@link FhirContext#newXmlParser()} to get an instance.
|
||||
*/
|
||||
public class XmlParser extends BaseParser implements IParser {
|
||||
|
||||
|
@ -110,7 +111,8 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
private boolean myPrettyPrint;
|
||||
|
||||
/**
|
||||
* Do not use this constructor, the recommended way to obtain a new instance of the XML parser is to invoke {@link FhirContext#newXmlParser()}.
|
||||
* Do not use this constructor, the recommended way to obtain a new instance of the XML parser is to invoke
|
||||
* {@link FhirContext#newXmlParser()}.
|
||||
*
|
||||
* @param theParserErrorHandler
|
||||
*/
|
||||
|
@ -187,13 +189,11 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
|
||||
}
|
||||
|
||||
for (@SuppressWarnings("unchecked")
|
||||
Iterator<Attribute> iter = elem.getAttributes(); iter.hasNext();) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Iterator<Attribute> attributes = elem.getAttributes();
|
||||
for (Iterator<Attribute> iter = attributes; iter.hasNext();) {
|
||||
Attribute next = iter.next();
|
||||
// if
|
||||
// (next.getName().getLocalPart().equals("value")) {
|
||||
parserState.attributeValue(next.getName().getLocalPart(), next.getValue());
|
||||
// }
|
||||
}
|
||||
|
||||
} else if (nextEvent.isAttribute()) {
|
||||
|
@ -446,8 +446,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
theEventWriter.close();
|
||||
}
|
||||
|
||||
private void encodeChildElementToStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, IBase nextValue, String childName, BaseRuntimeElementDefinition<?> childDef,
|
||||
String theExtensionUrl, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
private void encodeChildElementToStreamWriter(IBaseResource theResource, XMLStreamWriter theEventWriter, IBase nextValue, String childName, BaseRuntimeElementDefinition<?> childDef, String theExtensionUrl, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
if (nextValue == null || nextValue.isEmpty()) {
|
||||
if (isChildContained(childDef, theIncludedResource)) {
|
||||
// We still want to go in..
|
||||
|
@ -502,9 +501,10 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
case CONTAINED_RESOURCE_LIST:
|
||||
case CONTAINED_RESOURCES: {
|
||||
/*
|
||||
* Disable per #103 for (IResource next : value.getContainedResources()) { if (getContainedResources().getResourceId(next) != null) { continue; }
|
||||
* theEventWriter.writeStartElement("contained"); encodeResourceToXmlStreamWriter(next, theEventWriter, true, fixContainedResourceId(next.getId().getValue()));
|
||||
* theEventWriter.writeEndElement(); }
|
||||
* Disable per #103 for (IResource next : value.getContainedResources()) { if
|
||||
* (getContainedResources().getResourceId(next) != null) { continue; }
|
||||
* theEventWriter.writeStartElement("contained"); encodeResourceToXmlStreamWriter(next, theEventWriter, true,
|
||||
* fixContainedResourceId(next.getId().getValue())); theEventWriter.writeEndElement(); }
|
||||
*/
|
||||
for (IBaseResource next : getContainedResources().getContainedResources()) {
|
||||
IIdType resourceId = getContainedResources().getResourceId(next);
|
||||
|
@ -548,8 +548,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
|
||||
}
|
||||
|
||||
private void encodeCompositeElementChildrenToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children,
|
||||
boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
private void encodeCompositeElementChildrenToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, List<? extends BaseRuntimeChildDefinition> children, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
for (BaseRuntimeChildDefinition nextChild : children) {
|
||||
if (nextChild.getElementName().equals("extension") || nextChild.getElementName().equals("modifierExtension")) {
|
||||
continue;
|
||||
|
@ -586,7 +585,8 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
// RuntimeChildNarrativeDefinition child = (RuntimeChildNarrativeDefinition) nextChild;
|
||||
// String childName = nextChild.getChildNameByDatatype(child.getDatatype());
|
||||
// BaseRuntimeElementDefinition<?> type = child.getChildByName(childName);
|
||||
// encodeChildElementToStreamWriter(theResource, theEventWriter, narr2, childName, type, null, theIncludedResource);
|
||||
// encodeChildElementToStreamWriter(theResource, theEventWriter, narr2, childName, type, null,
|
||||
// theIncludedResource);
|
||||
// continue;
|
||||
// }
|
||||
}
|
||||
|
@ -594,8 +594,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
|
||||
if (nextChild instanceof RuntimeChildContainedResources) {
|
||||
if (!theIncludedResource) {
|
||||
encodeChildElementToStreamWriter(theResource, theEventWriter, null, nextChild.getChildNameByDatatype(null), nextChild.getChildElementDefinitionByDatatype(null), null,
|
||||
theIncludedResource);
|
||||
encodeChildElementToStreamWriter(theResource, theEventWriter, null, nextChild.getChildNameByDatatype(null), nextChild.getChildElementDefinitionByDatatype(null), null, theIncludedResource);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
@ -641,8 +640,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void encodeCompositeElementToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> theElementDefinition,
|
||||
boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
private void encodeCompositeElementToStreamWriter(IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> theElementDefinition, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
encodeExtensionsIfPresent(theResource, theEventWriter, theElement, theIncludedResource);
|
||||
encodeCompositeElementChildrenToStreamWriter(theResource, theElement, theEventWriter, theElementDefinition.getExtensions(), theIncludedResource);
|
||||
encodeCompositeElementChildrenToStreamWriter(theResource, theElement, theEventWriter, theElementDefinition.getChildren(), theIncludedResource);
|
||||
|
@ -665,8 +663,9 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* This is just to work around the fact that casting java.util.List<ca.uhn.fhir.model.api.ExtensionDt> to java.util.List<? extends org.hl7.fhir.instance.model.api.IBaseExtension<?, ?>> seems to be
|
||||
* rejected by the compiler some of the time.
|
||||
* This is just to work around the fact that casting java.util.List<ca.uhn.fhir.model.api.ExtensionDt> to
|
||||
* java.util.List<? extends org.hl7.fhir.instance.model.api.IBaseExtension<?, ?>> seems to be rejected by the
|
||||
* compiler some of the time.
|
||||
*/
|
||||
private <Q extends IBaseExtension<?, ?>> List<IBaseExtension<?, ?>> toBaseExtensionList(final List<Q> theList) {
|
||||
List<IBaseExtension<?, ?>> retVal = new ArrayList<IBaseExtension<?, ?>>(theList.size());
|
||||
|
@ -691,11 +690,10 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void encodeResourceToStreamWriterInDstu2Format(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter,
|
||||
BaseRuntimeElementCompositeDefinition<?> resDef, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
private void encodeResourceToStreamWriterInDstu2Format(RuntimeResourceDefinition theResDef, IBaseResource theResource, IBase theElement, XMLStreamWriter theEventWriter, BaseRuntimeElementCompositeDefinition<?> resDef, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
/*
|
||||
* DSTU2 requires extensions to come in a specific spot within the encoded content - This is a bit of a messy way to make that happen, but hopefully this won't matter as much once we use the
|
||||
* HL7 structures
|
||||
* DSTU2 requires extensions to come in a specific spot within the encoded content - This is a bit of a messy way
|
||||
* to make that happen, but hopefully this won't matter as much once we use the HL7 structures
|
||||
*/
|
||||
|
||||
List<BaseRuntimeChildDefinition> preExtensionChildren = new ArrayList<BaseRuntimeChildDefinition>();
|
||||
|
@ -885,8 +883,7 @@ public class XmlParser extends BaseParser implements IParser {
|
|||
}
|
||||
}
|
||||
|
||||
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List<? extends IBaseExtension<?, ?>> theExtensions, String tagName, boolean theIncludedResource)
|
||||
throws XMLStreamException, DataFormatException {
|
||||
private void encodeUndeclaredExtensions(IBaseResource theResource, XMLStreamWriter theWriter, List<? extends IBaseExtension<?, ?>> theExtensions, String tagName, boolean theIncludedResource) throws XMLStreamException, DataFormatException {
|
||||
for (IBaseExtension<?, ?> next : theExtensions) {
|
||||
if (next == null || (ElementUtil.isEmpty(next.getValue()) && next.getExtension().isEmpty())) {
|
||||
continue;
|
||||
|
|
|
@ -20,12 +20,14 @@ package ca.uhn.fhir.rest.client.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
|
||||
/**
|
||||
* Represents a failure by the HAPI FHIR Client to successfully communicate
|
||||
* with a FHIR server, because of IO failures, incomprehensible response, etc.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class FhirClientConnectionException extends BaseServerResponseException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.rest.client.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
|
||||
/**
|
||||
|
@ -27,6 +28,7 @@ import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
|||
* communicate with a server which is a valid FHIR server but is incompatible
|
||||
* with this client for some reason.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class FhirClientInappropriateForServerException extends BaseServerResponseException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -20,8 +20,10 @@ package ca.uhn.fhir.rest.client.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
|
||||
@CoverageIgnore
|
||||
public class InvalidResponseException extends BaseServerResponseException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -25,10 +25,13 @@ import static org.apache.commons.lang3.StringUtils.*;
|
|||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||
|
||||
@CoverageIgnore
|
||||
public class NonFhirResponseException extends BaseServerResponseException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
|
|
@ -48,7 +48,6 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.rest.server.IVersionSpecificBundleFactory;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||
import ca.uhn.fhir.validation.FhirValidator;
|
||||
|
||||
/**
|
||||
* @author James Agnew
|
||||
|
|
|
@ -34,8 +34,6 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import javax.servlet.ServletInputStream;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.method;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.method;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collection;
|
||||
|
|
|
@ -20,8 +20,7 @@ package ca.uhn.fhir.rest.method;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.Map.Entry;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.methods.HttpGet;
|
||||
import org.apache.http.client.methods.HttpRequestBase;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.rest.client.BaseHttpClientInvocation;
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.method;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.param;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
|
|
|
@ -20,8 +20,6 @@ package ca.uhn.fhir.rest.param;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -20,8 +20,8 @@ package ca.uhn.fhir.rest.param;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static ca.uhn.fhir.rest.param.ParameterUtil.escape;
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static ca.uhn.fhir.rest.param.ParameterUtil.*;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
|
|
@ -20,8 +20,7 @@ package ca.uhn.fhir.rest.param;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
|
|
|
@ -20,8 +20,7 @@ package ca.uhn.fhir.rest.param;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.param;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.defaultString;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
|
|
@ -20,11 +20,11 @@ package ca.uhn.fhir.rest.server;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.util.ResourceReferenceInfo;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Created by Bill de Beaubien on 3/4/2015.
|
||||
*
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,118 +0,0 @@
|
|||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2015 University Health Network
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/**
|
||||
* Used by {@link IBundleProvider} to provide a single page worth of results.
|
||||
*
|
||||
* If the server chooses to, it may return a different number of matching results to the number that the user requested.
|
||||
* For example, if the client requested 100 results but the server decided to return only 10 (perhaps because they were
|
||||
* very large), this value should be set to 10. Note that this count refers only to resources which are included in the
|
||||
* indexes provided to {@link IBundleProvider#getResources(int, int)}, so it should not reflect any additional results
|
||||
* added to the response as a result of _include parameters, OperationOutcome's etc.
|
||||
*/
|
||||
public class ResponseResourceList {
|
||||
/**
|
||||
* Singleton unmodifiable empty list
|
||||
*/
|
||||
public static final ResponseResourceList EMPTY = new EmptyResponseResourceList();
|
||||
|
||||
private List<IBaseResource> myIncludeResults;
|
||||
private List<IBaseResource> myMatchResults;
|
||||
|
||||
/**
|
||||
* Adds an "include" results. Include results are results which are added as a result of <code>_include</code>
|
||||
* directives in search requests.
|
||||
*/
|
||||
public void addIncludeResults(IBaseResource theIncludeResult) {
|
||||
if (myIncludeResults == null) {
|
||||
myIncludeResults = new ArrayList<IBaseResource>();
|
||||
}
|
||||
myIncludeResults.add(theIncludeResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a "match" result. A match result is a result added as a direct result of the operation in question. E.g. for
|
||||
* a search invocation a match result would be a result which directly matched the search criteria. For a history
|
||||
* invocation it would be a historical version of a resource or the current version.
|
||||
*/
|
||||
public void addMatchResult(IBaseResource theResource) {
|
||||
Validate.notNull(theResource, "theResource must not be null");
|
||||
if (myMatchResults == null) {
|
||||
myMatchResults = new ArrayList<IBaseResource>();
|
||||
}
|
||||
myMatchResults.add(theResource);
|
||||
}
|
||||
|
||||
public List<IBaseResource> getIncludeResults() {
|
||||
return myIncludeResults;
|
||||
}
|
||||
|
||||
public List<IBaseResource> getMatchResults() {
|
||||
return myMatchResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "include" results. Include results are results which are added as a result of <code>_include</code>
|
||||
* directives in search requests.
|
||||
*/
|
||||
public void setIncludeResults(List<IBaseResource> theIncludeResults) {
|
||||
myIncludeResults = theIncludeResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the "match" results. A match result is a result added as a direct result of the operation in question. E.g.
|
||||
* for a search invocation a match result would be a result which directly matched the search criteria. For a
|
||||
* history invocation it would be a historical version of a resource or the current version.
|
||||
*/
|
||||
public void setMatchResults(List<IBaseResource> theMatchResults) {
|
||||
myMatchResults = theMatchResults;
|
||||
}
|
||||
|
||||
private static final class EmptyResponseResourceList extends ResponseResourceList {
|
||||
@Override
|
||||
public void addIncludeResults(IBaseResource theIncludeResult) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addMatchResult(IBaseResource theResource) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIncludeResults(List<IBaseResource> theIncludeResults) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMatchResults(List<IBaseResource> theMatchResults) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.server;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
@ -103,12 +103,18 @@ public class RestfulServer extends HttpServlet {
|
|||
private boolean myUseBrowserFriendlyContentTypes;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor. Note that if no {@link FhirContext} is passed in to the server (either through the constructor, or
|
||||
* through {@link #setFhirContext(FhirContext)}) the server will determine which version of FHIR to support
|
||||
* through classpath scanning. This is brittle, and it is highly recommended to explicitly specify
|
||||
* a FHIR version.
|
||||
*/
|
||||
public RestfulServer() {
|
||||
this(new FhirContext());
|
||||
this(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public RestfulServer(FhirContext theCtx) {
|
||||
myFhirContext = theCtx;
|
||||
}
|
||||
|
@ -200,7 +206,7 @@ public class RestfulServer extends HttpServlet {
|
|||
int count = 0;
|
||||
|
||||
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
|
||||
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, myFhirContext, theProvider);
|
||||
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
|
||||
if (foundMethodBinding == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -220,7 +226,7 @@ public class RestfulServer extends HttpServlet {
|
|||
if (resourceName == null) {
|
||||
resourceBinding = myServerBinding;
|
||||
} else {
|
||||
RuntimeResourceDefinition definition = myFhirContext.getResourceDefinition(resourceName);
|
||||
RuntimeResourceDefinition definition = getFhirContext().getResourceDefinition(resourceName);
|
||||
if (myResourceNameToProvider.containsKey(definition.getName())) {
|
||||
resourceBinding = myResourceNameToProvider.get(definition.getName());
|
||||
} else {
|
||||
|
@ -270,7 +276,7 @@ public class RestfulServer extends HttpServlet {
|
|||
if (Modifier.isPublic(m.getModifiers())) {
|
||||
ourLog.debug("Scanning public method: {}#{}", theSystemProvider.getClass(), m.getName());
|
||||
|
||||
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, myFhirContext, theSystemProvider);
|
||||
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theSystemProvider);
|
||||
if (foundMethodBinding != null) {
|
||||
if (foundMethodBinding instanceof ConformanceMethodBinding) {
|
||||
myServerConformanceMethod = foundMethodBinding;
|
||||
|
@ -318,6 +324,9 @@ public class RestfulServer extends HttpServlet {
|
|||
* creating their own.
|
||||
*/
|
||||
public FhirContext getFhirContext() {
|
||||
if (myFhirContext == null) {
|
||||
myFhirContext = new FhirContext();
|
||||
}
|
||||
return myFhirContext;
|
||||
}
|
||||
|
||||
|
@ -419,7 +428,7 @@ public class RestfulServer extends HttpServlet {
|
|||
}
|
||||
|
||||
public IResourceProvider getServerProfilesProvider() {
|
||||
return myFhirContext.getVersion().createServerProfilesProvider(this);
|
||||
return getFhirContext().getVersion().createServerProfilesProvider(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -462,7 +471,7 @@ public class RestfulServer extends HttpServlet {
|
|||
NarrativeModeEnum narrativeMode = RestfulServerUtils.determineNarrativeMode(theRequest);
|
||||
boolean respondGzip = theRequest.isRespondGzip();
|
||||
|
||||
IVersionSpecificBundleFactory bundleFactory = myFhirContext.newBundleFactory();
|
||||
IVersionSpecificBundleFactory bundleFactory = getFhirContext().newBundleFactory();
|
||||
|
||||
Set<Include> includes = new HashSet<Include>();
|
||||
String[] reqIncludes = theRequest.getServletRequest().getParameterValues(Constants.PARAM_INCLUDE);
|
||||
|
@ -765,7 +774,7 @@ public class RestfulServer extends HttpServlet {
|
|||
throw new NullPointerException("getResourceType() on class '" + nextProvider.getClass().getCanonicalName() + "' returned null");
|
||||
}
|
||||
|
||||
String resourceName = myFhirContext.getResourceDefinition(resourceType).getName();
|
||||
String resourceName = getFhirContext().getResourceDefinition(resourceType).getName();
|
||||
if (typeToProvider.containsKey(resourceName)) {
|
||||
throw new ServletException("Multiple resource providers return resource type[" + resourceName + "]: First[" + typeToProvider.get(resourceName).getClass().getCanonicalName()
|
||||
+ "] and Second[" + nextProvider.getClass().getCanonicalName() + "]");
|
||||
|
@ -792,7 +801,7 @@ public class RestfulServer extends HttpServlet {
|
|||
|
||||
Object confProvider = getServerConformanceProvider();
|
||||
if (confProvider == null) {
|
||||
confProvider = myFhirContext.getVersion().createServerConformanceProvider(this);
|
||||
confProvider = getFhirContext().getVersion().createServerConformanceProvider(this);
|
||||
}
|
||||
findSystemMethods(confProvider);
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.server;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
/*
|
||||
|
@ -25,6 +26,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
/**
|
||||
* Represents an <b>HTTP 401 Client Unauthorized</b> response, which means that the client needs to provide credentials, or has provided invalid credentials.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class AuthenticationException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_401_CLIENT_UNAUTHORIZED;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -35,6 +36,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* Summary</a>.
|
||||
* </p>
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class ForbiddenOperationException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_403_FORBIDDEN;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -39,6 +40,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
*
|
||||
* @see UnprocessableEntityException Which should be used for business level validation failures
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class InternalErrorException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_500_INTERNAL_ERROR;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -36,6 +37,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
*
|
||||
* @see UnprocessableEntityException Which should be used for business level validation failures
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class InvalidRequestException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_400_BAD_REQUEST;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -32,6 +33,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* Summary</a>.
|
||||
* </p>
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class NotImplementedOperationException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_501_NOT_IMPLEMENTED;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -33,6 +34,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* Summary</a>.
|
||||
* </p>
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class NotModifiedException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_304_NOT_MODIFIED;
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.annotation.Update;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
@ -30,6 +31,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* be specified in an HTTP header, and none was.
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
@CoverageIgnore
|
||||
public class PreconditionFailedException extends ResourceVersionNotSpecifiedException {
|
||||
@SuppressWarnings("hiding")
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_412_PRECONDITION_FAILED;
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
|
@ -30,6 +31,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* Represents an <b>HTTP 410 Resource Gone</b> response, which geenerally
|
||||
* indicates that the resource has been deleted
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class ResourceGoneException extends BaseServerResponseException {
|
||||
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_410_GONE;
|
||||
|
|
|
@ -20,6 +20,8 @@ package ca.uhn.fhir.rest.server.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -31,6 +33,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
/**
|
||||
* Represents an <b>HTTP 404 Resource Not Found</b> response, which means that the request is pointing to a resource that does not exist.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class ResourceNotFoundException extends BaseServerResponseException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.annotation.Delete;
|
||||
import ca.uhn.fhir.rest.annotation.Update;
|
||||
|
@ -30,6 +31,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* thrown in methods which accept a version (e.g. {@link Update}, {@link Delete})
|
||||
* when the operation fails because of a version conflict as specified in the FHIR specification.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class ResourceVersionConflictException extends BaseServerResponseException {
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_409_CONFLICT;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -28,6 +29,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
* strangely named and will be removed at some point.
|
||||
*/
|
||||
@Deprecated
|
||||
@CoverageIgnore
|
||||
public class ResourceVersionNotSpecifiedException extends BaseServerResponseException {
|
||||
public static final int STATUS_CODE = Constants.STATUS_HTTP_412_PRECONDITION_FAILED;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package ca.uhn.fhir.rest.server.exceptions;
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
|
||||
/*
|
||||
|
@ -26,6 +27,7 @@ import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
|||
* Exception for use when a response is received or being sent that does not correspond to any other exception type. An HTTP status code must be provided, and will be provided to the caller in the
|
||||
* case of a server implementation.
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class UnclassifiedServerFailureException extends BaseServerResponseException {
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import net.sourceforge.cobertura.CoverageIgnore;
|
||||
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
|
@ -32,6 +33,7 @@ import ca.uhn.fhir.rest.server.Constants;
|
|||
*
|
||||
* @see InvalidRequestException Which corresponds to an <b>HTTP 400 Bad Request</b> failure
|
||||
*/
|
||||
@CoverageIgnore
|
||||
public class UnprocessableEntityException extends BaseServerResponseException {
|
||||
|
||||
private static final String DEFAULT_MESSAGE = "Unprocessable Entity";
|
||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.server.interceptor;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||
import static org.apache.commons.lang3.StringUtils.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
|
|
@ -26,8 +26,6 @@ import javax.servlet.ServletException;
|
|||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
|
|
|
@ -20,6 +20,8 @@ package ca.uhn.fhir.util;
|
|||
* #L%
|
||||
*/
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
|
@ -28,8 +30,6 @@ import ca.uhn.fhir.context.BaseRuntimeElementDefinition;
|
|||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
import ca.uhn.fhir.model.api.ISupportsUndeclaredExtensions;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @see FhirTerser#visit(IBaseResource, IModelVisitor)
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
||||
|
||||
/**
|
||||
* Created by Bill de Beaubien on 2/26/2015.
|
||||
|
|
|
@ -0,0 +1,411 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>hapi-fhir-cobertura</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>HAPI FHIR - Consolidated Test Project</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-base</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
||||
<version>1.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.phloc</groupId>
|
||||
<artifactId>phloc-schematron</artifactId>
|
||||
<version>${phloc_schematron_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.phloc</groupId>
|
||||
<artifactId>phloc-commons</artifactId>
|
||||
<version>${phloc_commons_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
<artifactId>thymeleaf</artifactId>
|
||||
<version>${thymeleaf-version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>jcl-over-slf4j</artifactId>
|
||||
<version>${slf4j_version}</version>
|
||||
</dependency>
|
||||
<!-- <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-nop</artifactId>
|
||||
<version>${slf4j_version}</version> </dependency> -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback_version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>java-hamcrest</artifactId>
|
||||
<version>${hamcrest_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Test Database -->
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>${junit_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.4</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlets</artifactId>
|
||||
<version>${jetty_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<version>${jetty_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-server</artifactId>
|
||||
<version>${jetty_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-servlet</artifactId>
|
||||
<version>${jetty_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-util</artifactId>
|
||||
<version>${jetty_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mockito</groupId>
|
||||
<artifactId>mockito-all</artifactId>
|
||||
<version>1.9.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.4</version>
|
||||
<classifier>jdk15</classifier>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.json-lib</groupId>
|
||||
<artifactId>json-lib</artifactId>
|
||||
<version>2.4</version>
|
||||
<classifier>jdk15-sources</classifier>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>directory-naming</groupId>
|
||||
<artifactId>naming-java</artifactId>
|
||||
<version>0.8</version>
|
||||
<scope>test</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<groupId>commons-logging</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hamcrest</groupId>
|
||||
<artifactId>java-hamcrest</artifactId>
|
||||
<version>${hamcrest_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.ebaysf.web</groupId>
|
||||
<artifactId>cors-filter</artifactId>
|
||||
<version>${ebay_cors_filter_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>xmlunit</groupId>
|
||||
<artifactId>xmlunit</artifactId>
|
||||
<version>${xmlunit_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-site-plugin</artifactId>
|
||||
<configuration>
|
||||
<skipDeploy>true</skipDeploy>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
<formats>
|
||||
<format>html</format>
|
||||
<format>xml</format>
|
||||
</formats>
|
||||
<maxmem>256m</maxmem>
|
||||
<instrumentation>
|
||||
<ignores>
|
||||
<ignore>ca.uhn.fhir.model.dstu.valueset.*</ignore>
|
||||
</ignores>
|
||||
<excludes>
|
||||
<ignore>**/valueset/*.class</ignore>
|
||||
<ignore>**/exceptions/*.class</ignore>
|
||||
</excludes>
|
||||
<!-- <ignoreMethodAnnotations> <ignoreMethodAnnotation>net.sourceforge.cobertura.CoverageIgnore</ignoreMethodAnnotation>
|
||||
</ignoreMethodAnnotations> -->
|
||||
</instrumentation>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eluder.coveralls</groupId>
|
||||
<artifactId>coveralls-maven-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<coberturaReports>
|
||||
<coberturaReport>
|
||||
${basedir}/target/coverage.xml
|
||||
</coberturaReport>
|
||||
</coberturaReports>
|
||||
<sourceEncoding>UTF-8</sourceEncoding>
|
||||
<serviceName>travis-ci</serviceName>
|
||||
<serviceJobId>${env.TRAVIS_JOB_ID}</serviceJobId>
|
||||
<sourceDirectories>
|
||||
<sourceDirectory>../hapi-fhir-structures-dstu/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-structures-dstu2/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-structures-hl7org-dstu2/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-jpaserver-base/src/test/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-base/src/main/java</sourceDirectory>
|
||||
<sourceDirectory>../hapi-fhir-jpaserver-base/src/main/java</sourceDirectory>
|
||||
</sourceDirectories>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>build-helper-maven-plugin</artifactId>
|
||||
<version>${maven_build_helper_plugin_version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>add-source</id>
|
||||
<phase>generate-sources</phase>
|
||||
<goals>
|
||||
<goal>add-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>../hapi-fhir-base/src/main/java</source>
|
||||
<source>../hapi-fhir-jpaserver-base/src/main/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>add-test-source</id>
|
||||
<phase>generate-test-sources</phase>
|
||||
<goals>
|
||||
<goal>add-test-source</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<sources>
|
||||
<source>../hapi-fhir-structures-dstu/src/test/java</source>
|
||||
<source>../hapi-fhir-structures-dstu2/src/test/java</source>
|
||||
<source>../hapi-fhir-structures-hl7org-dstu2/src/test/java</source>
|
||||
<source>../hapi-fhir-jpaserver-base/src/test/java</source>
|
||||
</sources>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<runOrder>alphabetical</runOrder>
|
||||
<reuseForks>false</reuseForks>
|
||||
<argLine>-Xms512m -Xmx1024m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<configuration>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version> <configuration> <check>
|
||||
<branchRate>85</branchRate> <lineRate>85</lineRate> <haltOnFailure>true</haltOnFailure>
|
||||
<totalBranchRate>85</totalBranchRate> <totalLineRate>85</totalLineRate> <packageLineRate>85</packageLineRate>
|
||||
<packageBranchRate>85</packageBranchRate> <regexes> <regex> <pattern>com.example.reallyimportant.*</pattern>
|
||||
<branchRate>90</branchRate> <lineRate>80</lineRate> </regex> <regex> <pattern>com.example.boringcode.*</pattern>
|
||||
<branchRate>40</branchRate> <lineRate>30</lineRate> </regex> </regexes> </check>
|
||||
</configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal>
|
||||
</goals> </execution> </executions> </plugin> -->
|
||||
</plugins>
|
||||
<resources>
|
||||
</resources>
|
||||
<testResources>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-jpaserver-base/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-dstu/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-dstu2/src/test/resources</directory>
|
||||
</testResource>
|
||||
<testResource>
|
||||
<directory>../hapi-fhir-structures-hl7org-dstu2/src/test/resources</directory>
|
||||
</testResource>
|
||||
</testResources>
|
||||
</build>
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>cobertura</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>${maven_project_info_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>checkstyle</report>
|
||||
</reports>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
<configuration>
|
||||
<linkXRef>false</linkXRef>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
|
@ -1002,7 +1002,7 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
return singleCode;
|
||||
}
|
||||
|
||||
private void createSort(CriteriaBuilder theBuilder, Root<ResourceTable> theFrom, SortSpec theSort, List<Order> theOrders, List<Predicate> thePredicates) {
|
||||
private void createSort(CriteriaBuilder theBuilder, Root<ResourceTable> theFrom, SortSpec theSort, List<Order> theOrders) {
|
||||
if (theSort == null || isBlank(theSort.getParamName())) {
|
||||
return;
|
||||
}
|
||||
|
@ -1017,7 +1017,7 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
theOrders.add(theBuilder.desc(theFrom.get("myId")));
|
||||
}
|
||||
|
||||
createSort(theBuilder, theFrom, theSort.getChain(), theOrders, null);
|
||||
createSort(theBuilder, theFrom, theSort.getChain(), theOrders);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1039,6 +1039,10 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
joinAttrName = "myParamsDate";
|
||||
sortAttrName = "myValueLow";
|
||||
break;
|
||||
case REFERENCE:
|
||||
joinAttrName = "myResourceLinks";
|
||||
sortAttrName = "myTargetResourcePid";
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException("This server does not support _sort specifications of type " + param.getParamType() + " - Can't serve _sort=" + theSort.getParamName());
|
||||
}
|
||||
|
@ -1054,7 +1058,7 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
theOrders.add(theBuilder.desc(stringJoin.get(sortAttrName)));
|
||||
}
|
||||
|
||||
createSort(theBuilder, theFrom, theSort.getChain(), theOrders, null);
|
||||
createSort(theBuilder, theFrom, theSort.getChain(), theOrders);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1142,6 +1146,10 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
return outcome;
|
||||
}
|
||||
|
||||
/**
|
||||
* May
|
||||
* @param theResource The resource that is about to be stored
|
||||
*/
|
||||
protected void preProcessResourceForStorage(T theResource) {
|
||||
// nothing by default
|
||||
}
|
||||
|
@ -1655,7 +1663,7 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
CriteriaQuery<Tuple> cq = builder.createTupleQuery();
|
||||
Root<ResourceTable> from = cq.from(ResourceTable.class);
|
||||
predicates.add(from.get("myId").in(loadPids));
|
||||
createSort(builder, from, theParams.getSort(), orders, predicates);
|
||||
createSort(builder, from, theParams.getSort(), orders);
|
||||
if (orders.size() > 0) {
|
||||
Set<Long> originalPids = loadPids;
|
||||
loadPids = new LinkedHashSet<Long>();
|
||||
|
|
|
@ -7,7 +7,7 @@ import org.junit.Test;
|
|||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Condition;
|
||||
|
||||
public class BaseFhirDaoTest {
|
||||
public class BaseFhirDaoTest extends BaseJpaTest {
|
||||
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2();
|
||||
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package ca.uhn.fhir.jpa.dao;
|
||||
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLNonTransientConnectionException;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
|
||||
public class BaseJpaTest {
|
||||
|
||||
@AfterClass
|
||||
public static void afterClassShutdownDerby() throws SQLException {
|
||||
// try {
|
||||
// DriverManager.getConnection("jdbc:derby:memory:myUnitTestDB;drop=true");
|
||||
// } catch (SQLNonTransientConnectionException e) {
|
||||
// // expected.. for some reason....
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
|
||||
public class FhirResourceDaoDstu1Test {
|
||||
public class FhirResourceDaoDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static ClassPathXmlApplicationContext ourCtx;
|
||||
private static IFhirResourceDao<Device> ourDeviceDao;
|
||||
|
|
|
@ -93,7 +93,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public class FhirResourceDaoDstu2Test {
|
||||
public class FhirResourceDaoDstu2Test extends BaseJpaTest {
|
||||
|
||||
private static ClassPathXmlApplicationContext ourCtx;
|
||||
private static IFhirResourceDao<Device> ourDeviceDao;
|
||||
|
@ -2210,6 +2210,67 @@ public class FhirResourceDaoDstu2Test {
|
|||
assertThat(actual, contains(id3, id2, id1, id4));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSortByReference() {
|
||||
String methodName = "testSortByReference";
|
||||
|
||||
Organization o1 = new Organization();
|
||||
IdDt oid1 = ourOrganizationDao.create(o1).getId().toUnqualifiedVersionless();
|
||||
|
||||
Organization o2 = new Organization();
|
||||
IdDt oid2 = ourOrganizationDao.create(o2).getId().toUnqualifiedVersionless();
|
||||
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
p.addName().addFamily("testSortF1").addGiven("testSortG1");
|
||||
p.getManagingOrganization().setReference(oid1);
|
||||
IdDt id1 = ourPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
p.addName().addFamily("testSortF2").addGiven("testSortG2");
|
||||
p.getManagingOrganization().setReference(oid2);
|
||||
IdDt id2 = ourPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
p.addName().addFamily("testSortF3").addGiven("testSortG3");
|
||||
p.getManagingOrganization().setReference(oid1);
|
||||
IdDt id3 = ourPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||
|
||||
p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue(methodName);
|
||||
p.getManagingOrganization().setReference(oid2);
|
||||
IdDt id4 = ourPatientDao.create(p).getId().toUnqualifiedVersionless();
|
||||
|
||||
SearchParameterMap pm;
|
||||
List<IdDt> actual;
|
||||
|
||||
pm = new SearchParameterMap();
|
||||
pm.add(Patient.SP_IDENTIFIER, new TokenParam("urn:system", methodName));
|
||||
pm.setSort(new SortSpec(Patient.SP_ORGANIZATION));
|
||||
actual = toUnqualifiedVersionlessIds(ourPatientDao.search(pm));
|
||||
assertEquals(4, actual.size());
|
||||
assertThat(actual.subList(0, 2), containsInAnyOrder(id1, id3));
|
||||
assertThat(actual.subList(2, 4), containsInAnyOrder(id2, id4));
|
||||
|
||||
pm = new SearchParameterMap();
|
||||
pm.add(Patient.SP_IDENTIFIER, new TokenParam("urn:system", methodName));
|
||||
pm.setSort(new SortSpec(Patient.SP_ORGANIZATION).setOrder(SortOrderEnum.ASC));
|
||||
actual = toUnqualifiedVersionlessIds(ourPatientDao.search(pm));
|
||||
assertEquals(4, actual.size());
|
||||
assertThat(actual.subList(0, 2), containsInAnyOrder(id1, id3));
|
||||
assertThat(actual.subList(2, 4), containsInAnyOrder(id2, id4));
|
||||
|
||||
pm = new SearchParameterMap();
|
||||
pm.add(Patient.SP_IDENTIFIER, new TokenParam("urn:system", methodName));
|
||||
pm.setSort(new SortSpec(Patient.SP_ORGANIZATION).setOrder(SortOrderEnum.DESC));
|
||||
actual = toUnqualifiedVersionlessIds(ourPatientDao.search(pm));
|
||||
assertEquals(4, actual.size());
|
||||
assertThat(actual.subList(0, 2), containsInAnyOrder(id2, id4));
|
||||
assertThat(actual.subList(2, 4), containsInAnyOrder(id1, id3));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStoreUnversionedResources() {
|
||||
Organization o1 = new Organization();
|
||||
|
|
|
@ -45,7 +45,7 @@ import ca.uhn.fhir.rest.param.TokenParam;
|
|||
import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||
|
||||
public class FhirSystemDaoDstu1Test {
|
||||
public class FhirSystemDaoDstu1Test extends BaseJpaTest {
|
||||
|
||||
private static ClassPathXmlApplicationContext ourCtx;
|
||||
private static FhirContext ourFhirContext;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue