From 9ae0c18867428f3fe41efbf1558d299593d323c3 Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Sat, 20 Apr 2019 20:34:14 +0200 Subject: [PATCH 1/6] modified new JPA Starter for MOLIT --- README.md | 73 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 25 deletions(-) diff --git a/README.md b/README.md index 7def907..4383f60 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,29 @@ mvn jetty:run Then, browse to the following link to use the server: -[http://localhost:8080/](http://localhost:8080/) +[http://localhost:8080/hapi-fhir-jpaserver/](http://localhost:8080/hapi-fhir-jpaserver/) + +# Configuration + +Much of this HAPI starter project can be configured using the properties file in *src/main/resources/hapi.properties*. By default, this starter project is configured to use Derby as the database. + +## MySql + +To configure the starter app to use MySQL, instead of the default Derby, update the hapi.properties file to have the following: + +* datasource.driver=com.mysql.jdbc.Driver +* datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3 +* hibernate.dialect=org.hibernate.dialect.MySQL5Dialect + +It is important to use MySQL5Dialect when using MySQL version 5+. + +# Customizing The Web Testpage UI + +The UI that comes with this server is an exact clone of the server available at [http://hapi.fhir.org](http://hapi.fhir.org). You may skin this UI if you'd like. For example, you might change the introductory text or replace the logo with your own. + +The UI is customized using [Thymeleaf](https://www.thymeleaf.org/) template files. You might want to learn more about Thymeleaf, but you don't necessarily need to: they are quite easy to figure out. + +Several template files that can be customized are found in the following directory: [https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates) # Deploying to a Container @@ -40,37 +62,38 @@ This will create a file called `hapi-fhir-jpaserver.war` in your `target` direct Again, browse to the following link to use the server (note that the port 8080 may not be correct depending on how your server is configured). -[http://localhost:8080/](http://localhost:8080/) +[http://localhost:8080/hapi-fhir-jpaserver/](http://localhost:8080/hapi-fhir-jpaserver/) -# Customizing The Web Testpage UI +# Running hapi-fhir-jpaserver-example in Tomcat from IntelliJ -The UI that comes with this server is an exact clone of the server available at [http://hapi.fhir.org](http://hapi.fhir.org). You may skin this UI if you'd like. For example, you might change the introductory text or replace the logo with your own. +Install Tomcat. -The UI is customized using [Thymeleaf](https://www.thymeleaf.org/) template files. You might want to learn more about Thymeleaf, but you don't necessarily need to: they are quite easy to figure out. +Make sure you have Tomcat set up in IntelliJ. -Several template files that can be customized are found in the following directory: [https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates](https://github.com/hapifhir/hapi-fhir-jpaserver-starter/tree/master/src/main/webapp/WEB-INF/templates) +- File->Settings->Build, Execution, Deployment->Application Servers +- Click + +- Select "Tomcat Server" +- Enter the path to your tomcat deployment for both Tomcat Home (IntelliJ will fill in base directory for you) -# Configuration +Add a Run Configuration for running hapi-fhir-jpaserver-example under Tomcat -Much of this HAPI starter project can be configured using the properties file in *src/main/resources/hapi.properties*. By default, this starter project is configured to use Derby as the database. +- Run->Edit Configurations +- Click the green + +- Select Tomcat Server, Local +- Change the name to whatever you wish +- Uncheck the "After launch" checkbox +- On the "Deployment" tab, click the green + +- Select "Artifact" +- Select "hapi-fhir-jpaserver-example:war" +- In "Application context" type /hapi -## MySql +Run the configuration. -To configure the starter app to use MySQL, instead of the default Derby: +- You should now have an "Application Servers" in the list of windows at the bottom. +- Click it. +- Select your server, and click the green triangle (or the bug if you want to debug) +- Wait for the console output to stop -> Add user and database on your mysql server via mysql cli -``` -CREATE USER 'hapiDbUser'@'localhost' IDENTIFIED BY 'hapiDbPass'; -CREATE DATABASE hapi_dstu3; -GRANT ALL PRIVILEGES ON hapi_dstu3.* to 'hapiDbUser'@'localhost'; -FLUSH PRIVILEGES; -``` +Point your browser (or fiddler, or what have you) to `http://localhost:8080/hapi/baseDstu3/Patient` -> Update hapi.properties file to have the following -* datasource.driver=com.mysql.cj.jdbc.Driver -* datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3 -* datasource.username=hapiDbUser -* datasource.password=hapiDbPass -* hibernate.dialect=org.hibernate.dialect.MySQL5Dialect - -It is important to use MySQL5Dialect when using MySQL version 5+. +You should get an empty bundle back. \ No newline at end of file From 09141dd64b8f62b5433dc8d9bf1d5126b7d2d535 Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Sun, 5 May 2019 10:49:24 -0400 Subject: [PATCH 2/6] Adding the "Prefer" header as an allowed header by cors when cors is enabled --- src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java b/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java index c0a3403..a69c546 100644 --- a/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java +++ b/src/main/java/ca/uhn/fhir/jpa/starter/JpaRestfulServer.java @@ -179,6 +179,7 @@ public class JpaRestfulServer extends RestfulServer { config.addAllowedHeader("Accept"); config.addAllowedHeader("X-Requested-With"); config.addAllowedHeader("Content-Type"); + config.addAllowedHeader("Prefer"); config.addAllowedOrigin(HapiProperties.getCorsAllowedOrigin()); From 23ad3ec62cd7e493624bbcabaf04f18b02d87bf1 Mon Sep 17 00:00:00 2001 From: Sean McIlvenna Date: Wed, 22 May 2019 16:01:58 -0700 Subject: [PATCH 3/6] Update README.md Changing recommended MySql dialect to org.hibernate.dialect.MySQL5InnoDBDialect in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6796ca3..11db3ec 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ To configure the starter app to use MySQL, instead of the default Derby, update * datasource.driver=com.mysql.jdbc.Driver * datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3 -* hibernate.dialect=org.hibernate.dialect.MySQL5Dialect +* hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect It is important to use MySQL5Dialect when using MySQL version 5+. From 19cbeba5cf958924a1f79bd4d9ed0959815e3be5 Mon Sep 17 00:00:00 2001 From: Justin Wolgamott Date: Thu, 23 May 2019 10:23:00 -0400 Subject: [PATCH 4/6] Updated MySQL configuration instructions to highlight the dependence between the default Derby datasource configuration and the integration tests --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 11db3ec..0b55070 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,8 @@ To configure the starter app to use MySQL, instead of the default Derby, update * datasource.url=jdbc:mysql://localhost:3306/hapi_dstu3 * hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect +Because the integration tests within the project rely on the default Derby database configuration, it is important to either explicity skip the integration tests during the build process, i.e., `mvn install -DskipTests`, or delete the tests altogether. Failure to skip or delete the tests once you've configured MySQL for the datasource.driver, datasource.url, and hibernate.dialect as outlined above will result in build errors and compilation failure. + It is important to use MySQL5Dialect when using MySQL version 5+. # Customizing The Web Testpage UI From c24474f0c608d8d0ff3fa13e079184600e5ef67c Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Tue, 28 May 2019 18:48:59 +0200 Subject: [PATCH 5/6] changed default to R4 fixes #28 --- pom.xml | 2 +- src/main/resources/hapi.properties | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e411811..c021774 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ ca.uhn.hapi.fhir - hapi-fhir-structures-dstu3 + hapi-fhir-structures-r4 ${project.version} diff --git a/src/main/resources/hapi.properties b/src/main/resources/hapi.properties index e128f2c..99e6a9a 100644 --- a/src/main/resources/hapi.properties +++ b/src/main/resources/hapi.properties @@ -2,7 +2,7 @@ # Adjust this to set the version of FHIR supported by this server. See # FhirVersionEnum for a list of available constants. Example values include # DSTU2, DSTU3, R4. -fhir_version=DSTU3 +fhir_version=R4 # This is the address that the FHIR server will report as its own address. # If this server will be deployed (for example) to an internet accessible From eaa0290636a27e1f8fbd1a560b3a48c4f24517e6 Mon Sep 17 00:00:00 2001 From: patrick-werner Date: Tue, 28 May 2019 22:44:01 +0200 Subject: [PATCH 6/6] removed unnecessary fhir-structure import --- pom.xml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/pom.xml b/pom.xml index c021774..ca21e27 100644 --- a/pom.xml +++ b/pom.xml @@ -50,13 +50,6 @@ ${project.version} - - - ca.uhn.hapi.fhir - hapi-fhir-structures-r4 - ${project.version} - - ca.uhn.hapi.fhir