Merge branch 'master' of ssh://git.code.sf.net/p/hl7api/fhircode

Conflicts:
	hapi-fhir-base/pom.xml
	hapi-fhir-structures-dstu/pom.xml
	hapi-tinder-plugin/pom.xml
	hapi-tinder-test/pom.xml
	pom.xml
This commit is contained in:
jamesagnew 2014-04-24 07:31:12 -04:00
commit b15462ddca
35 changed files with 2220 additions and 525 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.2</version>
<version>0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -194,6 +194,31 @@
<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>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>

473
hapi-fhir-base/pom.xml.orig Normal file
View File

@ -0,0 +1,473 @@
<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>
<<<<<<< HEAD
<version>0.2</version>
=======
<version>0.3</version>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<packaging>jar</packaging>
<url>http://hl7api.sourceforge.net/hapi-fhir/</url>
<name>HAPI FHIR Base Library</name>
<distributionManagement>
<site>
<id>hl7api.sf.net</id>
<url>scp://shell.sourceforge.net/home/project-web/hl7api/htdocs/hapi-fhir</url>
</site>
</distributionManagement>
<dependencies>
<!-- JSON -->
<!-- <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.2.4</version> </dependency> -->
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
</dependency>
<!-- XML -->
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>woodstox-core-asl</artifactId>
<version>4.2.0</version>
</dependency>
<!-- <dependency> <groupId>org.codehaus.woodstox</groupId> <artifactId>stax2-api</artifactId> <version>3.1.3</version> </dependency> -->
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
<version>2.1.2.RELEASE</version>
<optional>true</optional>
</dependency>
<!-- General -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
<optional>true</optional>
</dependency>
<!-- Client -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.3</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.3.2</version>
</dependency>
<!-- Server -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</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.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>
</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>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>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>directory-naming</groupId>
<artifactId>naming-java</artifactId>
<version>0.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest_version}</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>
<artifactId>maven-site-plugin</artifactId>
<version>3.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<configuration>
</configuration>
<reportSets>
<reportSet>
<id>default</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.5.3</version>
</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>
</plugins>
</reporting>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<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', 'sourceforge.net');
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', 'sourceforge.net');
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>
<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>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<attach>false</attach>
<descriptors>
<descriptor>${project.basedir}/src/assembly/hapi-fhir-all.xml</descriptor>
<!-- <descriptor>src/assembly/hapi-jdk14.xml</descriptor> -->
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0"?>
<document xmlns="http://maven.apache.org/changes/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 ./changes.xsd">
<properties>
<author>James Agnew</author>
<title>HAPI FHIR Changelog</title>
</properties>
<body>
<release version="0.3" date="TBD">
<action type="fix" dev="Josh Mandel">
Make it easier to add HTTP Basic Authorization headers to RESTful client requests
and <![CDATA[<a href="./doc_rest_client.html#HTTP_Basic_Authorization">an example</a>]]>
illustrating how it works
</action>
<action type="fix" dev="Josh Mandel">
Correct a dependency on commons-io that was causing issues with the Tinder build
</action>
</release>
</body>
</document>

View File

@ -0,0 +1,263 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" xmlns="http://maven.apache.org/changes/1.0.0" targetNamespace="http://maven.apache.org/changes/1.0.0">
<xs:element name="document" type="ChangesDocument">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Record every release with their subsequent changes.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:complexType name="ChangesDocument">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Record every release with their subsequent changes.
</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element minOccurs="0" name="properties" type="Properties">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Contains the properties of this document.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="body" type="Body">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Contains the releases of this project with the actions taken
for each of the releases.
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="Body">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" name="release" type="Release" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">The list of releases for this project.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
</xs:complexType>
<xs:complexType name="Release">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">A single release of this project.</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" name="action" type="Action" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">The list of actions taken for this release.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="version" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
The version number associated with this release.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="date" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
&lt;p&gt;The date of this release.&lt;/p&gt;
&lt;p&gt;This field can be any String, such as &quot;in SVN&quot; when the version isn&apos;t yet released. &lt;/p&gt;
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="description" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
A short description of this release.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="Action" mixed="true">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
A single action done on the project, during this release.
</xs:documentation>
</xs:annotation>
<xs:sequence>
<xs:element minOccurs="0" name="fixes" type="FixedIssue" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">A list of fix issues.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="dueto" type="DueTo" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">A list of contibutors for this issue.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
<xs:attribute name="dev" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
&lt;p&gt;Name of developer who committed the change.&lt;/p&gt;
&lt;p&gt;This &lt;b&gt;MUST&lt;/b&gt; be the name of the developer as described in the developers section of the pom.xml file.&lt;/p&gt;
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="due-to" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Name of the person to be credited for this change. This can be used when a patch is submitted by a non-committer.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="due-to-email" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Email of the person to be credited for this change.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="issue" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
&lt;p&gt;Id of the issue related to this change. This is the id in your issue tracking system.&lt;/p&gt;
&lt;p&gt;The Changes plugin will generate a URL out of this id. The URL is constructed using the value of the issueLinkTemplate parameter.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;changes-report.html&quot;&gt;changes-report mojo&lt;/a&gt; for more details.&lt;/p&gt;
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="type" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Supported action types are the following:
&lt;ul&gt;
&lt;li&gt;add : added functionnality to the project.&lt;/li&gt;
&lt;li&gt;fix : bug fix for the project.&lt;/li&gt;
&lt;li&gt;update : updated some part of the project.&lt;/li&gt;
&lt;li&gt;remove : removed some functionnality from the project.&lt;/li&gt;
&lt;/ul&gt;
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="system" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
&lt;p&gt;Id of issue tracking system. If empty &apos;default&apos; value will be use.&lt;/p&gt;
&lt;p&gt;The Changes plugin will generate a URL out of this id. The URL is constructed using the value of the issueLinkTemplatePerSystem parameter.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;changes-report.html&quot;&gt;changes-report mojo&lt;/a&gt; for more details.&lt;/p&gt;
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="date" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">fix date</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="FixedIssue">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
A fixed issue.
</xs:documentation>
</xs:annotation>
<xs:attribute name="issue" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
&lt;p&gt;Id of the issue related to this change. This is the id in your issue tracking system.&lt;/p&gt;
&lt;p&gt;The Changes plugin will generate a URL out of this id. The URL is constructed using the value of the issueLinkTemplate parameter.&lt;/p&gt;
&lt;p&gt;See the &lt;a href=&quot;changes-report.html&quot;&gt;changes-report mojo&lt;/a&gt; for more details.&lt;/p&gt;
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="DueTo">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
Name and Email of the person to be credited for this change. This can be used when a patch is submitted by a non-committer.
</xs:documentation>
</xs:annotation>
<xs:attribute name="name" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">Name of the person to be credited for this change.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="email" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">Email of the person to be credited for this change.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name="Properties">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element minOccurs="0" name="title" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">Page Title.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element minOccurs="0" name="author" type="Author">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">Page Author</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:complexType name="Author" mixed="true">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
A description of the author page.
</xs:documentation>
</xs:annotation>
<xs:all/>
<xs:attribute name="email" type="xs:string">
<xs:annotation>
<xs:documentation source="version">1.0.0</xs:documentation>
<xs:documentation source="description">
The page author email.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:schema>

View File

@ -0,0 +1,44 @@
package ca.uhn.fhir.rest.client;
import java.io.IOException;
import org.apache.http.HttpException;
import org.apache.http.HttpRequest;
import org.apache.http.HttpRequestInterceptor;
import org.apache.http.auth.AuthState;
import org.apache.http.auth.Credentials;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.impl.auth.BasicScheme;
import org.apache.http.protocol.HttpContext;
/**
* HTTP interceptor to be used for adding HTTP basic auth username/password tokens
* to requests
* <p>
* See the
* </p>
*/
public class HttpBasicAuthInterceptor implements HttpRequestInterceptor {
private String myUsername;
private String myPassword;
public HttpBasicAuthInterceptor(String theUsername, String thePassword) {
super();
myUsername = theUsername;
myPassword = thePassword;
}
@Override
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
AuthState authState = (AuthState) context.getAttribute(HttpClientContext.TARGET_AUTH_STATE);
if (authState.getAuthScheme() == null) {
Credentials creds = new UsernamePasswordCredentials(myUsername, myPassword);
authState.update(new BasicScheme(), creds);
}
}
}

View File

@ -69,7 +69,7 @@ public abstract class BaseOutcomeReturningMethodBindingWithResourceParam extends
if (param == null) {
continue;
}
params[i] = param.translateQueryParametersIntoServerArgument(theRequest.getParameters(), resource);
params[i] = param.translateQueryParametersIntoServerArgument(theRequest, resource);
}
addParametersForServerRequest(theRequest, params);

View File

@ -1,6 +1,6 @@
package ca.uhn.fhir.rest.method;
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isNotBlank;
import java.io.IOException;
import java.io.PrintWriter;
@ -130,7 +130,7 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi
throw new IllegalStateException("Should not get here!");
}
public abstract List<IResource> invokeServer(Object theResourceProvider, IdDt theId, IdDt theVersionId, Map<String, String[]> theParameterValues) throws InvalidRequestException, InternalErrorException;
public abstract List<IResource> invokeServer(Object theResourceProvider, Request theRequest) throws InvalidRequestException, InternalErrorException;
@Override
public void invokeServer(RestfulServer theServer, Request theRequest, HttpServletResponse theResponse) throws BaseServerResponseException, IOException {
@ -165,7 +165,7 @@ public abstract class BaseResourceReturningMethodBinding extends BaseMethodBindi
requestIsBrowser = true;
}
List<IResource> result = invokeServer(getProvider(), theRequest.getId(), theRequest.getVersion(), theRequest.getParameters());
List<IResource> result = invokeServer(getProvider(), theRequest);
switch (getReturnType()) {
case BUNDLE:
streamResponseAsBundle(theServer, theResponse, result, responseEncoding, theRequest.getFhirServerBase(), theRequest.getCompleteUrl(), prettyPrint, requestIsBrowser, narrativeMode);

View File

@ -3,7 +3,6 @@ package ca.uhn.fhir.rest.method;
import java.lang.reflect.Method;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
@ -11,7 +10,6 @@ import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Conformance;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.client.GetClientInvocation;
import ca.uhn.fhir.rest.method.SearchMethodBinding.RequestType;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
@ -39,7 +37,7 @@ public class ConformanceMethodBinding extends BaseResourceReturningMethodBinding
}
@Override
public List<IResource> invokeServer(Object theResourceProvider, IdDt theId, IdDt theVersionId, Map<String, String[]> theParameterValues) throws InvalidRequestException,
public List<IResource> invokeServer(Object theResourceProvider, Request theRequest) throws InvalidRequestException,
InternalErrorException {
IResource conf;
try {

View File

@ -1,11 +1,10 @@
package ca.uhn.fhir.rest.method;
import static org.apache.commons.lang3.StringUtils.*;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
@ -151,10 +150,10 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
}
@Override
public List<IResource> invokeServer(Object theResourceProvider, IdDt theId, IdDt theVersionId, Map<String, String[]> theParameterValues) throws InvalidRequestException, InternalErrorException {
public List<IResource> invokeServer(Object theResourceProvider, Request theRequest) throws InvalidRequestException, InternalErrorException {
Object[] args = new Object[getMethod().getParameterTypes().length];
if (myCountParamIndex != null) {
String[] countValues = theParameterValues.remove(Constants.PARAM_COUNT);
String[] countValues = theRequest.getParameters().remove(Constants.PARAM_COUNT);
if (countValues.length > 0 && StringUtils.isNotBlank(countValues[0])) {
try {
args[myCountParamIndex] = new IntegerDt(countValues[0]);
@ -164,7 +163,7 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
}
}
if (mySinceParamIndex != null) {
String[] sinceValues = theParameterValues.remove(Constants.PARAM_SINCE);
String[] sinceValues = theRequest.getParameters().remove(Constants.PARAM_SINCE);
if (sinceValues.length > 0 && StringUtils.isNotBlank(sinceValues[0])) {
try {
args[mySinceParamIndex] = new InstantDt(sinceValues[0]);
@ -175,7 +174,7 @@ public class HistoryMethodBinding extends BaseResourceReturningMethodBinding {
}
if (myIdParamIndex!=null) {
args[myIdParamIndex] = theId;
args[myIdParamIndex] = theRequest.getId();
}
Object response;

View File

@ -2,7 +2,6 @@ package ca.uhn.fhir.rest.method;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
@ -88,11 +87,11 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding {
}
@Override
public List<IResource> invokeServer(Object theResourceProvider, IdDt theId, IdDt theVersionId, Map<String, String[]> theParameterValues) throws InvalidRequestException, InternalErrorException {
public List<IResource> invokeServer(Object theResourceProvider, Request theRequest) throws InvalidRequestException, InternalErrorException {
Object[] params = new Object[myParameterCount];
params[myIdIndex] = theId;
params[myIdIndex] = theRequest.getId();
if (myVersionIdIndex != null) {
params[myVersionIdIndex] = theVersionId;
params[myVersionIdIndex] = theRequest.getVersion();
}
Object response;

View File

@ -15,10 +15,9 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationSystemEnum;
import ca.uhn.fhir.model.dstu.valueset.RestfulOperationTypeEnum;
import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.client.GetClientInvocation;
import ca.uhn.fhir.rest.param.IParameter;
import ca.uhn.fhir.rest.param.IQueryParameter;
import ca.uhn.fhir.rest.param.BaseQueryParameter;
import ca.uhn.fhir.rest.server.Constants;
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
@ -85,20 +84,21 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
}
@Override
public List<IResource> invokeServer(Object theResourceProvider, IdDt theId, IdDt theVersionId, Map<String, String[]> parameterValues) throws InvalidRequestException,
public List<IResource> invokeServer(Object theResourceProvider, Request theRequest) throws InvalidRequestException,
InternalErrorException {
assert theId == null;
assert theVersionId == null;
assert theRequest.getId() == null;
assert theRequest.getVersion() == null;
Object[] params = new Object[myParameters.size()];
for (int i = 0; i < myParameters.size(); i++) {
IParameter param = myParameters.get(i);
params[i] = param.translateQueryParametersIntoServerArgument(parameterValues, null);
params[i] = param.translateQueryParametersIntoServerArgument(theRequest, null);
}
Object response;
try {
response = this.getMethod().invoke(theResourceProvider, params);
Method method = this.getMethod();
response = method.invoke(theResourceProvider, params);
} catch (IllegalAccessException e) {
throw new InternalErrorException(e);
} catch (IllegalArgumentException e) {
@ -140,10 +140,10 @@ public class SearchMethodBinding extends BaseResourceReturningMethodBinding {
Set<String> methodParamsTemp = new HashSet<String>();
for (int i = 0; i < this.myParameters.size(); i++) {
if (!(myParameters.get(i) instanceof IQueryParameter)) {
if (!(myParameters.get(i) instanceof BaseQueryParameter)) {
continue;
}
IQueryParameter temp = (IQueryParameter) myParameters.get(i);
BaseQueryParameter temp = (BaseQueryParameter) myParameters.get(i);
methodParamsTemp.add(temp.getName());
if (temp.isRequired() && !theRequest.getParameters().containsKey(temp.getName())) {
ourLog.trace("Method {} doesn't match param '{}' is not present", getMethod().getName(), temp.getName());

View File

@ -0,0 +1,26 @@
package ca.uhn.fhir.rest.method;
import java.util.List;
import java.util.Map;
import ca.uhn.fhir.rest.param.IParameter;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
class ServletRequestParameter implements IParameter {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServletRequestParameter.class);
@Override
public void translateClientArgumentIntoQueryArgument(Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments) throws InternalErrorException {
/*
* Does nothing, since we just ignore HttpServletRequest arguments
*/
ourLog.trace("Ignoring HttpServletRequest argument: {}", theSourceClientArgument);
}
@Override
public Object translateQueryParametersIntoServerArgument(Request theRequest, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
return theRequest.getServletRequest();
}
}

View File

@ -24,7 +24,7 @@ import ca.uhn.fhir.rest.server.Constants;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
public class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithResourceParam {
class UpdateMethodBinding extends BaseOutcomeReturningMethodBindingWithResourceParam {
private Integer myIdParameterIndex;

View File

@ -10,6 +10,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.PathSpecification;
@ -88,66 +91,73 @@ class Util {
int paramIndex = 0;
for (Annotation[] annotations : method.getParameterAnnotations()) {
boolean haveHandledMethod = false;
for (int i = 0; i < annotations.length; i++) {
Annotation nextAnnotation = annotations[i];
Class<?> parameterType = parameterTypes[paramIndex];
Class<? extends java.util.Collection<?>> outerCollectionType = null;
Class<? extends java.util.Collection<?>> innerCollectionType = null;
if (Collection.class.isAssignableFrom(parameterType)) {
innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType;
parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(method, paramIndex);
}
if (Collection.class.isAssignableFrom(parameterType)) {
outerCollectionType = innerCollectionType;
innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType;
parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(method, paramIndex);
}
IParameter param;
if (nextAnnotation instanceof RequiredParam) {
SearchParameter parameter = new SearchParameter();
parameter.setName(((RequiredParam) nextAnnotation).name());
parameter.setRequired(true);
parameter.setType(parameterType, innerCollectionType, outerCollectionType);
param = parameter;
} else if (nextAnnotation instanceof OptionalParam) {
SearchParameter parameter = new SearchParameter();
parameter.setName(((OptionalParam) nextAnnotation).name());
parameter.setRequired(false);
parameter.setType(parameterType, innerCollectionType, innerCollectionType);
param = parameter;
} else if (nextAnnotation instanceof IncludeParam) {
if (parameterType != PathSpecification.class || innerCollectionType == null || outerCollectionType != null) {
throw new ConfigurationException("Method '" + method.getName() + "' is annotated with @" + IncludeParam.class.getSimpleName() + " but has a type other than Collection<"
+ PathSpecification.class.getSimpleName() + ">");
}
Class<? extends Collection<PathSpecification>> instantiableCollectionType = (Class<? extends Collection<PathSpecification>>) CollectionBinder.getInstantiableCollectionType(
innerCollectionType, "Method '" + method.getName() + "'");
param = new IncludeParameter((IncludeParam) nextAnnotation, instantiableCollectionType);
} else if (nextAnnotation instanceof ResourceParam) {
if (!IResource.class.isAssignableFrom(parameterType)) {
throw new ConfigurationException("Method '" + method.getName() + "' is annotated with @" + ResourceParam.class.getSimpleName()
+ " but has a type that is not an implemtation of " + IResource.class.getCanonicalName());
}
param = new ResourceParameter((Class<? extends IResource>) parameterType);
} else if (nextAnnotation instanceof IdParam || nextAnnotation instanceof VersionIdParam) {
param = null;
} else {
continue;
}
haveHandledMethod = true;
Class<?> parameterType = parameterTypes[paramIndex];
if (parameterType.equals(HttpServletRequest.class) || parameterType.equals(ServletRequest.class)) {
ServletRequestParameter param = new ServletRequestParameter();
parameters.add(param);
} else {
for (int i = 0; i < annotations.length; i++) {
Annotation nextAnnotation = annotations[i];
}
Class<? extends java.util.Collection<?>> outerCollectionType = null;
Class<? extends java.util.Collection<?>> innerCollectionType = null;
if (!haveHandledMethod) {
throw new ConfigurationException("Parameter #" + paramIndex + " of method '" + method.getName() + "' on type '" + method.getDeclaringClass().getCanonicalName()
+ "' has no recognized FHIR interface parameter annotations. Don't know how to handle this parameter");
if (Collection.class.isAssignableFrom(parameterType)) {
innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType;
parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(method, paramIndex);
}
if (Collection.class.isAssignableFrom(parameterType)) {
outerCollectionType = innerCollectionType;
innerCollectionType = (Class<? extends java.util.Collection<?>>) parameterType;
parameterType = ReflectionUtil.getGenericCollectionTypeOfMethodParameter(method, paramIndex);
}
IParameter param;
if (nextAnnotation instanceof RequiredParam) {
SearchParameter parameter = new SearchParameter();
parameter.setName(((RequiredParam) nextAnnotation).name());
parameter.setRequired(true);
parameter.setType(parameterType, innerCollectionType, outerCollectionType);
param = parameter;
} else if (nextAnnotation instanceof OptionalParam) {
SearchParameter parameter = new SearchParameter();
parameter.setName(((OptionalParam) nextAnnotation).name());
parameter.setRequired(false);
parameter.setType(parameterType, innerCollectionType, outerCollectionType);
param = parameter;
} else if (nextAnnotation instanceof IncludeParam) {
if (parameterType != PathSpecification.class || innerCollectionType == null || outerCollectionType != null) {
throw new ConfigurationException("Method '" + method.getName() + "' is annotated with @" + IncludeParam.class.getSimpleName() + " but has a type other than Collection<"
+ PathSpecification.class.getSimpleName() + ">");
}
Class<? extends Collection<PathSpecification>> instantiableCollectionType = (Class<? extends Collection<PathSpecification>>) CollectionBinder.getInstantiableCollectionType(
innerCollectionType, "Method '" + method.getName() + "'");
param = new IncludeParameter((IncludeParam) nextAnnotation, instantiableCollectionType);
} else if (nextAnnotation instanceof ResourceParam) {
if (!IResource.class.isAssignableFrom(parameterType)) {
throw new ConfigurationException("Method '" + method.getName() + "' is annotated with @" + ResourceParam.class.getSimpleName()
+ " but has a type that is not an implemtation of " + IResource.class.getCanonicalName());
}
param = new ResourceParameter((Class<? extends IResource>) parameterType);
} else if (nextAnnotation instanceof IdParam || nextAnnotation instanceof VersionIdParam) {
param = null;
} else {
continue;
}
haveHandledMethod = true;
parameters.add(param);
break;
}
if (!haveHandledMethod) {
throw new ConfigurationException("Parameter #" + paramIndex + " of method '" + method.getName() + "' on type '" + method.getDeclaringClass().getCanonicalName()
+ "' has no recognized FHIR interface parameter annotations. Don't know how to handle this parameter");
}
}
paramIndex++;

View File

@ -6,11 +6,12 @@ import java.util.List;
import java.util.Map;
import ca.uhn.fhir.model.dstu.valueset.SearchParamTypeEnum;
import ca.uhn.fhir.rest.method.Request;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.util.QueryUtil;
public abstract class IQueryParameter implements IParameter {
public abstract class BaseQueryParameter implements IParameter {
public abstract List<List<String>> encode(Object theObject) throws InternalErrorException;
@ -54,8 +55,8 @@ public abstract class IQueryParameter implements IParameter {
}
@Override
public Object translateQueryParametersIntoServerArgument(Map<String, String[]> theQueryParameters, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
String[] value = theQueryParameters.get(getName());
public Object translateQueryParametersIntoServerArgument(Request theRequest, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
String[] value = theRequest.getParameters().get(getName());
if (value == null || value.length == 0) {
if (handlesMissing()) {
return parse(new ArrayList<List<String>>(0));

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.method.Request;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
@ -16,12 +17,12 @@ public interface IParameter {
* This <b>server method</b> method takes the data received by the server in an incoming request, and translates that data into a single argument for a server method invocation. Note that all
* received data is passed to this method, but the expectation is that not necessarily that all data is used by every parameter.
*
* @param theQueryParameters
* The query params, e.g. ?family=smith&given=john
* @param theRequest
* The incoming request object
* @param theRequestContents
* The parsed contents of the incoming request. E.g. if the request was an HTTP POST with a resource in the body, this argument would contain the parsed {@link IResource} instance.
* @return Returns the argument object as it will be passed to the {@link IResourceProvider} method.
*/
Object translateQueryParametersIntoServerArgument(Map<String, String[]> theQueryParameters, Object theRequestContents) throws InternalErrorException, InvalidRequestException;
Object translateQueryParametersIntoServerArgument(Request theRequest, Object theRequestContents) throws InternalErrorException, InvalidRequestException;
}

View File

@ -13,7 +13,7 @@ import ca.uhn.fhir.rest.annotation.IncludeParam;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
public class IncludeParameter extends IQueryParameter {
public class IncludeParameter extends BaseQueryParameter {
private Class<? extends Collection<PathSpecification>> myInstantiableCollectionType;
private HashSet<String> myAllow;

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.method.Request;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
@ -22,7 +23,7 @@ public class ResourceParameter implements IParameter {
}
@Override
public Object translateQueryParametersIntoServerArgument(Map<String, String[]> theQueryParameters, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
public Object translateQueryParametersIntoServerArgument(Request theRequest, Object theRequestContents) throws InternalErrorException, InvalidRequestException {
IResource resource = (IResource) theRequestContents;
return resource;
}

View File

@ -16,7 +16,7 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
/**
* Created by dsotnikov on 2/25/2014.
*/
public class SearchParameter extends IQueryParameter {
public class SearchParameter extends BaseQueryParameter {
private String name;
private IParamBinder myParamBinder;

View File

@ -162,6 +162,7 @@ public class RestfulServer extends HttpServlet {
}
ourLog.info("Got {} resource providers", typeToProvider.size());
for (IResourceProvider provider : typeToProvider.values()) {
assertProviderIsValid(provider);
findResourceMethods(provider);
}
}
@ -169,6 +170,7 @@ public class RestfulServer extends HttpServlet {
Collection<Object> providers = getProviders();
if (providers != null) {
for (Object next : providers) {
assertProviderIsValid(next);
findResourceMethods(next);
}
}
@ -184,6 +186,12 @@ public class RestfulServer extends HttpServlet {
ourLog.info("A FHIR has been lit on this server");
}
private void assertProviderIsValid(Object theNext) throws ConfigurationException {
if (Modifier.isPublic(theNext.getClass().getModifiers()) == false) {
throw new ConfigurationException("Can not use provider '" + theNext.getClass() + "' - Must be public");
}
}
public boolean isUseBrowserFriendlyContentTypes() {
return myUseBrowserFriendlyContentTypes;
}

View File

@ -22,7 +22,7 @@ import ca.uhn.fhir.rest.annotation.Metadata;
import ca.uhn.fhir.rest.method.BaseMethodBinding;
import ca.uhn.fhir.rest.method.SearchMethodBinding;
import ca.uhn.fhir.rest.param.IParameter;
import ca.uhn.fhir.rest.param.IQueryParameter;
import ca.uhn.fhir.rest.param.BaseQueryParameter;
import ca.uhn.fhir.rest.server.ResourceBinding;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.util.ExtensionConstants;
@ -86,11 +86,11 @@ public class ServerConformanceProvider {
RestResourceSearchParam searchParam = null;
StringDt searchParamChain = null;
for (IParameter nextParameterObj : params) {
if (!(nextParameterObj instanceof IQueryParameter)) {
if (!(nextParameterObj instanceof BaseQueryParameter)) {
continue;
}
IQueryParameter nextParameter = (IQueryParameter)nextParameterObj;
BaseQueryParameter nextParameter = (BaseQueryParameter)nextParameterObj;
if (nextParameter.getName().startsWith("_")) {
continue;
}

View File

@ -15,7 +15,7 @@ DIV.hapiHeaderText {
TABLE.hapiTableOfValues THEAD TR TD {
background: #A0A0F0;
color: #000080;
font-size: 1.em;
font-size: 1.2em;
font-weight: bold;
padding: 5px;
}

View File

@ -0,0 +1,40 @@
package example;
import org.apache.http.impl.client.HttpClientBuilder;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.client.HttpBasicAuthInterceptor;
import ca.uhn.fhir.rest.client.IRestfulClientFactory;
import ca.uhn.fhir.rest.client.api.IBasicClient;
public class ClientExamples {
public interface PatientClient extends IBasicClient {
// nothing yet
}
@SuppressWarnings("unused")
public void createSecurity() {
//START SNIPPET: security
// Create a context and get the client factory so it can be configured
FhirContext ctx = new FhirContext();
IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();
// Create an HTTP Client Builder
HttpClientBuilder builder = HttpClientBuilder.create();
// This interceptor adds HTTP username/password to every request
String username = "foobar";
String password = "boobear";
builder.addInterceptorFirst(new HttpBasicAuthInterceptor(username, password));
// Use the new HTTP client builder
clientFactory.setHttpClient(builder.build());
// Actually create a client instance
PatientClient client = ctx.newRestfulClient(PatientClient.class, "http://localhost:9999/");
//END SNIPPET: security
}
}

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<document xmlns="http://maven.apache.org/XDOC/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/XDOC/2.0 http://maven.apache.org/xsd/xdoc-2.0.xsd">
<properties>
<title>RESTful Client - HAPI FHIR</title>
@ -10,97 +11,152 @@
<!-- The body of the document contains a number of sections -->
<section name="Creating a RESTful Client">
<macro name="toc">
</macro>
<p>
HAPI provides a built-in mechanism for connecting to FHIR RESTful servers.
The HAPI RESTful client is designed to be easy to set up and to allow strong
compile-time type checking wherever possible.
HAPI provides a built-in mechanism for connecting to FHIR RESTful
servers.
The HAPI RESTful client is designed to be easy to set up and
to allow strong
compile-time type checking wherever possible.
</p>
<p>
Setup is mostly done using simple annotations, which means that it should
be possible to create a FHIR compliant server quickly and easily. Once again,
this design is intended to be similar to that of JAX-WS, so users of that
specification should be comfortable with this one.
Setup is mostly done using simple annotations, which means that it
should
be possible to create a FHIR compliant server quickly and
easily. Once again,
this design is intended to be similar to that of
JAX-WS, so users of that
specification should be comfortable with
this one.
</p>
<subsection name="Defining A Restful Client Interface">
<p>
The first step in creating a FHIR RESTful Client is to define a
restful client interface.
restful client interface.
</p>
<p>
A restful client interface class must extend the
<a href="./apidocs/ca/uhn/fhir/rest/client/api/IRestfulClient.html">IRestfulClient</a> interface,
A restful client interface class must extend the
<a href="./apidocs/ca/uhn/fhir/rest/client/api/IRestfulClient.html">IRestfulClient</a>
interface,
and will contain one or more methods which have been
annotated with special annotations indicating which RESTful operation
that method supports. Below is a simple example of a resource provider
annotated with special annotations indicating which RESTful
operation
that method supports. Below is a simple example of a
resource provider
which supports the
<a href="http://hl7.org/implement/standards/fhir/http.html#read">read</a>
operation (i.e. retrieve a single resource by ID) as well as the
<a href="http://hl7.org/implement/standards/fhir/http.html#search">search</a>
operation (i.e. find any resources matching a given criteria) for a specific
operation (i.e. find any resources matching a given criteria) for a
specific
search criteria.
</p>
<p>
You may notice that this interface looks a lot like the Resource Provider
which is defined for use by the RESTful server. In fact, it supports all
of the same annotations and is essentially identical, other than the
You may notice that this interface looks a lot like the Resource
Provider
which is defined for use by the RESTful server. In fact, it
supports all
of the same annotations and is essentially identical,
other than the
fact that for a client you must use an interface but for a server you
must use a concrete class with method implementations.
</p>
<macro name="snippet">
<param name="id" value="provider" />
<param name="file" value="src/site/example/java/example/RestfulClientImpl.java" />
<param name="file"
value="src/site/example/java/example/RestfulClientImpl.java" />
</macro>
<p>
You will probably want to add more methods
to your client interface. See
<a href="./doc_rest_operations.html">RESTful Operations</a> for
to your client interface.
See
<a href="./doc_rest_operations.html">RESTful Operations</a>
for
lots more examples of how to add methods for various operations.
</p>
</subsection>
<subsection name="Instantiate the Client">
<p>
Once your client interface is created, all that is left is to
create a FhirContext and instantiate the client and you are
ready to start using it.
ready to
start using it.
</p>
<macro name="snippet">
<param name="id" value="client" />
<param name="file" value="src/site/example/java/example/ExampleRestfulClient.java" />
<param name="file"
value="src/site/example/java/example/ExampleRestfulClient.java" />
</macro>
</subsection>
</subsection>
</section>
<section name="A Complete Example">
<p>
The following is a complete example showing a RESTful client
using HAPI FHIR.
using
HAPI FHIR.
</p>
<macro name="snippet">
<param name="id" value="client" />
<param name="file" value="src/site/example/java/example/CompleteExampleClient.java" />
<param name="id" value="client" />
<param name="file"
value="src/site/example/java/example/CompleteExampleClient.java" />
</macro>
</section>
<section name="Configuring the HTTP Client">
<p>
The client uses <a href="http://hc.apache.org/httpcomponents-client-ga/">Apache HTTP Client</a>
as a provider. The HTTP Client is very powerful, but can be a bit tricky to configure.
</p>
<p>
In many cases, the default configuration should suffice. However, if you require anything
more sophisticated (username/password, HTTP proxy settings, etc.) you will need
to configure the underlying client.
</p>
<p>
The underlying client configuration is provided by setting an
<a href="./apidocs/ca/uhn/fhir/rest/client/IRestfulClientFactory.html#setHttpClient(org.apache.http.client.HttpClient)">HttpClient</a>
on the RestfulClientFactory.
</p>
<subsection name="HTTP Basic Authorization">
<p>
The following example shows how to configure your client to
use a specific username and password in every request.
</p>
<macro name="snippet">
<param name="id" value="security" />
<param name="file" value="src/site/example/java/example/ClientExamples.java" />
</macro>
</subsection>
</section>
</body>
</document>

View File

@ -0,0 +1,134 @@
package ca.uhn.fhir.rest.client;
import static org.junit.Assert.*;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.servlet.http.HttpServletRequest;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.annotation.RequiredParam;
import ca.uhn.fhir.rest.annotation.Search;
import ca.uhn.fhir.rest.client.api.IBasicClient;
import ca.uhn.fhir.rest.server.IResourceProvider;
import ca.uhn.fhir.rest.server.ResfulServerMethodTest.DummyDiagnosticReportResourceProvider;
import ca.uhn.fhir.rest.server.ResfulServerMethodTest.DummyPatientResourceProvider;
import ca.uhn.fhir.rest.server.ResfulServerMethodTest.DummyRestfulServer;
import ca.uhn.fhir.rest.server.RestfulServer;
import ca.uhn.fhir.rest.server.provider.ServerProfileProvider;
import ca.uhn.fhir.testutil.RandomServerPortProvider;
public class ClientIntegrationTest {
private int myPort;
private Server myServer;
private FhirContext myCtx;
private MyPatientResourceProvider myPatientProvider;
@Before
public void before() {
myPort = RandomServerPortProvider.findFreePort();
myServer = new Server(myPort);
myCtx = new FhirContext(Patient.class);
myPatientProvider = new MyPatientResourceProvider();
ServletHandler proxyHandler = new ServletHandler();
RestfulServer servlet = new RestfulServer();
servlet.setResourceProviders(myPatientProvider);
ServletHolder servletHolder = new ServletHolder(servlet);
proxyHandler.addServletWithMapping(servletHolder, "/*");
myServer.setHandler(proxyHandler);
}
@Test
public void testClientSecurity() throws Exception {
// BasicCredentialsProvider credentialsProvider = new BasicCredentialsProvider();
// UsernamePasswordCredentials credentials = new UsernamePasswordCredentials("foobar", "boobear");
// AuthScope scope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT);
// credentialsProvider.setCredentials(scope, credentials);
// builder.setDefaultCredentialsProvider(credentialsProvider);
//
myServer.start();
FhirContext ctx = new FhirContext();
HttpClientBuilder builder = HttpClientBuilder.create();
// PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
// builder.setConnectionManager(connectionManager);
builder.addInterceptorFirst(new HttpBasicAuthInterceptor("foobar", "boobear"));
CloseableHttpClient httpClient = builder.build();
ctx.getRestfulClientFactory().setHttpClient(httpClient);
PatientClient client = ctx.newRestfulClient(PatientClient.class, "http://localhost:" + myPort + "/");
List<Patient> actualPatients = client.searchForPatients(new StringDt("AAAABBBB"));
assertEquals(1, actualPatients.size());
assertEquals("AAAABBBB", actualPatients.get(0).getNameFirstRep().getFamilyAsSingleString());
assertEquals("Basic Zm9vYmFyOmJvb2JlYXI=", myPatientProvider.getAuthorizationHeader());
}
@After
public void after() throws Exception {
myServer.stop();
}
public static class MyPatientResourceProvider implements IResourceProvider {
private String myAuthorizationHeader;
public String getAuthorizationHeader() {
return myAuthorizationHeader;
}
@Override
public Class<? extends IResource> getResourceType() {
return Patient.class;
}
@Search
public List<Patient> searchForPatients(@RequiredParam(name="fooParam") StringDt theFooParam, HttpServletRequest theRequest) {
myAuthorizationHeader = theRequest.getHeader("authorization");
Patient retVal = new Patient();
retVal.addName().addFamily(theFooParam.getValue());
return Collections.singletonList(retVal);
}
}
private static interface PatientClient extends IBasicClient {
@Search
public List<Patient> searchForPatients(@RequiredParam(name="fooParam") StringDt theFooParam);
}
}

View File

@ -52,9 +52,9 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
public class ClientTest {
private FhirContext ctx;
private HttpClient httpClient;
private HttpResponse httpResponse;
private FhirContext ctx;
// atom-document-large.xml
@ -68,6 +68,133 @@ public class ClientTest {
httpResponse = mock(HttpResponse.class, new ReturnsDeepStubs());
}
private String getPatientFeedWithOneResult() {
//@formatter:off
String msg = "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n" +
"<title/>\n" +
"<id>d039f91a-cc3c-4013-988e-af4d8d0614bd</id>\n" +
"<os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">1</os:totalResults>\n" +
"<published>2014-03-11T16:35:07-04:00</published>\n" +
"<author>\n" +
"<name>ca.uhn.fhir.rest.server.DummyRestfulServer</name>\n" +
"</author>\n" +
"<entry>\n" +
"<content type=\"text/xml\">"
+ "<Patient xmlns=\"http://hl7.org/fhir\">"
+ "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>"
+ "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>"
+ "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>"
+ "<name><family value=\"Kramer\" /><given value=\"Doe\" /></name>"
+ "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>"
+ "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>"
+ "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />"
+ "</Patient>"
+ "</content>\n"
+ " </entry>\n"
+ "</feed>";
//@formatter:on
return msg;
}
@Test
public void testCreate() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.createPatient(patient);
assertEquals(HttpPost.class, capt.getValue().getClass());
HttpPost post = (HttpPost) capt.getValue();
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertEquals("100", response.getId().getValue());
assertEquals("200", response.getVersionId().getValue());
}
@Test
public void testCreateBad() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 400, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("foobar"), Charset.forName("UTF-8")));
try {
ctx.newRestfulClient(ITestClient.class, "http://foo").createPatient(patient);
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), StringContains.containsString("foobar"));
}
}
@Test
public void testDelete() throws Exception {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDetails("Hello");
String resp = new FhirContext().newXmlParser().encodeResourceToString(oo);
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(resp), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.deletePatient(new IdDt("1234"));
assertEquals(HttpDelete.class, capt.getValue().getClass());
assertEquals("http://foo/Patient/1234", capt.getValue().getURI().toString());
assertEquals("Hello", response.getOperationOutcome().getIssueFirstRep().getDetails().getValue());
}
@Test
public void testDeleteNoResponse() throws Exception {
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 204, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.deleteDiagnosticReport(new IdDt("1234"));
assertEquals(HttpDelete.class, capt.getValue().getClass());
assertEquals("http://foo/DiagnosticReport/1234", capt.getValue().getURI().toString());
}
@Test
public void testGetConformance() throws Exception {
String msg = IOUtils.toString(ClientTest.class.getResourceAsStream("/example-metadata.xml"));
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
Conformance response = client.getServerConformanceStatement();
assertEquals("http://foo/metadata", capt.getValue().getURI().toString());
assertEquals("Health Intersections", response.getPublisher().getValue());
}
@Test
public void testHistoryResourceInstance() throws Exception {
@ -90,35 +217,35 @@ public class ClientTest {
// Older resource
{
BundleEntry olderEntry = response.getEntries().get(0);
assertEquals("222", olderEntry.getId().getValue());
assertThat(olderEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/1"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = olderEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(20000L));
InstantDt updActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = olderEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
BundleEntry olderEntry = response.getEntries().get(0);
assertEquals("222", olderEntry.getId().getValue());
assertThat(olderEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/1"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = olderEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(20000L));
InstantDt updActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = olderEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
}
// Newer resource
{
BundleEntry newerEntry = response.getEntries().get(1);
assertEquals("222", newerEntry.getId().getValue());
assertThat(newerEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/2"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = newerEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(30000L));
InstantDt updActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = newerEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
BundleEntry newerEntry = response.getEntries().get(1);
assertEquals("222", newerEntry.getId().getValue());
assertThat(newerEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/2"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = newerEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(30000L));
InstantDt updActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = newerEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
}
}
@ -144,38 +271,38 @@ public class ClientTest {
// Older resource
{
BundleEntry olderEntry = response.getEntries().get(0);
assertEquals("222", olderEntry.getId().getValue());
assertThat(olderEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/1"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = olderEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(20000L));
InstantDt updActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = olderEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
BundleEntry olderEntry = response.getEntries().get(0);
assertEquals("222", olderEntry.getId().getValue());
assertThat(olderEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/1"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = olderEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(20000L));
InstantDt updActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = olderEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
}
// Newer resource
{
BundleEntry newerEntry = response.getEntries().get(1);
assertEquals("222", newerEntry.getId().getValue());
assertThat(newerEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/2"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = newerEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(30000L));
InstantDt updActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = newerEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
BundleEntry newerEntry = response.getEntries().get(1);
assertEquals("222", newerEntry.getId().getValue());
assertThat(newerEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/2"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = newerEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(30000L));
InstantDt updActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = newerEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
}
}
@Test
public void testHistoryServer() throws Exception {
@ -198,35 +325,35 @@ public class ClientTest {
// Older resource
{
BundleEntry olderEntry = response.getEntries().get(0);
assertEquals("222", olderEntry.getId().getValue());
assertThat(olderEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/1"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = olderEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(20000L));
InstantDt updActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = olderEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
BundleEntry olderEntry = response.getEntries().get(0);
assertEquals("222", olderEntry.getId().getValue());
assertThat(olderEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/1"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = olderEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(20000L));
InstantDt updActualRes = (InstantDt) olderEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = olderEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
}
// Newer resource
{
BundleEntry newerEntry = response.getEntries().get(1);
assertEquals("222", newerEntry.getId().getValue());
assertThat(newerEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/2"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = newerEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(30000L));
InstantDt updActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = newerEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
BundleEntry newerEntry = response.getEntries().get(1);
assertEquals("222", newerEntry.getId().getValue());
assertThat(newerEntry.getLinkSelf().getValue(), StringEndsWith.endsWith("/Patient/222/_history/2"));
InstantDt pubExpected = new InstantDt(new Date(10000L));
InstantDt pubActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.PUBLISHED);
InstantDt pubActualBundle = newerEntry.getPublished();
assertEquals(pubExpected.getValueAsString(), pubActualRes.getValueAsString());
assertEquals(pubExpected.getValueAsString(), pubActualBundle.getValueAsString());
InstantDt updExpected = new InstantDt(new Date(30000L));
InstantDt updActualRes = (InstantDt) newerEntry.getResource().getResourceMetadata().get(ResourceMetadataKeyEnum.UPDATED);
InstantDt updActualBundle = newerEntry.getUpdated();
assertEquals(updExpected.getValueAsString(), updActualRes.getValueAsString());
assertEquals(updExpected.getValueAsString(), updActualBundle.getValueAsString());
}
}
@ -260,194 +387,10 @@ public class ClientTest {
}
@Test
public void testCreate() throws Exception {
public void testSearchByDateRange() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location" , "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.createPatient(patient);
assertEquals(HttpPost.class, capt.getValue().getClass());
HttpPost post = (HttpPost) capt.getValue();
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertEquals("100", response.getId().getValue());
assertEquals("200", response.getVersionId().getValue());
}
@Test
public void testDelete() throws Exception {
OperationOutcome oo = new OperationOutcome();
oo.addIssue().setDetails("Hello");
String resp = new FhirContext().newXmlParser().encodeResourceToString(oo);
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(resp), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.deletePatient(new IdDt("1234"));
assertEquals(HttpDelete.class, capt.getValue().getClass());
assertEquals("http://foo/Patient/1234", capt.getValue().getURI().toString());
assertEquals("Hello", response.getOperationOutcome().getIssueFirstRep().getDetails().getValue());
}
@Test
public void testDeleteNoResponse() throws Exception {
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 204, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.deleteDiagnosticReport(new IdDt("1234"));
assertEquals(HttpDelete.class, capt.getValue().getClass());
assertEquals("http://foo/DiagnosticReport/1234", capt.getValue().getURI().toString());
}
@Test
public void testUpdate() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location" , "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdDt("100"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertEquals("100", response.getId().getValue());
assertEquals("200", response.getVersionId().getValue());
}
/**
* Return a FHIR content type, but no content and make sure we handle this without crashing
*/
@Test
public void testUpdateWithEmptyResponse() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location" , "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.updatePatient(new IdDt("100"), new IdDt("200"), patient);
}
@Test
public void testUpdateWithVersion() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location" , "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdDt("100"), new IdDt("200"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertThat(post.getFirstHeader("Content-Location").getValue(), StringEndsWith.endsWith("/Patient/100/_history/200"));
assertEquals("100", response.getId().getValue());
assertEquals("200", response.getVersionId().getValue());
}
@Test(expected=ResourceVersionConflictException.class)
public void testUpdateWithResourceConflict() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_409_CONFLICT, "Conflict"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.updatePatient(new IdDt("100"), new IdDt("200"), patient);
}
@Test
public void testCreateBad() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 400, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader("foobar"), Charset.forName("UTF-8")));
try {
ctx.newRestfulClient(ITestClient.class, "http://foo").createPatient(patient);
fail();
}catch (InvalidRequestException e) {
assertThat(e.getMessage(), StringContains.containsString("foobar"));
}
}
private Header[] toHeaderArray(String theName, String theValue) {
return new Header[] {new BasicHeader(theName, theValue)};
}
@Test
public void testVRead() throws Exception {
//@formatter:off
String msg = "<Patient xmlns=\"http://hl7.org/fhir\">"
+ "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>"
+ "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>"
+ "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>"
+ "<name><family value=\"Kramer\" /><given value=\"Doe\" /></name>"
+ "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>"
+ "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>"
+ "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />"
+ "</Patient>";
//@formatter:on
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
@ -456,11 +399,31 @@ public class ClientTest {
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
// Patient response = client.findPatientByMrn(new IdentifierDt("urn:foo", "123"));
Patient response = client.getPatientByVersionId(new IdDt("111"), new IdDt("999"));
DateRangeParam param = new DateRangeParam();
param.setLowerBound(new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, "2011-01-01"));
param.setUpperBound(new QualifiedDateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, "2021-01-01"));
List<Patient> response = client.getPatientByDateRange(param);
assertEquals("http://foo/Patient/111/_history/999", capt.getValue().getURI().toString());
assertEquals("PRP1660", response.getIdentifier().get(0).getValue().getValue());
assertEquals("http://foo/Patient?dateRange=%3E%3D2011-01-01&dateRange=%3C%3D2021-01-01", capt.getValue().getURI().toString());
}
@Test
public void testSearchByDob() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
List<Patient> response = client.getPatientByDob(new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, "2011-01-02"));
assertEquals("http://foo/Patient?birthdate=%3E%3D2011-01-02", capt.getValue().getURI().toString());
assertEquals("PRP1660", response.get(0).getIdentifier().get(0).getValue().getValue());
}
@ -482,70 +445,7 @@ public class ClientTest {
assertEquals("PRP1660", response.getIdentifier().get(0).getValue().getValue());
}
@Test
public void testSearchByDateRange() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
DateRangeParam param = new DateRangeParam();
param.setLowerBound(new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, "2011-01-01"));
param.setUpperBound(new QualifiedDateParam(QuantityCompararatorEnum.LESSTHAN_OR_EQUALS, "2021-01-01"));
List<Patient> response = client.getPatientByDateRange(param);
assertEquals("http://foo/Patient?dateRange=%3E%3D2011-01-01&dateRange=%3C%3D2021-01-01", capt.getValue().getURI().toString());
}
@Test
public void testSearchByDob() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
List<Patient> response = client.getPatientByDob(new QualifiedDateParam(QuantityCompararatorEnum.GREATERTHAN_OR_EQUALS, "2011-01-02"));
assertEquals("http://foo/Patient?birthdate=%3E%3D2011-01-02", capt.getValue().getURI().toString());
assertEquals("PRP1660", response.get(0).getIdentifier().get(0).getValue().getValue());
}
@Test
public void testSearchWithIncludes() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.getPatientWithIncludes(new StringDt("aaa"), Arrays.asList(new PathSpecification[] {new PathSpecification("inc1"), new PathSpecification("inc2")}));
assertEquals("http://foo/Patient?withIncludes=aaa&_include=inc1&_include=inc2", capt.getValue().getURI().toString());
}
@Test
public void testSearchComposite() throws Exception {
@ -566,11 +466,11 @@ public class ClientTest {
assertEquals("http://foo/Patient?ids=foo%7Cbar%2Cbaz%7Cboz", capt.getValue().getURI().toString());
}
@Test
public void testGetConformance() throws Exception {
String msg = IOUtils.toString(ClientTest.class.getResourceAsStream("/example-metadata.xml"));
@Test
public void testSearchNamedQueryNoParams() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
@ -579,10 +479,45 @@ public class ClientTest {
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
Conformance response = client.getServerConformanceStatement();
client.getPatientNoParams();
assertEquals("http://foo/metadata", capt.getValue().getURI().toString());
assertEquals("Health Intersections", response.getPublisher().getValue());
assertEquals("http://foo/Patient?_query=someQueryNoParams", capt.getValue().getURI().toString());
}
@Test
public void testSearchNamedQueryOneParam() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.getPatientOneParam(new StringDt("BB"));
assertEquals("http://foo/Patient?_query=someQueryOneParam&param1=BB", capt.getValue().getURI().toString());
}
@Test
public void testSearchWithIncludes() throws Exception {
String msg = getPatientFeedWithOneResult();
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.getPatientWithIncludes(new StringDt("aaa"), Arrays.asList(new PathSpecification[] { new PathSpecification("inc1"), new PathSpecification("inc2") }));
assertEquals("http://foo/Patient?withIncludes=aaa&_include=inc1&_include=inc2", capt.getValue().getURI().toString());
}
@ -619,54 +554,95 @@ public class ClientTest {
}
@Test
public void testSearchNamedQueryOneParam() throws Exception {
public void testUpdate() throws Exception {
String msg = getPatientFeedWithOneResult();
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.getPatientOneParam(new StringDt("BB"));
assertEquals("http://foo/Patient?_query=someQueryOneParam&param1=BB", capt.getValue().getURI().toString());
MethodOutcome response = client.updatePatient(new IdDt("100"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertEquals("100", response.getId().getValue());
assertEquals("200", response.getVersionId().getValue());
}
/**
* Return a FHIR content type, but no content and make sure we handle this without crashing
*/
@Test
public void testSearchNamedQueryNoParams() throws Exception {
public void testUpdateWithEmptyResponse() throws Exception {
String msg = getPatientFeedWithOneResult();
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.getPatientNoParams();
assertEquals("http://foo/Patient?_query=someQueryNoParams", capt.getValue().getURI().toString());
client.updatePatient(new IdDt("100"), new IdDt("200"), patient);
}
private String getPatientFeedWithOneResult() {
@Test(expected = ResourceVersionConflictException.class)
public void testUpdateWithResourceConflict() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), Constants.STATUS_HTTP_409_CONFLICT, "Conflict"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
client.updatePatient(new IdDt("100"), new IdDt("200"), patient);
}
@Test
public void testUpdateWithVersion() throws Exception {
Patient patient = new Patient();
patient.addIdentifier("urn:foo", "123");
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 201, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_TEXT + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(""), Charset.forName("UTF-8")));
when(httpResponse.getAllHeaders()).thenReturn(toHeaderArray("Location", "http://example.com/fhir/Patient/100/_history/200"));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
MethodOutcome response = client.updatePatient(new IdDt("100"), new IdDt("200"), patient);
assertEquals(HttpPut.class, capt.getValue().getClass());
HttpPut post = (HttpPut) capt.getValue();
assertThat(post.getURI().toASCIIString(), StringEndsWith.endsWith("/Patient/100"));
assertThat(IOUtils.toString(post.getEntity().getContent()), StringContains.containsString("<Patient"));
assertThat(post.getFirstHeader("Content-Location").getValue(), StringEndsWith.endsWith("/Patient/100/_history/200"));
assertEquals("100", response.getId().getValue());
assertEquals("200", response.getVersionId().getValue());
}
@Test
public void testVRead() throws Exception {
//@formatter:off
String msg = "<feed xmlns=\"http://www.w3.org/2005/Atom\">\n" +
"<title/>\n" +
"<id>d039f91a-cc3c-4013-988e-af4d8d0614bd</id>\n" +
"<os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">1</os:totalResults>\n" +
"<published>2014-03-11T16:35:07-04:00</published>\n" +
"<author>\n" +
"<name>ca.uhn.fhir.rest.server.DummyRestfulServer</name>\n" +
"</author>\n" +
"<entry>\n" +
"<content type=\"text/xml\">"
+ "<Patient xmlns=\"http://hl7.org/fhir\">"
String msg = "<Patient xmlns=\"http://hl7.org/fhir\">"
+ "<text><status value=\"generated\" /><div xmlns=\"http://www.w3.org/1999/xhtml\">John Cardinal: 444333333 </div></text>"
+ "<identifier><label value=\"SSN\" /><system value=\"http://orionhealth.com/mrn\" /><value value=\"PRP1660\" /></identifier>"
+ "<name><use value=\"official\" /><family value=\"Cardinal\" /><given value=\"John\" /></name>"
@ -674,11 +650,25 @@ public class ClientTest {
+ "<telecom><system value=\"phone\" /><value value=\"555-555-2004\" /><use value=\"work\" /></telecom>"
+ "<gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\" /><code value=\"M\" /></coding></gender>"
+ "<address><use value=\"home\" /><line value=\"2222 Home Street\" /></address><active value=\"true\" />"
+ "</Patient>"
+ "</content>\n"
+ " </entry>\n"
+ "</feed>";
+ "</Patient>";
//@formatter:on
return msg;
ArgumentCaptor<HttpUriRequest> capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(httpClient.execute(capt.capture())).thenReturn(httpResponse);
when(httpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
when(httpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(httpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
// Patient response = client.findPatientByMrn(new IdentifierDt("urn:foo", "123"));
Patient response = client.getPatientByVersionId(new IdDt("111"), new IdDt("999"));
assertEquals("http://foo/Patient/111/_history/999", capt.getValue().getURI().toString());
assertEquals("PRP1660", response.getIdentifier().get(0).getValue().getValue());
}
private Header[] toHeaderArray(String theName, String theValue) {
return new Header[] { new BasicHeader(theName, theValue) };
}
}

View File

@ -30,6 +30,20 @@ public class ServerInvalidDefinitionTest {
}
}
@Test
public void testPrivateResourceProvider() {
RestfulServer srv = new RestfulServer();
srv.setResourceProviders(new PrivateResourceProvider());
try {
srv.init();
fail();
} catch (ServletException e) {
assertThat(e.getCause().toString(), StringContains.containsString("ConfigurationException"));
assertThat(e.getCause().toString(), StringContains.containsString("public"));
}
}
/**
* Normal, should initialize properly
*/
@ -40,8 +54,23 @@ public class ServerInvalidDefinitionTest {
srv.init();
}
private static class PrivateResourceProvider implements IResourceProvider
{
@Override
public Class<? extends IResource> getResourceType() {
return Patient.class;
}
@SuppressWarnings("unused")
@Read
public Patient read(@IdParam IdDt theId) {
return null;
}
}
private static class NonInstantiableTypeForResourceProvider implements IResourceProvider
public static class NonInstantiableTypeForResourceProvider implements IResourceProvider
{
@Override
@ -57,7 +86,7 @@ public class ServerInvalidDefinitionTest {
}
private static class InstantiableTypeForResourceProvider implements IResourceProvider
public static class InstantiableTypeForResourceProvider implements IResourceProvider
{
@Override

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.2</version>
<version>0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -19,7 +19,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.1</version>
<version>0.3</version>
</dependency>
</dependencies>
@ -28,7 +28,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.1</version>
<version>0.3</version>
<executions>
<execution>
<goals>

View File

@ -0,0 +1,150 @@
<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>
<<<<<<< HEAD
<version>0.2</version>
=======
<version>0.3</version>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR Structures - DSTU (FHIR 0.80)</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.3</version>
<executions>
<execution>
<goals>
<goal>generate-structures</goal>
</goals>
</execution>
</executions>
<configuration>
<package>ca.uhn.fhir.model.dstu</package>
<baseResourceNames>
<!-- <baseResourceName>account</baseResourceName> -->
<!-- <baseResourceName>activitydefinition-extensions</baseResourceName> -->
<baseResourceName>adversereaction</baseResourceName>
<baseResourceName>alert</baseResourceName>
<baseResourceName>allergyintolerance</baseResourceName>
<baseResourceName>appointmentresponse</baseResourceName>
<baseResourceName>appointment</baseResourceName>
<baseResourceName>availability</baseResourceName>
<baseResourceName>careplan</baseResourceName>
<baseResourceName>claim</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-genetics-profile</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>namespace</baseResourceName> -->
<baseResourceName>observation</baseResourceName>
<baseResourceName>operationoutcome</baseResourceName>
<baseResourceName>orderresponse</baseResourceName>
<baseResourceName>order</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>other</baseResourceName>
<baseResourceName>patient</baseResourceName>
<!--<baseResourceName>person</baseResourceName>-->
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>procedure</baseResourceName>
<baseResourceName>profile</baseResourceName>
<!-- <baseResourceName>protocol</baseResourceName> -->
<!-- <baseResourceName>provenance-extensions</baseResourceName> -->
<baseResourceName>provenance</baseResourceName>
<baseResourceName>query</baseResourceName>
<!-- <baseResourceName>questionnaire-extensions</baseResourceName> -->
<baseResourceName>questionnaire</baseResourceName>
<baseResourceName>relatedperson</baseResourceName>
<baseResourceName>remittance</baseResourceName>
<!-- <baseResourceName>resource</baseResourceName> -->
<baseResourceName>securityevent</baseResourceName>
<!--<baseResourceName>sequence</baseResourceName>-->
<baseResourceName>sequencinganalysis</baseResourceName>
<baseResourceName>sequencinglab</baseResourceName>
<baseResourceName>slot</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>supply</baseResourceName>
<!--<baseResourceName>template</baseResourceName>-->
<baseResourceName>test</baseResourceName>
<baseResourceName>user</baseResourceName>
<!-- <baseResourceName>valueset-extensions</baseResourceName> -->
<baseResourceName>valueset</baseResourceName>
<!--<baseResourceName>vcfmeta</baseResourceName>-->
<!--<baseResourceName>vcfvariant</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>
</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

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.2</version>
<version>0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -20,7 +20,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.2</version>
<version>0.3</version>
</dependency>
<dependency>
@ -67,12 +67,6 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
<scope>test</scope>
</dependency>
<!-- Maven -->
<dependency>

View File

@ -0,0 +1,147 @@
<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>
<<<<<<< HEAD
<version>0.2</version>
=======
<version>0.3</version>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<packaging>maven-plugin</packaging>
<!-- <packaging>jar</packaging> -->
<name>HAPI Tinder Plugin</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<<<<<<< HEAD
<version>0.2</version>
=======
<version>0.3</version>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity</artifactId>
<version>1.7</version>
</dependency>
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>2.0</version>
</dependency>
<!-- General -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.6</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.1</version>
<optional>true</optional>
</dependency>
<!-- Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- Maven -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-project</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<maven_version>3.1.1</maven_version>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<reportSets>
<reportSet>
<reports>
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version> <configuration> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration> <executions> <execution> <id>mojo-descriptor</id> <goals>
<goal>descriptor</goal> </goals> </execution> </executions> </plugin> -->
</plugins>
</build>
</project>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>0.2</version>
<version>0.3</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,111 @@
<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>
<<<<<<< HEAD
<version>0.2</version>
=======
<version>0.3</version>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-test</artifactId>
<packaging>jar</packaging>
<name>HAPI Tinder Plugin - Test Project</name>
<dependencies>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- <plugin> <groupId>ca.uhn.hapi.fhir</groupId> <artifactId>hapi-tinder-plugin</artifactId> <version>1.0-SNAPSHOT</version> <executions> <execution> <id>structs</id> <goals> <goal>generate-structures</goal>
</goals> <configuration> <package>ca.uhn.tindertest</package> <baseResourceNames> <baseResourceName>patient</baseResourceName> <baseResourceName>valueset</baseResourceName> <baseResourceName>organization</baseResourceName>
<baseResourceName>device</baseResourceName> <baseResourceName>location</baseResourceName> <baseResourceName>practitioner</baseResourceName> </baseResourceNames> </configuration> </execution>
<execution> <id>client</id> <goals> <goal>generate-client</goal> </goals> <configuration> <clientClassName>ca.uhn.hitest.HiTest</clientClassName> <serverBaseHref>http://fhir.healthintersections.com.au/open</serverBaseHref>
<generateSearchForAllParams>true</generateSearchForAllParams> </configuration> </execution> </executions> </plugin> -->
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>0.1</version>
<executions>
<execution>
<id>custom-structs</id>
<goals>
<goal>generate-structures</goal>
</goals>
<configuration>
<package>ca.uhn.test.customstructs</package>
<profileHttpBase>http://foo</profileHttpBase>
<resourceProfileFiles>
<resourceProfileFile>
<profileFile>${project.basedir}/src/test/resources/profile/patient.xml</profileFile>
<profileSourceUrl>http://foo1</profileSourceUrl>
</resourceProfileFile>
<resourceProfileFile>
<profileFile>${project.basedir}/src/test/resources/profile/organization.xml</profileFile>
<profileSourceUrl>http://foo1</profileSourceUrl>
</resourceProfileFile>
</resourceProfileFiles>
<resourceValueSetFiles>
<resourceValueSetFile>
<valueSetFile>${project.basedir}/src/test/resources/valueset/valueset-cgta-patientidpool.xml</valueSetFile>
</resourceValueSetFile>
<resourceValueSetFile>
<valueSetFile>${project.basedir}/src/test/resources/valueset/valueset-cgta-provideridpool.xml</valueSetFile>
</resourceValueSetFile>
</resourceValueSetFiles>
</configuration>
</execution>
<execution>
<id>generalstructs</id>
<goals>
<goal>generate-structures</goal>
</goals>
<configuration>
<package>ca.uhn.test.realstructs</package>
<baseResourceNames>
<baseResourceName>patient</baseResourceName>
<baseResourceName>valueset</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
</baseResourceNames>
<buildDatatypes>true</buildDatatypes>
</configuration>
</execution>
<!-- <execution> <id>client</id> <goals> <goal>generate-client</goal> </goals> <configuration> <clientClassName>ca.uhn.hitest.HiTest</clientClassName> <serverBaseHref>http://fhir.healthintersections.com.au/open</serverBaseHref>
<generateSearchForAllParams>true</generateSearchForAllParams> </configuration> </execution> -->
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

18
pom.xml
View File

@ -11,7 +11,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>0.2</version>
<version>0.3</version>
<name>HAPI</name>
<url>http://hl7api.sourceforge.net/</url>
<description>
@ -20,6 +20,22 @@
<dependencies>
</dependencies>
<developers>
<developer>
<name>James Agnew</name>
</developer>
<developer>
<name>Dmitri Sotnikov</name>
</developer>
<developer>
<name>Lisa Wong</name>
</developer>
<developer>
<name>Josh Mandel</name>
<url></url>
</developer>
</developers>
<licenses>
<license>
<name>Apache Software License 2.0</name>

160
pom.xml.orig Normal file
View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd">
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<<<<<<< HEAD
<version>0.2</version>
=======
<version>0.3</version>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
<name>HAPI</name>
<url>http://hl7api.sourceforge.net/</url>
<description>
</description>
<dependencies>
</dependencies>
<developers>
<developer>
<name>James Agnew</name>
</developer>
<developer>
<name>Dmitri Sotnikov</name>
</developer>
<developer>
<name>Lisa Wong</name>
</developer>
<developer>
<name>Josh Mandel</name>
<url></url>
</developer>
</developers>
<licenses>
<license>
<name>Apache Software License 2.0</name>
<url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<modules>
<module>hapi-fhir-base</module>
<module>hapi-tinder-plugin</module>
<module>hapi-tinder-test</module>
<module>hapi-fhir-structures-dstu</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven_javadoc_plugin_version>2.9.1</maven_javadoc_plugin_version>
<maven_site_plugin_version>3.3</maven_site_plugin_version>
<slf4j_version>1.6.6</slf4j_version>
<hamcrest_version>1.3</hamcrest_version>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven_site_plugin_version}</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ssh</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
</plugin>
</plugins>
</pluginManagement>
<<<<<<< HEAD
=======
<plugins>
<!--
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
-->
</plugins>
>>>>>>> 9ab7f8facc2fb9bf65a245933989bca1e976d28d
</build>
<profiles>
<profile>
<id>SIGN_ARTIFACTS</id>
<activation>
<property>
<name>gpg.passphrase</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>