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
8a65e518
Commit
8a65e518
authored
4 years ago
by
kfilippopolitis
Browse files
Options
Downloads
Patches
Plain Diff
Fixed dependencies that blocked the GET /algorithms.
parent
94dffcf0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!19
Feat/186 experiment refactor
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pom.xml
+0
-1
0 additions, 1 deletion
pom.xml
src/main/java/eu/hbp/mip/controllers/AlgorithmsApi.java
+22
-17
22 additions, 17 deletions
src/main/java/eu/hbp/mip/controllers/AlgorithmsApi.java
src/main/resources/application.yml
+2
-2
2 additions, 2 deletions
src/main/resources/application.yml
with
24 additions
and
20 deletions
pom.xml
+
0
−
1
View file @
8a65e518
...
...
@@ -244,7 +244,6 @@
<dependency>
<groupId>
com.squareup.okhttp3
</groupId>
<artifactId>
logging-interceptor
</artifactId>
<version>
4.10.0-RC1
</version>
</dependency>
<dependency>
...
...
This diff is collapsed.
Click to expand it.
src/main/java/eu/hbp/mip/controllers/AlgorithmsApi.java
+
22
−
17
View file @
8a65e518
...
...
@@ -61,24 +61,26 @@ public class AlgorithmsApi {
@ApiOperation
(
value
=
"List all algorithms"
,
response
=
String
.
class
)
@RequestMapping
(
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
List
<
AlgorithmDTO
>>
getAlgorithms
()
{
Logging
.
LogUserAction
(
userInfo
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Executing..."
);
String
username
=
userInfo
.
getUser
().
getUsername
();
String
endpoint
=
"(GET) /algorithms"
;
Logging
.
LogUserAction
(
username
,
endpoint
,
"Executing..."
);
LinkedList
<
AlgorithmDTO
>
exaremeAlgorithms
=
getExaremeAlgorithms
();
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Loaded "
+
exaremeAlgorithms
.
size
()
+
" exareme algorithms"
);
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Loaded "
+
exaremeAlgorithms
.
size
()
+
" exareme algorithms"
);
LinkedList
<
AlgorithmDTO
>
galaxyAlgorithms
=
getGalaxyWorkflows
();
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Loaded "
+
galaxyAlgorithms
.
size
()
+
" galaxy algorithms"
);
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Loaded "
+
galaxyAlgorithms
.
size
()
+
" galaxy algorithms"
);
LinkedList
<
AlgorithmDTO
>
algorithms
=
new
LinkedList
<>();
if
(
exaremeAlgorithms
!=
null
)
{
algorithms
.
addAll
(
exaremeAlgorithms
);
}
else
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Getting exareme algorithms failed and returned null"
);
}
if
(
galaxyAlgorithms
!=
null
)
{
algorithms
.
addAll
(
galaxyAlgorithms
);
}
else
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Getting galaxy workflows failed and returned null"
);
}
...
...
@@ -86,7 +88,7 @@ public class AlgorithmsApi {
try
{
disabledAlgorithms
=
getDisabledAlgorithms
();
}
catch
(
IOException
e
)
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"The disabled algorithms could not be loaded."
);
}
...
...
@@ -97,7 +99,7 @@ public class AlgorithmsApi {
allowedAlgorithms
.
add
(
algorithm
);
}
}
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Successfully listed "
+
allowedAlgorithms
.
size
()
+
" algorithms"
);
return
ResponseEntity
.
ok
(
allowedAlgorithms
);
}
...
...
@@ -108,6 +110,8 @@ public class AlgorithmsApi {
* @return a list of AlgorithmDTOs or null if something fails
*/
public
LinkedList
<
AlgorithmDTO
>
getExaremeAlgorithms
()
{
String
username
=
userInfo
.
getUser
().
getUsername
();
String
endpoint
=
"(GET) /algorithms"
;
LinkedList
<
AlgorithmDTO
>
algorithms
=
new
LinkedList
<>();
// Get exareme algorithms
try
{
...
...
@@ -120,11 +124,11 @@ public class AlgorithmsApi {
}.
getType
()
);
}
catch
(
IOException
e
)
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"An exception occurred: "
+
e
.
getMessage
());
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"An exception occurred: "
+
e
.
getMessage
());
return
null
;
}
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Completed, returned "
+
algorithms
.
size
()
+
" algorithms."
);
return
algorithms
;
}
...
...
@@ -135,7 +139,8 @@ public class AlgorithmsApi {
* @return a list of AlgorithmDTOs or null if something fails
*/
public
LinkedList
<
AlgorithmDTO
>
getGalaxyWorkflows
()
{
String
username
=
userInfo
.
getUser
().
getUsername
();
String
endpoint
=
"(GET) /algorithms"
;
List
<
Workflow
>
workflowList
;
try
{
// Get all the workflows with the galaxy client
...
...
@@ -144,7 +149,7 @@ public class AlgorithmsApi {
workflowList
=
new
ArrayList
<>(
workflowsClient
.
getWorkflows
());
}
catch
(
Exception
e
)
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Error when calling list galaxy workflows: "
+
e
.
getMessage
());
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Error when calling list galaxy workflows: "
+
e
.
getMessage
());
return
null
;
}
...
...
@@ -164,28 +169,28 @@ public class AlgorithmsApi {
}
else
{
// Something unexpected happened
String
msgErr
=
gson
.
toJson
(
response
.
errorBody
());
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Error Response: "
+
msgErr
);
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Error Response: "
+
msgErr
);
return
null
;
}
}
catch
(
Exception
e
)
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"An exception occurred: "
+
e
.
getMessage
());
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"An exception occurred: "
+
e
.
getMessage
());
return
null
;
}
}
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Workflows fetched: "
+
workflows
.
size
());
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Workflows fetched: "
+
workflows
.
size
());
// Convert the workflows to algorithms
LinkedList
<
AlgorithmDTO
>
algorithms
=
new
LinkedList
<>();
for
(
WorkflowDTO
workflow
:
workflows
)
{
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Converting workflow: "
+
workflow
);
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Converting workflow: "
+
workflow
);
algorithms
.
add
(
workflow
.
convertToAlgorithmDTO
());
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Converted algorithm: "
+
algorithms
.
get
(
algorithms
.
size
()
-
1
));
}
Logging
.
LogUserAction
(
user
Info
.
getUser
().
getUsername
(),
"(GET) /algorithms"
,
"Completed!"
);
Logging
.
LogUserAction
(
user
name
,
endpoint
,
"Completed!"
);
return
algorithms
;
}
...
...
This diff is collapsed.
Click to expand it.
src/main/resources/application.yml
+
2
−
2
View file @
8a65e518
...
...
@@ -36,8 +36,8 @@ frontend:
logging
:
level
:
root
:
"
DEBUG
"
org
:
"
DEBUG
"
root
:
"
ERROR
"
org
:
"
ERROR
"
eu
:
hbp
:
"
DEBUG"
...
...
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