Bump several dependency versions to latest versions
This commit is contained in:
parent
24536941c2
commit
190f0a0d5a
|
@ -1 +0,0 @@
|
||||||
/jpaserver_derby_files
|
|
|
@ -1,231 +0,0 @@
|
||||||
<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>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-jpaserver-example-with-custom</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
|
|
||||||
<name>HAPI FHIR JPA Server - Example with Custom Resources</name>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>oss-snapshots</id>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<!-- This dependency includes the core HAPI-FHIR classes -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-base</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- At least one "structures" JAR must also be included -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-structures-dstu2</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- This dependency includes the JPA server itself, which is packaged
|
|
||||||
separately from the rest of HAPI FHIR -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-jpaserver-base</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<type>war</type>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- HAPI-FHIR uses Logback for logging support. The logback library is
|
|
||||||
included automatically by Maven as a part of the hapi-fhir-base dependency,
|
|
||||||
but you also need to include a logging library. Logback is used here, but
|
|
||||||
log4j would also be fine. -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Needed for JEE/Servlet support -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- If you are using HAPI narrative generation, you will need to include
|
|
||||||
Thymeleaf as well. Otherwise the following can be omitted. -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.thymeleaf</groupId>
|
|
||||||
<artifactId>thymeleaf</artifactId>
|
|
||||||
<version>2.1.4.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Used for CORS support -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.ebaysf.web</groupId>
|
|
||||||
<artifactId>cors-filter</artifactId>
|
|
||||||
<version>1.0.1</version>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>servlet-api</artifactId>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Spring Web is used to deploy the server to a web container. -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-web</artifactId>
|
|
||||||
<version>4.1.6.RELEASE</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework</groupId>
|
|
||||||
<artifactId>spring-webmvc</artifactId>
|
|
||||||
<version>4.1.6.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- You may not need this if you are deploying to an application server
|
|
||||||
which provides database connection pools itself. -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-dbcp2</artifactId>
|
|
||||||
<version>2.0.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Used to provide JSON support in non-FHIR services -->
|
|
||||||
<!-- <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-asl</artifactId>
|
|
||||||
<version>1.9.13</version> </dependency> -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-core</artifactId>
|
|
||||||
<version>2.5.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-annotations</artifactId>
|
|
||||||
<version>2.5.2</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.5.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- This example uses Derby embedded database. If you are using another
|
|
||||||
database such as Mysql or Oracle, you may omit the following dependencies
|
|
||||||
and replace them with an appropriate database client dependency for your
|
|
||||||
database platform. -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.derby</groupId>
|
|
||||||
<artifactId>derby</artifactId>
|
|
||||||
<version>10.11.1.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.derby</groupId>
|
|
||||||
<artifactId>derbynet</artifactId>
|
|
||||||
<version>10.11.1.1</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.derby</groupId>
|
|
||||||
<artifactId>derbyclient</artifactId>
|
|
||||||
<version>10.11.1.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Testing -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>junit</groupId>
|
|
||||||
<artifactId>junit</artifactId>
|
|
||||||
<version>4.12</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hamcrest</groupId>
|
|
||||||
<artifactId>java-hamcrest</artifactId>
|
|
||||||
<version>2.0.0.0</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
|
|
||||||
<!-- Tells Maven to name the generated WAR file as hapi-fhir-jpaserver-example.war -->
|
|
||||||
<finalName>hapi-fhir-jpaserver-example</finalName>
|
|
||||||
|
|
||||||
<!-- The following is not required for the application to build, but allows
|
|
||||||
you to test it by issuing "mvn jetty:run" from the command line. -->
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
|
||||||
<version>9.1.1.v20140108</version>
|
|
||||||
<configuration>
|
|
||||||
<webApp>
|
|
||||||
<contextPath>/hapi-fhir-jpaserver-example-advanced</contextPath>
|
|
||||||
</webApp>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
|
|
||||||
<plugins>
|
|
||||||
<!-- Tell Maven which Java source version you want to use -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.2</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.7</source>
|
|
||||||
<target>1.7</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- The configuration here tells the WAR plugin to include the FHIR Tester
|
|
||||||
overlay. You can omit it if you are not using that feature. -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<overlays>
|
|
||||||
<overlay>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-testpage-overlay</artifactId>
|
|
||||||
</overlay>
|
|
||||||
</overlays>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!-- This plugin is just a part of the HAPI internal build process, you
|
|
||||||
do not need to incude it in your own projects -->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,9 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo;
|
|
||||||
|
|
||||||
public class DerbyInit {
|
|
||||||
|
|
||||||
public DerbyInit() throws ClassNotFoundException {
|
|
||||||
Class.forName("org.apache.derby.jdbc.ClientDriver");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,117 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
|
||||||
|
|
||||||
import org.springframework.web.context.ContextLoaderListener;
|
|
||||||
import org.springframework.web.context.WebApplicationContext;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.jpa.dao.IFhirSystemDao;
|
|
||||||
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu1;
|
|
||||||
import ca.uhn.fhir.jpa.provider.JpaConformanceProviderDstu2;
|
|
||||||
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu1;
|
|
||||||
import ca.uhn.fhir.jpa.provider.JpaSystemProviderDstu2;
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
|
||||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
|
||||||
import ca.uhn.fhir.rest.server.ETagSupportEnum;
|
|
||||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
|
||||||
import ca.uhn.fhir.rest.server.FifoMemoryPagingProvider;
|
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
|
||||||
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor;
|
|
||||||
import ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor;
|
|
||||||
|
|
||||||
public class JpaServerDemo extends RestfulServer {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private WebApplicationContext myAppCtx;
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
protected void initialize() throws ServletException {
|
|
||||||
super.initialize();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We want to support FHIR DSTU2 format. This means that the server
|
|
||||||
* will use the DSTU2 bundle format and other DSTU2 encoding changes.
|
|
||||||
*
|
|
||||||
* If you want to use DSTU1 instead, change the following line, and change the 2 occurrences of dstu2 in web.xml to dstu1
|
|
||||||
*/
|
|
||||||
FhirVersionEnum fhirVersion = FhirVersionEnum.DSTU2;
|
|
||||||
setFhirContext(new FhirContext(fhirVersion));
|
|
||||||
|
|
||||||
// Get the spring context from the web container (it's declared in web.xml)
|
|
||||||
myAppCtx = ContextLoaderListener.getCurrentWebApplicationContext();
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The hapi-fhir-server-resourceproviders-dev.xml file is a spring configuration
|
|
||||||
* file which is automatically generated as a part of hapi-fhir-jpaserver-base and
|
|
||||||
* contains bean definitions for a resource provider for each resource type
|
|
||||||
*/
|
|
||||||
ResourceProviderFactory beans = myAppCtx.getBean("myResourceProvidersDstu2", List.class);
|
|
||||||
setResourceProviders(beans);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The system provider implements non-resource-type methods, such as
|
|
||||||
* transaction, and global history.
|
|
||||||
*/
|
|
||||||
Object systemProvider = myAppCtx.getBean("mySystemProviderDstu2", JpaSystemProviderDstu2.class);
|
|
||||||
setPlainProviders(systemProvider);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The conformance provider exports the supported resources, search parameters, etc for
|
|
||||||
* this server. The JPA version adds resource counts to the exported statement, so it
|
|
||||||
* is a nice addition.
|
|
||||||
*/
|
|
||||||
IFhirSystemDao<Bundle> systemDao = myAppCtx.getBean("mySystemDaoDstu2", IFhirSystemDao.class);
|
|
||||||
JpaConformanceProviderDstu2 confProvider = new JpaConformanceProviderDstu2(this, systemDao);
|
|
||||||
confProvider.setImplementationDescription("Example Server");
|
|
||||||
setServerConformanceProvider(confProvider);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable ETag Support (this is already the default)
|
|
||||||
*/
|
|
||||||
setETagSupport(ETagSupportEnum.ENABLED);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This tells the server to use "browser friendly" MIME types if it
|
|
||||||
* detects that the request is coming from a browser, in the hopes that the
|
|
||||||
* browser won't just treat the content as a binary payload and try
|
|
||||||
* to download it (which is what generally happens if you load a
|
|
||||||
* FHIR URL in a browser).
|
|
||||||
*
|
|
||||||
* This means that the server isn't technically complying with the
|
|
||||||
* FHIR specification for direct browser requests, but this mode
|
|
||||||
* is very helpful for testing and troubleshooting since it means
|
|
||||||
* you can look at FHIR URLs directly in a browser.
|
|
||||||
*/
|
|
||||||
setUseBrowserFriendlyContentTypes(true);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Default to XML and pretty printing
|
|
||||||
*/
|
|
||||||
setDefaultPrettyPrint(true);
|
|
||||||
setDefaultResponseEncoding(EncodingEnum.JSON);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This is a simple paging strategy that keeps the last 10 searches in memory
|
|
||||||
*/
|
|
||||||
setPagingProvider(new FifoMemoryPagingProvider(10));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Load interceptors for the server from Spring (these are defined in hapi-fhir-server-config.xml
|
|
||||||
*/
|
|
||||||
List<IServerInterceptor> interceptorBeans = myAppCtx.getBean("myServerInterceptors", List.class);
|
|
||||||
for (IServerInterceptor interceptor : interceptorBeans) {
|
|
||||||
this.registerInterceptor(interceptor);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo.entity;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* #%L
|
|
||||||
* HAPI FHIR JPA Server
|
|
||||||
* %%
|
|
||||||
* Copyright (C) 2014 - 2015 University Health Network
|
|
||||||
* %%
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
* #L%
|
|
||||||
*/
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
|
||||||
import javax.persistence.GeneratedValue;
|
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
|
||||||
import javax.persistence.Table;
|
|
||||||
|
|
||||||
//@formatter:off
|
|
||||||
@Entity()
|
|
||||||
@Table(name = "CUST_USER")
|
|
||||||
//@formatter:on
|
|
||||||
public class User implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
|
||||||
@Id
|
|
||||||
@Column(name = "PID")
|
|
||||||
private Long myId;
|
|
||||||
|
|
||||||
@Column(name = "PASSWORD", length = 200)
|
|
||||||
private String myPassword;
|
|
||||||
|
|
||||||
@Column(name = "USERNAME", length = 200)
|
|
||||||
private String myUsername;
|
|
||||||
|
|
||||||
public Long getId() {
|
|
||||||
return myId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return myPassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUsername() {
|
|
||||||
return myUsername;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(Long theId) {
|
|
||||||
myId = theId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String thePassword) {
|
|
||||||
myPassword = thePassword;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String theUsername) {
|
|
||||||
myUsername = theUsername;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo.interceptor;
|
|
||||||
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.persistence.NoResultException;
|
|
||||||
import javax.persistence.PersistenceContext;
|
|
||||||
import javax.persistence.TypedQuery;
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
|
||||||
import org.springframework.transaction.annotation.Propagation;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.demo.entity.User;
|
|
||||||
import ca.uhn.fhir.rest.server.interceptor.InterceptorAdapter;
|
|
||||||
|
|
||||||
public class RequestAuthorizationInterceptor extends InterceptorAdapter {
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(RequestAuthorizationInterceptor.class);
|
|
||||||
|
|
||||||
@PersistenceContext()
|
|
||||||
private EntityManager myEntityManager;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private PlatformTransactionManager myPlatformTransactionManager;
|
|
||||||
|
|
||||||
@Transactional(propagation = Propagation.REQUIRED)
|
|
||||||
@Override
|
|
||||||
public boolean incomingRequestPreProcessed(HttpServletRequest theRequest, HttpServletResponse theResponse) {
|
|
||||||
|
|
||||||
String authorization = theResponse.getHeader("Authorization");
|
|
||||||
|
|
||||||
TypedQuery<User> q = myEntityManager.createQuery("SELECT u FROM User u WHERE u.myUsername = :username", User.class);
|
|
||||||
String username = authorization;
|
|
||||||
|
|
||||||
q.setParameter("username", username);
|
|
||||||
try {
|
|
||||||
User user = q.getSingleResult();
|
|
||||||
ourLog.info("Found user [{}]: {}", username, user);
|
|
||||||
} catch (NoResultException e) {
|
|
||||||
ourLog.info("No user found in user table with username [{}]", username);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,18 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo.svc;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
|
|
||||||
public class LoginResponse {
|
|
||||||
|
|
||||||
@JsonProperty(value = "success")
|
|
||||||
private boolean mySuccess;
|
|
||||||
|
|
||||||
public boolean isSuccess() {
|
|
||||||
return mySuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSuccess(boolean theSuccess) {
|
|
||||||
mySuccess = theSuccess;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,28 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo.svc;
|
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class ServiceController {
|
|
||||||
|
|
||||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(ServiceController.class);
|
|
||||||
|
|
||||||
public ServiceController() {
|
|
||||||
ourLog.info("Starting service controller");
|
|
||||||
}
|
|
||||||
|
|
||||||
@RequestMapping(value = "/login", method = {RequestMethod.GET, RequestMethod.POST} )
|
|
||||||
public @ResponseBody LoginResponse handleFormUpload(@RequestParam("name") String theUsername) {
|
|
||||||
ourLog.info("Login request for user[{}]", theUsername);
|
|
||||||
|
|
||||||
LoginResponse retVal = new LoginResponse();
|
|
||||||
retVal.setSuccess(true);
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
<configuration scan="true" scanPeriod="30 seconds">
|
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>INFO</level>
|
|
||||||
</filter>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} [%file:%line] %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root level="INFO">
|
|
||||||
<appender-ref ref="STDOUT" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
|
@ -1,42 +0,0 @@
|
||||||
<?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:context="http://www.springframework.org/schema/context"
|
|
||||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
|
|
||||||
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-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
|
||||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
|
||||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
|
||||||
"
|
|
||||||
default-autowire="no" default-lazy-init="false">
|
|
||||||
|
|
||||||
<context:annotation-config />
|
|
||||||
<context:mbean-server />
|
|
||||||
|
|
||||||
<bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig">
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
|
||||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
|
||||||
</bean>
|
|
||||||
<tx:annotation-driven transaction-manager="myTxManager" />
|
|
||||||
|
|
||||||
<util:list id="myServerInterceptors">
|
|
||||||
<ref bean="authorizationInterceptor"/>
|
|
||||||
<ref bean="loggingInterceptor"/>
|
|
||||||
</util:list>
|
|
||||||
|
|
||||||
<bean id="authorizationInterceptor" class="ca.uhn.fhir.jpa.demo.interceptor.RequestAuthorizationInterceptor">
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Do some fancy logging to create a nice access log that has details
|
|
||||||
about each incoming request.
|
|
||||||
-->
|
|
||||||
<bean id="loggingInterceptor" class="ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor">
|
|
||||||
<property name="loggerName" value="fhirtest.access"/>
|
|
||||||
<property name="messageFormat"
|
|
||||||
value="Path[${servletPath}] Source[${requestHeader.x-forwarded-for}] Operation[${operationType} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}]"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,57 +0,0 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security"
|
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
|
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This file configures the database connection for the HAPI JPA Server.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The following bean configures the database connection. The 'url' property value
|
|
||||||
of "jdbc:derby:directory:jpaserver_derby_files;create=true" indicates that the
|
|
||||||
server should save resources in a directory called "jpaserver_derby_files".
|
|
||||||
|
|
||||||
A URL to a remote database could also be placed here, along with login credentials
|
|
||||||
and other properties supported by BasicDataSource.
|
|
||||||
-->
|
|
||||||
<bean id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
|
||||||
<property name="url" value="jdbc:derby:directory:jpaserver_derby_files;create=true" />
|
|
||||||
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"></property>
|
|
||||||
<property name="username" value=""/>
|
|
||||||
<property name="password" value=""/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Hibernate can be configured with other dialects if you wish to connect to another
|
|
||||||
database (e.g. Postgres). Consult the Hibernate documentation to see a list of
|
|
||||||
available dialects.
|
|
||||||
-->
|
|
||||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
|
||||||
<property name="dataSource" ref="myPersistenceDataSource" />
|
|
||||||
<!--
|
|
||||||
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
|
|
||||||
<property name="persistenceUnitName" value="FHIR_UT" />
|
|
||||||
-->
|
|
||||||
<property name="packagesToScan">
|
|
||||||
<array>
|
|
||||||
<value type="java.lang.String">ca.uhn.fhir.jpa.entity</value>
|
|
||||||
<value type="java.lang.String">ca.uhn.fhir.jpa.model.entity</value>
|
|
||||||
<value type="java.lang.String">ca.uhn.fhir.jpa.demo.entity</value>
|
|
||||||
</array>
|
|
||||||
</property>
|
|
||||||
<property name="jpaVendorAdapter">
|
|
||||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
|
||||||
<property name="showSql" value="false" />
|
|
||||||
<property name="generateDdl" value="true" />
|
|
||||||
<property name="databasePlatform" value="ca.uhn.fhir.jpa.util.DerbyTenSevenHapiFhirDialect" />
|
|
||||||
</bean>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,23 +0,0 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
|
||||||
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security"
|
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
|
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
|
|
||||||
|
|
||||||
<bean class="ca.uhn.fhir.to.TesterConfig">
|
|
||||||
<property name="servers">
|
|
||||||
<list>
|
|
||||||
<value>home , DSTU2 , Local Server , ${serverBase}/fhir</value>
|
|
||||||
</list>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="fhirContext" class="ca.uhn.fhir.context.FhirContext" factory-method="forDstu2">
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?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:context="http://www.springframework.org/schema/context"
|
|
||||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
||||||
xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
|
|
||||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
||||||
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-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
|
||||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
|
||||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
|
||||||
"
|
|
||||||
default-autowire="no" default-lazy-init="false">
|
|
||||||
|
|
||||||
<context:annotation-config/>
|
|
||||||
<context:mbean-server/>
|
|
||||||
|
|
||||||
<mvc:annotation-driven>
|
|
||||||
<mvc:message-converters register-defaults="false">
|
|
||||||
<bean id="jacksonMessageConverter"
|
|
||||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
|
|
||||||
</mvc:message-converters>
|
|
||||||
</mvc:annotation-driven>
|
|
||||||
|
|
||||||
<context:component-scan base-package="ca.uhn.fhir.jpa.demo.svc"></context:component-scan>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,67 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head th:include="tmpl-head :: head">
|
|
||||||
<title>About This Server</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<form action="" method="get" id="outerForm">
|
|
||||||
<div th:replace="tmpl-navbar-top :: top" ></div>
|
|
||||||
|
|
||||||
<div class="container-fluid">
|
|
||||||
<div class="row">
|
|
||||||
<div th:replace="tmpl-navbar-left :: left" ></div>
|
|
||||||
|
|
||||||
<div class="col-sm-9 col-sm-offset-3 col-md-9 col-md-offset-3 main">
|
|
||||||
|
|
||||||
<div th:replace="tmpl-banner :: banner"></div>
|
|
||||||
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">About This Server</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<div class="pull-right">
|
|
||||||
<object data="img/fhirtest-architecture.svg" width="383" height="369" type="image/svg+xml"></object>
|
|
||||||
</div>
|
|
||||||
<p>
|
|
||||||
This server provides a nearly complete implementation of the FHIR Specification
|
|
||||||
using a 100% open source software stack. It is hosted by University Health Network.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The architecture in use here is shown in the image on the right. This server is built
|
|
||||||
from a number of modules of the
|
|
||||||
<a href="https://github.com/jamesagnew/hapi-fhir/">HAPI FHIR</a>
|
|
||||||
project, which is a 100% open-source (Apache 2.0 Licensed) Java based
|
|
||||||
implementation of the FHIR specification.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="panel panel-default">
|
|
||||||
<div class="panel-heading">
|
|
||||||
<h3 class="panel-title">Data On This Server</h3>
|
|
||||||
</div>
|
|
||||||
<div class="panel-body">
|
|
||||||
<p>
|
|
||||||
This server is regularly loaded with a standard set of test data sourced
|
|
||||||
from UHN's own testing environment. Do not use this server to store any data
|
|
||||||
that you will need later, as we will be regularly resetting it.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
This is not a production server and it provides no privacy. Do not store any
|
|
||||||
confidential data here.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div th:replace="tmpl-footer :: footer" ></div>
|
|
||||||
</form>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -1,16 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<div th:fragment="footer">
|
|
||||||
<script>
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
|
||||||
|
|
||||||
ga('create', 'UA-1395874-6', 'auto');
|
|
||||||
ga('require', 'displayfeatures');
|
|
||||||
ga('require', 'linkid', 'linkid.js');
|
|
||||||
ga('send', 'pageview');
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
|
@ -1,52 +0,0 @@
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<div th:fragment="banner" class="well">
|
|
||||||
<th:block th:if="${serverId} == 'home'">
|
|
||||||
<p>
|
|
||||||
This is the home for the FHIR test server operated by
|
|
||||||
<a href="http://uhn.ca">University Health Network</a>. This server
|
|
||||||
(and the testing application you are currently using to access it)
|
|
||||||
is entirely built using
|
|
||||||
<a href="https://github.com/jamesagnew/hapi-fhir">HAPI-FHIR</a>,
|
|
||||||
a 100% open-source Java implementation of the
|
|
||||||
<a href="http://hl7.org/implement/standards/fhir/">FHIR specification</a>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Here are some things you might wish to try:
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
View a
|
|
||||||
<a href="http://fhirtest.uhn.ca/search?serverId=home&encoding=json&pretty=true&resource=Patient&param.0.type=string&param.0.name=_id&param.0.0=&resource-search-limit=">list of patients</a>
|
|
||||||
on this server.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Construct a
|
|
||||||
<a href="http://fhirtest.uhn.ca/resource?serverId=home&encoding=json&pretty=true&resource=Patient">search query</a>
|
|
||||||
on this server.
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
Access a
|
|
||||||
<a href="http://fhirtest.uhn.ca/home?serverId=furore">different server</a>
|
|
||||||
(use the <b>Server</b> menu at the top of the page to see a list of public FHIR servers)
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</th:block>
|
|
||||||
<th:block th:if="${serverId} != 'home'">
|
|
||||||
<p>
|
|
||||||
You are accessing the public FHIR server
|
|
||||||
<b th:text="${baseName}"/>. This server is hosted elsewhere on the internet
|
|
||||||
but is being accessed using the HAPI client implementation.
|
|
||||||
</p>
|
|
||||||
</th:block>
|
|
||||||
<p>
|
|
||||||
<b style="color: red;">
|
|
||||||
<span class="glyphicon glyphicon-warning-sign"/>
|
|
||||||
This is not a production server!
|
|
||||||
</b>
|
|
||||||
Do not store any information here that contains personal health information
|
|
||||||
or any other confidential information. This server will be regularly purged
|
|
||||||
and reloaded with fixed test data.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</html>
|
|
|
@ -1,104 +0,0 @@
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
version="3.0" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee ./xsd/web-app_3_0.xsd">
|
|
||||||
|
|
||||||
<listener>
|
|
||||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
|
||||||
</listener>
|
|
||||||
|
|
||||||
<context-param>
|
|
||||||
<param-name>contextConfigLocation</param-name>
|
|
||||||
<param-value>
|
|
||||||
classpath:hapi-fhir-server-resourceproviders-dstu2.xml
|
|
||||||
/WEB-INF/hapi-fhir-server-database-config.xml
|
|
||||||
/WEB-INF/hapi-fhir-server-config.xml
|
|
||||||
/WEB-INF/hapi-fhir-tester-application-context.xml
|
|
||||||
/WEB-INF/hapi-fhir-tester-config.xml
|
|
||||||
/WEB-INF/non-fhir-services-config.xml
|
|
||||||
</param-value>
|
|
||||||
</context-param>
|
|
||||||
|
|
||||||
<!-- Servlets -->
|
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>spring</servlet-name>
|
|
||||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
|
||||||
<init-param>
|
|
||||||
<param-name>contextConfigLocation</param-name>
|
|
||||||
<param-value>
|
|
||||||
/WEB-INF/hapi-fhir-tester-application-context.xml
|
|
||||||
/WEB-INF/hapi-fhir-tester-config.xml
|
|
||||||
</param-value>
|
|
||||||
</init-param>
|
|
||||||
<load-on-startup>2</load-on-startup>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet>
|
|
||||||
<servlet-name>fhirServlet</servlet-name>
|
|
||||||
<servlet-class>ca.uhn.fhir.jpa.demo.JpaServerDemo</servlet-class>
|
|
||||||
<init-param>
|
|
||||||
<param-name>ImplementationDescription</param-name>
|
|
||||||
<param-value>FHIR JPA Server</param-value>
|
|
||||||
</init-param>
|
|
||||||
<load-on-startup>1</load-on-startup>
|
|
||||||
</servlet>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>fhirServlet</servlet-name>
|
|
||||||
<url-pattern>/fhir/*</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
<servlet-mapping>
|
|
||||||
<servlet-name>spring</servlet-name>
|
|
||||||
<url-pattern>/</url-pattern>
|
|
||||||
</servlet-mapping>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- This filters provide support for Cross Origin Resource Sharing (CORS) -->
|
|
||||||
<filter>
|
|
||||||
<filter-name>CORS Filter</filter-name>
|
|
||||||
<filter-class>org.ebaysf.web.cors.CORSFilter</filter-class>
|
|
||||||
<init-param>
|
|
||||||
<description>A comma separated list of allowed origins. Note: An '*' cannot be used for an allowed origin when using credentials.</description>
|
|
||||||
<param-name>cors.allowed.origins</param-name>
|
|
||||||
<param-value>*</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<description>A comma separated list of HTTP verbs, using which a CORS request can be made.</description>
|
|
||||||
<param-name>cors.allowed.methods</param-name>
|
|
||||||
<param-value>GET,POST,PUT,DELETE,OPTIONS</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<description>A comma separated list of allowed headers when making a non simple CORS request.</description>
|
|
||||||
<param-name>cors.allowed.headers</param-name>
|
|
||||||
<param-value>X-FHIR-Starter,Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<description>A comma separated list non-standard response headers that will be exposed to XHR2 object.</description>
|
|
||||||
<param-name>cors.exposed.headers</param-name>
|
|
||||||
<param-value>Location,Content-Location</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<description>A flag that suggests if CORS is supported with cookies</description>
|
|
||||||
<param-name>cors.support.credentials</param-name>
|
|
||||||
<param-value>true</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<description>A flag to control logging</description>
|
|
||||||
<param-name>cors.logging.enabled</param-name>
|
|
||||||
<param-value>true</param-value>
|
|
||||||
</init-param>
|
|
||||||
<init-param>
|
|
||||||
<description>Indicates how long (in seconds) the results of a preflight request can be cached in a preflight result cache.</description>
|
|
||||||
<param-name>cors.preflight.maxage</param-name>
|
|
||||||
<param-value>300</param-value>
|
|
||||||
</init-param>
|
|
||||||
</filter>
|
|
||||||
<filter-mapping>
|
|
||||||
<filter-name>CORS Filter</filter-name>
|
|
||||||
<url-pattern>/*</url-pattern>
|
|
||||||
</filter-mapping>
|
|
||||||
|
|
||||||
|
|
||||||
</web-app>
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,389 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
|
|
||||||
targetNamespace="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
||||||
elementFormDefault="qualified"
|
|
||||||
attributeFormDefault="unqualified"
|
|
||||||
version="2.2">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
||||||
|
|
||||||
Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved.
|
|
||||||
|
|
||||||
The contents of this file are subject to the terms of either the
|
|
||||||
GNU General Public License Version 2 only ("GPL") or the Common
|
|
||||||
Development and Distribution License("CDDL") (collectively, the
|
|
||||||
"License"). You may not use this file except in compliance with
|
|
||||||
the License. You can obtain a copy of the License at
|
|
||||||
https://glassfish.dev.java.net/public/CDDL+GPL.html or
|
|
||||||
glassfish/bootstrap/legal/LICENSE.txt. See the License for the
|
|
||||||
specific language governing permissions and limitations under the
|
|
||||||
License.
|
|
||||||
|
|
||||||
When distributing the software, include this License Header
|
|
||||||
Notice in each file and include the License file at
|
|
||||||
glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as
|
|
||||||
provided by Sun in the GPL Version 2 section of the License file
|
|
||||||
that accompanied this code. If applicable, add the following
|
|
||||||
below the License Header, with the fields enclosed by brackets []
|
|
||||||
replaced by your own identifying information:
|
|
||||||
"Portions Copyrighted [year] [name of copyright owner]"
|
|
||||||
|
|
||||||
Contributor(s):
|
|
||||||
|
|
||||||
If you wish your version of this file to be governed by only the
|
|
||||||
CDDL or only the GPL Version 2, indicate your decision by adding
|
|
||||||
"[Contributor] elects to include this software in this
|
|
||||||
distribution under the [CDDL or GPL Version 2] license." If you
|
|
||||||
don't indicate a single choice of license, a recipient has the
|
|
||||||
option to distribute your version of this file under either the
|
|
||||||
CDDL, the GPL Version 2 or to extend the choice of license to its
|
|
||||||
licensees as provided above. However, if you add GPL Version 2
|
|
||||||
code and therefore, elected the GPL Version 2 license, then the
|
|
||||||
option applies only if the new code is made subject to such
|
|
||||||
option by the copyright holder.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
This is the XML Schema for the JSP 2.2 deployment descriptor
|
|
||||||
types. The JSP 2.2 schema contains all the special
|
|
||||||
structures and datatypes that are necessary to use JSP files
|
|
||||||
from a web application.
|
|
||||||
|
|
||||||
The contents of this schema is used by the web-common_3_0.xsd
|
|
||||||
file to define JSP specific content.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The following conventions apply to all Java EE
|
|
||||||
deployment descriptor elements unless indicated otherwise.
|
|
||||||
|
|
||||||
- In elements that specify a pathname to a file within the
|
|
||||||
same JAR file, relative filenames (i.e., those not
|
|
||||||
starting with "/") are considered relative to the root of
|
|
||||||
the JAR file's namespace. Absolute filenames (i.e., those
|
|
||||||
starting with "/") also specify names in the root of the
|
|
||||||
JAR file's namespace. In general, relative names are
|
|
||||||
preferred. The exception is .war files where absolute
|
|
||||||
names are preferred for consistency with the Servlet API.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
|
|
||||||
<xsd:include schemaLocation="javaee_6.xsd"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
|
||||||
|
|
||||||
<xsd:complexType name="jsp-configType">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The jsp-configType is used to provide global configuration
|
|
||||||
information for the JSP files in a web application. It has
|
|
||||||
two subelements, taglib and jsp-property-group.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="taglib"
|
|
||||||
type="javaee:taglibType"
|
|
||||||
minOccurs="0"
|
|
||||||
maxOccurs="unbounded"/>
|
|
||||||
<xsd:element name="jsp-property-group"
|
|
||||||
type="javaee:jsp-property-groupType"
|
|
||||||
minOccurs="0"
|
|
||||||
maxOccurs="unbounded"/>
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="id"
|
|
||||||
type="xsd:ID"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
|
||||||
|
|
||||||
<xsd:complexType name="jsp-fileType">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The jsp-file element contains the full path to a JSP file
|
|
||||||
within the web application beginning with a `/'.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:simpleContent>
|
|
||||||
<xsd:restriction base="javaee:pathType"/>
|
|
||||||
</xsd:simpleContent>
|
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
|
||||||
|
|
||||||
<xsd:complexType name="jsp-property-groupType">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The jsp-property-groupType is used to group a number of
|
|
||||||
files so they can be given global property information.
|
|
||||||
All files so described are deemed to be JSP files. The
|
|
||||||
following additional properties can be described:
|
|
||||||
|
|
||||||
- Control whether EL is ignored.
|
|
||||||
- Control whether scripting elements are invalid.
|
|
||||||
- Indicate pageEncoding information.
|
|
||||||
- Indicate that a resource is a JSP document (XML).
|
|
||||||
- Prelude and Coda automatic includes.
|
|
||||||
- Control whether the character sequence #{ is allowed
|
|
||||||
when used as a String literal.
|
|
||||||
- Control whether template text containing only
|
|
||||||
whitespaces must be removed from the response output.
|
|
||||||
- Indicate the default contentType information.
|
|
||||||
- Indicate the default buffering model for JspWriter
|
|
||||||
- Control whether error should be raised for the use of
|
|
||||||
undeclared namespaces in a JSP page.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:group ref="javaee:descriptionGroup"/>
|
|
||||||
<xsd:element name="url-pattern"
|
|
||||||
type="javaee:url-patternType"
|
|
||||||
maxOccurs="unbounded"/>
|
|
||||||
<xsd:element name="el-ignored"
|
|
||||||
type="javaee:true-falseType"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
Can be used to easily set the isELIgnored
|
|
||||||
property of a group of JSP pages. By default, the
|
|
||||||
EL evaluation is enabled for Web Applications using
|
|
||||||
a Servlet 2.4 or greater web.xml, and disabled
|
|
||||||
otherwise.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="page-encoding"
|
|
||||||
type="javaee:string"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The valid values of page-encoding are those of the
|
|
||||||
pageEncoding page directive. It is a
|
|
||||||
translation-time error to name different encodings
|
|
||||||
in the pageEncoding attribute of the page directive
|
|
||||||
of a JSP page and in a JSP configuration element
|
|
||||||
matching the page. It is also a translation-time
|
|
||||||
error to name different encodings in the prolog
|
|
||||||
or text declaration of a document in XML syntax and
|
|
||||||
in a JSP configuration element matching the document.
|
|
||||||
It is legal to name the same encoding through
|
|
||||||
mulitple mechanisms.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="scripting-invalid"
|
|
||||||
type="javaee:true-falseType"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
Can be used to easily disable scripting in a
|
|
||||||
group of JSP pages. By default, scripting is
|
|
||||||
enabled.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="is-xml"
|
|
||||||
type="javaee:true-falseType"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
If true, denotes that the group of resources
|
|
||||||
that match the URL pattern are JSP documents,
|
|
||||||
and thus must be interpreted as XML documents.
|
|
||||||
If false, the resources are assumed to not
|
|
||||||
be JSP documents, unless there is another
|
|
||||||
property group that indicates otherwise.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="include-prelude"
|
|
||||||
type="javaee:pathType"
|
|
||||||
minOccurs="0"
|
|
||||||
maxOccurs="unbounded">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The include-prelude element is a context-relative
|
|
||||||
path that must correspond to an element in the
|
|
||||||
Web Application. When the element is present,
|
|
||||||
the given path will be automatically included (as
|
|
||||||
in an include directive) at the beginning of each
|
|
||||||
JSP page in this jsp-property-group.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="include-coda"
|
|
||||||
type="javaee:pathType"
|
|
||||||
minOccurs="0"
|
|
||||||
maxOccurs="unbounded">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The include-coda element is a context-relative
|
|
||||||
path that must correspond to an element in the
|
|
||||||
Web Application. When the element is present,
|
|
||||||
the given path will be automatically included (as
|
|
||||||
in an include directive) at the end of each
|
|
||||||
JSP page in this jsp-property-group.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="deferred-syntax-allowed-as-literal"
|
|
||||||
type="javaee:true-falseType"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The character sequence #{ is reserved for EL expressions.
|
|
||||||
Consequently, a translation error occurs if the #{
|
|
||||||
character sequence is used as a String literal, unless
|
|
||||||
this element is enabled (true). Disabled (false) by
|
|
||||||
default.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="trim-directive-whitespaces"
|
|
||||||
type="javaee:true-falseType"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
Indicates that template text containing only whitespaces
|
|
||||||
must be removed from the response output. It has no
|
|
||||||
effect on JSP documents (XML syntax). Disabled (false)
|
|
||||||
by default.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="default-content-type"
|
|
||||||
type="javaee:string"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The valid values of default-content-type are those of the
|
|
||||||
contentType page directive. It specifies the default
|
|
||||||
response contentType if the page directive does not include
|
|
||||||
a contentType attribute.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="buffer"
|
|
||||||
type="javaee:string"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The valid values of buffer are those of the
|
|
||||||
buffer page directive. It specifies if buffering should be
|
|
||||||
used for the output to response, and if so, the size of the
|
|
||||||
buffer to use.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="error-on-undeclared-namespace"
|
|
||||||
type="javaee:true-falseType"
|
|
||||||
minOccurs="0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The default behavior when a tag with unknown namespace is used
|
|
||||||
in a JSP page (regular syntax) is to silently ignore it. If
|
|
||||||
set to true, then an error must be raised during the translation
|
|
||||||
time when an undeclared tag is used in a JSP page. Disabled
|
|
||||||
(false) by default.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="id"
|
|
||||||
type="xsd:ID"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
|
||||||
|
|
||||||
<xsd:complexType name="taglibType">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The taglibType defines the syntax for declaring in
|
|
||||||
the deployment descriptor that a tag library is
|
|
||||||
available to the application. This can be done
|
|
||||||
to override implicit map entries from TLD files and
|
|
||||||
from the container.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="taglib-uri"
|
|
||||||
type="javaee:string">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
A taglib-uri element describes a URI identifying a
|
|
||||||
tag library used in the web application. The body
|
|
||||||
of the taglib-uri element may be either an
|
|
||||||
absolute URI specification, or a relative URI.
|
|
||||||
There should be no entries in web.xml with the
|
|
||||||
same taglib-uri value.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="taglib-location"
|
|
||||||
type="javaee:pathType">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
the taglib-location element contains the location
|
|
||||||
(as a resource relative to the root of the web
|
|
||||||
application) where to find the Tag Library
|
|
||||||
Description file for the tag library.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="id"
|
|
||||||
type="xsd:ID"/>
|
|
||||||
</xsd:complexType>
|
|
||||||
|
|
||||||
</xsd:schema>
|
|
|
@ -1,272 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
|
|
||||||
targetNamespace="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:javaee="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
|
||||||
elementFormDefault="qualified"
|
|
||||||
attributeFormDefault="unqualified"
|
|
||||||
version="3.0">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
|
|
||||||
|
|
||||||
Copyright 2003-2009 Sun Microsystems, Inc. All rights reserved.
|
|
||||||
|
|
||||||
The contents of this file are subject to the terms of either the
|
|
||||||
GNU General Public License Version 2 only ("GPL") or the Common
|
|
||||||
Development and Distribution License("CDDL") (collectively, the
|
|
||||||
"License"). You may not use this file except in compliance with
|
|
||||||
the License. You can obtain a copy of the License at
|
|
||||||
https://glassfish.dev.java.net/public/CDDL+GPL.html or
|
|
||||||
glassfish/bootstrap/legal/LICENSE.txt. See the License for the
|
|
||||||
specific language governing permissions and limitations under the
|
|
||||||
License.
|
|
||||||
|
|
||||||
When distributing the software, include this License Header
|
|
||||||
Notice in each file and include the License file at
|
|
||||||
glassfish/bootstrap/legal/LICENSE.txt. Sun designates this
|
|
||||||
particular file as subject to the "Classpath" exception as
|
|
||||||
provided by Sun in the GPL Version 2 section of the License file
|
|
||||||
that accompanied this code. If applicable, add the following
|
|
||||||
below the License Header, with the fields enclosed by brackets []
|
|
||||||
replaced by your own identifying information:
|
|
||||||
"Portions Copyrighted [year] [name of copyright owner]"
|
|
||||||
|
|
||||||
Contributor(s):
|
|
||||||
|
|
||||||
If you wish your version of this file to be governed by only the
|
|
||||||
CDDL or only the GPL Version 2, indicate your decision by adding
|
|
||||||
"[Contributor] elects to include this software in this
|
|
||||||
distribution under the [CDDL or GPL Version 2] license." If you
|
|
||||||
don't indicate a single choice of license, a recipient has the
|
|
||||||
option to distribute your version of this file under either the
|
|
||||||
CDDL, the GPL Version 2 or to extend the choice of license to its
|
|
||||||
licensees as provided above. However, if you add GPL Version 2
|
|
||||||
code and therefore, elected the GPL Version 2 license, then the
|
|
||||||
option applies only if the new code is made subject to such
|
|
||||||
option by the copyright holder.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
<![CDATA[[
|
|
||||||
This is the XML Schema for the Servlet 3.0 deployment descriptor.
|
|
||||||
The deployment descriptor must be named "WEB-INF/web.xml" in the
|
|
||||||
web application's war file. All Servlet deployment descriptors
|
|
||||||
must indicate the web application schema by using the Java EE
|
|
||||||
namespace:
|
|
||||||
|
|
||||||
http://java.sun.com/xml/ns/javaee
|
|
||||||
|
|
||||||
and by indicating the version of the schema by
|
|
||||||
using the version element as shown below:
|
|
||||||
|
|
||||||
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="..."
|
|
||||||
version="3.0">
|
|
||||||
...
|
|
||||||
</web-app>
|
|
||||||
|
|
||||||
The instance documents may indicate the published version of
|
|
||||||
the schema using the xsi:schemaLocation attribute for Java EE
|
|
||||||
namespace with the following location:
|
|
||||||
|
|
||||||
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
|
|
||||||
|
|
||||||
]]>
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The following conventions apply to all Java EE
|
|
||||||
deployment descriptor elements unless indicated otherwise.
|
|
||||||
|
|
||||||
- In elements that specify a pathname to a file within the
|
|
||||||
same JAR file, relative filenames (i.e., those not
|
|
||||||
starting with "/") are considered relative to the root of
|
|
||||||
the JAR file's namespace. Absolute filenames (i.e., those
|
|
||||||
starting with "/") also specify names in the root of the
|
|
||||||
JAR file's namespace. In general, relative names are
|
|
||||||
preferred. The exception is .war files where absolute
|
|
||||||
names are preferred for consistency with the Servlet API.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
|
|
||||||
<xsd:include schemaLocation="web-common_3_0.xsd"/>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- **************************************************** -->
|
|
||||||
|
|
||||||
<xsd:element name="web-app"
|
|
||||||
type="javaee:web-appType">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The web-app element is the root of the deployment
|
|
||||||
descriptor for a web application. Note that the sub-elements
|
|
||||||
of this element can be in the arbitrary order. Because of
|
|
||||||
that, the multiplicity of the elements of distributable,
|
|
||||||
session-config, welcome-file-list, jsp-config, login-config,
|
|
||||||
and locale-encoding-mapping-list was changed from "?" to "*"
|
|
||||||
in this schema. However, the deployment descriptor instance
|
|
||||||
file must not contain multiple elements of session-config,
|
|
||||||
jsp-config, and login-config. When there are multiple elements of
|
|
||||||
welcome-file-list or locale-encoding-mapping-list, the container
|
|
||||||
must concatenate the element contents. The multiple occurence
|
|
||||||
of the element distributable is redundant and the container
|
|
||||||
treats that case exactly in the same way when there is only
|
|
||||||
one distributable.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:unique name="web-common-servlet-name-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The servlet element contains the name of a servlet.
|
|
||||||
The name must be unique within the web application.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:servlet"/>
|
|
||||||
<xsd:field xpath="javaee:servlet-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-filter-name-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The filter element contains the name of a filter.
|
|
||||||
The name must be unique within the web application.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:filter"/>
|
|
||||||
<xsd:field xpath="javaee:filter-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-ejb-local-ref-name-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The ejb-local-ref-name element contains the name of an EJB
|
|
||||||
reference. The EJB reference is an entry in the web
|
|
||||||
application's environment and is relative to the
|
|
||||||
java:comp/env context. The name must be unique within
|
|
||||||
the web application.
|
|
||||||
|
|
||||||
It is recommended that name is prefixed with "ejb/".
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:ejb-local-ref"/>
|
|
||||||
<xsd:field xpath="javaee:ejb-ref-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-ejb-ref-name-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The ejb-ref-name element contains the name of an EJB
|
|
||||||
reference. The EJB reference is an entry in the web
|
|
||||||
application's environment and is relative to the
|
|
||||||
java:comp/env context. The name must be unique within
|
|
||||||
the web application.
|
|
||||||
|
|
||||||
It is recommended that name is prefixed with "ejb/".
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:ejb-ref"/>
|
|
||||||
<xsd:field xpath="javaee:ejb-ref-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-resource-env-ref-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The resource-env-ref-name element specifies the name of
|
|
||||||
a resource environment reference; its value is the
|
|
||||||
environment entry name used in the web application code.
|
|
||||||
The name is a JNDI name relative to the java:comp/env
|
|
||||||
context and must be unique within a web application.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:resource-env-ref"/>
|
|
||||||
<xsd:field xpath="javaee:resource-env-ref-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-message-destination-ref-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The message-destination-ref-name element specifies the name of
|
|
||||||
a message destination reference; its value is the
|
|
||||||
environment entry name used in the web application code.
|
|
||||||
The name is a JNDI name relative to the java:comp/env
|
|
||||||
context and must be unique within a web application.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:message-destination-ref"/>
|
|
||||||
<xsd:field xpath="javaee:message-destination-ref-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-res-ref-name-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The res-ref-name element specifies the name of a
|
|
||||||
resource manager connection factory reference. The name
|
|
||||||
is a JNDI name relative to the java:comp/env context.
|
|
||||||
The name must be unique within a web application.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:resource-ref"/>
|
|
||||||
<xsd:field xpath="javaee:res-ref-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:unique name="web-common-env-entry-name-uniqueness">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The env-entry-name element contains the name of a web
|
|
||||||
application's environment entry. The name is a JNDI
|
|
||||||
name relative to the java:comp/env context. The name
|
|
||||||
must be unique within a web application.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:env-entry"/>
|
|
||||||
<xsd:field xpath="javaee:env-entry-name"/>
|
|
||||||
</xsd:unique>
|
|
||||||
<xsd:key name="web-common-role-name-key">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
A role-name-key is specified to allow the references
|
|
||||||
from the security-role-refs.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:security-role"/>
|
|
||||||
<xsd:field xpath="javaee:role-name"/>
|
|
||||||
</xsd:key>
|
|
||||||
<xsd:keyref name="web-common-role-name-references"
|
|
||||||
refer="javaee:web-common-role-name-key">
|
|
||||||
<xsd:annotation>
|
|
||||||
<xsd:documentation>
|
|
||||||
|
|
||||||
The keyref indicates the references from
|
|
||||||
security-role-ref to a specified role-name.
|
|
||||||
|
|
||||||
</xsd:documentation>
|
|
||||||
</xsd:annotation>
|
|
||||||
<xsd:selector xpath="javaee:servlet/javaee:security-role-ref"/>
|
|
||||||
<xsd:field xpath="javaee:role-link"/>
|
|
||||||
</xsd:keyref>
|
|
||||||
</xsd:element>
|
|
||||||
|
|
||||||
</xsd:schema>
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,287 +0,0 @@
|
||||||
<?xml version='1.0'?>
|
|
||||||
<?xml-stylesheet href="../2008/09/xsd.xsl" type="text/xsl"?>
|
|
||||||
<xs:schema targetNamespace="http://www.w3.org/XML/1998/namespace"
|
|
||||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
||||||
xmlns ="http://www.w3.org/1999/xhtml"
|
|
||||||
xml:lang="en">
|
|
||||||
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div>
|
|
||||||
<h1>About the XML namespace</h1>
|
|
||||||
|
|
||||||
<div class="bodytext">
|
|
||||||
<p>
|
|
||||||
This schema document describes the XML namespace, in a form
|
|
||||||
suitable for import by other schema documents.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
See <a href="http://www.w3.org/XML/1998/namespace.html">
|
|
||||||
http://www.w3.org/XML/1998/namespace.html</a> and
|
|
||||||
<a href="http://www.w3.org/TR/REC-xml">
|
|
||||||
http://www.w3.org/TR/REC-xml</a> for information
|
|
||||||
about this namespace.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Note that local names in this namespace are intended to be
|
|
||||||
defined only by the World Wide Web Consortium or its subgroups.
|
|
||||||
The names currently defined in this namespace are listed below.
|
|
||||||
They should not be used with conflicting semantics by any Working
|
|
||||||
Group, specification, or document instance.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
See further below in this document for more information about <a
|
|
||||||
href="#usage">how to refer to this schema document from your own
|
|
||||||
XSD schema documents</a> and about <a href="#nsversioning">the
|
|
||||||
namespace-versioning policy governing this schema document</a>.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
|
|
||||||
<xs:attribute name="lang">
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<h3>lang (as an attribute name)</h3>
|
|
||||||
<p>
|
|
||||||
denotes an attribute whose value
|
|
||||||
is a language code for the natural language of the content of
|
|
||||||
any element; its value is inherited. This name is reserved
|
|
||||||
by virtue of its definition in the XML specification.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h4>Notes</h4>
|
|
||||||
<p>
|
|
||||||
Attempting to install the relevant ISO 2- and 3-letter
|
|
||||||
codes as the enumerated possible values is probably never
|
|
||||||
going to be a realistic possibility.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
See BCP 47 at <a href="http://www.rfc-editor.org/rfc/bcp/bcp47.txt">
|
|
||||||
http://www.rfc-editor.org/rfc/bcp/bcp47.txt</a>
|
|
||||||
and the IANA language subtag registry at
|
|
||||||
<a href="http://www.iana.org/assignments/language-subtag-registry">
|
|
||||||
http://www.iana.org/assignments/language-subtag-registry</a>
|
|
||||||
for further information.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The union allows for the 'un-declaration' of xml:lang with
|
|
||||||
the empty string.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:union memberTypes="xs:language">
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:string">
|
|
||||||
<xs:enumeration value=""/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:union>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:attribute>
|
|
||||||
|
|
||||||
<xs:attribute name="space">
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<h3>space (as an attribute name)</h3>
|
|
||||||
<p>
|
|
||||||
denotes an attribute whose
|
|
||||||
value is a keyword indicating what whitespace processing
|
|
||||||
discipline is intended for the content of the element; its
|
|
||||||
value is inherited. This name is reserved by virtue of its
|
|
||||||
definition in the XML specification.</p>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
<xs:simpleType>
|
|
||||||
<xs:restriction base="xs:NCName">
|
|
||||||
<xs:enumeration value="default"/>
|
|
||||||
<xs:enumeration value="preserve"/>
|
|
||||||
</xs:restriction>
|
|
||||||
</xs:simpleType>
|
|
||||||
</xs:attribute>
|
|
||||||
|
|
||||||
<xs:attribute name="base" type="xs:anyURI"> <xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<h3>base (as an attribute name)</h3>
|
|
||||||
<p>
|
|
||||||
denotes an attribute whose value
|
|
||||||
provides a URI to be used as the base for interpreting any
|
|
||||||
relative URIs in the scope of the element on which it
|
|
||||||
appears; its value is inherited. This name is reserved
|
|
||||||
by virtue of its definition in the XML Base specification.</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
See <a
|
|
||||||
href="http://www.w3.org/TR/xmlbase/">http://www.w3.org/TR/xmlbase/</a>
|
|
||||||
for information about this attribute.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
</xs:attribute>
|
|
||||||
|
|
||||||
<xs:attribute name="id" type="xs:ID">
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<h3>id (as an attribute name)</h3>
|
|
||||||
<p>
|
|
||||||
denotes an attribute whose value
|
|
||||||
should be interpreted as if declared to be of type ID.
|
|
||||||
This name is reserved by virtue of its definition in the
|
|
||||||
xml:id specification.</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
See <a
|
|
||||||
href="http://www.w3.org/TR/xml-id/">http://www.w3.org/TR/xml-id/</a>
|
|
||||||
for information about this attribute.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
</xs:attribute>
|
|
||||||
|
|
||||||
<xs:attributeGroup name="specialAttrs">
|
|
||||||
<xs:attribute ref="xml:base"/>
|
|
||||||
<xs:attribute ref="xml:lang"/>
|
|
||||||
<xs:attribute ref="xml:space"/>
|
|
||||||
<xs:attribute ref="xml:id"/>
|
|
||||||
</xs:attributeGroup>
|
|
||||||
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div>
|
|
||||||
|
|
||||||
<h3>Father (in any context at all)</h3>
|
|
||||||
|
|
||||||
<div class="bodytext">
|
|
||||||
<p>
|
|
||||||
denotes Jon Bosak, the chair of
|
|
||||||
the original XML Working Group. This name is reserved by
|
|
||||||
the following decision of the W3C XML Plenary and
|
|
||||||
XML Coordination groups:
|
|
||||||
</p>
|
|
||||||
<blockquote>
|
|
||||||
<p>
|
|
||||||
In appreciation for his vision, leadership and
|
|
||||||
dedication the W3C XML Plenary on this 10th day of
|
|
||||||
February, 2000, reserves for Jon Bosak in perpetuity
|
|
||||||
the XML name "xml:Father".
|
|
||||||
</p>
|
|
||||||
</blockquote>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div xml:id="usage" id="usage">
|
|
||||||
<h2><a name="usage">About this schema document</a></h2>
|
|
||||||
|
|
||||||
<div class="bodytext">
|
|
||||||
<p>
|
|
||||||
This schema defines attributes and an attribute group suitable
|
|
||||||
for use by schemas wishing to allow <code>xml:base</code>,
|
|
||||||
<code>xml:lang</code>, <code>xml:space</code> or
|
|
||||||
<code>xml:id</code> attributes on elements they define.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
To enable this, such a schema must import this schema for
|
|
||||||
the XML namespace, e.g. as follows:
|
|
||||||
</p>
|
|
||||||
<pre>
|
|
||||||
<schema . . .>
|
|
||||||
. . .
|
|
||||||
<import namespace="http://www.w3.org/XML/1998/namespace"
|
|
||||||
schemaLocation="http://www.w3.org/2001/xml.xsd"/>
|
|
||||||
</pre>
|
|
||||||
<p>
|
|
||||||
or
|
|
||||||
</p>
|
|
||||||
<pre>
|
|
||||||
<import namespace="http://www.w3.org/XML/1998/namespace"
|
|
||||||
schemaLocation="http://www.w3.org/2009/01/xml.xsd"/>
|
|
||||||
</pre>
|
|
||||||
<p>
|
|
||||||
Subsequently, qualified reference to any of the attributes or the
|
|
||||||
group defined below will have the desired effect, e.g.
|
|
||||||
</p>
|
|
||||||
<pre>
|
|
||||||
<type . . .>
|
|
||||||
. . .
|
|
||||||
<attributeGroup ref="xml:specialAttrs"/>
|
|
||||||
</pre>
|
|
||||||
<p>
|
|
||||||
will define a type which will schema-validate an instance element
|
|
||||||
with any of those attributes.
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
|
|
||||||
<xs:annotation>
|
|
||||||
<xs:documentation>
|
|
||||||
<div id="nsversioning" xml:id="nsversioning">
|
|
||||||
<h2><a name="nsversioning">Versioning policy for this schema document</a></h2>
|
|
||||||
<div class="bodytext">
|
|
||||||
<p>
|
|
||||||
In keeping with the XML Schema WG's standard versioning
|
|
||||||
policy, this schema document will persist at
|
|
||||||
<a href="http://www.w3.org/2009/01/xml.xsd">
|
|
||||||
http://www.w3.org/2009/01/xml.xsd</a>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
At the date of issue it can also be found at
|
|
||||||
<a href="http://www.w3.org/2001/xml.xsd">
|
|
||||||
http://www.w3.org/2001/xml.xsd</a>.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
The schema document at that URI may however change in the future,
|
|
||||||
in order to remain compatible with the latest version of XML
|
|
||||||
Schema itself, or with the XML namespace itself. In other words,
|
|
||||||
if the XML Schema or XML namespaces change, the version of this
|
|
||||||
document at <a href="http://www.w3.org/2001/xml.xsd">
|
|
||||||
http://www.w3.org/2001/xml.xsd
|
|
||||||
</a>
|
|
||||||
will change accordingly; the version at
|
|
||||||
<a href="http://www.w3.org/2009/01/xml.xsd">
|
|
||||||
http://www.w3.org/2009/01/xml.xsd
|
|
||||||
</a>
|
|
||||||
will not change.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Previous dated (and unchanging) versions of this schema
|
|
||||||
document are at:
|
|
||||||
</p>
|
|
||||||
<ul>
|
|
||||||
<li><a href="http://www.w3.org/2009/01/xml.xsd">
|
|
||||||
http://www.w3.org/2009/01/xml.xsd</a></li>
|
|
||||||
<li><a href="http://www.w3.org/2007/08/xml.xsd">
|
|
||||||
http://www.w3.org/2007/08/xml.xsd</a></li>
|
|
||||||
<li><a href="http://www.w3.org/2004/10/xml.xsd">
|
|
||||||
http://www.w3.org/2004/10/xml.xsd</a></li>
|
|
||||||
<li><a href="http://www.w3.org/2001/03/xml.xsd">
|
|
||||||
http://www.w3.org/2001/03/xml.xsd</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</xs:documentation>
|
|
||||||
</xs:annotation>
|
|
||||||
|
|
||||||
</xs:schema>
|
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
package ca.uhn.fhir.jpa.demo;
|
|
||||||
|
|
||||||
import org.junit.AfterClass;
|
|
||||||
import org.junit.BeforeClass;
|
|
||||||
import org.junit.Test;
|
|
||||||
import org.springframework.context.support.FileSystemXmlApplicationContext;
|
|
||||||
|
|
||||||
public class ServiceTest {
|
|
||||||
|
|
||||||
private static FileSystemXmlApplicationContext ourAppCtx;
|
|
||||||
|
|
||||||
@BeforeClass
|
|
||||||
public static void beforeClass() {
|
|
||||||
ourAppCtx = new FileSystemXmlApplicationContext(
|
|
||||||
"src/test/resources/test-hapi-fhir-server-database-config.xml",
|
|
||||||
"src/main/webapp/WEB-INF/hapi-fhir-server-config.xml",
|
|
||||||
"src/main/webapp/WEB-INF/non-fhir-services-config.xml"
|
|
||||||
);
|
|
||||||
ourAppCtx.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSomething() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@AfterClass
|
|
||||||
public static void afterClass() {
|
|
||||||
ourAppCtx.stop();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,42 +0,0 @@
|
||||||
<?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:context="http://www.springframework.org/schema/context"
|
|
||||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
|
|
||||||
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-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
|
||||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
|
||||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
|
||||||
"
|
|
||||||
default-autowire="no" default-lazy-init="false">
|
|
||||||
|
|
||||||
<context:annotation-config />
|
|
||||||
<context:mbean-server />
|
|
||||||
|
|
||||||
<bean id="myDaoConfig" class="ca.uhn.fhir.jpa.dao.DaoConfig">
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="myTxManager" class="org.springframework.orm.jpa.JpaTransactionManager">
|
|
||||||
<property name="entityManagerFactory" ref="entityManagerFactory" />
|
|
||||||
</bean>
|
|
||||||
<tx:annotation-driven transaction-manager="myTxManager" />
|
|
||||||
|
|
||||||
<util:list id="myServerInterceptors">
|
|
||||||
<ref bean="authorizationInterceptor"/>
|
|
||||||
<ref bean="loggingInterceptor"/>
|
|
||||||
</util:list>
|
|
||||||
|
|
||||||
<bean id="authorizationInterceptor" class="ca.uhn.fhir.jpa.demo.interceptor.RequestAuthorizationInterceptor">
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Do some fancy logging to create a nice access log that has details
|
|
||||||
about each incoming request.
|
|
||||||
-->
|
|
||||||
<bean id="loggingInterceptor" class="ca.uhn.fhir.rest.server.interceptor.LoggingInterceptor">
|
|
||||||
<property name="loggerName" value="fhirtest.access"/>
|
|
||||||
<property name="messageFormat"
|
|
||||||
value="Path[${servletPath}] Source[${requestHeader.x-forwarded-for}] Operation[${operationType} ${idOrResourceName}] UA[${requestHeader.user-agent}] Params[${requestParameters}]"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,57 +0,0 @@
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context" xmlns:security="http://www.springframework.org/schema/security"
|
|
||||||
xmlns:oauth="http://www.springframework.org/schema/security/oauth2"
|
|
||||||
xsi:schemaLocation="http://www.springframework.org/schema/security/oauth2 http://www.springframework.org/schema/security/spring-security-oauth2-2.0.xsd
|
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
|
|
||||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
|
|
||||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This file configures the database connection for the HAPI JPA Server.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The following bean configures the database connection. The 'url' property value
|
|
||||||
of "jdbc:derby:directory:jpaserver_derby_files;create=true" indicates that the
|
|
||||||
server should save resources in a directory called "jpaserver_derby_files".
|
|
||||||
|
|
||||||
A URL to a remote database could also be placed here, along with login credentials
|
|
||||||
and other properties supported by BasicDataSource.
|
|
||||||
-->
|
|
||||||
<bean id="myPersistenceDataSource" class="org.apache.commons.dbcp2.BasicDataSource" destroy-method="close">
|
|
||||||
<property name="url" value="jdbc:derby:directory:jpaserver_derby_files;create=true" />
|
|
||||||
<property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"></property>
|
|
||||||
<property name="username" value=""/>
|
|
||||||
<property name="password" value=""/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Hibernate can be configured with other dialects if you wish to connect to another
|
|
||||||
database (e.g. Postgres). Consult the Hibernate documentation to see a list of
|
|
||||||
available dialects.
|
|
||||||
-->
|
|
||||||
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
|
|
||||||
<property name="dataSource" ref="myPersistenceDataSource" />
|
|
||||||
<!--
|
|
||||||
<property name="persistenceXmlLocation" value="classpath:META-INF/fhirtest_persistence.xml" />
|
|
||||||
<property name="persistenceUnitName" value="FHIR_UT" />
|
|
||||||
-->
|
|
||||||
<property name="packagesToScan">
|
|
||||||
<array>
|
|
||||||
<value type="java.lang.String">ca.uhn.fhir.jpa.entity</value>
|
|
||||||
<value type="java.lang.String">ca.uhn.fhir.jpa.model.entity</value>
|
|
||||||
<value type="java.lang.String">ca.uhn.fhir.jpa.demo.entity</value>
|
|
||||||
</array>
|
|
||||||
</property>
|
|
||||||
<property name="jpaVendorAdapter">
|
|
||||||
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
|
|
||||||
<property name="showSql" value="false" />
|
|
||||||
<property name="generateDdl" value="true" />
|
|
||||||
<property name="databasePlatform" value="org.hibernate.dialect.DerbyTenSevenDialect" />
|
|
||||||
</bean>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,29 +0,0 @@
|
||||||
<?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:context="http://www.springframework.org/schema/context"
|
|
||||||
xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx"
|
|
||||||
xmlns:task="http://www.springframework.org/schema/task" xmlns:util="http://www.springframework.org/schema/util"
|
|
||||||
xmlns:mvc="http://www.springframework.org/schema/mvc"
|
|
||||||
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-3.0.xsd
|
|
||||||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
|
|
||||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
|
|
||||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd
|
|
||||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
|
||||||
"
|
|
||||||
default-autowire="no" default-lazy-init="false">
|
|
||||||
|
|
||||||
<context:annotation-config/>
|
|
||||||
<context:mbean-server/>
|
|
||||||
|
|
||||||
<mvc:annotation-driven>
|
|
||||||
<mvc:message-converters register-defaults="false">
|
|
||||||
<bean id="jacksonMessageConverter"
|
|
||||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>
|
|
||||||
</mvc:message-converters>
|
|
||||||
</mvc:annotation-driven>
|
|
||||||
|
|
||||||
<context:component-scan base-package="ca.uhn.fhir.jpa.demo.svc"></context:component-scan>
|
|
||||||
|
|
||||||
</beans>
|
|
|
@ -1,4 +0,0 @@
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
/target/
|
|
||||||
/bin/
|
|
|
@ -1,121 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
HAPI projects use the Sonatype OSS parent project.
|
|
||||||
You do not need to use this <parent> in your own projects.
|
|
||||||
-->
|
|
||||||
<parent>
|
|
||||||
<groupId>org.sonatype.oss</groupId>
|
|
||||||
<artifactId>oss-parent</artifactId>
|
|
||||||
<version>7</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
|
|
||||||
<groupId>ca.uhn.hapi.example</groupId>
|
|
||||||
<artifactId>hapi-fhir-example-simple-server</artifactId>
|
|
||||||
<version>0.8</version>
|
|
||||||
<packaging>war</packaging>
|
|
||||||
|
|
||||||
<name>HAPI FHIR Example - Simple Server</name>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>oss-snapshots</id>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<!-- This dependency includes the core HAPI-FHIR classes -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-base</artifactId>
|
|
||||||
<version>1.6</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
|
||||||
<version>1.6</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
HAPI-FHIR uses Logback for logging support. The logback library is included
|
|
||||||
automatically by Maven as a part of the hapi-fhir-base dependency, but you
|
|
||||||
also need to include a logging library. Logback is used here, but log4j
|
|
||||||
would also be fine.
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- Needed for JEE/Servlet support -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>javax.servlet</groupId>
|
|
||||||
<artifactId>javax.servlet-api</artifactId>
|
|
||||||
<version>3.0.1</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Tells Maven to name the generated WAR file as
|
|
||||||
restful-server-example.war
|
|
||||||
-->
|
|
||||||
<finalName>restful-server-example</finalName>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The following is not required for the application to build, but
|
|
||||||
allows you to test it by issuing "mvn jetty:run" from the command
|
|
||||||
line.
|
|
||||||
-->
|
|
||||||
<pluginManagement>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.eclipse.jetty</groupId>
|
|
||||||
<artifactId>jetty-maven-plugin</artifactId>
|
|
||||||
<version>9.1.1.v20140108</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</pluginManagement>
|
|
||||||
|
|
||||||
<plugins>
|
|
||||||
<!--
|
|
||||||
Tell Maven which Java source version you want to use
|
|
||||||
-->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.6</source>
|
|
||||||
<target>1.6</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The deploy plugin is configured as a part of the HAPI
|
|
||||||
internal build process, you do not need to include
|
|
||||||
the <plugin> below in your own projects
|
|
||||||
-->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skip>false</skip>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1 +0,0 @@
|
||||||
curl -H "Content-Type: application/xml+fhir" -X POST -d '<Patient xmlns="http://hl7.org/fhir"><name><family value="Fireman"/><given value="John"/></name></Patient>' "http://localhost:8080/example03/Patient"
|
|
|
@ -1,46 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex1;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
|
||||||
import ca.uhn.fhir.rest.annotation.OptionalParam;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Read;
|
|
||||||
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Search;
|
|
||||||
import ca.uhn.fhir.rest.param.StringParam;
|
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Note, this is an incomplete example of a resource provider. It does not
|
|
||||||
* do anything but is used as examples of methods that can be used.
|
|
||||||
*/
|
|
||||||
public class Example01_ResourceProviders implements IResourceProvider {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends IResource> getResourceType() {
|
|
||||||
return Patient.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Read()
|
|
||||||
public Patient read(@IdParam IdDt theId) {
|
|
||||||
return null; // populate this
|
|
||||||
}
|
|
||||||
|
|
||||||
@Create
|
|
||||||
void create(@ResourceParam Patient thePatient) {
|
|
||||||
// save the resource
|
|
||||||
}
|
|
||||||
|
|
||||||
@Search
|
|
||||||
List<Patient> search(
|
|
||||||
@OptionalParam(name="family") StringParam theFamily,
|
|
||||||
@OptionalParam(name="given") StringParam theGiven
|
|
||||||
) {
|
|
||||||
return null; // populate this
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,46 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex2;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Read;
|
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the most basic resource provider, showing only a single
|
|
||||||
* read method on a resource provider
|
|
||||||
*/
|
|
||||||
public class Example02_PatientResourceProvider implements IResourceProvider {
|
|
||||||
|
|
||||||
private Map<Long, Patient> myPatients = new HashMap<Long, Patient>();
|
|
||||||
|
|
||||||
/** Constructor */
|
|
||||||
public Example02_PatientResourceProvider() {
|
|
||||||
Patient pat1 = new Patient();
|
|
||||||
pat1.addIdentifier().setSystem("http://acme.com/MRNs").setValue("7000135");
|
|
||||||
pat1.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
myPatients.put(1L, pat1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** All Resource Providers must implement this method */
|
|
||||||
@Override
|
|
||||||
public Class<? extends IResource> getResourceType() {
|
|
||||||
return Patient.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Simple implementation of the "read" method */
|
|
||||||
@Read()
|
|
||||||
public Patient read(@IdParam IdDt theId) {
|
|
||||||
Patient retVal = myPatients.get(theId.getIdPartAsLong());
|
|
||||||
if (retVal == null) {
|
|
||||||
throw new ResourceNotFoundException(theId);
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex2;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.annotation.WebServlet;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
|
||||||
|
|
||||||
@WebServlet("/example02/*")
|
|
||||||
public class Example02_SimpleRestfulServer extends RestfulServer {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initialize() throws ServletException {
|
|
||||||
|
|
||||||
// Set the resource providers used by this server
|
|
||||||
setResourceProviders(new Example02_PatientResourceProvider());
|
|
||||||
|
|
||||||
/* This just means to use Content-Types which are not technically
|
|
||||||
* FHIR compliant if a browser is detected (so that they display
|
|
||||||
* nicely for testing) */
|
|
||||||
setUseBrowserFriendlyContentTypes(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,98 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex3;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
|
||||||
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.api.MethodOutcome;
|
|
||||||
import ca.uhn.fhir.rest.param.StringParam;
|
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the most basic resource provider, showing only a single
|
|
||||||
* read method on a resource provider
|
|
||||||
*/
|
|
||||||
public class Example03_PatientResourceProvider implements IResourceProvider {
|
|
||||||
|
|
||||||
private Map<Long, Patient> myPatients = new HashMap<Long, Patient>();
|
|
||||||
private Long myNextId = 1L;
|
|
||||||
|
|
||||||
/** Constructor */
|
|
||||||
public Example03_PatientResourceProvider() {
|
|
||||||
Long id = myNextId++;
|
|
||||||
|
|
||||||
Patient pat1 = new Patient();
|
|
||||||
pat1.setId(new IdDt(id));
|
|
||||||
pat1.addIdentifier().setSystem("http://acme.com/MRNs").setValue("7000135");
|
|
||||||
pat1.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
myPatients.put(id, pat1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** All Resource Providers must implement this method */
|
|
||||||
@Override
|
|
||||||
public Class<? extends IResource> getResourceType() {
|
|
||||||
return Patient.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Simple implementation of the "read" method */
|
|
||||||
@Read()
|
|
||||||
public Patient read(@IdParam IdDt theId) {
|
|
||||||
Patient retVal = myPatients.get(theId.getIdPartAsLong());
|
|
||||||
if (retVal == null) {
|
|
||||||
throw new ResourceNotFoundException(theId);
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create/save a new resource */
|
|
||||||
@Create
|
|
||||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
|
||||||
// Give the resource the next sequential ID
|
|
||||||
long id = myNextId++;
|
|
||||||
thePatient.setId(new IdDt(id));
|
|
||||||
|
|
||||||
// Store the resource in memory
|
|
||||||
myPatients.put(id, thePatient);
|
|
||||||
|
|
||||||
// Inform the server of the ID for the newly stored resource
|
|
||||||
return new MethodOutcome(thePatient.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Simple "search" implementation **/
|
|
||||||
@Search
|
|
||||||
public List<Patient> search() {
|
|
||||||
List<Patient> retVal = new ArrayList<Patient>();
|
|
||||||
retVal.addAll(myPatients.values());
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** A search with a parameter */
|
|
||||||
@Search
|
|
||||||
public List<Patient> search(@RequiredParam(name="family") StringParam theParam) {
|
|
||||||
List<Patient> retVal = new ArrayList<Patient>();
|
|
||||||
|
|
||||||
// Loop through the patients looking for matches
|
|
||||||
for (Patient next : myPatients.values()) {
|
|
||||||
String familyName = next.getNameFirstRep().getFamilyAsSingleString().toLowerCase();
|
|
||||||
if (familyName.contains(theParam.getValue().toLowerCase()) == false) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
retVal.add(next);
|
|
||||||
}
|
|
||||||
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex3;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.annotation.WebServlet;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
|
||||||
|
|
||||||
@WebServlet("/example03/*")
|
|
||||||
public class Example03_SimpleRestfulServer extends RestfulServer {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initialize() throws ServletException {
|
|
||||||
|
|
||||||
// Set the resource providers used by this server
|
|
||||||
setResourceProviders(new Example03_PatientResourceProvider());
|
|
||||||
|
|
||||||
/* This just means to use Content-Types which are not technically
|
|
||||||
* FHIR compliant if a browser is detected (so that they display
|
|
||||||
* nicely for testing) */
|
|
||||||
setUseBrowserFriendlyContentTypes(true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex4;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.IResource;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Create;
|
|
||||||
import ca.uhn.fhir.rest.annotation.IdParam;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Read;
|
|
||||||
import ca.uhn.fhir.rest.annotation.ResourceParam;
|
|
||||||
import ca.uhn.fhir.rest.annotation.Search;
|
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
|
||||||
import ca.uhn.fhir.rest.server.IResourceProvider;
|
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This is the most basic resource provider, showing only a single
|
|
||||||
* read method on a resource provider
|
|
||||||
*/
|
|
||||||
public class Example04_PatientResourceProvider implements IResourceProvider {
|
|
||||||
|
|
||||||
private Map<Long, Patient> myPatients = new HashMap<Long, Patient>();
|
|
||||||
private Long myNextId = 1L;
|
|
||||||
|
|
||||||
/** Constructor */
|
|
||||||
public Example04_PatientResourceProvider() {
|
|
||||||
Patient pat1 = new Patient();
|
|
||||||
pat1.addIdentifier().setSystem("http://acme.com/MRNs").setValue("7000135");
|
|
||||||
pat1.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
myPatients.put(myNextId++, pat1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** All Resource Providers must implement this method */
|
|
||||||
@Override
|
|
||||||
public Class<? extends IResource> getResourceType() {
|
|
||||||
return Patient.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Simple implementation of the "read" method */
|
|
||||||
@Read()
|
|
||||||
public Patient read(@IdParam IdDt theId) {
|
|
||||||
Patient retVal = myPatients.get(theId.getIdPartAsLong());
|
|
||||||
if (retVal == null) {
|
|
||||||
throw new ResourceNotFoundException(theId);
|
|
||||||
}
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Create/save a new resource */
|
|
||||||
@Create
|
|
||||||
public MethodOutcome create(@ResourceParam Patient thePatient) {
|
|
||||||
// Give the resource the next sequential ID
|
|
||||||
long id = myNextId++;
|
|
||||||
thePatient.setId(new IdDt(id));
|
|
||||||
|
|
||||||
// Store the resource in memory
|
|
||||||
myPatients.put(id, thePatient);
|
|
||||||
|
|
||||||
// Inform the server of the ID for the newly stored resource
|
|
||||||
return new MethodOutcome(thePatient.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Simple "search" implementation **/
|
|
||||||
@Search
|
|
||||||
public List<Patient> search() {
|
|
||||||
List<Patient> retVal = new ArrayList<Patient>();
|
|
||||||
retVal.addAll(myPatients.values());
|
|
||||||
return retVal;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
package ca.uhn.fhir.example.ex4;
|
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
|
||||||
import javax.servlet.annotation.WebServlet;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
|
||||||
|
|
||||||
@WebServlet("/example04/*")
|
|
||||||
public class Example04_SimpleRestfulServer extends RestfulServer {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initialize() throws ServletException {
|
|
||||||
setResourceProviders(new Example04_PatientResourceProvider());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,6 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<web-app version="3.0">
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</web-app>
|
|
|
@ -1,3 +0,0 @@
|
||||||
.classpath
|
|
||||||
.project
|
|
||||||
/target/
|
|
|
@ -1,126 +0,0 @@
|
||||||
<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>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
HAPI projects use the Sonatype OSS parent project.
|
|
||||||
You do not need to use this in your own projects.
|
|
||||||
-->
|
|
||||||
<parent>
|
|
||||||
<groupId>org.sonatype.oss</groupId>
|
|
||||||
<artifactId>oss-parent</artifactId>
|
|
||||||
<version>7</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<groupId>ca.uhn.hapi.example</groupId>
|
|
||||||
<artifactId>hapi-fhir-example-skeleton-project</artifactId>
|
|
||||||
<version>0.7</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
|
|
||||||
<name>HAPI FHIR Example - Skeleton Project</name>
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>oss-snapshots</id>
|
|
||||||
<snapshots>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</snapshots>
|
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
|
|
||||||
<!-- This dependency includes the core HAPI-FHIR classes -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-base</artifactId>
|
|
||||||
<version>0.7</version>
|
|
||||||
</dependency>
|
|
||||||
<!--
|
|
||||||
Beginning in HAPI 0.8, at least one "structures" JAR must also be included.
|
|
||||||
For now it is commented out.
|
|
||||||
-->
|
|
||||||
<!--
|
|
||||||
<dependency>
|
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
|
||||||
<artifactId>hapi-fhir-structures-dstu</artifactId>
|
|
||||||
<version>0.8-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
HAPI-FHIR uses Logback for logging support. The logback library is included
|
|
||||||
automatically by Maven as a part of the hapi-fhir-base dependency, but you
|
|
||||||
also need to include a logging library. Logback is used here, but log4j
|
|
||||||
would also be fine.
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>ch.qos.logback</groupId>
|
|
||||||
<artifactId>logback-classic</artifactId>
|
|
||||||
<version>1.1.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The following two dependencies are required only if you are using
|
|
||||||
Schematron resource validation. Otherwise, they may be omitted.
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.helger</groupId>
|
|
||||||
<artifactId>ph-schematron</artifactId>
|
|
||||||
<exclusions>
|
|
||||||
<exclusion>
|
|
||||||
<artifactId>Saxon-HE</artifactId>
|
|
||||||
<groupId>net.sf.saxon</groupId>
|
|
||||||
</exclusion>
|
|
||||||
</exclusions>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.helger</groupId>
|
|
||||||
<artifactId>ph-commons</artifactId>
|
|
||||||
<version>4.3.3</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The following dependency is only required for narrative generator
|
|
||||||
support. If you are not using this, it may be removed.
|
|
||||||
-->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.thymeleaf</groupId>
|
|
||||||
<artifactId>thymeleaf</artifactId>
|
|
||||||
<version>2.1.3.RELEASE</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
|
|
||||||
<build>
|
|
||||||
|
|
||||||
<plugins>
|
|
||||||
<!--
|
|
||||||
Tell Maven which Java source version you want to use
|
|
||||||
-->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
<configuration>
|
|
||||||
<source>1.6</source>
|
|
||||||
<target>1.6</target>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This plugin is just a part of the HAPI internal build process, you do not
|
|
||||||
need to incude it in your own projects
|
|
||||||
-->
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<skip>false</skip>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
|
|
@ -1,27 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.dstu.composite.HumanNameDt;
|
|
||||||
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
|
|
||||||
public class Example01_CreateAPatient {
|
|
||||||
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
// Create a resource instance
|
|
||||||
Patient pat = new Patient();
|
|
||||||
|
|
||||||
// Add a "name" element
|
|
||||||
HumanNameDt name = pat.addName();
|
|
||||||
name.addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
|
|
||||||
// Add an "identifier" element
|
|
||||||
IdentifierDt identifier = pat.addIdentifier();
|
|
||||||
identifier.setSystem("http://acme.org/MRNs").setValue("7000135");
|
|
||||||
|
|
||||||
// Model is designed to be chained
|
|
||||||
pat.addIdentifier().setLabel("Library Card 12345").setValue("12345");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.dstu.composite.ContactDt;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.ContactSystemEnum;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.ContactUseEnum;
|
|
||||||
|
|
||||||
public class Example02_CreateAPatient {
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
Patient pat = new Patient();
|
|
||||||
|
|
||||||
pat.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
|
|
||||||
pat.addIdentifier().setLabel("Library Card 12345").setValue("12345");
|
|
||||||
|
|
||||||
// Enumerated types are provided for many coded elements
|
|
||||||
ContactDt contact = pat.addTelecom();
|
|
||||||
contact.setUse(ContactUseEnum.HOME);
|
|
||||||
contact.setSystem(ContactSystemEnum.PHONE);
|
|
||||||
contact.setValue("1 (416) 340-4800");
|
|
||||||
|
|
||||||
pat.setGender(AdministrativeGenderCodesEnum.M);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.ContactSystemEnum;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.ContactUseEnum;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
|
||||||
|
|
||||||
public class Example03_EncodeResource {
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
// Create a Patient
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
|
|
||||||
pat.addIdentifier().setLabel("Library Card 12345").setValue("12345");
|
|
||||||
pat.addTelecom().setUse(ContactUseEnum.HOME).setSystem(ContactSystemEnum.PHONE).setValue("1 (416) 340-4800");
|
|
||||||
pat.setGender(AdministrativeGenderCodesEnum.M);
|
|
||||||
|
|
||||||
// Create a context
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
|
|
||||||
// Create a XML parser
|
|
||||||
IParser parser = ctx.newXmlParser();
|
|
||||||
parser.setPrettyPrint(true);
|
|
||||||
|
|
||||||
String encode = parser.encodeResourceToString(pat);
|
|
||||||
System.out.println(encode);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
|
||||||
|
|
||||||
public class Example04_ParseResource {
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
String resourceBody = "{\"resourceType\":\"Patient\",\"identifier\":[{\"system\":\"http://acme.org/MRNs\",\"value\":\"7000135\"}],\"name\":[{\"family\":[\"Simpson\"],\"given\":[\"Homer\",\"J\"]}]}";
|
|
||||||
|
|
||||||
// Create a context
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
|
|
||||||
// Create a JSON parser
|
|
||||||
IParser parser = ctx.newJsonParser();
|
|
||||||
Patient pat = parser.parseResource(Patient.class, resourceBody);
|
|
||||||
|
|
||||||
List<IdentifierDt> identifiers = pat.getIdentifier();
|
|
||||||
String idSystemString = identifiers.get(0).getSystem().getValueAsString();
|
|
||||||
String idValueString = identifiers.get(0).getValue().getValueAsString();
|
|
||||||
|
|
||||||
System.out.println(idSystemString + " " + idValueString);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,31 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
|
||||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
|
||||||
|
|
||||||
public class Example05_ClientCreate {
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addName().addFamily("Simpson").addGiven("Homer").addGiven("J");
|
|
||||||
pat.addIdentifier().setSystem("http://acme.org/MRNs").setValue("7000135");
|
|
||||||
pat.setGender(AdministrativeGenderCodesEnum.M);
|
|
||||||
|
|
||||||
// Create a context
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
|
|
||||||
// Create a client
|
|
||||||
String serverBaseUrl = "http://fhirtest.uhn.ca/base";
|
|
||||||
IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);
|
|
||||||
|
|
||||||
// Use the client to store a new resource instance
|
|
||||||
MethodOutcome outcome = client.create().resource(pat).execute();
|
|
||||||
|
|
||||||
// Print the ID of the newly created resource
|
|
||||||
System.out.println(outcome.getId());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,39 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.api.Bundle;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.IdDt;
|
|
||||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
|
||||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
|
||||||
|
|
||||||
//@formatter:off
|
|
||||||
public class Example06_ClientReadAndUpdate {
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
// Create a client
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
String serverBaseUrl = "http://fhirtest.uhn.ca/base";
|
|
||||||
IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);
|
|
||||||
|
|
||||||
// Log requests and responses
|
|
||||||
client.registerInterceptor(new LoggingInterceptor(true));
|
|
||||||
|
|
||||||
// Build a search and execute it
|
|
||||||
Bundle response = client.search()
|
|
||||||
.forResource(Patient.class)
|
|
||||||
.where(Patient.NAME.matches().value("Test"))
|
|
||||||
.and(Patient.BIRTHDATE.before().day("2014-01-01"))
|
|
||||||
.limitTo(100)
|
|
||||||
.execute();
|
|
||||||
|
|
||||||
// How many resources did we find?
|
|
||||||
System.out.println("Responses: " + response.size());
|
|
||||||
|
|
||||||
// Print the ID of the first one
|
|
||||||
IdDt firstResponseId = response.getEntries().get(0).getResource().getId();
|
|
||||||
System.out.println(firstResponseId);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//@formatter:on
|
|
|
@ -1,31 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.dstu.valueset.AdministrativeGenderCodesEnum;
|
|
||||||
import ca.uhn.fhir.rest.api.MethodOutcome;
|
|
||||||
import ca.uhn.fhir.rest.client.IGenericClient;
|
|
||||||
|
|
||||||
public class Example07_ClientSearch {
|
|
||||||
public static void main(String[] theArgs) {
|
|
||||||
|
|
||||||
// Create a client
|
|
||||||
String serverBaseUrl = "http://fhirtest.uhn.ca/base";
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
IGenericClient client = ctx.newRestfulGenericClient(serverBaseUrl);
|
|
||||||
|
|
||||||
// Use the client to read back the new instance using the
|
|
||||||
// ID we retrieved from the read
|
|
||||||
Patient patient = client.read(Patient.class, "4529");
|
|
||||||
|
|
||||||
// Print the ID of the newly created resource
|
|
||||||
System.out.println("Found ID: " + patient.getId());
|
|
||||||
|
|
||||||
// Change the gender and send an update to the server
|
|
||||||
patient.setGender(AdministrativeGenderCodesEnum.F);
|
|
||||||
MethodOutcome outcome = client.update().resource(patient).execute();
|
|
||||||
|
|
||||||
System.out.println("Now have ID: " + outcome.getId());
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Encounter;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
|
||||||
import ca.uhn.fhir.validation.FhirValidator;
|
|
||||||
import ca.uhn.fhir.validation.ValidationResult;
|
|
||||||
|
|
||||||
public class Example08_ValidateResource {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
// Create an encounter with an invalid status and no class
|
|
||||||
Encounter enc = new Encounter();
|
|
||||||
enc.getStatus().setValueAsString("invalid_status");
|
|
||||||
|
|
||||||
// Create a new validator
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
FhirValidator validator = ctx.newValidator();
|
|
||||||
|
|
||||||
// Did we succeed?
|
|
||||||
ValidationResult result = validator.validateWithResult(enc);
|
|
||||||
System.out.println("Success: " + result.isSuccessful());
|
|
||||||
|
|
||||||
// What was the result
|
|
||||||
OperationOutcome outcome = result.getOperationOutcome();
|
|
||||||
IParser parser = ctx.newXmlParser().setPrettyPrint(true);
|
|
||||||
System.out.println(parser.encodeResourceToString(outcome));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Encounter;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.OperationOutcome;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
|
||||||
import ca.uhn.fhir.validation.FhirValidator;
|
|
||||||
import ca.uhn.fhir.validation.ValidationResult;
|
|
||||||
|
|
||||||
public class Example09_NarrativeGenerator {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
// Create an encounter with an invalid status and no class
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addName().addFamily("Simpson").addGiven("Homer").addGiven("Jay");
|
|
||||||
pat.addAddress().addLine("342 Evergreen Terrace").addLine("Springfield");
|
|
||||||
pat.addIdentifier().setLabel("MRN: 12345");
|
|
||||||
|
|
||||||
// Create a new context and enable the narrative generator
|
|
||||||
FhirContext ctx = new FhirContext();
|
|
||||||
ctx.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
|
|
||||||
|
|
||||||
String res = ctx.newJsonParser().setPrettyPrint(true).encodeResourceToString(pat);
|
|
||||||
System.out.println(res);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,24 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
|
||||||
|
|
||||||
public class Example10_Extensions {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
Patient pat = new Patient();
|
|
||||||
pat.addName().addFamily("Simpson").addGiven("Homer");
|
|
||||||
|
|
||||||
String url = "http://acme.org#eyeColour";
|
|
||||||
boolean isModifier = false;
|
|
||||||
pat.addUndeclaredExtension(isModifier, url).setValue(new CodeDt("blue"));;
|
|
||||||
|
|
||||||
IParser p = new FhirContext().newXmlParser().setPrettyPrint(true);
|
|
||||||
String encoded = p.encodeResourceToString(pat);
|
|
||||||
|
|
||||||
System.out.println(encoded);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Child;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Extension;
|
|
||||||
import ca.uhn.fhir.model.api.annotation.ResourceDef;
|
|
||||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
|
||||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
|
||||||
|
|
||||||
@ResourceDef(name="Patient")
|
|
||||||
public class Example11_ExtendedPatient extends Patient {
|
|
||||||
|
|
||||||
@Child(name = "eyeColour")
|
|
||||||
@Extension(url="http://acme.org/#extpt", definedLocally = false, isModifier = false)
|
|
||||||
private CodeDt myEyeColour;
|
|
||||||
|
|
||||||
public CodeDt getEyeColour() {
|
|
||||||
if (myEyeColour == null) {
|
|
||||||
myEyeColour = new CodeDt();
|
|
||||||
}
|
|
||||||
return myEyeColour;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEyeColour(CodeDt theEyeColour) {
|
|
||||||
myEyeColour = theEyeColour;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,22 +0,0 @@
|
||||||
package ca.uhn.fhir.example;
|
|
||||||
|
|
||||||
import ca.uhn.fhir.context.FhirContext;
|
|
||||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
|
||||||
import ca.uhn.fhir.parser.IParser;
|
|
||||||
|
|
||||||
public class Example11_UseExtensions {
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
|
||||||
|
|
||||||
Example11_ExtendedPatient pat = new Example11_ExtendedPatient();
|
|
||||||
pat.addName().addFamily("Simpson").addGiven("Homer");
|
|
||||||
pat.setEyeColour(new CodeDt("blue"));
|
|
||||||
|
|
||||||
IParser p = new FhirContext().newXmlParser().setPrettyPrint(true);
|
|
||||||
String encoded = p.encodeResourceToString(pat);
|
|
||||||
|
|
||||||
System.out.println(encoded);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
<configuration scan="true" scanPeriod="30 seconds">
|
|
||||||
|
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
|
||||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
||||||
<level>INFO</level>
|
|
||||||
</filter>
|
|
||||||
<encoder>
|
|
||||||
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{36} %msg%n</pattern>
|
|
||||||
</encoder>
|
|
||||||
</appender>
|
|
||||||
|
|
||||||
<root>
|
|
||||||
<appender-ref ref="STDOUT" />
|
|
||||||
</root>
|
|
||||||
|
|
||||||
</configuration>
|
|
11
pom.xml
11
pom.xml
|
@ -555,9 +555,9 @@
|
||||||
<aries_spifly_version>1.2</aries_spifly_version>
|
<aries_spifly_version>1.2</aries_spifly_version>
|
||||||
<caffeine_version>2.7.0</caffeine_version>
|
<caffeine_version>2.7.0</caffeine_version>
|
||||||
<commons_codec_version>1.12</commons_codec_version>
|
<commons_codec_version>1.12</commons_codec_version>
|
||||||
<commons_text_version>1.6</commons_text_version>
|
<commons_text_version>1.7</commons_text_version>
|
||||||
<commons_io_version>2.6</commons_io_version>
|
<commons_io_version>2.6</commons_io_version>
|
||||||
<commons_lang3_version>3.8.1</commons_lang3_version>
|
<commons_lang3_version>3.9</commons_lang3_version>
|
||||||
<derby_version>10.14.2.0</derby_version>
|
<derby_version>10.14.2.0</derby_version>
|
||||||
<!--<derby_version>10.15.1.3</derby_version>-->
|
<!--<derby_version>10.15.1.3</derby_version>-->
|
||||||
<error_prone_annotations_version>2.3.3</error_prone_annotations_version>
|
<error_prone_annotations_version>2.3.3</error_prone_annotations_version>
|
||||||
|
@ -581,6 +581,7 @@
|
||||||
<httpcore_version>4.4.11</httpcore_version>
|
<httpcore_version>4.4.11</httpcore_version>
|
||||||
<httpclient_version>4.5.8</httpclient_version>
|
<httpclient_version>4.5.8</httpclient_version>
|
||||||
<jackson_version>2.9.9</jackson_version>
|
<jackson_version>2.9.9</jackson_version>
|
||||||
|
<jackson_databind_version>2.9.9.1</jackson_databind_version>
|
||||||
<maven_assembly_plugin_version>3.1.0</maven_assembly_plugin_version>
|
<maven_assembly_plugin_version>3.1.0</maven_assembly_plugin_version>
|
||||||
<maven_license_plugin_version>1.8</maven_license_plugin_version>
|
<maven_license_plugin_version>1.8</maven_license_plugin_version>
|
||||||
<resteasy_version>4.0.0.Beta3</resteasy_version>
|
<resteasy_version>4.0.0.Beta3</resteasy_version>
|
||||||
|
@ -639,7 +640,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>${jackson_version}</version>
|
<version>${jackson_databind_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||||
|
@ -739,7 +740,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-collections4</artifactId>
|
<artifactId>commons-collections4</artifactId>
|
||||||
<version>4.1</version>
|
<version>4.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
@ -908,7 +909,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-dbcp2</artifactId>
|
<artifactId>commons-dbcp2</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.6.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
<!-- <li>Derby (CLI and JPA Examples): 10.14.2.0 -> 10.15.1.3</li>-->
|
<!-- <li>Derby (CLI and JPA Examples): 10.14.2.0 -> 10.15.1.3</li>-->
|
||||||
<li>JANSI (CLI): 1.17.1 -> 1.18</li>
|
<li>JANSI (CLI): 1.17.1 -> 1.18</li>
|
||||||
<li>json-patch (JPA): 1.10 -> 1.15 (see changelog entry about this change)</li>
|
<li>json-patch (JPA): 1.10 -> 1.15 (see changelog entry about this change)</li>
|
||||||
|
<li>Jackson-Databind (JPA): 2.9.9 -> 2.9.9.1 (due to a Jackson vulnerability CVE-2019-12384)</li>
|
||||||
|
<li>commons-collections4 (Server/JPA): 4.1 -> 4.3</li>
|
||||||
|
<li>commons-dbcp2 (JPA): 2.5.0 -> 2.6.0</li>
|
||||||
|
<li>commons-lang3 (Core): 3.8.1 -> 3.9</li>
|
||||||
|
<li>commons-text (Core): 1.6 -> 1.7</li>
|
||||||
</ul>
|
</ul>
|
||||||
]]>
|
]]>
|
||||||
</action>
|
</action>
|
||||||
|
|
Loading…
Reference in New Issue