diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java index 5170e23099f3f9f51521dd65225dee123462db69..3318c8b2149af9a7244c030dcaec8d8ad39d1c30 100644 --- a/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java +++ b/rest-api/src/main/java/lcsb/mapviewer/api/projects/overlays/OverlayRestImpl.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.io.InputStream; import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.TreeMap; @@ -141,7 +142,7 @@ public class OverlayRestImpl extends BaseRestImpl { if (columns != null && !columns.trim().isEmpty()) { columnSet = columns.split(","); } else { - columnSet = new String[] { "modelId", "value", "color", "idObject" }; + columnSet = new String[] { "modelId", "idObject", "value", "color", "uniqueId" }; } List<Map<String, Object>> result = new ArrayList<>(); @@ -378,7 +379,8 @@ public class OverlayRestImpl extends BaseRestImpl { if (columns != null && !columns.trim().isEmpty()) { columnSet = columns.split(","); } else { - columnSet = new String[] { "modelId", "value", "color", "idObject", "description", "type", "geneVariations" }; + columnSet = new String[] { "modelId", "idObject", "value", "color", "description", "type", "geneVariations", + "uniqueId" }; } Map<String, Object> result = new TreeMap<>(); if (ElementIdentifierType.ALIAS.getJsName().equals(elementType)) { @@ -400,15 +402,16 @@ public class OverlayRestImpl extends BaseRestImpl { private Map<String, Object> overlayContentToMap(Pair<? extends BioEntity, ColorSchema> bioEntityDataOverlay, String[] columns) { - Map<String, Object> result = new TreeMap<>(); + Map<String, Object> result = new LinkedHashMap<>(); BioEntity bioEntity = bioEntityDataOverlay.getLeft(); ColorSchema colorSchema = bioEntityDataOverlay.getRight(); for (String string : columns) { String column = string.toLowerCase(); Object value = null; - if (column.equals("id") || column.equals("idobject")) { - value = bioEntity.getId(); - } else if (column.equals("modelId")) { + if (column.equals("id") || column.equals("idobject") || column.equals("uniqueid")) { + //casting to string is only to provide the same results as before refactoring + value = bioEntity.getId()+""; + } else if (column.equals("modelid")) { value = bioEntity.getModel().getId(); } else if (column.equals("value")) { value = colorSchema.getValue();