Skip to content

Commit

Permalink
Shiro (#105)
Browse files Browse the repository at this point in the history
* Updated schema migration scripts to specify schema.

Added new application.properties value:
flyway.placeholders.ohdsiSchema=${flyway.placeholders.ohdsiSchema}
spring.jpa.properties.hibernate.default_schema=${datasource.ohdsi.schema}

Manually applying JPA properties in DataAccessConfig.

* sparql

* base8.17

* LAERTES base

* linkoutdata

* added a new test for the linkout data retrieval

* add ? to makefile

* updates to allow for concept set persistence

* OHDSI-49 =>
- move getCohortSummaryData(), getCohortSummaryAnalyses() and
corresponding methods/mapper into CohortResultsService
- remove /sourceKey from path and modify service methods in
CohortAnalysisService
- add getOhdsiSchema() into AbstractDaoService

* adding flyway script

* fix case sensitive issue

* Rename v1.0.1.0__conceptsets.sql to V1.0.1.0__conceptsets.sql

* Support multiple events per person in feasibility Study.

* documentation and job information improvements

* flyway postgresql and oracle migrations for concept sets

* getEvidenceSummaryBySource

* Basic Caching and Record Count Updates

* getsummary

* makefile

* Implement Abnormal filter.

Fixes #46.

* implement getEvidenceDetails

* add id to evidencesummary

* add judgement before get json

* Create getDrugEraTreemap

getDrugEraTreemap returns data for ACHILLES DRUG_ERA summary report, which is currently displayed as treemap and tabular view.  This function has parameter @ConceptIdList, such that the user can restrict to a subset of all records in the table, rather than returning all.

* Rename getDrugEraTreemap to getDrugEraTreemap.sql

* Create getDrugEraPrevalenceByGenderAgeYear.sql

* Create getConditionOccurrenceTreemap.sql

Has parameter @conceptIdList to specify the subset of records you want to come back

* Create getDescendentOfAncestorConcepts.sql

Pararms:    @cdm_schema - set where vocab lives
@id  - the target concept you are starting with
@ancestorVocabularyId - the vocab of the ancestor concepts you are interested in
@ancestorClassId - the concept class of the ancestor concept you are interested in
@siblingVocabularyId - the vocab of the descendant of the ancestor that you want
@siblingClassId - the concept class of the descendant of the ancestor that you want



Example target use case:

if given an RxNorm ingredient concept,  you want to find all other RxNorm ingredient concepts that are descendants of the same ATC3  ancestor(s).

* Adding methods for Penelope functionality

* Fixed cohort cout for the 'nullStudy' case.

Now that we support 'event-level' feasibility studies, the nullStudy case needed to do a simple select count(*) instead of select count(distinct subject_id)

* enabling compression for services

* Person Service Functionality for Profiles / Apollo

* ensure proper table qualifiers are utilized for vocabulary and result tables

* Updates to WebAPI for Penelope

* new export functionality for cohort results

* Fixes for CDMResultsService.java

* no change to V1.0.0.6.2__schema-create_laertes.sql. Created V1.0.0.6.3__schema-create_laertes.sql to drop null constraint

* flyway changes to drop null constraint on ohdsi.drug_hoi_evidence in oracle and sql server (NOT TESTED - Postgres has been tested)

* Descendant concepts for concept list

* export hotfix

removed trailing tab character on cohort result export file

* Additional evidence calls for Penelope

* Penelope WebAPI updates

* Changes for retrieving label evidence

* adding repositories for labels and mappings

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* Update getExposureOutcomePredictors.sql

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* Adding methods for Penelope functionality

* more transparent error handling to help with debugging

* git formatting?

Conflicts:
	src/main/java/org/ohdsi/webapi/cohortresults/ExposureCohortResult.java
	src/main/java/org/ohdsi/webapi/cohortresults/TimeToEventResult.java
	src/main/java/org/ohdsi/webapi/service/CohortResultsService.java

* git formatting?

* add hoiname,drugname
solve duplication

* Adding methods for Penelope functionality

* Update firstConditionRelativeToIndex.sql

bounded the information that comes back to +/- 1000 days

* Update getTimeToEventDrilldown.sql

bounded graphs to -1000 to 1000

* Update getConceptRecordCount.sql

added measurement counts

* OHDSI-58 => fix issue #71

* Merge origin/Penelope into Penelope

Conflicts:
	src/main/java/org/ohdsi/webapi/evidence/ConceptOfInterestMapping.java

* Flyway scripts multihomed tables for Penelope

* Added support for specifying at last/at most in criteria groups.

* Refactoring table names

* Penelope search enablement

* Flyway script fixes

* added ordering to returned domain and vocabulary lists

* OHDSI-60 => fix Oracle errors in penelope scripts.

* Fix for additional criteria not properly restricting primary events.

* Fixed matching cohort definition from calypso feasibility study.

Switched logic from looking for ANY to looking for NOT ALL.  This covers the case when the additional criteria has 'At Least' or 'At Most' specified for the criteria group.

* Changes to support schema awareness:

Added flyway properties to allow injection of ohdsi schema into migration scripts.
Updated MSSQL migration scripts to specify schema to create tables in.
Modified Hiberanate properties to specify default schema of ${ohdsi_schema}
Removed cdm database and cdm schema from maven properties. These are specified in the source and source_daimon tables.
Removed 'if table exists' checks from migration scripts. Flyway will fail now if a table already exists.  This is better behavior due to confusion that arises when an existing out-of-date table exists in the database makes flyway create the correct table.

* Additional updates related to oracle.

Tested with Oracle.
Removed unnecessary sequences:  oracle and postgres only depend on hibernate_sequence for id generation.

* Use different names for temp tables in runHeraclesAnalyses.sql (fixes #62)

* Specify schema when getting cohort analyses.

* Changed end_time column from timestamp to datetime for MsSQL.

* Added fetch join to cohort definition repository to eliminate n+1 query.

* Fixes #80 - Created a schema variable to jobExecutions.sql to load tables for Jobs

* Initialize collections to an empty list (to avoid null checks)

* Format sql literal dates into DATEFROMPARTS() to enable cross dbms compatability.

Fixes OHDSI/Circe#50.

* Added table qualifier for feas_study tables.

* Added cast() calls to POWER function so that result will be casted into 64 bit integer. This allows us to support up to 62 distinct inclusion rules.

* Set visit type filters to use visit_type_concept_id.

* Revert change to visit_type_concept_id.  Visit_concept_id is the IP/OP concepts, visit_type_concept_id indicates how the visit was derived.

* #68

* #70

* remove MSSQL JDBC dependency from webapi-oracle profile.

* Fixed min value for Oracle Sequence.

* Remove invalid concept relationships when looking up mapped concepts.

Fixes #85

* Update README.md

Added links to installation guide.

* ConceptIDs passed into queries should not be surrounded with quotes.

* Fixed #39

Thanks for pointer, @cataphract

* Force correlated criteria to be within the same observation period as index.

* Added calls to splitSql for oracle support.

Fixes 'invalid character' errors in Oracle with trailing ; in commands.

* LAERTES update changes some evidence table schemas and queries

* updating flyway to support the changes to LAERTES made for this update

* updated WebAPI to work with the updated LAERTES evidence data

* modified some testing files

* minor fixes to evidence service after testing in sql server environment

* Released branch update

* Readme whitespace cleanup

* Concept Set Existance; Penelope Tables

* RSB Integration

* RSB Integration

* OHDSI-70 => fix ORA-14155 issues. (#96)

* heracles script fixes

* Concept Set Source Code Evaluation

* Use 'datasource.ohdsi.schema' as default schema.

* fix for cross-database support, improvements to the person api

* Adjust cohort expression query builder to build series of INSERT INTO (changed from CTAS).

Fixes #99

* Add coalesce to death cause_concept_id.

Fixes #101

* adding refresh route to the source service to allow for a reload of sources from the database without a webapi restart

* Add PostgreSQL migration to create shiro tables.

* Concept Set Export

* Add permission checks on API methods call.

* Update migration scripts for Shiro.

* Concept Set Export

* Added Route to export conceptsets for cohort definition.
Refactored writeToCSVandZip into separate utility function.

* Fixes OHDSI/Atlas#104

Restructured codeset query to fetch all included concepts and left join to all excluded concepts looking for exclusion = null.

* added gender to person api

* Fix for issue #106

Add @ohdsi_database_schema to qualify tables properly

fixes #106

* added list of cohorts a person belongs to to the person api

* cohortbreakdown api for navigation to profiles

* CIRCE Inclusion Rule Support

Cohort generation with inclusion rules
Added new flyway migration for cohort_feasibility tables.
Added new route to retrieve cohort inclusion rule impact.
New route: cohortdefinition/{id}/report/{sourcekey}

* getCohortBreakdownPeople working

* bugfixes. using 'set rowcount' instead of row_number(), which is not
translatable, but a lot faster

* went back to row_number for translatability. kludge makes it faster most
of the time

* Add bearer token auth based on JSON Web Token.

* throwing exception when can't find person. not great.

* got rid of String.join(), it was causing problems for pre Java 8

* Closes #113. Fix large concept set export

* fixed errors that popped up after translating to PostgreSQL

* fixed person api to work on postgres. (did this yesterday but it didn't
work. I now have a testing platform for postgres)

* Exclude stats generation SQL when definition SQL is generated via /sql route.
Added @generateStats flag to generateCohort.sql.

* Add method to register windows user.

* Fixes OHDSI/Atlas#173
Drop #cohort_candidate table after cohort generation.

.

* Fix NPE in FeasiblityService.

generate_stats and results_database_schema were not being passed as a job parameter, and causing a NPE.

* Use sequences as generator for ID columns in Shiro tables. Add default role within migration.

* Fixes OHDSI/Atlas#182

Concept needs to include all properties when serializing JSON.

* Inclusion Rule Report must return results in inclusion rule sequence order.

* Add abstraction to be able to turn SHIRO security off.

* Add NTLM Authentication.

* Add logout method to invalidate access token.

* Add authorizing filter.

* Add expiration time for tokens.

* Fix invalidation of empty token.

* Sort source service /sources result by SourceKey.

* Fixes OHDSI/Atlas#198

* Renamed classes involved in visitor pattern to dispatch pattern for getCriteriaSql().

* Implemented cohort definition enhancments:
1: Added new limit filter: "Qualified Events" to limit the events per person after additional criteria are applied to primary evetns.
2: Added 'End Date Strategies':  A strategy is used to determine how an end date of a cohort should be applied.
- 2 implementations of end date strategies implemented: DateOffset and CustomEra.
3: Default event limit type to 'First'

* Comparitive Cohort Analysis Implementation
New webservices to support comparative cohort analysis through psmodel.
- Added models for attrition, balance, and distribution data.

Removed flyway-sources migration folders from branch.

* Fixing thread safety issue in resolveConceptSetExpression.

* Adding device, procedure and specimen domains to the patient profile data returned.  This makes progress on #170.

* Added migrations for CCA for postgresql and oracle.

* Bug fix - cohort person count should read from results schema

* fix result schema issues

* Fixes #121

Do not apply QualifiedLimitFilter when additional criteria is null.

* Add API methods to manage roles and permissions. Add permission checks.

* Distinguish create and update methods in 'ConceptSetService'.

* Remove obsolete permission checks.

* Hide user service when 'DisabledSecurity' is used.

* Fixes #122.

Truncate/drop #cohort_ends temp table.

* Fixes. Simplify 'UserService'.

* Fix IDs generation.

* Initialize security data within flyway migrations.

* Add API methods to manage roles and permissions.

* added missing table qualifier

* Add/remove appropriate permissions on creating/deleting cohort definition.

* Allow vocabulary search.

* Update rollback scripts.

* Sort output of user service.

* CORS support. Fixes.

* Fix filter chain definitions.

* Put user's permissioins into bearer token.

* Discard changes in 'ConceptSetService'.

* Allow read concept sets to all users.

* Change delimiter for permissions in token.

* Demographic Criteria Implementation.

* Removed BETWEEN usage in criteria

A BETWEEN X and Y becomes A >= X and A <= Y.  BETWEEN is not consistent between all db platforms.

* Incidence Rate Analysis Implementation

Implementation of Incidence Rate web services, tasklets and repositories and IR Analysis Report Generation.

Added new dependency: apache commons collections v4.1.

* Remove BETWEEN expression from numeric and date range criteria input types.

* Add null check for correlated criteria end date.

Existing cohorts will have this null, so a null check is required.

* enhancements for person profile service and cohort comparison service

* sql syntax error

* Add permissions into cohort roles.
Put new permissions for cohort created with 'copy' method.

* Fix to allow more than 1 person per cohort.

* Flyway deployment scripts for postgreSQL and Oracle.

* adding outcome model retrieval and updates to comparative cohort analysis

* Negative controls implementation
	modified:   src/test/java/org/ohdsi/webapi/test/feasibility/StudyInfoTest.java

* ConceptSet optimization and comparison utilities

* ConceptSet utilties

* Moving GenerationStatus enum

* Delete concept sets per OHDSI/Atlas#87

* Fixing ir calc flyway script for postgreSql

* sql cleanup

* Flyway fixes for sql server

* Allow everithing what is not forbidden.

* Add/remove appropriate permissions on creating/deleting a concept set.

* Add/remove permissions on creating/deleting a role. Only author of a role can change it.
  • Loading branch information
ganisimov authored and fdefalco committed Sep 26, 2016
1 parent 1327c1f commit 0f3297c
Show file tree
Hide file tree
Showing 375 changed files with 40,823 additions and 3,385 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ sandbox/
/nbactions.xml
/nbactions-webapi-local.xml
/nbactions-webapi-mssql.xml
/nbactions-webapi-postgresql.xml
/nbactions-webapi-oracle.xml
/nbactions-debug*
*~
44 changes: 26 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
compile:
mvn clean
mvn compile -Pwebapi-postgresql
mvn compile -Pwebapi-postgresql-laertes

package: compile
mvn package -Pwebapi-postgresql
mvn package -Pwebapi-postgresql-laertes

deploy: package
sudo service tomcat7 stop
Expand All @@ -18,22 +18,30 @@ git-push:
git push myfork master

test:
wget -O tests/test-general-evidence.json "http://localhost:8080/WebAPI/CS1/evidence/1000640"
wget -O tests/test-drug-hoi.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/1000640-137682"
wget -O tests/test-drug.json "http://localhost:8080/WebAPI/CS1/evidence/drug/1000640"
wget -O tests/test-hoi.json "http://localhost:8080/WebAPI/CS1/evidence/hoi/320073"
wget -O tests/test-info.json "http://localhost:8080/WebAPI/CS1/evidence/info"
wget -O tests/test-drug-hoi-eu-spc.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/40239056-75053"
wget -O tests/test-drug-hoi-splicer.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/19133853-195588"
wget -O tests/test-drug-hoi-faers-counts-and-signals.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/1154343-433031"
wget -O tests/test-drug-hoi-pubmed-mesh-cr.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/1154343-433031"
wget -O tests/test-drug-hoi-pubmed-mesh-clin-trial.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/789578-378144"
wget -O tests/test-drug-hoi-pubmed-mesh-other.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/19010482-316866"
wget -O tests/test-drug-hoi-semmed-cr.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/1112807-441202"
wget -O tests/test-drug-hoi-semmed-clin-trial.json "http://localhost:8080/WebAPI/CS1/evidence/drughoi/19059744-381591"
wget -O tests/test-drug-rollup-ingredient.json "http://localhost:8080/WebAPI/CS1/evidence/drugrollup/ingredient/1000632"
wget -O tests/test-drug-rollup-clin-drug.json "http://localhost:8080/WebAPI/CS1/evidence/drugrollup/clinicaldrug/19074181"
wget -O tests/test-drug-rollup-branded-drug.json "http://localhost:8080/WebAPI/CS1/evidence/drugrollup/brandeddrug/1000640"
wget -O tests/test-general-evidence.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/752061"
wget -O tests/test-drug-hoi.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/752061-374013"
wget -O tests/test-drug.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drug/752061"
wget -O tests/test-hoi.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/hoi/320073"
wget -O tests/test-info.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/info"
wget -O tests/test-drug-hoi-eu-spc.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/904351-4190045"
wget -O tests/test-drug-hoi-splicer.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/19133853-195588"
wget -O tests/test-drug-hoi-faers-counts-and-signals.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/1154343-433031"
wget -O tests/test-drug-hoi-pubmed-mesh-cr.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/1154343-433031"
wget -O tests/test-drug-hoi-pubmed-mesh-clin-trial.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/789578-378144"
wget -O tests/test-drug-hoi-pubmed-mesh-other.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/19010482-316866"
wget -O tests/test-drug-hoi-semmed-cr.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/1112807-441202"
wget -O tests/test-drug-hoi-semmed-clin-trial.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drughoi/19059744-381591"
wget -O tests/test-drug-rollup-ingredient.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drugrollup/ingredient/1000632"
wget -O tests/test-drug-rollup-clin-drug.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drugrollup/clinicaldrug/19074181"
wget -O tests/test-drug-rollup-branded-drug.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/drugrollup/brandeddrug/1000640"
wget -O tests/test-rdf-evidencesummary.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/evidencesummary?conditionID=139900&drugID=1115008&evidenceGroup=Literature"
wget -O tests/test-rdf-evidencedetails.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/evidencedetails?conditionID=24134&drugID=1115008&evidenceType=SPL_SPLICER_ADR"

test-sparql:
wget -O tests/test-rdf-info.json "http://localhost:8080/WebAPI/evidence/rdfinfo"
wget -O tests/test-rdf-commandlist.json "http://localhost:8080/WebAPI/evidence/?"
wget -O tests/test-rdf-linkoutdata.json "http://localhost:8080/WebAPI/LAERTES_CDM/evidence/linkoutdata/http%3A%252F%252Flocalhost%3A8080%252Fl%252Findex.php%3Fid%3Dsplicer-splicer-210"


test-public:
wget -O tests/test-general-evidence.json "http://api.ohdsi.org/WebAPI/CS1/evidence/1000640"
Expand Down
15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ OHDSI WebAPI contains all OHDSI services that can be called from OHDSI applicati
NOTE: Check license information for individual sources on the [Web API documentation page](http://www.ohdsi.org/web/wiki/doku.php?id=documentation:software:webapi)

#### Getting Started

New documentation can be found a tthe [Web API Installation Guide](https://github.com/OHDSI/WebAPI/wiki/WebAPI-Installation-Guide)

##### Compilation
Compiling the WebAPI project will require Maven. Any Maven compliant IDE will be able to resolve all dependencies and compile the project.
Compiling the WebAPI project will require Maven. Maven is a command line tool that will build the WAR for deployment to a servlet container.

##### JDBC Drivers
JDBC Drivers are not included with the source or any release packages. Obtaining JDBC Drivers and making them available on the hosting server via environment classpath or web server configuration are left as an excercise for the developer / system administrator.
Expand Down Expand Up @@ -67,13 +70,3 @@ See org.ohdsi.webapi.exampleapplication.ExampleApplicationConfig & ExampleApplic

See JobServiceIT (integration test) for more detail (java client).











118 changes: 90 additions & 28 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
<datasource.password>password</datasource.password>
<!--<datasource.validationQuery>SELECT 1</datasource.validationQuery>-->
<datasource.dialect>sql server</datasource.dialect>
<!-- specify cdm.database if CDM instance is in a different database name then the one specified in primary jdbc url connection -->
<datasource.cdm.database />
<datasource.cdm.schema>dbo</datasource.cdm.schema>
<datasource.ohdsi.schema>dbo</datasource.ohdsi.schema>
<datasource.dialect.source>sql server</datasource.dialect.source>
<!-- DB Change Management / Migration -->
Expand All @@ -40,15 +37,18 @@
<!-- Note: Schema name is case-sensitive. -->
<flyway.schemas>${datasource.ohdsi.schema}</flyway.schemas>
<flyway.validateOnMigrate>false</flyway.validateOnMigrate>

<flyway.placeholders.ohdsiSchema>${datasource.ohdsi.schema}</flyway.placeholders.ohdsiSchema>
<!-- CDM properties -->
<source.name>CDM_NAME</source.name>
<cdm.version>5</cdm.version>

<spring.batch.repository.tableprefix>BATCH_</spring.batch.repository.tableprefix>
<spring.batch.repository.tableprefix>${datasource.ohdsi.schema}.BATCH_</spring.batch.repository.tableprefix>
<spring.batch.repository.isolationLevelForCreate>ISOLATION_READ_COMMITTED</spring.batch.repository.isolationLevelForCreate>

<spring.profiles.active>default</spring.profiles.active>

<security.token.expiration>43200</security.token.expiration>
<security.allowOrigin>http://localhost:8080</security.allowOrigin>
</properties>
<build>
<finalName>WebAPI</finalName>
Expand Down Expand Up @@ -111,6 +111,14 @@
</executions>
-->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -139,13 +147,15 @@
</includes>
</configuration>
<executions>
<!--
<execution>
<id>failsafe-integration-tests</id>
<phase>integration-test</phase>
<goals>
<goal>integration-test</goal>
</goals>
</execution>
-->
</executions>
</plugin>
<plugin>
Expand Down Expand Up @@ -230,11 +240,6 @@
<dependencies>
<!-- <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId>
<version>${spring.boot.version}</version> </dependency> -->
<dependency>
<groupId>com.github.dblock.waffle</groupId>
<artifactId>waffle-jna</artifactId>
<version>${waffle.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
Expand Down Expand Up @@ -322,6 +327,18 @@
<artifactId>flyway-core</artifactId>
<version>${flyway.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.6</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>


<dependency>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-admin-manager</artifactId>
Expand All @@ -337,12 +354,19 @@
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4-1201-jdbc41</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>3.7</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
Expand All @@ -360,28 +384,45 @@
<artifactId>shiro-spring</artifactId>
<version>1.2.4</version>
</dependency>

<dependency>
<groupId>com.github.dblock.waffle</groupId>
<artifactId>waffle-shiro</artifactId>
<version>1.7.4</version>
</dependency>

<dependency>
<groupId>com.github.dblock.waffle</groupId>
<artifactId>waffle-jna</artifactId>
<version>${waffle.version}</version>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.6.0</version>
</dependency>

<dependency>
<groupId>com.github.dblock.waffle</groupId>
<artifactId>waffle-shiro</artifactId>
<version>1.7.4</version>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
<type>jar</type>
</dependency>
</dependencies>
<profiles>
<profile>
<id>webapi-oracle</id>
<properties>
<datasource.driverClassName>oracle.jdbc.OracleDriver</datasource.driverClassName>
<datasource.url>jdbc:oracle:thin:@127.0.0.1:1521:cdm</datasource.url>
<datasource.url>jdbc:oracle:thin:@127.0.0.1:1521/ohdsi</datasource.url>
<datasource.username>user</datasource.username>
<datasource.password>password</datasource.password>
<datasource.dialect>oracle</datasource.dialect>
<datasource.cdm.schema>omopv5_de</datasource.cdm.schema>
<datasource.ohdsi.schema>OHDSI</datasource.ohdsi.schema>
<!--<datasource.validationQuery>SELECT 1 FROM DUAL</datasource.validationQuery>-->
<flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
<flyway.datasource.url>jdbc:oracle:thin@127.0.0.1:1521:ohdsi</flyway.datasource.url>
<flyway.datasource.url>jdbc:oracle:thin:@127.0.0.1:152/ohdsi</flyway.datasource.url>
<flyway.datasource.username>user</flyway.datasource.username>
<flyway.datasource.password>pass</flyway.datasource.password>
<flyway.locations>classpath:db/migration/oracle</flyway.locations>
Expand All @@ -399,16 +440,15 @@
<id>webapi-postgresql</id>
<properties>
<datasource.driverClassName>org.postgresql.Driver</datasource.driverClassName>
<datasource.url>jdbc:postgresql://54.209.111.128:5432/vocabularyv5</datasource.url>
<datasource.username>USER</datasource.username>
<datasource.password>PASS</datasource.password>
<datasource.url>jdbc:postgresql://localhost:5432/OHDSI</datasource.url>
<datasource.username>ohdsi_app_user</datasource.username>
<datasource.password>app1</datasource.password>
<datasource.dialect>postgresql</datasource.dialect>
<datasource.cdm.schema>unrestricted</datasource.cdm.schema>
<datasource.ohdsi.schema>ohdsi</datasource.ohdsi.schema>
<datasource.ohdsi.schema>webapi</datasource.ohdsi.schema>
<flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
<flyway.datasource.url>${datasource.url}</flyway.datasource.url>
<flyway.datasource.username>userWithWritesToOhdsiSchema</flyway.datasource.username>
<flyway.datasource.password>PASS</flyway.datasource.password>
<flyway.datasource.username>ohdsi_admin_user</flyway.datasource.username>
<flyway.datasource.password>admin1</flyway.datasource.password>
<flyway.locations>classpath:db/migration/postgresql</flyway.locations>
</properties>
</profile>
Expand All @@ -420,7 +460,6 @@
<datasource.username>USER</datasource.username>
<datasource.password>PASS</datasource.password>
<datasource.dialect>sql server</datasource.dialect>
<datasource.cdm.schema>CDM_schema</datasource.cdm.schema>
<datasource.ohdsi.schema>OHDSI_schema</datasource.ohdsi.schema>
<flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
<flyway.datasource.url>${datasource.url}</flyway.datasource.url>
Expand All @@ -445,7 +484,30 @@
<datasource.username>USER</datasource.username>
<datasource.password>PASS</datasource.password>
<datasource.dialect>sql server</datasource.dialect>
<datasource.cdm.schema>CDM_schema</datasource.cdm.schema>
<datasource.ohdsi.schema>OHDSI_schema</datasource.ohdsi.schema>
<flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
<flyway.datasource.url>${datasource.url}</flyway.datasource.url>
<flyway.datasource.username>FLYWAY_USER</flyway.datasource.username>
<flyway.datasource.password>FLYWAY_PASS</flyway.datasource.password>
<flyway.locations>classpath:db/migration/sqlserver</flyway.locations>
</properties>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<type>jar</type>
</dependency>
</dependencies>
</profile>
<profile>
<id>webapi-alpha</id>
<properties>
<datasource.driverClassName>com.microsoft.sqlserver.jdbc.SQLServerDriver</datasource.driverClassName>
<datasource.url>jdbc:sqlserver://server</datasource.url>
<datasource.username>USER</datasource.username>
<datasource.password>PASS</datasource.password>
<datasource.dialect>sql server</datasource.dialect>
<datasource.ohdsi.schema>OHDSI_schema</datasource.ohdsi.schema>
<flyway.datasource.driverClassName>${datasource.driverClassName}</flyway.datasource.driverClassName>
<flyway.datasource.url>${datasource.url}</flyway.datasource.url>
Expand Down
18 changes: 17 additions & 1 deletion src/main/java/org/ohdsi/webapi/DataAccessConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.ohdsi.webapi;

import java.sql.DriverManager;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

Expand Down Expand Up @@ -30,6 +31,13 @@ public class DataAccessConfig {
@Autowired
private Environment env;


private Properties getJPAProperties() {
Properties properties = new Properties();
properties.setProperty("hibernate.default_schema", this.env.getProperty("spring.jpa.properties.hibernate.default_schema"));
return properties;
}

@Bean
@Primary
public DataSource primaryDataSource() {
Expand Down Expand Up @@ -76,9 +84,10 @@ public EntityManagerFactory entityManagerFactory() {
vendorAdapter.setShowSql(Boolean.valueOf(this.env.getRequiredProperty("spring.jpa.show-sql")));
//hibernate.dialect is resolved based on driver
//vendorAdapter.setDatabasePlatform(hibernateDialect);

LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
factory.setJpaProperties(getJPAProperties());
factory.setPackagesToScan("org.ohdsi.webapi");
factory.setDataSource(primaryDataSource());
factory.afterPropertiesSet();
Expand Down Expand Up @@ -110,4 +119,11 @@ public TransactionTemplate transactionTemplateRequiresNew(PlatformTransactionMan
transactionTemplate.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
return transactionTemplate;
}

/*
public String getSparqlEndpoint()
{
String sparqlEndpoint = this.env.getRequiredProperty("sparql.endpoint");
return sparqlEndpoint;
}*/
}
24 changes: 0 additions & 24 deletions src/main/java/org/ohdsi/webapi/Filter.java

This file was deleted.

0 comments on commit 0f3297c

Please sign in to comment.