Merge branch 'master' of github.com:jamesagnew/hapi-fhir
This commit is contained in:
commit
914f615b8e
|
@ -0,0 +1,65 @@
|
|||
package example;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.RelatedPerson;
|
||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
|
||||
/**
|
||||
* @author Bill de Beaubien on 1/13/2016.
|
||||
*/
|
||||
public class BundleFetcher {
|
||||
public static void fetchRestOfBundle(IGenericClient theClient, Bundle theBundle) {
|
||||
// we need to keep track of which resources are already in the bundle so that if other resources (e.g. Practitioner) are _included,
|
||||
// we don't end up with multiple copies
|
||||
Set<String> resourcesAlreadyAdded = new HashSet<String>();
|
||||
addInitialUrlsToSet(theBundle, resourcesAlreadyAdded);
|
||||
Bundle partialBundle = theBundle;
|
||||
for (;;) {
|
||||
if (partialBundle.getLink(IBaseBundle.LINK_NEXT) != null) {
|
||||
partialBundle = theClient.loadPage().next(partialBundle).execute();
|
||||
addAnyResourcesNotAlreadyPresentToBundle(theBundle, partialBundle, resourcesAlreadyAdded);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
// the self and next links for the aggregated bundle aren't really valid anymore, so remove them
|
||||
theBundle.getLink().clear();
|
||||
}
|
||||
|
||||
private static void addInitialUrlsToSet(Bundle theBundle, Set<String> theResourcesAlreadyAdded) {
|
||||
for (Bundle.Entry entry : theBundle.getEntry()) {
|
||||
theResourcesAlreadyAdded.add(entry.getFullUrl());
|
||||
}
|
||||
}
|
||||
|
||||
private static void addAnyResourcesNotAlreadyPresentToBundle(Bundle theAggregatedBundle, Bundle thePartialBundle, Set<String> theResourcesAlreadyAdded) {
|
||||
for (Bundle.Entry entry : thePartialBundle.getEntry()) {
|
||||
if (!theResourcesAlreadyAdded.contains(entry.getFullUrl())) {
|
||||
theResourcesAlreadyAdded.add(entry.getFullUrl());
|
||||
theAggregatedBundle.getEntry().add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
FhirContext ctx = FhirContext.forDstu2();
|
||||
String serverBase = "http://fhirtest.uhn.ca/baseDstu2";
|
||||
IGenericClient client = ctx.newRestfulGenericClient(serverBase);
|
||||
// use RelatedPerson because there aren't that many on the server
|
||||
Bundle bundle = client.search().forResource(RelatedPerson.class).returnBundle(Bundle.class).execute();
|
||||
BundleFetcher.fetchRestOfBundle(client, bundle);
|
||||
if (bundle.getTotal() != bundle.getEntry().size()) {
|
||||
System.out.println("Counts didn't match! Expected " + bundle.getTotal() + " but bundle only had " + bundle.getEntry().size() + " entries!");
|
||||
}
|
||||
|
||||
// IParser parser = ctx.newXmlParser().setPrettyPrint(true);
|
||||
// System.out.println(parser.encodeResourceToString(bundle));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
|
@ -14,6 +13,9 @@
|
|||
|
||||
<name>HAPI FHIR - Deployable Artifact Parent POM</name>
|
||||
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
|
@ -53,7 +55,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||
<version>${maven_project_info_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
|
@ -61,7 +62,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${maven_javadoc_plugin_version}</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<id>default</id>
|
||||
|
@ -110,7 +110,6 @@
|
|||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven_source_plugin_version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
|
@ -123,7 +122,6 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>license-maven-plugin</artifactId>
|
||||
<version>${maven_license_plugin_version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>first</id>
|
||||
|
|
|
@ -46,6 +46,13 @@ public enum TemporalPrecisionEnum {
|
|||
return DateUtils.addDays(theInput, theAmount);
|
||||
}
|
||||
},
|
||||
MINUTE(Calendar.MINUTE) {
|
||||
@Override
|
||||
public Date add(Date theInput, int theAmount) {
|
||||
return DateUtils.addMinutes(theInput, theAmount);
|
||||
}
|
||||
|
||||
},
|
||||
SECOND(Calendar.SECOND) {
|
||||
@Override
|
||||
public Date add(Date theInput, int theAmount) {
|
||||
|
@ -58,7 +65,7 @@ public enum TemporalPrecisionEnum {
|
|||
public Date add(Date theInput, int theAmount) {
|
||||
return DateUtils.addMilliseconds(theInput, theAmount);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
;
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
private static final FastDateFormat ourHumanDateFormat = FastDateFormat.getDateInstance(FastDateFormat.MEDIUM);
|
||||
private static final Pattern ourYearMonthPattern = Pattern.compile("[0-9]{4}[0-9]{2}");
|
||||
private static final Pattern ourYearPattern = Pattern.compile("[0-9]{4}");
|
||||
private static final FastDateFormat ourYearMonthDayTimeMinsFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm");
|
||||
private static final FastDateFormat ourYearMonthDayTimeMinsZoneFormat = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mmZZ");
|
||||
|
||||
static {
|
||||
ArrayList<FastDateFormat> formatters = new ArrayList<FastDateFormat>();
|
||||
|
@ -185,36 +187,40 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
|
|||
if (theValue == null) {
|
||||
return null;
|
||||
} else {
|
||||
GregorianCalendar cal;
|
||||
if (myTimeZoneZulu) {
|
||||
cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
} else if (myTimeZone != null) {
|
||||
cal = new GregorianCalendar(myTimeZone);
|
||||
} else {
|
||||
cal = new GregorianCalendar();
|
||||
}
|
||||
cal.setTime(theValue);
|
||||
|
||||
switch (myPrecision) {
|
||||
case DAY:
|
||||
return ourYearMonthDayFormat.format(theValue);
|
||||
return ourYearMonthDayFormat.format(cal);
|
||||
case MONTH:
|
||||
return ourYearMonthFormat.format(theValue);
|
||||
return ourYearMonthFormat.format(cal);
|
||||
case YEAR:
|
||||
return ourYearFormat.format(theValue);
|
||||
return ourYearFormat.format(cal);
|
||||
case MINUTE:
|
||||
if (myTimeZoneZulu) {
|
||||
return ourYearMonthDayTimeMinsFormat.format(cal) + "Z";
|
||||
} else {
|
||||
return ourYearMonthDayTimeMinsZoneFormat.format(cal);
|
||||
}
|
||||
case SECOND:
|
||||
if (myTimeZoneZulu) {
|
||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeFormat.format(cal) + "Z";
|
||||
} else if (myTimeZone != null) {
|
||||
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeZoneFormat.format(cal);
|
||||
} else {
|
||||
return ourYearMonthDayTimeFormat.format(theValue);
|
||||
return ourYearMonthDayTimeZoneFormat.format(cal);
|
||||
}
|
||||
case MILLI:
|
||||
if (myTimeZoneZulu) {
|
||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeMilliFormat.format(cal) + "Z";
|
||||
} else if (myTimeZone != null) {
|
||||
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeMilliZoneFormat.format(cal);
|
||||
} else {
|
||||
return ourYearMonthDayTimeMilliFormat.format(theValue);
|
||||
return ourYearMonthDayTimeMilliZoneFormat.format(cal);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Invalid precision (this is a HAPI bug, shouldn't happen): " + myPrecision);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
|
@ -21,6 +23,8 @@ package ca.uhn.fhir.model.primitive;
|
|||
*/
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
@ -34,6 +38,17 @@ import ca.uhn.fhir.parser.DataFormatException;
|
|||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* </ul>
|
||||
*
|
||||
* <p>
|
||||
* <b>Note on using Java Date objects:</b> This type stores the date as a Java Date. Note that
|
||||
* the Java Date has more precision (millisecond precision), and does not store a timezone. As such,
|
||||
* it could potentially cause issues. For example, if a Date contains the number of milliseconds at
|
||||
* midnight in a timezone across the date line from your location, it might refer to a different date than
|
||||
* intended.
|
||||
* </p>
|
||||
* <p>
|
||||
* As such, it is recommended to use the <code>Calendar<code> or <code>int,int,int</code> constructors
|
||||
* </p>
|
||||
*/
|
||||
@DatatypeDef(name = "date")
|
||||
public class DateDt extends BaseDateTimeDt {
|
||||
|
@ -51,7 +66,17 @@ public class DateDt extends BaseDateTimeDt {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
|
||||
*/
|
||||
public DateDt(Calendar theCalendar) {
|
||||
super(theCalendar.getTime(), DEFAULT_PRECISION);
|
||||
setTimeZone(theCalendar.getTimeZone());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
|
||||
* <b>Please see the note on timezones</b> on the {@link DateDt class documentation} for considerations
|
||||
* when using this constructor!
|
||||
*/
|
||||
@SimpleSetter(suffix = "WithDayPrecision")
|
||||
public DateDt(@SimpleSetter.Parameter(name = "theDate") Date theDate) {
|
||||
|
@ -65,6 +90,8 @@ public class DateDt extends BaseDateTimeDt {
|
|||
* <li>{@link TemporalPrecisionEnum#MONTH}
|
||||
* <li>{@link TemporalPrecisionEnum#DAY}
|
||||
* </ul>
|
||||
* <b>Please see the note on timezones</b> on the {@link DateDt class documentation} for considerations
|
||||
* when using this constructor!
|
||||
*
|
||||
* @throws DataFormatException
|
||||
* If the specified precision is not allowed for this type
|
||||
|
@ -74,6 +101,17 @@ public class DateDt extends BaseDateTimeDt {
|
|||
super(theDate, thePrecision);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
|
||||
*
|
||||
* @param theYear The year, e.g. 2015
|
||||
* @param theMonth The month, e.g. 0 for January
|
||||
* @param theDay The day (1 indexed) e.g. 1 for the first day of the month
|
||||
*/
|
||||
public DateDt(int theYear, int theMonth, int theDay) {
|
||||
this(toCalendarZulu(theYear, theMonth, theDay));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date as a string in FHIR format
|
||||
*
|
||||
|
@ -84,6 +122,16 @@ public class DateDt extends BaseDateTimeDt {
|
|||
super(theDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default precision for this datatype
|
||||
*
|
||||
* @see #DEFAULT_PRECISION
|
||||
*/
|
||||
@Override
|
||||
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
|
||||
return DEFAULT_PRECISION;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
|
||||
switch (thePrecision) {
|
||||
|
@ -96,14 +144,12 @@ public class DateDt extends BaseDateTimeDt {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default precision for this datatype
|
||||
*
|
||||
* @see #DEFAULT_PRECISION
|
||||
*/
|
||||
@Override
|
||||
protected TemporalPrecisionEnum getDefaultPrecisionForDatatype() {
|
||||
return DEFAULT_PRECISION;
|
||||
private static GregorianCalendar toCalendarZulu(int theYear, int theMonth, int theDay) {
|
||||
GregorianCalendar retVal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
retVal.set(Calendar.YEAR, theYear);
|
||||
retVal.set(Calendar.MONTH, theMonth);
|
||||
retVal.set(Calendar.DATE, theDay);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -47,6 +47,16 @@ public interface IRestfulClientFactory {
|
|||
*/
|
||||
public static final int DEFAULT_SOCKET_TIMEOUT = 10000;
|
||||
|
||||
/**
|
||||
* Default value for {@link #getPoolMaxTotal() ()}
|
||||
*/
|
||||
public static final int DEFAULT_POOL_MAX = 20;
|
||||
|
||||
/**
|
||||
* Default value for {@link #getPoolMaxPerRoute() }
|
||||
*/
|
||||
public static final int DEFAULT_POOL_MAX_PER_ROUTE = DEFAULT_POOL_MAX;
|
||||
|
||||
/**
|
||||
* Gets the connection request timeout, in milliseconds. This is the amount of time that the HTTPClient connection
|
||||
* pool may wait for an available connection before failing. This setting typically does not need to be adjusted.
|
||||
|
@ -99,6 +109,22 @@ public interface IRestfulClientFactory {
|
|||
*/
|
||||
int getSocketTimeout();
|
||||
|
||||
/**
|
||||
* Gets the maximum number of connections allowed in the pool.
|
||||
* <p>
|
||||
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX}
|
||||
* </p>
|
||||
*/
|
||||
int getPoolMaxTotal();
|
||||
|
||||
/**
|
||||
* Gets the maximum number of connections per route allowed in the pool.
|
||||
* <p>
|
||||
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX_PER_ROUTE}
|
||||
* </p>
|
||||
*/
|
||||
int getPoolMaxPerRoute();
|
||||
|
||||
/**
|
||||
* Instantiates a new client instance
|
||||
*
|
||||
|
@ -193,4 +219,19 @@ public interface IRestfulClientFactory {
|
|||
*/
|
||||
void setSocketTimeout(int theSocketTimeout);
|
||||
|
||||
/**
|
||||
* Sets the maximum number of connections allowed in the pool.
|
||||
* <p>
|
||||
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX}
|
||||
* </p>
|
||||
*/
|
||||
void setPoolMaxTotal(int thePoolMaxTotal);
|
||||
|
||||
/**
|
||||
* Sets the maximum number of connections per route allowed in the pool.
|
||||
* <p>
|
||||
* The default value for this setting is defined by {@link #DEFAULT_POOL_MAX_PER_ROUTE}
|
||||
* </p>
|
||||
*/
|
||||
void setPoolMaxPerRoute(int thePoolMaxPerRoute);
|
||||
}
|
||||
|
|
|
@ -68,7 +68,9 @@ public class RestfulClientFactory implements IRestfulClientFactory {
|
|||
private ServerValidationModeEnum myServerValidationMode = DEFAULT_SERVER_VALIDATION_MODE;
|
||||
private int mySocketTimeout = DEFAULT_SOCKET_TIMEOUT;
|
||||
private Set<String> myValidatedServerBaseUrls = Collections.synchronizedSet(new HashSet<String>());
|
||||
|
||||
private int myPoolMaxTotal = DEFAULT_POOL_MAX;
|
||||
private int myPoolMaxPerRoute = DEFAULT_POOL_MAX_PER_ROUTE;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
@ -100,7 +102,9 @@ public class RestfulClientFactory implements IRestfulClientFactory {
|
|||
if (myHttpClient == null) {
|
||||
|
||||
PoolingHttpClientConnectionManager connectionManager = new PoolingHttpClientConnectionManager(5000, TimeUnit.MILLISECONDS);
|
||||
|
||||
connectionManager.setMaxTotal(myPoolMaxTotal);
|
||||
connectionManager.setDefaultMaxPerRoute(myPoolMaxPerRoute);
|
||||
|
||||
//@formatter:off
|
||||
RequestConfig defaultRequestConfig = RequestConfig.custom()
|
||||
.setSocketTimeout(mySocketTimeout)
|
||||
|
@ -149,6 +153,16 @@ public class RestfulClientFactory implements IRestfulClientFactory {
|
|||
return mySocketTimeout;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPoolMaxTotal() {
|
||||
return myPoolMaxTotal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPoolMaxPerRoute() {
|
||||
return myPoolMaxPerRoute;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private <T extends IRestfulClient> T instantiateProxy(Class<T> theClientType, InvocationHandler theInvocationHandler) {
|
||||
T proxy = (T) Proxy.newProxyInstance(theClientType.getClassLoader(), new Class[] { theClientType }, theInvocationHandler);
|
||||
|
@ -276,6 +290,18 @@ public class RestfulClientFactory implements IRestfulClientFactory {
|
|||
myHttpClient = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setPoolMaxTotal(int thePoolMaxTotal) {
|
||||
myPoolMaxTotal = thePoolMaxTotal;
|
||||
myHttpClient = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void setPoolMaxPerRoute(int thePoolMaxPerRoute) {
|
||||
myPoolMaxPerRoute = thePoolMaxPerRoute;
|
||||
myHttpClient = null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
void validateServerBase(String theServerBase, HttpClient theHttpClient, BaseClient theClient) {
|
||||
|
||||
|
|
|
@ -30,12 +30,11 @@ import ca.uhn.fhir.model.api.IQueryParameterType;
|
|||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
||||
public class TokenParam extends BaseParam implements IQueryParameterType {
|
||||
|
||||
private TokenParamModifier myModifier;
|
||||
private String mySystem;
|
||||
private boolean myText;
|
||||
private String myValue;
|
||||
|
||||
/**
|
||||
|
@ -46,8 +45,8 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor which copies the {@link InternalCodingDt#getSystemElement() system} and {@link InternalCodingDt#getCodeElement() code} from a {@link InternalCodingDt} instance and adds it as a
|
||||
* parameter
|
||||
* Constructor which copies the {@link InternalCodingDt#getSystemElement() system} and
|
||||
* {@link InternalCodingDt#getCodeElement() code} from a {@link InternalCodingDt} instance and adds it as a parameter
|
||||
*
|
||||
* @param theCodingDt
|
||||
* The coding
|
||||
|
@ -57,7 +56,8 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
}
|
||||
|
||||
/**
|
||||
* Constructor which copies the {@link BaseIdentifierDt#getSystemElement() system} and {@link BaseIdentifierDt#getValueElement() value} from a {@link BaseIdentifierDt} instance and adds it as a
|
||||
* Constructor which copies the {@link BaseIdentifierDt#getSystemElement() system} and
|
||||
* {@link BaseIdentifierDt#getValueElement() value} from a {@link BaseIdentifierDt} instance and adds it as a
|
||||
* parameter
|
||||
*
|
||||
* @param theIdentifierDt
|
||||
|
@ -74,8 +74,7 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
|
||||
public TokenParam(String theSystem, String theValue, boolean theText) {
|
||||
if (theText && isNotBlank(theSystem)) {
|
||||
throw new IllegalArgumentException(
|
||||
"theSystem can not be non-blank if theText is true (:text searches do not include a system). In other words, set the first parameter to null for a text search");
|
||||
throw new IllegalArgumentException("theSystem can not be non-blank if theText is true (:text searches do not include a system). In other words, set the first parameter to null for a text search");
|
||||
}
|
||||
setSystem(theSystem);
|
||||
setValue(theValue);
|
||||
|
@ -84,8 +83,8 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
|
||||
@Override
|
||||
String doGetQueryParameterQualifier() {
|
||||
if (isText()) {
|
||||
return Constants.PARAMQUALIFIER_TOKEN_TEXT;
|
||||
if (getModifier() != null) {
|
||||
return getModifier().getValue();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
@ -108,25 +107,46 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
*/
|
||||
@Override
|
||||
void doSetValueAsQueryToken(String theQualifier, String theParameter) {
|
||||
setText(Constants.PARAMQUALIFIER_TOKEN_TEXT.equals(theQualifier));
|
||||
setSystem(null);
|
||||
if (theParameter == null) {
|
||||
setValue(null);
|
||||
setModifier(null);
|
||||
if (theQualifier != null) {
|
||||
TokenParamModifier modifier = TokenParamModifier.forValue(theQualifier);
|
||||
setModifier(modifier);
|
||||
setSystem(null);
|
||||
setValue(ParameterUtil.unescape(theParameter));
|
||||
} else {
|
||||
int barIndex = ParameterUtil.nonEscapedIndexOf(theParameter, '|');
|
||||
if (barIndex != -1) {
|
||||
setSystem(theParameter.substring(0, barIndex));
|
||||
setValue(ParameterUtil.unescape(theParameter.substring(barIndex + 1)));
|
||||
setSystem(null);
|
||||
if (theParameter == null) {
|
||||
setValue(null);
|
||||
} else {
|
||||
setValue(ParameterUtil.unescape(theParameter));
|
||||
int barIndex = ParameterUtil.nonEscapedIndexOf(theParameter, '|');
|
||||
if (barIndex != -1) {
|
||||
setSystem(theParameter.substring(0, barIndex));
|
||||
setValue(ParameterUtil.unescape(theParameter.substring(barIndex + 1)));
|
||||
} else {
|
||||
setValue(ParameterUtil.unescape(theParameter));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the modifier for this token
|
||||
*/
|
||||
public TokenParamModifier getModifier() {
|
||||
return myModifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the system for this token. Note that if a {@link #getModifier()} is being used, the entire value of the
|
||||
* parameter will be placed in {@link #getValue() value} and this method will return <code>null</code>.
|
||||
*/
|
||||
public String getSystem() {
|
||||
return mySystem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the value for the token
|
||||
*/
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
@ -143,8 +163,16 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
return StringUtils.isEmpty(myValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if {@link #getModifier()} returns {@link TokenParamModifier#TEXT}
|
||||
*/
|
||||
public boolean isText() {
|
||||
return myText;
|
||||
return myModifier == TokenParamModifier.TEXT;
|
||||
}
|
||||
|
||||
public TokenParam setModifier(TokenParamModifier theModifier) {
|
||||
myModifier = theModifier;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TokenParam setSystem(String theSystem) {
|
||||
|
@ -152,8 +180,16 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setModifier(TokenParamModifier)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public TokenParam setText(boolean theText) {
|
||||
myText = theText;
|
||||
if (theText) {
|
||||
myModifier = TokenParamModifier.TEXT;
|
||||
} else {
|
||||
myModifier = null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -166,10 +202,10 @@ public class TokenParam extends BaseParam implements IQueryParameterType {
|
|||
public String toString() {
|
||||
ToStringBuilder builder = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
||||
builder.append("system", defaultString(getSystem()));
|
||||
builder.append("value", getValue());
|
||||
if (myText) {
|
||||
builder.append(":text", myText);
|
||||
if (myModifier != null) {
|
||||
builder.append(":" + myModifier.getValue());
|
||||
}
|
||||
builder.append("value", getValue());
|
||||
if (getMissing() != null) {
|
||||
builder.append(":missing", getMissing());
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package ca.uhn.fhir.rest.param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Modifiers for {@link TokenParam}
|
||||
*/
|
||||
public enum TokenParamModifier {
|
||||
/**
|
||||
* :above
|
||||
*/
|
||||
ABOVE(":above"),
|
||||
|
||||
/**
|
||||
* :above
|
||||
*/
|
||||
BELOW(":below"),
|
||||
|
||||
/**
|
||||
* :in
|
||||
*/
|
||||
IN(":in"),
|
||||
|
||||
/**
|
||||
* :not
|
||||
*/
|
||||
NOT(":not"),
|
||||
|
||||
/**
|
||||
* :not-in
|
||||
*/
|
||||
NOT_IN(":not-in"),
|
||||
|
||||
/**
|
||||
* :text
|
||||
*/
|
||||
TEXT(":text");
|
||||
|
||||
private static final Map<String, TokenParamModifier> VALUE_TO_ENUM;
|
||||
|
||||
static {
|
||||
Map<String, TokenParamModifier> valueToEnum = new HashMap<String, TokenParamModifier>();
|
||||
for (TokenParamModifier next : values()) {
|
||||
valueToEnum.put(next.getValue(), next);
|
||||
}
|
||||
VALUE_TO_ENUM = valueToEnum;
|
||||
}
|
||||
private final String myValue;
|
||||
|
||||
private TokenParamModifier(String theValue) {
|
||||
myValue = theValue;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return myValue;
|
||||
}
|
||||
|
||||
public static TokenParamModifier forValue(String theValue) {
|
||||
return VALUE_TO_ENUM.get(theValue);
|
||||
}
|
||||
|
||||
}
|
|
@ -80,6 +80,12 @@ import ca.uhn.fhir.util.VersionUtil;
|
|||
|
||||
public class RestfulServer extends HttpServlet implements IRestfulServer<ServletRequestDetails> {
|
||||
|
||||
/**
|
||||
* Requests will have an HttpServletRequest attribute set with this name, containing the servlet
|
||||
* context, in order to avoid a dependency on Servlet-API 3.0+
|
||||
*/
|
||||
public static final String SERVLET_CONTEXT_ATTRIBUTE = "ca.uhn.fhir.rest.server.RestfulServer.servlet_context";
|
||||
|
||||
/**
|
||||
* Default setting for {@link #setETagSupport(ETagSupportEnum) ETag Support}: {@link ETagSupportEnum#ENABLED}
|
||||
*/
|
||||
|
@ -517,6 +523,8 @@ public class RestfulServer extends HttpServlet implements IRestfulServer<Servlet
|
|||
requestDetails.setRequestType(theRequestType);
|
||||
requestDetails.setServletRequest(theRequest);
|
||||
requestDetails.setServletResponse(theResponse);
|
||||
|
||||
theRequest.setAttribute(SERVLET_CONTEXT_ATTRIBUTE, getServletContext());
|
||||
|
||||
try {
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ public class TestDstu21Config extends BaseJavaConfigDstu21 {
|
|||
extraProperties.put("hibernate.search.default.directory_provider" ,"filesystem");
|
||||
extraProperties.put("hibernate.search.default.indexBase", "target/lucene_index_dstu21");
|
||||
extraProperties.put("hibernate.search.lucene_version","LUCENE_CURRENT");
|
||||
extraProperties.put("hibernate.search.autoregister_listeners", "true");
|
||||
return extraProperties;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
<project name="HAPI FHIR Core OSGi Bundle" default="all">
|
||||
<property file="project.properties"/>
|
||||
<property name="spring.dir" value="${resources.dir}/META-INF/spring" />
|
||||
<property name="bundle.jar" value="${bundle.file.name}_${major.version}.${minor.version}.${micro.version}.jar" />
|
||||
<property name="bundle.file" value="${target.dir}/${bundle.jar}" />
|
||||
<property name="hapi.fhir.base.jar" value="${hapi.fhir.base.name}-${hapi.fhir.version}.jar" />
|
||||
<property name="hapi.fhir.base.file" value="../${hapi.fhir.base.name}/target/${hapi.fhir.base.jar}" />
|
||||
<property name="hapi.fhir.dstu.jar" value="${hapi.fhir.dstu.name}-${hapi.fhir.version}.jar" />
|
||||
<property name="hapi.fhir.dstu.file" value="../${hapi.fhir.dstu.name}/target/${hapi.fhir.dstu.jar}" />
|
||||
<property name="hapi.fhir.dstu2.jar" value="${hapi.fhir.dstu2.name}-${hapi.fhir.version}.jar" />
|
||||
<property name="hapi.fhir.dstu2.file" value="../${hapi.fhir.dstu2.name}/target/${hapi.fhir.dstu2.jar}" />
|
||||
<property name="hapi.fhir.hl7dstu2.jar" value="${hapi.fhir.hl7dstu2.name}-${hapi.fhir.version}.jar" />
|
||||
<property name="hapi.fhir.hl7dstu2.file" value="../${hapi.fhir.hl7dstu2.name}/target/${hapi.fhir.hl7dstu2.jar}" />
|
||||
|
||||
<target name="all" depends="bundle" />
|
||||
|
||||
<target name="init">
|
||||
<delete dir="${obr.target.dir}" failonerror="false"/>
|
||||
<mkdir dir="${obr.target.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="collect.jars" depends="init">
|
||||
<delete dir="${temp.target.dir}" failonerror="false"/>
|
||||
<mkdir dir="${temp.target.dir}" />
|
||||
<copy todir="${temp.target.dir}">
|
||||
<fileset file="${hapi.fhir.base.file}"/>
|
||||
<fileset file="${hapi.fhir.dstu.file}"/>
|
||||
<fileset file="${hapi.fhir.dstu2.file}"/>
|
||||
<fileset file="${hapi.fhir.hl7dstu2.file}"/>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="bundle" depends="collect.jars">
|
||||
<echo>creating HAPI FHIR Core OSGi Bundle</echo>
|
||||
<concat destfile="${temp.target.dir}/MANIFEST.MF">
|
||||
<fileset dir="${resources.dir}/META-INF" includes="MANIFEST.MF" />
|
||||
<footer>
|
||||
Bundle-Classpath: .,
|
||||
lib/${hapi.fhir.base.jar},
|
||||
lib/${hapi.fhir.dstu.jar},
|
||||
lib/${hapi.fhir.dstu2.jar},
|
||||
lib/${hapi.fhir.hl7dstu2.jar}
|
||||
</footer>
|
||||
</concat>
|
||||
<jar destfile="${bundle.file}" manifest="${temp.target.dir}/MANIFEST.MF">
|
||||
<fileset dir="${classes.dir}" includes="**/*" />
|
||||
<zipfileset dir="${temp.target.dir}" includes="*.jar" prefix="lib"/>
|
||||
<zipfileset dir="${spring.dir}" prefix="META-INF/spring"/>
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
</project>
|
|
@ -36,11 +36,21 @@
|
|||
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-structures-dstu2.1</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-fhir-validation-resources-dstu2.1</artifactId>
|
||||
<version>1.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.thymeleaf</groupId>
|
||||
|
@ -87,10 +97,11 @@
|
|||
<fileset dir="../hapi-fhir-base/src/main/java" />
|
||||
<fileset dir="../hapi-fhir-structures-dstu/src/main/java" />
|
||||
<fileset dir="../hapi-fhir-structures-dstu/target/generated-sources/tinder" />
|
||||
<fileset dir="../hapi-fhir-structures-dstu/src/main/java" />
|
||||
<fileset dir="../hapi-fhir-structures-dstu2/src/main/java" />
|
||||
<fileset dir="../hapi-fhir-structures-dstu2/target/generated-sources/tinder" />
|
||||
<fileset dir="../hapi-fhir-structures-hl7org-dstu2/src/main/java" />
|
||||
<fileset dir="../hapi-fhir-structures-dstu2.1/src/main/java" />
|
||||
<!--<fileset dir="../hapi-fhir-structures-dstu2.1/target/generated-sources/tinder" /> -->
|
||||
</copy>
|
||||
</target>
|
||||
</configuration>
|
||||
|
@ -124,12 +135,28 @@
|
|||
<!--<Export-Package>ca.uhn.fhir</Export-Package> <Export-Package>org.hl7.fhir</Export-Package> -->
|
||||
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
|
||||
<!--<Embed-Dependency>*;scope=!provided|test</Embed-Dependency> <Embed-Directory>lib</Embed-Directory> <Embed-Transitive>true</Embed-Transitive> -->
|
||||
<_nouses>true</_nouses>
|
||||
<_removeheaders>Built-By, Include-Resource, Private-Package</_removeheaders>
|
||||
<!-- <Private-Package>org.foo.myproject.*</Private-Package> <Bundle-Activator>org.foo.myproject.impl1.Activator</Bundle-Activator> -->
|
||||
<!-- <Embed-Dependency>*;scope=compile|runtime;inline=false;artifactId=hapi-fhir-*</Embed-Dependency> -->
|
||||
<Import-Package>
|
||||
!ca.uhn.*,
|
||||
!org.hl7.*,
|
||||
com.ctc.wstx.api;version="4.4";resolution:=optional,
|
||||
com.ctc.wstx.*;version="4.4";resolution:=optional,
|
||||
com.google.*;resolution:=optional;-remove-attribute:=version,
|
||||
com.phloc.commons;resolution:=optional;-remove-attribute:=version,
|
||||
com.phloc.*;resolution:=optional;-remove-attribute:=version,
|
||||
javax.*;-remove-attribute:=version,
|
||||
net.sf.saxon;resolution:=optional,
|
||||
org.apache.commons.*;-remove-attribute:=version,
|
||||
org.apache.http.client.protocol;version="4.0",
|
||||
org.apache.http.*;version="4.0",
|
||||
org.codehaus.stax2;resolution:=optional;-remove-attribute:=version,
|
||||
org.codehaus.stax2.*;resolution:=optional;-remove-attribute:=version,
|
||||
org.oclc.purl.*;-remove-attribute:=version,
|
||||
org.slf4j.*;-remove-attribute:=version,
|
||||
org.xmlpull.v1;resolution:=optional,
|
||||
*
|
||||
</Import-Package>
|
||||
</instructions>
|
||||
|
@ -188,7 +215,25 @@
|
|||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>../hapi-fhir-structures-hl7org-dstu2/src/resources/java</directory>
|
||||
<directory>../hapi-fhir-structures-hl7org-dstu2/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>../hapi-fhir-structures-dstu2.1/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<!--
|
||||
<resource>
|
||||
<directory>../hapi-fhir-structures-dstu2.1/target/generated-resources/tinder</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
-->
|
||||
<resource>
|
||||
<directory>../hapi-fhir-validation-resources-dstu2/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>../hapi-fhir-validation-resources-dstu2.1/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#Fri, 31 Jul 2015 17:06:47 -0700
|
||||
bundle.file.name=hapi-fhir-osgi-core
|
||||
major.version=1
|
||||
minor.version=2
|
||||
micro.version=0.SNAPSHOT
|
||||
|
||||
src.dir=./src/main/java
|
||||
resources.dir=./src/main/resources
|
||||
classes.dir=./target/classes
|
||||
target.dir=./target
|
||||
obr.target.dir=./target/build-obr
|
||||
temp.target.dir=./target/build-temp
|
||||
|
||||
hapi.fhir.version=1.2-SNAPSHOT
|
||||
hapi.fhir.base.name=hapi-fhir-base
|
||||
hapi.fhir.dstu.name=hapi-fhir-structures-dstu
|
||||
hapi.fhir.dstu2.name=hapi-fhir-structures-dstu2
|
||||
hapi.fhir.hl7dstu2.name=hapi-fhir-structures-hl7org-dstu2
|
|
@ -1,4 +1,4 @@
|
|||
package ca.uhn.fhir.osgi.impl;
|
||||
package ca.uhn.fhir.osgi;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
|
@ -23,8 +23,6 @@ package ca.uhn.fhir.osgi.impl;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import ca.uhn.fhir.osgi.FhirProviderBundle;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Akana, Inc. Professional Services
|
|
@ -1,134 +0,0 @@
|
|||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: HAPI FHIR - Core Library and DSTU/DSTU2 Structures
|
||||
Bundle-SymbolicName: hapi-fhir-osgi-core
|
||||
Bundle-Version: 1.2.0.SNAPSHOT
|
||||
Spring-Context: *;publish-context:=false
|
||||
Export-Package: ca.uhn.fhir;version="1.2.0",
|
||||
ca.uhn.fhir.context;version="1.2.0",
|
||||
ca.uhn.fhir.i18n;version="1.2.0",
|
||||
ca.uhn.fhir.model.api;version="1.2.0",
|
||||
ca.uhn.fhir.model.api.annotation;version="1.2.0",
|
||||
ca.uhn.fhir.model.base.composite;version="1.2.0",
|
||||
ca.uhn.fhir.model.base.resource;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu.api;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu.composite;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu.resource;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu.valueset;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu2;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu2.composite;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu2.resource;version="1.2.0",
|
||||
ca.uhn.fhir.model.dstu2.valueset;version="1.2.0",
|
||||
ca.uhn.fhir.model.primitive;version="1.2.0",
|
||||
ca.uhn.fhir.model.valueset;version="1.2.0",
|
||||
ca.uhn.fhir.model.view;version="1.2.0",
|
||||
ca.uhn.fhir.narrative;version="1.2.0",
|
||||
ca.uhn.fhir.narrative.datatype;version="1.2.0",
|
||||
ca.uhn.fhir.narrative.title;version="1.2.0",
|
||||
ca.uhn.fhir.osgi;version="1.2.0",
|
||||
ca.uhn.fhir.osgi.impl;version="1.2.0",
|
||||
ca.uhn.fhir.parser;version="1.2.0",
|
||||
ca.uhn.fhir.rest.annotation;version="1.2.0",
|
||||
ca.uhn.fhir.rest.api;version="1.2.0",
|
||||
ca.uhn.fhir.rest.client;version="1.2.0",
|
||||
ca.uhn.fhir.rest.client.api;version="1.2.0",
|
||||
ca.uhn.fhir.rest.client.exceptions;version="1.2.0",
|
||||
ca.uhn.fhir.rest.client.interceptor;version="1.2.0",
|
||||
ca.uhn.fhir.rest.gclient;version="1.2.0",
|
||||
ca.uhn.fhir.rest.method;version="1.2.0",
|
||||
ca.uhn.fhir.rest.param;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server.audit;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server.exceptions;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server.interceptor;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server.provider;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server.provider.dstu2;version="1.2.0",
|
||||
ca.uhn.fhir.rest.server.provider.dstu2hl7org,
|
||||
ca.uhn.fhir.store;version="1.2.0",
|
||||
ca.uhn.fhir.util;version="1.2.0",
|
||||
ca.uhn.fhir.validation;version="1.2.0",
|
||||
org.hl7.fhir.instance;version="1.2.0",
|
||||
org.hl7.fhir.instance.client;version="1.2.0",
|
||||
org.hl7.fhir.instance.conf;version="1.2.0",
|
||||
org.hl7.fhir.instance.formats;version="1.2.0",
|
||||
org.hl7.fhir.instance.model;version="1.2.0",
|
||||
org.hl7.fhir.instance.model.annotations;version="1.2.0",
|
||||
org.hl7.fhir.instance.model.api;version="1.2.0",
|
||||
org.hl7.fhir.instance.model.valuesets;version="1.2.0",
|
||||
org.hl7.fhir.instance.terminologies;version="1.2.0",
|
||||
org.hl7.fhir.instance.utils;version="1.2.0",
|
||||
org.hl7.fhir.instance.validation;version="1.2.0",
|
||||
org.hl7.fhir.utilities;version="1.2.0",
|
||||
org.hl7.fhir.utilities.xhtml;version="1.2.0",
|
||||
org.hl7.fhir.utilities.xml;version="1.2.0"
|
||||
Import-Package: com.ctc.wstx.api;version="4.4.0",
|
||||
com.ctc.wstx.stax;version="4.4.0",
|
||||
com.google.gson;resolution:=optional,
|
||||
com.phloc.commons;resolution:=optional,
|
||||
com.phloc.commons.error;resolution:=optional,
|
||||
com.phloc.schematron;resolution:=optional,
|
||||
com.phloc.schematron.xslt;resolution:=optional,
|
||||
javax.json,
|
||||
javax.json.stream,
|
||||
javax.servlet,
|
||||
javax.servlet.http,
|
||||
javax.xml.parsers,
|
||||
javax.xml.stream,
|
||||
javax.xml.stream,events,
|
||||
net.sf.saxon;resolution:=optional,
|
||||
net.sourceforge.cobertura;resolution:=optional,
|
||||
org.apache.commons.codec.binary,
|
||||
org.apache.commons.io,
|
||||
org.apache.commons.io.input,
|
||||
org.apache.commons.lang3,
|
||||
org.apache.commons.lang3.builder,
|
||||
org.apache.commons.lang3.exception,
|
||||
org.apache.commons.lang3.text,
|
||||
org.apache.commons.lang3.time,
|
||||
org.apache.http;version="4.4.0",
|
||||
org.apache.http.auth;version="4.4.0",
|
||||
org.apache.http.client;version="4.4.0",
|
||||
org.apache.http.client.config;version="4.4.0",
|
||||
org.apache.http.client.entity;version="4.4.0",
|
||||
org.apache.http.client.methods;version="4.4.0",
|
||||
org.apache.http.client.protocol;version="4.4.0",
|
||||
org.apache.http.client.utils;version="4.4.0",
|
||||
org.apache.http.entity;version="4.4.0",
|
||||
org.apache.http.impl.auth;version="4.4.0",
|
||||
org.apache.http.impl.client;version="4.4.0",
|
||||
org.apache.http.impl.conn;version="4.4.0",
|
||||
org.apache.http.message;version="4.4.0",
|
||||
org.apache.http.protocol;version="4.4.0",
|
||||
org.apache.xerces.parsers,
|
||||
org.apache.xerces.xni.parser,
|
||||
org.codehaus.stax2,
|
||||
org.codehaus.stax2.io,
|
||||
org.oclc.purl.dsdl.svrl,
|
||||
org.slf4j,
|
||||
org.thymeleaf,
|
||||
org.thymeleaf.context,
|
||||
org.thymeleaf.dialect,
|
||||
org.thymeleaf.dom,
|
||||
org.thymeleaf.exceptions,
|
||||
org.thymeleaf.messageresolver,
|
||||
org.thymeleaf.processor,
|
||||
org.thymeleaf.processor.attr,
|
||||
org.thymeleaf.resourceresolver,
|
||||
org.thymeleaf.standard,
|
||||
org.thymeleaf.standard.expression,
|
||||
org.thymeleaf.templatemode,
|
||||
org.thymeleaf.templateparser.xmlsax,
|
||||
org.thymeleaf.templateresolver,
|
||||
org.thymeleaf.util,
|
||||
org.unbescape.html,
|
||||
org.unbescape.java,
|
||||
org.unbescape.javascript,
|
||||
org.unbescape.uri,
|
||||
org.w3c.dom,
|
||||
org.w3c.dom.ls,
|
||||
org.xmlpull.v1;resolution:=optional,
|
||||
org.xml.sax,
|
||||
org.xml.sax.ext,
|
||||
org.xml.sax.helpers
|
||||
Bundle-Vendor: University Health Network
|
|
@ -1,47 +1,47 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ctx="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:osgi="http://www.eclipse.org/gemini/blueprint/schema/blueprint"
|
||||
xmlns:osgix="http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util
|
||||
http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium/gemini-blueprint-compendium.xsd
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd">
|
||||
|
||||
<!-- ++====================================++
|
||||
|| S E R V E R M A N A G E R ||
|
||||
++====================================++
|
||||
-->
|
||||
<bean id="fhir.server.manager" class="ca.uhn.fhir.osgi.impl.FhirServerManager">
|
||||
</bean>
|
||||
|
||||
<!-- ++=====================++
|
||||
|| S E R V E R S ||
|
||||
++=====================++
|
||||
-->
|
||||
<osgi:list id="fhir.servers" interface="ca.uhn.fhir.osgi.FhirServer" cardinality="0..N">
|
||||
<osgi:listener ref="fhir.server.manager"
|
||||
bind-method="registerFhirServer"
|
||||
unbind-method="unregisterFhirServer" />
|
||||
</osgi:list>
|
||||
|
||||
<!-- ++========================================++
|
||||
|| P R O V I D E R B U N D L E S ||
|
||||
++========================================++
|
||||
-->
|
||||
<osgi:list id="fhir.osgi.providers" interface="ca.uhn.fhir.osgi.FhirProviderBundle" cardinality="0..N" >
|
||||
<osgi:listener ref="fhir.server.manager"
|
||||
bind-method="registerFhirProviders"
|
||||
unbind-method="unregisterFhirProviders" />
|
||||
</osgi:list>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:ctx="http://www.springframework.org/schema/context"
|
||||
xmlns:util="http://www.springframework.org/schema/util"
|
||||
xmlns:osgi="http://www.eclipse.org/gemini/blueprint/schema/blueprint"
|
||||
xmlns:osgix="http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||||
http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context
|
||||
http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util
|
||||
http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint-compendium/gemini-blueprint-compendium.xsd
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint
|
||||
http://www.eclipse.org/gemini/blueprint/schema/blueprint/gemini-blueprint.xsd">
|
||||
|
||||
<!-- ++====================================++
|
||||
|| S E R V E R M A N A G E R ||
|
||||
++====================================++
|
||||
-->
|
||||
<bean id="fhir.server.manager" class="ca.uhn.fhir.osgi.impl.FhirServerManager">
|
||||
</bean>
|
||||
|
||||
<!-- ++=====================++
|
||||
|| S E R V E R S ||
|
||||
++=====================++
|
||||
-->
|
||||
<osgi:list id="fhir.servers" interface="ca.uhn.fhir.osgi.FhirServer" cardinality="0..N">
|
||||
<osgi:listener ref="fhir.server.manager"
|
||||
bind-method="registerFhirServer"
|
||||
unbind-method="unregisterFhirServer" />
|
||||
</osgi:list>
|
||||
|
||||
<!-- ++========================================++
|
||||
|| P R O V I D E R B U N D L E S ||
|
||||
++========================================++
|
||||
-->
|
||||
<osgi:list id="fhir.osgi.providers" interface="ca.uhn.fhir.osgi.FhirProviderBundle" cardinality="0..N" >
|
||||
<osgi:listener ref="fhir.server.manager"
|
||||
bind-method="registerFhirProviders"
|
||||
unbind-method="unregisterFhirProviders" />
|
||||
</osgi:list>
|
||||
|
||||
</beans>
|
|
@ -20,9 +20,14 @@
|
|||
<version>1.4-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
The JPA project uses a newer API but we'll try to hold to this version
|
||||
as much as possible. See #283.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
|
|||
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.Conformance;
|
||||
import ca.uhn.fhir.model.dstu.resource.Conformance.Rest;
|
||||
import ca.uhn.fhir.model.dstu.resource.Conformance.RestQuery;
|
||||
|
@ -156,7 +155,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
String resourceName = next.getResourceName();
|
||||
RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName);
|
||||
resource.getType().setValue(def.getName());
|
||||
ServletContext servletContext = theRequest == null ? null : theRequest.getServletContext();
|
||||
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||
resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ import ca.uhn.fhir.rest.annotation.RequiredParam;
|
|||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParamModifier;
|
||||
import ca.uhn.fhir.util.PortUtil;
|
||||
import ca.uhn.fhir.util.UrlUtil;
|
||||
|
||||
|
@ -218,4 +219,35 @@ public class TokenParameterTest {
|
|||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetModifiersNone() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier=a%7Cb");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(1, ourLastOrList.getListAsCodings().size());
|
||||
assertEquals(null, ourLastOrList.getValuesAsQueryTokens().get(0).getModifier());
|
||||
assertEquals("a", ourLastOrList.getListAsCodings().get(0).getSystemElement().getValue());
|
||||
assertEquals("b", ourLastOrList.getListAsCodings().get(0).getCodeElement().getValue());
|
||||
assertEquals("a", ourLastOrList.getValuesAsQueryTokens().get(0).getSystem());
|
||||
assertEquals("b", ourLastOrList.getValuesAsQueryTokens().get(0).getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetModifiersText() throws Exception {
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient?identifier:text=a%7Cb");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
assertEquals(1, ourLastOrList.getListAsCodings().size());
|
||||
assertEquals(TokenParamModifier.TEXT, ourLastOrList.getValuesAsQueryTokens().get(0).getModifier());
|
||||
assertEquals(null, ourLastOrList.getValuesAsQueryTokens().get(0).getSystem());
|
||||
assertEquals("a|b", ourLastOrList.getValuesAsQueryTokens().get(0).getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,9 +26,15 @@
|
|||
<version>1.4-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
The JPA project uses a newer API but we'll try to hold to this version
|
||||
as much as possible. See #283.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ import ca.uhn.fhir.rest.method.IParameter;
|
|||
import ca.uhn.fhir.rest.method.OperationMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.OperationMethodBinding.ReturnType;
|
||||
import ca.uhn.fhir.rest.method.OperationParameter;
|
||||
import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum;
|
||||
import ca.uhn.fhir.rest.method.SearchMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
@ -85,8 +86,10 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|||
* Server FHIR Provider which serves the conformance statement for a RESTful server implementation
|
||||
*
|
||||
* <p>
|
||||
* Note: This class is safe to extend, but it is important to note that the same instance of {@link Conformance} is always returned unless {@link #setCache(boolean)} is called with a value of
|
||||
* <code>false</code>. This means that if you are adding anything to the returned conformance instance on each call you should call <code>setCache(false)</code> in your provider constructor.
|
||||
* Note: This class is safe to extend, but it is important to note that the same instance of {@link Conformance} is
|
||||
* always returned unless {@link #setCache(boolean)} is called with a value of <code>false</code>. This means that if
|
||||
* you are adding anything to the returned conformance instance on each call you should call
|
||||
* <code>setCache(false)</code> in your provider constructor.
|
||||
* </p>
|
||||
*/
|
||||
public class ServerConformanceProvider implements IServerConformanceProvider<Conformance> {
|
||||
|
@ -101,22 +104,20 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
||||
this.myServerConfiguration = theRestfulServer.createConfiguration();
|
||||
}
|
||||
|
||||
|
||||
public ServerConformanceProvider(RestulfulServerConfiguration theServerConfiguration) {
|
||||
this.myServerConfiguration = theServerConfiguration;
|
||||
this.myServerConfiguration = theServerConfiguration;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Add a no-arg constructor and seetter so that the
|
||||
* ServerConfirmanceProvider can be Spring-wired with
|
||||
* the RestfulService avoiding the potential reference
|
||||
* cycle that would happen.
|
||||
* Add a no-arg constructor and seetter so that the ServerConfirmanceProvider can be Spring-wired with the
|
||||
* RestfulService avoiding the potential reference cycle that would happen.
|
||||
*/
|
||||
public ServerConformanceProvider () {
|
||||
public ServerConformanceProvider() {
|
||||
super();
|
||||
}
|
||||
|
||||
public void setRestfulServer (RestfulServer theRestfulServer) {
|
||||
|
||||
public void setRestfulServer(RestfulServer theRestfulServer) {
|
||||
myServerConfiguration = theRestfulServer.createConfiguration();
|
||||
}
|
||||
|
||||
|
@ -167,8 +168,9 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the "publisher" that will be placed in the generated conformance statement. As this is a mandatory element, the value should not be null (although this is not enforced). The
|
||||
* value defaults to "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
* Gets the value of the "publisher" that will be placed in the generated conformance statement. As this is a
|
||||
* mandatory element, the value should not be null (although this is not enforced). The value defaults to
|
||||
* "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
*/
|
||||
public String getPublisher() {
|
||||
return myPublisher;
|
||||
|
@ -186,7 +188,8 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
retVal.setPublisher(myPublisher);
|
||||
retVal.setDateElement(conformanceDate());
|
||||
retVal.setFhirVersion("1.0.2"); // TODO: pull from model
|
||||
retVal.setAcceptUnknown(UnknownContentCode.EXTENSIONS); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||
retVal.setAcceptUnknown(UnknownContentCode.EXTENSIONS); // TODO: make this configurable - this is a fairly big
|
||||
// effort since the parser
|
||||
// needs to be modified to actually allow it
|
||||
|
||||
retVal.getImplementation().setDescription(myServerConfiguration.getImplementationDescription());
|
||||
|
@ -211,8 +214,8 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
String resourceName = nextEntry.getKey();
|
||||
RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName);
|
||||
resource.getTypeElement().setValue(def.getName());
|
||||
ServletContext servletContext = theRequest == null ? null : theRequest.getServletContext();
|
||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||
resource.getProfile().setReference((def.getResourceProfile(serverBase)));
|
||||
|
||||
TreeSet<String> includes = new TreeSet<String>();
|
||||
|
@ -432,6 +435,15 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
if (StringUtils.isNotBlank(chain)) {
|
||||
param.addChain(chain);
|
||||
}
|
||||
|
||||
if (nextParameter.getParamType() == RestSearchParameterTypeEnum.REFERENCE) {
|
||||
for (String nextWhitelist : new TreeSet<String>(nextParameter.getQualifierWhitelist())) {
|
||||
if (nextWhitelist.startsWith(".")) {
|
||||
param.addChain(nextWhitelist.substring(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
param.setDocumentation(nextParamDescription);
|
||||
if (nextParameter.getParamType() != null) {
|
||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||
|
@ -441,7 +453,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
if (targetDef != null) {
|
||||
ResourceType code;
|
||||
try {
|
||||
code = ResourceType.fromCode(targetDef.getName());
|
||||
code = ResourceType.fromCode(targetDef.getName());
|
||||
} catch (FHIRException e) {
|
||||
code = null;
|
||||
}
|
||||
|
@ -561,8 +573,9 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the "publisher" that will be placed in the generated conformance statement. As this is a mandatory element, the value should not be null (although this is not enforced). The
|
||||
* value defaults to "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
* Sets the value of the "publisher" that will be placed in the generated conformance statement. As this is a
|
||||
* mandatory element, the value should not be null (although this is not enforced). The value defaults to
|
||||
* "Not provided" but may be set to null, which will cause this element to be omitted.
|
||||
*/
|
||||
public void setPublisher(String thePublisher) {
|
||||
myPublisher = thePublisher;
|
||||
|
|
|
@ -126,51 +126,43 @@ public abstract class BaseDateTimeType extends PrimitiveType<Date> {
|
|||
if (theValue == null) {
|
||||
return null;
|
||||
} else {
|
||||
GregorianCalendar cal;
|
||||
if (myTimeZoneZulu) {
|
||||
cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
} else if (myTimeZone != null) {
|
||||
cal = new GregorianCalendar(myTimeZone);
|
||||
} else {
|
||||
cal = new GregorianCalendar();
|
||||
}
|
||||
cal.setTime(theValue);
|
||||
|
||||
switch (myPrecision) {
|
||||
case DAY:
|
||||
return ourYearMonthDayFormat.format(theValue);
|
||||
return ourYearMonthDayFormat.format(cal);
|
||||
case MONTH:
|
||||
return ourYearMonthFormat.format(theValue);
|
||||
return ourYearMonthFormat.format(cal);
|
||||
case YEAR:
|
||||
return ourYearFormat.format(theValue);
|
||||
return ourYearFormat.format(cal);
|
||||
case MINUTE:
|
||||
if (myTimeZoneZulu) {
|
||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeMinsFormat.format(cal) + "Z";
|
||||
} else if (myTimeZone != null) {
|
||||
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
|
||||
cal.setTime(theValue);
|
||||
return (ourYearMonthDayTimeMinsZoneFormat.format(cal));
|
||||
} else {
|
||||
return ourYearMonthDayTimeMinsFormat.format(theValue);
|
||||
return ourYearMonthDayTimeMinsZoneFormat.format(cal);
|
||||
}
|
||||
case SECOND:
|
||||
if (myTimeZoneZulu) {
|
||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeFormat.format(cal) + "Z";
|
||||
} else if (myTimeZone != null) {
|
||||
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
|
||||
cal.setTime(theValue);
|
||||
return (ourYearMonthDayTimeZoneFormat.format(cal));
|
||||
} else {
|
||||
return ourYearMonthDayTimeFormat.format(theValue);
|
||||
return ourYearMonthDayTimeZoneFormat.format(cal);
|
||||
}
|
||||
case MILLI:
|
||||
if (myTimeZoneZulu) {
|
||||
GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
cal.setTime(theValue);
|
||||
return ourYearMonthDayTimeMilliFormat.format(cal) + "Z";
|
||||
} else if (myTimeZone != null) {
|
||||
GregorianCalendar cal = new GregorianCalendar(myTimeZone);
|
||||
cal.setTime(theValue);
|
||||
return (ourYearMonthDayTimeMilliZoneFormat.format(cal));
|
||||
} else {
|
||||
return ourYearMonthDayTimeMilliFormat.format(theValue);
|
||||
return ourYearMonthDayTimeMilliZoneFormat.format(cal);
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Invalid precision (this is a bug, shouldn't happen): " + myPrecision);
|
||||
throw new IllegalStateException("Invalid precision (this is a HAPI bug, shouldn't happen): " + myPrecision);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,11 +29,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
package org.hl7.fhir.dstu21.model;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
/**
|
||||
* Primitive type "date" in FHIR: any day in a gregorian calendar
|
||||
*/
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
@ -95,6 +98,33 @@ public class DateType extends BaseDateTimeType {
|
|||
super(theDate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
|
||||
*/
|
||||
public DateType(Calendar theCalendar) {
|
||||
super(theCalendar.getTime(), DEFAULT_PRECISION);
|
||||
setTimeZone(theCalendar.getTimeZone());
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor which accepts a date value and uses the {@link #DEFAULT_PRECISION} for this type.
|
||||
*
|
||||
* @param theYear The year, e.g. 2015
|
||||
* @param theMonth The month, e.g. 0 for January
|
||||
* @param theDay The day (1 indexed) e.g. 1 for the first day of the month
|
||||
*/
|
||||
public DateType(int theYear, int theMonth, int theDay) {
|
||||
this(toCalendarZulu(theYear, theMonth, theDay));
|
||||
}
|
||||
|
||||
private static GregorianCalendar toCalendarZulu(int theYear, int theMonth, int theDay) {
|
||||
GregorianCalendar retVal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||
retVal.set(Calendar.YEAR, theYear);
|
||||
retVal.set(Calendar.MONTH, theMonth);
|
||||
retVal.set(Calendar.DATE, theDay);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isPrecisionAllowed(TemporalPrecisionEnum thePrecision) {
|
||||
switch (thePrecision) {
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.hl7.fhir.dstu21.model.DateTimeType;
|
||||
import org.hl7.fhir.dstu21.model.DateType;
|
||||
import org.hl7.fhir.dstu21.model.TemporalPrecisionEnum;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
public class BaseDateTimeTypeDstu21Test {
|
||||
private static Locale ourDefaultLocale;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(BaseDateTimeTypeDstu21Test.class);
|
||||
private SimpleDateFormat myDateInstantParser;
|
||||
|
||||
@Before
|
||||
public void before() {
|
||||
myDateInstantParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
}
|
||||
|
||||
/**
|
||||
* See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
|
||||
*/
|
||||
@Test
|
||||
public void testPrecisionRespectedForSetValue() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
|
||||
cal.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
|
||||
Date time = cal.getTime();
|
||||
|
||||
DateType date = new DateType();
|
||||
date.setValue(time);
|
||||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinutePrecisionEncode() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 3, 3, 22, 11);
|
||||
|
||||
DateTimeType date = new DateTimeType();
|
||||
date.setValue(cal.getTime(), TemporalPrecisionEnum.MINUTE);
|
||||
date.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
assertEquals("1990-01-02T21:22-05:00", date.getValueAsString());
|
||||
|
||||
date.setTimeZoneZulu(true);
|
||||
assertEquals("1990-01-03T02:22Z", date.getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
|
||||
*/
|
||||
@Test
|
||||
public void testPrecisionRespectedForSetValueWithPrecision() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(myDateInstantParser.parse("2012-01-02 22:31:02.333"));
|
||||
cal.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
|
||||
Date time = cal.getTime();
|
||||
|
||||
DateType date = new DateType();
|
||||
date.setValue(time, TemporalPrecisionEnum.DAY);
|
||||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testToHumanDisplay() {
|
||||
DateTimeType dt = new DateTimeType("2012-01-05T12:00:00-08:00");
|
||||
String human = dt.toHumanDisplay();
|
||||
ourLog.info(human);
|
||||
assertThat(human, containsString("2012"));
|
||||
assertThat(human, containsString("12"));
|
||||
}
|
||||
|
||||
public static void afterClass() {
|
||||
Locale.setDefault(ourDefaultLocale);
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() {
|
||||
/*
|
||||
* We cache the default locale, but temporarily set it to a random value during this test. This helps ensure
|
||||
* that there are no language specific dependencies in the test.
|
||||
*/
|
||||
ourDefaultLocale = Locale.getDefault();
|
||||
|
||||
Locale[] available = { Locale.CANADA, Locale.GERMANY, Locale.TAIWAN };
|
||||
Locale newLocale = available[(int) (Math.random() * available.length)];
|
||||
Locale.setDefault(newLocale);
|
||||
|
||||
ourLog.info("Tests are running in locale: " + newLocale.getDisplayName());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package ca.uhn.fhir.model;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.hl7.fhir.dstu21.model.DateType;
|
||||
import org.junit.Test;
|
||||
|
||||
public class DateTypeTest {
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DateTypeTest.class);
|
||||
|
||||
@Test
|
||||
public void testPrecision() {
|
||||
|
||||
// ourLog.info(""+ new TreeSet<String>(Arrays.asList(TimeZone.getAvailableIDs())));
|
||||
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
cal.set(1990, Calendar.JANUARY, 1, 0, 0, 0);
|
||||
ourLog.info("Time: {}", cal); // 631152000775
|
||||
|
||||
DateType dateDt = new DateType(cal.getTime());
|
||||
long time = dateDt.getValue().getTime();
|
||||
ourLog.info("Time: {}", time); // 631152000775
|
||||
ourLog.info("Time: {}", dateDt.getValue()); // 631152000775
|
||||
|
||||
dateDt.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
time = dateDt.getValue().getTime();
|
||||
ourLog.info("Time: {}", time); // 631152000775
|
||||
ourLog.info("Time: {}", dateDt.getValue()); // 631152000775
|
||||
|
||||
String valueAsString = dateDt.getValueAsString();
|
||||
ourLog.info(valueAsString);
|
||||
// is 631152000030
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructors() {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 5, 0, 0, 0);
|
||||
DateType dateDt = new DateType(cal);
|
||||
assertEquals("1990-01-05", dateDt.getValueAsString());
|
||||
|
||||
dateDt = new DateType(1990, 0, 5);
|
||||
assertEquals("1990-01-05", dateDt.getValueAsString());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,188 @@
|
|||
|
||||
package org.hl7.fhir.dstu21.hapi.rest.server;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.hl7.fhir.dstu21.model.Organization;
|
||||
import org.hl7.fhir.dstu21.model.Patient;
|
||||
import org.hl7.fhir.dstu21.model.Practitioner;
|
||||
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.rest.annotation.IncludeParam;
|
||||
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
||||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.annotation.Sort;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
// import ca.uhn.fhir.model.dstu.resource.Binary;
|
||||
// import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
// import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
|
||||
import ca.uhn.fhir.rest.param.StringAndListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||
import ca.uhn.fhir.rest.param.UriAndListParam;
|
||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||
|
||||
public class PatientResourceProvider implements IResourceProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public Class<Patient> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Search()
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider search(
|
||||
javax.servlet.http.HttpServletRequest theServletRequest,
|
||||
|
||||
@Description(shortDefinition="The resource identity")
|
||||
@OptionalParam(name="_id")
|
||||
StringAndListParam theId,
|
||||
|
||||
@Description(shortDefinition="The resource language")
|
||||
@OptionalParam(name="_language")
|
||||
StringAndListParam theResourceLanguage,
|
||||
|
||||
@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_CONTENT)
|
||||
StringAndListParam theFtContent,
|
||||
|
||||
@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_TEXT)
|
||||
StringAndListParam theFtText,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given tag")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_TAG)
|
||||
TokenAndListParam theSearchForTag,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given security labels")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_SECURITY)
|
||||
TokenAndListParam theSearchForSecurity,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given profile")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_PROFILE)
|
||||
UriAndListParam theSearchForProfile,
|
||||
|
||||
|
||||
@Description(shortDefinition="A patient identifier")
|
||||
@OptionalParam(name="identifier")
|
||||
TokenAndListParam theIdentifier,
|
||||
|
||||
@Description(shortDefinition="A portion of either family or given name of the patient")
|
||||
@OptionalParam(name="name")
|
||||
StringAndListParam theName,
|
||||
|
||||
@Description(shortDefinition="A portion of the family name of the patient")
|
||||
@OptionalParam(name="family")
|
||||
StringAndListParam theFamily,
|
||||
|
||||
@Description(shortDefinition="A portion of the given name of the patient")
|
||||
@OptionalParam(name="given")
|
||||
StringAndListParam theGiven,
|
||||
|
||||
@Description(shortDefinition="A portion of either family or given name using some kind of phonetic matching algorithm")
|
||||
@OptionalParam(name="phonetic")
|
||||
StringAndListParam thePhonetic,
|
||||
|
||||
@Description(shortDefinition="The value in any kind of telecom details of the patient")
|
||||
@OptionalParam(name="telecom")
|
||||
TokenAndListParam theTelecom,
|
||||
|
||||
@Description(shortDefinition="A value in a phone contact")
|
||||
@OptionalParam(name="phone")
|
||||
TokenAndListParam thePhone,
|
||||
|
||||
@Description(shortDefinition="A value in an email contact")
|
||||
@OptionalParam(name="email")
|
||||
TokenAndListParam theEmail,
|
||||
|
||||
@Description(shortDefinition="An address in any kind of address/part of the patient")
|
||||
@OptionalParam(name="address")
|
||||
StringAndListParam theAddress,
|
||||
|
||||
@Description(shortDefinition="A city specified in an address")
|
||||
@OptionalParam(name="address-city")
|
||||
StringAndListParam theAddress_city,
|
||||
|
||||
@Description(shortDefinition="A state specified in an address")
|
||||
@OptionalParam(name="address-state")
|
||||
StringAndListParam theAddress_state,
|
||||
|
||||
@Description(shortDefinition="A postalCode specified in an address")
|
||||
@OptionalParam(name="address-postalcode")
|
||||
StringAndListParam theAddress_postalcode,
|
||||
|
||||
@Description(shortDefinition="A country specified in an address")
|
||||
@OptionalParam(name="address-country")
|
||||
StringAndListParam theAddress_country,
|
||||
|
||||
@Description(shortDefinition="A use code specified in an address")
|
||||
@OptionalParam(name="address-use")
|
||||
TokenAndListParam theAddress_use,
|
||||
|
||||
@Description(shortDefinition="Gender of the patient")
|
||||
@OptionalParam(name="gender")
|
||||
TokenAndListParam theGender,
|
||||
|
||||
@Description(shortDefinition="Language code (irrespective of use value)")
|
||||
@OptionalParam(name="language")
|
||||
TokenAndListParam theLanguage,
|
||||
|
||||
@Description(shortDefinition="The patient's date of birth")
|
||||
@OptionalParam(name="birthdate")
|
||||
DateRangeParam theBirthdate,
|
||||
|
||||
@Description(shortDefinition="The organization at which this person is a patient")
|
||||
@OptionalParam(name="organization", targetTypes={ Organization.class } )
|
||||
ReferenceAndListParam theOrganization,
|
||||
|
||||
@Description(shortDefinition="Patient's nominated care provider, could be a care manager, not the organization that manages the record")
|
||||
@OptionalParam(name="careprovider", targetTypes={ Organization.class , Practitioner.class } )
|
||||
ReferenceAndListParam theCareprovider,
|
||||
|
||||
@Description(shortDefinition="Whether the patient record is active")
|
||||
@OptionalParam(name="active")
|
||||
TokenAndListParam theActive,
|
||||
|
||||
@Description(shortDefinition="The species for animal patients")
|
||||
@OptionalParam(name="animal-species")
|
||||
TokenAndListParam theAnimal_species,
|
||||
|
||||
@Description(shortDefinition="The breed for animal patients")
|
||||
@OptionalParam(name="animal-breed")
|
||||
TokenAndListParam theAnimal_breed,
|
||||
|
||||
@Description(shortDefinition="All patients linked to the given patient")
|
||||
@OptionalParam(name="link", targetTypes={ Patient.class } )
|
||||
ReferenceAndListParam theLink,
|
||||
|
||||
@Description(shortDefinition="This patient has been marked as deceased, or as a death date entered")
|
||||
@OptionalParam(name="deceased")
|
||||
TokenAndListParam theDeceased,
|
||||
|
||||
@Description(shortDefinition="The date of death has been provided and satisfies this search value")
|
||||
@OptionalParam(name="deathdate")
|
||||
DateRangeParam theDeathdate,
|
||||
|
||||
@IncludeParam(reverse=true)
|
||||
Set<Include> theRevIncludes,
|
||||
@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
|
||||
@OptionalParam(name="_lastUpdated")
|
||||
DateRangeParam theLastUpdated,
|
||||
|
||||
@IncludeParam(allow= {
|
||||
"Patient:careprovider" , "Patient:link" , "Patient:organization" , "Patient:careprovider" , "Patient:link" , "Patient:organization" , "Patient:careprovider" , "Patient:link" , "Patient:organization" , "*"
|
||||
})
|
||||
Set<Include> theIncludes,
|
||||
|
||||
@Sort
|
||||
SortSpec theSort,
|
||||
|
||||
@ca.uhn.fhir.rest.annotation.Count
|
||||
Integer theCount
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,739 @@
|
|||
package org.hl7.fhir.dstu21.hapi.rest.server;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.servlet.ServletConfig;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.hl7.fhir.dstu21.model.Conformance;
|
||||
import org.hl7.fhir.dstu21.model.Conformance.ConditionalDeleteStatus;
|
||||
import org.hl7.fhir.dstu21.model.Conformance.ConformanceRestComponent;
|
||||
import org.hl7.fhir.dstu21.model.Conformance.ConformanceRestResourceComponent;
|
||||
import org.hl7.fhir.dstu21.model.Conformance.ConformanceRestResourceSearchParamComponent;
|
||||
import org.hl7.fhir.dstu21.model.Conformance.SystemRestfulInteraction;
|
||||
import org.hl7.fhir.dstu21.model.Conformance.TypeRestfulInteraction;
|
||||
import org.hl7.fhir.dstu21.model.DateType;
|
||||
import org.hl7.fhir.dstu21.model.DiagnosticReport;
|
||||
import org.hl7.fhir.dstu21.model.IdType;
|
||||
import org.hl7.fhir.dstu21.model.OperationDefinition;
|
||||
import org.hl7.fhir.dstu21.model.Patient;
|
||||
import org.hl7.fhir.dstu21.model.StringType;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.rest.annotation.ConditionalUrlParam;
|
||||
import ca.uhn.fhir.rest.annotation.Create;
|
||||
import ca.uhn.fhir.rest.annotation.Delete;
|
||||
import ca.uhn.fhir.rest.annotation.History;
|
||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||
import ca.uhn.fhir.rest.annotation.IncludeParam;
|
||||
import ca.uhn.fhir.rest.annotation.Operation;
|
||||
import ca.uhn.fhir.rest.annotation.OperationParam;
|
||||
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
||||
import ca.uhn.fhir.rest.annotation.Read;
|
||||
import ca.uhn.fhir.rest.annotation.RequiredParam;
|
||||
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
||||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.annotation.Update;
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.method.BaseMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.IParameter;
|
||||
import ca.uhn.fhir.rest.method.SearchMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
|
||||
import ca.uhn.fhir.rest.param.StringParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenParam;
|
||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
||||
import ca.uhn.fhir.rest.server.ResourceBinding;
|
||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
|
||||
public class ServerConformanceProviderDstu21Test {
|
||||
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2_1();
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServerConformanceProviderDstu21Test.class);
|
||||
|
||||
private HttpServletRequest createHttpServletRequest() {
|
||||
HttpServletRequest req = mock(HttpServletRequest.class);
|
||||
when(req.getRequestURI()).thenReturn("/FhirStorm/fhir/Patient/_search");
|
||||
when(req.getServletPath()).thenReturn("/fhir");
|
||||
when(req.getRequestURL()).thenReturn(new StringBuffer().append("http://fhirstorm.dyndns.org:8080/FhirStorm/fhir/Patient/_search"));
|
||||
when(req.getContextPath()).thenReturn("/FhirStorm");
|
||||
return req;
|
||||
}
|
||||
|
||||
private ServletConfig createServletConfig() {
|
||||
ServletConfig sc = mock(ServletConfig.class);
|
||||
when(sc.getServletContext()).thenReturn(null);
|
||||
return sc;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertTrue(res.getConditionalCreate());
|
||||
assertEquals(ConditionalDeleteStatus.MULTIPLE, res.getConditionalDelete());
|
||||
assertTrue(res.getConditionalUpdate());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtendedOperationReturningBundle() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ProviderWithExtendedOperationReturningBundle());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertEquals(1, conformance.getRest().get(0).getOperation().size());
|
||||
assertEquals("$everything", conformance.getRest().get(0).getOperation().get(0).getName());
|
||||
assertEquals("OperationDefinition/everything", conformance.getRest().get(0).getOperation().get(0).getDefinition().getReferenceElement().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtendedOperationReturningBundleOperation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ProviderWithExtendedOperationReturningBundle());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs) {
|
||||
};
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/everything"));
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertEquals("$everything", opDef.getCode());
|
||||
assertEquals(true, opDef.getIdempotent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInstanceHistorySupported() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new InstanceHistoryProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
conf = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(conformance);
|
||||
assertThat(conf, containsString("<interaction><code value=\"" + TypeRestfulInteraction.HISTORYINSTANCE.toCode() + "\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultiOptionalDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new MultiOptionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().iterator().next();
|
||||
assertEquals("The patient's identifier", param.getDescription());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertThat(conf, containsString("<documentation value=\"The patient's identifier\"/>"));
|
||||
assertThat(conf, containsString("<documentation value=\"The patient's name\"/>"));
|
||||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonConditionalOperations() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new NonConditionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent res = conformance.getRest().get(0).getResource().get(1);
|
||||
assertEquals("Patient", res.getType());
|
||||
|
||||
assertNull(res.getConditionalCreateElement().getValue());
|
||||
assertNull(res.getConditionalDeleteElement().getValue());
|
||||
assertNull(res.getConditionalUpdateElement().getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new SearchProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
for (IParameter next : binding.getParameters()) {
|
||||
SearchParameter param = (SearchParameter) next;
|
||||
if (param.getDescription().contains("The patient's identifier (MRN or other card number")) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info("AAAAAA" + conf);
|
||||
|
||||
assertThat(conf, containsString("<documentation value=\"The patient's identifier (MRN or other card number)\"/>"));
|
||||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOperationOnNoTypes() throws Exception {
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new PlainProviderWithExtendedOperationOnNoType());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs) {
|
||||
@Override
|
||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||
return super.getServerConformance(theRequest);
|
||||
}
|
||||
};
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance sconf = sc.getServerConformance(createHttpServletRequest());
|
||||
assertEquals("OperationDefinition/plain", sconf.getRest().get(0).getOperation().get(0).getDefinition().getReferenceElement().getValue());
|
||||
|
||||
OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/plain"));
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertEquals("$plain", opDef.getCode());
|
||||
assertEquals(true, opDef.getIdempotent());
|
||||
assertEquals(3, opDef.getParameter().size());
|
||||
assertEquals("start", opDef.getParameter().get(0).getName());
|
||||
assertEquals("in", opDef.getParameter().get(0).getUse().toCode());
|
||||
assertEquals("0", opDef.getParameter().get(0).getMinElement().getValueAsString());
|
||||
assertEquals("date", opDef.getParameter().get(0).getTypeElement().getValueAsString());
|
||||
|
||||
assertEquals("out1", opDef.getParameter().get(2).getName());
|
||||
assertEquals("out", opDef.getParameter().get(2).getUse().toCode());
|
||||
assertEquals("1", opDef.getParameter().get(2).getMinElement().getValueAsString());
|
||||
assertEquals("2", opDef.getParameter().get(2).getMaxElement().getValueAsString());
|
||||
assertEquals("string", opDef.getParameter().get(2).getTypeElement().getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProviderWithRequiredAndOptional() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ProviderWithRequiredAndOptional());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestComponent rest = conformance.getRest().get(0);
|
||||
ConformanceRestResourceComponent res = rest.getResource().get(0);
|
||||
assertEquals("DiagnosticReport", res.getType());
|
||||
|
||||
assertEquals(DiagnosticReport.SP_SUBJECT, res.getSearchParam().get(0).getName());
|
||||
assertEquals("identifier", res.getSearchParam().get(0).getChain().get(0).getValue());
|
||||
|
||||
assertEquals(DiagnosticReport.SP_CODE, res.getSearchParam().get(1).getName());
|
||||
|
||||
assertEquals(DiagnosticReport.SP_DATE, res.getSearchParam().get(2).getName());
|
||||
|
||||
assertEquals(1, res.getSearchInclude().size());
|
||||
assertEquals("DiagnosticReport.result", res.getSearchInclude().get(0).getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadAndVReadSupported() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new VreadProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
conf = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(conformance);
|
||||
assertThat(conf, containsString("<interaction><code value=\"vread\"/></interaction>"));
|
||||
assertThat(conf, containsString("<interaction><code value=\"read\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSupported() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new ReadProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
conf = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(conformance);
|
||||
assertThat(conf, not(containsString("<interaction><code value=\"vread\"/></interaction>")));
|
||||
assertThat(conf, containsString("<interaction><code value=\"read\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSearchParameterDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new SearchProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
for (IParameter next : binding.getParameters()) {
|
||||
SearchParameter param = (SearchParameter) next;
|
||||
if (param.getDescription().contains("The patient's identifier (MRN or other card number")) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
assertThat(conf, containsString("<documentation value=\"The patient's identifier (MRN or other card number)\"/>"));
|
||||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #286
|
||||
*/
|
||||
@Test
|
||||
public void testSearchReferenceParameterWithWhitelistDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new SearchProviderWithWhitelist());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().get(0);
|
||||
assertEquals("The organization at which this person is a patient", param.getDescription());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
ConformanceRestResourceComponent resource = findRestResource(conformance, "Patient");
|
||||
|
||||
ConformanceRestResourceSearchParamComponent param = resource.getSearchParam().get(0);
|
||||
assertEquals("bar", param.getChain().get(0).getValue());
|
||||
assertEquals("foo", param.getChain().get(1).getValue());
|
||||
assertEquals(2, param.getChain().size());
|
||||
}
|
||||
|
||||
private ConformanceRestResourceComponent findRestResource(Conformance conformance, String wantResource) throws Exception {
|
||||
ConformanceRestResourceComponent resource = null;
|
||||
for (ConformanceRestResourceComponent next : conformance.getRest().get(0).getResource()) {
|
||||
if (next.getType().equals(wantResource)) {
|
||||
resource = next;
|
||||
}
|
||||
}
|
||||
if (resource == null) {
|
||||
throw new Exception("Could not find resource: " + wantResource);
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* See #286
|
||||
*/
|
||||
@Test
|
||||
public void testSearchReferenceParameterDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new PatientResourceProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().get(25);
|
||||
assertEquals("The organization at which this person is a patient", param.getDescription());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSystemHistorySupported() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new SystemHistoryProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
conf = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(conformance);
|
||||
assertThat(conf, containsString("<interaction><code value=\"" + SystemRestfulInteraction.HISTORYSYSTEM.toCode() + "\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTypeHistorySupported() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new TypeHistoryProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
conf = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(conformance);
|
||||
assertThat(conf, containsString("<interaction><code value=\"" + TypeRestfulInteraction.HISTORYTYPE.toCode() + "\"/></interaction>"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateGeneratedStatement() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new MultiOptionalProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance));
|
||||
|
||||
ValidationResult result = ourCtx.newValidator().validateWithResult(conformance);
|
||||
assertTrue(result.getMessages().toString(), result.isSuccessful());
|
||||
}
|
||||
|
||||
public static class ConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdType theId, @ConditionalUrlParam(supportsMultiple = true) String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdType theId, @ResourceParam Patient thePatient, @ConditionalUrlParam String theConditionalUrl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class InstanceHistoryProvider implements IResourceProvider {
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@History
|
||||
public List<IBaseResource> history(@IdParam IdType theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public static class MultiOptionalProvider {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient(@Description(shortDefinition = "The patient's identifier") @OptionalParam(name = Patient.SP_IDENTIFIER) TokenParam theIdentifier, @Description(shortDefinition = "The patient's name") @OptionalParam(name = Patient.SP_NAME) StringParam theName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class NonConditionalProvider implements IResourceProvider {
|
||||
|
||||
@Create
|
||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Delete
|
||||
public MethodOutcome delete(@IdParam IdType theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome update(@IdParam IdType theId, @ResourceParam Patient thePatient) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class PlainProviderWithExtendedOperationOnNoType {
|
||||
|
||||
@Operation(name = "plain", idempotent = true, returnParameters = { @OperationParam(min = 1, max = 2, name = "out1", type = StringType.class) })
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam IdType theId, @OperationParam(name = "start") DateType theStart, @OperationParam(name = "end") DateType theEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ProviderWithExtendedOperationReturningBundle implements IResourceProvider {
|
||||
|
||||
@Operation(name = "everything", idempotent = true)
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam IdType theId, @OperationParam(name = "start") DateType theStart, @OperationParam(name = "end") DateType theEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class ProviderWithRequiredAndOptional {
|
||||
|
||||
@Description(shortDefinition = "This is a search for stuff!")
|
||||
@Search
|
||||
public List<DiagnosticReport> findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) TokenParam thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames,
|
||||
@OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public static class ReadProvider {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient(@Description(shortDefinition = "The patient's identifier (MRN or other card number)") @RequiredParam(name = Patient.SP_IDENTIFIER) TokenParam theIdentifier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Read(version = false)
|
||||
public Patient readPatient(@IdParam IdType theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SearchProvider {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient1(@Description(shortDefinition = "The patient's identifier (MRN or other card number)") @RequiredParam(name = Patient.SP_IDENTIFIER) TokenParam theIdentifier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient2(@Description(shortDefinition = "All patients linked to the given patient") @OptionalParam(name = "link", targetTypes = { Patient.class }) ReferenceAndListParam theLink) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SearchProviderWithWhitelist {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient1(
|
||||
@Description(shortDefinition = "The organization at which this person is a patient")
|
||||
@RequiredParam(name = Patient.SP_ORGANIZATION, chainWhitelist= {"foo", "bar"})
|
||||
ReferenceAndListParam theIdentifier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SystemHistoryProvider {
|
||||
|
||||
@History
|
||||
public List<IBaseResource> history() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class TypeHistoryProvider implements IResourceProvider {
|
||||
|
||||
@Override
|
||||
public Class<? extends IBaseResource> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
@History
|
||||
public List<IBaseResource> history() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public static class VreadProvider {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient(@Description(shortDefinition = "The patient's identifier (MRN or other card number)") @RequiredParam(name = Patient.SP_IDENTIFIER) TokenParam theIdentifier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Read(version = true)
|
||||
public Patient readPatient(@IdParam IdType theId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -27,9 +27,14 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
The JPA project uses a newer API but we'll try to hold to this version
|
||||
as much as possible. See #283.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -72,6 +72,7 @@ import ca.uhn.fhir.rest.method.IParameter;
|
|||
import ca.uhn.fhir.rest.method.OperationMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.OperationMethodBinding.ReturnType;
|
||||
import ca.uhn.fhir.rest.method.OperationParameter;
|
||||
import ca.uhn.fhir.rest.method.RestSearchParameterTypeEnum;
|
||||
import ca.uhn.fhir.rest.method.SearchMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
|
@ -206,7 +207,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
String resourceName = nextEntry.getKey();
|
||||
RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName);
|
||||
resource.getTypeElement().setValue(def.getName());
|
||||
ServletContext servletContext = theRequest == null ? null : theRequest.getServletContext();
|
||||
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||
resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
|
||||
|
||||
|
@ -423,6 +424,15 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
|||
if (StringUtils.isNotBlank(chain)) {
|
||||
param.addChain(chain);
|
||||
}
|
||||
|
||||
if (nextParameter.getParamType() == RestSearchParameterTypeEnum.REFERENCE) {
|
||||
for (String nextWhitelist : new TreeSet<String>(nextParameter.getQualifierWhitelist())) {
|
||||
if (nextWhitelist.startsWith(".")) {
|
||||
param.addChain(nextWhitelist.substring(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
param.setDocumentation(nextParamDescription);
|
||||
if (nextParameter.getParamType() != null) {
|
||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||
|
|
|
@ -41,6 +41,21 @@ public class BaseDateTimeDtDstu2Test {
|
|||
assertEquals("2012-01-02", date.getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMinutePrecisionEncode() throws Exception {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 3, 3, 22, 11);
|
||||
|
||||
DateTimeDt date = new DateTimeDt();
|
||||
date.setValue(cal.getTime(), TemporalPrecisionEnum.MINUTE);
|
||||
date.setTimeZone(TimeZone.getTimeZone("EST"));
|
||||
assertEquals("1990-01-02T21:22-05:00", date.getValueAsString());
|
||||
|
||||
date.setTimeZoneZulu(true);
|
||||
assertEquals("1990-01-03T02:22Z", date.getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
* See HAPI #101 - https://github.com/jamesagnew/hapi-fhir/issues/101
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.model.primitive;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.TimeZone;
|
||||
|
@ -36,4 +38,18 @@ public class DateDtTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConstructors() {
|
||||
final Calendar cal = Calendar.getInstance();
|
||||
cal.setTimeZone(TimeZone.getTimeZone("Europe/Berlin"));
|
||||
cal.set(1990, Calendar.JANUARY, 5, 0, 0, 0);
|
||||
DateDt dateDt = new DateDt(cal);
|
||||
assertEquals("1990-01-05", dateDt.getValueAsString());
|
||||
|
||||
dateDt = new DateDt(1990, 0, 5);
|
||||
assertEquals("1990-01-05", dateDt.getValueAsString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,189 @@
|
|||
|
||||
package ca.uhn.fhir.rest.server;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import ca.uhn.fhir.model.api.Include;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
//
|
||||
import ca.uhn.fhir.model.dstu2.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Practitioner;
|
||||
import ca.uhn.fhir.rest.annotation.IncludeParam;
|
||||
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
||||
import ca.uhn.fhir.rest.annotation.Search;
|
||||
import ca.uhn.fhir.rest.annotation.Sort;
|
||||
import ca.uhn.fhir.rest.api.SortSpec;
|
||||
// import ca.uhn.fhir.model.dstu.resource.Binary;
|
||||
// import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
// import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
|
||||
import ca.uhn.fhir.rest.param.StringAndListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenAndListParam;
|
||||
import ca.uhn.fhir.rest.param.UriAndListParam;
|
||||
|
||||
public class PatientResourceProvider implements IResourceProvider
|
||||
{
|
||||
|
||||
@Override
|
||||
public Class<Patient> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
//@formatter:off
|
||||
@Search()
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider search(
|
||||
javax.servlet.http.HttpServletRequest theServletRequest,
|
||||
|
||||
@Description(shortDefinition="The resource identity")
|
||||
@OptionalParam(name="_id")
|
||||
StringAndListParam theId,
|
||||
|
||||
@Description(shortDefinition="The resource language")
|
||||
@OptionalParam(name="_language")
|
||||
StringAndListParam theResourceLanguage,
|
||||
|
||||
@Description(shortDefinition="Search the contents of the resource's data using a fulltext search")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_CONTENT)
|
||||
StringAndListParam theFtContent,
|
||||
|
||||
@Description(shortDefinition="Search the contents of the resource's narrative using a fulltext search")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_TEXT)
|
||||
StringAndListParam theFtText,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given tag")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_TAG)
|
||||
TokenAndListParam theSearchForTag,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given security labels")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_SECURITY)
|
||||
TokenAndListParam theSearchForSecurity,
|
||||
|
||||
@Description(shortDefinition="Search for resources which have the given profile")
|
||||
@OptionalParam(name=ca.uhn.fhir.rest.server.Constants.PARAM_PROFILE)
|
||||
UriAndListParam theSearchForProfile,
|
||||
|
||||
|
||||
@Description(shortDefinition="A patient identifier")
|
||||
@OptionalParam(name="identifier")
|
||||
TokenAndListParam theIdentifier,
|
||||
|
||||
@Description(shortDefinition="A portion of either family or given name of the patient")
|
||||
@OptionalParam(name="name")
|
||||
StringAndListParam theName,
|
||||
|
||||
@Description(shortDefinition="A portion of the family name of the patient")
|
||||
@OptionalParam(name="family")
|
||||
StringAndListParam theFamily,
|
||||
|
||||
@Description(shortDefinition="A portion of the given name of the patient")
|
||||
@OptionalParam(name="given")
|
||||
StringAndListParam theGiven,
|
||||
|
||||
@Description(shortDefinition="A portion of either family or given name using some kind of phonetic matching algorithm")
|
||||
@OptionalParam(name="phonetic")
|
||||
StringAndListParam thePhonetic,
|
||||
|
||||
@Description(shortDefinition="The value in any kind of telecom details of the patient")
|
||||
@OptionalParam(name="telecom")
|
||||
TokenAndListParam theTelecom,
|
||||
|
||||
@Description(shortDefinition="A value in a phone contact")
|
||||
@OptionalParam(name="phone")
|
||||
TokenAndListParam thePhone,
|
||||
|
||||
@Description(shortDefinition="A value in an email contact")
|
||||
@OptionalParam(name="email")
|
||||
TokenAndListParam theEmail,
|
||||
|
||||
@Description(shortDefinition="An address in any kind of address/part of the patient")
|
||||
@OptionalParam(name="address")
|
||||
StringAndListParam theAddress,
|
||||
|
||||
@Description(shortDefinition="A city specified in an address")
|
||||
@OptionalParam(name="address-city")
|
||||
StringAndListParam theAddress_city,
|
||||
|
||||
@Description(shortDefinition="A state specified in an address")
|
||||
@OptionalParam(name="address-state")
|
||||
StringAndListParam theAddress_state,
|
||||
|
||||
@Description(shortDefinition="A postalCode specified in an address")
|
||||
@OptionalParam(name="address-postalcode")
|
||||
StringAndListParam theAddress_postalcode,
|
||||
|
||||
@Description(shortDefinition="A country specified in an address")
|
||||
@OptionalParam(name="address-country")
|
||||
StringAndListParam theAddress_country,
|
||||
|
||||
@Description(shortDefinition="A use code specified in an address")
|
||||
@OptionalParam(name="address-use")
|
||||
TokenAndListParam theAddress_use,
|
||||
|
||||
@Description(shortDefinition="Gender of the patient")
|
||||
@OptionalParam(name="gender")
|
||||
TokenAndListParam theGender,
|
||||
|
||||
@Description(shortDefinition="Language code (irrespective of use value)")
|
||||
@OptionalParam(name="language")
|
||||
TokenAndListParam theLanguage,
|
||||
|
||||
@Description(shortDefinition="The patient's date of birth")
|
||||
@OptionalParam(name="birthdate")
|
||||
DateRangeParam theBirthdate,
|
||||
|
||||
@Description(shortDefinition="The organization at which this person is a patient")
|
||||
@OptionalParam(name="organization", targetTypes={ Organization.class } )
|
||||
ReferenceAndListParam theOrganization,
|
||||
|
||||
@Description(shortDefinition="Patient's nominated care provider, could be a care manager, not the organization that manages the record")
|
||||
@OptionalParam(name="careprovider", targetTypes={ Organization.class , Practitioner.class } )
|
||||
ReferenceAndListParam theCareprovider,
|
||||
|
||||
@Description(shortDefinition="Whether the patient record is active")
|
||||
@OptionalParam(name="active")
|
||||
TokenAndListParam theActive,
|
||||
|
||||
@Description(shortDefinition="The species for animal patients")
|
||||
@OptionalParam(name="animal-species")
|
||||
TokenAndListParam theAnimal_species,
|
||||
|
||||
@Description(shortDefinition="The breed for animal patients")
|
||||
@OptionalParam(name="animal-breed")
|
||||
TokenAndListParam theAnimal_breed,
|
||||
|
||||
@Description(shortDefinition="All patients linked to the given patient")
|
||||
@OptionalParam(name="link", targetTypes={ Patient.class } )
|
||||
ReferenceAndListParam theLink,
|
||||
|
||||
@Description(shortDefinition="This patient has been marked as deceased, or as a death date entered")
|
||||
@OptionalParam(name="deceased")
|
||||
TokenAndListParam theDeceased,
|
||||
|
||||
@Description(shortDefinition="The date of death has been provided and satisfies this search value")
|
||||
@OptionalParam(name="deathdate")
|
||||
DateRangeParam theDeathdate,
|
||||
|
||||
@IncludeParam(reverse=true)
|
||||
Set<Include> theRevIncludes,
|
||||
@Description(shortDefinition="Only return resources which were last updated as specified by the given range")
|
||||
@OptionalParam(name="_lastUpdated")
|
||||
DateRangeParam theLastUpdated,
|
||||
|
||||
@IncludeParam(allow= {
|
||||
"Patient:careprovider" , "Patient:link" , "Patient:organization" , "Patient:careprovider" , "Patient:link" , "Patient:organization" , "Patient:careprovider" , "Patient:link" , "Patient:organization" , "*"
|
||||
})
|
||||
Set<Include> theIncludes,
|
||||
|
||||
@Sort
|
||||
SortSpec theSort,
|
||||
|
||||
@ca.uhn.fhir.rest.annotation.Count
|
||||
Integer theCount
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
//@formatter:on
|
||||
|
||||
}
|
|
@ -26,6 +26,7 @@ import ca.uhn.fhir.model.dstu2.composite.IdentifierDt;
|
|||
import ca.uhn.fhir.model.dstu2.resource.Conformance;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Conformance.Rest;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Conformance.RestResource;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Conformance.RestResourceSearchParam;
|
||||
import ca.uhn.fhir.model.dstu2.resource.DiagnosticReport;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
|
@ -51,9 +52,11 @@ import ca.uhn.fhir.rest.annotation.Search;
|
|||
import ca.uhn.fhir.rest.annotation.Update;
|
||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
||||
import ca.uhn.fhir.rest.method.BaseMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.IParameter;
|
||||
import ca.uhn.fhir.rest.method.SearchMethodBinding;
|
||||
import ca.uhn.fhir.rest.method.SearchParameter;
|
||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||
import ca.uhn.fhir.rest.param.ReferenceAndListParam;
|
||||
import ca.uhn.fhir.rest.param.TokenOrListParam;
|
||||
import ca.uhn.fhir.rest.server.provider.dstu2.ServerConformanceProvider;
|
||||
import ca.uhn.fhir.validation.ValidationResult;
|
||||
|
@ -235,16 +238,19 @@ public class ServerConformanceProviderDstu2Test {
|
|||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().iterator().next();
|
||||
assertEquals("The patient's identifier (MRN or other card number)", param.getDescription());
|
||||
found = true;
|
||||
for (IParameter next : binding.getParameters()) {
|
||||
SearchParameter param = (SearchParameter) next;
|
||||
if (param.getDescription().contains("The patient's identifier (MRN or other card number")) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
ourLog.info("AAAAAA" + conf);
|
||||
|
||||
assertThat(conf, containsString("<documentation value=\"The patient's identifier (MRN or other card number)\"/>"));
|
||||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
|
@ -376,8 +382,12 @@ public class ServerConformanceProviderDstu2Test {
|
|||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().iterator().next();
|
||||
assertEquals("The patient's identifier (MRN or other card number)", param.getDescription());
|
||||
for (IParameter next : binding.getParameters()) {
|
||||
SearchParameter param = (SearchParameter) next;
|
||||
if (param.getDescription().contains("The patient's identifier (MRN or other card number")) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
|
@ -391,6 +401,91 @@ public class ServerConformanceProviderDstu2Test {
|
|||
assertThat(conf, containsString("<type value=\"token\"/>"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* See #286
|
||||
*/
|
||||
@Test
|
||||
public void testSearchReferenceParameterWithWhitelistDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new SearchProviderWithWhitelist());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().get(0);
|
||||
assertEquals("The organization at which this person is a patient", param.getDescription());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
RestResource resource = findRestResource(conformance, "Patient");
|
||||
|
||||
RestResourceSearchParam param = resource.getSearchParam().get(0);
|
||||
assertEquals("bar", param.getChain().get(0).getValue());
|
||||
assertEquals("foo", param.getChain().get(1).getValue());
|
||||
assertEquals(2, param.getChain().size());
|
||||
}
|
||||
|
||||
private RestResource findRestResource(Conformance conformance, String wantResource) throws Exception {
|
||||
RestResource resource = null;
|
||||
for (RestResource next : conformance.getRest().get(0).getResource()) {
|
||||
if (next.getType().equals(wantResource)) {
|
||||
resource = next;
|
||||
}
|
||||
}
|
||||
if (resource == null) {
|
||||
throw new Exception("Could not find resource: " + wantResource);
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* See #286
|
||||
*/
|
||||
@Test
|
||||
public void testSearchReferenceParameterDocumentation() throws Exception {
|
||||
|
||||
RestfulServer rs = new RestfulServer(ourCtx);
|
||||
rs.setProviders(new PatientResourceProvider());
|
||||
|
||||
ServerConformanceProvider sc = new ServerConformanceProvider(rs);
|
||||
rs.setServerConformanceProvider(sc);
|
||||
|
||||
rs.init(createServletConfig());
|
||||
|
||||
boolean found = false;
|
||||
Collection<ResourceBinding> resourceBindings = rs.getResourceBindings();
|
||||
for (ResourceBinding resourceBinding : resourceBindings) {
|
||||
if (resourceBinding.getResourceName().equals("Patient")) {
|
||||
List<BaseMethodBinding<?>> methodBindings = resourceBinding.getMethodBindings();
|
||||
SearchMethodBinding binding = (SearchMethodBinding) methodBindings.get(0);
|
||||
SearchParameter param = (SearchParameter) binding.getParameters().get(25);
|
||||
assertEquals("The organization at which this person is a patient", param.getDescription());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
Conformance conformance = sc.getServerConformance(createHttpServletRequest());
|
||||
|
||||
String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(conformance);
|
||||
ourLog.info(conf);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSystemHistorySupported() throws Exception {
|
||||
|
@ -491,8 +586,7 @@ public class ServerConformanceProviderDstu2Test {
|
|||
public static class MultiOptionalProvider {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient(@Description(shortDefinition = "The patient's identifier") @OptionalParam(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier,
|
||||
@Description(shortDefinition = "The patient's name") @OptionalParam(name = Patient.SP_NAME) StringDt theName) {
|
||||
public Patient findPatient(@Description(shortDefinition = "The patient's identifier") @OptionalParam(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier, @Description(shortDefinition = "The patient's name") @OptionalParam(name = Patient.SP_NAME) StringDt theName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -525,8 +619,7 @@ public class ServerConformanceProviderDstu2Test {
|
|||
public static class PlainProviderWithExtendedOperationOnNoType {
|
||||
|
||||
@Operation(name = "plain", idempotent = true, returnParameters = { @OperationParam(min = 1, max = 2, name = "out1", type = StringDt.class) })
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam ca.uhn.fhir.model.primitive.IdDt theId,
|
||||
@OperationParam(name = "start") DateDt theStart, @OperationParam(name = "end") DateDt theEnd) {
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam ca.uhn.fhir.model.primitive.IdDt theId, @OperationParam(name = "start") DateDt theStart, @OperationParam(name = "end") DateDt theEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -535,8 +628,7 @@ public class ServerConformanceProviderDstu2Test {
|
|||
public static class ProviderWithExtendedOperationReturningBundle implements IResourceProvider {
|
||||
|
||||
@Operation(name = "everything", idempotent = true)
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam ca.uhn.fhir.model.primitive.IdDt theId,
|
||||
@OperationParam(name = "start") DateDt theStart, @OperationParam(name = "end") DateDt theEnd) {
|
||||
public ca.uhn.fhir.rest.server.IBundleProvider everything(javax.servlet.http.HttpServletRequest theServletRequest, @IdParam ca.uhn.fhir.model.primitive.IdDt theId, @OperationParam(name = "start") DateDt theStart, @OperationParam(name = "end") DateDt theEnd) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -551,9 +643,8 @@ public class ServerConformanceProviderDstu2Test {
|
|||
|
||||
@Description(shortDefinition = "This is a search for stuff!")
|
||||
@Search
|
||||
public List<DiagnosticReport> findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId,
|
||||
@OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames, @OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange,
|
||||
@IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
|
||||
public List<DiagnosticReport> findDiagnosticReportsByPatient(@RequiredParam(name = DiagnosticReport.SP_SUBJECT + '.' + Patient.SP_IDENTIFIER) IdentifierDt thePatientId, @OptionalParam(name = DiagnosticReport.SP_CODE) TokenOrListParam theNames,
|
||||
@OptionalParam(name = DiagnosticReport.SP_DATE) DateRangeParam theDateRange, @IncludeParam(allow = { "DiagnosticReport.result" }) Set<Include> theIncludes) throws Exception {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -576,13 +667,27 @@ public class ServerConformanceProviderDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by dsotnikov on 2/25/2014.
|
||||
*/
|
||||
public static class SearchProvider {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient(@Description(shortDefinition = "The patient's identifier (MRN or other card number)") @RequiredParam(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier) {
|
||||
public Patient findPatient1(@Description(shortDefinition = "The patient's identifier (MRN or other card number)") @RequiredParam(name = Patient.SP_IDENTIFIER) IdentifierDt theIdentifier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient2(@Description(shortDefinition = "All patients linked to the given patient") @OptionalParam(name = "link", targetTypes = { Patient.class }) ReferenceAndListParam theLink) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class SearchProviderWithWhitelist {
|
||||
|
||||
@Search(type = Patient.class)
|
||||
public Patient findPatient1(
|
||||
@Description(shortDefinition = "The organization at which this person is a patient")
|
||||
@RequiredParam(name = Patient.SP_ORGANIZATION, chainWhitelist= {"foo", "bar"})
|
||||
ReferenceAndListParam theIdentifier) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,13 +26,18 @@
|
|||
<version>1.4-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!--
|
||||
The JPA project uses a newer API but we'll try to hold to this version
|
||||
as much as possible. See #283.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- <dependency> <groupId>net.sf.saxon</groupId> <artifactId>saxon</artifactId>
|
||||
<version>8.7</version> </dependency> -->
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBase;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
import org.hl7.fhir.instance.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public abstract class Base implements Serializable, IBase {
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package org.hl7.fhir.instance.model;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
|
||||
import org.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
import org.hl7.fhir.instance.utilities.xhtml.XhtmlNode;
|
||||
|
||||
public abstract class BaseNarrative extends Type implements INarrative {
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -38,7 +38,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -39,7 +39,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcome;
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcomeEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.api.IBaseCoding;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.hl7.fhir.instance.model;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
/**
|
||||
* See http://www.healthintersections.com.au/?p=1941
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.hl7.fhir.instance.model.Enumerations.ConceptMapEquivalenceEnumFactory
|
|||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -40,7 +40,7 @@ import org.hl7.fhir.instance.model.Enumerations.SearchParamType;
|
|||
import org.hl7.fhir.instance.model.Enumerations.SearchParamTypeEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseConformance;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -38,7 +38,7 @@ import org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus;
|
|||
import org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.DocumentReferenceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseHasExtensions;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -37,7 +37,7 @@ import org.hl7.fhir.instance.model.Enumerations.BindingStrength;
|
|||
import org.hl7.fhir.instance.model.Enumerations.BindingStrengthEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseDatatypeElement;
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcome;
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcomeEnumFactory;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcome;
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcomeEnumFactory;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcome;
|
||||
import org.hl7.fhir.instance.model.Enumerations.RemittanceOutcomeEnumFactory;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -6,8 +6,8 @@ import java.util.UUID;
|
|||
|
||||
import org.hl7.fhir.instance.model.ContactPoint.ContactPointSystem;
|
||||
import org.hl7.fhir.instance.model.Narrative.NarrativeStatus;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlParser;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.xhtml.XhtmlParser;
|
||||
|
||||
/*
|
||||
Copyright (c) 2011+, HL7, Inc
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.Enumerations.AdministrativeGender;
|
||||
import org.hl7.fhir.instance.model.Enumerations.AdministrativeGenderEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.ICompositeType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseMetaType;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -37,7 +37,7 @@ import java.util.List;
|
|||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -33,7 +33,7 @@ package org.hl7.fhir.instance.model;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.INarrative;
|
||||
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
|
||||
import org.hl7.fhir.instance.utilities.xhtml.XhtmlNode;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -39,7 +39,7 @@ import org.hl7.fhir.instance.model.Enumerations.BindingStrengthEnumFactory;
|
|||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatus;
|
||||
import org.hl7.fhir.instance.model.Enumerations.ConformanceResourceStatusEnumFactory;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -35,7 +35,7 @@ import java.util.List;
|
|||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
|
||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Block;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
|
|
|
@ -34,7 +34,7 @@ import java.util.ArrayList;
|
|||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import org.hl7.fhir.utilities.Utilities;
|
||||
import org.hl7.fhir.instance.utilities.Utilities;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue