Merge branch 'master' of https://github.com/jamesagnew/hapi-fhir
This commit is contained in:
commit
6049df0bfa
|
@ -7,6 +7,12 @@
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="0.7" date="TBD">
|
<release version="0.7" date="TBD">
|
||||||
|
<action type="add" issue="30">
|
||||||
|
<![CDATA[<b>API CHANGE:</b>]]> The TagList class previously implemented ArrayList semantics,
|
||||||
|
but this has been replaced with LinkedHashMap semantics. This means that the list of
|
||||||
|
tags will no longer accept duplicate tags, but that tag order will still be
|
||||||
|
preserved. Thanks to Bill de Beaubien for reporting!
|
||||||
|
</action>
|
||||||
<action type="add" dev="suranga">
|
<action type="add" dev="suranga">
|
||||||
Documentation fixes
|
Documentation fixes
|
||||||
</action>
|
</action>
|
||||||
|
@ -55,6 +61,10 @@
|
||||||
entities converted to their equivalent unicode characters when resources are encoded, since FHIR does
|
entities converted to their equivalent unicode characters when resources are encoded, since FHIR does
|
||||||
not allow extended entities in resource instances.
|
not allow extended entities in resource instances.
|
||||||
</action>
|
</action>
|
||||||
|
<action type="add">
|
||||||
|
Add a new client interceptor which adds HTTP Authorization Bearer Tokens (for use with OAUTH2 servers)
|
||||||
|
to client requests.
|
||||||
|
</action>
|
||||||
<action type="fix">
|
<action type="fix">
|
||||||
Add phloc-commons dependency explicitly, which resolves an issue building HAPI from source on
|
Add phloc-commons dependency explicitly, which resolves an issue building HAPI from source on
|
||||||
some platforms. Thanks to Odysseas Pentakalos for the patch!
|
some platforms. Thanks to Odysseas Pentakalos for the patch!
|
||||||
|
@ -63,6 +73,29 @@
|
||||||
HAPI now logs a single line indicating the StAX implementation being used upon the
|
HAPI now logs a single line indicating the StAX implementation being used upon the
|
||||||
first time an XML parser is created.
|
first time an XML parser is created.
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
Update methods on the server did not return a "content-location" header, but
|
||||||
|
only a "location" header. Both are required according to the FHIR specification.
|
||||||
|
Thanks to Bill de Beaubien of Systems Made Simple for reporting this!
|
||||||
|
</action>
|
||||||
|
<action type="fix" issue="26" dev="akley">
|
||||||
|
Parser failed to correctly read contained Binary resources. Thanks to Alexander Kley for
|
||||||
|
the patch!
|
||||||
|
</action>
|
||||||
|
<action type="fix" issue="29" dev="akley">
|
||||||
|
Calling encode multiple times on a resource with contained resources caused the contained
|
||||||
|
resources to be re-added (and the actual message to grow) with each encode pass. Thanks to
|
||||||
|
Alexander Kley for the test case!
|
||||||
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
JSON-encoded contained resources with the incorrect "_id" element (which should be "id", but some
|
||||||
|
incorrect examples exist on the FHIR specification) now parse correctly.
|
||||||
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
Several unit tests failed on Windows (or any platform with non UTF-8 default encoding). This may
|
||||||
|
have also caused resource validation to fail occasionally on these platforms as well.
|
||||||
|
Thanks to Bill de Beaubien for reporting!
|
||||||
|
</action>
|
||||||
</release>
|
</release>
|
||||||
<release version="0.6" date="2014-Sep-08" description="This release brings a number of new features and bug fixes!">
|
<release version="0.6" date="2014-Sep-08" description="This release brings a number of new features and bug fixes!">
|
||||||
<!--
|
<!--
|
||||||
|
@ -206,7 +239,9 @@
|
||||||
</release>
|
</release>
|
||||||
<release version="0.5" date="2014-Jul-30">
|
<release version="0.5" date="2014-Jul-30">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
having multiple ways of accomplishing the same thing. This means that a number of existing classes
|
HAPI has a number of RESTful method parameter types that have similar but not identical
|
||||||
|
purposes and confusing names. A cleanup has been undertaken to clean this up.
|
||||||
|
This means that a number of existing classes
|
||||||
have been deprocated in favour of new naming schemes.
|
have been deprocated in favour of new naming schemes.
|
||||||
<![CDATA[<br/><br/>]]>
|
<![CDATA[<br/><br/>]]>
|
||||||
All annotation-based clients and all server search method parameters are now named
|
All annotation-based clients and all server search method parameters are now named
|
||||||
|
|
|
@ -7,11 +7,23 @@
|
||||||
</properties>
|
</properties>
|
||||||
<body>
|
<body>
|
||||||
<release version="0.7" date="TBD">
|
<release version="0.7" date="TBD">
|
||||||
<action type="add">
|
<action type="add" dev="suranga">
|
||||||
Documentation update, thanks to Suranga Nath Kasthurirathne of the OpenMRS project.
|
Documentation fixes
|
||||||
|
</action>
|
||||||
|
<action type="add" dev="dougmartin">
|
||||||
|
Add a collection of new methods on the generic client which support the
|
||||||
|
<![CDATA[
|
||||||
|
<b><a href="./apidocs/ca/uhn/fhir/rest/client/IGenericClient.html#read(java.lang.Class,%20ca.uhn.fhir.model.primitive.UriDt)">read</a></b>,
|
||||||
|
<b><a href="./apidocs/ca/uhn/fhir/rest/client/IGenericClient.html#vread(java.lang.Class,%20ca.uhn.fhir.model.primitive.UriDt)">read</a></b>,
|
||||||
|
and <b><a href="./apidocs/ca/uhn/fhir/rest/client/IGenericClient.html#search(java.lang.Class,%20ca.uhn.fhir.model.primitive.UriDt)">search</a></b>
|
||||||
|
]]>
|
||||||
|
operations using an absolute URL. This allows developers to perform these operations using
|
||||||
|
URLs they obtained from other sources (or external resource references within resources). In
|
||||||
|
addition, the existing read/vread operations will now access absolute URL references if
|
||||||
|
they are passed in. Thanks to Doug Martin of the Regenstrief Center for Biomedical Informatics
|
||||||
|
for contributing this implementation!
|
||||||
</action>
|
</action>
|
||||||
<action type="fix">
|
<action type="fix">
|
||||||
<<<<<<< HEAD
|
|
||||||
Server implementation was not correctly figuring out its own FHIR Base URL when deployed
|
Server implementation was not correctly figuring out its own FHIR Base URL when deployed
|
||||||
on Amazon Web Service server. Thanks to Jeffrey Ting and Bill De Beaubien of
|
on Amazon Web Service server. Thanks to Jeffrey Ting and Bill De Beaubien of
|
||||||
Systems Made Simple for their help in figuring out this issue!
|
Systems Made Simple for their help in figuring out this issue!
|
||||||
|
@ -20,15 +32,44 @@
|
||||||
XML Parser failed to encode fields with both a resource reference child and
|
XML Parser failed to encode fields with both a resource reference child and
|
||||||
a primitive type child. Thanks to Jeffrey Ting and Bill De Beaubien of
|
a primitive type child. Thanks to Jeffrey Ting and Bill De Beaubien of
|
||||||
Systems Made Simple for their help in figuring out this issue!
|
Systems Made Simple for their help in figuring out this issue!
|
||||||
=======
|
</action>
|
||||||
|
<action type="fix">
|
||||||
HAPI now runs successfully on Servlet 2.5 containers (such as Tomcat 6). Thanks to
|
HAPI now runs successfully on Servlet 2.5 containers (such as Tomcat 6). Thanks to
|
||||||
Bernard Gitaadji for reporting and diagnosing the issue!
|
Bernard Gitaadji for reporting and diagnosing the issue!
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
Summary (in the bundle entry) is now encoded by the XML and JSON parsers if supplied. Thanks to David Hay of
|
||||||
|
Orion Health for reporting this!
|
||||||
|
</action>
|
||||||
|
<action type="fix" issue="24">
|
||||||
|
Conformance profiles which are automatically generated by the server were missing a few mandatory elements,
|
||||||
|
which meant that the profile did not correctly validate. Thanks to Bill de Beaubien of Systems Made Simple
|
||||||
|
for reporting this!
|
||||||
|
</action>
|
||||||
<action type="fix">
|
<action type="fix">
|
||||||
XHTML (in narratives) containing escapable characters (e.g. < or ") will now always have those characters
|
XHTML (in narratives) containing escapable characters (e.g. < or ") will now always have those characters
|
||||||
escaped properly in encoded messages.
|
escaped properly in encoded messages.
|
||||||
>>>>>>> 83f9c1c6a992266de12f9076b733dffdaaf63203
|
|
||||||
</action>
|
</action>
|
||||||
|
<action type="fix">
|
||||||
|
Resources containing entities which are not valid in basic XML (e.g. &sect;) will have those
|
||||||
|
entities converted to their equivalent unicode characters when resources are encoded, since FHIR does
|
||||||
|
not allow extended entities in resource instances.
|
||||||
|
</action>
|
||||||
|
<<<<<<< HEAD
|
||||||
|
<action type="add">
|
||||||
|
Add a new client interceptor which adds HTTP Authorization Bearer Tokens (for use with OAUTH2 servers)
|
||||||
|
to client requests.
|
||||||
|
</action>
|
||||||
|
=======
|
||||||
|
<action type="fix">
|
||||||
|
Add phloc-commons dependency explicitly, which resolves an issue building HAPI from source on
|
||||||
|
some platforms. Thanks to Odysseas Pentakalos for the patch!
|
||||||
|
</action>
|
||||||
|
<action type="add">
|
||||||
|
HAPI now logs a single line indicating the StAX implementation being used upon the
|
||||||
|
first time an XML parser is created.
|
||||||
|
</action>
|
||||||
|
>>>>>>> 4622af7a822ad80c864516369e1e941660a19194
|
||||||
</release>
|
</release>
|
||||||
<release version="0.6" date="2014-Sep-08" description="This release brings a number of new features and bug fixes!">
|
<release version="0.6" date="2014-Sep-08" description="This release brings a number of new features and bug fixes!">
|
||||||
<!--
|
<!--
|
||||||
|
@ -172,7 +213,9 @@
|
||||||
</release>
|
</release>
|
||||||
<release version="0.5" date="2014-Jul-30">
|
<release version="0.5" date="2014-Jul-30">
|
||||||
<action type="add">
|
<action type="add">
|
||||||
having multiple ways of accomplishing the same thing. This means that a number of existing classes
|
HAPI has a number of RESTful method parameter types that have similar but not identical
|
||||||
|
purposes and confusing names. A cleanup has been undertaken to clean this up.
|
||||||
|
This means that a number of existing classes
|
||||||
have been deprocated in favour of new naming schemes.
|
have been deprocated in favour of new naming schemes.
|
||||||
<![CDATA[<br/><br/>]]>
|
<![CDATA[<br/><br/>]]>
|
||||||
All annotation-based clients and all server search method parameters are now named
|
All annotation-based clients and all server search method parameters are now named
|
||||||
|
|
|
@ -25,6 +25,7 @@ import static org.apache.commons.lang3.StringUtils.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Modifier;
|
||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -380,9 +381,14 @@ class ModelScanner {
|
||||||
|
|
||||||
for (Field next : theClass.getDeclaredFields()) {
|
for (Field next : theClass.getDeclaredFields()) {
|
||||||
|
|
||||||
|
if (Modifier.isFinal(next.getModifiers())) {
|
||||||
|
ourLog.trace("Ignoring constant {} on target type {}", next.getName(), theClass);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
Child childAnnotation = next.getAnnotation(Child.class);
|
Child childAnnotation = next.getAnnotation(Child.class);
|
||||||
if (childAnnotation == null) {
|
if (childAnnotation == null) {
|
||||||
ourLog.debug("Ignoring non-type field '" + next.getName() + "' on target type: " + theClass);
|
ourLog.trace("Ignoring non @Child field {} on target type {}",next.getName() , theClass);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,12 +59,20 @@ public class Bundle extends BaseBundle /* implements IElement */{
|
||||||
private IntegerDt myTotalResults;
|
private IntegerDt myTotalResults;
|
||||||
private InstantDt myUpdated;
|
private InstantDt myUpdated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags wil become immutable in a future release of HAPI, so {@link #addCategory(String, String, String)} should be used instead
|
||||||
|
*/
|
||||||
public Tag addCategory() {
|
public Tag addCategory() {
|
||||||
Tag retVal = new Tag();
|
Tag retVal = new Tag();
|
||||||
getCategories().add(retVal);
|
getCategories().add(retVal);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addCategory(String theScheme, String theTerm, String theLabel) {
|
||||||
|
getCategories().add(new Tag(theScheme, theTerm, theLabel));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addCategory(Tag theTag) {
|
public void addCategory(Tag theTag) {
|
||||||
getCategories().add(theTag);
|
getCategories().add(theTag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,12 +50,19 @@ public class BundleEntry extends BaseBundle {
|
||||||
private StringDt myTitle;
|
private StringDt myTitle;
|
||||||
private InstantDt myUpdated;
|
private InstantDt myUpdated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags wil become immutable in a future release of HAPI, so {@link #addCategory(String, String, String)} should be used instead
|
||||||
|
*/
|
||||||
public Tag addCategory() {
|
public Tag addCategory() {
|
||||||
Tag retVal = new Tag();
|
Tag retVal = new Tag();
|
||||||
getCategories().add(retVal);
|
getCategories().add(retVal);
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void addCategory(String theScheme, String theTerm, String theLabel) {
|
||||||
|
getCategories().add(new Tag(theScheme, theTerm, theLabel));
|
||||||
|
}
|
||||||
|
|
||||||
public void addCategory(Tag theTag) {
|
public void addCategory(Tag theTag) {
|
||||||
getCategories().add(theTag);
|
getCategories().add(theTag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,38 +28,52 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A single tag
|
||||||
|
* <p>
|
||||||
|
* Note on equality- When computing hashCode or equals values for this class, only the
|
||||||
|
* {@link #getScheme() scheme} and
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
public class Tag extends BaseElement implements IElement {
|
public class Tag extends BaseElement implements IElement {
|
||||||
/**
|
|
||||||
* Convenience constant containing the "http://hl7.org/fhir/tag" scheme
|
|
||||||
* value
|
|
||||||
*/
|
|
||||||
public static final String HL7_ORG_FHIR_TAG = "http://hl7.org/fhir/tag";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience constant containing the "http://hl7.org/fhir/tag/security" scheme
|
|
||||||
* value
|
|
||||||
*/
|
|
||||||
public static final String HL7_ORG_SECURITY_TAG = "http://hl7.org/fhir/tag/security";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convenience constant containing the "http://hl7.org/fhir/tag/profile" scheme
|
|
||||||
* value
|
|
||||||
*/
|
|
||||||
public static final String HL7_ORG_PROFILE_TAG = "http://hl7.org/fhir/tag/profile";
|
|
||||||
|
|
||||||
public static final String ATTR_TERM = "term";
|
|
||||||
public static final String ATTR_LABEL = "label";
|
public static final String ATTR_LABEL = "label";
|
||||||
public static final String ATTR_SCHEME = "scheme";
|
public static final String ATTR_SCHEME = "scheme";
|
||||||
|
public static final String ATTR_TERM = "term";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convenience constant containing the "http://hl7.org/fhir/tag" scheme value
|
||||||
|
*/
|
||||||
|
public static final String HL7_ORG_FHIR_TAG = "http://hl7.org/fhir/tag";
|
||||||
|
/**
|
||||||
|
* Convenience constant containing the "http://hl7.org/fhir/tag/profile" scheme value
|
||||||
|
*/
|
||||||
|
public static final String HL7_ORG_PROFILE_TAG = "http://hl7.org/fhir/tag/profile";
|
||||||
|
/**
|
||||||
|
* Convenience constant containing the "http://hl7.org/fhir/tag/security" scheme value
|
||||||
|
*/
|
||||||
|
public static final String HL7_ORG_SECURITY_TAG = "http://hl7.org/fhir/tag/security";
|
||||||
|
|
||||||
private String myLabel;
|
private String myLabel;
|
||||||
private String myScheme;
|
private String myScheme;
|
||||||
private String myTerm;
|
private String myTerm;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags will become immutable in a future release, so this constructor should not be used.
|
||||||
|
*/
|
||||||
public Tag() {
|
public Tag() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated There is no reason to create a tag with a term and not a scheme, so this constructor will be removed
|
||||||
|
*/
|
||||||
public Tag(String theTerm) {
|
public Tag(String theTerm) {
|
||||||
this((String)null, theTerm, null);
|
this((String) null, theTerm, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tag(String theScheme, String theTerm) {
|
||||||
|
myScheme = theScheme;
|
||||||
|
myTerm = theTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tag(String theScheme, String theTerm, String theLabel) {
|
public Tag(String theScheme, String theTerm, String theLabel) {
|
||||||
|
@ -78,32 +92,6 @@ public class Tag extends BaseElement implements IElement {
|
||||||
myLabel = theLabel;
|
myLabel = theLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj)
|
|
||||||
return true;
|
|
||||||
if (obj == null)
|
|
||||||
return false;
|
|
||||||
if (getClass() != obj.getClass())
|
|
||||||
return false;
|
|
||||||
Tag other = (Tag) obj;
|
|
||||||
if (myLabel == null) {
|
|
||||||
if (other.myLabel != null)
|
|
||||||
return false;
|
|
||||||
} else if (!myLabel.equals(other.myLabel))
|
|
||||||
return false;
|
|
||||||
if (myScheme == null) {
|
|
||||||
if (other.myScheme != null)
|
|
||||||
return false;
|
|
||||||
} else if (!myScheme.equals(other.myScheme))
|
|
||||||
return false;
|
|
||||||
if (myTerm == null) {
|
|
||||||
if (other.myTerm != null)
|
|
||||||
return false;
|
|
||||||
} else if (!myTerm.equals(other.myTerm))
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return myLabel;
|
return myLabel;
|
||||||
|
@ -117,11 +105,32 @@ public class Tag extends BaseElement implements IElement {
|
||||||
return myTerm;
|
return myTerm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
Tag other = (Tag) obj;
|
||||||
|
if (myScheme == null) {
|
||||||
|
if (other.myScheme != null)
|
||||||
|
return false;
|
||||||
|
} else if (!myScheme.equals(other.myScheme))
|
||||||
|
return false;
|
||||||
|
if (myTerm == null) {
|
||||||
|
if (other.myTerm != null)
|
||||||
|
return false;
|
||||||
|
} else if (!myTerm.equals(other.myTerm))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = 1;
|
||||||
result = prime * result + ((myLabel == null) ? 0 : myLabel.hashCode());
|
|
||||||
result = prime * result + ((myScheme == null) ? 0 : myScheme.hashCode());
|
result = prime * result + ((myScheme == null) ? 0 : myScheme.hashCode());
|
||||||
result = prime * result + ((myTerm == null) ? 0 : myTerm.hashCode());
|
result = prime * result + ((myTerm == null) ? 0 : myTerm.hashCode());
|
||||||
return result;
|
return result;
|
||||||
|
@ -132,16 +141,31 @@ public class Tag extends BaseElement implements IElement {
|
||||||
return StringUtils.isBlank(myLabel) && StringUtils.isBlank(myScheme) && StringUtils.isBlank(myTerm);
|
return StringUtils.isBlank(myLabel) && StringUtils.isBlank(myScheme) && StringUtils.isBlank(myTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags will become immutable in a future release of HAPI in order to facilitate
|
||||||
|
* ensuring that the TagList acts as an unordered set. Use the constructor to set this field when creating a new
|
||||||
|
* tag object
|
||||||
|
*/
|
||||||
public Tag setLabel(String theLabel) {
|
public Tag setLabel(String theLabel) {
|
||||||
myLabel = theLabel;
|
myLabel = theLabel;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags will become immutable in a future release of HAPI in order to facilitate
|
||||||
|
* ensuring that the TagList acts as an unordered set. Use the constructor to set this field when creating a new
|
||||||
|
* tag object
|
||||||
|
*/
|
||||||
public Tag setScheme(String theScheme) {
|
public Tag setScheme(String theScheme) {
|
||||||
myScheme = theScheme;
|
myScheme = theScheme;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags will become immutable in a future release of HAPI in order to facilitate
|
||||||
|
* ensuring that the TagList acts as an unordered set. Use the constructor to set this field when creating a new
|
||||||
|
* tag object
|
||||||
|
*/
|
||||||
public Tag setTerm(String theTerm) {
|
public Tag setTerm(String theTerm) {
|
||||||
myTerm = theTerm;
|
myTerm = theTerm;
|
||||||
return this;
|
return this;
|
||||||
|
|
|
@ -20,24 +20,146 @@ package ca.uhn.fhir.model.api;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class TagList extends ArrayList<Tag> {
|
/**
|
||||||
|
* A collection of tags present on a single resource. TagList is backed by a {@link LinkedHashSet}, so the order of added tags will be consistent, but duplicates will not be preserved.
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* <b>Thread safety:</b> This class is not thread safe
|
||||||
|
* </p>
|
||||||
|
*/
|
||||||
|
public class TagList implements Set<Tag>, Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
public static final String ATTR_CATEGORY = "category";
|
public static final String ATTR_CATEGORY = "category";
|
||||||
public static final String ELEMENT_NAME = "TagList";
|
public static final String ELEMENT_NAME = "TagList";
|
||||||
public static final String ELEMENT_NAME_LC = ELEMENT_NAME.toLowerCase();
|
|
||||||
|
|
||||||
public Tag addTag(String theScheme, String theTerm, String theLabel) {
|
public static final String ELEMENT_NAME_LC = ELEMENT_NAME.toLowerCase();
|
||||||
Tag retVal = new Tag(theScheme, theTerm, theLabel);
|
private static final long serialVersionUID = 1L;
|
||||||
|
private transient List<Tag> myOrderedTags;
|
||||||
|
private LinkedHashSet<Tag> myTagSet = new LinkedHashSet<Tag>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public TagList() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
b.append("TagList[").append(size()).append(" tag(s)]");
|
||||||
|
for (Tag next : this) {
|
||||||
|
b.append("\n * ").append(next.toString());
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean add(Tag theE) {
|
||||||
|
myOrderedTags = null;
|
||||||
|
return myTagSet.add(theE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addAll(Collection<? extends Tag> theC) {
|
||||||
|
myOrderedTags = null;
|
||||||
|
return myTagSet.addAll(theC);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated Tags wil become immutable in a future release of HAPI, so {@link #addTag(String, String, String)} should be used instead
|
||||||
|
*/
|
||||||
|
public Tag addTag() {
|
||||||
|
myOrderedTags = null;
|
||||||
|
return addTag(null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a new tag instance
|
||||||
|
*
|
||||||
|
* @param theScheme
|
||||||
|
* The tag scheme
|
||||||
|
* @param theTerm
|
||||||
|
* The tag term
|
||||||
|
* @return Returns the newly created tag instance. Note that the tag is added to the list by this method, so you generally do not need to interact directly with the added tag.
|
||||||
|
*/
|
||||||
|
public Tag addTag(String theScheme, String theTerm) {
|
||||||
|
Tag retVal = new Tag(theScheme, theTerm);
|
||||||
add(retVal);
|
add(retVal);
|
||||||
|
myOrderedTags = null;
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tag addTag() {
|
/**
|
||||||
return addTag(null, null, null);
|
* Add a new tag instance
|
||||||
|
*
|
||||||
|
* @param theScheme
|
||||||
|
* The tag scheme
|
||||||
|
* @param theTerm
|
||||||
|
* The tag term
|
||||||
|
* @param theLabel
|
||||||
|
* The tag label
|
||||||
|
* @return Returns the newly created tag instance. Note that the tag is added to the list by this method, so you generally do not need to interact directly with the added tag.
|
||||||
|
*/
|
||||||
|
public Tag addTag(String theScheme, String theTerm, String theLabel) {
|
||||||
|
Tag retVal = new Tag(theScheme, theTerm, theLabel);
|
||||||
|
add(retVal);
|
||||||
|
myOrderedTags = null;
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
myOrderedTags = null;
|
||||||
|
myTagSet.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object theO) {
|
||||||
|
return myTagSet.contains(theO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean containsAll(Collection<?> theC) {
|
||||||
|
return myTagSet.containsAll(theC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
TagList other = (TagList) obj;
|
||||||
|
if (myTagSet == null) {
|
||||||
|
if (other.myTagSet != null)
|
||||||
|
return false;
|
||||||
|
} else if (!myTagSet.equals(other.myTagSet))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the tag at a given index - Note that the TagList is backed by a {@link LinkedHashSet}, so the order of added tags will be consistent, but duplicates will not be preserved.
|
||||||
|
*/
|
||||||
|
public Tag get(int theIndex) {
|
||||||
|
if (myOrderedTags == null) {
|
||||||
|
myOrderedTags = new ArrayList<Tag>();
|
||||||
|
for (Tag next : myTagSet) {
|
||||||
|
myOrderedTags.add(next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return myOrderedTags.get(theIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Tag getTag(String theScheme, String theTerm) {
|
public Tag getTag(String theScheme, String theTerm) {
|
||||||
|
@ -59,4 +181,52 @@ public class TagList extends ArrayList<Tag> {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return myTagSet.hashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return myTagSet.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Iterator<Tag> iterator() {
|
||||||
|
return myTagSet.iterator();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean remove(Object theO) {
|
||||||
|
myOrderedTags = null;
|
||||||
|
return myTagSet.remove(theO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean removeAll(Collection<?> theC) {
|
||||||
|
myOrderedTags = null;
|
||||||
|
return myTagSet.removeAll(theC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean retainAll(Collection<?> theC) {
|
||||||
|
myOrderedTags = null;
|
||||||
|
return myTagSet.retainAll(theC);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size() {
|
||||||
|
return myTagSet.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object[] toArray() {
|
||||||
|
return myTagSet.toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <T> T[] toArray(T[] theA) {
|
||||||
|
return myTagSet.toArray(theA);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
import ca.uhn.fhir.context.BaseRuntimeChildDefinition;
|
||||||
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
|
import ca.uhn.fhir.context.BaseRuntimeDeclaredChildDefinition;
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.ConfigurationException;
|
||||||
|
@ -131,15 +133,23 @@ public abstract class BaseParser implements IParser {
|
||||||
|
|
||||||
Set<String> allIds = new HashSet<String>();
|
Set<String> allIds = new HashSet<String>();
|
||||||
|
|
||||||
|
for (IResource next : theTarget.getContained().getContainedResources()) {
|
||||||
|
String nextId = next.getId().getValue();
|
||||||
|
if (StringUtils.isNotBlank(nextId)) {
|
||||||
|
allIds.add(nextId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (ResourceReferenceDt next : allElements) {
|
for (ResourceReferenceDt next : allElements) {
|
||||||
IResource resource = next.getResource();
|
IResource resource = next.getResource();
|
||||||
if (resource != null) {
|
if (resource != null) {
|
||||||
if (resource.getId().isEmpty()) {
|
if (resource.getId().isEmpty()) { // TODO: make this configurable between the two below (and something else?)
|
||||||
resource.setId(new IdDt(myNextContainedId++));
|
resource.setId(new IdDt(myNextContainedId++));
|
||||||
// resource.setId(new IdDt(UUID.randomUUID().toString()));
|
// resource.setId(new IdDt(UUID.randomUUID().toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allIds.contains(resource.getId().getValue())) {
|
String nextResourceId = resource.getId().getValue();
|
||||||
|
if (!allIds.contains(nextResourceId)) {
|
||||||
theTarget.getContained().getContainedResources().add(resource);
|
theTarget.getContained().getContainedResources().add(resource);
|
||||||
allIds.add(resource.getId().getValue());
|
allIds.add(resource.getId().getValue());
|
||||||
}
|
}
|
||||||
|
|
|
@ -698,6 +698,10 @@ public class JsonParser extends BaseParser implements IParser {
|
||||||
} else if ("id".equals(nextName)) {
|
} else if ("id".equals(nextName)) {
|
||||||
elementId = theObject.getString(nextName);
|
elementId = theObject.getString(nextName);
|
||||||
continue;
|
continue;
|
||||||
|
} else if ("_id".equals(nextName)) {
|
||||||
|
// _id is incorrect, but some early examples in the FHIR spec used it
|
||||||
|
elementId = theObject.getString(nextName);
|
||||||
|
continue;
|
||||||
} else if ("extension".equals(nextName)) {
|
} else if ("extension".equals(nextName)) {
|
||||||
JsonArray array = theObject.getJsonArray(nextName);
|
JsonArray array = theObject.getJsonArray(nextName);
|
||||||
parseExtension(theState, array, false);
|
parseExtension(theState, array, false);
|
||||||
|
|
|
@ -158,8 +158,7 @@ class ParserState<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoked after any new XML event is individually processed, containing a copy of the XML event. This is basically
|
* Invoked after any new XML event is individually processed, containing a copy of the XML event. This is basically intended for embedded XHTML content
|
||||||
* intended for embedded XHTML content
|
|
||||||
*/
|
*/
|
||||||
public void xmlEvent(XMLEvent theNextEvent) {
|
public void xmlEvent(XMLEvent theNextEvent) {
|
||||||
myState.xmlEvent(theNextEvent);
|
myState.xmlEvent(theNextEvent);
|
||||||
|
@ -222,35 +221,37 @@ class ParserState<T> {
|
||||||
private static final int STATE_TERM = 1;
|
private static final int STATE_TERM = 1;
|
||||||
|
|
||||||
private int myCatState = STATE_NONE;
|
private int myCatState = STATE_NONE;
|
||||||
private Tag myInstance;
|
private TagList myTagList;
|
||||||
|
private String myTerm;
|
||||||
|
private String myLabel;
|
||||||
|
private String myScheme;
|
||||||
|
|
||||||
public AtomCategoryState(Tag theEntry) {
|
public AtomCategoryState(TagList theTagList) {
|
||||||
super(null);
|
super(null);
|
||||||
myInstance = theEntry;
|
myTagList = theTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||||
if ("term".equals(theName)) {
|
if ("term".equals(theName)) {
|
||||||
myInstance.setTerm(theValue);
|
myTerm = theValue;
|
||||||
} else if ("label".equals(theName)) {
|
} else if ("label".equals(theName)) {
|
||||||
myInstance.setLabel(theValue);
|
myLabel = theValue;
|
||||||
} else if ("scheme".equals(theName)) {
|
} else if ("scheme".equals(theName)) {
|
||||||
myInstance.setScheme(theValue);
|
myScheme = theValue;
|
||||||
} else if ("value".equals(theName)) {
|
} else if ("value".equals(theName)) {
|
||||||
/*
|
/*
|
||||||
* This handles XML parsing, which is odd for this quasi-resource type, since the tag has three values
|
* This handles XML parsing, which is odd for this quasi-resource type, since the tag has three values instead of one like everything else.
|
||||||
* instead of one like everything else.
|
|
||||||
*/
|
*/
|
||||||
switch (myCatState) {
|
switch (myCatState) {
|
||||||
case STATE_LABEL:
|
case STATE_LABEL:
|
||||||
myInstance.setLabel(theValue);
|
myLabel = theValue;
|
||||||
break;
|
break;
|
||||||
case STATE_TERM:
|
case STATE_TERM:
|
||||||
myInstance.setTerm(theValue);
|
myTerm = theValue;
|
||||||
break;
|
break;
|
||||||
case STATE_SCHEME:
|
case STATE_SCHEME:
|
||||||
myInstance.setScheme(theValue);
|
myScheme = theValue;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
super.string(theValue);
|
super.string(theValue);
|
||||||
|
@ -265,6 +266,9 @@ class ParserState<T> {
|
||||||
if (myCatState != STATE_NONE) {
|
if (myCatState != STATE_NONE) {
|
||||||
myCatState = STATE_NONE;
|
myCatState = STATE_NONE;
|
||||||
} else {
|
} else {
|
||||||
|
if (isNotEmpty(myScheme) || isNotBlank(myTerm) || isNotBlank(myLabel)) {
|
||||||
|
myTagList.addTag(myScheme, myTerm, myLabel);
|
||||||
|
}
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,7 +426,7 @@ class ParserState<T> {
|
||||||
} else if ("summary".equals(theLocalPart)) {
|
} else if ("summary".equals(theLocalPart)) {
|
||||||
push(new XhtmlState(getPreResourceState(), myEntry.getSummary(), false));
|
push(new XhtmlState(getPreResourceState(), myEntry.getSummary(), false));
|
||||||
} else if ("category".equals(theLocalPart)) {
|
} else if ("category".equals(theLocalPart)) {
|
||||||
push(new AtomCategoryState(myEntry.addCategory()));
|
push(new AtomCategoryState(myEntry.getCategories()));
|
||||||
} else if ("deleted".equals(theLocalPart) && myJsonMode) {
|
} else if ("deleted".equals(theLocalPart) && myJsonMode) {
|
||||||
// JSON and XML deleted entries are completely different for some reason
|
// JSON and XML deleted entries are completely different for some reason
|
||||||
myDeleted = true;
|
myDeleted = true;
|
||||||
|
@ -629,7 +633,7 @@ class ParserState<T> {
|
||||||
} else if ("author".equals(theLocalPart)) {
|
} else if ("author".equals(theLocalPart)) {
|
||||||
push(new AtomAuthorState(myInstance));
|
push(new AtomAuthorState(myInstance));
|
||||||
} else if ("category".equals(theLocalPart)) {
|
} else if ("category".equals(theLocalPart)) {
|
||||||
push(new AtomCategoryState(myInstance.getCategories().addTag()));
|
push(new AtomCategoryState(myInstance.getCategories()));
|
||||||
} else if ("deleted-entry".equals(theLocalPart) && verifyNamespace(XmlParser.TOMBSTONES_NS, theNamespaceURI)) {
|
} else if ("deleted-entry".equals(theLocalPart) && verifyNamespace(XmlParser.TOMBSTONES_NS, theNamespaceURI)) {
|
||||||
push(new AtomDeletedEntryState(myInstance, myResourceType));
|
push(new AtomDeletedEntryState(myInstance, myResourceType));
|
||||||
} else {
|
} else {
|
||||||
|
@ -707,7 +711,8 @@ class ParserState<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param theData The string value
|
* @param theData
|
||||||
|
* The string value
|
||||||
*/
|
*/
|
||||||
public void string(String theData) {
|
public void string(String theData) {
|
||||||
// ignore by default
|
// ignore by default
|
||||||
|
@ -718,7 +723,8 @@ class ParserState<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param theNextEvent The XML event
|
* @param theNextEvent
|
||||||
|
* The XML event
|
||||||
*/
|
*/
|
||||||
public void xmlEvent(XMLEvent theNextEvent) {
|
public void xmlEvent(XMLEvent theNextEvent) {
|
||||||
// ignore
|
// ignore
|
||||||
|
@ -741,7 +747,13 @@ class ParserState<T> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
public void attributeValue(String theName, String theValue) throws DataFormatException {
|
||||||
if ("contentType".equals(theName)) {
|
if ("id".equals(theName)) {
|
||||||
|
if (myInstance instanceof IIdentifiableElement) {
|
||||||
|
((IIdentifiableElement) myInstance).setElementSpecificId((theValue));
|
||||||
|
} else if (myInstance instanceof IResource) {
|
||||||
|
((IResource) myInstance).setId(new IdDt(theValue));
|
||||||
|
}
|
||||||
|
} else if ("contentType".equals(theName)) {
|
||||||
myInstance.setContentType(theValue);
|
myInstance.setContentType(theValue);
|
||||||
} else if (myJsonMode && "value".equals(theName)) {
|
} else if (myJsonMode && "value".equals(theName)) {
|
||||||
string(theValue);
|
string(theValue);
|
||||||
|
@ -1269,7 +1281,8 @@ class ParserState<T> {
|
||||||
myContext.newTerser().visit(myInstance, new IModelVisitor() {
|
myContext.newTerser().visit(myInstance, new IModelVisitor() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void acceptUndeclaredExtension(ISupportsUndeclaredExtensions theContainingElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition, ExtensionDt theNextExt) {
|
public void acceptUndeclaredExtension(ISupportsUndeclaredExtensions theContainingElement, BaseRuntimeChildDefinition theChildDefinition, BaseRuntimeElementDefinition<?> theDefinition,
|
||||||
|
ExtensionDt theNextExt) {
|
||||||
acceptElement(theNextExt.getValue(), null, null);
|
acceptElement(theNextExt.getValue(), null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1502,7 +1515,7 @@ class ParserState<T> {
|
||||||
@Override
|
@Override
|
||||||
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
public void enteringNewElement(String theNamespaceURI, String theLocalPart) throws DataFormatException {
|
||||||
if (TagList.ATTR_CATEGORY.equals(theLocalPart)) {
|
if (TagList.ATTR_CATEGORY.equals(theLocalPart)) {
|
||||||
push(new TagState(myTagList.addTag()));
|
push(new TagState(myTagList));
|
||||||
} else {
|
} else {
|
||||||
throw new DataFormatException("Unexpected element: " + theLocalPart);
|
throw new DataFormatException("Unexpected element: " + theLocalPart);
|
||||||
}
|
}
|
||||||
|
@ -1518,11 +1531,14 @@ class ParserState<T> {
|
||||||
private static final int SCHEME = 3;
|
private static final int SCHEME = 3;
|
||||||
private static final int TERM = 1;
|
private static final int TERM = 1;
|
||||||
private int mySubState = 0;
|
private int mySubState = 0;
|
||||||
private Tag myTag;
|
private TagList myTagList;
|
||||||
|
private String myTerm;
|
||||||
|
private String myLabel;
|
||||||
|
private String myScheme;
|
||||||
|
|
||||||
public TagState(Tag theTag) {
|
public TagState(TagList theTagList) {
|
||||||
super(null);
|
super(null);
|
||||||
myTag = theTag;
|
myTagList = theTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1531,13 +1547,13 @@ class ParserState<T> {
|
||||||
|
|
||||||
switch (mySubState) {
|
switch (mySubState) {
|
||||||
case TERM:
|
case TERM:
|
||||||
myTag.setTerm(value);
|
myTerm = (value);
|
||||||
break;
|
break;
|
||||||
case LABEL:
|
case LABEL:
|
||||||
myTag.setLabel(value);
|
myLabel = (value);
|
||||||
break;
|
break;
|
||||||
case SCHEME:
|
case SCHEME:
|
||||||
myTag.setScheme(value);
|
myScheme = (value);
|
||||||
break;
|
break;
|
||||||
case NONE:
|
case NONE:
|
||||||
// This handles JSON encoding, which is a bit weird
|
// This handles JSON encoding, which is a bit weird
|
||||||
|
@ -1553,6 +1569,9 @@ class ParserState<T> {
|
||||||
if (mySubState != NONE) {
|
if (mySubState != NONE) {
|
||||||
mySubState = NONE;
|
mySubState = NONE;
|
||||||
} else {
|
} else {
|
||||||
|
if (isNotEmpty(myScheme) || isNotBlank(myTerm) || isNotBlank(myLabel)) {
|
||||||
|
myTagList.addTag(myScheme, myTerm, myLabel);
|
||||||
|
}
|
||||||
pop();
|
pop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,10 +214,6 @@ abstract class BaseAddOrDeleteTagsMethodBinding extends BaseMethodBinding<Void>
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((myVersionIdParamIndex != null) != (theRequest.getId() != null && theRequest.getId().hasVersionIdPart())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isDelete()) {
|
if (isDelete()) {
|
||||||
if (Constants.PARAM_DELETE.equals(theRequest.getSecondaryOperation()) == false) {
|
if (Constants.PARAM_DELETE.equals(theRequest.getSecondaryOperation()) == false) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -20,7 +20,7 @@ package ca.uhn.fhir.rest.method;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.*;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
|
@ -66,7 +66,6 @@ import ca.uhn.fhir.rest.server.IBundleProvider;
|
||||||
import ca.uhn.fhir.rest.server.IDynamicSearchResourceProvider;
|
import ca.uhn.fhir.rest.server.IDynamicSearchResourceProvider;
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.SearchParameterMap;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
import ca.uhn.fhir.rest.server.exceptions.BaseServerResponseException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
|
|
@ -61,8 +61,7 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
|
|
||||||
if (!theMethod.getReturnType().equals(MethodOutcome.class)) {
|
if (!theMethod.getReturnType().equals(MethodOutcome.class)) {
|
||||||
if (!allowVoidReturnType()) {
|
if (!allowVoidReturnType()) {
|
||||||
throw new ConfigurationException("Method " + theMethod.getName() + " in type " + theMethod.getDeclaringClass().getCanonicalName() + " is a @" + theMethodAnnotation.getSimpleName()
|
throw new ConfigurationException("Method " + theMethod.getName() + " in type " + theMethod.getDeclaringClass().getCanonicalName() + " is a @" + theMethodAnnotation.getSimpleName() + " method but it does not return " + MethodOutcome.class);
|
||||||
+ " method but it does not return " + MethodOutcome.class);
|
|
||||||
} else if (theMethod.getReturnType() == void.class) {
|
} else if (theMethod.getReturnType() == void.class) {
|
||||||
myReturnVoid = true;
|
myReturnVoid = true;
|
||||||
}
|
}
|
||||||
|
@ -89,8 +88,7 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MethodOutcome invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException,
|
public MethodOutcome invokeClient(String theResponseMimeType, Reader theResponseReader, int theResponseStatusCode, Map<String, List<String>> theHeaders) throws IOException, BaseServerResponseException {
|
||||||
BaseServerResponseException {
|
|
||||||
switch (theResponseStatusCode) {
|
switch (theResponseStatusCode) {
|
||||||
case Constants.STATUS_HTTP_200_OK:
|
case Constants.STATUS_HTTP_200_OK:
|
||||||
case Constants.STATUS_HTTP_201_CREATED:
|
case Constants.STATUS_HTTP_201_CREATED:
|
||||||
|
@ -148,7 +146,7 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OperationOutcome outcome = response != null ? response.getOperationOutcome():null;
|
OperationOutcome outcome = response != null ? response.getOperationOutcome() : null;
|
||||||
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
|
for (int i = theServer.getInterceptors().size() - 1; i >= 0; i--) {
|
||||||
IServerInterceptor next = theServer.getInterceptors().get(i);
|
IServerInterceptor next = theServer.getInterceptors().get(i);
|
||||||
boolean continueProcessing = next.outgoingResponse(theRequest, outcome, theRequest.getServletRequest(), theRequest.getServletResponse());
|
boolean continueProcessing = next.outgoingResponse(theRequest, outcome, theRequest.getServletRequest(), theRequest.getServletResponse());
|
||||||
|
@ -160,15 +158,14 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
switch (getResourceOperationType()) {
|
switch (getResourceOperationType()) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
if (response == null) {
|
if (response == null) {
|
||||||
throw new InternalErrorException("Method " + getMethod().getName() + " in type " + getMethod().getDeclaringClass().getCanonicalName()
|
throw new InternalErrorException("Method " + getMethod().getName() + " in type " + getMethod().getDeclaringClass().getCanonicalName() + " returned null, which is not allowed for create operation");
|
||||||
+ " returned null, which is not allowed for create operation");
|
|
||||||
}
|
}
|
||||||
if (response.getCreated() == null || Boolean.TRUE.equals(response.getCreated())) {
|
if (response.getCreated() == null || Boolean.TRUE.equals(response.getCreated())) {
|
||||||
servletResponse.setStatus(Constants.STATUS_HTTP_201_CREATED);
|
servletResponse.setStatus(Constants.STATUS_HTTP_201_CREATED);
|
||||||
} else {
|
} else {
|
||||||
servletResponse.setStatus(Constants.STATUS_HTTP_200_OK);
|
servletResponse.setStatus(Constants.STATUS_HTTP_200_OK);
|
||||||
}
|
}
|
||||||
addLocationHeader(theRequest, servletResponse, response);
|
addLocationHeader(theRequest, servletResponse, response, Constants.HEADER_LOCATION);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
|
@ -178,7 +175,8 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
servletResponse.setStatus(Constants.STATUS_HTTP_201_CREATED);
|
servletResponse.setStatus(Constants.STATUS_HTTP_201_CREATED);
|
||||||
}
|
}
|
||||||
if (response != null && response.getId() != null) {
|
if (response != null && response.getId() != null) {
|
||||||
addLocationHeader(theRequest, servletResponse, response);
|
addLocationHeader(theRequest, servletResponse, response, Constants.HEADER_LOCATION);
|
||||||
|
addLocationHeader(theRequest, servletResponse, response, Constants.HEADER_CONTENT_LOCATION);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -226,7 +224,7 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
return myReturnVoid;
|
return myReturnVoid;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addLocationHeader(Request theRequest, HttpServletResponse theResponse, MethodOutcome response) {
|
private void addLocationHeader(Request theRequest, HttpServletResponse theResponse, MethodOutcome response, String headerLocation) {
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
b.append(theRequest.getFhirServerBase());
|
b.append(theRequest.getFhirServerBase());
|
||||||
b.append('/');
|
b.append('/');
|
||||||
|
@ -240,31 +238,38 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
b.append("/" + Constants.PARAM_HISTORY + "/");
|
b.append("/" + Constants.PARAM_HISTORY + "/");
|
||||||
b.append(response.getVersionId().getValue());
|
b.append(response.getVersionId().getValue());
|
||||||
}
|
}
|
||||||
theResponse.addHeader(Constants.HEADER_LOCATION, b.toString());
|
theResponse.addHeader(headerLocation, b.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @Override public void invokeServer(RestfulServer theServer, Request theRequest, HttpServletResponse theResponse) throws BaseServerResponseException, IOException { Object[] params = new
|
* @Override public void invokeServer(RestfulServer theServer, Request theRequest, HttpServletResponse theResponse)
|
||||||
* Object[getParameters().size()]; for (int i = 0; i < getParameters().size(); i++) { IParameter param = getParameters().get(i); if (param != null) { params[i] =
|
* throws BaseServerResponseException, IOException { Object[] params = new Object[getParameters().size()]; for (int
|
||||||
* param.translateQueryParametersIntoServerArgument(theRequest, null); } }
|
* i = 0; i < getParameters().size(); i++) { IParameter param = getParameters().get(i); if (param != null) {
|
||||||
|
* params[i] = param.translateQueryParametersIntoServerArgument(theRequest, null); } }
|
||||||
*
|
*
|
||||||
* addParametersForServerRequest(theRequest, params);
|
* addParametersForServerRequest(theRequest, params);
|
||||||
*
|
*
|
||||||
* MethodOutcome response = (MethodOutcome) invokeServerMethod(getProvider(), params);
|
* MethodOutcome response = (MethodOutcome) invokeServerMethod(getProvider(), params);
|
||||||
*
|
*
|
||||||
* if (response == null) { if (myReturnVoid == false) { throw new ConfigurationException("Method " + getMethod().getName() + " in type " + getMethod().getDeclaringClass().getCanonicalName() +
|
* if (response == null) { if (myReturnVoid == false) { throw new ConfigurationException("Method " +
|
||||||
* " returned null"); } else { theResponse.setStatus(Constants.STATUS_HTTP_204_NO_CONTENT); } } else if (!myReturnVoid) { if (response.isCreated()) {
|
* getMethod().getName() + " in type " + getMethod().getDeclaringClass().getCanonicalName() + " returned null"); }
|
||||||
* theResponse.setStatus(Constants.STATUS_HTTP_201_CREATED); StringBuilder b = new StringBuilder(); b.append(theRequest.getFhirServerBase()); b.append('/'); b.append(getResourceName());
|
* else { theResponse.setStatus(Constants.STATUS_HTTP_204_NO_CONTENT); } } else if (!myReturnVoid) { if
|
||||||
* b.append('/'); b.append(response.getId().getValue()); if (response.getVersionId() != null && response.getVersionId().isEmpty() == false) { b.append("/_history/");
|
* (response.isCreated()) { theResponse.setStatus(Constants.STATUS_HTTP_201_CREATED); StringBuilder b = new
|
||||||
* b.append(response.getVersionId().getValue()); } theResponse.addHeader("Location", b.toString()); } else { theResponse.setStatus(Constants.STATUS_HTTP_200_OK); } } else {
|
* StringBuilder(); b.append(theRequest.getFhirServerBase()); b.append('/'); b.append(getResourceName());
|
||||||
|
* b.append('/'); b.append(response.getId().getValue()); if (response.getVersionId() != null &&
|
||||||
|
* response.getVersionId().isEmpty() == false) { b.append("/_history/");
|
||||||
|
* b.append(response.getVersionId().getValue()); } theResponse.addHeader("Location", b.toString()); } else {
|
||||||
|
* theResponse.setStatus(Constants.STATUS_HTTP_200_OK); } } else {
|
||||||
* theResponse.setStatus(Constants.STATUS_HTTP_204_NO_CONTENT); }
|
* theResponse.setStatus(Constants.STATUS_HTTP_204_NO_CONTENT); }
|
||||||
*
|
*
|
||||||
* theServer.addHeadersToResponse(theResponse);
|
* theServer.addHeadersToResponse(theResponse);
|
||||||
*
|
*
|
||||||
* Writer writer = theResponse.getWriter(); try { if (response != null) { OperationOutcome outcome = new OperationOutcome(); if (response.getOperationOutcome() != null &&
|
* Writer writer = theResponse.getWriter(); try { if (response != null) { OperationOutcome outcome = new
|
||||||
* response.getOperationOutcome().getIssue() != null) { outcome.getIssue().addAll(response.getOperationOutcome().getIssue()); } EncodingUtil encoding =
|
* OperationOutcome(); if (response.getOperationOutcome() != null && response.getOperationOutcome().getIssue() !=
|
||||||
* BaseMethodBinding.determineResponseEncoding(theRequest .getServletRequest(), theRequest.getParameters()); theResponse.setContentType(encoding.getResourceContentType()); IParser parser =
|
* null) { outcome.getIssue().addAll(response.getOperationOutcome().getIssue()); } EncodingUtil encoding =
|
||||||
* encoding.newParser(getContext()); parser.encodeResourceToWriter(outcome, writer); } } finally { writer.close(); } // getMethod().in }
|
* BaseMethodBinding.determineResponseEncoding(theRequest .getServletRequest(), theRequest.getParameters());
|
||||||
|
* theResponse.setContentType(encoding.getResourceContentType()); IParser parser = encoding.newParser(getContext());
|
||||||
|
* parser.encodeResourceToWriter(outcome, writer); } } finally { writer.close(); } // getMethod().in }
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected abstract void addParametersForServerRequest(Request theRequest, Object[] theParams);
|
protected abstract void addParametersForServerRequest(Request theRequest, Object[] theParams);
|
||||||
|
@ -279,7 +284,8 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
protected abstract BaseHttpClientInvocation createClientInvocation(Object[] theArgs, IResource resource);
|
protected abstract BaseHttpClientInvocation createClientInvocation(Object[] theArgs, IResource resource);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For servers, this method will match only incoming requests that match the given operation, or which have no operation in the URL if this method returns null.
|
* For servers, this method will match only incoming requests that match the given operation, or which have no
|
||||||
|
* operation in the URL if this method returns null.
|
||||||
*/
|
*/
|
||||||
protected abstract String getMatchingOperation();
|
protected abstract String getMatchingOperation();
|
||||||
|
|
||||||
|
@ -352,5 +358,4 @@ abstract class BaseOutcomeReturningMethodBinding extends BaseMethodBinding<Metho
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package ca.uhn.fhir.util;
|
||||||
|
|
||||||
|
public class ObjectUtil {
|
||||||
|
|
||||||
|
public static boolean equals(Object object1, Object object2) {
|
||||||
|
if (object1 == object2) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if ((object1 == null) || (object2 == null)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return object1.equals(object2);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,6 +26,7 @@ import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
@ -40,6 +41,7 @@ import javax.xml.validation.SchemaFactory;
|
||||||
import javax.xml.validation.Validator;
|
import javax.xml.validation.Validator;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.io.input.BOMInputStream;
|
||||||
import org.w3c.dom.ls.LSInput;
|
import org.w3c.dom.ls.LSInput;
|
||||||
import org.w3c.dom.ls.LSResourceResolver;
|
import org.w3c.dom.ls.LSResourceResolver;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
@ -50,6 +52,7 @@ import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
|
import ca.uhn.fhir.model.dstu.resource.OperationOutcome.Issue;
|
||||||
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
import ca.uhn.fhir.model.dstu.valueset.IssueSeverityEnum;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
|
|
||||||
class SchemaBaseValidator implements IValidator {
|
class SchemaBaseValidator implements IValidator {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SchemaBaseValidator.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SchemaBaseValidator.class);
|
||||||
|
@ -78,7 +81,7 @@ class SchemaBaseValidator implements IValidator {
|
||||||
validator.setErrorHandler(handler);
|
validator.setErrorHandler(handler);
|
||||||
String encodedResource = theContext.getXmlEncodedResource();
|
String encodedResource = theContext.getXmlEncodedResource();
|
||||||
|
|
||||||
// ourLog.info(new FhirContext().newXmlParser().setPrettyPrint(true).encodeBundleToString((Bundle) theContext.getResource()));
|
// ourLog.info(new FhirContext().newXmlParser().setPrettyPrint(true).encodeBundleToString((Bundle) theContext.getResource()));
|
||||||
|
|
||||||
validator.validate(new StreamSource(new StringReader(encodedResource)));
|
validator.validate(new StreamSource(new StringReader(encodedResource)));
|
||||||
} catch (SAXException e) {
|
} catch (SAXException e) {
|
||||||
|
@ -115,11 +118,26 @@ class SchemaBaseValidator implements IValidator {
|
||||||
|
|
||||||
private Source loadXml(String theVersion, String theSystemId, String theSchemaName) {
|
private Source loadXml(String theVersion, String theSystemId, String theSchemaName) {
|
||||||
String pathToBase = "ca/uhn/fhir/model/" + theVersion + "/schema/" + theSchemaName;
|
String pathToBase = "ca/uhn/fhir/model/" + theVersion + "/schema/" + theSchemaName;
|
||||||
|
ourLog.debug("Going to load resource: {}", pathToBase);
|
||||||
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
||||||
if (baseIs == null) {
|
if (baseIs == null) {
|
||||||
throw new ValidationFailureException("No FHIR-BASE schema found");
|
throw new ValidationFailureException("No FHIR-BASE schema found");
|
||||||
}
|
}
|
||||||
Source baseSource = new StreamSource(baseIs, theSystemId);
|
baseIs = new BOMInputStream(baseIs, false);
|
||||||
|
InputStreamReader baseReader = new InputStreamReader(baseIs, Charset.forName("UTF-8"));
|
||||||
|
Source baseSource = new StreamSource(baseReader, theSystemId);
|
||||||
|
|
||||||
|
// String schema;
|
||||||
|
// try {
|
||||||
|
// schema = IOUtils.toString(baseIs, Charset.forName("UTF-8"));
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// throw new InternalErrorException(e);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// ourLog.info("Schema is:\n{}", schema);
|
||||||
|
//
|
||||||
|
// Source baseSource = new StreamSource(new StringReader(schema), theSystemId);
|
||||||
|
// Source baseSource = new StreamSource(baseIs, theSystemId);
|
||||||
return baseSource;
|
return baseSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,30 +198,15 @@ class SchemaBaseValidator implements IValidator {
|
||||||
input.setSystemId(theSystemId);
|
input.setSystemId(theSystemId);
|
||||||
input.setBaseURI(theBaseURI);
|
input.setBaseURI(theBaseURI);
|
||||||
String pathToBase = "ca/uhn/fhir/model/" + myVersion + "/schema/" + theSystemId;
|
String pathToBase = "ca/uhn/fhir/model/" + myVersion + "/schema/" + theSystemId;
|
||||||
|
|
||||||
|
ourLog.debug("Loading referenced schema file: " + pathToBase);
|
||||||
|
|
||||||
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
InputStream baseIs = FhirValidator.class.getClassLoader().getResourceAsStream(pathToBase);
|
||||||
if (baseIs == null) {
|
if (baseIs == null) {
|
||||||
throw new ValidationFailureException("No FHIR-BASE schema found");
|
throw new ValidationFailureException("No FHIR-BASE schema found");
|
||||||
}
|
}
|
||||||
|
|
||||||
ourLog.debug("Loading schema: {}", theSystemId);
|
input.setByteStream(baseIs);
|
||||||
byte[] schema;
|
|
||||||
try {
|
|
||||||
schema = IOUtils.toByteArray(new InputStreamReader(baseIs, "UTF-8"));
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new ValidationFailureException("Failed to load schema " + theSystemId, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Account for BOM in UTF-8 text (this seems to choke Java 6's built in XML reader)
|
|
||||||
int offset = 0;
|
|
||||||
if (schema[0] == (byte) 0xEF && schema[1] == (byte) 0xBB && schema[2] == (byte) 0xBF) {
|
|
||||||
offset = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
input.setCharacterStream(new InputStreamReader(new ByteArrayInputStream(schema, offset, schema.length - offset), "UTF-8"));
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new ValidationFailureException("Failed to load schema " + theSystemId, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return input;
|
return input;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
package ca.uhn.fhir.model.api;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.not;
|
||||||
|
import static org.hamcrest.Matchers.stringContainsInOrder;
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||||
|
|
||||||
|
public class TagListTest {
|
||||||
|
|
||||||
|
private FhirContext myCtx = new FhirContext();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquals() {
|
||||||
|
TagList tagList1 = new TagList();
|
||||||
|
tagList1.addTag(null, "Dog", "Puppies");
|
||||||
|
tagList1.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
|
||||||
|
TagList tagList2 = new TagList();
|
||||||
|
tagList2.addTag(null, "Dog", "Puppies");
|
||||||
|
tagList2.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
|
||||||
|
assertEquals(tagList1,tagList2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEqualsIgnoresLabel() {
|
||||||
|
TagList tagList1 = new TagList();
|
||||||
|
tagList1.addTag(null, "Dog", "AAAA");
|
||||||
|
tagList1.addTag("http://foo", "Cat", "BBBB");
|
||||||
|
|
||||||
|
TagList tagList2 = new TagList();
|
||||||
|
tagList2.addTag(null, "Dog", "Puppies");
|
||||||
|
tagList2.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
|
||||||
|
assertEquals(tagList1,tagList2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEqualsIgnoresOrder() {
|
||||||
|
TagList tagList1 = new TagList();
|
||||||
|
tagList1.addTag(null, "Dog", "Puppies");
|
||||||
|
tagList1.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
|
||||||
|
TagList tagList2 = new TagList();
|
||||||
|
tagList2.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
tagList2.addTag(null, "Dog", "Puppies");
|
||||||
|
|
||||||
|
assertEquals(tagList1,tagList2);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPreventDuplication() {
|
||||||
|
|
||||||
|
Patient patient = new Patient();
|
||||||
|
patient.addIdentifier("urn:system", "testTagsWithCreateAndReadAndSearch");
|
||||||
|
patient.addName().addFamily("Tester").addGiven("Joe");
|
||||||
|
TagList tagList = new TagList();
|
||||||
|
tagList.addTag(null, "Dog", "Puppies");
|
||||||
|
// Add this twice
|
||||||
|
tagList.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
tagList.addTag("http://foo", "Cat", "Kittens");
|
||||||
|
|
||||||
|
patient.getResourceMetadata().put(ResourceMetadataKeyEnum.TAG_LIST, tagList);
|
||||||
|
|
||||||
|
Bundle b = new Bundle();
|
||||||
|
b.addResource(patient, myCtx, "http://foo");
|
||||||
|
|
||||||
|
String encoded = myCtx.newXmlParser().encodeBundleToString(b);
|
||||||
|
assertThat(encoded, stringContainsInOrder(Arrays.asList("Cat", "Kittens")));
|
||||||
|
assertThat(encoded, not(stringContainsInOrder(Arrays.asList("Cat", "Kittens", "Cat", "Kittens"))));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,159 @@
|
||||||
|
package ca.uhn.fhir.parser;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
import ca.uhn.fhir.model.dstu.composite.CodeableConceptDt;
|
||||||
|
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
||||||
|
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.Composition;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.Composition.Section;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.Condition;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.Practitioner;
|
||||||
|
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
||||||
|
import ca.uhn.fhir.model.dstu.valueset.ConditionStatusEnum;
|
||||||
|
import ca.uhn.fhir.model.dstu.valueset.NameUseEnum;
|
||||||
|
import ca.uhn.fhir.model.dstu.valueset.PractitionerRoleEnum;
|
||||||
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initially contributed by Alexander Kley for bug #29
|
||||||
|
*/
|
||||||
|
public class ContainedResourceEncodingTest {
|
||||||
|
|
||||||
|
private static Logger logger = LoggerFactory.getLogger(ContainedResourceEncodingTest.class);
|
||||||
|
|
||||||
|
private FhirContext ctx;
|
||||||
|
|
||||||
|
private Composition comp;
|
||||||
|
|
||||||
|
private Practitioner author;
|
||||||
|
|
||||||
|
private Patient patient;
|
||||||
|
|
||||||
|
private final String patFamName1 = "FirstFamilyName";
|
||||||
|
|
||||||
|
private final String patGivName1 = "FirstGivenName";
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void initTest() {
|
||||||
|
logger.info("[initTest]");
|
||||||
|
|
||||||
|
initPatient();
|
||||||
|
initAuthor();
|
||||||
|
initComposition();
|
||||||
|
this.ctx = new FhirContext();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initComposition() {
|
||||||
|
// new ConditionList
|
||||||
|
|
||||||
|
final Condition c = new Condition();
|
||||||
|
c.setId(UUID.randomUUID().toString());
|
||||||
|
c.setNotes("This is a note");
|
||||||
|
c.setSubject(new ResourceReferenceDt(this.patient));
|
||||||
|
c.setCode(new CodeableConceptDt("mySystem", "theCode"));
|
||||||
|
c.setStatus(ConditionStatusEnum.CONFIRMED);
|
||||||
|
|
||||||
|
// new General Note Section
|
||||||
|
final Section generalNoteSection = new Section();
|
||||||
|
generalNoteSection.setElementSpecificId("Note");
|
||||||
|
generalNoteSection.setTitle("Note");
|
||||||
|
generalNoteSection.setContent(new ResourceReferenceDt(c));
|
||||||
|
|
||||||
|
// new SectionList
|
||||||
|
final List<Section> sectionList = new ArrayList<Section>();
|
||||||
|
sectionList.add(generalNoteSection);
|
||||||
|
|
||||||
|
// fill composition
|
||||||
|
this.comp = new Composition();
|
||||||
|
this.comp.addAuthor().setResource(this.author);
|
||||||
|
this.comp.setSubject(new ResourceReferenceDt(this.patient));
|
||||||
|
this.comp.setSection(sectionList);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initPatient() {
|
||||||
|
this.patient = new Patient();
|
||||||
|
this.patient.setId(new IdDt(UUID.randomUUID().toString()));
|
||||||
|
this.patient.addIdentifier().setSystem("http://example.com/fictitious-mrns").setValue("MRN001");
|
||||||
|
this.patient.setGender(AdministrativeGenderCodesEnum.M);
|
||||||
|
this.patient.addName().setUse(NameUseEnum.OFFICIAL).addFamily(this.patFamName1).addGiven(this.patGivName1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initAuthor() {
|
||||||
|
this.author = new Practitioner();
|
||||||
|
this.author.setId(new IdDt(UUID.randomUUID().toString()));
|
||||||
|
this.author.addIdentifier().setSystem("DoctorID").setValue("4711");
|
||||||
|
this.author.addRole(PractitionerRoleEnum.DOCTOR);
|
||||||
|
this.author.setName(new HumanNameDt().addFamily("Mueller").addGiven("Klaus").addPrefix("Prof. Dr."));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPatient() {
|
||||||
|
logger.debug("[xmlEncoding] encode resource to xml.");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This works fine, although patient instance is modifing from encoder
|
||||||
|
*/
|
||||||
|
final String expectedPatientXml = this.ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||||
|
logger.debug("[xmlEncoding] first encoding: {}", expectedPatientXml);
|
||||||
|
final String actualPatientXml = this.ctx.newXmlParser().setPrettyPrint(true).encodeResourceToString(this.patient);
|
||||||
|
// second encoding - xml is corrupt - i.e.: patient content 4 times! should be the same as after first encoding!
|
||||||
|
logger.debug("[xmlEncoding] second encoding: {}", actualPatientXml);
|
||||||
|
|
||||||
|
Assert.assertEquals(expectedPatientXml.length(), actualPatientXml.length());
|
||||||
|
Assert.assertArrayEquals(expectedPatientXml.getBytes(), actualPatientXml.getBytes());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testComposition() {
|
||||||
|
|
||||||
|
IParser parser = this.ctx.newXmlParser().setPrettyPrint(true);
|
||||||
|
|
||||||
|
assertEquals(0, this.comp.getContained().getContainedResources().size());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This doesn't works, secund encoding creates corrupt xml
|
||||||
|
*/
|
||||||
|
final String expectedCompXml = parser.encodeResourceToString(this.comp);
|
||||||
|
logger.debug("[xmlEncoding] first encoding: {}", expectedCompXml);
|
||||||
|
|
||||||
|
assertEquals(3, this.comp.getContained().getContainedResources().size());
|
||||||
|
|
||||||
|
final String actualCompXml = parser.encodeResourceToString(this.comp);
|
||||||
|
|
||||||
|
assertEquals(3, this.comp.getContained().getContainedResources().size());
|
||||||
|
|
||||||
|
// second encoding - xml could not be parsed back to compositon - i.e.: patient content 4 times! should be the same
|
||||||
|
// as after first encoding!
|
||||||
|
logger.debug("[xmlEncoding] second encoding: {}", actualCompXml);
|
||||||
|
|
||||||
|
final String thirdCompXml = parser.encodeResourceToString(this.comp);
|
||||||
|
|
||||||
|
assertEquals(3, this.comp.getContained().getContainedResources().size());
|
||||||
|
|
||||||
|
// third encoding - xml could not be parsed back to compositon i.e.: patient content 4 times! should be the same as
|
||||||
|
// afterfirst encoding!
|
||||||
|
logger.debug("[xmlEncoding] third encoding: {}", thirdCompXml);
|
||||||
|
|
||||||
|
Assert.assertEquals(expectedCompXml.length(), actualCompXml.length());
|
||||||
|
Assert.assertArrayEquals(expectedCompXml.getBytes(), actualCompXml.getBytes());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
import ca.uhn.fhir.model.api.BundleEntry;
|
import ca.uhn.fhir.model.api.BundleEntry;
|
||||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||||
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||||
import ca.uhn.fhir.model.api.TagList;
|
import ca.uhn.fhir.model.api.TagList;
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
import ca.uhn.fhir.model.api.annotation.Child;
|
||||||
|
@ -41,6 +42,7 @@ import ca.uhn.fhir.model.dstu.resource.Binary;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Conformance;
|
import ca.uhn.fhir.model.dstu.resource.Conformance;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Conformance.RestResource;
|
import ca.uhn.fhir.model.dstu.resource.Conformance.RestResource;
|
||||||
import ca.uhn.fhir.model.dstu.resource.DiagnosticReport;
|
import ca.uhn.fhir.model.dstu.resource.DiagnosticReport;
|
||||||
|
import ca.uhn.fhir.model.dstu.resource.ListResource;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Observation;
|
import ca.uhn.fhir.model.dstu.resource.Observation;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Organization;
|
import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||||
|
@ -63,7 +65,6 @@ public class JsonParserTest {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserTest.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JsonParserTest.class);
|
||||||
private static FhirContext ourCtx;
|
private static FhirContext ourCtx;
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeNarrativeBlockInBundle() {
|
public void testEncodeNarrativeBlockInBundle() {
|
||||||
Patient p = new Patient();
|
Patient p = new Patient();
|
||||||
|
@ -87,6 +88,27 @@ public class JsonParserTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEncodeIds() {
|
||||||
|
Patient pt =new Patient();
|
||||||
|
pt.addIdentifier("sys", "val");
|
||||||
|
|
||||||
|
ListResource list = new ListResource();
|
||||||
|
list.setId("listId");
|
||||||
|
list.addEntry().setItem(new ResourceReferenceDt(pt));
|
||||||
|
|
||||||
|
String enc = ourCtx.newJsonParser().encodeResourceToString(list);
|
||||||
|
ourLog.info(enc);
|
||||||
|
|
||||||
|
assertThat(enc, containsString("\"id\":\"1\""));
|
||||||
|
|
||||||
|
ListResource parsed = ourCtx.newJsonParser().parseResource(ListResource.class,enc);
|
||||||
|
assertEquals(Patient.class, parsed.getEntryFirstRep().getItem().getResource().getClass());
|
||||||
|
|
||||||
|
enc = enc.replace("\"id\"", "\"_id\"");
|
||||||
|
parsed = ourCtx.newJsonParser().parseResource(ListResource.class,enc);
|
||||||
|
assertEquals(Patient.class, parsed.getEntryFirstRep().getItem().getResource().getClass());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodingNullExtension() {
|
public void testEncodingNullExtension() {
|
||||||
|
@ -164,13 +186,11 @@ public class JsonParserTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeExtensionInResourceElement() {
|
public void testEncodeExtensionInResourceElement() {
|
||||||
|
|
||||||
Conformance c = new Conformance();
|
Conformance c = new Conformance();
|
||||||
// c.addRest().getSecurity().addUndeclaredExtension(false, "http://foo", new StringDt("AAA"));
|
// c.addRest().getSecurity().addUndeclaredExtension(false, "http://foo", new StringDt("AAA"));
|
||||||
c.addUndeclaredExtension(false, "http://foo", new StringDt("AAA"));
|
c.addUndeclaredExtension(false, "http://foo", new StringDt("AAA"));
|
||||||
|
|
||||||
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c);
|
String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c);
|
||||||
|
@ -187,10 +207,10 @@ public class JsonParserTest {
|
||||||
|
|
||||||
Binary patient = new Binary();
|
Binary patient = new Binary();
|
||||||
patient.setContentType("foo");
|
patient.setContentType("foo");
|
||||||
patient.setContent(new byte[] {1,2,3,4});
|
patient.setContent(new byte[] { 1, 2, 3, 4 });
|
||||||
|
|
||||||
String val = ourCtx.newJsonParser().encodeResourceToString(patient);
|
String val = ourCtx.newJsonParser().encodeResourceToString(patient);
|
||||||
assertEquals("{\"resourceType\":\"Binary\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}",val);
|
assertEquals("{\"resourceType\":\"Binary\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,8 +237,6 @@ public class JsonParserTest {
|
||||||
assertNull(value);
|
assertNull(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNestedContainedResources() {
|
public void testNestedContainedResources() {
|
||||||
|
|
||||||
|
@ -240,39 +258,27 @@ public class JsonParserTest {
|
||||||
|
|
||||||
// Only one (outer) contained block
|
// Only one (outer) contained block
|
||||||
int idx0 = str.indexOf("\"contained\"");
|
int idx0 = str.indexOf("\"contained\"");
|
||||||
int idx1 = str.indexOf("\"contained\"",idx0+1);
|
int idx1 = str.indexOf("\"contained\"", idx0 + 1);
|
||||||
|
|
||||||
assertNotEquals(-1, idx0);
|
assertNotEquals(-1, idx0);
|
||||||
assertEquals(-1, idx1);
|
assertEquals(-1, idx1);
|
||||||
|
|
||||||
Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, str);
|
Observation obs = ourCtx.newJsonParser().parseResource(Observation.class, str);
|
||||||
assertEquals("A",obs.getName().getText().getValue());
|
assertEquals("A", obs.getName().getText().getValue());
|
||||||
|
|
||||||
Observation obsB = (Observation) obs.getRelatedFirstRep().getTarget().getResource();
|
Observation obsB = (Observation) obs.getRelatedFirstRep().getTarget().getResource();
|
||||||
assertEquals("B",obsB.getName().getText().getValue());
|
assertEquals("B", obsB.getName().getText().getValue());
|
||||||
|
|
||||||
Observation obsC = (Observation) obsB.getRelatedFirstRep().getTarget().getResource();
|
Observation obsC = (Observation) obsB.getRelatedFirstRep().getTarget().getResource();
|
||||||
assertEquals("C",obsC.getName().getText().getValue());
|
assertEquals("C", obsC.getName().getText().getValue());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testParseQuery() {
|
public void testParseQuery() {
|
||||||
String msg = "{\n" +
|
String msg = "{\n" + " \"resourceType\": \"Query\",\n" + " \"text\": {\n" + " \"status\": \"generated\",\n" + " \"div\": \"<div>[Put rendering here]</div>\"\n" + " },\n"
|
||||||
" \"resourceType\": \"Query\",\n" +
|
+ " \"identifier\": \"urn:uuid:42b253f5-fa17-40d0-8da5-44aeb4230376\",\n" + " \"parameter\": [\n" + " {\n" + " \"url\": \"http://hl7.org/fhir/query#_query\",\n"
|
||||||
" \"text\": {\n" +
|
+ " \"valueString\": \"example\"\n" + " }\n" + " ]\n" + "}";
|
||||||
" \"status\": \"generated\",\n" +
|
|
||||||
" \"div\": \"<div>[Put rendering here]</div>\"\n" +
|
|
||||||
" },\n" +
|
|
||||||
" \"identifier\": \"urn:uuid:42b253f5-fa17-40d0-8da5-44aeb4230376\",\n" +
|
|
||||||
" \"parameter\": [\n" +
|
|
||||||
" {\n" +
|
|
||||||
" \"url\": \"http://hl7.org/fhir/query#_query\",\n" +
|
|
||||||
" \"valueString\": \"example\"\n" +
|
|
||||||
" }\n" +
|
|
||||||
" ]\n" +
|
|
||||||
"}";
|
|
||||||
Query query = ourCtx.newJsonParser().parseResource(Query.class, msg);
|
Query query = ourCtx.newJsonParser().parseResource(Query.class, msg);
|
||||||
|
|
||||||
assertEquals("urn:uuid:42b253f5-fa17-40d0-8da5-44aeb4230376", query.getIdentifier().getValueAsString());
|
assertEquals("urn:uuid:42b253f5-fa17-40d0-8da5-44aeb4230376", query.getIdentifier().getValueAsString());
|
||||||
|
@ -287,7 +293,6 @@ public class JsonParserTest {
|
||||||
ExtensionDt parameter = q.addParameter();
|
ExtensionDt parameter = q.addParameter();
|
||||||
parameter.setUrl("http://hl7.org/fhir/query#_query").setValue(new StringDt("example"));
|
parameter.setUrl("http://hl7.org/fhir/query#_query").setValue(new StringDt("example"));
|
||||||
|
|
||||||
|
|
||||||
String val = new FhirContext().newJsonParser().encodeResourceToString(q);
|
String val = new FhirContext().newJsonParser().encodeResourceToString(q);
|
||||||
ourLog.info(val);
|
ourLog.info(val);
|
||||||
|
|
||||||
|
@ -315,7 +320,7 @@ public class JsonParserTest {
|
||||||
|
|
||||||
Binary val = ourCtx.newJsonParser().parseResource(Binary.class, "{\"resourceType\":\"Binary\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}");
|
Binary val = ourCtx.newJsonParser().parseResource(Binary.class, "{\"resourceType\":\"Binary\",\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}");
|
||||||
assertEquals("foo", val.getContentType());
|
assertEquals("foo", val.getContentType());
|
||||||
assertArrayEquals(new byte[] {1,2,3,4}, val.getContent());
|
assertArrayEquals(new byte[] { 1, 2, 3, 4 }, val.getContent());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,7 +387,7 @@ public class JsonParserTest {
|
||||||
//@formatter:on
|
//@formatter:on
|
||||||
|
|
||||||
String encoded = new FhirContext().newJsonParser().encodeTagListToString(tagList);
|
String encoded = new FhirContext().newJsonParser().encodeTagListToString(tagList);
|
||||||
assertEquals(expected,encoded);
|
assertEquals(expected, encoded);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -392,7 +397,7 @@ public class JsonParserTest {
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
BundleEntry e = b.addEntry();
|
BundleEntry e = b.addEntry();
|
||||||
e.setResource(new Patient());
|
e.setResource(new Patient());
|
||||||
b.addCategory().setLabel("label").setTerm("term").setScheme("scheme");
|
b.addCategory("scheme", "term", "label");
|
||||||
|
|
||||||
String val = new FhirContext().newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
|
String val = new FhirContext().newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
|
||||||
ourLog.info(val);
|
ourLog.info(val);
|
||||||
|
@ -400,8 +405,8 @@ public class JsonParserTest {
|
||||||
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
|
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
|
||||||
|
|
||||||
b = new FhirContext().newJsonParser().parseBundle(val);
|
b = new FhirContext().newJsonParser().parseBundle(val);
|
||||||
assertEquals(1,b.getEntries().size());
|
assertEquals(1, b.getEntries().size());
|
||||||
assertEquals(1,b.getCategories().size());
|
assertEquals(1, b.getCategories().size());
|
||||||
assertEquals("term", b.getCategories().get(0).getTerm());
|
assertEquals("term", b.getCategories().get(0).getTerm());
|
||||||
assertEquals("label", b.getCategories().get(0).getLabel());
|
assertEquals("label", b.getCategories().get(0).getLabel());
|
||||||
assertEquals("scheme", b.getCategories().get(0).getScheme());
|
assertEquals("scheme", b.getCategories().get(0).getScheme());
|
||||||
|
@ -415,16 +420,16 @@ public class JsonParserTest {
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
BundleEntry e = b.addEntry();
|
BundleEntry e = b.addEntry();
|
||||||
e.setResource(new Patient());
|
e.setResource(new Patient());
|
||||||
e.addCategory().setLabel("label").setTerm("term").setScheme("scheme");
|
e.addCategory("scheme", "term", "label");
|
||||||
|
|
||||||
String val = new FhirContext().newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
|
String val = ourCtx.newJsonParser().setPrettyPrint(false).encodeBundleToString(b);
|
||||||
ourLog.info(val);
|
ourLog.info(val);
|
||||||
|
|
||||||
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
|
assertThat(val, StringContains.containsString("\"category\":[{\"term\":\"term\",\"label\":\"label\",\"scheme\":\"scheme\"}]"));
|
||||||
|
|
||||||
b = new FhirContext().newJsonParser().parseBundle(val);
|
b = ourCtx.newJsonParser().parseBundle(val);
|
||||||
assertEquals(1,b.getEntries().size());
|
assertEquals(1, b.getEntries().size());
|
||||||
assertEquals(1,b.getEntries().get(0).getCategories().size());
|
assertEquals(1, b.getEntries().get(0).getCategories().size());
|
||||||
assertEquals("term", b.getEntries().get(0).getCategories().get(0).getTerm());
|
assertEquals("term", b.getEntries().get(0).getCategories().get(0).getTerm());
|
||||||
assertEquals("label", b.getEntries().get(0).getCategories().get(0).getLabel());
|
assertEquals("label", b.getEntries().get(0).getCategories().get(0).getLabel());
|
||||||
assertEquals("scheme", b.getEntries().get(0).getCategories().get(0).getScheme());
|
assertEquals("scheme", b.getEntries().get(0).getCategories().get(0).getScheme());
|
||||||
|
@ -450,7 +455,6 @@ public class JsonParserTest {
|
||||||
parseAndEncode("/alert.profile.json");
|
parseAndEncode("/alert.profile.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void parseAndEncode(String name) throws IOException {
|
private void parseAndEncode(String name) throws IOException {
|
||||||
String msg = IOUtils.toString(XmlParser.class.getResourceAsStream(name));
|
String msg = IOUtils.toString(XmlParser.class.getResourceAsStream(name));
|
||||||
ourLog.info(msg);
|
ourLog.info(msg);
|
||||||
|
@ -465,7 +469,7 @@ public class JsonParserTest {
|
||||||
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
||||||
|
|
||||||
String exp = expected.toString().replace("\\r\\n", "\\n").replace("§", "§");
|
String exp = expected.toString().replace("\\r\\n", "\\n").replace("§", "§");
|
||||||
String act = actual.toString().replace("\\r\\n","\\n");
|
String act = actual.toString().replace("\\r\\n", "\\n");
|
||||||
|
|
||||||
ourLog.info("Expected: {}", exp);
|
ourLog.info("Expected: {}", exp);
|
||||||
ourLog.info("Actual : {}", act);
|
ourLog.info("Actual : {}", act);
|
||||||
|
@ -473,8 +477,6 @@ public class JsonParserTest {
|
||||||
assertEquals(exp, act);
|
assertEquals(exp, act);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeContainedResourcesMore() {
|
public void testEncodeContainedResourcesMore() {
|
||||||
|
|
||||||
|
@ -518,7 +520,6 @@ public class JsonParserTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeDeclaredExtensionWithResourceContent() {
|
public void testEncodeDeclaredExtensionWithResourceContent() {
|
||||||
IParser parser = new FhirContext().newJsonParser();
|
IParser parser = new FhirContext().newJsonParser();
|
||||||
|
@ -549,8 +550,6 @@ public class JsonParserTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeExt() throws Exception {
|
public void testEncodeExt() throws Exception {
|
||||||
|
|
||||||
|
@ -567,11 +566,12 @@ public class JsonParserTest {
|
||||||
ourLog.info(encoded);
|
ourLog.info(encoded);
|
||||||
|
|
||||||
assertThat(encoded, not(containsString("123456")));
|
assertThat(encoded, not(containsString("123456")));
|
||||||
assertEquals("{\"resourceType\":\"ValueSet\",\"define\":{\"concept\":[{\"extension\":[{\"url\":\"urn:alt\",\"valueString\":\"alt name\"}],\"code\":\"someCode\",\"display\":\"someDisplay\"}]}}", encoded);
|
assertEquals(
|
||||||
|
"{\"resourceType\":\"ValueSet\",\"define\":{\"concept\":[{\"extension\":[{\"url\":\"urn:alt\",\"valueString\":\"alt name\"}],\"code\":\"someCode\",\"display\":\"someDisplay\"}]}}",
|
||||||
|
encoded);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeExtensionWithResourceContent() {
|
public void testEncodeExtensionWithResourceContent() {
|
||||||
IParser parser = new FhirContext().newJsonParser();
|
IParser parser = new FhirContext().newJsonParser();
|
||||||
|
@ -593,7 +593,6 @@ public class JsonParserTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeInvalidChildGoodException() {
|
public void testEncodeInvalidChildGoodException() {
|
||||||
Observation obs = new Observation();
|
Observation obs = new Observation();
|
||||||
|
@ -793,7 +792,6 @@ public class JsonParserTest {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This sample has extra elements in <searchParam> that are not actually a part of the spec any more..
|
* This sample has extra elements in <searchParam> that are not actually a part of the spec any more..
|
||||||
*/
|
*/
|
||||||
|
@ -864,13 +862,13 @@ public class JsonParserTest {
|
||||||
|
|
||||||
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(bundle));
|
ourLog.info(ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(bundle));
|
||||||
String encoded = ourCtx.newJsonParser().encodeBundleToString(bundle);
|
String encoded = ourCtx.newJsonParser().encodeBundleToString(bundle);
|
||||||
assertEquals(bundleString,encoded);
|
assertEquals(bundleString, encoded);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testEncodeBundle() throws InterruptedException {
|
public void testEncodeBundle() throws InterruptedException {
|
||||||
Bundle b= new Bundle();
|
Bundle b = new Bundle();
|
||||||
|
|
||||||
InstantDt pub = InstantDt.withCurrentTime();
|
InstantDt pub = InstantDt.withCurrentTime();
|
||||||
b.setPublished(pub);
|
b.setPublished(pub);
|
||||||
|
@ -899,18 +897,17 @@ public class JsonParserTest {
|
||||||
ourLog.info(bundleString);
|
ourLog.info(bundleString);
|
||||||
|
|
||||||
List<String> strings = new ArrayList<String>();
|
List<String> strings = new ArrayList<String>();
|
||||||
strings.addAll(Arrays.asList("\"published\":\""+pub.getValueAsString()+"\""));
|
strings.addAll(Arrays.asList("\"published\":\"" + pub.getValueAsString() + "\""));
|
||||||
strings.addAll(Arrays.asList("\"id\":\"1\""));
|
strings.addAll(Arrays.asList("\"id\":\"1\""));
|
||||||
strings.addAll(Arrays.asList("this is the summary"));
|
strings.addAll(Arrays.asList("this is the summary"));
|
||||||
strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\""));
|
strings.addAll(Arrays.asList("\"id\":\"2\"", "\"rel\":\"alternate\"", "\"href\":\"http://foo/bar\""));
|
||||||
strings.addAll(Arrays.asList("\"deleted\":\""+nowDt.getValueAsString()+"\"", "\"id\":\"Patient/3\""));
|
strings.addAll(Arrays.asList("\"deleted\":\"" + nowDt.getValueAsString() + "\"", "\"id\":\"Patient/3\""));
|
||||||
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
|
assertThat(bundleString, StringContainsInOrder.stringContainsInOrder(strings));
|
||||||
|
|
||||||
b.getEntries().remove(2);
|
b.getEntries().remove(2);
|
||||||
bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
|
bundleString = ourCtx.newJsonParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||||
assertThat(bundleString, not(containsString("deleted")));
|
assertThat(bundleString, not(containsString("deleted")));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -956,7 +953,7 @@ public class JsonParserTest {
|
||||||
String encoded = jsonParser.encodeResourceToString(obs);
|
String encoded = jsonParser.encodeResourceToString(obs);
|
||||||
ourLog.info(encoded);
|
ourLog.info(encoded);
|
||||||
|
|
||||||
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"));
|
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"), Charset.forName("UTF-8"));
|
||||||
|
|
||||||
JSON expected = JSONSerializer.toJSON(jsonString);
|
JSON expected = JSONSerializer.toJSON(jsonString);
|
||||||
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
||||||
|
@ -978,11 +975,10 @@ public class JsonParserTest {
|
||||||
public void testParseWithIncorrectReference() throws IOException {
|
public void testParseWithIncorrectReference() throws IOException {
|
||||||
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"));
|
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"));
|
||||||
jsonString = jsonString.replace("\"reference\"", "\"resource\"");
|
jsonString = jsonString.replace("\"reference\"", "\"resource\"");
|
||||||
Patient parsed = ourCtx.newJsonParser().parseResource(Patient.class,jsonString);
|
Patient parsed = ourCtx.newJsonParser().parseResource(Patient.class, jsonString);
|
||||||
assertEquals("Organization/1", parsed.getManagingOrganization().getReference().getValue());
|
assertEquals("Organization/1", parsed.getManagingOrganization().getReference().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSimpleResourceEncodeWithCustomType() throws IOException {
|
public void testSimpleResourceEncodeWithCustomType() throws IOException {
|
||||||
|
|
||||||
|
@ -1003,7 +999,7 @@ public class JsonParserTest {
|
||||||
String encoded = jsonParser.encodeResourceToString(obs);
|
String encoded = jsonParser.encodeResourceToString(obs);
|
||||||
ourLog.info(encoded);
|
ourLog.info(encoded);
|
||||||
|
|
||||||
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"));
|
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.json"), Charset.forName("UTF-8"));
|
||||||
|
|
||||||
JSON expected = JSONSerializer.toJSON(jsonString);
|
JSON expected = JSONSerializer.toJSON(jsonString);
|
||||||
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
JSON actual = JSONSerializer.toJSON(encoded.trim());
|
||||||
|
|
|
@ -73,10 +73,15 @@ public class XmlParserTest {
|
||||||
private static FhirContext ourCtx;
|
private static FhirContext ourCtx;
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserTest.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(XmlParserTest.class);
|
||||||
|
|
||||||
|
@BeforeClass
|
||||||
|
public static void beforeClass2() {
|
||||||
|
System.setProperty("file.encoding", "ISO-8859-1");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thanks to Alexander Kley!
|
* Thanks to Alexander Kley!
|
||||||
*/
|
*/
|
||||||
// @Test
|
@Test
|
||||||
public void testParseContainedBinaryResource() {
|
public void testParseContainedBinaryResource() {
|
||||||
byte[] bin = new byte[] {0,1,2,3,4};
|
byte[] bin = new byte[] {0,1,2,3,4};
|
||||||
final Binary binary = new Binary("PatientConsent", bin);
|
final Binary binary = new Binary("PatientConsent", bin);
|
||||||
|
@ -199,7 +204,7 @@ public class XmlParserTest {
|
||||||
Bundle b = new Bundle();
|
Bundle b = new Bundle();
|
||||||
BundleEntry e = b.addEntry();
|
BundleEntry e = b.addEntry();
|
||||||
e.setResource(new Patient());
|
e.setResource(new Patient());
|
||||||
e.addCategory().setLabel("label").setTerm("term").setScheme("scheme");
|
e.addCategory("scheme", "term", "label");
|
||||||
|
|
||||||
String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
|
String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||||
ourLog.info(val);
|
ourLog.info(val);
|
||||||
|
@ -696,7 +701,7 @@ public class XmlParserTest {
|
||||||
|
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/observation-example-eeg.xml"));
|
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/observation-example-eeg.xml"), Charset.forName("UTF-8"));
|
||||||
IResource resource = p.parseResource(string);
|
IResource resource = p.parseResource(string);
|
||||||
|
|
||||||
String result = p.encodeResourceToString(resource);
|
String result = p.encodeResourceToString(resource);
|
||||||
|
@ -709,7 +714,7 @@ public class XmlParserTest {
|
||||||
// Use new context here to ensure List isn't already loaded
|
// Use new context here to ensure List isn't already loaded
|
||||||
IParser p = new FhirContext().newXmlParser();
|
IParser p = new FhirContext().newXmlParser();
|
||||||
|
|
||||||
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/feed-with-list.xml"));
|
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/feed-with-list.xml"), Charset.forName("UTF-8"));
|
||||||
Bundle bundle = p.parseBundle(string);
|
Bundle bundle = p.parseBundle(string);
|
||||||
|
|
||||||
ListResource res = (ListResource) bundle.toListOfResources().get(2);
|
ListResource res = (ListResource) bundle.toListOfResources().get(2);
|
||||||
|
@ -722,7 +727,7 @@ public class XmlParserTest {
|
||||||
|
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/patient-example-dicom.xml"));
|
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/patient-example-dicom.xml"), Charset.forName("UTF-8"));
|
||||||
IResource resource = p.parseResource(string);
|
IResource resource = p.parseResource(string);
|
||||||
|
|
||||||
String result = p.encodeResourceToString(resource);
|
String result = p.encodeResourceToString(resource);
|
||||||
|
@ -730,7 +735,7 @@ public class XmlParserTest {
|
||||||
|
|
||||||
// Nothing
|
// Nothing
|
||||||
|
|
||||||
string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/patient-example-us-extensions.xml"));
|
string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/patient-example-us-extensions.xml"), Charset.forName("UTF-8"));
|
||||||
resource = p.parseResource(string);
|
resource = p.parseResource(string);
|
||||||
|
|
||||||
result = p.encodeResourceToString(resource);
|
result = p.encodeResourceToString(resource);
|
||||||
|
@ -743,7 +748,7 @@ public class XmlParserTest {
|
||||||
|
|
||||||
IParser p = ourCtx.newXmlParser();
|
IParser p = ourCtx.newXmlParser();
|
||||||
|
|
||||||
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/questionnaire-example.xml"));
|
String string = IOUtils.toString(XmlParserTest.class.getResourceAsStream("/questionnaire-example.xml"), Charset.forName("UTF-8"));
|
||||||
IResource resource = p.parseResource(string);
|
IResource resource = p.parseResource(string);
|
||||||
|
|
||||||
String result = p.encodeResourceToString(resource);
|
String result = p.encodeResourceToString(resource);
|
||||||
|
@ -1188,7 +1193,7 @@ public class XmlParserTest {
|
||||||
String encoded = jsonParser.encodeResourceToString(obs);
|
String encoded = jsonParser.encodeResourceToString(obs);
|
||||||
ourLog.info(encoded);
|
ourLog.info(encoded);
|
||||||
|
|
||||||
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.xml"));
|
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.xml"), Charset.forName("UTF-8"));
|
||||||
|
|
||||||
String expected = (jsonString);
|
String expected = (jsonString);
|
||||||
String actual = (encoded.trim());
|
String actual = (encoded.trim());
|
||||||
|
@ -1220,7 +1225,7 @@ public class XmlParserTest {
|
||||||
String encoded = jsonParser.encodeResourceToString(obs);
|
String encoded = jsonParser.encodeResourceToString(obs);
|
||||||
ourLog.info(encoded);
|
ourLog.info(encoded);
|
||||||
|
|
||||||
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.xml"));
|
String jsonString = IOUtils.toString(JsonParser.class.getResourceAsStream("/example-patient-general.xml"), Charset.forName("UTF-8"));
|
||||||
|
|
||||||
String expected = (jsonString);
|
String expected = (jsonString);
|
||||||
String actual = (encoded.trim());
|
String actual = (encoded.trim());
|
||||||
|
|
|
@ -521,7 +521,9 @@ public class ClientTest {
|
||||||
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
|
ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo");
|
||||||
|
|
||||||
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02"), new IntegerDt(12));
|
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02"), new IntegerDt(12));
|
||||||
assertEquals("http://foo/Patient/111/_history?_since=2012-01-02T00%3A01%3A02&_count=12", capt.getAllValues().get(0).getURI().toString());
|
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("http://foo/Patient/111/_history?"));
|
||||||
|
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_since=2012-01-02T00%3A01%3A02"));
|
||||||
|
assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_count=12"));
|
||||||
|
|
||||||
String expectedDateString = new InstantDt(new InstantDt("2012-01-02T00:01:02").getValue()).getValueAsString(); // ensures
|
String expectedDateString = new InstantDt(new InstantDt("2012-01-02T00:01:02").getValue()).getValueAsString(); // ensures
|
||||||
// the
|
// the
|
||||||
|
@ -529,7 +531,9 @@ public class ClientTest {
|
||||||
// timezone
|
// timezone
|
||||||
expectedDateString = expectedDateString.replace(":", "%3A");
|
expectedDateString = expectedDateString.replace(":", "%3A");
|
||||||
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02").getValue(), new IntegerDt(12).getValue());
|
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02").getValue(), new IntegerDt(12).getValue());
|
||||||
assertEquals("http://foo/Patient/111/_history?_since=" + expectedDateString + "&_count=12", capt.getAllValues().get(1).getURI().toString());
|
assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("http://foo/Patient/111/_history?"));
|
||||||
|
assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("_since="+expectedDateString));
|
||||||
|
assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("_count=12"));
|
||||||
|
|
||||||
client.getHistoryPatientInstance(new IdDt("111"), null, new IntegerDt(12));
|
client.getHistoryPatientInstance(new IdDt("111"), null, new IntegerDt(12));
|
||||||
assertEquals("http://foo/Patient/111/_history?_count=12", capt.getAllValues().get(2).getURI().toString());
|
assertEquals("http://foo/Patient/111/_history?_count=12", capt.getAllValues().get(2).getURI().toString());
|
||||||
|
@ -538,10 +542,10 @@ public class ClientTest {
|
||||||
assertEquals("http://foo/Patient/111/_history?_since=2012-01-02T00%3A01%3A02", capt.getAllValues().get(3).getURI().toString());
|
assertEquals("http://foo/Patient/111/_history?_since=2012-01-02T00%3A01%3A02", capt.getAllValues().get(3).getURI().toString());
|
||||||
|
|
||||||
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt(), new IntegerDt(12));
|
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt(), new IntegerDt(12));
|
||||||
assertEquals("http://foo/Patient/111/_history?_count=12", capt.getAllValues().get(2).getURI().toString());
|
assertEquals("http://foo/Patient/111/_history?_count=12", capt.getAllValues().get(4).getURI().toString());
|
||||||
|
|
||||||
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02"), new IntegerDt());
|
client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02"), new IntegerDt());
|
||||||
assertEquals("http://foo/Patient/111/_history?_since=2012-01-02T00%3A01%3A02", capt.getAllValues().get(3).getURI().toString());
|
assertEquals("http://foo/Patient/111/_history?_since=2012-01-02T00%3A01%3A02", capt.getAllValues().get(5).getURI().toString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package ca.uhn.fhir.rest.server;
|
package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
import static org.apache.commons.lang.StringUtils.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
package ca.uhn.fhir.rest.server;
|
package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
|
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
@ -205,8 +207,12 @@ public class IncludeTest {
|
||||||
Patient p = bundle.getResources(Patient.class).get(0);
|
Patient p = bundle.getResources(Patient.class).get(0);
|
||||||
assertEquals(2, p.getName().size());
|
assertEquals(2, p.getName().size());
|
||||||
assertEquals("Hello", p.getId().getIdPart());
|
assertEquals("Hello", p.getId().getIdPart());
|
||||||
assertEquals("foo", p.getName().get(0).getFamilyFirstRep().getValue());
|
|
||||||
assertEquals("bar", p.getName().get(1).getFamilyFirstRep().getValue());
|
Set<String> values = new HashSet<String>();
|
||||||
|
values.add( p.getName().get(0).getFamilyFirstRep().getValue());
|
||||||
|
values.add( p.getName().get(1).getFamilyFirstRep().getValue());
|
||||||
|
assertThat(values, containsInAnyOrder("foo", "bar"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
package ca.uhn.fhir.rest.server;
|
package ca.uhn.fhir.rest.server;
|
||||||
|
|
||||||
import static org.apache.commons.lang.StringUtils.*;
|
import static org.apache.commons.lang.StringUtils.defaultString;
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.methods.HttpGet;
|
import org.apache.http.client.methods.HttpGet;
|
||||||
import org.apache.http.client.methods.HttpPost;
|
import org.apache.http.client.methods.HttpPost;
|
||||||
|
@ -33,7 +34,6 @@ import ca.uhn.fhir.rest.annotation.DeleteTags;
|
||||||
import ca.uhn.fhir.rest.annotation.GetTags;
|
import ca.uhn.fhir.rest.annotation.GetTags;
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||||
import ca.uhn.fhir.rest.annotation.TagListParam;
|
import ca.uhn.fhir.rest.annotation.TagListParam;
|
||||||
import ca.uhn.fhir.rest.annotation.VersionIdParam;
|
|
||||||
import ca.uhn.fhir.util.PortUtil;
|
import ca.uhn.fhir.util.PortUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -94,17 +94,6 @@ public class TagsServerTest {
|
||||||
assertEquals(tagList, ourLastTagList);
|
assertEquals(tagList, ourLastTagList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testEquals() {
|
|
||||||
TagList list1 = ourProvider.getAllTagsPatient();
|
|
||||||
TagList list2 = ourProvider.getAllTagsPatient();
|
|
||||||
assertEquals(list1, list2);
|
|
||||||
|
|
||||||
list1 = ourProvider.getAllTagsPatient();
|
|
||||||
list2 = ourProvider.getAllTagsPatient();
|
|
||||||
list2.get(0).setTerm("!!!!!");
|
|
||||||
assertNotEquals(list1, list2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAllTags() throws Exception {
|
public void testGetAllTags() throws Exception {
|
||||||
|
@ -134,8 +123,10 @@ public class TagsServerTest {
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
||||||
TagList expected = ourProvider.getAllTags();
|
|
||||||
expected.get(0).setTerm("Patient");
|
TagList expected = new TagList();
|
||||||
|
expected.addTag(null, "Patient", "DogLabel");
|
||||||
|
expected.addTag("http://cats", "AllCat", "CatLabel");
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +143,10 @@ public class TagsServerTest {
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
||||||
TagList expected = ourProvider.getAllTags();
|
|
||||||
expected.get(0).setTerm("Patient111");
|
TagList expected = new TagList();
|
||||||
|
expected.addTag(null, "Patient111", "DogLabel");
|
||||||
|
expected.addTag("http://cats", "AllCat", "CatLabel");
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +163,9 @@ public class TagsServerTest {
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
||||||
TagList expected = ourProvider.getAllTags();
|
TagList expected = new TagList();
|
||||||
expected.get(0).setTerm("Patient111222");
|
expected.addTag(null, "Patient111222", "DogLabel");
|
||||||
|
expected.addTag("http://cats", "AllCat", "CatLabel");
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +182,9 @@ public class TagsServerTest {
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
|
||||||
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
TagList actual = ourCtx.newXmlParser().parseTagList(responseContent);
|
||||||
TagList expected = ourProvider.getAllTags();
|
TagList expected = new TagList();
|
||||||
expected.get(0).setTerm("Patient111222");
|
expected.addTag(null, "Patient111222", "DogLabel");
|
||||||
|
expected.addTag("http://cats", "AllCat", "CatLabel");
|
||||||
assertEquals(expected, actual);
|
assertEquals(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,15 +256,9 @@ public class TagsServerTest {
|
||||||
|
|
||||||
public static class DummyProvider {
|
public static class DummyProvider {
|
||||||
|
|
||||||
@AddTags(type = Patient.class)
|
|
||||||
public void addTagsPatient(@IdParam IdDt theId, @VersionIdParam IdDt theVersion, @TagListParam TagList theTagList) {
|
|
||||||
ourLastOutcome = "add" + theId.getIdPart() + theVersion.getVersionIdPart();
|
|
||||||
ourLastTagList=theTagList;
|
|
||||||
}
|
|
||||||
|
|
||||||
@AddTags(type = Patient.class)
|
@AddTags(type = Patient.class)
|
||||||
public void addTagsPatient(@IdParam IdDt theId, @TagListParam TagList theTagList) {
|
public void addTagsPatient(@IdParam IdDt theId, @TagListParam TagList theTagList) {
|
||||||
ourLastOutcome = "add" + theId.getIdPart();
|
ourLastOutcome = "add" + theId.getIdPart() + StringUtils.defaultString(theId.getVersionIdPart());
|
||||||
ourLastTagList=theTagList;
|
ourLastTagList=theTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,13 +286,13 @@ public class TagsServerTest {
|
||||||
return tagList;
|
return tagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetTags(type = Patient.class)
|
// @GetTags(type = Patient.class)
|
||||||
public TagList getAllTagsPatientIdVersion(@IdParam IdDt theId, @VersionIdParam IdDt theVersion) {
|
// public TagList getAllTagsPatientIdVersion(@IdParam IdDt theId, @VersionIdParam IdDt theVersion) {
|
||||||
TagList tagList = new TagList();
|
// TagList tagList = new TagList();
|
||||||
tagList.add(new Tag((String) null, "Patient" + theId.getIdPart() + theVersion.getVersionIdPart(), "DogLabel"));
|
// tagList.add(new Tag((String) null, "Patient" + theId.getIdPart() + theVersion.getVersionIdPart(), "DogLabel"));
|
||||||
tagList.add(new Tag("http://cats", "AllCat", "CatLabel"));
|
// tagList.add(new Tag("http://cats", "AllCat", "CatLabel"));
|
||||||
return tagList;
|
// return tagList;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@GetTags(type = Observation.class)
|
@GetTags(type = Observation.class)
|
||||||
public TagList getAllTagsObservationIdVersion(@IdParam IdDt theId) {
|
public TagList getAllTagsObservationIdVersion(@IdParam IdDt theId) {
|
||||||
|
@ -313,15 +302,15 @@ public class TagsServerTest {
|
||||||
return tagList;
|
return tagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@DeleteTags(type = Patient.class)
|
// @DeleteTags(type = Patient.class)
|
||||||
public void RemoveTagsPatient(@IdParam IdDt theId, @VersionIdParam IdDt theVersion, @TagListParam TagList theTagList) {
|
// public void RemoveTagsPatient(@IdParam IdDt theId, @VersionIdParam IdDt theVersion, @TagListParam TagList theTagList) {
|
||||||
ourLastOutcome = "Remove" + theId.getIdPart() + theVersion.getVersionIdPart();
|
// ourLastOutcome = "Remove" + theId.getIdPart() + theVersion.getVersionIdPart();
|
||||||
ourLastTagList=theTagList;
|
// ourLastTagList=theTagList;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@DeleteTags(type = Patient.class)
|
@DeleteTags(type = Patient.class)
|
||||||
public void RemoveTagsPatient(@IdParam IdDt theId, @TagListParam TagList theTagList) {
|
public void RemoveTagsPatient(@IdParam IdDt theId, @TagListParam TagList theTagList) {
|
||||||
ourLastOutcome = "Remove" + theId.getIdPart();
|
ourLastOutcome = "Remove" + theId.getIdPart()+StringUtils.defaultString(theId.getVersionIdPart());
|
||||||
ourLastTagList=theTagList;
|
ourLastTagList=theTagList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,6 +69,7 @@ public class UpdateTest {
|
||||||
|
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertEquals("http://localhost:" + ourPort + "/Patient/001/_history/002", status.getFirstHeader("location").getValue());
|
assertEquals("http://localhost:" + ourPort + "/Patient/001/_history/002", status.getFirstHeader("location").getValue());
|
||||||
|
assertEquals("http://localhost:" + ourPort + "/Patient/001/_history/002", status.getFirstHeader("content-location").getValue());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,23 +142,25 @@ public class UpdateTest {
|
||||||
dr.addCodedDiagnosis().addCoding().setCode("AAA");
|
dr.addCodedDiagnosis().addCoding().setCode("AAA");
|
||||||
|
|
||||||
HttpPut httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
HttpPut httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
||||||
httpPost.addHeader("Category", "Dog, Cat");
|
httpPost.addHeader("Category", "Dog; scheme=\"urn:animals\", Cat; scheme=\"urn:animals\"");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
CloseableHttpResponse status = ourClient.execute(httpPost);
|
CloseableHttpResponse status = ourClient.execute(httpPost);
|
||||||
assertEquals(2, ourReportProvider.getLastTags().size());
|
|
||||||
assertEquals(new Tag("Dog"), ourReportProvider.getLastTags().get(0));
|
|
||||||
assertEquals(new Tag("Cat"), ourReportProvider.getLastTags().get(1));
|
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
|
assertEquals(2, ourReportProvider.getLastTags().size());
|
||||||
|
assertEquals(new Tag("urn:animals", "Dog"), ourReportProvider.getLastTags().get(0));
|
||||||
|
assertEquals(new Tag("urn:animals", "Cat"), ourReportProvider.getLastTags().get(1));
|
||||||
|
|
||||||
httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
||||||
httpPost.addHeader("Category", "Dog; label=\"aa\", Cat; label=\"bb\"");
|
httpPost.addHeader("Category", "Dog; label=\"aa\"; scheme=\"urn:animals\", Cat; label=\"bb\"; scheme=\"urn:animals\"");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
status = ourClient.execute(httpPost);
|
status = ourClient.execute(httpPost);
|
||||||
assertEquals(2, ourReportProvider.getLastTags().size());
|
|
||||||
assertEquals(new Tag((String) null, "Dog", "aa"), ourReportProvider.getLastTags().get(0));
|
|
||||||
assertEquals(new Tag((String) null, "Cat", "bb"), ourReportProvider.getLastTags().get(1));
|
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
|
assertEquals(2, ourReportProvider.getLastTags().size());
|
||||||
|
assertEquals(new Tag("urn:animals", "Dog", "aa"), ourReportProvider.getLastTags().get(0));
|
||||||
|
assertEquals(new Tag("urn:animals", "Cat", "bb"), ourReportProvider.getLastTags().get(1));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -167,13 +170,14 @@ public class UpdateTest {
|
||||||
dr.addCodedDiagnosis().addCoding().setCode("AAA");
|
dr.addCodedDiagnosis().addCoding().setCode("AAA");
|
||||||
|
|
||||||
HttpPut httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
HttpPut httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
||||||
httpPost.addHeader("Category", "Dog");
|
httpPost.addHeader("Category", "Dog; scheme=\"animals\"");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
CloseableHttpResponse status = ourClient.execute(httpPost);
|
CloseableHttpResponse status = ourClient.execute(httpPost);
|
||||||
assertEquals(1, ourReportProvider.getLastTags().size());
|
|
||||||
assertEquals(new Tag("Dog"), ourReportProvider.getLastTags().get(0));
|
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
|
assertEquals(1, ourReportProvider.getLastTags().size());
|
||||||
|
assertEquals(new Tag("animals", "Dog"), ourReportProvider.getLastTags().get(0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -186,17 +190,19 @@ public class UpdateTest {
|
||||||
httpPost.addHeader("Category", "Dog; scheme=\"http://foo\"");
|
httpPost.addHeader("Category", "Dog; scheme=\"http://foo\"");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
CloseableHttpResponse status = ourClient.execute(httpPost);
|
CloseableHttpResponse status = ourClient.execute(httpPost);
|
||||||
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
assertEquals(1, ourReportProvider.getLastTags().size());
|
assertEquals(1, ourReportProvider.getLastTags().size());
|
||||||
assertEquals(new Tag("http://foo", "Dog", null), ourReportProvider.getLastTags().get(0));
|
assertEquals(new Tag("http://foo", "Dog", null), ourReportProvider.getLastTags().get(0));
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
|
||||||
|
|
||||||
httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
httpPost = new HttpPut("http://localhost:" + ourPort + "/DiagnosticReport/001");
|
||||||
httpPost.addHeader("Category", "Dog; scheme=\"http://foo\";");
|
httpPost.addHeader("Category", "Dog; scheme=\"http://foo\";");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
ourClient.execute(httpPost);
|
ourClient.execute(httpPost);
|
||||||
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
assertEquals(1, ourReportProvider.getLastTags().size());
|
assertEquals(1, ourReportProvider.getLastTags().size());
|
||||||
assertEquals(new Tag("http://foo", "Dog", null), ourReportProvider.getLastTags().get(0));
|
assertEquals(new Tag("http://foo", "Dog", null), ourReportProvider.getLastTags().get(0));
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -218,9 +224,10 @@ public class UpdateTest {
|
||||||
httpPost.addHeader("Category", "Dog; scheme=\"http://foo\"; label=\"aaaa\"; ");
|
httpPost.addHeader("Category", "Dog; scheme=\"http://foo\"; label=\"aaaa\"; ");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(dr), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
status=ourClient.execute(httpPost);
|
status=ourClient.execute(httpPost);
|
||||||
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
assertEquals(1, ourReportProvider.getLastTags().size());
|
assertEquals(1, ourReportProvider.getLastTags().size());
|
||||||
assertEquals(new Tag("http://foo", "Dog", "aaaa"), ourReportProvider.getLastTags().get(0));
|
assertEquals(new Tag("http://foo", "Dog", "aaaa"), ourReportProvider.getLastTags().get(0));
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +242,7 @@ public class UpdateTest {
|
||||||
httpPut.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPut.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
|
|
||||||
HttpResponse status = ourClient.execute(httpPut);
|
HttpResponse status = ourClient.execute(httpPut);
|
||||||
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
// String responseContent =
|
// String responseContent =
|
||||||
// IOUtils.toString(status.getEntity().getContent());
|
// IOUtils.toString(status.getEntity().getContent());
|
||||||
|
@ -242,7 +250,6 @@ public class UpdateTest {
|
||||||
|
|
||||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
assertEquals("http://localhost:" + ourPort + "/DiagnosticReport/001/_history/002", status.getFirstHeader("Location").getValue());
|
assertEquals("http://localhost:" + ourPort + "/DiagnosticReport/001/_history/002", status.getFirstHeader("Location").getValue());
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,11 +264,12 @@ public class UpdateTest {
|
||||||
httpPut.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPut.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
|
|
||||||
CloseableHttpResponse status = ourClient.execute(httpPut);
|
CloseableHttpResponse status = ourClient.execute(httpPut);
|
||||||
assertEquals(400, status.getStatusLine().getStatusCode());
|
|
||||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||||
ourLog.info("Response was:\n{}", responseContent);
|
|
||||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
|
||||||
|
assertEquals(400, status.getStatusLine().getStatusCode());
|
||||||
|
ourLog.info("Response was:\n{}", responseContent);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testUpdateWrongResourceType() throws Exception {
|
public void testUpdateWrongResourceType() throws Exception {
|
||||||
|
@ -289,9 +297,11 @@ public class UpdateTest {
|
||||||
HttpPut httpPost = new HttpPut("http://localhost:" + ourPort + "/Organization/001");
|
HttpPut httpPost = new HttpPut("http://localhost:" + ourPort + "/Organization/001");
|
||||||
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
httpPost.setEntity(new StringEntity(new FhirContext().newXmlParser().encodeResourceToString(patient), ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||||
|
|
||||||
CloseableHttpResponse response = ourClient.execute(httpPost);
|
CloseableHttpResponse status = ourClient.execute(httpPost);
|
||||||
assertEquals(200, response.getStatusLine().getStatusCode());
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
response.close();
|
|
||||||
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
status.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -376,6 +386,7 @@ public class UpdateTest {
|
||||||
return Observation.class;
|
return Observation.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@Update()
|
@Update()
|
||||||
public MethodOutcome updateDiagnosticReportWithVersion(@IdParam IdDt theId, @ResourceParam DiagnosticOrder thePatient) {
|
public MethodOutcome updateDiagnosticReportWithVersion(@IdParam IdDt theId, @ResourceParam DiagnosticOrder thePatient) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -92,6 +92,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException;
|
||||||
import ca.uhn.fhir.util.FhirTerser;
|
import ca.uhn.fhir.util.FhirTerser;
|
||||||
|
import ca.uhn.fhir.util.ObjectUtil;
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRED)
|
@Transactional(propagation = Propagation.REQUIRED)
|
||||||
public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements IFhirResourceDao<T> {
|
public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements IFhirResourceDao<T> {
|
||||||
|
@ -117,7 +118,7 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
}
|
}
|
||||||
|
|
||||||
for (BaseTag next : new ArrayList<BaseTag>(entity.getTags())) {
|
for (BaseTag next : new ArrayList<BaseTag>(entity.getTags())) {
|
||||||
if (next.getTag().getScheme().equals(theScheme) && next.getTag().getTerm().equals(theTerm)) {
|
if (ObjectUtil.equals(next.getTag().getScheme(), theScheme) && ObjectUtil.equals(next.getTag().getTerm(), theTerm)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
|
|
||||||
if (theResource.getId().isEmpty() == false) {
|
if (theResource.getId().isEmpty() == false) {
|
||||||
if (isValidPid(theResource.getId())) {
|
if (isValidPid(theResource.getId())) {
|
||||||
throw new UnprocessableEntityException("This server cannot create an entity with a user-specified numeric ID - Client should not specify an ID when creating a new resource, or should include at least one letter in the ID to force a client-defined ID");
|
throw new UnprocessableEntityException(
|
||||||
|
"This server cannot create an entity with a user-specified numeric ID - Client should not specify an ID when creating a new resource, or should include at least one letter in the ID to force a client-defined ID");
|
||||||
}
|
}
|
||||||
createForcedIdIfNeeded(entity, theResource.getId());
|
createForcedIdIfNeeded(entity, theResource.getId());
|
||||||
|
|
||||||
|
@ -229,7 +231,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
|
|
||||||
final T current = currentTmp;
|
final T current = currentTmp;
|
||||||
|
|
||||||
String querySring = "SELECT count(h) FROM ResourceHistoryTable h " + "WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE" + " AND h.myUpdated < :END" + (theSince != null ? " AND h.myUpdated >= :SINCE" : "");
|
String querySring = "SELECT count(h) FROM ResourceHistoryTable h " + "WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE" + " AND h.myUpdated < :END"
|
||||||
|
+ (theSince != null ? " AND h.myUpdated >= :SINCE" : "");
|
||||||
TypedQuery<Long> countQuery = myEntityManager.createQuery(querySring, Long.class);
|
TypedQuery<Long> countQuery = myEntityManager.createQuery(querySring, Long.class);
|
||||||
countQuery.setParameter("PID", translateForcedIdToPid(theId));
|
countQuery.setParameter("PID", translateForcedIdToPid(theId));
|
||||||
countQuery.setParameter("RESTYPE", resourceType);
|
countQuery.setParameter("RESTYPE", resourceType);
|
||||||
|
@ -267,8 +270,9 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
retVal.add(current);
|
retVal.add(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedQuery<ResourceHistoryTable> q = myEntityManager.createQuery("SELECT h FROM ResourceHistoryTable h WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE AND h.myUpdated < :END " + (theSince != null ? " AND h.myUpdated >= :SINCE" : "")
|
TypedQuery<ResourceHistoryTable> q = myEntityManager.createQuery(
|
||||||
+ " ORDER BY h.myUpdated ASC", ResourceHistoryTable.class);
|
"SELECT h FROM ResourceHistoryTable h WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE AND h.myUpdated < :END "
|
||||||
|
+ (theSince != null ? " AND h.myUpdated >= :SINCE" : "") + " ORDER BY h.myUpdated ASC", ResourceHistoryTable.class);
|
||||||
q.setParameter("PID", translateForcedIdToPid(theId));
|
q.setParameter("PID", translateForcedIdToPid(theId));
|
||||||
q.setParameter("RESTYPE", resourceType);
|
q.setParameter("RESTYPE", resourceType);
|
||||||
q.setParameter("END", end.getValue(), TemporalType.TIMESTAMP);
|
q.setParameter("END", end.getValue(), TemporalType.TIMESTAMP);
|
||||||
|
@ -317,7 +321,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
throw new ConfigurationException("Unknown search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "]");
|
throw new ConfigurationException("Unknown search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "]");
|
||||||
}
|
}
|
||||||
if (sp.getParamType() != SearchParamTypeEnum.TOKEN) {
|
if (sp.getParamType() != SearchParamTypeEnum.TOKEN) {
|
||||||
throw new ConfigurationException("Search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "] is not a token type, only token is supported");
|
throw new ConfigurationException("Search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName
|
||||||
|
+ "] is not a token type, only token is supported");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +361,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
|
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
if (theId.hasVersionIdPart()) {
|
if (theId.hasVersionIdPart()) {
|
||||||
TypedQuery<ResourceHistoryTable> q = myEntityManager.createQuery("SELECT t from ResourceHistoryTable t WHERE t.myResourceId = :RID AND t.myResourceType = :RTYP AND t.myResourceVersion = :RVER", ResourceHistoryTable.class);
|
TypedQuery<ResourceHistoryTable> q = myEntityManager.createQuery(
|
||||||
|
"SELECT t from ResourceHistoryTable t WHERE t.myResourceId = :RID AND t.myResourceType = :RTYP AND t.myResourceVersion = :RVER", ResourceHistoryTable.class);
|
||||||
q.setParameter("RID", pid);
|
q.setParameter("RID", pid);
|
||||||
q.setParameter("RTYP", myResourceName);
|
q.setParameter("RTYP", myResourceName);
|
||||||
q.setParameter("RVER", theId.getVersionIdPartAsLong());
|
q.setParameter("RVER", theId.getVersionIdPartAsLong());
|
||||||
|
@ -532,7 +538,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
|
|
||||||
if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) {
|
if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) {
|
||||||
OperationOutcome oo = new OperationOutcome();
|
OperationOutcome oo = new OperationOutcome();
|
||||||
oo.addIssue().setSeverity(IssueSeverityEnum.WARNING).setDetails("Not all _include resources were actually included as the request surpassed the limit of " + getConfig().getIncludeLimit() + " resources");
|
oo.addIssue().setSeverity(IssueSeverityEnum.WARNING)
|
||||||
|
.setDetails("Not all _include resources were actually included as the request surpassed the limit of " + getConfig().getIncludeLimit() + " resources");
|
||||||
retVal.add(0, oo);
|
retVal.add(0, oo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -704,8 +711,7 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If set, the given param will be treated as a secondary primary key, and multiple resources will not be able to
|
* If set, the given param will be treated as a secondary primary key, and multiple resources will not be able to share the same value.
|
||||||
* share the same value.
|
|
||||||
*/
|
*/
|
||||||
public void setSecondaryPrimaryKeyParamName(String theSecondaryPrimaryKeyParamName) {
|
public void setSecondaryPrimaryKeyParamName(String theSecondaryPrimaryKeyParamName) {
|
||||||
mySecondaryPrimaryKeyParamName = theSecondaryPrimaryKeyParamName;
|
mySecondaryPrimaryKeyParamName = theSecondaryPrimaryKeyParamName;
|
||||||
|
@ -1294,7 +1300,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Predicate createPredicateString(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder, From<ResourceIndexedSearchParamString, ResourceIndexedSearchParamString> theFrom) {
|
private Predicate createPredicateString(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder,
|
||||||
|
From<ResourceIndexedSearchParamString, ResourceIndexedSearchParamString> theFrom) {
|
||||||
String rawSearchTerm;
|
String rawSearchTerm;
|
||||||
if (theParameter instanceof TokenParam) {
|
if (theParameter instanceof TokenParam) {
|
||||||
TokenParam id = (TokenParam) theParameter;
|
TokenParam id = (TokenParam) theParameter;
|
||||||
|
@ -1313,7 +1320,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rawSearchTerm.length() > ResourceIndexedSearchParamString.MAX_LENGTH) {
|
if (rawSearchTerm.length() > ResourceIndexedSearchParamString.MAX_LENGTH) {
|
||||||
throw new InvalidRequestException("Parameter[" + theParamName + "] has length (" + rawSearchTerm.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamString.MAX_LENGTH + "): " + rawSearchTerm);
|
throw new InvalidRequestException("Parameter[" + theParamName + "] has length (" + rawSearchTerm.length() + ") that is longer than maximum allowed ("
|
||||||
|
+ ResourceIndexedSearchParamString.MAX_LENGTH + "): " + rawSearchTerm);
|
||||||
}
|
}
|
||||||
|
|
||||||
String likeExpression = normalizeString(rawSearchTerm);
|
String likeExpression = normalizeString(rawSearchTerm);
|
||||||
|
@ -1327,7 +1335,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
return singleCode;
|
return singleCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Predicate createPredicateToken(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder, From<ResourceIndexedSearchParamToken, ResourceIndexedSearchParamToken> theFrom) {
|
private Predicate createPredicateToken(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder,
|
||||||
|
From<ResourceIndexedSearchParamToken, ResourceIndexedSearchParamToken> theFrom) {
|
||||||
String code;
|
String code;
|
||||||
String system;
|
String system;
|
||||||
if (theParameter instanceof TokenParam) {
|
if (theParameter instanceof TokenParam) {
|
||||||
|
@ -1347,10 +1356,12 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
}
|
}
|
||||||
|
|
||||||
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
|
if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
|
||||||
throw new InvalidRequestException("Parameter[" + theParamName + "] has system (" + system.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + system);
|
throw new InvalidRequestException("Parameter[" + theParamName + "] has system (" + system.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH
|
||||||
|
+ "): " + system);
|
||||||
}
|
}
|
||||||
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
|
if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) {
|
||||||
throw new InvalidRequestException("Parameter[" + theParamName + "] has code (" + code.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + code);
|
throw new InvalidRequestException("Parameter[" + theParamName + "] has code (" + code.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH
|
||||||
|
+ "): " + code);
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayList<Predicate> singleCodePredicates = (new ArrayList<Predicate>());
|
ArrayList<Predicate> singleCodePredicates = (new ArrayList<Predicate>());
|
||||||
|
@ -1499,7 +1510,8 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
|
||||||
|
|
||||||
private void validateResourceType(BaseHasResource entity) {
|
private void validateResourceType(BaseHasResource entity) {
|
||||||
if (!myResourceName.equals(entity.getResourceType())) {
|
if (!myResourceName.equals(entity.getResourceType())) {
|
||||||
throw new ResourceNotFoundException("Resource with ID " + entity.getIdDt().getIdPart() + " exists but it is not of type " + myResourceName + ", found resource of type " + entity.getResourceType());
|
throw new ResourceNotFoundException("Resource with ID " + entity.getIdDt().getIdPart() + " exists but it is not of type " + myResourceName + ", found resource of type "
|
||||||
|
+ entity.getResourceType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1189,14 +1189,17 @@ public class FhirResourceDaoTest {
|
||||||
patient.addName().addFamily("Tester").addGiven("Joe");
|
patient.addName().addFamily("Tester").addGiven("Joe");
|
||||||
TagList tagList = new TagList();
|
TagList tagList = new TagList();
|
||||||
tagList.addTag(null, "Dog", "Puppies");
|
tagList.addTag(null, "Dog", "Puppies");
|
||||||
|
// Add this twice
|
||||||
|
tagList.addTag("http://foo", "Cat", "Kittens");
|
||||||
tagList.addTag("http://foo", "Cat", "Kittens");
|
tagList.addTag("http://foo", "Cat", "Kittens");
|
||||||
patient.getResourceMetadata().put(ResourceMetadataKeyEnum.TAG_LIST, tagList);
|
patient.getResourceMetadata().put(ResourceMetadataKeyEnum.TAG_LIST, tagList);
|
||||||
|
|
||||||
MethodOutcome outcome = ourPatientDao.create(patient);
|
MethodOutcome outcome = ourPatientDao.create(patient);
|
||||||
assertNotNull(outcome.getId());
|
IdDt patientId = outcome.getId();
|
||||||
assertFalse(outcome.getId().isEmpty());
|
assertNotNull(patientId);
|
||||||
|
assertFalse(patientId.isEmpty());
|
||||||
|
|
||||||
Patient retrieved = ourPatientDao.read(outcome.getId());
|
Patient retrieved = ourPatientDao.read(patientId);
|
||||||
TagList published = (TagList) retrieved.getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST);
|
TagList published = (TagList) retrieved.getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST);
|
||||||
assertEquals(2, published.size());
|
assertEquals(2, published.size());
|
||||||
assertEquals("Dog", published.get(0).getTerm());
|
assertEquals("Dog", published.get(0).getTerm());
|
||||||
|
@ -1217,6 +1220,23 @@ public class FhirResourceDaoTest {
|
||||||
assertEquals("Kittens", published.get(1).getLabel());
|
assertEquals("Kittens", published.get(1).getLabel());
|
||||||
assertEquals("http://foo", published.get(1).getScheme());
|
assertEquals("http://foo", published.get(1).getScheme());
|
||||||
|
|
||||||
|
ourPatientDao.addTag(patientId, "http://foo", "Cat", "Kittens");
|
||||||
|
ourPatientDao.addTag(patientId, "http://foo", "Cow", "Calves");
|
||||||
|
|
||||||
|
retrieved = ourPatientDao.read(patientId);
|
||||||
|
published = (TagList) retrieved.getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST);
|
||||||
|
assertEquals(3, published.size());
|
||||||
|
assertEquals("Dog", published.get(0).getTerm());
|
||||||
|
assertEquals("Puppies", published.get(0).getLabel());
|
||||||
|
assertEquals(null, published.get(0).getScheme());
|
||||||
|
assertEquals("Cat", published.get(1).getTerm());
|
||||||
|
assertEquals("Kittens", published.get(1).getLabel());
|
||||||
|
assertEquals("http://foo", published.get(1).getScheme());
|
||||||
|
assertEquals("Cow", published.get(2).getTerm());
|
||||||
|
assertEquals("Calves", published.get(2).getLabel());
|
||||||
|
assertEquals("http://foo", published.get(2).getScheme());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
16
pom.xml
16
pom.xml
|
@ -46,13 +46,17 @@
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
|
<id>jamesagnew</id>
|
||||||
<name>James Agnew</name>
|
<name>James Agnew</name>
|
||||||
|
<organization>University Health Network</organization>
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<name>Dmitri Sotnikov</name>
|
<name>Dmitri Sotnikov</name>
|
||||||
|
<organization>University Health Network</organization>
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<name>Lisa Wong</name>
|
<name>Lisa Wong</name>
|
||||||
|
<organization>University Health Network</organization>
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<name>Josh Mandel</name>
|
<name>Josh Mandel</name>
|
||||||
|
@ -60,6 +64,11 @@
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<name>Laura MacDougall Sookraj</name>
|
<name>Laura MacDougall Sookraj</name>
|
||||||
|
<organization>University Health Network</organization>
|
||||||
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<name>Neal Acharya</name>
|
||||||
|
<organization>University Health Network</organization>
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<name>David Hay</name>
|
<name>David Hay</name>
|
||||||
|
@ -68,13 +77,17 @@
|
||||||
<developer>
|
<developer>
|
||||||
<id>suranga</id>
|
<id>suranga</id>
|
||||||
<name>Suranga Nath Kasthurirathne</name>
|
<name>Suranga Nath Kasthurirathne</name>
|
||||||
<organization>OpenMRS</organization>
|
<organization>OpenMRS / Regenstrief Center for Biomedical Informatics</organization>
|
||||||
</developer>
|
</developer>
|
||||||
<developer>
|
<developer>
|
||||||
<id>dougmartin</id>
|
<id>dougmartin</id>
|
||||||
<name>Doug Martin</name>
|
<name>Doug Martin</name>
|
||||||
<organization>Regenstrief Center for Biomedical Informatics</organization>
|
<organization>Regenstrief Center for Biomedical Informatics</organization>
|
||||||
</developer>
|
</developer>
|
||||||
|
<developer>
|
||||||
|
<id>akley</id>
|
||||||
|
<name>Alexander Kley</name>
|
||||||
|
</developer>
|
||||||
</developers>
|
</developers>
|
||||||
|
|
||||||
<licenses>
|
<licenses>
|
||||||
|
@ -150,6 +163,7 @@
|
||||||
<configuration>
|
<configuration>
|
||||||
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
<redirectTestOutputToFile>true</redirectTestOutputToFile>
|
||||||
<runOrder>random</runOrder>
|
<runOrder>random</runOrder>
|
||||||
|
<!--<argLine>-Dfile.encoding=ISO-8859-1</argLine>-->
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
<groupId>ca.uhn.hapi.example</groupId>
|
<groupId>ca.uhn.hapi.example</groupId>
|
||||||
<artifactId>restful-server-example</artifactId>
|
<artifactId>restful-server-example</artifactId>
|
||||||
<version>0.7-SNAPSHOT</version>
|
<version>0.8-SNAPSHOT</version>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
||||||
<name>HAPI FHIR Sample RESTful Server</name>
|
<name>HAPI FHIR Sample RESTful Server</name>
|
||||||
|
|
Loading…
Reference in New Issue