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
2110d24e
Commit
2110d24e
authored
7 years ago
by
Mirco Nasuti
Browse files
Options
Downloads
Patches
Plain Diff
Bugfix: variables/groups API when data cannot be found in DB
parent
91b9a1a3
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/controllers/GroupsApi.java
+6
-5
6 additions, 5 deletions
src/main/java/eu/hbp/mip/controllers/GroupsApi.java
src/main/java/eu/hbp/mip/controllers/VariablesApi.java
+5
-5
5 additions, 5 deletions
src/main/java/eu/hbp/mip/controllers/VariablesApi.java
with
11 additions
and
10 deletions
src/main/java/eu/hbp/mip/controllers/GroupsApi.java
+
6
−
5
View file @
2110d24e
...
...
@@ -56,12 +56,13 @@ public class GroupsApi {
String
sqlQuery
=
String
.
format
(
"SELECT * FROM meta_variables where target_table='%s'"
,
featuresMainTable
.
toUpperCase
());
SqlRowSet
data
=
metaJdbcTemplate
.
queryForRowSet
(
sqlQuery
);
data
.
next
();
String
json
=
((
PGobject
)
data
.
getObject
(
"hierarchy"
)).
getValue
();
JsonObject
root
=
gson
.
fromJson
(
json
,
JsonObject
.
class
);
removeVariablesRecursive
(
root
);
JsonObject
root
=
new
JsonObject
();
if
(
data
.
next
())
{
String
json
=
((
PGobject
)
data
.
getObject
(
"hierarchy"
)).
getValue
();
root
=
gson
.
fromJson
(
json
,
JsonObject
.
class
);
removeVariablesRecursive
(
root
);
}
return
gson
.
toJson
(
root
);
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/eu/hbp/mip/controllers/VariablesApi.java
+
5
−
5
View file @
2110d24e
...
...
@@ -140,13 +140,13 @@ public class VariablesApi {
String
sqlQuery
=
String
.
format
(
"SELECT * FROM meta_variables where upper(target_table)='%s'"
,
featuresMainTable
.
toUpperCase
());
SqlRowSet
data
=
metaJdbcTemplate
.
queryForRowSet
(
sqlQuery
);
data
.
next
();
String
json
=
((
PGobject
)
data
.
getObject
(
"hierarchy"
)).
getValue
();
JsonObject
root
=
gson
.
fromJson
(
json
,
JsonObject
.
class
);
List
<
String
>
variables
=
new
LinkedList
<>();
extractVariablesRecursive
(
root
,
variables
);
if
(
data
.
next
())
{
String
json
=
((
PGobject
)
data
.
getObject
(
"hierarchy"
)).
getValue
();
JsonObject
root
=
gson
.
fromJson
(
json
,
JsonObject
.
class
);
extractVariablesRecursive
(
root
,
variables
);
}
return
variables
;
}
...
...
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