Version bumps
This commit is contained in:
parent
e36bc3889c
commit
987679483a
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.dao;
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
|
@ -9,9 +9,9 @@ package ca.uhn.fhir.jpa.dao;
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
|
|
@ -1,34 +1,46 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<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">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir</artifactId>
|
<artifactId>hapi-fhir</artifactId>
|
||||||
<version>3.5.0-SNAPSHOT</version>
|
<version>3.5.0-SNAPSHOT</version>
|
||||||
<relativePath>../pom.xml</relativePath>
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>hapi-fhir-spring-boot</artifactId>
|
<artifactId>hapi-fhir-spring-boot</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>hapi-fhir-spring-boot-autoconfigure</module>
|
<module>hapi-fhir-spring-boot-autoconfigure</module>
|
||||||
<module>hapi-fhir-spring-boot-starter</module>
|
<module>hapi-fhir-spring-boot-starter</module>
|
||||||
<module>hapi-fhir-spring-boot-samples</module>
|
<module>hapi-fhir-spring-boot-samples</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-dependencies</artifactId>
|
||||||
|
<version>${spring-boot.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skip>true</skip>
|
<skip>true</skip>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,12 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.dstu2016may.model.*;
|
import org.hl7.fhir.dstu2016may.model.*;
|
||||||
import org.hl7.fhir.dstu2016may.model.Conformance.*;
|
import org.hl7.fhir.dstu2016may.model.Conformance.*;
|
||||||
|
@ -64,21 +66,27 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
||||||
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
||||||
private String myPublisher = "Not provided";
|
private String myPublisher = "Not provided";
|
||||||
private RestulfulServerConfiguration myServerConfiguration;
|
private Callable<RestulfulServerConfiguration> myServerConfiguration;
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* 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.
|
* 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();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
||||||
this.myServerConfiguration = theRestfulServer.createConfiguration();
|
this.myServerConfiguration = theRestfulServer::createConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
public ServerConformanceProvider(RestulfulServerConfiguration theServerConfiguration) {
|
public ServerConformanceProvider(RestulfulServerConfiguration theServerConfiguration) {
|
||||||
this.myServerConfiguration = theServerConfiguration;
|
this.myServerConfiguration = () -> theServerConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBindingForSystemOps(ConformanceRestComponent rest, Set<SystemRestfulInteraction> systemOps, BaseMethodBinding<?> nextMethodBinding) {
|
private void checkBindingForSystemOps(ConformanceRestComponent rest, Set<SystemRestfulInteraction> systemOps, BaseMethodBinding<?> nextMethodBinding) {
|
||||||
|
@ -103,20 +111,20 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
||||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<>();
|
||||||
for (ResourceBinding next : myServerConfiguration.getResourceBindings()) {
|
for (ResourceBinding next : getServerConfiguration().getResourceBindings()) {
|
||||||
String resourceName = next.getResourceName();
|
String resourceName = next.getResourceName();
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
resourceToMethods.put(resourceName, new ArrayList<>());
|
||||||
}
|
}
|
||||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : myServerConfiguration.getServerBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) {
|
||||||
String resourceName = "";
|
String resourceName = "";
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
resourceToMethods.put(resourceName, new ArrayList<>());
|
||||||
}
|
}
|
||||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +132,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTimeType conformanceDate() {
|
private DateTimeType conformanceDate() {
|
||||||
String buildDate = myServerConfiguration.getConformanceDate();
|
String buildDate = getServerConfiguration().getConformanceDate();
|
||||||
if (buildDate != null) {
|
if (buildDate != null) {
|
||||||
try {
|
try {
|
||||||
return new DateTimeType(buildDate);
|
return new DateTimeType(buildDate);
|
||||||
|
@ -181,15 +189,15 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
// needs to be modified to actually allow it
|
// needs to be modified to actually allow it
|
||||||
|
|
||||||
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
||||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||||
retVal
|
retVal
|
||||||
.getImplementation()
|
.getImplementation()
|
||||||
.setUrl(serverBase)
|
.setUrl(serverBase)
|
||||||
.setDescription(myServerConfiguration.getImplementationDescription());
|
.setDescription(getServerConfiguration().getImplementationDescription());
|
||||||
|
|
||||||
retVal.setKind(ConformanceStatementKind.INSTANCE);
|
retVal.setKind(ConformanceStatementKind.INSTANCE);
|
||||||
retVal.getSoftware().setName(myServerConfiguration.getServerName());
|
retVal.getSoftware().setName(getServerConfiguration().getServerName());
|
||||||
retVal.getSoftware().setVersion(myServerConfiguration.getServerVersion());
|
retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion());
|
||||||
retVal.addFormat(Constants.CT_FHIR_XML);
|
retVal.addFormat(Constants.CT_FHIR_XML);
|
||||||
retVal.addFormat(Constants.CT_FHIR_JSON);
|
retVal.addFormat(Constants.CT_FHIR_JSON);
|
||||||
retVal.setStatus(ConformanceResourceStatus.ACTIVE);
|
retVal.setStatus(ConformanceResourceStatus.ACTIVE);
|
||||||
|
@ -197,17 +205,17 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
ConformanceRestComponent rest = retVal.addRest();
|
ConformanceRestComponent rest = retVal.addRest();
|
||||||
rest.setMode(RestfulConformanceMode.SERVER);
|
rest.setMode(RestfulConformanceMode.SERVER);
|
||||||
|
|
||||||
Set<SystemRestfulInteraction> systemOps = new HashSet<SystemRestfulInteraction>();
|
Set<SystemRestfulInteraction> systemOps = new HashSet<>();
|
||||||
Set<String> operationNames = new HashSet<String>();
|
Set<String> operationNames = new HashSet<>();
|
||||||
|
|
||||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||||
|
|
||||||
if (nextEntry.getKey().isEmpty() == false) {
|
if (nextEntry.getKey().isEmpty() == false) {
|
||||||
Set<TypeRestfulInteraction> resourceOps = new HashSet<TypeRestfulInteraction>();
|
Set<TypeRestfulInteraction> resourceOps = new HashSet<>();
|
||||||
ConformanceRestResourceComponent resource = rest.addResource();
|
ConformanceRestResourceComponent resource = rest.addResource();
|
||||||
String resourceName = nextEntry.getKey();
|
String resourceName = nextEntry.getKey();
|
||||||
RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName);
|
RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName);
|
||||||
resource.getTypeElement().setValue(def.getName());
|
resource.getTypeElement().setValue(def.getName());
|
||||||
resource.getProfile().setReference((def.getResourceProfile(serverBase)));
|
resource.getProfile().setReference((def.getResourceProfile(serverBase)));
|
||||||
|
|
||||||
|
@ -432,7 +440,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||||
}
|
}
|
||||||
for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
||||||
RuntimeResourceDefinition targetDef = myServerConfiguration.getFhirContext().getResourceDefinition(nextTarget);
|
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget);
|
||||||
if (targetDef != null) {
|
if (targetDef != null) {
|
||||||
ResourceType code;
|
ResourceType code;
|
||||||
try {
|
try {
|
||||||
|
@ -594,11 +602,15 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRestfulServer(RestfulServer theRestfulServer) {
|
public void setRestfulServer(RestfulServer theRestfulServer) {
|
||||||
myServerConfiguration = theRestfulServer.createConfiguration();
|
myServerConfiguration = theRestfulServer::createConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
RestulfulServerConfiguration getServerConfiguration() {
|
RestulfulServerConfiguration getServerConfiguration() {
|
||||||
return myServerConfiguration;
|
try {
|
||||||
|
return myServerConfiguration.call();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new InternalErrorException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
||||||
|
|
|
@ -1,6 +1,45 @@
|
||||||
package ca.uhn.fhir.rest.server.provider.dstu2;
|
package ca.uhn.fhir.rest.server.provider.dstu2;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
|
import ca.uhn.fhir.context.RuntimeSearchParam;
|
||||||
|
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.RestResourceInteraction;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.Conformance.RestResourceSearchParam;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
|
||||||
|
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition.Parameter;
|
||||||
|
import ca.uhn.fhir.model.dstu2.valueset.*;
|
||||||
|
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||||
|
import ca.uhn.fhir.model.primitive.IdDt;
|
||||||
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
import ca.uhn.fhir.rest.annotation.IdParam;
|
||||||
|
import ca.uhn.fhir.rest.annotation.Initialize;
|
||||||
|
import ca.uhn.fhir.rest.annotation.Metadata;
|
||||||
|
import ca.uhn.fhir.rest.annotation.Read;
|
||||||
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
|
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
||||||
|
import ca.uhn.fhir.rest.server.IServerConformanceProvider;
|
||||||
|
import ca.uhn.fhir.rest.server.ResourceBinding;
|
||||||
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
|
import ca.uhn.fhir.rest.server.RestulfulServerConfiguration;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
||||||
|
import ca.uhn.fhir.rest.server.method.*;
|
||||||
|
import ca.uhn.fhir.rest.server.method.OperationMethodBinding.ReturnType;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
|
|
||||||
|
import javax.servlet.ServletContext;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.isBlank;
|
import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* #%L
|
* #%L
|
||||||
* HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
|
* HAPI FHIR Structures - DSTU2 (FHIR v1.0.0)
|
||||||
|
@ -10,9 +49,9 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -20,39 +59,10 @@ import static org.apache.commons.lang3.StringUtils.isBlank;
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
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.dstu2.resource.Conformance;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Conformance.*;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.OperationDefinition.Parameter;
|
|
||||||
import ca.uhn.fhir.model.dstu2.valueset.*;
|
|
||||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
|
||||||
import ca.uhn.fhir.rest.annotation.*;
|
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
|
||||||
import ca.uhn.fhir.rest.api.RestSearchParameterTypeEnum;
|
|
||||||
import ca.uhn.fhir.rest.server.*;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
||||||
import ca.uhn.fhir.rest.server.method.*;
|
|
||||||
import ca.uhn.fhir.rest.server.method.OperationMethodBinding.ReturnType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Server FHIR Provider which serves the conformance statement for a RESTful server implementation
|
* Server FHIR Provider which serves the conformance statement for a RESTful server implementation
|
||||||
*
|
*
|
||||||
* <p>
|
* <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
|
* 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.
|
* <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.
|
||||||
|
@ -65,25 +75,27 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
||||||
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
||||||
private String myPublisher = "Not provided";
|
private String myPublisher = "Not provided";
|
||||||
private RestulfulServerConfiguration myServerConfiguration;
|
private Callable<RestulfulServerConfiguration> myServerConfiguration;
|
||||||
|
|
||||||
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
/**
|
||||||
this.myServerConfiguration = theRestfulServer.createConfiguration();
|
* 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(RestulfulServerConfiguration 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.
|
|
||||||
*/
|
*/
|
||||||
public ServerConformanceProvider() {
|
public ServerConformanceProvider() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRestfulServer(RestfulServer theRestfulServer) {
|
/**
|
||||||
myServerConfiguration = theRestfulServer.createConfiguration();
|
* Constructor
|
||||||
|
*/
|
||||||
|
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
||||||
|
this.myServerConfiguration = theRestfulServer::createConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public ServerConformanceProvider(RestulfulServerConfiguration theServerConfiguration) {
|
||||||
|
this.myServerConfiguration = () -> theServerConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBindingForSystemOps(Rest rest, Set<SystemRestfulInteractionEnum> systemOps, BaseMethodBinding<?> nextMethodBinding) {
|
private void checkBindingForSystemOps(Rest rest, Set<SystemRestfulInteractionEnum> systemOps, BaseMethodBinding<?> nextMethodBinding) {
|
||||||
|
@ -104,7 +116,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
|
|
||||||
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
||||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
||||||
for (ResourceBinding next : myServerConfiguration.getResourceBindings()) {
|
for (ResourceBinding next : getServerConfiguration().getResourceBindings()) {
|
||||||
String resourceName = next.getResourceName();
|
String resourceName = next.getResourceName();
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
|
@ -113,7 +125,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : myServerConfiguration.getServerBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) {
|
||||||
String resourceName = "";
|
String resourceName = "";
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
||||||
|
@ -123,6 +135,18 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
return resourceToMethods;
|
return resourceToMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTimeDt conformanceDate() {
|
||||||
|
String buildDate = getServerConfiguration().getConformanceDate();
|
||||||
|
if (buildDate != null) {
|
||||||
|
try {
|
||||||
|
return new DateTimeDt(buildDate);
|
||||||
|
} catch (DataFormatException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DateTimeDt.withCurrentTime();
|
||||||
|
}
|
||||||
|
|
||||||
private String createOperationName(OperationMethodBinding theMethodBinding) {
|
private String createOperationName(OperationMethodBinding theMethodBinding) {
|
||||||
StringBuilder retVal = new StringBuilder();
|
StringBuilder retVal = new StringBuilder();
|
||||||
if (theMethodBinding.getResourceName() != null) {
|
if (theMethodBinding.getResourceName() != null) {
|
||||||
|
@ -137,10 +161,10 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
retVal.append('s');
|
retVal.append('s');
|
||||||
}
|
}
|
||||||
retVal.append('-');
|
retVal.append('-');
|
||||||
|
|
||||||
// Exclude the leading $
|
// Exclude the leading $
|
||||||
retVal.append(theMethodBinding.getName(), 1, theMethodBinding.getName().length());
|
retVal.append(theMethodBinding.getName(), 1, theMethodBinding.getName().length());
|
||||||
|
|
||||||
return retVal.toString();
|
return retVal.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +176,22 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
return myPublisher;
|
return myPublisher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
RestulfulServerConfiguration getServerConfiguration() {
|
||||||
|
try {
|
||||||
|
return myServerConfiguration.call();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new InternalErrorException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Metadata
|
@Metadata
|
||||||
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
public Conformance getServerConformance(HttpServletRequest theRequest) {
|
||||||
|
@ -168,36 +208,36 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
// needs to be modified to actually allow it
|
// needs to be modified to actually allow it
|
||||||
|
|
||||||
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
||||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||||
retVal
|
retVal
|
||||||
.getImplementation()
|
.getImplementation()
|
||||||
.setUrl(serverBase)
|
.setUrl(serverBase)
|
||||||
.setDescription(myServerConfiguration.getImplementationDescription());
|
.setDescription(getServerConfiguration().getImplementationDescription());
|
||||||
|
|
||||||
retVal.setKind(ConformanceStatementKindEnum.INSTANCE);
|
retVal.setKind(ConformanceStatementKindEnum.INSTANCE);
|
||||||
retVal.getSoftware().setName(myServerConfiguration.getServerName());
|
retVal.getSoftware().setName(getServerConfiguration().getServerName());
|
||||||
retVal.getSoftware().setVersion(myServerConfiguration.getServerVersion());
|
retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion());
|
||||||
retVal.addFormat(Constants.CT_FHIR_XML);
|
retVal.addFormat(Constants.CT_FHIR_XML);
|
||||||
retVal.addFormat(Constants.CT_FHIR_JSON);
|
retVal.addFormat(Constants.CT_FHIR_JSON);
|
||||||
|
|
||||||
Rest rest = retVal.addRest();
|
Rest rest = retVal.addRest();
|
||||||
rest.setMode(RestfulConformanceModeEnum.SERVER);
|
rest.setMode(RestfulConformanceModeEnum.SERVER);
|
||||||
|
|
||||||
Set<SystemRestfulInteractionEnum> systemOps = new HashSet<SystemRestfulInteractionEnum>();
|
Set<SystemRestfulInteractionEnum> systemOps = new HashSet<>();
|
||||||
Set<String> operationNames = new HashSet<String>();
|
Set<String> operationNames = new HashSet<>();
|
||||||
|
|
||||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||||
|
|
||||||
if (nextEntry.getKey().isEmpty() == false) {
|
if (nextEntry.getKey().isEmpty() == false) {
|
||||||
Set<TypeRestfulInteractionEnum> resourceOps = new HashSet<TypeRestfulInteractionEnum>();
|
Set<TypeRestfulInteractionEnum> resourceOps = new HashSet<>();
|
||||||
RestResource resource = rest.addResource();
|
RestResource resource = rest.addResource();
|
||||||
String resourceName = nextEntry.getKey();
|
String resourceName = nextEntry.getKey();
|
||||||
RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName);
|
RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName);
|
||||||
resource.getTypeElement().setValue(def.getName());
|
resource.getTypeElement().setValue(def.getName());
|
||||||
resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
|
resource.getProfile().setReference(new IdDt(def.getResourceProfile(serverBase)));
|
||||||
|
|
||||||
TreeSet<String> includes = new TreeSet<String>();
|
TreeSet<String> includes = new TreeSet<>();
|
||||||
|
|
||||||
// Map<String, Conformance.RestResourceSearchParam> nameToSearchParam = new HashMap<String,
|
// Map<String, Conformance.RestResourceSearchParam> nameToSearchParam = new HashMap<String,
|
||||||
// Conformance.RestResourceSearchParam>();
|
// Conformance.RestResourceSearchParam>();
|
||||||
|
@ -222,21 +262,21 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
|
|
||||||
if (nextMethodBinding.isSupportsConditional()) {
|
if (nextMethodBinding.isSupportsConditional()) {
|
||||||
switch (resOp) {
|
switch (resOp) {
|
||||||
case CREATE:
|
case CREATE:
|
||||||
resource.setConditionalCreate(true);
|
resource.setConditionalCreate(true);
|
||||||
break;
|
break;
|
||||||
case DELETE:
|
case DELETE:
|
||||||
if (nextMethodBinding.isSupportsConditionalMultiple()) {
|
if (nextMethodBinding.isSupportsConditionalMultiple()) {
|
||||||
resource.setConditionalDelete(ConditionalDeleteStatusEnum.MULTIPLE_DELETES_SUPPORTED);
|
resource.setConditionalDelete(ConditionalDeleteStatusEnum.MULTIPLE_DELETES_SUPPORTED);
|
||||||
} else {
|
} else {
|
||||||
resource.setConditionalDelete(ConditionalDeleteStatusEnum.SINGLE_DELETES_SUPPORTED);
|
resource.setConditionalDelete(ConditionalDeleteStatusEnum.SINGLE_DELETES_SUPPORTED);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UPDATE:
|
case UPDATE:
|
||||||
resource.setConditionalUpdate(true);
|
resource.setConditionalUpdate(true);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -299,18 +339,6 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTimeDt conformanceDate() {
|
|
||||||
String buildDate = myServerConfiguration.getConformanceDate();
|
|
||||||
if (buildDate != null) {
|
|
||||||
try {
|
|
||||||
return new DateTimeDt(buildDate);
|
|
||||||
} catch (DataFormatException e) {
|
|
||||||
// fall through
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return DateTimeDt.withCurrentTime();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleDynamicSearchMethodBinding(RestResource resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
private void handleDynamicSearchMethodBinding(RestResource resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
||||||
includes.addAll(searchMethodBinding.getIncludes());
|
includes.addAll(searchMethodBinding.getIncludes());
|
||||||
|
|
||||||
|
@ -424,7 +452,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||||
}
|
}
|
||||||
for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
||||||
RuntimeResourceDefinition targetDef = myServerConfiguration.getFhirContext().getResourceDefinition(nextTarget);
|
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget);
|
||||||
if (targetDef != null) {
|
if (targetDef != null) {
|
||||||
ResourceTypeEnum code = ResourceTypeEnum.VALUESET_BINDER.fromCodeString(targetDef.getName());
|
ResourceTypeEnum code = ResourceTypeEnum.VALUESET_BINDER.fromCodeString(targetDef.getName());
|
||||||
if (code != null) {
|
if (code != null) {
|
||||||
|
@ -537,7 +565,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
op.setName(op.getCode());
|
op.setName(op.getCode());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op.getSystem() == null) {
|
if (op.getSystem() == null) {
|
||||||
op.setSystem(false);
|
op.setSystem(false);
|
||||||
}
|
}
|
||||||
|
@ -558,12 +586,9 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
myCache = theCache;
|
myCache = theCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* 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
|
public void setRestfulServer(RestfulServer theRestfulServer) {
|
||||||
* value defaults to "Not provided" but may be set to null, which will cause this element to be omitted.
|
myServerConfiguration = theRestfulServer::createConfiguration;
|
||||||
*/
|
|
||||||
public void setPublisher(String thePublisher) {
|
|
||||||
myPublisher = thePublisher;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
private void sortRuntimeSearchParameters(List<RuntimeSearchParam> searchParameters) {
|
||||||
|
@ -589,4 +614,5 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -122,6 +122,31 @@ public class MetadataCapabilityStatementDstu3Test {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testResponseContainsBaseUrlFixed() throws Exception {
|
||||||
|
IServerAddressStrategy addressStrategy = ourServlet.getServerAddressStrategy();
|
||||||
|
try {
|
||||||
|
ourServlet.setServerAddressStrategy(new HardcodedServerAddressStrategy("http://foo/bar"));
|
||||||
|
|
||||||
|
String output;
|
||||||
|
|
||||||
|
HttpRequestBase httpPost = new HttpGet("http://localhost:" + ourPort + "/metadata?_format=json");
|
||||||
|
CloseableHttpResponse status = ourClient.execute(httpPost);
|
||||||
|
try {
|
||||||
|
output = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
|
||||||
|
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||||
|
ourLog.info(output);
|
||||||
|
CapabilityStatement cs = ourCtx.newJsonParser().parseResource(CapabilityStatement.class, output);
|
||||||
|
|
||||||
|
assertEquals("http://foo/bar", cs.getImplementation().getUrl());
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||||
|
}
|
||||||
|
} finally {
|
||||||
|
ourServlet.setServerAddressStrategy(addressStrategy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSummary() throws Exception {
|
public void testSummary() throws Exception {
|
||||||
String output;
|
String output;
|
||||||
|
|
|
@ -24,12 +24,14 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.parser.DataFormatException;
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.hl7.fhir.instance.model.*;
|
import org.hl7.fhir.instance.model.*;
|
||||||
import org.hl7.fhir.instance.model.Conformance.*;
|
import org.hl7.fhir.instance.model.Conformance.*;
|
||||||
|
@ -69,33 +71,40 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
private IdentityHashMap<OperationMethodBinding, String> myOperationBindingToName;
|
||||||
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
private HashMap<String, List<OperationMethodBinding>> myOperationNameToBindings;
|
||||||
private String myPublisher = "Not provided";
|
private String myPublisher = "Not provided";
|
||||||
private RestulfulServerConfiguration myServerConfiguration;
|
private Callable<RestulfulServerConfiguration> myServerConfiguration;
|
||||||
|
|
||||||
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
/**
|
||||||
this.myServerConfiguration = theRestfulServer.createConfiguration();
|
* 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(RestulfulServerConfiguration theServerConfiguration) {
|
super();
|
||||||
this.myServerConfiguration = theServerConfiguration;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public ServerConformanceProvider(RestfulServer theRestfulServer) {
|
||||||
|
this.myServerConfiguration = theRestfulServer::createConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public ServerConformanceProvider(RestulfulServerConfiguration 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.
|
|
||||||
*/
|
|
||||||
public ServerConformanceProvider () {
|
|
||||||
super();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRestfulServer (RestfulServer theRestfulServer) {
|
public void setRestfulServer (RestfulServer theRestfulServer) {
|
||||||
myServerConfiguration = theRestfulServer.createConfiguration();
|
myServerConfiguration = theRestfulServer::createConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
RestulfulServerConfiguration getServerConfiguration() {
|
RestulfulServerConfiguration getServerConfiguration() {
|
||||||
return myServerConfiguration;
|
try {
|
||||||
|
return myServerConfiguration.call();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new InternalErrorException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkBindingForSystemOps(ConformanceRestComponent rest, Set<SystemRestfulInteraction> systemOps,
|
private void checkBindingForSystemOps(ConformanceRestComponent rest, Set<SystemRestfulInteraction> systemOps,
|
||||||
|
@ -122,7 +131,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
|
|
||||||
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
private Map<String, List<BaseMethodBinding<?>>> collectMethodBindings() {
|
||||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = new TreeMap<String, List<BaseMethodBinding<?>>>();
|
||||||
for (ResourceBinding next : myServerConfiguration.getResourceBindings()) {
|
for (ResourceBinding next : getServerConfiguration().getResourceBindings()) {
|
||||||
String resourceName = next.getResourceName();
|
String resourceName = next.getResourceName();
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : next.getMethodBindings()) {
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
|
@ -131,7 +140,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
resourceToMethods.get(resourceName).add(nextMethodBinding);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (BaseMethodBinding<?> nextMethodBinding : myServerConfiguration.getServerBindings()) {
|
for (BaseMethodBinding<?> nextMethodBinding : getServerConfiguration().getServerBindings()) {
|
||||||
String resourceName = "";
|
String resourceName = "";
|
||||||
if (resourceToMethods.containsKey(resourceName) == false) {
|
if (resourceToMethods.containsKey(resourceName) == false) {
|
||||||
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
resourceToMethods.put(resourceName, new ArrayList<BaseMethodBinding<?>>());
|
||||||
|
@ -171,16 +180,10 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
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
|
// needs to be modified to actually allow it
|
||||||
|
|
||||||
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
retVal.getImplementation().setDescription(getServerConfiguration().getImplementationDescription());
|
||||||
String serverBase = myServerConfiguration.getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
|
||||||
retVal
|
|
||||||
.getImplementation()
|
|
||||||
.setUrl(serverBase)
|
|
||||||
.setDescription(myServerConfiguration.getImplementationDescription());
|
|
||||||
|
|
||||||
retVal.setKind(ConformanceStatementKind.INSTANCE);
|
retVal.setKind(ConformanceStatementKind.INSTANCE);
|
||||||
retVal.getSoftware().setName(myServerConfiguration.getServerName());
|
retVal.getSoftware().setName(getServerConfiguration().getServerName());
|
||||||
retVal.getSoftware().setVersion(myServerConfiguration.getServerVersion());
|
retVal.getSoftware().setVersion(getServerConfiguration().getServerVersion());
|
||||||
retVal.addFormat(Constants.CT_FHIR_XML);
|
retVal.addFormat(Constants.CT_FHIR_XML);
|
||||||
retVal.addFormat(Constants.CT_FHIR_JSON);
|
retVal.addFormat(Constants.CT_FHIR_JSON);
|
||||||
|
|
||||||
|
@ -197,8 +200,10 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
Set<TypeRestfulInteraction> resourceOps = new HashSet<TypeRestfulInteraction>();
|
Set<TypeRestfulInteraction> resourceOps = new HashSet<TypeRestfulInteraction>();
|
||||||
ConformanceRestResourceComponent resource = rest.addResource();
|
ConformanceRestResourceComponent resource = rest.addResource();
|
||||||
String resourceName = nextEntry.getKey();
|
String resourceName = nextEntry.getKey();
|
||||||
RuntimeResourceDefinition def = myServerConfiguration.getFhirContext().getResourceDefinition(resourceName);
|
RuntimeResourceDefinition def = getServerConfiguration().getFhirContext().getResourceDefinition(resourceName);
|
||||||
resource.getTypeElement().setValue(def.getName());
|
resource.getTypeElement().setValue(def.getName());
|
||||||
|
ServletContext servletContext = (ServletContext) (theRequest == null ? null : theRequest.getAttribute(RestfulServer.SERVLET_CONTEXT_ATTRIBUTE));
|
||||||
|
String serverBase = getServerConfiguration().getServerAddressStrategy().determineServerBase(servletContext, theRequest);
|
||||||
resource.getProfile().setReference((def.getResourceProfile(serverBase)));
|
resource.getProfile().setReference((def.getResourceProfile(serverBase)));
|
||||||
|
|
||||||
TreeSet<String> includes = new TreeSet<>();
|
TreeSet<String> includes = new TreeSet<>();
|
||||||
|
@ -266,7 +271,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resource.getInteraction().sort(new Comparator<ResourceInteractionComponent>() {
|
Collections.sort(resource.getInteraction(), new Comparator<ResourceInteractionComponent>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(ResourceInteractionComponent theO1, ResourceInteractionComponent theO2) {
|
public int compare(ResourceInteractionComponent theO1, ResourceInteractionComponent theO2) {
|
||||||
TypeRestfulInteraction o1 = theO1.getCode();
|
TypeRestfulInteraction o1 = theO1.getCode();
|
||||||
|
@ -309,7 +314,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
}
|
}
|
||||||
|
|
||||||
private DateTimeType conformanceDate() {
|
private DateTimeType conformanceDate() {
|
||||||
String buildDate = myServerConfiguration.getConformanceDate();
|
String buildDate = getServerConfiguration().getConformanceDate();
|
||||||
if (buildDate != null) {
|
if (buildDate != null) {
|
||||||
try {
|
try {
|
||||||
return new DateTimeType(buildDate);
|
return new DateTimeType(buildDate);
|
||||||
|
@ -430,7 +435,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
param.getTypeElement().setValueAsString(nextParameter.getParamType().getCode());
|
||||||
}
|
}
|
||||||
for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
for (Class<? extends IBaseResource> nextTarget : nextParameter.getDeclaredTypes()) {
|
||||||
RuntimeResourceDefinition targetDef = myServerConfiguration.getFhirContext().getResourceDefinition(nextTarget);
|
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget);
|
||||||
if (targetDef != null) {
|
if (targetDef != null) {
|
||||||
ResourceType code;
|
ResourceType code;
|
||||||
try {
|
try {
|
||||||
|
@ -449,8 +454,8 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
|
|
||||||
@Initialize
|
@Initialize
|
||||||
public void initializeOperations() {
|
public void initializeOperations() {
|
||||||
myOperationBindingToName = new IdentityHashMap<OperationMethodBinding, String>();
|
myOperationBindingToName = new IdentityHashMap<>();
|
||||||
myOperationNameToBindings = new HashMap<String, List<OperationMethodBinding>>();
|
myOperationNameToBindings = new HashMap<>();
|
||||||
|
|
||||||
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
Map<String, List<BaseMethodBinding<?>>> resourceToMethods = collectMethodBindings();
|
||||||
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
for (Entry<String, List<BaseMethodBinding<?>>> nextEntry : resourceToMethods.entrySet()) {
|
||||||
|
@ -465,7 +470,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
String name = createOperationName(methodBinding);
|
String name = createOperationName(methodBinding);
|
||||||
myOperationBindingToName.put(methodBinding, name);
|
myOperationBindingToName.put(methodBinding, name);
|
||||||
if (myOperationNameToBindings.containsKey(name) == false) {
|
if (myOperationNameToBindings.containsKey(name) == false) {
|
||||||
myOperationNameToBindings.put(name, new ArrayList<OperationMethodBinding>());
|
myOperationNameToBindings.put(name, new ArrayList<>());
|
||||||
}
|
}
|
||||||
myOperationNameToBindings.get(name).add(methodBinding);
|
myOperationNameToBindings.get(name).add(methodBinding);
|
||||||
}
|
}
|
||||||
|
@ -487,8 +492,8 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
op.setStatus(ConformanceResourceStatus.ACTIVE);
|
op.setStatus(ConformanceResourceStatus.ACTIVE);
|
||||||
op.setIdempotent(true);
|
op.setIdempotent(true);
|
||||||
|
|
||||||
Set<String> inParams = new HashSet<String>();
|
Set<String> inParams = new HashSet<>();
|
||||||
Set<String> outParams = new HashSet<String>();
|
Set<String> outParams = new HashSet<>();
|
||||||
|
|
||||||
for (OperationMethodBinding sharedDescription : sharedDescriptions) {
|
for (OperationMethodBinding sharedDescription : sharedDescriptions) {
|
||||||
if (isNotBlank(sharedDescription.getDescription())) {
|
if (isNotBlank(sharedDescription.getDescription())) {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
27
pom.xml
27
pom.xml
|
@ -482,8 +482,8 @@
|
||||||
<apache_karaf_version>4.1.4</apache_karaf_version>
|
<apache_karaf_version>4.1.4</apache_karaf_version>
|
||||||
<aries_spifly_version>1.0.10</aries_spifly_version>
|
<aries_spifly_version>1.0.10</aries_spifly_version>
|
||||||
<caffeine_version>2.6.2</caffeine_version>
|
<caffeine_version>2.6.2</caffeine_version>
|
||||||
<commons_codec_version>1.10</commons_codec_version>
|
<commons_codec_version>1.11</commons_codec_version>
|
||||||
<commons_io_version>2.5</commons_io_version>
|
<commons_io_version>2.6</commons_io_version>
|
||||||
<commons_lang3_version>3.7</commons_lang3_version>
|
<commons_lang3_version>3.7</commons_lang3_version>
|
||||||
<derby_version>10.14.2.0</derby_version>
|
<derby_version>10.14.2.0</derby_version>
|
||||||
<error_prone_annotations_version>2.0.18</error_prone_annotations_version>
|
<error_prone_annotations_version>2.0.18</error_prone_annotations_version>
|
||||||
|
@ -508,6 +508,7 @@
|
||||||
<resteasy_version>4.0.0.Beta3</resteasy_version>
|
<resteasy_version>4.0.0.Beta3</resteasy_version>
|
||||||
<ph_schematron_version>5.0.4</ph_schematron_version>
|
<ph_schematron_version>5.0.4</ph_schematron_version>
|
||||||
<ph_commons_version>9.1.1</ph_commons_version>
|
<ph_commons_version>9.1.1</ph_commons_version>
|
||||||
|
<plexus_compiler_api_version>2.8.4</plexus_compiler_api_version>
|
||||||
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
<servicemix_saxon_version>9.5.1-5_1</servicemix_saxon_version>
|
||||||
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
<servicemix_xmlresolver_version>1.2_5</servicemix_xmlresolver_version>
|
||||||
<spring_version>5.0.6.RELEASE</spring_version>
|
<spring_version>5.0.6.RELEASE</spring_version>
|
||||||
|
@ -906,17 +907,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-api</artifactId>
|
<artifactId>plexus-compiler-api</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>${plexus_compiler_api_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac</artifactId>
|
<artifactId>plexus-compiler-javac</artifactId>
|
||||||
<version>2.8.2</version>
|
<version>${plexus_compiler_api_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
||||||
<version>2.8.4</version>
|
<version>${plexus_compiler_api_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
@ -1180,13 +1181,6 @@
|
||||||
<artifactId>spring-websocket</artifactId>
|
<artifactId>spring-websocket</artifactId>
|
||||||
<version>${spring_version}</version>
|
<version>${spring_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
|
||||||
<version>${spring-boot.version}</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.thymeleaf</groupId>
|
<groupId>org.thymeleaf</groupId>
|
||||||
<artifactId>thymeleaf</artifactId>
|
<artifactId>thymeleaf</artifactId>
|
||||||
|
@ -1292,17 +1286,17 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-api</artifactId>
|
<artifactId>plexus-compiler-api</artifactId>
|
||||||
<version>2.8.4</version>
|
<version>${plexus_compiler_api_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac</artifactId>
|
<artifactId>plexus-compiler-javac</artifactId>
|
||||||
<version>2.8.4</version>
|
<version>${plexus_compiler_api_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
<artifactId>plexus-compiler-javac-errorprone</artifactId>
|
||||||
<version>2.8.4</version>
|
<version>${plexus_compiler_api_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.codehaus.plexus</groupId>
|
<groupId>org.codehaus.plexus</groupId>
|
||||||
|
@ -1411,6 +1405,9 @@
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>versions-maven-plugin</artifactId>
|
<artifactId>versions-maven-plugin</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.5</version>
|
||||||
|
<configuration>
|
||||||
|
<processDependencyManagementTransitive>false</processDependencyManagementTransitive>
|
||||||
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
<groupId>org.eclipse.jetty</groupId>
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
<li>Hibernate OR (JPA): 5.2.16.Final -> 5.3.1.Final</li>
|
<li>Hibernate OR (JPA): 5.2.16.Final -> 5.3.1.Final</li>
|
||||||
<li>Hibernate Search (JPA): 5.7.1.Final -> 5.10.1.Final</li>
|
<li>Hibernate Search (JPA): 5.7.1.Final -> 5.10.1.Final</li>
|
||||||
<li>Jetty (CLI): 9.4.8.v20171121 -> 9.4.10.v20180503</li>
|
<li>Jetty (CLI): 9.4.8.v20171121 -> 9.4.10.v20180503</li>
|
||||||
|
<li>Commons-Codec (All): 1.10 -> 1.11</li>
|
||||||
|
<li>Commons-IO (All): 2.5 -> 2.6</li>
|
||||||
</ul>
|
</ul>
|
||||||
]]>
|
]]>
|
||||||
</action>
|
</action>
|
||||||
|
|
Loading…
Reference in New Issue