From 1a11a841ce7bcb5952b27da8ce495b7831cd70ac Mon Sep 17 00:00:00 2001
From: Piotr Gawron <piotr.gawron@uni.lu>
Date: Wed, 7 Feb 2018 13:36:17 +0100
Subject: [PATCH] new constructors added (with reaction id arg)

---
 .../model/map/reaction/Reaction.java          |  4 +
 .../map/reaction/type/TransportReaction.java  | 88 ++++++++++---------
 2 files changed, 51 insertions(+), 41 deletions(-)

diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java
index 567e40b0cf..36c3ad235c 100644
--- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java
+++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/Reaction.java
@@ -261,6 +261,10 @@ public class Reaction implements BioEntity {
 
   }
 
+  public Reaction(String reactionId) {
+    setIdReaction(reactionId);
+  }
+
   /**
    * Adds node to the reaction.
    * 
diff --git a/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TransportReaction.java b/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TransportReaction.java
index b55aaa188a..4d107c09f9 100644
--- a/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TransportReaction.java
+++ b/model/src/main/java/lcsb/mapviewer/model/map/reaction/type/TransportReaction.java
@@ -18,51 +18,57 @@ import lcsb.mapviewer.model.map.reaction.Reaction;
 @DiscriminatorValue("TRANSPORT_REACTION")
 public class TransportReaction extends Reaction implements SimpleReactionInterface {
 
-	/**
-	 * 
-	 */
-	private static final long serialVersionUID = 1L;
+  /**
+   * 
+   */
+  private static final long serialVersionUID = 1L;
 
-	/**
-	 * Default constructor.
-	 */
-	public TransportReaction() {
-		super();
-	}
+  /**
+   * Default constructor.
+   */
+  public TransportReaction() {
+    super();
+  }
 
-	/**
-	 * Constructor that copies data from the parameter given in the argument.
-	 * 
-	 * @param result
-	 *          parent reaction from which we copy data
-	 */
-	public TransportReaction(Reaction result) {
-		super(result);
-		if (result.getProducts().size() < 1) {
-			throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of products must be greater than 0");
-		}
-		if (result.getReactants().size() < 1) {
-			throw new InvalidArgumentException("Reaction cannot be transformed to " + getStringType() + ": number of reactants must be greater than 0");
-		}
-	}
+  /**
+   * Constructor that copies data from the parameter given in the argument.
+   * 
+   * @param result
+   *          parent reaction from which we copy data
+   */
+  public TransportReaction(Reaction result) {
+    super(result);
+    if (result.getProducts().size() < 1) {
+      throw new InvalidArgumentException(
+          "Reaction cannot be transformed to " + getStringType() + ": number of products must be greater than 0");
+    }
+    if (result.getReactants().size() < 1) {
+      throw new InvalidArgumentException(
+          "Reaction cannot be transformed to " + getStringType() + ": number of reactants must be greater than 0");
+    }
+  }
 
-	@Override
-	public String getStringType() {
-		return "Transport";
-	}
+  public TransportReaction(String reactionId) {
+    super(reactionId);
+  }
 
-	@Override
-	public ReactionRect getReactionRect() {
-		return ReactionRect.RECT_EMPTY;
-	}
+  @Override
+  public String getStringType() {
+    return "Transport";
+  }
 
-	@Override
-	public TransportReaction copy() {
-		if (this.getClass() == TransportReaction.class) {
-			return new TransportReaction(this);
-		} else {
-			throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
-		}
-	}
+  @Override
+  public ReactionRect getReactionRect() {
+    return ReactionRect.RECT_EMPTY;
+  }
+
+  @Override
+  public TransportReaction copy() {
+    if (this.getClass() == TransportReaction.class) {
+      return new TransportReaction(this);
+    } else {
+      throw new NotImplementedException("Method copy() should be overriden in class " + this.getClass());
+    }
+  }
 
 }
-- 
GitLab