This commit is contained in:
jamesagnew 2014-11-08 10:36:27 -05:00
parent 4117989784
commit d1fb878c55
591 changed files with 405021 additions and 1985 deletions

8
.gitignore vendored
View File

@ -1,5 +1,13 @@
/bin
/target
target/
.idea/
.project/
.settings/
.metadata/
RemoteSystemsTempFiles/
Servers/
*.iml
*.log
*.log*
nohup.out

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hapi-deployable-pom</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

115
hapi-deployable-pom/pom.xml Normal file
View File

@ -0,0 +1,115 @@
<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>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hapi-deployable-pom</artifactId>
<packaging>pom</packaging>
<name>HAPI FHIR - Deployable Artifact Parent POM</name>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<reportSets>
<reportSet>
<reports>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
<reportSets>
<reportSet>
<id>default</id>
<reports>
<report>javadoc</report>
</reports>
<configuration>
<links>
<link>http://docs.oracle.com/javaee/7/api</link>
</links>
</configuration>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<profiles>
<profile>
<id>DIST</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<minmemory>128m</minmemory>
<maxmemory>1g</maxmemory>
<linksource>true</linksource>
<verbose>false</verbose>
<debug>false</debug>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven_source_plugin_version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${maven_license_plugin_version}</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<licenseName>apache_v2</licenseName>
<canUpdateDescription>true</canUpdateDescription>
<canUpdateCopyright>true</canUpdateCopyright>
<roots>
<root>src/main/java</root>
</roots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

View File

@ -1,2 +1,3 @@
/target
/bin
/target/

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@ -17,7 +17,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>

View File

@ -0,0 +1,55 @@
<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>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-base-examples</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR - Examples (for site)</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.8-SNAPSHOT</version>
<<<<<<< HEAD
=======
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
>>>>>>> versions
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit_version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -6,6 +6,8 @@ import java.util.List;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.resource.BaseConformance;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
@ -82,19 +84,19 @@ public class GenericClientExample {
// START SNIPPET: conformance
// Retrieve the server's conformance statement and print its
// description
Conformance conf = client.conformance();
System.out.println(conf.getDescription().getValue());
BaseConformance conf = client.conformance();
System.out.println(conf.getDescriptionElement().getValue());
// END SNIPPET: conformance
}
{
// START SNIPPET: delete
// Retrieve the server's conformance statement and print its
// description
OperationOutcome outcome = client.delete().resourceById(new IdDt("Patient", "1234")).execute();
BaseOperationOutcome outcome = client.delete().resourceById(new IdDt("Patient", "1234")).execute();
// outcome may be null if the server didn't return one
if (outcome != null) {
System.out.println(outcome.getIssueFirstRep().getDetails().getValue());
System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
}
// END SNIPPET: delete
}

View File

@ -19,6 +19,7 @@ import ca.uhn.fhir.model.api.Tag;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.rest.annotation.TagListParam;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.dstu.resource.Conformance;
@ -430,7 +431,7 @@ public List<Observation> searchByObservationNames(
// The list here will contain 0..* codings, and any observations which match any of the
// given codings should be returned
List<CodingDt> wantedCodings = theCodings.getListAsCodings();
List<BaseCodingDt> wantedCodings = theCodings.getListAsCodings();
List<Observation> retVal = new ArrayList<Observation>();
// ...populate...

View File

@ -3,9 +3,9 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<relativePath>../pom.xml</relativePath>
<artifactId>hapi-deployable-pom</artifactId>
<version>0.8-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-base</artifactId>
@ -178,7 +178,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<version>${servlet_api_version}</version>
<scope>provided</scope>
</dependency>
@ -189,395 +189,16 @@
<version>${junit_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlets</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>9.1.1.v20140108</version>
<scope>test</scope>
</dependency>
<!-- UNIT TEST DEPENDENCIES -->
<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>hamcrest-all</artifactId>
<version>${hamcrest_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava_version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.2.RELEASE</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changes-plugin</artifactId>
<version>2.10</version>
<inherited>false</inherited>
<reportSets>
<reportSet>
<reports>
<report>changes-report</report>
</reports>
</reportSet>
</reportSets>
<configuration>
<feedType>atom_1.0</feedType>
<issueLinkTemplatePerSystem>
<default>http://sourceforge.net/support/tracker.php?aid=%ISSUE%</default>
<newbugs>https://sourceforge.net/p/hl7api/bugs/%ISSUE%/</newbugs>
<newfeatures>https://sourceforge.net/p/hl7api/feature-requests/%ISSUE%/</newfeatures>
</issueLinkTemplatePerSystem>
<escapeHTML>false</escapeHTML>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<reportSets>
<reportSet>
<reports>
<report>project-team</report>
<report>issue-tracking</report>
<report>license</report>
<report>scm</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-linkcheck-plugin</artifactId> <version>1.1</version> </plugin> -->
</plugins>
</reporting>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<siteMainDirectory>${user.home}/sites/hapi-fhir</siteMainDirectory>
<scmPubCheckoutDirectory>${user.home}/sites/scm/hapi-fhir</scmPubCheckoutDirectory>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>${maven_site_plugin_version}</version>
<configuration>
<skip>false</skip>
<skipDeploy>true</skipDeploy>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-scm</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-api</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>addSyntaxHighlighter</id>
<phase>site</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo>Adding Syntax Highlighter</echo>
<replace dir="target/site" summary="true">
<include name="*.html"></include>
<replacetoken><![CDATA[</body>]]></replacetoken>
<replacevalue><![CDATA[
<script type="text/javascript">
var elements = document.getElementsByClassName("source");
for (var i=0; i < elements.length; i++) {
var pres = elements[i].getElementsByTagName("pre");
for (var j = 0; j < pres.length; j++) {
var pre = pres[j];
if (pre.innerHTML.match(/\/\*/)) {
pre.className = 'brush: java';
} else if (pre.innerHTML.match(/^\/\//)) {
pre.className = 'brush: java';
} else if (pre.innerHTML.match(/^\{/)) {
pre.className = 'brush: jscript';
} else if (pre.innerHTML.match(/^\#/)) {
pre.className = 'brush: bash';
} else if (pre.innerHTML.match(/\&lt\;\//)) {
pre.className = 'brush: xml';
} else {
pre.className = 'brush: java';
}
}
}
SyntaxHighlighter.all();
</script>
</body>
]]></replacevalue>
</replace>
</target>
</configuration>
</execution>
<execution>
<id>addAnalytics</id>
<phase>post-site</phase>
<configuration>
<target>
<echo>Adding Google analytics in target/site for &lt;body&gt;</echo>
<replace dir="target/site" summary="true">
<include name="**/*.html"></include>
<replacefilter token="#build#" value="${label}" />
<replacefilter token="#version#" value="${project.version}" />
<replacetoken><![CDATA[</body>]]></replacetoken>
<replacevalue><![CDATA[
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1395874-5', 'auto');
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');
</script>
</body >
]]></replacevalue>
</replace>
<echo>Adding Google analytics in target/site for &lt;BODY&gt;</echo>
<replace dir="target/site" summary="true">
<include name="**/*.html"></include>
<replacetoken><![CDATA[</BODY>]]></replacetoken>
<replacevalue><![CDATA[
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-1395874-5', 'auto');
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');
</script>
</BODY >
]]></replacevalue>
</replace>
<echo>Adding social plugins for HAPI</echo>
<replace dir="target/site/" summary="true">
<include name="**/*.html"></include>
<replacetoken><![CDATA[SOCIALPLUGINSHEREFHIR]]></replacetoken>
<replacevalue><![CDATA[
<table cellpadding="0" cellspacing="0" border="0"><tr>
<td><div class="g-plusone" data-annotation="inline" data-width="300" data-href="http://hl7api.sourceforge.net/"></div></td>
<td><div class="fb-like" data-href="http://hl7api.sourceforge.net/" data-send="false" data-layout="button_count" data-width="450" data-show-faces="true"></div></td>
</tr></table>
</p><p>
<!-- Place this tag after the last +1 button tag. -->
<script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();
</script>
<div id="fb-root"></div>
<script>(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
]]></replacevalue>
</replace>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<executions>
<execution>
<id>stage-for-scm-publish</id>
<phase>post-site</phase>
<goals>
<goal>stage</goal>
</goals>
<configuration>
<stagingDirectory>${siteMainDirectory}</stagingDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-publish-plugin</artifactId>
<version>1.1</version>
<configuration>
<checkoutDirectory>${scmPubCheckoutDirectory}</checkoutDirectory>
<content>\${siteMainDirectory}</content>
<tryUpdate>true</tryUpdate>
<scmBranch>gh-pages</scmBranch>
<pubScmUrl>scm:git:git@github.com:jamesagnew/hapi-fhir.git</pubScmUrl>
</configuration>
<executions>
<execution>
<id>scm-publish</id>
<phase>site-deploy</phase>
<goals>
<goal>publish-scm</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<!-- <extensions> <extension> <groupId>org.apache.maven.wagon</groupId> <artifactId>wagon-scm</artifactId> <version>2.6</version> </extension> <extension> <groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId> <version>1.9</version> </extension> <extension> <groupId>org.apache.maven.scm</groupId> <artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9</version> </extension> </extensions> -->
</build>
<profiles>
@ -585,40 +206,10 @@
<id>MINI</id>
</profile>
<profile>
<id>DEFAULT</id>
<!--
The default profile has a bunch of the site plugins that
take longer to execute, so that they can be skipped for
testing the site build
-->
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<id>SITE</id>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven_surefire_plugin_version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
<configuration>
<links>
<link>http://docs.oracle.com/javaee/7/api</link>
</links>
</configuration>
<reportSets>
<reportSet>
<id>default</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
@ -649,6 +240,7 @@
</reportSet>
</reportSets>
</plugin>
-->
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@ -666,39 +258,6 @@
<id>DIST</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<minmemory>128m</minmemory>
<maxmemory>1g</maxmemory>
<linksource>true</linksource>
<verbose>false</verbose>
<debug>false</debug>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${maven_source_plugin_version}</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${maven_assembly_plugin_version}</version>
@ -718,28 +277,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${maven_license_plugin_version}</version>
<executions>
<execution>
<id>first</id>
<goals>
<goal>update-file-header</goal>
</goals>
<phase>process-sources</phase>
<configuration>
<licenseName>apache_v2</licenseName>
<canUpdateDescription>true</canUpdateDescription>
<canUpdateCopyright>true</canUpdateCopyright>
<roots>
<root>src/main/java</root>
</roots>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

View File

@ -81,10 +81,10 @@ public abstract class BaseRuntimeDeclaredChildDefinition extends BaseRuntimeChil
if (ourUseMethodAccessors == null) {
try {
myField.setAccessible(true);
ourUseMethodAccessors = true;
ourUseMethodAccessors = false;
} catch (SecurityException e) {
ourLog.info("Can not use field accessors/mutators, going to use methods instead");
ourUseMethodAccessors = false;
ourUseMethodAccessors = true;
}
}

View File

@ -32,6 +32,7 @@ import org.apache.commons.lang3.text.WordUtils;
import ca.uhn.fhir.i18n.HapiLocalizer;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.view.ViewGenerator;
import ca.uhn.fhir.narrative.INarrativeGenerator;
@ -72,6 +73,7 @@ public class FhirContext {
private volatile INarrativeGenerator myNarrativeGenerator;
private volatile IRestfulClientFactory myRestfulClientFactory;
private volatile RuntimeChildUndeclaredExtensionDefinition myRuntimeChildUndeclaredExtensionDefinition;
private IFhirVersion myVersion;
/**
* Default constructor. In most cases this is the right constructor to use.
@ -90,6 +92,13 @@ public class FhirContext {
public FhirContext(Collection<Class<? extends IResource>> theResourceTypes) {
scanResourceTypes(theResourceTypes);
if (FhirVersionEnum.DSTU1.isPresentOnClasspath()) {
myVersion = FhirVersionEnum.DSTU1.getVersionImplementation();
} else {
throw new IllegalStateException("Could not find any HAPI-FHIR structure JARs on the classpath. Note that as of HAPI-FHIR v0.8, a separate FHIR strcture JAR must be added to your classpath or project pom.xml");
}
}
/**
@ -197,6 +206,10 @@ public class FhirContext {
return myRuntimeChildUndeclaredExtensionDefinition;
}
public IFhirVersion getVersion() {
return myVersion;
}
/**
* Create and return a new JSON parser.
*
@ -282,7 +295,7 @@ public class FhirContext {
}
private Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> scanResourceTypes(Collection<Class<? extends IResource>> theResourceTypes) {
ModelScanner scanner = new ModelScanner(myClassToElementDefinition, theResourceTypes);
ModelScanner scanner = new ModelScanner(this, myClassToElementDefinition, theResourceTypes);
if (myRuntimeChildUndeclaredExtensionDefinition == null) {
myRuntimeChildUndeclaredExtensionDefinition = scanner.getRuntimeChildUndeclaredExtensionDefinition();
}

View File

@ -0,0 +1,69 @@
package ca.uhn.fhir.context;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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 ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
public enum FhirVersionEnum {
DSTU1("ca.uhn.fhir.model.dstu.FhirDstu1");
private final String myVersionClass;
private volatile Boolean myPresentOnClasspath;
private volatile IFhirVersion myVersionImplementation;
FhirVersionEnum(String theVersionClass) {
myVersionClass = theVersionClass;
}
/**
* Returns true if the given version is present on the classpath
*/
public boolean isPresentOnClasspath() {
Boolean retVal = myPresentOnClasspath;
if (retVal==null) {
try {
Class.forName(myVersionClass);
retVal= true;
} catch (Exception e) {
retVal= false;
}
myPresentOnClasspath = retVal;
}
return retVal;
}
public IFhirVersion getVersionImplementation() {
if (!isPresentOnClasspath()) {
throw new IllegalStateException("Version " + name() + " is not present on classpath");
}
if (myVersionImplementation == null) {
try {
myVersionImplementation = (IFhirVersion) Class.forName(myVersionClass).newInstance();
} catch (Exception e) {
throw new InternalErrorException("Failed to instantiate FHIR version " + name(), e);
}
}
return myVersionImplementation;
}
}

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.context;
* #L%
*/
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.IOException;
import java.io.InputStream;
@ -45,6 +45,7 @@ import java.util.TreeSet;
import ca.uhn.fhir.model.api.CodeableConceptElement;
import ca.uhn.fhir.model.api.ExtensionDt;
import ca.uhn.fhir.model.api.IBoundCodeableConcept;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.ICompositeElement;
@ -64,10 +65,8 @@ import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
import ca.uhn.fhir.model.base.composite.BaseResourceReferenceDt;
import ca.uhn.fhir.model.dstu.composite.ContainedDt;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.BoundCodeableConceptDt;
import ca.uhn.fhir.model.primitive.ICodedDatatype;
import ca.uhn.fhir.model.primitive.XhtmlDt;
import ca.uhn.fhir.util.ReflectionUtil;
@ -91,17 +90,22 @@ class ModelScanner {
private Set<Class<? extends ICodeEnum>> myScanAlsoCodeTable = new HashSet<Class<? extends ICodeEnum>>();
ModelScanner(Class<? extends IResource> theResourceTypes) throws ConfigurationException {
private FhirContext myContext;
ModelScanner(FhirContext theContext, Class<? extends IResource> theResourceTypes) throws ConfigurationException {
myContext=theContext;
Set<Class<? extends IElement>> singleton = new HashSet<Class<? extends IElement>>();
singleton.add(theResourceTypes);
init(null, singleton);
}
ModelScanner(Collection<Class<? extends IResource>> theResourceTypes) throws ConfigurationException {
ModelScanner(FhirContext theContext, Collection<Class<? extends IResource>> theResourceTypes) throws ConfigurationException {
myContext=theContext;
init(null, new HashSet<Class<? extends IElement>>(theResourceTypes));
}
ModelScanner(Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theExistingDefinitions, Collection<Class<? extends IResource>> theResourceTypes) throws ConfigurationException {
ModelScanner(FhirContext theContext, Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theExistingDefinitions, Collection<Class<? extends IResource>> theResourceTypes) throws ConfigurationException {
myContext=theContext;
init(theExistingDefinitions, new HashSet<Class<? extends IElement>>(theResourceTypes));
}
@ -479,7 +483,7 @@ class ModelScanner {
RuntimeChildContainedResources def = new RuntimeChildContainedResources(next, childAnnotation, descriptionAnnotation, elementName);
orderMap.put(order, def);
} else if (choiceTypes.size() > 1 && !ResourceReferenceDt.class.isAssignableFrom(nextElementType)) {
} else if (choiceTypes.size() > 1 && !BaseResourceReferenceDt.class.isAssignableFrom(nextElementType)) {
/*
* Child is a choice element
*/
@ -514,7 +518,7 @@ class ModelScanner {
List<Class<? extends IResource>> refTypesList = new ArrayList<Class<? extends IResource>>();
for (Class<? extends IElement> nextType : childAnnotation.type()) {
if (IResource.class.isAssignableFrom(nextType) == false) {
throw new ConfigurationException("Field '" + next.getName() + "' in class '" + next.getDeclaringClass().getCanonicalName() + "' is of type " + ResourceReferenceDt.class + " but contains a non-resource type: " + nextType.getCanonicalName());
throw new ConfigurationException("Field '" + next.getName() + "' in class '" + next.getDeclaringClass().getCanonicalName() + "' is of type " + BaseResourceReferenceDt.class + " but contains a non-resource type: " + nextType.getCanonicalName());
}
refTypesList.add((Class<? extends IResource>) nextType);
addScanAlso(nextType);
@ -551,7 +555,7 @@ class ModelScanner {
def = new RuntimeChildPrimitiveDatatypeDefinition(next, elementName, descriptionAnnotation, childAnnotation, nextDatatype);
}
} else {
if (nextElementType.equals(BoundCodeableConceptDt.class)) {
if (IBoundCodeableConcept.class.isAssignableFrom(nextElementType)) {
IValueSetEnumBinder<Enum<?>> binder = getBoundCodeBinder(next);
def = new RuntimeChildCompositeBoundDatatypeDefinition(next, elementName, childAnnotation, descriptionAnnotation, nextDatatype, binder);
} else if (NarrativeDt.class.getSimpleName().equals(nextElementType.getSimpleName())) {
@ -649,7 +653,7 @@ class ModelScanner {
}
}
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(resourceName, theClass, resourceDefinition);
RuntimeResourceDefinition resourceDef = new RuntimeResourceDefinition(myContext, resourceName, theClass, resourceDefinition);
myClassToElementDefinitions.put(theClass, resourceDef);
if (primaryNameProvider) {
myNameToResourceDefinitions.put(resourceName, resourceDef);

View File

@ -20,52 +20,40 @@ package ca.uhn.fhir.context;
* #L%
*/
import static org.apache.commons.lang3.StringUtils.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.IPrimitiveDatatype;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.resource.Profile;
import ca.uhn.fhir.model.dstu.resource.Profile.ExtensionDefn;
import ca.uhn.fhir.model.dstu.resource.Profile.Structure;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElement;
import ca.uhn.fhir.model.dstu.resource.Profile.StructureElementDefinitionType;
import ca.uhn.fhir.model.dstu.valueset.DataTypeEnum;
import ca.uhn.fhir.model.dstu.valueset.SlicingRulesEnum;
import ca.uhn.fhir.model.primitive.IdDt;
public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefinition<IResource> {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RuntimeResourceDefinition.class);
private RuntimeResourceDefinition myBaseDefinition;
private Map<RuntimeChildDeclaredExtensionDefinition, String> myExtensionDefToCode = new HashMap<RuntimeChildDeclaredExtensionDefinition, String>();
private String myId;
private Map<String, RuntimeSearchParam> myNameToSearchParam = new LinkedHashMap<String, RuntimeSearchParam>();
private Profile myProfileDef;
private IResource myProfileDef;
private String myResourceProfile;
private List<RuntimeSearchParam> mySearchParams;
private FhirContext myContext;
private String myId;
public RuntimeResourceDefinition(String theResourceName, Class<? extends IResource> theClass, ResourceDef theResourceAnnotation) {
public RuntimeResourceDefinition(FhirContext theContext, String theResourceName, Class<? extends IResource> theClass, ResourceDef theResourceAnnotation) {
super(theResourceName, theClass);
myContext= theContext;
myResourceProfile = theResourceAnnotation.profile();
myId = theResourceAnnotation.id();
}
public String getId() {
return myId;
}
public void addSearchParam(RuntimeSearchParam theParam) {
myNameToSearchParam.put(theParam.getName(), theParam);
}
@ -129,253 +117,17 @@ public class RuntimeResourceDefinition extends BaseRuntimeElementCompositeDefini
} while (target.equals(Object.class)==false);
}
public synchronized Profile toProfile() {
public synchronized IResource toProfile() {
if (myProfileDef != null) {
return myProfileDef;
}
Profile retVal = new Profile();
RuntimeResourceDefinition def = this;
if (StringUtils.isBlank(myId)) {
myId = getName().toLowerCase();
}
retVal.setId(new IdDt(myId));
// Scan for extensions
scanForExtensions(retVal, def);
Collections.sort(retVal.getExtensionDefn(), new Comparator<ExtensionDefn>() {
@Override
public int compare(ExtensionDefn theO1, ExtensionDefn theO2) {
return theO1.getCode().compareTo(theO2.getCode());
}
});
// Scan for children
retVal.setName(getName());
Structure struct = retVal.addStructure();
LinkedList<String> path = new LinkedList<String>();
StructureElement element = struct.addElement();
element.getDefinition().setMin(1);
element.getDefinition().setMax("1");
fillProfile(struct, element, def, path, null);
retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
IResource retVal = myContext.getVersion().generateProfile(this);
myProfileDef = retVal;
return retVal;
}
private void fillBasics(StructureElement theElement, BaseRuntimeElementDefinition<?> def, LinkedList<String> path, BaseRuntimeDeclaredChildDefinition theChild) {
if (path.isEmpty()) {
path.add(def.getName());
theElement.setName(def.getName());
} else {
path.add(WordUtils.uncapitalize(theChild.getElementName()));
theElement.setName(theChild.getElementName());
}
theElement.setPath(StringUtils.join(path, '.'));
}
private void fillExtensions(Structure theStruct, LinkedList<String> path, List<RuntimeChildDeclaredExtensionDefinition> extList, String elementName, boolean theIsModifier) {
if (extList.size() > 0) {
StructureElement extSlice = theStruct.addElement();
extSlice.setName(elementName);
extSlice.setPath(join(path, '.') + '.' + elementName);
extSlice.getSlicing().getDiscriminator().setValue("url");
extSlice.getSlicing().setOrdered(false);
extSlice.getSlicing().setRules(SlicingRulesEnum.OPEN);
extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);
for (RuntimeChildDeclaredExtensionDefinition nextExt : extList) {
StructureElement nextProfileExt = theStruct.addElement();
nextProfileExt.getDefinition().setIsModifier(theIsModifier);
nextProfileExt.setName(extSlice.getName());
nextProfileExt.setPath(extSlice.getPath());
fillMinAndMaxAndDefinitions(nextExt, nextProfileExt);
StructureElementDefinitionType type = nextProfileExt.getDefinition().addType();
type.setCode(DataTypeEnum.EXTENSION);
if (nextExt.isDefinedLocally()) {
type.setProfile(nextExt.getExtensionUrl().substring(nextExt.getExtensionUrl().indexOf('#')));
} else {
type.setProfile(nextExt.getExtensionUrl());
}
}
} else {
StructureElement extSlice = theStruct.addElement();
extSlice.setName(elementName);
extSlice.setPath(join(path, '.') + '.' + elementName);
extSlice.getDefinition().setIsModifier(theIsModifier);
extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);
extSlice.getDefinition().setMin(0);
extSlice.getDefinition().setMax("*");
}
}
private void fillMinAndMaxAndDefinitions(BaseRuntimeDeclaredChildDefinition child, StructureElement elem) {
elem.getDefinition().setMin(child.getMin());
if (child.getMax() == Child.MAX_UNLIMITED) {
elem.getDefinition().setMax("*");
} else {
elem.getDefinition().setMax(Integer.toString(child.getMax()));
}
if (isNotBlank(child.getShortDefinition())) {
elem.getDefinition().getShort().setValue(child.getShortDefinition());
}
if (isNotBlank(child.getFormalDefinition())) {
elem.getDefinition().getFormal().setValue(child.getFormalDefinition());
}
}
private void fillName(StructureElement elem, BaseRuntimeElementDefinition<?> nextDef) {
if (nextDef instanceof RuntimeResourceReferenceDefinition) {
RuntimeResourceReferenceDefinition rr = (RuntimeResourceReferenceDefinition) nextDef;
for (Class<? extends IResource> next : rr.getResourceTypes()) {
StructureElementDefinitionType type = elem.getDefinition().addType();
type.getCode().setValue("ResourceReference");
if (next != IResource.class) {
RuntimeResourceDefinition resDef = rr.getDefinitionForResourceType(next);
type.getProfile().setValueAsString(resDef.getResourceProfile());
}
}
return;
}
StructureElementDefinitionType type = elem.getDefinition().addType();
String name = nextDef.getName();
DataTypeEnum fromCodeString = DataTypeEnum.VALUESET_BINDER.fromCodeString(name);
if (fromCodeString == null) {
throw new ConfigurationException("Unknown type: " + name);
}
type.setCode(fromCodeString);
}
private void fillProfile(Structure theStruct, StructureElement theElement, BaseRuntimeElementDefinition<?> def, LinkedList<String> path, BaseRuntimeDeclaredChildDefinition theChild) {
fillBasics(theElement, def, path, theChild);
String expectedPath = StringUtils.join(path, '.');
ourLog.info("Filling profile for: {} - Path: {}", expectedPath);
String name = def.getName();
if (!expectedPath.equals(name)) {
path.pollLast();
theElement.getDefinition().getNameReference().setValue(def.getName());
return;
}
fillExtensions(theStruct, path, def.getExtensionsNonModifier(), "extension", false);
fillExtensions(theStruct, path, def.getExtensionsModifier(), "modifierExtension", true);
if (def.getChildType() == ChildTypeEnum.RESOURCE) {
StructureElement narrative = theStruct.addElement();
narrative.setName("text");
narrative.setPath(join(path, '.') + ".text");
narrative.getDefinition().addType().setCode(DataTypeEnum.NARRATIVE);
narrative.getDefinition().setIsModifier(false);
narrative.getDefinition().setMin(0);
narrative.getDefinition().setMax("1");
StructureElement contained = theStruct.addElement();
contained.setName("contained");
contained.setPath(join(path, '.') + ".contained");
contained.getDefinition().addType().getCode().setValue("Resource");
contained.getDefinition().setIsModifier(false);
contained.getDefinition().setMin(0);
contained.getDefinition().setMax("1");
}
if (def instanceof BaseRuntimeElementCompositeDefinition) {
BaseRuntimeElementCompositeDefinition<?> cdef = ((BaseRuntimeElementCompositeDefinition<?>) def);
for (BaseRuntimeChildDefinition nextChild : cdef.getChildren()) {
if (nextChild instanceof RuntimeChildUndeclaredExtensionDefinition) {
continue;
}
BaseRuntimeDeclaredChildDefinition child = (BaseRuntimeDeclaredChildDefinition) nextChild;
StructureElement elem = theStruct.addElement();
fillMinAndMaxAndDefinitions(child, elem);
if (child instanceof RuntimeChildResourceBlockDefinition) {
RuntimeResourceBlockDefinition nextDef = (RuntimeResourceBlockDefinition) child.getSingleChildOrThrow();
fillProfile(theStruct, elem, nextDef, path, child);
} else if (child instanceof RuntimeChildContainedResources) {
// ignore
} else if (child instanceof RuntimeChildDeclaredExtensionDefinition) {
throw new IllegalStateException("Unexpected child type: " + child.getClass().getCanonicalName());
} else if (child instanceof RuntimeChildCompositeDatatypeDefinition || child instanceof RuntimeChildPrimitiveDatatypeDefinition || child instanceof RuntimeChildChoiceDefinition
|| child instanceof RuntimeChildResourceDefinition) {
Iterator<String> childNamesIter = child.getValidChildNames().iterator();
String nextName = childNamesIter.next();
BaseRuntimeElementDefinition<?> nextDef = child.getChildByName(nextName);
fillBasics(elem, nextDef, path, child);
fillName(elem, nextDef);
while (childNamesIter.hasNext()) {
nextDef = child.getChildByName(childNamesIter.next());
fillName(elem, nextDef);
}
path.pollLast();
} else {
throw new IllegalStateException("Unexpected child type: " + child.getClass().getCanonicalName());
}
}
} else {
throw new IllegalStateException("Unexpected child type: " + def.getClass().getCanonicalName());
}
path.pollLast();
}
private void scanForExtensions(Profile theProfile, BaseRuntimeElementDefinition<?> def) {
BaseRuntimeElementCompositeDefinition<?> cdef = ((BaseRuntimeElementCompositeDefinition<?>) def);
for (RuntimeChildDeclaredExtensionDefinition nextChild : cdef.getExtensions()) {
if (myExtensionDefToCode.containsKey(nextChild)) {
continue;
}
if (nextChild.isDefinedLocally() == false) {
continue;
}
ExtensionDefn defn = theProfile.addExtensionDefn();
String code = null;
if (nextChild.getExtensionUrl().contains("#") && !nextChild.getExtensionUrl().endsWith("#")) {
code = nextChild.getExtensionUrl().substring(nextChild.getExtensionUrl().indexOf('#') + 1);
} else {
throw new ConfigurationException("Locally defined extension has no '#[code]' part in extension URL: " + nextChild.getExtensionUrl());
}
defn.setCode(code);
if (myExtensionDefToCode.values().contains(code)) {
throw new IllegalStateException("Duplicate extension code: " + code);
}
myExtensionDefToCode.put(nextChild, code);
if (nextChild.getChildType() != null && IPrimitiveDatatype.class.isAssignableFrom(nextChild.getChildType())) {
RuntimePrimitiveDatatypeDefinition pdef = (RuntimePrimitiveDatatypeDefinition) nextChild.getSingleChildOrThrow();
defn.getDefinition().addType().setCode(DataTypeEnum.VALUESET_BINDER.fromCodeString(pdef.getName()));
} else {
RuntimeResourceBlockDefinition pdef = (RuntimeResourceBlockDefinition) nextChild.getSingleChildOrThrow();
scanForExtensions(theProfile, pdef);
for (RuntimeChildDeclaredExtensionDefinition nextChildExt : pdef.getExtensions()) {
StructureElementDefinitionType type = defn.getDefinition().addType();
type.setCode(DataTypeEnum.EXTENSION);
type.setProfile("#" + myExtensionDefToCode.get(nextChildExt));
}
}
}
}
}

View File

@ -0,0 +1,25 @@
package ca.uhn.fhir.model.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public interface IBoundCodeableConcept {
}

View File

@ -0,0 +1,35 @@
package ca.uhn.fhir.model.api;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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 ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
public interface IFhirVersion {
IResource generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition);
Object createServerConformanceProvider(RestfulServer theServer);
IResourceProvider createServerProfilesProvider(RestfulServer theRestfulServer);
}

View File

@ -24,7 +24,6 @@ import java.util.Map;
import ca.uhn.fhir.model.dstu.composite.ContainedDt;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.IdDt;
@ -38,7 +37,7 @@ public interface IResource extends ICompositeElement {
* encoding, and copying contained resources from this list to their
* appropriate references when parsing) so it is generally not neccesary to
* interact with this list directly. Instead, in a server you can place
* resource instances in reference fields (such as {@link Patient#setManagingOrganization(ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt)})
* resource instances in reference fields (such as {@link ca.uhn.fhir.model.dstu.resource.Patient#setManagingOrganization(ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt)})
* and the resource will be automatically contained. In a client, contained resources will
* be automatically populated into their appropriate fields by the HAPI parser.
* </p>

View File

@ -38,7 +38,7 @@ public @interface ResourceDef {
String name() default "";
/**
* Not currently used
* if set, will be used as the id for any profiles generated for this resource
*/
String id() default "";

View File

@ -25,7 +25,6 @@ import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.param.ParameterUtil;
@ -39,7 +38,7 @@ public abstract class BaseCodingDt extends BaseIdentifiableElement implements IC
* <b>Definition:</b> A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p>
*/
public abstract CodeDt getCode();
public abstract CodeDt getCodeElement();
@Override
public String getQueryParameterQualifier() {
@ -53,17 +52,17 @@ public abstract class BaseCodingDt extends BaseIdentifiableElement implements IC
* <b>Definition:</b> The identification of the code system that defines the meaning of the symbol in the code.
* </p>
*/
public abstract UriDt getSystem();
public abstract UriDt getSystemElement();
/**
* {@inheritDoc}
*/
@Override
public String getValueAsQueryToken() {
if (getSystem().getValueAsString() != null) {
return ParameterUtil.escape(StringUtils.defaultString(getSystem().getValueAsString())) + '|' + ParameterUtil.escape(getCode().getValueAsString());
if (getSystemElement().getValueAsString() != null) {
return ParameterUtil.escape(StringUtils.defaultString(getSystemElement().getValueAsString())) + '|' + ParameterUtil.escape(getCodeElement().getValueAsString());
} else {
return ParameterUtil.escape(getCode().getValueAsString());
return ParameterUtil.escape(getCodeElement().getValueAsString());
}
}
@ -82,14 +81,14 @@ public abstract class BaseCodingDt extends BaseIdentifiableElement implements IC
}
/**
* Returns true if <code>this</code> Coding has the same {@link CodingDt#getCode() Code} and {@link CodingDt#getSystem() system} (as compared by simple equals comparison). Does not compare other
* Codes (e.g. {@link CodingDt#getUse() use}) or any extensions.
* Returns true if <code>this</code> Coding has the same {@link ca.uhn.fhir.model.dstu.composite.InternalCodingDt#getCode() Code} and {@link ca.uhn.fhir.model.dstu.composite.InternalCodingDt#getSystem() system} (as compared by simple equals comparison). Does not compare other
* Codes (e.g. {@link ca.uhn.fhir.model.dstu.composite.InternalCodingDt#getUse() use}) or any extensions.
*/
public boolean matchesSystemAndCode(BaseCodingDt theCoding) {
if (theCoding == null) {
return false;
}
return getCode().equals(theCoding.getCode()) && getSystem().equals(theCoding.getSystem());
return getCodeElement().equals(theCoding.getCodeElement()) && getSystemElement().equals(theCoding.getSystemElement());
}
/**

View File

@ -0,0 +1,25 @@
package ca.uhn.fhir.model.base.composite;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class BaseContainedDt {
}

View File

@ -23,9 +23,9 @@ package ca.uhn.fhir.model.base.composite;
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.param.ParameterUtil;
@ -38,83 +38,73 @@ public abstract class BaseIdentifierDt extends BaseIdentifiableElement implement
}
/**
* Gets the value(s) for <b>system</b> (The namespace for the identifier).
* creating it if it does
* not exist. Will not return <code>null</code>.
* Gets the value(s) for <b>system</b> (The namespace for the identifier). creating it if it does not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Establishes the namespace in which set of possible id values is unique.
* </p>
* <p>
* <b>Definition:</b> Establishes the namespace in which set of possible id values is unique.
* </p>
*/
public abstract UriDt getSystem() ;
public abstract UriDt getSystemElement();
/**
* Gets the value(s) for <b>value</b> (The value that is unique).
* creating it if it does
* not exist. Will not return <code>null</code>.
* Gets the value(s) for <b>value</b> (The value that is unique). creating it if it does not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The portion of the identifier typically displayed to the user and which is unique within the context of the system.
* </p>
* <p>
* <b>Definition:</b> The portion of the identifier typically displayed to the user and which is unique within the context of the system.
* </p>
*/
public abstract StringDt getValue();
public abstract StringDt getValueElement();
/**
* {@inheritDoc}
*/
@Override
public String getValueAsQueryToken() {
if (getSystem().getValueAsString() != null) {
return ParameterUtil.escape(StringUtils.defaultString(getSystem().getValueAsString())) + '|' + ParameterUtil.escape(getValue().getValueAsString());
} else {
return ParameterUtil.escape(getValue().getValueAsString());
}
UriDt system = (UriDt) getSystemElement();
StringDt value = (StringDt) getValueElement();
if (system.getValueAsString() != null) {
return ParameterUtil.escape(StringUtils.defaultString(system.getValueAsString())) + '|' + ParameterUtil.escape(value.getValueAsString());
} else {
return ParameterUtil.escape(value.getValueAsString());
}
}
/**
* Returns true if <code>this</code> identifier has the same {@link IdentifierDt#getValue() value}
* and {@link IdentifierDt#getSystem() system} (as compared by simple equals comparison).
* Does not compare other values (e.g. {@link IdentifierDt#getUse() use}) or any extensions.
* Returns true if <code>this</code> identifier has the same {@link ca.uhn.fhir.model.dstu.composite.IdentifierDt#getValue() value} and
* {@link ca.uhn.fhir.model.dstu.composite.IdentifierDt#getSystem() system} (as compared by simple equals comparison). Does not compare other values (e.g.
* {@link ca.uhn.fhir.model.dstu.composite.IdentifierDt#getUse() use}) or any extensions.
*/
public boolean matchesSystemAndValue(BaseIdentifierDt theIdentifier) {
if (theIdentifier == null) {
return false;
}
return getValue().equals(theIdentifier.getValue()) && getSystem().equals(theIdentifier.getSystem());
return getValueElement().equals(theIdentifier.getValueElement()) && getSystemElement().equals(theIdentifier.getSystemElement());
}
/**
/**
* Sets the value for <b>system</b> (The namespace for the identifier)
*
* <p>
* <b>Definition:</b>
* Establishes the namespace in which set of possible id values is unique.
* </p>
* <p>
* <b>Definition:</b> Establishes the namespace in which set of possible id values is unique.
* </p>
*/
public abstract BaseIdentifierDt setSystem( String theUri);
public abstract BaseIdentifierDt setSystem(String theUri);
/**
* Sets the value for <b>value</b> (The value that is unique)
*
* <p>
* <b>Definition:</b>
* The portion of the identifier typically displayed to the user and which is unique within the context of the system.
* </p>
* <p>
* <b>Definition:</b> The portion of the identifier typically displayed to the user and which is unique within the context of the system.
* </p>
*/
public abstract BaseIdentifierDt setValue( String theString);
public abstract BaseIdentifierDt setValue(String theString);
/**
* {@inheritDoc}
*/
@Override
public void setValueAsQueryToken(String theQualifier, String theParameter) {
int barIndex = ParameterUtil.nonEscapedIndexOf(theParameter,'|');
int barIndex = ParameterUtil.nonEscapedIndexOf(theParameter, '|');
if (barIndex != -1) {
setSystem(theParameter.substring(0, barIndex));
setValue(ParameterUtil.unescape(theParameter.substring(barIndex + 1)));

View File

@ -50,7 +50,7 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
@Override
public void setValueAsQueryToken(String theQualifier, String theValue) {
getComparator().setValue(null);
getComparatorElement().setValue(null);
setCode( null);
setSystem(null);
setUnits( null);
@ -62,16 +62,16 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
String[] parts = theValue.split("\\|");
if (parts.length > 0 && StringUtils.isNotBlank(parts[0])) {
if (parts[0].startsWith("<=")) {
getComparator().setValue(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS.getCode());
getComparatorElement().setValue(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS.getCode());
setValue(new BigDecimal(parts[0].substring(2)));
} else if (parts[0].startsWith("<")) {
getComparator().setValue(QuantityCompararatorEnum.LESSTHAN.getCode());
getComparatorElement().setValue(QuantityCompararatorEnum.LESSTHAN.getCode());
setValue(new BigDecimal(parts[0].substring(1)));
} else if (parts[0].startsWith(">=")) {
getComparator().setValue(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS.getCode());
getComparatorElement().setValue(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS.getCode());
setValue(new BigDecimal(parts[0].substring(2)));
} else if (parts[0].startsWith(">")) {
getComparator().setValue(QuantityCompararatorEnum.GREATERTHAN.getCode());
getComparatorElement().setValue(QuantityCompararatorEnum.GREATERTHAN.getCode());
setValue(new BigDecimal(parts[0].substring(1)));
} else {
setValue(new BigDecimal(parts[0]));
@ -96,24 +96,24 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is \"<\" , then the real value is < stated value
* </p>
*/
public abstract BoundCodeDt<?> getComparator();
public abstract BoundCodeDt<?> getComparatorElement();
@Override
public String getValueAsQueryToken() {
StringBuilder b= new StringBuilder();
if (getComparator() != null) {
b.append(getComparator().getValue());
if (getComparatorElement() != null) {
b.append(getComparatorElement().getValue());
}
if (!getValue().isEmpty()) {
b.append(getValue().getValueAsString());
if (!getValueElement().isEmpty()) {
b.append(getValueElement().getValueAsString());
}
b.append('|');
if (!getSystem().isEmpty()) {
b.append(getSystem().getValueAsString());
if (!getSystemElement().isEmpty()) {
b.append(getSystemElement().getValueAsString());
}
b.append('|');
if (!getUnits().isEmpty()) {
b.append(getUnits().getValueAsString());
if (!getUnitsElement().isEmpty()) {
b.append(getUnitsElement().getValueAsString());
}
return b.toString();
@ -150,7 +150,7 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
* The identification of the system that provides the coded form of the unit
* </p>
*/
public abstract UriDt getSystem();
public abstract UriDt getSystemElement();
@ -174,7 +174,7 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
* A computer processable form of the units in some unit representation system
* </p>
*/
public abstract CodeDt getCode();
public abstract CodeDt getCodeElement();
/**
* Sets the value for <b>code</b> (Coded form of the unit)
@ -195,7 +195,7 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
* A human-readable form of the units
* </p>
*/
public abstract StringDt getUnits() ;
public abstract StringDt getUnitsElement() ;
/**
* Gets the value(s) for <b>value</b> (Numerical value (with implicit precision)).
* creating it if it does
@ -206,5 +206,5 @@ public abstract class BaseQuantityDt extends BaseIdentifiableElement implements
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public abstract DecimalDt getValue();
public abstract DecimalDt getValueElement();
}

View File

@ -0,0 +1,35 @@
package ca.uhn.fhir.model.base.resource;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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 ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.primitive.StringDt;
//@ResourceDef(name="Conformance")
public abstract class BaseConformance extends BaseResource implements IResource {
public abstract StringDt getDescriptionElement();
public abstract StringDt getPublisherElement();
}

View File

@ -0,0 +1,59 @@
package ca.uhn.fhir.model.base.resource;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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.List;
import ca.uhn.fhir.model.api.BaseIdentifiableElement;
import ca.uhn.fhir.model.api.BaseResource;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.IResourceBlock;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.StringDt;
public abstract class BaseOperationOutcome extends BaseResource implements IResource {
public abstract BaseIssue addIssue();
public abstract List<? extends BaseIssue> getIssue();
public abstract BaseIssue getIssueFirstRep();
public static abstract class BaseIssue extends BaseIdentifiableElement implements IResourceBlock {
public abstract CodeDt getSeverityElement();
public abstract StringDt getDetailsElement();
public abstract BaseCodingDt getType();
public abstract BaseIssue addLocation( String theString);
public abstract BaseIssue setDetails(String theString);
public abstract StringDt getLocationFirstRep();
}
}

View File

@ -0,0 +1,148 @@
package ca.uhn.fhir.model.primitive;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.api.BasePrimitive;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
import ca.uhn.fhir.parser.DataFormatException;
/**
* Represents a Time datatype, per the FHIR specification. A time is a specification of hours and minutes (and optionally
* milliseconds), with NO date and NO timezone information attached. It is expressed as a string in the form
* <code>HH:mm:ss[.SSSS]</code>
*
* <p>
* This datatype is not valid in FHIR DSTU1
* </p>
* @since FHIR DSTU 2 / HAPI 0.8
*/
@DatatypeDef(name = "time")
public class TimeDt extends BasePrimitive<String> implements IQueryParameterType {
private String myValue;
/**
* Create a new String
*/
public TimeDt() {
super();
}
/**
* Create a new String
*/
@SimpleSetter
public TimeDt(@SimpleSetter.Parameter(name = "theString") String theValue) {
myValue = theValue;
}
@Override
public String getValue() {
return myValue;
}
public String getValueNotNull() {
return StringUtils.defaultString(myValue);
}
@Override
public String getValueAsString() {
return myValue;
}
@Override
public void setValue(String theValue) throws DataFormatException {
myValue = theValue;
}
@Override
public void setValueAsString(String theValue) throws DataFormatException {
myValue = theValue;
}
/**
* Returns the value of this string, or <code>null</code>
*/
@Override
public String toString() {
return myValue;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((myValue == null) ? 0 : myValue.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
TimeDt other = (TimeDt) obj;
if (myValue == null) {
if (other.myValue != null)
return false;
} else if (!myValue.equals(other.myValue))
return false;
return true;
}
/**
* {@inheritDoc}
*/
@Override
public void setValueAsQueryToken(String theQualifier, String theValue) {
setValue(theValue);
}
/**
* {@inheritDoc}
*/
@Override
public String getValueAsQueryToken() {
return getValue();
}
/**
* Returns <code>true</code> if this datatype has no extensions, and has either a <code>null</code> value or an empty ("") value.
*/
@Override
public boolean isEmpty() {
boolean retVal = super.isBaseEmpty() && StringUtils.isBlank(getValue());
return retVal;
}
@Override
public String getQueryParameterQualifier() {
return null;
}
}

View File

@ -20,7 +20,6 @@ package ca.uhn.fhir.narrative;
* #L%
*/
import java.io.IOException;
import java.util.Arrays;
import java.util.List;
@ -39,10 +38,8 @@ public class CustomThymeleafNarrativeGenerator extends BaseThymeleafNarrativeGen
* <li>file:/path/to/file/file.properties</li>
* <li>classpath:/com/package/file.properties</li>
* </ul>
* @throws IOException
* If the file can not be found/read
*/
public CustomThymeleafNarrativeGenerator(String... thePropertyFile) throws IOException {
public CustomThymeleafNarrativeGenerator(String... thePropertyFile) {
setPropertyFile(thePropertyFile);
}
@ -55,8 +52,6 @@ public class CustomThymeleafNarrativeGenerator extends BaseThymeleafNarrativeGen
* <li>file:/path/to/file/file.properties</li>
* <li>classpath:/com/package/file.properties</li>
* </ul>
* @throws IOException
* If the file can not be found/read
*/
public void setPropertyFile(String... thePropertyFile) {
Validate.notNull(thePropertyFile, "Property file can not be null");

View File

@ -23,7 +23,6 @@ package ca.uhn.fhir.narrative;
import java.util.ArrayList;
import java.util.List;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.rest.server.RestfulServer;
@ -46,7 +45,7 @@ public class DefaultThymeleafNarrativeGenerator extends BaseThymeleafNarrativeGe
/**
* If set to <code>true</code> (default is <code>false</code>) a special custom narrative for the
* {@link Conformance} resource will be provided, which is designed to be used with
* {@link ca.uhn.fhir.model.dstu.resource.Conformance} resource will be provided, which is designed to be used with
* HAPI {@link RestfulServer} instances. This narrative provides a friendly search
* page which can assist users of the service.
*/
@ -56,7 +55,7 @@ public class DefaultThymeleafNarrativeGenerator extends BaseThymeleafNarrativeGe
/**
* If set to <code>true</code> (default is <code>false</code>) a special custom narrative for the
* {@link Conformance} resource will be provided, which is designed to be used with
* {@link ca.uhn.fhir.model.dstu.resource.Conformance} resource will be provided, which is designed to be used with
* HAPI {@link RestfulServer} instances. This narrative provides a friendly search
* page which can assist users of the service.
*/

View File

@ -1495,6 +1495,11 @@ class ParserState<T> {
}
}
@Override
public void enteringNewElementExtension(StartElement theElement, String theUrlAttr, boolean theIsModifier) {
myDepth++;
}
@Override
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
myDepth++;

View File

@ -26,8 +26,8 @@ import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.primitive.IdDt;
//import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly
/**
* RESTful method annotation to be used for the FHIR

View File

@ -25,10 +25,9 @@ import java.lang.annotation.RetentionPolicy;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.rest.param.CompositeParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
//import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly
/**

View File

@ -25,10 +25,9 @@ import java.lang.annotation.RetentionPolicy;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.rest.param.CompositeParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
//import ca.uhn.fhir.testmodel.Patient; // TODO: qualify this correctly
@Retention(RetentionPolicy.RUNTIME)
/**

View File

@ -20,13 +20,13 @@ package ca.uhn.fhir.rest.api;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.primitive.IdDt;
public class MethodOutcome {
private IdDt myId;
private OperationOutcome myOperationOutcome;
private BaseOperationOutcome myOperationOutcome;
private IdDt myVersionId;
private Boolean myCreated;
@ -67,12 +67,12 @@ public class MethodOutcome {
* @param theId
* The ID of the created/updated resource
*
* @param theOperationOutcome
* @param theBaseOperationOutcome
* The operation outcome to return with the response (or null for none)
*/
public MethodOutcome(IdDt theId, OperationOutcome theOperationOutcome) {
public MethodOutcome(IdDt theId, BaseOperationOutcome theBaseOperationOutcome) {
myId = theId;
myOperationOutcome = theOperationOutcome;
myOperationOutcome = theBaseOperationOutcome;
}
/**
@ -81,16 +81,16 @@ public class MethodOutcome {
* @param theId
* The ID of the created/updated resource
*
* @param theOperationOutcome
* @param theBaseOperationOutcome
* The operation outcome to return with the response (or null for none)
*
* @param theCreated
* If not null, indicates whether the resource was created (as opposed to being updated). This is generally not needed, since the server can assume based on the method being called
* whether the result was a creation or an update. However, it can be useful if you are implementing an update method that does a create if the ID doesn't already exist.
*/
public MethodOutcome(IdDt theId, OperationOutcome theOperationOutcome, Boolean theCreated) {
public MethodOutcome(IdDt theId, BaseOperationOutcome theBaseOperationOutcome, Boolean theCreated) {
myId = theId;
myOperationOutcome = theOperationOutcome;
myOperationOutcome = theBaseOperationOutcome;
myCreated = theCreated;
}
@ -105,10 +105,10 @@ public class MethodOutcome {
/**
* @deprecated Use the constructor which accepts a single IdDt parameter, and include the logical ID and version ID in that IdDt instance
*/
public MethodOutcome(IdDt theId, IdDt theVersionId, OperationOutcome theOperationOutcome) {
public MethodOutcome(IdDt theId, IdDt theVersionId, BaseOperationOutcome theBaseOperationOutcome) {
myId = theId;
myVersionId = theVersionId;
myOperationOutcome = theOperationOutcome;
myOperationOutcome = theBaseOperationOutcome;
}
public IdDt getId() {
@ -116,11 +116,11 @@ public class MethodOutcome {
}
/**
* Returns the {@link OperationOutcome} resource to return to the client or <code>null</code> if none.
* Returns the {@link BaseOperationOutcome} resource to return to the client or <code>null</code> if none.
*
* @return This method <b>will return null</b>, unlike many methods in the API.
*/
public OperationOutcome getOperationOutcome() {
public BaseOperationOutcome getOperationOutcome() {
return myOperationOutcome;
}
@ -156,10 +156,10 @@ public class MethodOutcome {
}
/**
* Sets the {@link OperationOutcome} resource to return to the client. Set to <code>null</code> (which is the default) if none.
* Sets the {@link BaseOperationOutcome} resource to return to the client. Set to <code>null</code> (which is the default) if none.
*/
public void setOperationOutcome(OperationOutcome theOperationOutcome) {
myOperationOutcome = theOperationOutcome;
public void setOperationOutcome(BaseOperationOutcome theBaseOperationOutcome) {
myOperationOutcome = theBaseOperationOutcome;
}
/**

View File

@ -47,7 +47,7 @@ import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.entity.ContentType;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.parser.DataFormatException;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
@ -211,7 +211,7 @@ public abstract class BaseClient {
}
String message = "HTTP " + response.getStatusLine().getStatusCode() + " " + response.getStatusLine().getReasonPhrase();
OperationOutcome oo=null;
BaseOperationOutcome oo=null;
if (Constants.CT_TEXT.equals(mimeType)) {
message = message + ": " + body;
} else {
@ -219,9 +219,10 @@ public abstract class BaseClient {
if (enc != null) {
IParser p = enc.newParser(theContext);
try {
oo = p.parseResource(OperationOutcome.class, body);
if (oo.getIssueFirstRep().getDetails().isEmpty()==false) {
message = message + ": " + oo.getIssueFirstRep().getDetails().getValue();
// TODO: handle if something other than OO comes back
oo = (BaseOperationOutcome) p.parseResource( body);
if (oo.getIssueFirstRep().getDetailsElement().isEmpty()==false) {
message = message + ": " + oo.getIssueFirstRep().getDetailsElement().getValue();
}
} catch (Exception e) {
ourLog.debug("Failed to process OperationOutcome response");

View File

@ -44,8 +44,8 @@ import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.Include;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseConformance;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.UriDt;
@ -115,14 +115,17 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
@Override
public Conformance conformance() {
public BaseConformance conformance() {
HttpGetClientInvocation invocation = MethodUtil.createConformanceInvocation();
if (isKeepResponses()) {
myLastRequest = invocation.asHttpRequest(getServerBase(), createExtraParams(), getEncoding());
}
ResourceResponseHandler<Conformance> binding = new ResourceResponseHandler<Conformance>(Conformance.class, null);
Conformance resp = invokeClient(myContext, binding, invocation, myLogRequestAndResponse);
@SuppressWarnings("unchecked")
Class<BaseConformance> conformance = (Class<BaseConformance>) myContext.getResourceDefinition("Conformance").getImplementingClass();
ResourceResponseHandler<? extends BaseConformance> binding = new ResourceResponseHandler<BaseConformance>(conformance, null);
BaseConformance resp = invokeClient(myContext, binding, invocation, myLogRequestAndResponse);
return resp;
}
@ -608,12 +611,12 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
private class DeleteInternal extends BaseClientExecutable<IDeleteTyped, OperationOutcome> implements IDelete, IDeleteTyped {
private class DeleteInternal extends BaseClientExecutable<IDeleteTyped, BaseOperationOutcome> implements IDelete, IDeleteTyped {
private IdDt myId;
@Override
public OperationOutcome execute() {
public BaseOperationOutcome execute() {
HttpDeleteClientInvocation invocation = DeleteMethodBinding.createDeleteInvocation(myId);
OperationOutcomeResponseHandler binding = new OperationOutcomeResponseHandler();
Map<String, List<String>> params = new HashMap<String, List<String>>();
@ -763,19 +766,20 @@ public class GenericClient extends BaseClient implements IGenericClient {
}
private final class OperationOutcomeResponseHandler implements IClientResponseHandler<OperationOutcome> {
private final class OperationOutcomeResponseHandler implements IClientResponseHandler<BaseOperationOutcome> {
@Override
public OperationOutcome invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException,
public BaseOperationOutcome invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException,
BaseServerResponseException {
EncodingEnum respType = EncodingEnum.forContentType(theResponseMimeType);
if (respType == null) {
return null;
}
IParser parser = respType.newParser(myContext);
OperationOutcome retVal;
BaseOperationOutcome retVal;
try {
retVal = parser.parseResource(OperationOutcome.class, theResponseReader);
// TODO: handle if something else than OO comes back
retVal = (BaseOperationOutcome) parser.parseResource(theResponseReader);
} catch (DataFormatException e) {
ourLog.warn("Failed to parse OperationOutcome response", e);
return null;

View File

@ -26,7 +26,7 @@ import java.util.Map;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.base.resource.BaseConformance;
import ca.uhn.fhir.model.primitive.DateTimeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.UriDt;
@ -41,10 +41,11 @@ import ca.uhn.fhir.rest.gclient.IUntypedQuery;
import ca.uhn.fhir.rest.gclient.IUpdate;
public interface IGenericClient {
/**
* Retrieves and returns the server conformance statement
*/
Conformance conformance();
BaseConformance conformance();
/**
* Fluent method for the "create" operation, which creates a new resource instance on the server

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.client.api;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.base.resource.BaseConformance;
import ca.uhn.fhir.rest.annotation.Metadata;
/**
@ -35,6 +35,6 @@ public interface IBasicClient extends IRestfulClient {
* @see See the <a href="http://hl7.org/implement/standards/fhir/http.html#conformance">FHIR HTTP Conformance</a> definition
*/
@Metadata
Conformance getServerConformanceStatement();
BaseConformance getServerConformanceStatement();
}

View File

@ -20,9 +20,9 @@ package ca.uhn.fhir.rest.gclient;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
public interface IDeleteTyped extends IClientExecutable<IDeleteTyped, OperationOutcome> {
public interface IDeleteTyped extends IClientExecutable<IDeleteTyped, BaseOperationOutcome> {
// nothing for now

View File

@ -1,11 +1,11 @@
package ca.uhn.fhir.rest.gclient;
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.defaultString;
import java.util.Arrays;
import java.util.List;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
/*
* #%L
@ -67,17 +67,17 @@ public class TokenClientParam implements IParam {
}
@Override
public ICriterion<TokenClientParam> identifier(IdentifierDt theIdentifier) {
return new TokenCriterion(getParamName(), theIdentifier.getSystem().getValueAsString(), theIdentifier.getValue().getValue());
public ICriterion<TokenClientParam> identifier(BaseIdentifierDt theIdentifier) {
return new TokenCriterion(getParamName(), theIdentifier.getSystemElement().getValueAsString(), theIdentifier.getValueElement().getValue());
}
@Override
public ICriterion<TokenClientParam> identifiers(List<IdentifierDt> theIdentifiers) {
public ICriterion<TokenClientParam> identifiers(List<BaseIdentifierDt> theIdentifiers) {
return new TokenCriterion(getParamName(), theIdentifiers);
}
@Override
public ICriterion<TokenClientParam> identifiers(IdentifierDt... theIdentifiers) {
public ICriterion<TokenClientParam> identifiers(BaseIdentifierDt... theIdentifiers) {
return new TokenCriterion(getParamName(), Arrays.asList(theIdentifiers));
}
};
@ -131,7 +131,7 @@ public class TokenClientParam implements IParam {
* The identifier
* @return A criterion
*/
ICriterion<TokenClientParam> identifier(IdentifierDt theIdentifier);
ICriterion<TokenClientParam> identifier(BaseIdentifierDt theIdentifier);
/**
* Creates a search criterion that matches against the given collection of identifiers (system and code if both are present, or whatever is present).
@ -141,7 +141,7 @@ public class TokenClientParam implements IParam {
* The identifier
* @return A criterion
*/
ICriterion<TokenClientParam> identifiers(List<IdentifierDt> theIdentifiers);
ICriterion<TokenClientParam> identifiers(List<BaseIdentifierDt> theIdentifiers);
/**
* Creates a search criterion that matches against the given collection of identifiers (system and code if both are present, or whatever is present).
@ -151,7 +151,7 @@ public class TokenClientParam implements IParam {
* The identifier
* @return A criterion
*/
ICriterion<TokenClientParam> identifiers(IdentifierDt... theIdentifiers);
ICriterion<TokenClientParam> identifiers(BaseIdentifierDt... theIdentifiers);
}

View File

@ -24,7 +24,7 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.rest.param.ParameterUtil;
class TokenCriterion implements ICriterion<TokenClientParam>, ICriterionInternal {
@ -51,17 +51,17 @@ class TokenCriterion implements ICriterion<TokenClientParam>, ICriterionInternal
return value;
}
public TokenCriterion(String theParamName, List<IdentifierDt> theValue) {
public TokenCriterion(String theParamName, List<BaseIdentifierDt> theValue) {
myName=theParamName;
StringBuilder b = new StringBuilder();
for (IdentifierDt next : theValue) {
if (next.getSystem().isEmpty() && next.getValue().isEmpty()) {
for (BaseIdentifierDt next : theValue) {
if (next.getSystemElement().isEmpty() && next.getValueElement().isEmpty()) {
continue;
}
if (b.length() > 0) {
b.append(',');
}
b.append(toValue(next.getSystem().getValueAsString(), next.getValue().getValue()));
b.append(toValue(next.getSystemElement().getValueAsString(), next.getValueElement().getValue()));
}
myValue = b.toString();
}

View File

@ -40,7 +40,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
import ca.uhn.fhir.parser.IParser;
@ -230,7 +230,8 @@ public abstract class BaseMethodBinding<T> implements IClientResponseHandler<T>
break;
case Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY:
IParser parser = createAppropriateParserForParsingResponse(theResponseMimeType, theResponseReader, theStatusCode);
OperationOutcome operationOutcome = parser.parseResource(OperationOutcome.class, theResponseReader);
// TODO: handle if something other than OO comes back
BaseOperationOutcome operationOutcome = (BaseOperationOutcome) parser.parseResource(theResponseReader);
ex = new UnprocessableEntityException(operationOutcome);
break;
default:
@ -447,8 +448,9 @@ public abstract class BaseMethodBinding<T> implements IClientResponseHandler<T>
if (!IResource.class.isAssignableFrom(theReturnType)) {
return false;
}
boolean retVal = Modifier.isAbstract(theReturnType.getModifiers()) == false;
return retVal;
return true;
// boolean retVal = Modifier.isAbstract(theReturnType.getModifiers()) == false;
// return retVal;
}
protected static IBundleProvider toResourceList(Object response) throws InternalErrorException {

View File

@ -38,7 +38,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.parser.IParser;
import ca.uhn.fhir.rest.api.MethodOutcome;
@ -146,7 +146,7 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
}
}
OperationOutcome outcome = response != null ? response.getOperationOutcome() : null;
BaseOperationOutcome outcome = response != null ? response.getOperationOutcome() : null;
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
IServerInterceptor next = theServer.getInterceptors().get(i);
boolean continueProcessing = next.outgoingResponse(theRequest, outcome, theRequest.getServletRequest(), theRequest.getServletResponse());

View File

@ -23,6 +23,7 @@ package ca.uhn.fhir.rest.method;
import java.io.IOException;
import java.io.Reader;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@ -73,7 +74,8 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding<Obje
private String myResourceName;
private Class<? extends IResource> myResourceType;
public BaseResourceReturningMethodBinding(Class<? extends IResource> theReturnResourceType, Method theMethod, FhirContext theConetxt, Object theProvider) {
@SuppressWarnings("unchecked")
public BaseResourceReturningMethodBinding(Class<?> theReturnResourceType, Method theMethod, FhirContext theConetxt, Object theProvider) {
super(theMethod, theConetxt, theProvider);
Class<?> methodReturnType = theMethod.getReturnType();
@ -100,12 +102,17 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding<Obje
if (theReturnResourceType != null) {
if (IResource.class.isAssignableFrom(theReturnResourceType)) {
myResourceType = theReturnResourceType;
ResourceDef resourceDefAnnotation = theReturnResourceType.getAnnotation(ResourceDef.class);
if (resourceDefAnnotation == null) {
throw new ConfigurationException(theReturnResourceType.getCanonicalName() + " has no @" + ResourceDef.class.getSimpleName() + " annotation");
if (Modifier.isAbstract(theReturnResourceType.getModifiers())) {
// If we're returning an abstract type, that's ok
}else {
throw new ConfigurationException(theReturnResourceType.getCanonicalName() + " has no @" + ResourceDef.class.getSimpleName() + " annotation");
}
} else {
myResourceType = (Class<? extends IResource>) theReturnResourceType;
myResourceName = resourceDefAnnotation.name();
}
myResourceName = resourceDefAnnotation.name();
}
}
}

View File

@ -21,11 +21,12 @@ package ca.uhn.fhir.rest.method;
*/
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.base.resource.BaseConformance;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
import ca.uhn.fhir.rest.method.SearchMethodBinding.RequestType;
@ -37,10 +38,13 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
public class ConformanceMethodBinding extends BaseResourceReturningMethodBinding {
public ConformanceMethodBinding(Method theMethod, FhirContext theContext, Object theProvider) {
super(Conformance.class, theMethod, theContext, theProvider);
super(theMethod.getReturnType(), theMethod, theContext, theProvider);
if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || theMethod.getReturnType() != Conformance.class) {
throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return type " + Conformance.class);
// if (Modifier.isAbstract(theMethod.getReturnType().getModifiers())) {
// throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' must not be abstract");
// }
if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || !BaseConformance.class.isAssignableFrom(theMethod.getReturnType())) {
throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return a Conformance resource class, returns: " + theMethod.getReturnType());
}
}

View File

@ -1,6 +1,7 @@
package ca.uhn.fhir.rest.method;
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isBlank;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException;
import java.io.PushbackReader;
@ -34,7 +35,7 @@ import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.Tag;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.parser.IParser;
@ -303,8 +304,8 @@ public class MethodUtil {
if (reader != null) {
IParser parser = ct.newParser(theContext);
IResource outcome = parser.parseResource(reader);
if (outcome instanceof OperationOutcome) {
retVal.setOperationOutcome((OperationOutcome) outcome);
if (outcome instanceof BaseOperationOutcome) {
retVal.setOperationOutcome((BaseOperationOutcome) outcome);
}
}

View File

@ -37,13 +37,12 @@ import ca.uhn.fhir.model.api.IQueryParameterAnd;
import ca.uhn.fhir.model.api.IQueryParameterOr;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.base.composite.BaseQuantityDt;
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.annotation.OptionalParam;
import ca.uhn.fhir.rest.param.BaseQueryParameter;
import ca.uhn.fhir.rest.param.CodingListParam;
import ca.uhn.fhir.rest.param.CompositeAndListParam;
import ca.uhn.fhir.rest.param.CompositeOrListParam;
import ca.uhn.fhir.rest.param.CompositeParam;
@ -51,7 +50,6 @@ import ca.uhn.fhir.rest.param.DateAndListParam;
import ca.uhn.fhir.rest.param.DateOrListParam;
import ca.uhn.fhir.rest.param.DateParam;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.IdentifierListParam;
import ca.uhn.fhir.rest.param.NumberAndListParam;
import ca.uhn.fhir.rest.param.NumberOrListParam;
import ca.uhn.fhir.rest.param.NumberParam;
@ -306,16 +304,12 @@ public class SearchParameter extends BaseQueryParameter {
myParamType = SearchParamTypeEnum.STRING;
} else if (QualifiedDateParam.class.isAssignableFrom(type)) {
myParamType = SearchParamTypeEnum.DATE;
} else if (CodingListParam.class.isAssignableFrom(type)) {
} else if (BaseIdentifierDt.class.isAssignableFrom(type)) {
myParamType = SearchParamTypeEnum.TOKEN;
} else if (IdentifierDt.class.isAssignableFrom(type)) {
myParamType = SearchParamTypeEnum.TOKEN;
} else if (QuantityDt.class.isAssignableFrom(type)) {
} else if (BaseQuantityDt.class.isAssignableFrom(type)) {
myParamType = SearchParamTypeEnum.QUANTITY;
} else if (ReferenceParam.class.isAssignableFrom(type)) {
myParamType = SearchParamTypeEnum.REFERENCE;
} else if (IdentifierListParam.class.isAssignableFrom(type)) {
myParamType = SearchParamTypeEnum.TOKEN;
} else {
throw new ConfigurationException("Unknown search parameter type: " + type);
}

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.method;
* #L%
*/
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException;
import java.lang.reflect.Method;
@ -32,7 +32,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
import ca.uhn.fhir.model.primitive.IdDt;
@ -127,7 +127,7 @@ public class TransactionMethodBinding extends BaseResourceReturningMethodBinding
IdDt oldId = oldIds.get(retResources.get(i));
IResource newRes = retResources.get(i);
if (newRes.getId() == null || newRes.getId().isEmpty()) {
if (!(newRes instanceof OperationOutcome)) {
if (!(newRes instanceof BaseOperationOutcome)) {
throw new InternalErrorException("Transaction method returned resource at index " + i + " with no id specified - IResource#setId(IdDt)");
}
}

View File

@ -0,0 +1,367 @@
package ca.uhn.fhir.rest.param;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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.List;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.primitive.BooleanDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt;
public class InternalCodingDt
extends BaseCodingDt implements ICompositeDatatype
{
/**
* Constructor
*/
public InternalCodingDt() {
super();
}
/**
* Creates a new Coding with the given system and code
*/
public InternalCodingDt(String theSystem, String theCode) {
setSystem(theSystem);
setCode(theCode);
}
@Child(name="system", type=UriDt.class, order=0, min=0, max=1)
@Description(
shortDefinition="Identity of the terminology system",
formalDefinition="The identification of the code system that defines the meaning of the symbol in the code."
)
private UriDt mySystem;
@Child(name="version", type=StringDt.class, order=1, min=0, max=1)
@Description(
shortDefinition="Version of the system - if relevant",
formalDefinition="The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and When the meaning is not guaranteed to be consistent, the version SHOULD be exchanged"
)
private StringDt myVersion;
@Child(name="code", type=CodeDt.class, order=2, min=0, max=1)
@Description(
shortDefinition="Symbol in syntax defined by the system",
formalDefinition="A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)"
)
private CodeDt myCode;
@Child(name="display", type=StringDt.class, order=3, min=0, max=1)
@Description(
shortDefinition="Representation defined by the system",
formalDefinition="A representation of the meaning of the code in the system, following the rules of the system."
)
private StringDt myDisplay;
@Child(name="primary", type=BooleanDt.class, order=4, min=0, max=1)
@Description(
shortDefinition="If this code was chosen directly by the user",
formalDefinition="Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays)"
)
private BooleanDt myPrimary;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( mySystem, myVersion, myCode, myDisplay, myPrimary);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, mySystem, myVersion, myCode, myDisplay, myPrimary);
}
/**
* Gets the value(s) for <b>system</b> (Identity of the terminology system).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The identification of the code system that defines the meaning of the symbol in the code.
* </p>
*/
public UriDt getSystemElement() {
if (mySystem == null) {
mySystem = new UriDt();
}
return mySystem;
}
/**
* Sets the value(s) for <b>system</b> (Identity of the terminology system)
*
* <p>
* <b>Definition:</b>
* The identification of the code system that defines the meaning of the symbol in the code.
* </p>
*/
public InternalCodingDt setSystem(UriDt theValue) {
mySystem = theValue;
return this;
}
/**
* Sets the value for <b>system</b> (Identity of the terminology system)
*
* <p>
* <b>Definition:</b>
* The identification of the code system that defines the meaning of the symbol in the code.
* </p>
*/
public InternalCodingDt setSystem( String theUri) {
mySystem = new UriDt(theUri);
return this;
}
/**
* Gets the value(s) for <b>version</b> (Version of the system - if relevant).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and When the meaning is not guaranteed to be consistent, the version SHOULD be exchanged
* </p>
*/
public StringDt getVersion() {
if (myVersion == null) {
myVersion = new StringDt();
}
return myVersion;
}
/**
* Sets the value(s) for <b>version</b> (Version of the system - if relevant)
*
* <p>
* <b>Definition:</b>
* The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and When the meaning is not guaranteed to be consistent, the version SHOULD be exchanged
* </p>
*/
public InternalCodingDt setVersion(StringDt theValue) {
myVersion = theValue;
return this;
}
/**
* Sets the value for <b>version</b> (Version of the system - if relevant)
*
* <p>
* <b>Definition:</b>
* The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured. and When the meaning is not guaranteed to be consistent, the version SHOULD be exchanged
* </p>
*/
public InternalCodingDt setVersion( String theString) {
myVersion = new StringDt(theString);
return this;
}
/**
* Gets the value(s) for <b>code</b> (Symbol in syntax defined by the system).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p>
*/
public CodeDt getCodeElement() {
if (myCode == null) {
myCode = new CodeDt();
}
return myCode;
}
/**
* Sets the value(s) for <b>code</b> (Symbol in syntax defined by the system)
*
* <p>
* <b>Definition:</b>
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p>
*/
public InternalCodingDt setCode(CodeDt theValue) {
myCode = theValue;
return this;
}
/**
* Sets the value for <b>code</b> (Symbol in syntax defined by the system)
*
* <p>
* <b>Definition:</b>
* A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination)
* </p>
*/
public InternalCodingDt setCode( String theCode) {
myCode = new CodeDt(theCode);
return this;
}
/**
* Gets the value(s) for <b>display</b> (Representation defined by the system).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A representation of the meaning of the code in the system, following the rules of the system.
* </p>
*/
public StringDt getDisplay() {
if (myDisplay == null) {
myDisplay = new StringDt();
}
return myDisplay;
}
/**
* Sets the value(s) for <b>display</b> (Representation defined by the system)
*
* <p>
* <b>Definition:</b>
* A representation of the meaning of the code in the system, following the rules of the system.
* </p>
*/
public InternalCodingDt setDisplay(StringDt theValue) {
myDisplay = theValue;
return this;
}
/**
* Sets the value for <b>display</b> (Representation defined by the system)
*
* <p>
* <b>Definition:</b>
* A representation of the meaning of the code in the system, following the rules of the system.
* </p>
*/
public InternalCodingDt setDisplay( String theString) {
myDisplay = new StringDt(theString);
return this;
}
/**
* Gets the value(s) for <b>primary</b> (If this code was chosen directly by the user).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays)
* </p>
*/
public BooleanDt getPrimary() {
if (myPrimary == null) {
myPrimary = new BooleanDt();
}
return myPrimary;
}
/**
* Sets the value(s) for <b>primary</b> (If this code was chosen directly by the user)
*
* <p>
* <b>Definition:</b>
* Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays)
* </p>
*/
public InternalCodingDt setPrimary(BooleanDt theValue) {
myPrimary = theValue;
return this;
}
/**
* Sets the value for <b>primary</b> (If this code was chosen directly by the user)
*
* <p>
* <b>Definition:</b>
* Indicates that this code was chosen by a user directly - i.e. off a pick list of available items (codes or displays)
* </p>
*/
public InternalCodingDt setPrimary( boolean theBoolean) {
myPrimary = new BooleanDt(theBoolean);
return this;
}
/**
* Gets the value(s) for <b>valueSet</b> (Set this coding was chosen from).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The set of possible coded values this coding was chosen from or constrained by
* </p>
*/
public ResourceReferenceDt getValueSet() {
throw new UnsupportedOperationException();
}
/**
* Sets the value(s) for <b>valueSet</b> (Set this coding was chosen from)
*
* <p>
* <b>Definition:</b>
* The set of possible coded values this coding was chosen from or constrained by
* </p>
*/
public InternalCodingDt setValueSet(ResourceReferenceDt theValue) {
throw new UnsupportedOperationException();
}
}

View File

@ -0,0 +1,420 @@
package ca.uhn.fhir.rest.param;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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.List;
import ca.uhn.fhir.model.api.ICompositeDatatype;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.annotation.Child;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
import ca.uhn.fhir.model.base.composite.BaseQuantityDt;
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DecimalDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.model.primitive.UriDt;
class InternalQuantityDt
extends BaseQuantityDt implements ICompositeDatatype
{
/**
* Constructor
*/
public InternalQuantityDt() {
// nothing
}
/**
* Constructor
*/
@SimpleSetter
public InternalQuantityDt(@SimpleSetter.Parameter(name="theValue") double theValue) {
setValue(theValue);
}
/**
* Constructor
*/
@SimpleSetter
public InternalQuantityDt(@SimpleSetter.Parameter(name="theValue") long theValue) {
setValue(theValue);
}
/**
* Constructor
*/
@SimpleSetter
public InternalQuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") double theValue,
@SimpleSetter.Parameter(name = "theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setUnits(theUnits);
}
/**
* Constructor
*/
@SimpleSetter
public InternalQuantityDt(@SimpleSetter.Parameter(name = "theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name = "theValue") long theValue,
@SimpleSetter.Parameter(name = "theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setUnits(theUnits);
}
/**
* Constructor
*/
@SimpleSetter
public InternalQuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") double theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setSystem(theSystem);
setUnits(theUnits);
}
/**
* Constructor
*/
@SimpleSetter
public InternalQuantityDt(@SimpleSetter.Parameter(name="theComparator") QuantityCompararatorEnum theComparator, @SimpleSetter.Parameter(name="theValue") long theValue, @SimpleSetter.Parameter(name="theSystem") String theSystem, @SimpleSetter.Parameter(name="theUnits") String theUnits) {
setValue(theValue);
setComparator(theComparator);
setSystem(theSystem);
setUnits(theUnits);
}
@Child(name="value", type=DecimalDt.class, order=0, min=0, max=1)
@Description(
shortDefinition="Numerical value (with implicit precision)",
formalDefinition="The value of the measured amount. The value includes an implicit precision in the presentation of the value"
)
private DecimalDt myValue;
@Child(name="comparator", type=CodeDt.class, order=1, min=0, max=1)
@Description(
shortDefinition="< | <= | >= | > - how to understand the value",
formalDefinition="How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is \"<\" , then the real value is < stated value"
)
private BoundCodeDt<QuantityCompararatorEnum> myComparator;
@Child(name="units", type=StringDt.class, order=2, min=0, max=1)
@Description(
shortDefinition="Unit representation",
formalDefinition="A human-readable form of the units"
)
private StringDt myUnits;
@Child(name="system", type=UriDt.class, order=3, min=0, max=1)
@Description(
shortDefinition="System that defines coded unit form",
formalDefinition="The identification of the system that provides the coded form of the unit"
)
private UriDt mySystem;
@Child(name="code", type=CodeDt.class, order=4, min=0, max=1)
@Description(
shortDefinition="Coded form of the unit",
formalDefinition="A computer processable form of the units in some unit representation system"
)
private CodeDt myCode;
@Override
public boolean isEmpty() {
return super.isBaseEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty( myValue, myComparator, myUnits, mySystem, myCode);
}
@Override
public <T extends IElement> List<T> getAllPopulatedChildElementsOfType(Class<T> theType) {
return ca.uhn.fhir.util.ElementUtil.allPopulatedChildElements(theType, myValue, myComparator, myUnits, mySystem, myCode);
}
/**
* Gets the value(s) for <b>value</b> (Numerical value (with implicit precision)).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public DecimalDt getValueElement() {
if (myValue == null) {
myValue = new DecimalDt();
}
return myValue;
}
/**
* Sets the value(s) for <b>value</b> (Numerical value (with implicit precision))
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public InternalQuantityDt setValue(DecimalDt theValue) {
myValue = theValue;
return this;
}
/**
* Sets the value for <b>value</b> (Numerical value (with implicit precision))
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public InternalQuantityDt setValue( long theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>value</b> (Numerical value (with implicit precision))
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public InternalQuantityDt setValue( double theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Sets the value for <b>value</b> (Numerical value (with implicit precision))
*
* <p>
* <b>Definition:</b>
* The value of the measured amount. The value includes an implicit precision in the presentation of the value
* </p>
*/
public InternalQuantityDt setValue( java.math.BigDecimal theValue) {
myValue = new DecimalDt(theValue);
return this;
}
/**
* Gets the value(s) for <b>comparator</b> (< | <= | >= | > - how to understand the value).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is \"<\" , then the real value is < stated value
* </p>
*/
public BoundCodeDt<QuantityCompararatorEnum> getComparatorElement() {
if (myComparator == null) {
myComparator = new BoundCodeDt<QuantityCompararatorEnum>(QuantityCompararatorEnum.VALUESET_BINDER);
}
return myComparator;
}
/**
* Sets the value(s) for <b>comparator</b> (< | <= | >= | > - how to understand the value)
*
* <p>
* <b>Definition:</b>
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is \"<\" , then the real value is < stated value
* </p>
*/
public InternalQuantityDt setComparator(BoundCodeDt<QuantityCompararatorEnum> theValue) {
myComparator = theValue;
return this;
}
/**
* Sets the value(s) for <b>comparator</b> (< | <= | >= | > - how to understand the value)
*
* <p>
* <b>Definition:</b>
* How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues. E.g. if the comparator is \"<\" , then the real value is < stated value
* </p>
*/
public InternalQuantityDt setComparator(QuantityCompararatorEnum theValue) {
getComparatorElement().setValueAsEnum(theValue);
return this;
}
/**
* Gets the value(s) for <b>units</b> (Unit representation).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A human-readable form of the units
* </p>
*/
public StringDt getUnitsElement() {
if (myUnits == null) {
myUnits = new StringDt();
}
return myUnits;
}
/**
* Sets the value(s) for <b>units</b> (Unit representation)
*
* <p>
* <b>Definition:</b>
* A human-readable form of the units
* </p>
*/
public InternalQuantityDt setUnits(StringDt theValue) {
myUnits = theValue;
return this;
}
/**
* Sets the value for <b>units</b> (Unit representation)
*
* <p>
* <b>Definition:</b>
* A human-readable form of the units
* </p>
*/
public InternalQuantityDt setUnits( String theString) {
myUnits = new StringDt(theString);
return this;
}
/**
* Gets the value(s) for <b>system</b> (System that defines coded unit form).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* The identification of the system that provides the coded form of the unit
* </p>
*/
public UriDt getSystemElement() {
if (mySystem == null) {
mySystem = new UriDt();
}
return mySystem;
}
/**
* Sets the value(s) for <b>system</b> (System that defines coded unit form)
*
* <p>
* <b>Definition:</b>
* The identification of the system that provides the coded form of the unit
* </p>
*/
public InternalQuantityDt setSystem(UriDt theValue) {
mySystem = theValue;
return this;
}
/**
* Sets the value for <b>system</b> (System that defines coded unit form)
*
* <p>
* <b>Definition:</b>
* The identification of the system that provides the coded form of the unit
* </p>
*/
public InternalQuantityDt setSystem( String theUri) {
mySystem = new UriDt(theUri);
return this;
}
/**
* Gets the value(s) for <b>code</b> (Coded form of the unit).
* creating it if it does
* not exist. Will not return <code>null</code>.
*
* <p>
* <b>Definition:</b>
* A computer processable form of the units in some unit representation system
* </p>
*/
public CodeDt getCodeElement() {
if (myCode == null) {
myCode = new CodeDt();
}
return myCode;
}
/**
* Sets the value(s) for <b>code</b> (Coded form of the unit)
*
* <p>
* <b>Definition:</b>
* A computer processable form of the units in some unit representation system
* </p>
*/
public InternalQuantityDt setCode(CodeDt theValue) {
myCode = theValue;
return this;
}
/**
* Sets the value for <b>code</b> (Coded form of the unit)
*
* <p>
* <b>Definition:</b>
* A computer processable form of the units in some unit representation system
* </p>
*/
public InternalQuantityDt setCode( String theCode) {
myCode = new CodeDt(theCode);
return this;
}
}

View File

@ -20,17 +20,16 @@ package ca.uhn.fhir.rest.param;
* #L%
*/
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.math.BigDecimal;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
public class NumberParam extends BaseParam implements IQueryParameterType {
private QuantityDt myQuantity = new QuantityDt();
private InternalQuantityDt myQuantity = new InternalQuantityDt();
public NumberParam() {
}
@ -50,22 +49,22 @@ public class NumberParam extends BaseParam implements IQueryParameterType {
StringBuilder b = new StringBuilder();
b.append(getClass().getSimpleName());
b.append("[");
if (myQuantity.getComparator().isEmpty() == false) {
b.append(myQuantity.getComparator().getValue());
if (myQuantity.getComparatorElement().isEmpty() == false) {
b.append(myQuantity.getComparatorElement().getValue());
}
if (myQuantity.getValue().isEmpty() == false) {
b.append(myQuantity.getValue().toString());
if (myQuantity.getValueElement().isEmpty() == false) {
b.append(myQuantity.getValueElement().toString());
}
b.append("]");
return b.toString();
}
public QuantityCompararatorEnum getComparator() {
return myQuantity.getComparator().getValueAsEnum();
return myQuantity.getComparatorElement().getValueAsEnum();
}
public BigDecimal getValue() {
return myQuantity.getValue().getValue();
return myQuantity.getValueElement().getValue();
}
@ -100,11 +99,11 @@ public class NumberParam extends BaseParam implements IQueryParameterType {
}
StringBuilder b = new StringBuilder();
if (myQuantity.getComparator().isEmpty() == false) {
b.append(myQuantity.getComparator().getValue());
if (myQuantity.getComparatorElement().isEmpty() == false) {
b.append(myQuantity.getComparatorElement().getValue());
}
if (myQuantity.getValue().isEmpty() == false) {
b.append(myQuantity.getValue().toString());
if (myQuantity.getValueElement().isEmpty() == false) {
b.append(myQuantity.getValueElement().toString());
}
return b.toString();
}

View File

@ -179,8 +179,20 @@ public class ParameterUtil {
}
/**
* Escapes a string according to the rules for parameter escaping specified in the <a
* href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping Section</a>
* Escapes a string according to the rules for parameter escaping specified in the <a href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping
* Section</a>
*/
public static String escapeWithDefault(Object theValue) {
if (theValue == null) {
return "";
} else {
return escape(theValue.toString());
}
}
/**
* Escapes a string according to the rules for parameter escaping specified in the <a href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping
* Section</a>
*/
public static String escape(String theValue) {
if (theValue == null) {
@ -205,8 +217,8 @@ public class ParameterUtil {
}
/**
* Unescapes a string according to the rules for parameter escaping specified in the <a
* href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping Section</a>
* Unescapes a string according to the rules for parameter escaping specified in the <a href="http://www.hl7.org/implement/standards/fhir/search.html#escaping">FHIR Specification Escaping
* Section</a>
*/
public static String unescape(String theValue) {
if (theValue == null) {

View File

@ -20,8 +20,8 @@ package ca.uhn.fhir.rest.param;
* #L%
*/
import static ca.uhn.fhir.rest.param.ParameterUtil.*;
import static org.apache.commons.lang3.StringUtils.*;
import static ca.uhn.fhir.rest.param.ParameterUtil.escape;
import static org.apache.commons.lang3.StringUtils.defaultString;
import java.math.BigDecimal;
import java.util.List;
@ -31,7 +31,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
@ -42,7 +41,7 @@ import ca.uhn.fhir.model.primitive.UriDt;
public class QuantityParam extends BaseParam implements IQueryParameterType {
private boolean myApproximate;
private QuantityDt myQuantity = new QuantityDt();
private InternalQuantityDt myQuantity = new InternalQuantityDt();
/**
* Constructor
@ -144,7 +143,7 @@ public class QuantityParam extends BaseParam implements IQueryParameterType {
}
public QuantityCompararatorEnum getComparator() {
return myQuantity.getComparator().getValueAsEnum();
return myQuantity.getComparatorElement().getValueAsEnum();
}
@Override
@ -153,15 +152,15 @@ public class QuantityParam extends BaseParam implements IQueryParameterType {
}
public UriDt getSystem() {
return myQuantity.getSystem();
return myQuantity.getSystemElement();
}
public String getUnits() {
return myQuantity.getUnits().getValue();
return myQuantity.getUnitsElement().getValue();
}
public DecimalDt getValue() {
return myQuantity.getValue();
return myQuantity.getValueElement();
}
@Override
@ -174,19 +173,19 @@ public class QuantityParam extends BaseParam implements IQueryParameterType {
if (myApproximate) {
b.append('~');
} else {
b.append(defaultString(escape(myQuantity.getComparator().getValue())));
b.append(defaultString(escape(myQuantity.getComparatorElement().getValue())));
}
if (!myQuantity.getValue().isEmpty()) {
b.append(defaultString(escape(myQuantity.getValue().getValueAsString())));
if (!myQuantity.getValueElement().isEmpty()) {
b.append(defaultString(escape(myQuantity.getValueElement().getValueAsString())));
}
b.append('|');
if (!myQuantity.getSystem().isEmpty()) {
b.append(defaultString(escape(myQuantity.getSystem().getValueAsString())));
if (!myQuantity.getSystemElement().isEmpty()) {
b.append(defaultString(escape(myQuantity.getSystemElement().getValueAsString())));
}
b.append('|');
if (!myQuantity.getUnits().isEmpty()) {
b.append(defaultString(escape(myQuantity.getUnits().getValueAsString())));
if (!myQuantity.getUnitsElement().isEmpty()) {
b.append(defaultString(escape(myQuantity.getUnitsElement().getValueAsString())));
}
return b.toString();
@ -302,10 +301,10 @@ public class QuantityParam extends BaseParam implements IQueryParameterType {
@Override
public String toString() {
ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
b.append("cmp", myQuantity.getComparator().getValueAsString());
b.append("value", myQuantity.getValue().getValueAsString());
b.append("system", myQuantity.getSystem().getValueAsString());
b.append("units", myQuantity.getUnits().getValueAsString());
b.append("cmp", myQuantity.getComparatorElement().getValueAsString());
b.append("value", myQuantity.getValueElement().getValueAsString());
b.append("system", myQuantity.getSystemElement().getValueAsString());
b.append("units", myQuantity.getUnitsElement().getValueAsString());
if (getMissing() != null) {
b.append("missing", getMissing());
}

View File

@ -3,8 +3,8 @@ package ca.uhn.fhir.rest.param;
import java.util.ArrayList;
import java.util.List;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
/*
* #%L
@ -26,18 +26,62 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
* #L%
*/
/**
* This class represents a restful search operation parameter for an "OR list" of tokens (in other words, a
* list which can contain one-or-more tokens, where the server should return results matching any of the tokens)
*/
public class TokenOrListParam extends BaseOrListParam<TokenParam> {
public class TokenOrListParam extends BaseOrListParam<TokenParam> {
@Override
TokenParam newInstance() {
return new TokenParam();
/**
* Create a new empty token "OR list"
*/
public TokenOrListParam() {
}
public List<CodingDt> getListAsCodings() {
ArrayList<CodingDt> retVal = new ArrayList<CodingDt>();
/**
* Create a new token "OR list" with a single token, or multiple tokens which have the same system value
*
* @param theSystem
* The system to use for the one token to pre-populate in this list
* @param theValues
* The values to use for the one token to pre-populate in this list
*/
public TokenOrListParam(String theSystem, String... theValues) {
for (String next : theValues) {
add(theSystem, next);
}
}
/**
* Convenience method which adds a token to this OR list using the system and code from a coding
*/
public void add(BaseCodingDt theCodingDt) {
add(new TokenParam(theCodingDt));
}
/**
* Convenience method which adds a token to this OR list using the system and value from an identifier
*/
public void add(BaseIdentifierDt theIdentifierDt) {
add(new TokenParam(theIdentifierDt));
}
/**
* Add a new token to this list
*
* @param theSystem
* The system to use for the one token to pre-populate in this list
* @param theValue
* The value to use for the one token to pre-populate in this list
*/
public void add(String theSystem, String theValue) {
add(new TokenParam(theSystem, theValue));
}
public List<BaseCodingDt> getListAsCodings() {
ArrayList<BaseCodingDt> retVal = new ArrayList<BaseCodingDt>();
for (TokenParam next : getValuesAsQueryTokens()) {
CodingDt nextCoding = next.getValueAsCoding();
InternalCodingDt nextCoding = next.getValueAsCoding();
if (!nextCoding.isEmpty()) {
retVal.add(nextCoding);
}
@ -45,20 +89,9 @@ public class TokenOrListParam extends BaseOrListParam<TokenParam> {
return retVal;
}
/**
* Convenience method which adds a token to this OR list
* using the system and code from a coding
*/
public void add(CodingDt theCodingDt) {
add(new TokenParam(theCodingDt));
}
/**
* Convenience method which adds a token to this OR list
* using the system and value from an identifier
*/
public void add(IdentifierDt theIdentifierDt) {
add(new TokenParam(theIdentifierDt));
@Override
TokenParam newInstance() {
return new TokenParam();
}
}

View File

@ -27,8 +27,8 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.dstu.composite.CodingDt;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.rest.server.Constants;
@ -57,13 +57,13 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
}
/**
* Constructor which copies the {@link CodingDt#getSystem() system} and {@link CodingDt#getCode() code} from a {@link CodingDt} instance and adds it as a parameter
* Constructor which copies the {@link InternalCodingDt#getSystem() system} and {@link InternalCodingDt#getCode() code} from a {@link InternalCodingDt} instance and adds it as a parameter
*
* @param theCodingDt
* The coding
*/
public TokenParam(CodingDt theCodingDt) {
this(toSystemValue(theCodingDt.getSystem()), theCodingDt.getCode().getValue());
public TokenParam(BaseCodingDt theCodingDt) {
this(toSystemValue(theCodingDt.getSystemElement()), theCodingDt.getCodeElement().getValue());
}
/**
@ -72,8 +72,8 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
* @param theCodingDt
* The coding
*/
public TokenParam(IdentifierDt theIdentifierDt) {
this(toSystemValue(theIdentifierDt.getSystem()), theIdentifierDt.getValue().getValue());
public TokenParam(BaseIdentifierDt theIdentifierDt) {
this(toSystemValue(theIdentifierDt.getSystemElement()), theIdentifierDt.getValueElement().getValue());
}
private static String toSystemValue(UriDt theSystem) {
@ -170,8 +170,8 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
return builder.toString();
}
public CodingDt getValueAsCoding() {
return new CodingDt(mySystem, myValue);
public InternalCodingDt getValueAsCoding() {
return new InternalCodingDt(mySystem, myValue);
}
}

View File

@ -25,7 +25,7 @@ package ca.uhn.fhir.rest.server;
*
* @see RestfulServer#setAddProfileTag(AddProfileTagEnum)
*/
enum AddProfileTagEnum {
public enum AddProfileTagEnum {
/**
* Do not add profile tags automatically
*/

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.server;
* #L%
*/
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException;
import java.io.OutputStreamWriter;
@ -61,11 +61,10 @@ import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.api.Tag;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
import ca.uhn.fhir.model.dstu.resource.Binary;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.parser.IParser;
@ -82,8 +81,6 @@ import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
import ca.uhn.fhir.rest.server.provider.ServerConformanceProvider;
import ca.uhn.fhir.rest.server.provider.ServerProfileProvider;
import ca.uhn.fhir.util.VersionUtil;
public class RestfulServer extends HttpServlet {
@ -119,7 +116,7 @@ public class RestfulServer extends HttpServlet {
public RestfulServer(FhirContext theCtx) {
myFhirContext = theCtx;
myServerConformanceProvider = new ServerConformanceProvider(this);
myServerConformanceProvider = theCtx.getVersion().createServerConformanceProvider(this);
}
/**
@ -375,7 +372,7 @@ public class RestfulServer extends HttpServlet {
}
public IResourceProvider getServerProfilesProvider() {
return new ServerProfileProvider(getFhirContext());
return myFhirContext.getVersion().createServerProfilesProvider(this);
}
/**
@ -638,7 +635,7 @@ public class RestfulServer extends HttpServlet {
} catch (Throwable e) {
OperationOutcome oo = null;
BaseOperationOutcome oo = null;
int statusCode = 500;
if (e instanceof BaseServerResponseException) {
@ -647,19 +644,25 @@ public class RestfulServer extends HttpServlet {
}
if (oo == null) {
oo = new OperationOutcome();
Issue issue = oo.addIssue();
issue.getSeverity().setValueAsEnum(IssueSeverityEnum.ERROR);
try {
oo = (BaseOperationOutcome) myFhirContext.getResourceDefinition("OperationOutcome").getImplementingClass().newInstance();
} catch (Exception e1) {
ourLog.error("Failed to instantiate OperationOutcome resource instance", e1);
throw new ServletException("Failed to instantiate OperationOutcome resource instance", e1);
}
BaseIssue issue = oo.addIssue();
issue.getSeverityElement().setValue("error");
if (e instanceof InternalErrorException) {
ourLog.error("Failure during REST processing", e);
issue.getDetails().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));
issue.getDetailsElement().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));
} else if (e instanceof BaseServerResponseException) {
ourLog.warn("Failure during REST processing: {}", e.toString());
statusCode = ((BaseServerResponseException) e).getStatusCode();
issue.getDetails().setValue(e.getMessage());
issue.getDetailsElement().setValue(e.getMessage());
} else {
ourLog.error("Failure during REST processing", e);
issue.getDetails().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));
issue.getDetailsElement().setValue(e.toString() + "\n\n" + ExceptionUtils.getStackTrace(e));
}
}
@ -979,7 +982,7 @@ public class RestfulServer extends HttpServlet {
for (IResource next : resourceList) {
if (next.getId() == null || next.getId().isEmpty()) {
if (!(next instanceof OperationOutcome)) {
if (!(next instanceof BaseOperationOutcome)) {
throw new InternalErrorException("Server method returned resource of type[" + next.getClass().getSimpleName() + "] with no ID specified (IResource#setId(IdDt) must be called)");
}
}
@ -1179,6 +1182,11 @@ public class RestfulServer extends HttpServlet {
return EncodingEnum.XML;
}
/**
* Determine whether a response should be given in JSON or XML format based on the
* incoming HttpServletRequest's <code>"_format"</code> parameter and <code>"Accept:"</code>
* HTTP header.
*/
public static EncodingEnum determineResponseEncoding(HttpServletRequest theReq) {
String[] format = theReq.getParameterValues(Constants.PARAM_FORMAT);
if (format != null) {

View File

@ -4,7 +4,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
/*
* #%L
@ -49,7 +49,7 @@ public abstract class BaseServerResponseException extends RuntimeException {
registerExceptionType(NotImplementedOperationException.STATUS_CODE, NotImplementedOperationException.class);
}
private OperationOutcome myOperationOutcome;
private BaseOperationOutcome myBaseOperationOutcome;
private String myResponseBody;
private String myResponseMimeType;
private int myStatusCode;
@ -65,7 +65,7 @@ public abstract class BaseServerResponseException extends RuntimeException {
public BaseServerResponseException(int theStatusCode, String theMessage) {
super(theMessage);
myStatusCode = theStatusCode;
myOperationOutcome = null;
myBaseOperationOutcome = null;
}
/**
@ -75,14 +75,14 @@ public abstract class BaseServerResponseException extends RuntimeException {
* The HTTP status code corresponding to this problem
* @param theMessage
* The message
* @param theOperationOutcome
* An OperationOutcome resource to return to the calling client (in a server) or the OperationOutcome
* @param theBaseOperationOutcome
* An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome
* that was returned from the server (in a client)
*/
public BaseServerResponseException(int theStatusCode, String theMessage, OperationOutcome theOperationOutcome) {
public BaseServerResponseException(int theStatusCode, String theMessage, BaseOperationOutcome theBaseOperationOutcome) {
super(theMessage);
myStatusCode = theStatusCode;
myOperationOutcome = theOperationOutcome;
myBaseOperationOutcome = theBaseOperationOutcome;
}
/**
@ -98,7 +98,7 @@ public abstract class BaseServerResponseException extends RuntimeException {
public BaseServerResponseException(int theStatusCode, String theMessage, Throwable theCause) {
super(theMessage, theCause);
myStatusCode = theStatusCode;
myOperationOutcome = null;
myBaseOperationOutcome = null;
}
/**
@ -110,14 +110,14 @@ public abstract class BaseServerResponseException extends RuntimeException {
* The message
* @param theCause
* The underlying cause exception
* @param theOperationOutcome
* An OperationOutcome resource to return to the calling client (in a server) or the OperationOutcome
* @param theBaseOperationOutcome
* An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome
* that was returned from the server (in a client)
*/
public BaseServerResponseException(int theStatusCode, String theMessage, Throwable theCause, OperationOutcome theOperationOutcome) {
public BaseServerResponseException(int theStatusCode, String theMessage, Throwable theCause, BaseOperationOutcome theBaseOperationOutcome) {
super(theMessage, theCause);
myStatusCode = theStatusCode;
myOperationOutcome = theOperationOutcome;
myBaseOperationOutcome = theBaseOperationOutcome;
}
/**
@ -131,7 +131,7 @@ public abstract class BaseServerResponseException extends RuntimeException {
public BaseServerResponseException(int theStatusCode, Throwable theCause) {
super(theCause.toString(), theCause);
myStatusCode = theStatusCode;
myOperationOutcome = null;
myBaseOperationOutcome = null;
}
/**
@ -141,21 +141,21 @@ public abstract class BaseServerResponseException extends RuntimeException {
* The HTTP status code corresponding to this problem
* @param theCause
* The underlying cause exception
* @param theOperationOutcome
* An OperationOutcome resource to return to the calling client (in a server) or the OperationOutcome
* @param theBaseOperationOutcome
* An BaseOperationOutcome resource to return to the calling client (in a server) or the BaseOperationOutcome
* that was returned from the server (in a client)
*/
public BaseServerResponseException(int theStatusCode, Throwable theCause, OperationOutcome theOperationOutcome) {
public BaseServerResponseException(int theStatusCode, Throwable theCause, BaseOperationOutcome theBaseOperationOutcome) {
super(theCause.toString(), theCause);
myStatusCode = theStatusCode;
myOperationOutcome = theOperationOutcome;
myBaseOperationOutcome = theBaseOperationOutcome;
}
/**
* Returns the {@link OperationOutcome} resource if any which was supplied in the response, or <code>null</code>
* Returns the {@link BaseOperationOutcome} resource if any which was supplied in the response, or <code>null</code>
*/
public OperationOutcome getOperationOutcome() {
return myOperationOutcome;
public BaseOperationOutcome getOperationOutcome() {
return myBaseOperationOutcome;
}
/**
@ -188,14 +188,14 @@ public abstract class BaseServerResponseException extends RuntimeException {
}
/**
* Sets the OperationOutcome resource associated with this exception. In server
* Sets the BaseOperationOutcome resource associated with this exception. In server
* implementations, this is the OperartionOutcome resource to include with the HTTP response. In
* client implementations you should not call this method.
*
* @param theOperationOutcome The OperationOutcome resource
* @param theBaseOperationOutcome The BaseOperationOutcome resource
*/
public void setOperationOutcome(OperationOutcome theOperationOutcome) {
myOperationOutcome = theOperationOutcome;
public void setOperationOutcome(BaseOperationOutcome theBaseOperationOutcome) {
myBaseOperationOutcome = theBaseOperationOutcome;
}
/**

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.server.exceptions;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.server.Constants;
/*
@ -52,7 +52,7 @@ public class InternalErrorException extends BaseServerResponseException {
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public InternalErrorException(String theMessage, OperationOutcome theOperationOutcome) {
public InternalErrorException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.server.exceptions;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.server.Constants;
/*
@ -52,7 +52,7 @@ public class InvalidRequestException extends BaseServerResponseException {
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public InvalidRequestException(String theMessage, OperationOutcome theOperationOutcome) {
public InvalidRequestException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.server.exceptions;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.server.Constants;
/*
@ -44,7 +44,7 @@ public class MethodNotAllowedException extends BaseServerResponseException {
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public MethodNotAllowedException(String theMessage, OperationOutcome theOperationOutcome) {
public MethodNotAllowedException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -1,5 +1,5 @@
package ca.uhn.fhir.rest.server.exceptions;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.server.Constants;
/*
@ -54,7 +54,7 @@ public static final int STATUS_CODE = Constants.STATUS_HTTP_501_NOT_IMPLEMENTED;
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public NotImplementedOperationException(String theMessage, OperationOutcome theOperationOutcome) {
public NotImplementedOperationException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -21,8 +21,8 @@ package ca.uhn.fhir.rest.server.exceptions;
*/
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.Constants;
@ -38,7 +38,7 @@ public class ResourceGoneException extends BaseServerResponseException {
super(STATUS_CODE, "Resource " + (theId != null ? theId.getValue() : "") + " is gone/deleted");
}
public ResourceGoneException(Class<? extends IResource> theClass, IdentifierDt thePatientId) {
public ResourceGoneException(Class<? extends IResource> theClass, BaseIdentifierDt thePatientId) {
super(STATUS_CODE, "Resource of type " + theClass.getSimpleName() + " with ID " + thePatientId + " is gone/deleted");
}
@ -53,7 +53,7 @@ public class ResourceGoneException extends BaseServerResponseException {
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public ResourceGoneException(String theMessage, OperationOutcome theOperationOutcome) {
public ResourceGoneException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -21,8 +21,8 @@ package ca.uhn.fhir.rest.server.exceptions;
*/
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.Constants;
@ -39,7 +39,7 @@ public class ResourceNotFoundException extends BaseServerResponseException {
super(STATUS_CODE, createErrorMessage(theClass, theId));
}
public ResourceNotFoundException(Class<? extends IResource> theClass, IdDt theId, OperationOutcome theOperationOutcome) {
public ResourceNotFoundException(Class<? extends IResource> theClass, IdDt theId, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, createErrorMessage(theClass, theId), theOperationOutcome);
}
@ -50,14 +50,14 @@ public class ResourceNotFoundException extends BaseServerResponseException {
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public ResourceNotFoundException(String theMessage, OperationOutcome theOperationOutcome) {
public ResourceNotFoundException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}
/**
* @deprecated This doesn't make sense, since an identifier is not a resource ID and shouldn't generate a 404 if it isn't found - Should be removed
*/
public ResourceNotFoundException(Class<? extends IResource> theClass, IdentifierDt theId) {
public ResourceNotFoundException(Class<? extends IResource> theClass, BaseIdentifierDt theId) {
super(STATUS_CODE, "Resource of type " + theClass.getSimpleName() + " with ID " + theId + " is not known");
}
@ -65,7 +65,7 @@ public class ResourceNotFoundException extends BaseServerResponseException {
super(STATUS_CODE, createErrorMessage(theId));
}
public ResourceNotFoundException(IdDt theId, OperationOutcome theOperationOutcome) {
public ResourceNotFoundException(IdDt theId, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, createErrorMessage(theId), theOperationOutcome);
}

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.annotation.Delete;
import ca.uhn.fhir.rest.annotation.Update;
import ca.uhn.fhir.rest.server.Constants;
@ -45,7 +45,7 @@ public class ResourceVersionConflictException extends BaseServerResponseExceptio
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public ResourceVersionConflictException(String theMessage, OperationOutcome theOperationOutcome) {
public ResourceVersionConflictException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.annotation.Update;
import ca.uhn.fhir.rest.server.Constants;
@ -44,7 +44,7 @@ public class ResourceVersionNotSpecifiedException extends BaseServerResponseExce
* The message
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public ResourceVersionNotSpecifiedException(String theMessage, OperationOutcome theOperationOutcome) {
public ResourceVersionNotSpecifiedException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.server.exceptions;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
/*
* #%L
@ -49,7 +49,7 @@ public class UnclassifiedServerFailureException extends BaseServerResponseExcept
* The message to add to the status line
* @param theOperationOutcome The OperationOutcome resource to return to the client
*/
public UnclassifiedServerFailureException(int theStatusCode, String theMessage, OperationOutcome theOperationOutcome) {
public UnclassifiedServerFailureException(int theStatusCode, String theMessage, BaseOperationOutcome theOperationOutcome) {
super(theStatusCode, theMessage, theOperationOutcome);
}

View File

@ -20,14 +20,23 @@ package ca.uhn.fhir.rest.server.exceptions;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import java.util.List;
import java.util.Map;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.dstu.composite.ContainedDt;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.Constants;
/**
* Represents an <b>HTTP 422 Unprocessable Entity</b> response, which means that a resource was rejected by the server because it "violated applicable FHIR profiles or server business rules".
*
* <p>
* This exception will generally contain an {@link OperationOutcome} instance which details the failure.
* This exception will generally contain an {@link BaseOperationOutcome} instance which details the failure.
* </p>
*
* @see InvalidRequestException Which corresponds to an <b>HTTP 400 Bad Request</b> failure
@ -43,44 +52,32 @@ public class UnprocessableEntityException extends BaseServerResponseException {
*
* @param theMessage
* The message to add to the status line
* @param theOperationOutcome The OperationOutcome resource to return to the client
* @param theOperationOutcome The BaseOperationOutcome resource to return to the client
*/
public UnprocessableEntityException(String theMessage, OperationOutcome theOperationOutcome) {
public UnprocessableEntityException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}
/**
* Constructor which accepts an {@link OperationOutcome} resource which will be supplied in the response
* Constructor which accepts an {@link BaseOperationOutcome} resource which will be supplied in the response
*/
public UnprocessableEntityException(OperationOutcome theOperationOutcome) {
super(STATUS_CODE, DEFAULT_MESSAGE, theOperationOutcome == null ? new OperationOutcome() : theOperationOutcome);
public UnprocessableEntityException(BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, DEFAULT_MESSAGE, theOperationOutcome);
}
/**
* Constructor which accepts a String describing the issue. This string will be translated into an {@link OperationOutcome} resource which will be supplied in the response.
* Constructor which accepts a String describing the issue. This string will be translated into an {@link BaseOperationOutcome} resource which will be supplied in the response.
*/
public UnprocessableEntityException(String theMessage) {
super(STATUS_CODE, DEFAULT_MESSAGE, toOperationOutcome(theMessage));
super(STATUS_CODE, theMessage);
}
/**
* Constructor which accepts an array of Strings describing the issue. This strings will be translated into an {@link OperationOutcome} resource which will be supplied in the response.
* Constructor which accepts an array of Strings describing the issue. This strings will be translated into an {@link BaseOperationOutcome} resource which will be supplied in the response.
*/
public UnprocessableEntityException(String... theMessage) {
super(STATUS_CODE, DEFAULT_MESSAGE, toOperationOutcome(theMessage));
super(STATUS_CODE, theMessage[0]); // TODO: this used to generate an OperationOutcome - why?
}
private static OperationOutcome toOperationOutcome(String... theMessage) {
OperationOutcome OperationOutcome = new OperationOutcome();
if (theMessage != null) {
for (String next : theMessage) {
OperationOutcome.addIssue().setDetails(next);
}
}
return OperationOutcome;
}
}

View File

@ -0,0 +1,99 @@
package ca.uhn.fhir.rest.server.exceptions;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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.List;
import java.util.Map;
import ca.uhn.fhir.model.api.IElement;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.model.dstu.composite.ContainedDt;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.Constants;
/**
* Represents an <b>HTTP 422 Unprocessable Entity</b> response, which means that a resource was rejected by the server because it "violated applicable FHIR profiles or server business rules".
*
* <p>
* This exception will generally contain an {@link BaseOperationOutcome} instance which details the failure.
* </p>
*
* @see InvalidRequestException Which corresponds to an <b>HTTP 400 Bad Request</b> failure
*/
public class UnprocessableEntityException extends BaseServerResponseException {
private static final String DEFAULT_MESSAGE = "Unprocessable Entity";
private static final long serialVersionUID = 1L;
public static final int STATUS_CODE = Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY;
/**
* Constructor
*
* @param theMessage
* The message to add to the status line
* @param theOperationOutcome The BaseOperationOutcome resource to return to the client
*/
public UnprocessableEntityException(String theMessage, BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, theMessage, theOperationOutcome);
}
/**
* Constructor which accepts an {@link BaseOperationOutcome} resource which will be supplied in the response
*/
public UnprocessableEntityException(BaseOperationOutcome theOperationOutcome) {
super(STATUS_CODE, DEFAULT_MESSAGE, theOperationOutcome);
}
/**
* Constructor which accepts a String describing the issue. This string will be translated into an {@link BaseOperationOutcome} resource which will be supplied in the response.
*/
public UnprocessableEntityException(String theMessage) {
super(STATUS_CODE, theMessage);
}
/**
* Constructor which accepts an array of Strings describing the issue. This strings will be translated into an {@link BaseOperationOutcome} resource which will be supplied in the response.
*/
public UnprocessableEntityException(String... theMessage) {
<<<<<<< HEAD
super(STATUS_CODE, DEFAULT_MESSAGE, toOperationOutcome(theMessage));
}
private static OperationOutcome toOperationOutcome(String... theMessage) {
OperationOutcome OperationOutcome = new OperationOutcome();
if (theMessage != null) {
for (String next : theMessage) {
OperationOutcome.addIssue().setDetails(next);
}
}
return OperationOutcome;
=======
super(STATUS_CODE, theMessage[0]); // TODO: this used to generate an OperationOutcome - why?
>>>>>>> versions
}
}

View File

@ -20,24 +20,29 @@ package ca.uhn.fhir.rest.server.interceptor;
* #L%
*/
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.annotation.Read;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.method.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.AuthenticationException;
/**
* Provides methods to intercept requests and responses. Note that implementations of this interface may wish
* to use {@link InterceptorAdapter} in order to not need to implement every method.
* Provides methods to intercept requests and responses. Note that implementations of this interface may wish to use {@link InterceptorAdapter} in order to not need to implement every method.
*/
public interface IServerInterceptor {
/**
* This method is called before any other processing takes place for each incoming request. It may be used to
* provide alternate handling for some requests, or to screen requests before they are handled, etc.
* This method is called before any other processing takes place for each incoming request. It may be used to provide alternate handling for some requests, or to screen requests before they are
* handled, etc.
* <p>
* Note that any exceptions thrown by this method will not be trapped by HAPI (they will be passed up to the server)
* </p>
@ -45,12 +50,10 @@ public interface IServerInterceptor {
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do.
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
*/
public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse);
@ -65,21 +68,18 @@ public interface IServerInterceptor {
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do.
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* client.
*/
public boolean incomingRequestPostProcessed(RequestDetails theRequestDetails, HttpServletRequest theRequest, HttpServletResponse theResponse) throws AuthenticationException;
/**
* This method is called after the server implementation method has been called, but before any attempt to stream
* the response back to the client
* This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
*
* @param theRequestDetails
* A bean containing details about the request that is about to be processed, including
@ -88,22 +88,19 @@ public interface IServerInterceptor {
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do.
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* client.
*/
public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException;
public boolean outgoingResponse(RequestDetails theRequestDetails, TagList theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException;
/**
* This method is called after the server implementation method has been called, but before any attempt to stream
* the response back to the client
* This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
*
* @param theRequestDetails
* A bean containing details about the request that is about to be processed, including
@ -112,21 +109,19 @@ public interface IServerInterceptor {
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do.
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* client.
*/
public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException;
public boolean outgoingResponse(RequestDetails theRequestDetails, Bundle theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException;
/**
* This method is called after the server implementation method has been called, but before any attempt to stream
* the response back to the client
* This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
*
* @param theRequestDetails
* A bean containing details about the request that is about to be processed, including
@ -135,21 +130,19 @@ public interface IServerInterceptor {
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do.
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* client.
*/
public boolean outgoingResponse(RequestDetails theRequestDetails, IResource theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException;
public boolean outgoingResponse(RequestDetails theRequestDetails, IResource theResponseObject, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse)
throws AuthenticationException;
/**
* This method is called after the server implementation method has been called, but before any attempt to stream
* the response back to the client
* This method is called after the server implementation method has been called, but before any attempt to stream the response back to the client
*
* @param theRequestDetails
* A bean containing details about the request that is about to be processed, including
@ -158,16 +151,42 @@ public interface IServerInterceptor {
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling
* {@link HttpServletResponse#getWriter()}) but in that case it is important to return <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do.
* If your interceptor is providing a response rather than letting HAPI handle the response normally, you
* must return <code>false</code>. In this case, no further processing will occur and no further
* interceptors will be called.
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws AuthenticationException
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access
* attempt. If thrown, processing will stop and an HTTP 401 will be returned to the client.
* This exception may be thrown to indicate that the interceptor has detected an unauthorized access attempt. If thrown, processing will stop and an HTTP 401 will be returned to the
* client.
*/
public boolean outgoingResponse(RequestDetails theRequestDetails, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws AuthenticationException;
/**
* This method is called upon any exception being thrown within the server's request processing code. This includes any exceptions thrown within resource provider methods (e.g. {@link Search} and
* {@link Read} methods) as well as any runtime exceptions thrown by the server itself. This also includes any {@link AuthenticationException}s thrown.
* <p>
* Implementations of this method may choose to ignore/log/count/etc exceptions, and return <code>true</code>. In this case, processing will continue, and the server will automatically generate an
* {@link BaseOperationOutcome OperationOutcome}. Implementations may also choose to provide their own response to the client. In this case, they should return <code>false</code>, to indicate that
* they have handled the request and processing should stop.
* </p>
*
* @param theRequestDetails
* A bean containing details about the request that is about to be processed, including
* @param theResponseObject
* The actual object which is being streamed to the client as a response
* @param theRequest
* The incoming request
* @param theResponse
* The response. Note that interceptors may choose to provide a response (i.e. by calling {@link HttpServletResponse#getWriter()}) but in that case it is important to return
* <code>false</code>
* @return Return <code>true</code> if processing should continue normally. This is generally the right thing to do. If your interceptor is providing a response rather than letting HAPI handle the
* response normally, you must return <code>false</code>. In this case, no further processing will occur and no further interceptors will be called.
* @throws ServletException
* If this exception is thrown, it will be re-thrown up to the container for handling.
* @throws IOException
* If this exception is thrown, it will be re-thrown up to the container for handling.
*/
public boolean handleException(RequestDetails theRequestDetails, Throwable theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException,
IOException;
}

View File

@ -20,6 +20,9 @@ package ca.uhn.fhir.rest.server.interceptor;
* #L%
*/
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@ -65,4 +68,10 @@ public class InterceptorAdapter implements IServerInterceptor {
return true;
}
@Override
public boolean handleException(RequestDetails theRequestDetails, Throwable theException, HttpServletRequest theServletRequest, HttpServletResponse theServletResponse) throws ServletException,
IOException {
return true;
}
}

View File

@ -20,11 +20,16 @@ package ca.uhn.fhir.validation;
* #L%
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.Validate;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import org.apache.commons.lang3.Validate;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import java.util.ArrayList;
import java.util.Iterator;
@ -138,10 +143,19 @@ public class FhirValidator {
*/
@Deprecated
public void validate(Bundle theBundle) {
ValidationResult validationResult = validateWithResult(theBundle);
if (!validationResult.isSuccessful()) {
throw new ValidationFailureException(validationResult.getOperationOutcome());
}
Validate.notNull(theBundle, "theBundle must not be null");
ValidationContext<Bundle> ctx = ValidationContext.forBundle(myContext, theBundle);
for (IValidator next : myValidators) {
next.validateBundle(ctx);
}
BaseOperationOutcome oo = ctx.getOperationOutcome();
if (oo != null && oo.getIssue().size() > 0) {
throw new ValidationFailureException(oo);
}
}
/**
@ -174,11 +188,11 @@ public class FhirValidator {
ValidationContext<Bundle> ctx = ValidationContext.forBundle(myContext, theBundle);
for (IValidator next : myValidators) {
next.validateBundle(ctx);
}
for (IValidator next : myValidators) {
next.validateBundle(ctx);
}
OperationOutcome oo = ctx.getOperationOutcome();
BaseOperationOutcome oo = ctx.getOperationOutcome();
return ValidationResult.valueOf(oo);
}
@ -198,7 +212,7 @@ public class FhirValidator {
next.validateResource(ctx);
}
OperationOutcome oo = ctx.getOperationOutcome();
BaseOperationOutcome oo = ctx.getOperationOutcome();
return ValidationResult.valueOf(oo);
}
}

View File

@ -0,0 +1,251 @@
package ca.uhn.fhir.validation;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 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%
*/
<<<<<<< HEAD
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import org.apache.commons.lang3.Validate;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
=======
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.Validate;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
>>>>>>> versions
/**
* Resource validator, which checks resources for compliance against various validation schemes (schemas, schematrons, etc.)
*
* <p>
* To obtain a resource validator, call {@link FhirContext#newValidator()}
* </p>
*/
public class FhirValidator {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirValidator.class);
private static final String I18N_KEY_NO_PHLOC_WARNING = FhirValidator.class.getName()+".noPhlocWarningOnStartup";
private static final String I18N_KEY_NO_PHLOC_ERROR = FhirValidator.class.getName()+".noPhlocError";
private FhirContext myContext;
private List<IValidator> myValidators = new ArrayList<IValidator>();
private static volatile Boolean ourPhlocPresentOnClasspath;
/**
* Constructor (this should not be called directly, but rather {@link FhirContext#newValidator()} should be called to obtain an instance of {@link FhirValidator})
*/
public FhirValidator(FhirContext theFhirContext) {
myContext = theFhirContext;
setValidateAgainstStandardSchema(true);
if (ourPhlocPresentOnClasspath == null) {
try {
Class.forName("com.phloc.schematron.ISchematronResource");
ourPhlocPresentOnClasspath = true;
} catch (ClassNotFoundException e) {
ourLog.info(theFhirContext.getLocalizer().getMessage(I18N_KEY_NO_PHLOC_WARNING));
ourPhlocPresentOnClasspath = false;
}
}
if (ourPhlocPresentOnClasspath) {
setValidateAgainstStandardSchematron(true);
}
}
private void addOrRemoveValidator(boolean theValidateAgainstStandardSchema, Class<? extends IValidator> type, IValidator instance) {
if (theValidateAgainstStandardSchema) {
boolean found = haveValidatorOfType(type);
if (!found) {
myValidators.add(instance);
}
} else {
for (Iterator<IValidator> iter = myValidators.iterator(); iter.hasNext();) {
IValidator next = iter.next();
if (next.getClass().equals(type)) {
iter.remove();
}
}
}
}
private boolean haveValidatorOfType(Class<? extends IValidator> type) {
boolean found = false;
for (IValidator next : myValidators) {
if (next.getClass().equals(type)) {
found = true;
}
}
return found;
}
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
*/
public boolean isValidateAgainstStandardSchema() {
return haveValidatorOfType(SchemaBaseValidator.class);
}
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
*/
public boolean isValidateAgainstStandardSchematron() {
return haveValidatorOfType(SchematronBaseValidator.class);
}
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
*/
public void setValidateAgainstStandardSchema(boolean theValidateAgainstStandardSchema) {
addOrRemoveValidator(theValidateAgainstStandardSchema, SchemaBaseValidator.class, new SchemaBaseValidator());
}
/**
* Should the validator validate the resource against the base schematron (the schematron provided with the FHIR distribution itself)
*/
public void setValidateAgainstStandardSchematron(boolean theValidateAgainstStandardSchematron) {
if (theValidateAgainstStandardSchematron && !ourPhlocPresentOnClasspath) {
throw new IllegalArgumentException(myContext.getLocalizer().getMessage(I18N_KEY_NO_PHLOC_ERROR));
}
addOrRemoveValidator(theValidateAgainstStandardSchematron, SchematronBaseValidator.class, new SchematronBaseValidator());
}
/**
* Validates a bundle instance, throwing a {@link ValidationFailureException} if the validation fails. This validation includes validation of all resources in the bundle.
*
* @param theBundle
* The resource to validate
* @throws ValidationFailureException
* If the validation fails
* @deprecated use {@link #validateWithResult(ca.uhn.fhir.model.api.Bundle)} instead
*/
@Deprecated
public void validate(Bundle theBundle) {
<<<<<<< HEAD
ValidationResult validationResult = validateWithResult(theBundle);
if (!validationResult.isSuccessful()) {
throw new ValidationFailureException(validationResult.getOperationOutcome());
}
=======
Validate.notNull(theBundle, "theBundle must not be null");
ValidationContext<Bundle> ctx = ValidationContext.forBundle(myContext, theBundle);
for (IValidator next : myValidators) {
next.validateBundle(ctx);
}
BaseOperationOutcome oo = ctx.getOperationOutcome();
if (oo != null && oo.getIssue().size() > 0) {
throw new ValidationFailureException(oo);
}
>>>>>>> versions
}
/**
* Validates a resource instance, throwing a {@link ValidationFailureException} if the validation fails
*
* @param theResource
* The resource to validate
* @throws ValidationFailureException
* If the validation fails
* @deprecated use {@link #validateWithResult(ca.uhn.fhir.model.api.IResource)} instead
*/
@Deprecated
public void validate(IResource theResource) throws ValidationFailureException {
<<<<<<< HEAD
ValidationResult validationResult = validateWithResult(theResource);
if (!validationResult.isSuccessful()) {
throw new ValidationFailureException(validationResult.getOperationOutcome());
}
}
/**
* Validates a bundle instance returning a {@link ca.uhn.fhir.validation.ValidationResult} which contains the results.
* This validation includes validation of all resources in the bundle.
*
* @param theBundle the bundle to validate
* @return the results of validation
* @since 0.7
*/
public ValidationResult validateWithResult(Bundle theBundle) {
Validate.notNull(theBundle, "theBundle must not be null");
ValidationContext<Bundle> ctx = ValidationContext.forBundle(myContext, theBundle);
for (IValidator next : myValidators) {
next.validateBundle(ctx);
}
OperationOutcome oo = ctx.getOperationOutcome();
return ValidationResult.valueOf(oo);
}
/**
* Validates a resource instance returning a {@link ca.uhn.fhir.validation.ValidationResult} which contains the results.
*
* @param theResource the resource to validate
* @return the results of validation
* @since 0.7
*/
public ValidationResult validateWithResult(IResource theResource) {
Validate.notNull(theResource, "theResource must not be null");
ValidationContext<IResource> ctx = ValidationContext.forResource(myContext, theResource);
for (IValidator next : myValidators) {
next.validateResource(ctx);
}
OperationOutcome oo = ctx.getOperationOutcome();
return ValidationResult.valueOf(oo);
}
=======
Validate.notNull(theResource, "theResource must not be null");
ValidationContext<IResource> ctx = ValidationContext.forResource(myContext, theResource);
for (IValidator next : myValidators) {
next.validateResource(ctx);
}
BaseOperationOutcome oo = ctx.getOperationOutcome();
if (oo != null && oo.getIssue().size() > 0) {
throw new ValidationFailureException(oo);
}
}
>>>>>>> versions
}

View File

@ -20,12 +20,10 @@ package ca.uhn.fhir.validation;
* #L%
*/
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
@ -40,7 +38,6 @@ import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.input.BOMInputStream;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
@ -50,8 +47,7 @@ import org.xml.sax.SAXParseException;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
class SchemaBaseValidator implements IValidator {
@ -121,7 +117,7 @@ class SchemaBaseValidator implements IValidator {
ourLog.debug("Going to load resource: {}", pathToBase);
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
if (baseIs == null) {
throw new ValidationFailureException("No FHIR-BASE schema found");
throw new InternalErrorException("No FHIR-BASE schema found");
}
baseIs = new BOMInputStream(baseIs, false);
InputStreamReader baseReader = new InputStreamReader(baseIs, Charset.forName("UTF-8"));
@ -159,26 +155,26 @@ class SchemaBaseValidator implements IValidator {
myContext = theContext;
}
private void addIssue(SAXParseException theException, IssueSeverityEnum severity) {
Issue issue = myContext.getOperationOutcome().addIssue();
issue.setSeverity(severity);
issue.setDetails(theException.getLocalizedMessage());
issue.addLocation().setValue("Line[" + theException.getLineNumber() + "] Col[" + theException.getColumnNumber() + "]");
private void addIssue(SAXParseException theException, String severity) {
BaseIssue issue = myContext.getOperationOutcome().addIssue();
issue.getSeverityElement().setValue(severity);
issue.getDetailsElement().setValue(theException.getLocalizedMessage());
issue.addLocation("Line[" + theException.getLineNumber() + "] Col[" + theException.getColumnNumber() + "]");
}
@Override
public void error(SAXParseException theException) throws SAXException {
addIssue(theException, IssueSeverityEnum.ERROR);
addIssue(theException, "error");
}
@Override
public void fatalError(SAXParseException theException) throws SAXException {
addIssue(theException, IssueSeverityEnum.FATAL);
addIssue(theException, "fatal");
}
@Override
public void warning(SAXParseException theException) throws SAXException {
addIssue(theException, IssueSeverityEnum.WARNING);
addIssue(theException, "warning");
}
}
@ -203,7 +199,7 @@ class SchemaBaseValidator implements IValidator {
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
if (baseIs == null) {
throw new ValidationFailureException("No FHIR-BASE schema found");
throw new InternalErrorException("No FHIR-BASE schema found");
}
input.setByteStream(baseIs);

View File

@ -33,8 +33,9 @@ import org.oclc.purl.dsdl.svrl.SchematronOutputType;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import com.phloc.commons.error.IResourceError;
import com.phloc.commons.error.IResourceErrorGroup;
@ -64,23 +65,23 @@ public class SchematronBaseValidator implements IValidator {
}
for (IResourceError next : errors.getAllErrors().getAllResourceErrors()) {
Issue issue = theCtx.getOperationOutcome().addIssue();
BaseIssue issue = theCtx.getOperationOutcome().addIssue();
switch (next.getErrorLevel()) {
case ERROR:
issue.setSeverity(IssueSeverityEnum.ERROR);
issue.getSeverityElement().setValue("error");
break;
case FATAL_ERROR:
issue.setSeverity(IssueSeverityEnum.FATAL);
issue.getSeverityElement().setValue("fatal");
break;
case WARN:
issue.setSeverity(IssueSeverityEnum.WARNING);
issue.getSeverityElement().setValue("warning");
break;
case INFO:
case SUCCESS:
continue;
}
issue.getDetails().setValue(next.getAsString(Locale.getDefault()));
issue.getDetailsElement().setValue(next.getAsString(Locale.getDefault()));
}
}
@ -103,7 +104,7 @@ public class SchematronBaseValidator implements IValidator {
+ ".sch";
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
if (baseIs == null) {
throw new ValidationFailureException("No schematron found for resource type: "
throw new InternalErrorException("No schematron found for resource type: "
+ theCtx.getFhirContext().getResourceDefinition(theCtx.getResource()).getBaseDefinition().getImplementingClass().getCanonicalName());
}

View File

@ -23,16 +23,17 @@ package ca.uhn.fhir.validation;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
class ValidationContext<T> {
private final IEncoder myEncoder;
private final FhirContext myFhirContext;
private OperationOutcome myOperationOutcome;
private BaseOperationOutcome myOperationOutcome;
private final T myResource;
private String myXmlEncodedResource;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ValidationContext.class);
private ValidationContext(FhirContext theContext, T theResource, IEncoder theEncoder) {
myFhirContext = theContext;
myResource = theResource;
@ -43,9 +44,14 @@ class ValidationContext<T> {
return myFhirContext;
}
public OperationOutcome getOperationOutcome() {
public BaseOperationOutcome getOperationOutcome() {
if (myOperationOutcome == null) {
myOperationOutcome = new OperationOutcome();
try {
myOperationOutcome = (BaseOperationOutcome) myFhirContext.getResourceDefinition("OperationOutcome").getImplementingClass().newInstance();
} catch (Exception e1) {
ourLog.error("Failed to instantiate OperationOutcome resource instance", e1);
throw new InternalErrorException("Failed to instantiate OperationOutcome resource instance", e1);
}
}
return myOperationOutcome;
}

View File

@ -20,42 +20,41 @@ package ca.uhn.fhir.validation;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
public class ValidationFailureException extends RuntimeException {
private static final long serialVersionUID = 1L;
private OperationOutcome myOperationOutcome;
private BaseOperationOutcome myOperationOutcome;
public ValidationFailureException(String theProblem) {
this(theProblem, IssueSeverityEnum.FATAL, null);
}
// public ValidationFailureException(String theProblem) {
// this(theProblem, IssueSeverityEnum.FATAL, null);
// }
private static String toDescription(OperationOutcome theOo) {
private static String toDescription(BaseOperationOutcome theOo) {
StringBuilder b = new StringBuilder();
b.append(theOo.getIssueFirstRep().getDetails().getValue());
b.append(" - ");
b.append(theOo.getIssueFirstRep().getLocationFirstRep().getValue());
b.append(theOo.getIssueFirstRep().getDetailsElement().getValue());
// b.append(" - ");
// b.append(theOo.getIssueFirstRep().getLocationFirstRep().getValue());
return b.toString();
}
public ValidationFailureException(String theProblem, Exception theCause) {
this(theProblem, IssueSeverityEnum.FATAL, theCause);
}
// public ValidationFailureException(String theProblem, Exception theCause) {
// this(theProblem, IssueSeverityEnum.FATAL, theCause);
// }
public ValidationFailureException(String theProblem, IssueSeverityEnum theSeverity, Exception theCause) {
super(theProblem, theCause);
myOperationOutcome = new OperationOutcome();
myOperationOutcome.addIssue().setSeverity(theSeverity).setDetails(theProblem);
}
// public ValidationFailureException(String theProblem, IssueSeverityEnum theSeverity, Exception theCause) {
// super(theProblem, theCause);
// myOperationOutcome = new OperationOutcome();
// myOperationOutcome.addIssue().setSeverity(theSeverity).setDetails(theProblem);
// }
public ValidationFailureException(OperationOutcome theOperationOutcome) {
public ValidationFailureException(BaseOperationOutcome theOperationOutcome) {
super(toDescription(theOperationOutcome));
myOperationOutcome = theOperationOutcome;
}
public OperationOutcome getOperationOutcome() {
public BaseOperationOutcome getOperationOutcome() {
return myOperationOutcome;
}

View File

@ -20,7 +20,7 @@ package ca.uhn.fhir.validation;
* #L%
*/
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome;
/**
* Encapsulates the results of validation
@ -29,17 +29,17 @@ import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
* @since 0.7
*/
public class ValidationResult {
private OperationOutcome myOperationOutcome;
private BaseOperationOutcome myOperationOutcome;
private ValidationResult(OperationOutcome myOperationOutcome) {
private ValidationResult(BaseOperationOutcome myOperationOutcome) {
this.myOperationOutcome = myOperationOutcome;
}
public static ValidationResult valueOf(OperationOutcome myOperationOutcome) {
public static ValidationResult valueOf(BaseOperationOutcome myOperationOutcome) {
return new ValidationResult(myOperationOutcome);
}
public OperationOutcome getOperationOutcome() {
public BaseOperationOutcome getOperationOutcome() {
return myOperationOutcome;
}
@ -54,8 +54,8 @@ public class ValidationResult {
private String toDescription() {
StringBuilder b = new StringBuilder(100);
if (myOperationOutcome != null) {
OperationOutcome.Issue issueFirstRep = myOperationOutcome.getIssueFirstRep();
b.append(issueFirstRep.getDetails().getValue());
BaseOperationOutcome.BaseIssue issueFirstRep = myOperationOutcome.getIssueFirstRep();
b.append(issueFirstRep.getDetailsElement().getValue());
b.append(" - ");
b.append(issueFirstRep.getLocationFirstRep().getValue());
}

View File

@ -0,0 +1,5 @@
As of HAPI 0.8 -
Tests have mostly moved to the hapi-fhir-structures-dstu subproject,
since they depend on that project. There are also tests in other
structures subprojects.

View File

@ -0,0 +1,15 @@
package ca.uhn.fhir.validation;
import org.junit.Test;
public class PlaceholderTest {
/**
* This is just here to make Jenkins happy
*/
@Test
public void testPass() {
// nothing
}
}

View File

View File

@ -17,5 +17,11 @@
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/hapi-fhir-base"/>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,2 +1,3 @@
eclipse.preferences.version=1
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
@ -40,9 +40,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,68 @@
<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>0.8-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-base-testmindeps</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR - Minimal Dependency Test</name>
<dependencies>
<dependency>
<groupId>jetty</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5-6.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit_version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.7</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.8-SNAPSHOT</version>
<<<<<<< HEAD
=======
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
>>>>>>> versions
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,10 +1,11 @@
<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>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -19,20 +20,10 @@
</releases>
<url>https://maven.java.net/service/local/repositories/snapshots/content/</url>
</repository>
<!--
<repository>
<id>UOM</id>
<url>https://github.com/unitsofmeasurement/repository</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>maven-geotoolkit.org</id>
<name>GeoToolkit Repository for Maven</name>
<url>http://maven.geotoolkit.org/</url>
</repository>
-->
<!-- <repository> <id>UOM</id> <url>https://github.com/unitsofmeasurement/repository</url>
<releases> <enabled>true</enabled> </releases> </repository> <repository>
<id>maven-geotoolkit.org</id> <name>GeoToolkit Repository for Maven</name>
<url>http://maven.geotoolkit.org/</url> </repository> -->
</repositories>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
@ -44,7 +35,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
@ -52,11 +43,16 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j_version}</version>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>${slf4j_version}</version>
</dependency>
<dependency>
@ -74,56 +70,23 @@
<!-- For UCUM -->
<dependency>
<groupId>org.jscience</groupId>
<artifactId>jscience</artifactId>
<version>${jscience_version}</version>
<groupId>org.jscience</groupId>
<artifactId>jscience</artifactId>
<version>${jscience_version}</version>
</dependency>
<!--
FHIR RI is pulled in for UCUM support, but we don't want any
of its dependencies.
-->
<!--
<dependency>
<groupId>me.fhir</groupId>
<artifactId>fhir-dstu1</artifactId>
<version>0.0.81.2489</version>
<exclusions>
<exclusion>
<artifactId>Saxon-HE</artifactId>
<groupId>net.sf.saxon</groupId>
</exclusion>
<exclusion>
<artifactId>commons-discovery</artifactId>
<groupId>commons-discovery</groupId>
</exclusion>
<exclusion>
<artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId>
</exclusion>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
<exclusion>
<artifactId>xpp3</artifactId>
<groupId>xpp3</groupId>
</exclusion>
<exclusion>
<artifactId>junit</artifactId>
<groupId>junit</groupId>
</exclusion>
<exclusion>
<artifactId>jdom</artifactId>
<groupId>org.jdom</groupId>
</exclusion>
<exclusion>
<artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId>
</exclusion>
</exclusions>
</dependency>
-->
<!-- FHIR RI is pulled in for UCUM support, but we don't want any of its
dependencies. -->
<!-- <dependency> <groupId>me.fhir</groupId> <artifactId>fhir-dstu1</artifactId>
<version>0.0.81.2489</version> <exclusions> <exclusion> <artifactId>Saxon-HE</artifactId>
<groupId>net.sf.saxon</groupId> </exclusion> <exclusion> <artifactId>commons-discovery</artifactId>
<groupId>commons-discovery</groupId> </exclusion> <exclusion> <artifactId>commons-codec</artifactId>
<groupId>commons-codec</groupId> </exclusion> <exclusion> <artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId> </exclusion> <exclusion> <artifactId>xpp3</artifactId>
<groupId>xpp3</groupId> </exclusion> <exclusion> <artifactId>junit</artifactId>
<groupId>junit</groupId> </exclusion> <exclusion> <artifactId>jdom</artifactId>
<groupId>org.jdom</groupId> </exclusion> <exclusion> <artifactId>gson</artifactId>
<groupId>com.google.code.gson</groupId> </exclusion> </exclusions> </dependency> -->
<!-- Test Database -->
@ -154,7 +117,8 @@
</dependency>
<!-- <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>2.3.2</version> </dependency> -->
<!-- <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId>
<version>2.3.2</version> </dependency> -->
<!-- Spring -->
<dependency>
@ -254,21 +218,21 @@
<version>1.1.0.Final</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
<groupId>org.glassfish</groupId>
<artifactId>javax.el</artifactId>
<version>3.0.0</version>
</dependency>
<!-- Misc -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava_version}</version>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava_version}</version>
</dependency>
</dependencies>
@ -282,10 +246,10 @@
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<skip>true</skip>
<skipDeploy>true</skipDeploy>
</configuration>
</plugin>
</plugins>

View File

@ -11,6 +11,7 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.jpa.dao.IFhirResourceDao;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.TagList;
import ca.uhn.fhir.model.base.resource.BaseOperationOutcome.BaseIssue;
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
import ca.uhn.fhir.model.primitive.IdDt;
@ -160,7 +161,9 @@ public class JpaResourceProvider<T extends IResource> extends BaseJpaProvider im
try {
MethodOutcome retVal = new MethodOutcome();
retVal.setOperationOutcome(new OperationOutcome());
retVal.getOperationOutcome().addIssue().setSeverity(IssueSeverityEnum.INFORMATION).setDetails("Resource validates successfully");
BaseIssue issue = retVal.getOperationOutcome().addIssue();
issue.getSeverityElement().setValue("information");
issue.setDetails("Resource validates successfully");
return retVal;
} finally {
endRequest(theRequest);

View File

@ -970,7 +970,7 @@ public class FhirResourceDaoTest {
{
Patient patient = new Patient();
patient.addIdentifier("urn:system", "001");
patient.addName().addGiven("testSearchStringParamWithNonNormalized_höra");
patient.addName().addGiven("testSearchStringParamWithNonNormalized_h\u00F6ra");
ourPatientDao.create(patient);
}
{

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -17,7 +17,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
@ -127,7 +127,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<executions>
<execution>
<id>buildclient</id>
@ -152,6 +152,13 @@
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -6,13 +6,16 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<dependent-module archiveName="hapi-fhir-jpaserver-base-0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
<dependent-module archiveName="hapi-fhir-jpaserver-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-base-0.7-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependent-module archiveName="hapi-fhir-base-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/var/M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-testpage-overlay/0.7-SNAPSHOT/hapi-fhir-testpage-overlay-0.7-SNAPSHOT.war?unpackFolder=target/m2e-wtp/overlays&amp;includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependent-module archiveName="hapi-fhir-structures-dstu-0.8-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-structures-dstu/hapi-fhir-structures-dstu">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -16,12 +16,17 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
@ -29,7 +34,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
@ -185,7 +190,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<executions>
<execution>
<id>buildclient</id>
@ -193,6 +198,7 @@
<goal>generate-jparest-server</goal>
</goals>
<configuration>
<version>dstu</version>
<packageBase>ca.uhn.test.jpasrv</packageBase>
<baseResourceNames>
<baseResourceName>adversereaction</baseResourceName>
@ -202,7 +208,6 @@
<baseResourceName>appointment</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<baseResourceName>claim</baseResourceName>
<baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName>
@ -256,7 +261,6 @@
<baseResourceName>specimen</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<!-- <baseResourceName>test</baseResourceName> -->
<baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
@ -266,6 +270,13 @@
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>

View File

@ -0,0 +1,308 @@
<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>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-jpaserver-uhnfhirtest</artifactId>
<name>HAPI FHIR - fhirtest.uhn.ca Deployable WAR</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>0.8-SNAPSHOT</version>
<<<<<<< HEAD
=======
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
>>>>>>> versions
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>0.8-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-test</artifactId>
<version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring_version}</version>
</dependency>
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>${derby_version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbynet</artifactId>
<version>${derby_version}</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
<version>${derby_version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf-version}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback_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-api</artifactId>
<version>${slf4j_version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>17.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<!-- TEST DEPS -->
<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-webapp</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-util</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
<!-- Only required for CORS support -->
<dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<version>${ebay_cors_filter_version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId></groupId>
<artifactId></artifactId>
<versionRange>[0.4,)</versionRange>
<goals>
<goal></goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.8-SNAPSHOT</version>
<executions>
<execution>
<id>buildclient</id>
<goals>
<goal>generate-jparest-server</goal>
</goals>
<configuration>
<version>dstu</version>
<packageBase>ca.uhn.test.jpasrv</packageBase>
<baseResourceNames>
<baseResourceName>adversereaction</baseResourceName>
<baseResourceName>alert</baseResourceName>
<baseResourceName>allergyintolerance</baseResourceName>
<baseResourceName>appointmentresponse</baseResourceName>
<baseResourceName>appointment</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName>
<baseResourceName>conformance</baseResourceName>
<baseResourceName>coverage</baseResourceName>
<baseResourceName>deviceobservationreport</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>diagnosticorder</baseResourceName>
<baseResourceName>diagnosticreport</baseResourceName>
<baseResourceName>documentmanifest</baseResourceName>
<baseResourceName>documentreference</baseResourceName>
<baseResourceName>encounter</baseResourceName>
<baseResourceName>familyhistory</baseResourceName>
<baseResourceName>geneexpression</baseResourceName>
<baseResourceName>geneticanalysis</baseResourceName>
<baseResourceName>group</baseResourceName>
<baseResourceName>gvfmeta</baseResourceName>
<baseResourceName>gvfvariant</baseResourceName>
<baseResourceName>imagingstudy</baseResourceName>
<baseResourceName>immunizationrecommendation</baseResourceName>
<baseResourceName>immunization</baseResourceName>
<baseResourceName>list</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>media</baseResourceName>
<baseResourceName>medicationadministration</baseResourceName>
<baseResourceName>medicationdispense</baseResourceName>
<baseResourceName>medicationprescription</baseResourceName>
<baseResourceName>medication</baseResourceName>
<baseResourceName>medicationstatement</baseResourceName>
<baseResourceName>messageheader</baseResourceName>
<baseResourceName>microarray</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>operationoutcome</baseResourceName>
<baseResourceName>orderresponse</baseResourceName>
<baseResourceName>order</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName>
<baseResourceName>provenance</baseResourceName>
<baseResourceName>query</baseResourceName>
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>relatedperson</baseResourceName>
<baseResourceName>remittance</baseResourceName>
<baseResourceName>securityevent</baseResourceName>
<baseResourceName>sequencinganalysis</baseResourceName>
<baseResourceName>sequencinglab</baseResourceName>
<baseResourceName>slot</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
<targetResourceDirectory>${project.build.directory}/hapi-fhir-jpaserver/WEB-INF</targetResourceDirectory>
<targetResourceSpringBeansFile>hapi-fhir-server-resourceproviders.xml</targetResourceSpringBeansFile>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
<overlay>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
</overlay>
</overlays>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<finalName>hapi-fhir-jpaserver</finalName>
</build>
<packaging>war</packaging>
</project>

View File

@ -12,7 +12,7 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -17,7 +17,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.7</version>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<!-- Only required for OpenID Connect Support -->
@ -78,12 +84,6 @@
<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>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-resources/tinder"/>
<classpathentry kind="src" path="target/generated-sources/tinder"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

1
hapi-fhir-structures-dev/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target/

View File

@ -0,0 +1,353 @@
<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-deployable-pom</artifactId>
<version>0.8-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-structures-dev</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR Structures - DEV (FHIR Latest)</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet_api_version}</version>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>0.8-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
<scope>test</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.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback_version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<version>${ebay_cors_filter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-schematron</artifactId>
<version>${phloc_schematron_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-commons</artifactId>
<version>${phloc_commons_version}</version>
<scope>test</scope>
</dependency>
<!-- UNIT TEST DEPENDENCIES -->
<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>hamcrest-all</artifactId>
<version>${hamcrest_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava_version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.2.RELEASE</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.8-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate-structures</goal>
</goals>
</execution>
</executions>
<configuration>
<package>ca.uhn.fhir.model.dev</package>
<version>dev</version>
<baseResourceNames>
<baseResourceName>account</baseResourceName>
<baseResourceName>adversereaction</baseResourceName>
<baseResourceName>adversereactionrisk</baseResourceName>
<baseResourceName>alert</baseResourceName>
<baseResourceName>allergyintolerance</baseResourceName>
<baseResourceName>appointment</baseResourceName>
<baseResourceName>appointmentresponse</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<!--
Doesn't seem to work yet
<baseResourceName>claim</baseResourceName>
-->
<baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName>
<baseResourceName>conformance</baseResourceName>
<baseResourceName>contract</baseResourceName>
<baseResourceName>contraindication</baseResourceName>
<baseResourceName>coverage</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>deviceobservationreport</baseResourceName>
<baseResourceName>diagnosticorder</baseResourceName>
<baseResourceName>diagnosticreport</baseResourceName>
<baseResourceName>documentmanifest</baseResourceName>
<baseResourceName>documentreference</baseResourceName>
<baseResourceName>encounter</baseResourceName>
<baseResourceName>familyhistory</baseResourceName>
<baseResourceName>geneexpression</baseResourceName>
<baseResourceName>geneticanalysis</baseResourceName>
<baseResourceName>group</baseResourceName>
<baseResourceName>imagingstudy</baseResourceName>
<baseResourceName>immunization</baseResourceName>
<baseResourceName>immunizationrecommendation</baseResourceName>
<baseResourceName>list</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>media</baseResourceName>
<baseResourceName>medication</baseResourceName>
<baseResourceName>medicationadministration</baseResourceName>
<baseResourceName>medicationdispense</baseResourceName>
<baseResourceName>medicationprescription</baseResourceName>
<baseResourceName>medicationstatement</baseResourceName>
<baseResourceName>messageheader</baseResourceName>
<baseResourceName>microarray</baseResourceName>
<baseResourceName>namespace</baseResourceName>
<baseResourceName>nutritionorder</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>operationdefinition</baseResourceName>
<baseResourceName>operationoutcome</baseResourceName>
<baseResourceName>order</baseResourceName>
<baseResourceName>orderresponse</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName>
<!--
<baseResourceName>person</baseResourceName>
-->
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName>
<!--
Depends on "ActivityDefinition", which doesn't exist..
<baseResourceName>protocol</baseResourceName>
-->
<baseResourceName>provenance</baseResourceName>
<baseResourceName>query</baseResourceName>
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>questionnaireanswers</baseResourceName>
<baseResourceName>referralrequest</baseResourceName>
<baseResourceName>relatedperson</baseResourceName>
<baseResourceName>remittance</baseResourceName>
<baseResourceName>riskassessment</baseResourceName>
<baseResourceName>securityclaim</baseResourceName>
<baseResourceName>securityevent</baseResourceName>
<baseResourceName>securitygroup</baseResourceName>
<baseResourceName>securityprincipal</baseResourceName>
<!--
What is this?
<baseResourceName>sequence</baseResourceName>
-->
<baseResourceName>sequencinganalysis</baseResourceName>
<baseResourceName>sequencinglab</baseResourceName>
<baseResourceName>slot</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>subscription</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<versionRange>[0.4-SNAPSHOT,)</versionRange>
<goals>
<goal>generate-structures</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
<configuration>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,352 @@
<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>0.7-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-structures-dev</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR Structures - DEV (FHIR Latest)</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.7-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet_api_version}</version>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<version>1.5</version>
<scope>test</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.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-http</artifactId>
<version>${jetty_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${logback_version}</version>
<optional>true</optional>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.ebaysf.web</groupId>
<artifactId>cors-filter</artifactId>
<version>${ebay_cors_filter_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>${thymeleaf-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-schematron</artifactId>
<version>${phloc_schematron_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.phloc</groupId>
<artifactId>phloc-commons</artifactId>
<version>${phloc_commons_version}</version>
<scope>test</scope>
</dependency>
<!-- UNIT TEST DEPENDENCIES -->
<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>hamcrest-all</artifactId>
<version>${hamcrest_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava_version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring_security_version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.2.RELEASE</version>
<scope>test</scope>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.7-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>generate-structures</goal>
</goals>
</execution>
</executions>
<configuration>
<package>ca.uhn.fhir.model.dev</package>
<version>dev</version>
<baseResourceNames>
<baseResourceName>account</baseResourceName>
<baseResourceName>adversereaction</baseResourceName>
<baseResourceName>adversereactionrisk</baseResourceName>
<baseResourceName>alert</baseResourceName>
<baseResourceName>allergyintolerance</baseResourceName>
<baseResourceName>appointment</baseResourceName>
<baseResourceName>appointmentresponse</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<!--
Doesn't seem to work yet
<baseResourceName>claim</baseResourceName>
-->
<baseResourceName>composition</baseResourceName>
<baseResourceName>conceptmap</baseResourceName>
<baseResourceName>condition</baseResourceName>
<baseResourceName>conformance</baseResourceName>
<baseResourceName>contract</baseResourceName>
<baseResourceName>contraindication</baseResourceName>
<baseResourceName>coverage</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>deviceobservationreport</baseResourceName>
<baseResourceName>diagnosticorder</baseResourceName>
<baseResourceName>diagnosticreport</baseResourceName>
<baseResourceName>documentmanifest</baseResourceName>
<baseResourceName>documentreference</baseResourceName>
<baseResourceName>encounter</baseResourceName>
<baseResourceName>familyhistory</baseResourceName>
<baseResourceName>geneexpression</baseResourceName>
<baseResourceName>geneticanalysis</baseResourceName>
<baseResourceName>group</baseResourceName>
<baseResourceName>imagingstudy</baseResourceName>
<baseResourceName>immunization</baseResourceName>
<baseResourceName>immunizationrecommendation</baseResourceName>
<baseResourceName>list</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>media</baseResourceName>
<baseResourceName>medication</baseResourceName>
<baseResourceName>medicationadministration</baseResourceName>
<baseResourceName>medicationdispense</baseResourceName>
<baseResourceName>medicationprescription</baseResourceName>
<baseResourceName>medicationstatement</baseResourceName>
<baseResourceName>messageheader</baseResourceName>
<baseResourceName>microarray</baseResourceName>
<baseResourceName>namespace</baseResourceName>
<baseResourceName>nutritionorder</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>operationdefinition</baseResourceName>
<baseResourceName>operationoutcome</baseResourceName>
<baseResourceName>order</baseResourceName>
<baseResourceName>orderresponse</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName>
<baseResourceName>person</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName>
<!--
Depends on "ActivityDefinition", which doesn't exist..
<baseResourceName>protocol</baseResourceName>
-->
<baseResourceName>provenance</baseResourceName>
<baseResourceName>query</baseResourceName>
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>questionnaireanswers</baseResourceName>
<baseResourceName>referralrequest</baseResourceName>
<baseResourceName>relatedperson</baseResourceName>
<baseResourceName>remittance</baseResourceName>
<baseResourceName>riskassessment</baseResourceName>
<baseResourceName>securityclaim</baseResourceName>
<baseResourceName>securityevent</baseResourceName>
<baseResourceName>securitygroup</baseResourceName>
<baseResourceName>securityprincipal</baseResourceName>
<!--
What is this?
<baseResourceName>sequence</baseResourceName>
-->
<baseResourceName>sequencinganalysis</baseResourceName>
<baseResourceName>sequencinglab</baseResourceName>
<baseResourceName>slot</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>subscription</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<baseResourceName>user</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<versionRange>[0.4-SNAPSHOT,)</versionRange>
<goals>
<goal>generate-structures</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
<configuration>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -0,0 +1,64 @@
package ca.uhn.fhir.model.dev;
/*
* #%L
* HAPI FHIR Structures - DEV (FHIR Latest)
* %%
* Copyright (C) 2014 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
import org.apache.commons.lang3.StringUtils;
import ca.uhn.fhir.context.RuntimeResourceDefinition;
import ca.uhn.fhir.model.api.IFhirVersion;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dev.resource.Profile;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.provider.dev.ServerConformanceProvider;
import ca.uhn.fhir.rest.server.provider.dev.ServerProfileProvider;
public class FhirDev implements IFhirVersion {
private String myId;
@Override
public Object createServerConformanceProvider(RestfulServer theServer) {
return new ServerConformanceProvider(theServer);
}
@Override
public IResource generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition) {
Profile retVal = new Profile();
RuntimeResourceDefinition def = theRuntimeResourceDefinition;
myId = def.getId();
if (StringUtils.isBlank(myId)) {
myId = theRuntimeResourceDefinition.getName().toLowerCase();
}
retVal.setId(new IdDt(myId));
return retVal;
}
@Override
public IResourceProvider createServerProfilesProvider(RestfulServer theRestfulServer) {
return new ServerProfileProvider(theRestfulServer.getFhirContext());
}
}

View File

@ -0,0 +1,25 @@
package ca.uhn.fhir.model.dev.composite;
/*
* #%L
* HAPI FHIR Structures - DEV (FHIR Latest)
* %%
* Copyright (C) 2014 University Health Network
* %%
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* #L%
*/
public class AgeDt extends QuantityDt {
}

View File

@ -0,0 +1,123 @@
package ca.uhn.fhir.model.dev.composite;
/*
* #%L
* HAPI FHIR Structures - DEV (FHIR Latest)
* %%
* Copyright (C) 2014 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 static org.apache.commons.lang3.StringUtils.defaultString;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import ca.uhn.fhir.model.api.IBoundCodeableConcept;
import ca.uhn.fhir.model.api.IValueSetEnumBinder;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
@DatatypeDef(name = "CodeableConcept", isSpecialization = true)
public class BoundCodeableConceptDt<T extends Enum<?>> extends CodeableConceptDt implements IBoundCodeableConcept {
private IValueSetEnumBinder<T> myBinder;
/**
* Constructor
*/
public BoundCodeableConceptDt(IValueSetEnumBinder<T> theBinder) {
myBinder = theBinder;
}
/**
* Constructor
*/
public BoundCodeableConceptDt(IValueSetEnumBinder<T> theBinder, T theValue) {
myBinder = theBinder;
setValueAsEnum(theValue);
}
/**
* Constructor
*/
public BoundCodeableConceptDt(IValueSetEnumBinder<T> theBinder, Collection<T> theValues) {
myBinder = theBinder;
setValueAsEnum(theValues);
}
/**
* Sets the {@link #getCoding()} to contain a coding with the code and
* system defined by the given enumerated types, AND clearing any existing
* codings first. If theValue is null, existing codings are cleared and no
* codings are added.
*
* @param theValue
* The value to add, or <code>null</code>
*/
public void setValueAsEnum(Collection<T> theValues) {
getCoding().clear();
if (theValues != null) {
for (T next : theValues) {
getCoding().add(new CodingDt(myBinder.toSystemString(next), myBinder.toCodeString(next)));
}
}
}
/**
* Sets the {@link #getCoding()} to contain a coding with the code and
* system defined by the given enumerated type, AND clearing any existing
* codings first. If theValue is null, existing codings are cleared and no
* codings are added.
*
* @param theValue
* The value to add, or <code>null</code>
*/
public void setValueAsEnum(T theValue) {
getCoding().clear();
if (theValue == null) {
return;
}
getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue)));
}
/**
* Loops through the {@link #getCoding() codings} in this codeable concept
* and returns the first bound enumerated type that matches. <b>Use
* caution</b> using this method, see the return description for more
* information.
*
* @return Returns the bound enumerated type, or <code>null</code> if none
* are found. Note that a null return value doesn't neccesarily
* imply that this Codeable Concept has no codes, only that it has
* no codes that match the enum.
*/
public Set<T> getValueAsEnum() {
Set<T> retVal = new HashSet<T>();
for (CodingDt next : getCoding()) {
if (next == null) {
continue;
}
T nextT = myBinder.fromCodeString(defaultString(next.getCodeElement().getValue()), defaultString(next.getSystemElement().getValueAsString()));
if (nextT != null) {
retVal.add(nextT);
} else {
// TODO: throw special exception type?
}
}
return retVal;
}
}

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