Commit 7874d5c0 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

rest api provides info about glyphs

parent 6d11244e
......@@ -21,6 +21,7 @@ minerva (15.1.0) unstable; urgency=medium
raised if images are not referenced in coords.txt file (#1308)
* Small improvement: hitting enter after filling credentials automatically
tries to log in (#1312)
* Small improvement: rest API provides information about element glyph
* Bug fix: export to image from selected polygon contained all elements
inside rectangle bounded by the polygon coordinates (#1096)
* Bug fix: continuous refreshing list of project when uploading/removing
......
......@@ -13,6 +13,7 @@ import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.converter.model.celldesigner.structure.fields.ModificationType;
import lcsb.mapviewer.model.map.BioEntity;
import lcsb.mapviewer.model.map.compartment.Compartment;
import lcsb.mapviewer.model.map.layout.graphics.Glyph;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.species.*;
import lcsb.mapviewer.model.map.species.field.*;
......@@ -213,6 +214,9 @@ public class ElementsRestImpl extends BaseRestImpl {
case "bounds":
value = createBounds(element.getX(), element.getY(), element.getWidth(), element.getHeight());
break;
case "glyph":
value = createGlyph(element.getGlyph());
break;
default:
value = "Unknown column";
break;
......@@ -222,6 +226,16 @@ public class ElementsRestImpl extends BaseRestImpl {
return result;
}
private Map<String, Object> createGlyph(Glyph glyph) {
if (glyph == null) {
return null;
} else {
Map<String, Object> result = new HashMap<>();
result.put("fileId", glyph.getFile().getId());
return result;
}
}
protected Map<String, Object> getOthersForElement(Element element) {
Map<String, Object> result = new TreeMap<>();
List<Map<String, Object>> modifications = new ArrayList<>();
......@@ -343,6 +357,7 @@ public class ElementsRestImpl extends BaseRestImpl {
columnsSet.add("boundaryCondition");
columnsSet.add("constant");
columnsSet.add("initialAmount");
columnsSet.add("glyph");
} else {
columnsSet.addAll(Arrays.asList(columns.split(",")));
}
......
package lcsb.mapviewer.web;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.*;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
......@@ -81,6 +80,7 @@ public class MapControllerIntegrationTest extends ControllerIntegrationTest {
.getAsJsonArray().size();
assertTrue("user should be able to access elements", elements > 0);
assertFalse(response.contains("Unknown column"));
}
@Test
......
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