From ba236a78ff27155954be0c2b022c002438d15d1a Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Mon, 22 May 2017 14:23:21 +0200
Subject: [PATCH] api returns info about hierarchy visibility

---
 .../api/project/ProjectRestImpl.java          |  6 +++++
 .../services/search/data/FullAliasView.java   | 19 ++++++++++++++
 .../search/data/FullReactionView.java         | 26 ++++++++++++++++---
 3 files changed, 48 insertions(+), 3 deletions(-)

diff --git a/rest-api/src/main/java/lcsb/mapviewer/api/project/ProjectRestImpl.java b/rest-api/src/main/java/lcsb/mapviewer/api/project/ProjectRestImpl.java
index d77143640e..6d2eaf0347 100644
--- a/rest-api/src/main/java/lcsb/mapviewer/api/project/ProjectRestImpl.java
+++ b/rest-api/src/main/java/lcsb/mapviewer/api/project/ProjectRestImpl.java
@@ -344,6 +344,8 @@ public class ProjectRestImpl {
 				value = StringUtils.join(ids, ",");
 			} else if (column.equals("type")) {
 				value = reaction.getStringType();
+			} else if (column.equals("hierarchyvisibilitylevel")) {
+				value = reaction.getVisibilityLevel();
 			} else if (column.equals("lines")) {
 				value = new LightReactionView(reaction).getLines();
 			} else {
@@ -383,6 +385,8 @@ public class ProjectRestImpl {
 				value = element.getNotes();
 			} else if (column.equals("formersymbols")) {
 				value = element.getFormerSymbols();
+			} else if (column.equals("hierarchyvisibilitylevel")) {
+				value = element.getVisibilityLevel();
 			} else if (column.equals("bounds")) {
 				value = new Rectangle2D.Double(element.getX(), element.getY(), element.getWidth(), element.getHeight());
 			} else {
@@ -411,6 +415,7 @@ public class ProjectRestImpl {
 			columnsSet.add("formerSymbols");
 			columnsSet.add("references");
 			columnsSet.add("bounds");
+			columnsSet.add("hierarchyVisibilityLevel");
 		} else {
 			for (String str : columns.split(",")) {
 				columnsSet.add(str);
@@ -431,6 +436,7 @@ public class ProjectRestImpl {
 			columnsSet.add("products");
 			columnsSet.add("reactants");
 			columnsSet.add("modifiers");
+			columnsSet.add("hierarchyVisibilityLevel");
 		} else {
 			for (String str : columns.split(",")) {
 				columnsSet.add(str);
diff --git a/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java b/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java
index 05818c2851..10edf3b365 100644
--- a/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java
+++ b/service/src/main/java/lcsb/mapviewer/services/search/data/FullAliasView.java
@@ -147,6 +147,8 @@ public class FullAliasView extends LightAliasView implements IHeavyView {
 	 */
 	private Integer							 initialAmount				= null;
 
+	private Integer							 visibilityLevel			= null;
+
 	/**
 	 * Initial concentration of species.
 	 * 
@@ -231,6 +233,7 @@ public class FullAliasView extends LightAliasView implements IHeavyView {
 			setSymbol(element.getSymbol());
 			addSynonyms(element.getSynonyms());
 			setType(element.getStringType());
+			setVisibilityLevel(element.getVisibilityLevel());
 			if (element instanceof Species) {
 				Species species = (Species) element;
 				setCharge(species.getCharge());
@@ -609,4 +612,20 @@ public class FullAliasView extends LightAliasView implements IHeavyView {
 	public void setSubmodelId(String submodelId) {
 		this.submodelId = submodelId;
 	}
+
+	/**
+	 * @return the visibilityLevel
+	 * @see #visibilityLevel
+	 */
+	public Integer getVisibilityLevel() {
+		return visibilityLevel;
+	}
+
+	/**
+	 * @param visibilityLevel the visibilityLevel to set
+	 * @see #visibilityLevel
+	 */
+	public void setVisibilityLevel(Integer visibilityLevel) {
+		this.visibilityLevel = visibilityLevel;
+	}
 }
diff --git a/service/src/main/java/lcsb/mapviewer/services/search/data/FullReactionView.java b/service/src/main/java/lcsb/mapviewer/services/search/data/FullReactionView.java
index ee024685f1..31dbe84374 100644
--- a/service/src/main/java/lcsb/mapviewer/services/search/data/FullReactionView.java
+++ b/service/src/main/java/lcsb/mapviewer/services/search/data/FullReactionView.java
@@ -33,12 +33,12 @@ public class FullReactionView extends LightReactionView implements IHeavyView {
 	/**
 	 * List of reaction annotations.
 	 */
-	private List<AnnotationView> references								 = new ArrayList<AnnotationView>();
+	private List<AnnotationView> references								 = new ArrayList<>();
 
 	/**
 	 * List of markers to which this reaction refers to.
 	 */
-	private List<FullAliasView>	 elements									 = new ArrayList<FullAliasView>();
+	private List<FullAliasView>	 elements									 = new ArrayList<>();
 
 	/**
 	 * Submodel to which this reaction points.
@@ -118,7 +118,7 @@ public class FullReactionView extends LightReactionView implements IHeavyView {
 	 * 
 	 * @see Reaction#synonyms
 	 */
-	private List<String>				 synonyms									 = new ArrayList<String>();
+	private List<String>				 synonyms									 = new ArrayList<>();
 
 	/**
 	 * List of other unstructurized feuters, specific for some subclases of Alias.
@@ -126,6 +126,8 @@ public class FullReactionView extends LightReactionView implements IHeavyView {
 	 */
 	private Map<String, Object>	 other										 = new HashMap<>();
 
+	private Integer							 visibilityLevel					 = null;
+
 	/**
 	 * Default constructor with localization passed in the argument.
 	 * 
@@ -140,6 +142,8 @@ public class FullReactionView extends LightReactionView implements IHeavyView {
 		if (reaction.getModelData() != null) {
 			setModelId(reaction.getModelData().getId());
 		}
+		setVisibilityLevel(reaction.getVisibilityLevel());
+
 		symbol = reaction.getSymbol();
 		abbreviation = reaction.getAbbreviation();
 		formula = reaction.getFormula();
@@ -418,4 +422,20 @@ public class FullReactionView extends LightReactionView implements IHeavyView {
 		this.other = other;
 	}
 
+	/**
+	 * @return the visibilityLevel
+	 * @see #visibilityLevel
+	 */
+	public Integer getVisibilityLevel() {
+		return visibilityLevel;
+	}
+
+	/**
+	 * @param visibilityLevel the visibilityLevel to set
+	 * @see #visibilityLevel
+	 */
+	public void setVisibilityLevel(Integer visibilityLevel) {
+		this.visibilityLevel = visibilityLevel;
+	}
+
 }
-- 
GitLab