Fix #69
This commit is contained in:
parent
0e06e322c3
commit
0b44a32910
|
@ -28,9 +28,9 @@
|
||||||
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="owner.project.facets" value="java"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
|
Binary file not shown.
|
@ -7,9 +7,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.6
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
|
@ -97,4 +97,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
|
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.6
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<installed facet="jst.utility" version="1.0"/>
|
<installed facet="jst.utility" version="1.0"/>
|
||||||
<installed facet="java" version="1.6"/>
|
<installed facet="java" version="1.8"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
|
@ -203,6 +203,11 @@
|
||||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
||||||
<version>0.9-SNAPSHOT</version>
|
<version>0.9-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-android</artifactId>
|
||||||
|
<version>${slf4j_version}</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -225,10 +230,13 @@
|
||||||
<include>javax.json:javax.json-api</include>
|
<include>javax.json:javax.json-api</include>
|
||||||
-->
|
-->
|
||||||
<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu</include>
|
<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu</include>
|
||||||
|
<include>ca.uhn.hapi.fhir:hapi-fhir-structures-dstu</include>
|
||||||
<include>org.glassfish:javax.json</include>
|
<include>org.glassfish:javax.json</include>
|
||||||
<include>org.codehaus.woodstox:woodstox-core-asl</include>
|
<include>org.codehaus.woodstox:woodstox-core-asl</include>
|
||||||
<include>javax.xml.stream:stax-api</include>
|
<include>javax.xml.stream:stax-api</include>
|
||||||
<include>org.codehaus.woodstox:stax2-api</include>
|
<include>org.codehaus.woodstox:stax2-api</include>
|
||||||
|
<include>org.slf4j:slf4j*</include>
|
||||||
|
<include>org.apache.commons:*</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
<relocations>
|
<relocations>
|
||||||
|
|
|
@ -210,10 +210,21 @@ public class BundleEntry extends BaseBundle {
|
||||||
return myTitle;
|
return myTitle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated <b>DSTU2 Note:</b> As of DSTU2, bundle entries no longer have an updated time (this bit of metadata has been moved
|
||||||
|
* to the resource <meta/> element so it is redundant here). In preparation for DSTU2, it is recommended that you
|
||||||
|
* migrate code away from using this method and over to using resource metadata instead.
|
||||||
|
*/
|
||||||
public InstantDt getUpdated() {
|
public InstantDt getUpdated() {
|
||||||
if (myUpdated == null) {
|
if (myUpdated == null) {
|
||||||
myUpdated = new InstantDt();
|
myUpdated = new InstantDt();
|
||||||
}
|
}
|
||||||
|
if (myUpdated.isEmpty() && myResource != null) {
|
||||||
|
InstantDt resourceUpdated = ResourceMetadataKeyEnum.UPDATED.get(myResource);
|
||||||
|
if (resourceUpdated!=null && !resourceUpdated.isEmpty()) {
|
||||||
|
return resourceUpdated;
|
||||||
|
}
|
||||||
|
}
|
||||||
return myUpdated;
|
return myUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,6 +290,11 @@ public class BundleEntry extends BaseBundle {
|
||||||
myStatus = theStatus;
|
myStatus = theStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated <b>DSTU2 Note:</b> As of DSTU2, bundle entries no longer have an updated time (this bit of metadata has been moved
|
||||||
|
* to the resource <meta/> element so it is redundant here). In preparation for DSTU2, it is recommended that you
|
||||||
|
* migrate code away from using this method and over to using resource metadata instead.
|
||||||
|
*/
|
||||||
public void setUpdated(InstantDt theUpdated) {
|
public void setUpdated(InstantDt theUpdated) {
|
||||||
Validate.notNull(theUpdated, "Updated may not be null");
|
Validate.notNull(theUpdated, "Updated may not be null");
|
||||||
myUpdated = theUpdated;
|
myUpdated = theUpdated;
|
||||||
|
|
|
@ -34,7 +34,9 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
import ca.uhn.fhir.rest.annotation.*;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.hl7.fhir.instance.model.IBaseResource;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.ConfigurationException;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
|
@ -435,7 +437,7 @@ public abstract class BaseMethodBinding<T> implements IClientResponseHandler<T>
|
||||||
if (theReturnType == null) {
|
if (theReturnType == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!IResource.class.isAssignableFrom(theReturnType)) {
|
if (!IBaseResource.class.isAssignableFrom(theReturnType)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -34,6 +34,8 @@ import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import org.hl7.fhir.instance.model.IBaseResource;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.ConfigurationException;
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
|
@ -90,7 +92,7 @@ abstract class BaseResourceReturningMethodBinding extends BaseMethodBinding<Obje
|
||||||
}
|
}
|
||||||
myResourceListCollectionType = collectionType;
|
myResourceListCollectionType = collectionType;
|
||||||
|
|
||||||
} else if (IResource.class.isAssignableFrom(methodReturnType)) {
|
} else if (IBaseResource.class.isAssignableFrom(methodReturnType)) {
|
||||||
myMethodReturnType = MethodReturnTypeEnum.RESOURCE;
|
myMethodReturnType = MethodReturnTypeEnum.RESOURCE;
|
||||||
} else if (Bundle.class.isAssignableFrom(methodReturnType)) {
|
} else if (Bundle.class.isAssignableFrom(methodReturnType)) {
|
||||||
myMethodReturnType = MethodReturnTypeEnum.BUNDLE;
|
myMethodReturnType = MethodReturnTypeEnum.BUNDLE;
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class ConformanceMethodBinding extends BaseResourceReturningMethodBinding
|
||||||
// if (Modifier.isAbstract(theMethod.getReturnType().getModifiers())) {
|
// if (Modifier.isAbstract(theMethod.getReturnType().getModifiers())) {
|
||||||
// throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' must not be abstract");
|
// throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' must not be abstract");
|
||||||
// }
|
// }
|
||||||
if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || !BaseConformance.class.isAssignableFrom(theMethod.getReturnType())) {
|
if (getMethodReturnType() != MethodReturnTypeEnum.RESOURCE || !BaseConformance.class.isAssignableFrom((Class<?>) theMethod.getGenericReturnType())) {
|
||||||
throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return a Conformance resource class, returns: " + theMethod.getReturnType());
|
throw new ConfigurationException("Conformance resource provider method '" + theMethod.getName() + "' should return a Conformance resource class, returns: " + theMethod.getReturnType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ public class ReadMethodBinding extends BaseResourceReturningMethodBinding implem
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HttpGetClientInvocation createAbsoluteReadInvocation(IdDt theId) {
|
public static HttpGetClientInvocation createAbsoluteReadInvocation(IdDt theId) {
|
||||||
return new HttpGetClientInvocation(theId.getValue());
|
return new HttpGetClientInvocation(theId.toVersionless().getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HttpGetClientInvocation createAbsoluteVReadInvocation(IdDt theId) {
|
public static HttpGetClientInvocation createAbsoluteVReadInvocation(IdDt theId) {
|
||||||
|
|
|
@ -41,6 +41,7 @@ import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException;
|
import ca.uhn.fhir.rest.server.exceptions.NotModifiedException;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
||||||
|
import ca.uhn.fhir.util.ReflectionUtil;
|
||||||
import ca.uhn.fhir.util.VersionUtil;
|
import ca.uhn.fhir.util.VersionUtil;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -196,7 +197,7 @@ public class RestfulServer extends HttpServlet {
|
||||||
private int findResourceMethods(Object theProvider, Class<?> clazz) throws ConfigurationException {
|
private int findResourceMethods(Object theProvider, Class<?> clazz) throws ConfigurationException {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for (Method m : clazz.getDeclaredMethods()) {
|
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
|
||||||
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, myFhirContext, theProvider);
|
BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, myFhirContext, theProvider);
|
||||||
if (foundMethodBinding == null) {
|
if (foundMethodBinding == null) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -263,7 +264,7 @@ public class RestfulServer extends HttpServlet {
|
||||||
findSystemMethods(theSystemProvider, supertype);
|
findSystemMethods(theSystemProvider, supertype);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Method m : clazz.getDeclaredMethods()) {
|
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
|
||||||
if (Modifier.isPublic(m.getModifiers())) {
|
if (Modifier.isPublic(m.getModifiers())) {
|
||||||
ourLog.debug("Scanning public method: {}#{}", theSystemProvider.getClass(), m.getName());
|
ourLog.debug("Scanning public method: {}#{}", theSystemProvider.getClass(), m.getName());
|
||||||
|
|
||||||
|
@ -797,7 +798,7 @@ public class RestfulServer extends HttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void invokeDestroy(Object theProvider, Class<?> clazz) {
|
private void invokeDestroy(Object theProvider, Class<?> clazz) {
|
||||||
for (Method m : clazz.getDeclaredMethods()) {
|
for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
|
||||||
Destroy destroy = m.getAnnotation(Destroy.class);
|
Destroy destroy = m.getAnnotation(Destroy.class);
|
||||||
if (destroy != null) {
|
if (destroy != null) {
|
||||||
try {
|
try {
|
||||||
|
@ -1392,7 +1393,7 @@ public class RestfulServer extends HttpServlet {
|
||||||
|
|
||||||
if (theServer.getETagSupport() == ETagSupportEnum.ENABLED) {
|
if (theServer.getETagSupport() == ETagSupportEnum.ENABLED) {
|
||||||
if (theResource.getId().hasVersionIdPart()) {
|
if (theResource.getId().hasVersionIdPart()) {
|
||||||
theHttpResponse.addHeader(Constants.HEADER_ETAG, '"' + theResource.getId().getVersionIdPart() + '"');
|
theHttpResponse.addHeader(Constants.HEADER_ETAG, "W/\"" + theResource.getId().getVersionIdPart() + '"');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import java.lang.reflect.ParameterizedType;
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.lang.reflect.TypeVariable;
|
import java.lang.reflect.TypeVariable;
|
||||||
import java.lang.reflect.WildcardType;
|
import java.lang.reflect.WildcardType;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
|
||||||
public class ReflectionUtil {
|
public class ReflectionUtil {
|
||||||
|
|
||||||
|
@ -83,4 +85,19 @@ public class ReflectionUtil {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static LinkedHashSet<Method> getDeclaredMethods(Class<?> theClazz) {
|
||||||
|
LinkedHashSet<Method> retVal = new LinkedHashSet<Method>();
|
||||||
|
for (Method next : theClazz.getDeclaredMethods()) {
|
||||||
|
try {
|
||||||
|
Method method = theClazz.getMethod(next.getName(), next.getParameterTypes());
|
||||||
|
retVal.add(method);
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
retVal.add(next);
|
||||||
|
} catch (SecurityException e) {
|
||||||
|
retVal.add(next);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return retVal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class ETagServerTest {
|
||||||
|
|
||||||
Header cl = status.getFirstHeader(Constants.HEADER_ETAG_LC);
|
Header cl = status.getFirstHeader(Constants.HEADER_ETAG_LC);
|
||||||
assertNotNull(cl);
|
assertNotNull(cl);
|
||||||
assertEquals("\"222\"", cl.getValue());
|
assertEquals("W/\"222\"", cl.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<faceted-project>
|
<faceted-project>
|
||||||
<installed facet="jst.utility" version="1.0"/>
|
<installed facet="jst.utility" version="1.0"/>
|
||||||
<installed facet="java" version="1.6"/>
|
<installed facet="java" version="1.8"/>
|
||||||
</faceted-project>
|
</faceted-project>
|
||||||
|
|
|
@ -97,6 +97,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
*
|
*
|
||||||
* See the class documentation for an important note if you are extending this class
|
* See the class documentation for an important note if you are extending this class
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
@Metadata
|
@Metadata
|
||||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||||
if (myConformance != null && myCache) {
|
if (myConformance != null && myCache) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import com.google.common.reflect.ClassPath.ClassInfo;
|
||||||
public class ExceptionTest {
|
public class ExceptionTest {
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExceptionTest.class);
|
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ExceptionTest.class);
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Test
|
@Test
|
||||||
public void testExceptionsAreGood() throws Exception {
|
public void testExceptionsAreGood() throws Exception {
|
||||||
ImmutableSet<ClassInfo> classes = ClassPath.from(Thread.currentThread().getContextClassLoader()).getTopLevelClasses(BaseServerResponseException.class.getPackage().getName());
|
ImmutableSet<ClassInfo> classes = ClassPath.from(Thread.currentThread().getContextClassLoader()).getTopLevelClasses(BaseServerResponseException.class.getPackage().getName());
|
||||||
|
@ -35,8 +36,12 @@ public class ExceptionTest {
|
||||||
if (next == UnclassifiedServerFailureException.class) {
|
if (next == UnclassifiedServerFailureException.class) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (next == ResourceVersionNotSpecifiedException.class) {
|
||||||
|
// This one is deprocated
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
assertTrue(BaseServerResponseException.isExceptionTypeRegistered(next));
|
assertTrue("Type " + next + " is not registered", BaseServerResponseException.isExceptionTypeRegistered(next));
|
||||||
|
|
||||||
if (next == AuthenticationException.class) {
|
if (next == AuthenticationException.class) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -45,6 +45,7 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
import ca.uhn.fhir.model.api.Bundle;
|
||||||
|
import ca.uhn.fhir.model.api.BundleEntry;
|
||||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
import ca.uhn.fhir.model.api.IResource;
|
||||||
import ca.uhn.fhir.model.api.Include;
|
import ca.uhn.fhir.model.api.Include;
|
||||||
|
@ -58,6 +59,7 @@ import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
import ca.uhn.fhir.model.primitive.StringDt;
|
import ca.uhn.fhir.model.primitive.StringDt;
|
||||||
|
import ca.uhn.fhir.narrative.INarrativeGenerator;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
import ca.uhn.fhir.rest.client.GenericClient;
|
import ca.uhn.fhir.rest.client.GenericClient;
|
||||||
import ca.uhn.fhir.rest.client.IClientInterceptor;
|
import ca.uhn.fhir.rest.client.IClientInterceptor;
|
||||||
|
@ -343,7 +345,7 @@ public class Controller {
|
||||||
haveSearchParams = extractSearchParamsDstu1(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes);
|
haveSearchParams = extractSearchParamsDstu1(conformance, resourceName, includes, sortParams, queries, haveSearchParams, queryIncludes);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException("Unknown FHIR version: "+theRequest.getFhirVersion(myConfig));
|
throw new IllegalStateException("Unknown FHIR version: " + theRequest.getFhirVersion(myConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
theModel.put("includes", includes);
|
theModel.put("includes", includes);
|
||||||
|
@ -366,7 +368,8 @@ public class Controller {
|
||||||
return "resource";
|
return "resource";
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean extractSearchParamsDstu1(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams, List<List<String>> queryIncludes) {
|
private boolean extractSearchParamsDstu1(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams,
|
||||||
|
List<List<String>> queryIncludes) {
|
||||||
Conformance conformance = (Conformance) theConformance;
|
Conformance conformance = (Conformance) theConformance;
|
||||||
for (Rest nextRest : conformance.getRest()) {
|
for (Rest nextRest : conformance.getRest()) {
|
||||||
for (RestResource nextRes : nextRest.getResource()) {
|
for (RestResource nextRes : nextRest.getResource()) {
|
||||||
|
@ -414,8 +417,9 @@ public class Controller {
|
||||||
return haveSearchParams;
|
return haveSearchParams;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean extractSearchParamsDev(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams, List<List<String>> queryIncludes) {
|
private boolean extractSearchParamsDev(IResource theConformance, String resourceName, TreeSet<String> includes, TreeSet<String> sortParams, List<RestQuery> queries, boolean haveSearchParams,
|
||||||
ca.uhn.fhir.model.dev.resource.Conformance conformance = (ca.uhn.fhir.model.dev.resource.Conformance)theConformance;
|
List<List<String>> queryIncludes) {
|
||||||
|
ca.uhn.fhir.model.dev.resource.Conformance conformance = (ca.uhn.fhir.model.dev.resource.Conformance) theConformance;
|
||||||
for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) {
|
for (ca.uhn.fhir.model.dev.resource.Conformance.Rest nextRest : conformance.getRest()) {
|
||||||
for (ca.uhn.fhir.model.dev.resource.Conformance.RestResource nextRes : nextRest.getResource()) {
|
for (ca.uhn.fhir.model.dev.resource.Conformance.RestResource nextRes : nextRest.getResource()) {
|
||||||
if (nextRes.getTypeElement().getValue().equals(resourceName)) {
|
if (nextRes.getTypeElement().getValue().equals(resourceName)) {
|
||||||
|
@ -456,7 +460,7 @@ public class Controller {
|
||||||
IQuery query;
|
IQuery query;
|
||||||
if (isNotBlank(theReq.getParameter("resource"))) {
|
if (isNotBlank(theReq.getParameter("resource"))) {
|
||||||
try {
|
try {
|
||||||
query = search.forResource((Class<? extends IResource>)getResourceType(theRequest, theReq).getImplementingClass());
|
query = search.forResource((Class<? extends IResource>) getResourceType(theRequest, theReq).getImplementingClass());
|
||||||
} catch (ServletException e) {
|
} catch (ServletException e) {
|
||||||
theModel.put("errorMsg", e.toString());
|
theModel.put("errorMsg", e.toString());
|
||||||
return "resource";
|
return "resource";
|
||||||
|
@ -913,7 +917,7 @@ public class Controller {
|
||||||
private FhirContext getContext(HomeRequest theRequest) {
|
private FhirContext getContext(HomeRequest theRequest) {
|
||||||
FhirVersionEnum version = theRequest.getFhirVersion(myConfig);
|
FhirVersionEnum version = theRequest.getFhirVersion(myConfig);
|
||||||
FhirContext retVal = myContexts.get(version);
|
FhirContext retVal = myContexts.get(version);
|
||||||
if (retVal==null) {
|
if (retVal == null) {
|
||||||
retVal = new FhirContext(version);
|
retVal = new FhirContext(version);
|
||||||
myContexts.put(version, retVal);
|
myContexts.put(version, retVal);
|
||||||
}
|
}
|
||||||
|
@ -956,13 +960,13 @@ public class Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> values;
|
List<String> values;
|
||||||
boolean addToWhere=true;
|
boolean addToWhere = true;
|
||||||
if ("token".equals(nextType)) {
|
if ("token".equals(nextType)) {
|
||||||
if (isBlank(parts.get(2))) {
|
if (isBlank(parts.get(2))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
values = Collections.singletonList(StringUtils.join(parts, ""));
|
values = Collections.singletonList(StringUtils.join(parts, ""));
|
||||||
addToWhere=false;
|
addToWhere = false;
|
||||||
theQuery.where(new TokenClientParam(nextName + nextQualifier).exactly().systemAndCode(parts.get(0), parts.get(2)));
|
theQuery.where(new TokenClientParam(nextName + nextQualifier).exactly().systemAndCode(parts.get(0), parts.get(2)));
|
||||||
} else if ("date".equals(nextType)) {
|
} else if ("date".equals(nextType)) {
|
||||||
values = new ArrayList<String>();
|
values = new ArrayList<String>();
|
||||||
|
@ -991,13 +995,13 @@ public class Controller {
|
||||||
theClientCodeJsonWriter.write("value", nextValue);
|
theClientCodeJsonWriter.write("value", nextValue);
|
||||||
theClientCodeJsonWriter.writeEnd();
|
theClientCodeJsonWriter.writeEnd();
|
||||||
if (addToWhere) {
|
if (addToWhere) {
|
||||||
theQuery.where(new StringClientParam(nextName + nextQualifier).matches().value(nextValue));
|
theQuery.where(new StringClientParam(nextName + nextQualifier).matches().value(nextValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(theReq.getParameter("param." + paramIdxString + ".0.name"))) {
|
if (StringUtils.isNotBlank(theReq.getParameter("param." + paramIdxString + ".0.name"))) {
|
||||||
handleSearchParam(paramIdxString + ".0", theReq, theQuery , theClientCodeJsonWriter);
|
handleSearchParam(paramIdxString + ".0", theReq, theQuery, theClientCodeJsonWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1010,7 +1014,7 @@ public class Controller {
|
||||||
case DSTU1:
|
case DSTU1:
|
||||||
return loadAndAddConfDstu1(theRequest, theModel);
|
return loadAndAddConfDstu1(theRequest, theModel);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException("Unknown version: "+theRequest.getFhirVersion(myConfig));
|
throw new IllegalStateException("Unknown version: " + theRequest.getFhirVersion(myConfig));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Conformance loadAndAddConfDstu1(final HomeRequest theRequest, final ModelMap theModel) {
|
private Conformance loadAndAddConfDstu1(final HomeRequest theRequest, final ModelMap theModel) {
|
||||||
|
@ -1018,7 +1022,7 @@ public class Controller {
|
||||||
|
|
||||||
Conformance conformance;
|
Conformance conformance;
|
||||||
try {
|
try {
|
||||||
conformance = (Conformance)client.conformance();
|
conformance = (Conformance) client.conformance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ourLog.warn("Failed to load conformance statement", e);
|
ourLog.warn("Failed to load conformance statement", e);
|
||||||
theModel.put("errorMsg", "Failed to load conformance statement, error was: " + e.toString());
|
theModel.put("errorMsg", "Failed to load conformance statement, error was: " + e.toString());
|
||||||
|
@ -1077,7 +1081,7 @@ public class Controller {
|
||||||
|
|
||||||
ca.uhn.fhir.model.dev.resource.Conformance conformance;
|
ca.uhn.fhir.model.dev.resource.Conformance conformance;
|
||||||
try {
|
try {
|
||||||
conformance = (ca.uhn.fhir.model.dev.resource.Conformance)client.conformance();
|
conformance = (ca.uhn.fhir.model.dev.resource.Conformance) client.conformance();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
ourLog.warn("Failed to load conformance statement", e);
|
ourLog.warn("Failed to load conformance statement", e);
|
||||||
theModel.put("errorMsg", "Failed to load conformance statement, error was: " + e.toString());
|
theModel.put("errorMsg", "Failed to load conformance statement, error was: " + e.toString());
|
||||||
|
@ -1226,6 +1230,22 @@ public class Controller {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DSTU2 no longer has a title in the bundle format, but it's still
|
||||||
|
* useful here..
|
||||||
|
*/
|
||||||
|
if (bundle != null) {
|
||||||
|
INarrativeGenerator gen = getContext(theRequest).getNarrativeGenerator();
|
||||||
|
if (gen != null) {
|
||||||
|
for (BundleEntry next : bundle.getEntries()) {
|
||||||
|
if (next.getTitle().isEmpty() && next.getResource() != null) {
|
||||||
|
String title = gen.generateTitle(next.getResource());
|
||||||
|
next.getTitle().setValue(title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
resultDescription.append(" (").append(resultBody.length() + " bytes)");
|
resultDescription.append(" (").append(resultBody.length() + " bytes)");
|
||||||
|
|
||||||
Header[] requestHeaders = lastRequest != null ? applyHeaderFilters(lastRequest.getAllHeaders()) : new Header[0];
|
Header[] requestHeaders = lastRequest != null ? applyHeaderFilters(lastRequest.getAllHeaders()) : new Header[0];
|
||||||
|
|
|
@ -175,7 +175,7 @@
|
||||||
<table class="table table-condensed" style="padding-bottom: 0px; margin-bottom: 0px;">
|
<table class="table table-condensed" style="padding-bottom: 0px; margin-bottom: 0px;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 100px;"/>
|
<col style="width: 100px;"/>
|
||||||
<col style="width: 100px;"/>
|
<col/>
|
||||||
<col/>
|
<col/>
|
||||||
<col style="width: 100px;"/>
|
<col style="width: 100px;"/>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
|
@ -196,7 +196,7 @@
|
||||||
</th:block>
|
</th:block>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<small th:if="${entry.resource} != null" th:text="${entry.resource.id.toUnqualified()}"/>
|
<a th:if="${entry.resource} != null" th:href="${entry.resource.id}" th:text="${entry.resource.id.toUnqualified()}" style="font-size: 0.8em"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<small th:text="${entry.title}"/>
|
<small th:text="${entry.title}"/>
|
||||||
|
|
|
@ -143,6 +143,7 @@ PRE.resultBodyPre {
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
overflow: visible;
|
overflow: visible;
|
||||||
|
/*white-space: normal;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
2
pom.xml
2
pom.xml
|
@ -176,7 +176,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.1</version>
|
<version>3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
<source>1.6</source>
|
||||||
<target>1.6</target>
|
<target>1.6</target>
|
||||||
|
|
Loading…
Reference in New Issue