Commit ea9430ed authored by Piotr Gawron's avatar Piotr Gawron
Browse files

taxonomy class created

parent fa541d97
Pipeline #46978 passed with stage
in 20 minutes and 50 seconds
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;
......
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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment