Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
portal-backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
HBP Medical Informatics Platform
portal-backend
Commits
0eb6d557
Commit
0eb6d557
authored
8 years ago
by
Mirco Nasuti
Browse files
Options
Downloads
Patches
Plain Diff
second datasource has to be fixed but almost done
parent
10138179
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/eu/hbp/mip/configuration/PersistenceConfiguration.java
+1
-1
1 addition, 1 deletion
...va/eu/hbp/mip/configuration/PersistenceConfiguration.java
src/main/java/eu/hbp/mip/controllers/StatsApi.java
+15
-1
15 additions, 1 deletion
src/main/java/eu/hbp/mip/controllers/StatsApi.java
with
16 additions
and
2 deletions
src/main/java/eu/hbp/mip/configuration/PersistenceConfiguration.java
+
1
−
1
View file @
0eb6d557
...
...
@@ -26,7 +26,7 @@ public class PersistenceConfiguration {
DataSource
dataSource
;
@Autowired
DataSource
variablesDatasource
;
DataSource
variablesDatasource
;
// TODO: Fix this problem
@Bean
@DependsOn
(
"flyway"
)
...
...
This diff is collapsed.
Click to expand it.
src/main/java/eu/hbp/mip/controllers/StatsApi.java
+
15
−
1
View file @
0eb6d557
...
...
@@ -14,10 +14,13 @@ import io.swagger.annotations.ApiResponses;
import
org.apache.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.sql.DataSource
;
import
static
org
.
springframework
.
http
.
MediaType
.
APPLICATION_JSON_VALUE
;
@RestController
...
...
@@ -33,6 +36,9 @@ public class StatsApi {
@Autowired
ArticleRepository
articleRepository
;
@Autowired
DataSource
variablesDatasource
;
@ApiOperation
(
value
=
"Get general statistics"
,
response
=
GeneralStats
.
class
)
@ApiResponses
(
value
=
{
@ApiResponse
(
code
=
200
,
message
=
"Found"
),
@ApiResponse
(
code
=
404
,
message
=
"Not found"
)
})
...
...
@@ -44,9 +50,17 @@ public class StatsApi {
stats
.
setUsers
(
userRepository
.
count
());
stats
.
setArticles
(
articleRepository
.
count
());
stats
.
setVariables
(
0L
);
// TODO: compute from adni_merge DB
stats
.
setVariables
(
countVariables
());
return
ResponseEntity
.
ok
(
stats
);
}
private
Long
countVariables
()
{
JdbcTemplate
db
=
new
JdbcTemplate
(
variablesDatasource
);
LOGGER
.
warn
(
"TEST DB : "
+
db
.
queryForObject
(
"select count(*) from information_schema.tables"
,
Long
.
class
));
// This is a test
Long
count
=
db
.
queryForObject
(
"select count(*) from adni_merge"
,
Long
.
class
);
// TODO: compute from adni_merge DB
return
count
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment