Commit 9e4998c6 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

user API provides info about available annotators

parent ab1e5191
......@@ -134,8 +134,8 @@ public class ModelAnnotator {
*/
@PostConstruct
public final void init() {
availableAnnotators = new ArrayList<ElementAnnotator>();
defaultAnnotators = new ArrayList<ElementAnnotator>();
availableAnnotators = new ArrayList<>();
defaultAnnotators = new ArrayList<>();
addAnnotator(biocompendiumAnnotator);
addAnnotator(chebiBackend);
......
......@@ -45,6 +45,7 @@ public class ConfigurationController extends BaseController {
result.put("privilegeTypes", configurationController.getPrivilegeTypes(token));
result.put("version", configurationService.getSystemSvnVersion(context.getRealPath("/")));
result.put("buildDate", configurationService.getSystemBuild(context.getRealPath("/")));
result.put("annotators", configurationController.getAnnotators(token));
return result;
}
......
......@@ -15,6 +15,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import javassist.Modifier;
import lcsb.mapviewer.annotation.services.ModelAnnotator;
import lcsb.mapviewer.annotation.services.annotators.ElementAnnotator;
import lcsb.mapviewer.common.Pair;
import lcsb.mapviewer.converter.IConverter;
import lcsb.mapviewer.converter.graphics.AbstractImageGenerator;
......@@ -49,6 +51,9 @@ public class ConfigurationRestImpl {
@Autowired
private IConfigurationService configurationService;
@Autowired
private ModelAnnotator modelAnnotator;
public List<ConfigurationView> getAllValues(String token) throws SecurityException {
userService.getToken(token);
return configurationService.getAllValues();
......@@ -238,4 +243,21 @@ public class ConfigurationRestImpl {
return result;
}
public List<Map<String, Object>> getAnnotators(String token) {
List<Map<String, Object>> result = new ArrayList<>();
for (ElementAnnotator annotator : modelAnnotator.getAvailableAnnotators()) {
result.add(prepareAnnotator(annotator));
}
return result;
}
private Map<String, Object> prepareAnnotator(ElementAnnotator annotator) {
Map<String, Object> result = new HashMap<>();
result.put("className", annotator.getClass().getName());
result.put("name", annotator.getCommonName());
result.put("url", annotator.getUrl());
result.put("elementClassNames", annotator.getValidClasses());
return result;
}
}
Supports Markdown
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