Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
ea9430ed
Commit
ea9430ed
authored
Sep 13, 2021
by
Piotr Gawron
Browse files
taxonomy class created
parent
fa541d97
Pipeline
#46978
passed with stage
in 20 minutes and 50 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
rest-api/src/main/java/lcsb/mapviewer/api/mesh/MeshController.java
View file @
ea9430ed
package
lcsb.mapviewer.api.mesh
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
rest-api/src/main/java/lcsb/mapviewer/api/taxonomy/TaxonomyController.java
View file @
ea9430ed
package
lcsb.mapviewer.api.taxonomy
;
import
java.util.HashMap
;
import
java.util.Map
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -35,16 +32,23 @@ public class TaxonomyController extends BaseController {
this
.
taxonomyService
=
taxonomyService
;
}
static
class
Taxonomy
{
public
String
name
;
public
String
id
;
public
Taxonomy
(
String
name
,
String
id
)
{
this
.
name
=
name
;
this
.
id
=
id
;
}
}
@GetMapping
(
value
=
"/{id:.+}"
)
public
Map
<
String
,
Object
>
getTaxonomy
(
@PathVariable
(
value
=
"id"
)
String
id
)
public
Taxonomy
getTaxonomy
(
@PathVariable
(
value
=
"id"
)
String
id
)
throws
TaxonomySearchException
,
ObjectNotFoundException
{
String
name
=
taxonomyService
.
getNameForTaxonomy
(
new
MiriamData
(
MiriamType
.
TAXONOMY
,
id
));
if
(
name
==
null
)
{
throw
new
ObjectNotFoundException
(
"Object not found: "
+
id
);
}
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
result
.
put
(
"name"
,
name
);
result
.
put
(
"id"
,
id
);
return
result
;
return
new
Taxonomy
(
name
,
id
);
}
}
\ No newline at end of file
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment