Commit 5c64f656 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch '1596-click-on-reaction-annotations' into 'devel_16.0.x'

Resolve "Make annotations for 'clicked' elements and reactions visible by default"

See merge request !1394
parents d2b358a4 07fb26bc
Pipeline #49967 passed with stage
in 28 minutes and 19 seconds
minerva (16.0.2) stable; urgency=medium
* Bug fix: clicking on reaction stopped working (regression 16.0.1, #1599)
* Bug fix: clicking on map should show expanded results in left panel (#1596)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 22 Nov 2021 12:00:00 +0200
minerva (16.0.1) stable; urgency=medium
* Bug fix: pubmed identifier is visible in link name (#1564)
* Bug fix: auto discovery of genomics file stopped working
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>CellDesigner-plugin</artifactId>
<!-- dependency from the MapViewer model -->
......@@ -50,19 +50,19 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>commons</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>annotation</artifactId>
<name>Annotation module</name>
......@@ -18,7 +18,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- dependency from the MapViewer dao -->
......@@ -26,7 +26,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- dependency from the MapViewer cell designer parser (we need access
......@@ -34,13 +34,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>commons</artifactId>
<name>Mapviewer commons</name>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>converter-CellDesigner</artifactId>
<name>CellDesigner converter</name>
......@@ -17,13 +17,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>converter-SBGNML</artifactId>
......@@ -20,26 +20,26 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>persist</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>converter-graphics</artifactId>
<name>MapViewer graphics converter</name>
......@@ -18,13 +18,13 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Log4J2-->
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>converter-sbml</artifactId>
<name>converter-sbml</name>
......@@ -40,22 +40,22 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model-command</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Log4J2 -->
......@@ -154,7 +154,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
<scope>test</scope>
</dependency>
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>converter</artifactId>
......@@ -15,7 +15,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>frontend-js</artifactId>
<name>frontend-js</name>
......
......@@ -92,9 +92,7 @@ SessionData.prototype.setSearchQuery = function (value) {
*/
SessionData.prototype._setStorageItem = function (key, value) {
try {
logger.debug("X")
window.localStorage.setItem(key, value);
logger.debug("Y")
} catch (e) {
window.localStorage.clear();
logger.warn("Problem with setting value in local storage: " + key);
......
......@@ -19,6 +19,7 @@ var SearchBioEntityGroup = require('../../map/data/SearchBioEntityGroup');
var logger = require('../../logger');
var Functions = require('../../Functions');
var SearchMapBioEntityGroup = require("../../map/data/SearchMapBioEntityGroup");
var QueryType = require("../../map/overlay/AbstractDbOverlay").QueryType;
/**
*
......@@ -71,7 +72,6 @@ function GenericSearchPanel(params) {
}
});
});
}
GenericSearchPanel.prototype = Object.create(AbstractDbPanel.prototype);
......@@ -131,7 +131,7 @@ GenericSearchPanel.prototype.createTableElement = function (element, icon) {
label = "Top map: ";
}
var headerDiv = guiUtils.createSubMapLink({
label: label + "("+element.getBioEntities().length + " hits): ",
label: label + "(" + element.getBioEntities().length + " hits): ",
mapId: element.getModelId()
});
$(headerDiv).css("padding", "5px");
......@@ -172,6 +172,10 @@ GenericSearchPanel.prototype.createTableElement = function (element, icon) {
};
GenericSearchPanel.prototype.addResultTab = function (query, elements) {
var queryObj = JSON.parse(query);
if (queryObj.type === QueryType.SEARCH_BY_COORDINATES) {
return AbstractDbPanel.prototype.addResultTab.call(this, query, elements);
}
var self = this;
var groupsByMap = {};
var groups = [];
......
......@@ -3,7 +3,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>model-command</artifactId>
<name>Model commands</name>
......@@ -16,7 +16,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
......@@ -24,7 +24,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Log4J2-->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>model</artifactId>
<name>model MapViewer</name>
......@@ -15,7 +15,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>commons</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Java xml serialization -->
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>pathvisio</artifactId>
<name>Pathvisio plugin</name>
......@@ -77,20 +77,20 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-CellDesigner</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>converter-graphics</artifactId>
<scope>test</scope>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- Log4J2 -->
......
......@@ -7,7 +7,7 @@
<parent>
<groupId>lcsb.mapviewer</groupId>
<artifactId>parent</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</parent>
<artifactId>persist</artifactId>
......@@ -27,7 +27,7 @@
<dependency>
<groupId>lcsb.mapviewer</groupId>
<artifactId>model</artifactId>
<version>16.0.1</version>
<version>16.0.2</version>
</dependency>
<!-- apache ftp -->
......
......@@ -41,7 +41,7 @@ public class ReactionDao extends BaseDao<Reaction> {
super(Reaction.class);
}
public Reaction getById(int id, ModelData map) {
public Reaction getById(final int id, final ModelData map) {
List<?> list = getSession()
.createQuery(
" from " + this.getClazz().getSimpleName() + " where id=:id and model = :map" + removableAndStatemant())
......@@ -56,14 +56,16 @@ public class ReactionDao extends BaseDao<Reaction> {
}
/**
* Fetch proxy of reaction objects together with distance from point
* Fetch proxy of reaction objects together with distance from point
*
* @param map
* @param point
* @param numberOfElements
* @param classes
* @return
*/
public List<Pair<Reaction,Double>> getByCoordinatesWithDistance(ModelData map, Point2D point, int numberOfElements, List<Class<? extends BioEntity>> classes) {
public List<Pair<Reaction, Double>> getByCoordinatesWithDistance(final ModelData map, final Point2D point, final int numberOfElements,
final List<Class<? extends BioEntity>> classes) {
String typeClause = getTypeClause(classes);
org.hibernate.query.Query<?> query = getSession()
......@@ -92,18 +94,19 @@ public class ReactionDao extends BaseDao<Reaction> {
@SuppressWarnings("unchecked")
List<Object[]> orderedList = (List<Object[]>) query.list();
List<Pair<Reaction,Double>> result = new ArrayList<>();
for (Object[] row: orderedList) {
Reaction reaction = getSession().load(Reaction.class, (Integer)row[0]);
Double dist = Math.max((Double)row[1], (Double)row[2]);
List<Pair<Reaction, Double>> result = new ArrayList<>();
for (Object[] row : orderedList) {
Reaction reaction = getSession().load(Reaction.class, (Integer) row[0]);
Double dist = Math.min((Double) row[1], (Double) row[2]);
result.add(new Pair<>(reaction, dist));
}
return result;
}
public List<Reaction> getByCoordinates(ModelData map, Point2D point, int numberOfElements, List<Class<? extends BioEntity>> classes) {
List<Pair<Reaction,Double>> data = getByCoordinatesWithDistance(map, point, numberOfElements, classes);
public List<Reaction> getByCoordinates(final ModelData map, final Point2D point, final int numberOfElements,
final List<Class<? extends BioEntity>> classes) {
List<Pair<Reaction, Double>> data = getByCoordinatesWithDistance(map, point, numberOfElements, classes);
List<Reaction> result = new ArrayList<>();
for (Pair<Reaction, Double> pair : data) {
result.add(pair.getLeft());
......@@ -111,7 +114,7 @@ public class ReactionDao extends BaseDao<Reaction> {
return result;
}
private String getTypeClause(List<Class<? extends BioEntity>> classes) {
private String getTypeClause(final List<Class<? extends BioEntity>> classes) {
String typeClause = "";
if (classes.size() > 0) {
typeClause = " and type(reaction) in :classes ";
......@@ -119,7 +122,7 @@ public class ReactionDao extends BaseDao<Reaction> {
return typeClause;
}
private List<Reaction> genericListToReactionList(List<?> list) {
private List<Reaction> genericListToReactionList(final List<?> list) {
List<Reaction> result = new ArrayList<>();
for (Object object : list) {
......@@ -128,7 +131,7 @@ public class ReactionDao extends BaseDao<Reaction> {
return result;
}
public List<Reaction> getByIds(Collection<Integer> ids, Collection<Integer> participantIds, List<ModelData> maps) {
public List<Reaction> getByIds(final Collection<Integer> ids, final Collection<Integer> participantIds, final List<ModelData> maps) {
String idClause = "";
if (ids.size() > 0) {
idClause = " and reaction.id in :ids ";
......@@ -158,7 +161,7 @@ public class ReactionDao extends BaseDao<Reaction> {
}
@SuppressWarnings("unchecked")
public List<SbmlParameter> getParametersByMaps(List<ModelData> maps) {
public List<SbmlParameter> getParametersByMaps(final List<ModelData> maps) {
List<?> list = getSession()
.createQuery("select parameter_t from " + this.getClazz().getSimpleName()
+ " reaction inner join reaction.kinetics.parameters parameter_t where "
......@@ -170,7 +173,7 @@ public class ReactionDao extends BaseDao<Reaction> {
return (List<SbmlParameter>) list;
}
public Map<MiriamType, Integer> getAnnotationStatistics(List<ModelData> maps) {
public Map<MiriamType, Integer> getAnnotationStatistics(final List<ModelData> maps) {
Map<MiriamType, Integer> result = new HashMap<>();
List<?> list = getSession()
.createQuery(
......@@ -186,7 +189,7 @@ public class ReactionDao extends BaseDao<Reaction> {
return result;
}
public Page<Reaction> getByFilter(Pageable pageable, Map<ReactionProperty, List<? extends Object>> filter) {
public Page<Reaction> getByFilter(final Pageable pageable, final Map<ReactionProperty, List<? extends Object>> filter) {
String queryString = "select distinct(reaction) from " + this.getClazz().getSimpleName() + " reaction "
+ getJoinsForFilter(filter)
+ getWhereByFilter(filter);
......@@ -206,7 +209,7 @@ public class ReactionDao extends BaseDao<Reaction> {
return new PageImpl<Reaction>(genericListToReactionList(query.list()), pageable, getCountByFilter(filter));
}
public long getCountByFilter(Map<ReactionProperty, List<? extends Object>> filter) {
public long getCountByFilter(final Map<ReactionProperty, List<? extends Object>> filter) {
String countQueryString = "select count(distinct reaction) from " + this.getClazz().getSimpleName() + " reaction "
+ getJoinsForFilter(filter)
+ getWhereByFilter(filter);
......@@ -215,86 +218,86 @@ public class ReactionDao extends BaseDao<Reaction> {
return (Long) countQuery.list().get(0);
}
private void assignFilterOptions(Query<?> query, Map<ReactionProperty, List<? extends Object>> filter) {
private void assignFilterOptions(final Query<?> query, final Map<ReactionProperty, List<? extends Object>> filter) {
for (ReactionProperty property : filter.keySet()) {
List<? extends Object> list = filter.get(property);
if (list != null && list.size() > 0) {
switch (property) {
case ANNOTATION:
for (int i = 0; i < list.size(); i++) {
MiriamData annotation = (MiriamData) list.get(i);
query.setParameter("type" + i, annotation.getDataType());
query.setParameter("resource" + i, annotation.getResource().toLowerCase());
case ANNOTATION:
for (int i = 0; i < list.size(); i++) {
MiriamData annotation = (MiriamData) list.get(i);
query.setParameter("type" + i, annotation.getDataType());
query.setParameter("resource" + i, annotation.getResource().toLowerCase());
}
break;
case CLASS:
query.setParameter("classes", list);
break;
case MAP:
query.setParameter("maps", list);
break;
case PERFECT_TEXT: {
String text = (String) list.get(0);
text = text.toLowerCase().trim();
query.setParameter("query", text);
if (StringUtils.isNumeric(text)) {
query.setParameter("query_integer", Integer.valueOf(text));
}
break;
}
break;
case CLASS:
query.setParameter("classes", list);
break;
case MAP:
query.setParameter("maps", list);
break;
case PERFECT_TEXT: {
String text = (String) list.get(0);
text = text.toLowerCase().trim();
query.setParameter("query", text);
if (StringUtils.isNumeric(text)) {
query.setParameter("query_integer", Integer.valueOf(text));
case TEXT: {
String text = (String) list.get(0);
text = text.toLowerCase().trim();
query.setParameter("query", text);
break;
}
break;
}
case TEXT: {
String text = (String) list.get(0);
text = text.toLowerCase().trim();
query.setParameter("query", text);
break;
}
default:
throw new NotImplementedException("Search by " + property + " not implemented");
default:
throw new NotImplementedException("Search by " + property + " not implemented");
}
}
}
}
private String getWhereByFilter(Map<ReactionProperty, List<? extends Object>> filter) {
private String getWhereByFilter(final Map<ReactionProperty, List<? extends Object>> filter) {
List<String> statements = new ArrayList<>();
for (ReactionProperty property : filter.keySet()) {
List<? extends Object> list = filter.get(property);
if (list != null && list.size() > 0) {
switch (property) {
case ANNOTATION: {
StringBuilder statement = new StringBuilder("(");
for (int i = 0; i < list.size(); i++) {
if (i > 0) {
statement.append(" or ");
case ANNOTATION: {
StringBuilder statement = new StringBuilder("(");
for (int i = 0; i < list.size(); i++) {
if (i > 0) {
statement.append(" or ");
}
statement.append("md.dataType = :type" + i + " and lower(md.resource) = :resource" + i + " ");