diff --git a/frontend-js/src/main/js/map/data/Reaction.js b/frontend-js/src/main/js/map/data/Reaction.js index 9393da43eecc4a2c0e1b678ea3f1e50f87429e43..e0ace636e0d9ad37347505230b35420c185c7f1c 100644 --- a/frontend-js/src/main/js/map/data/Reaction.js +++ b/frontend-js/src/main/js/map/data/Reaction.js @@ -106,7 +106,8 @@ Reaction.prototype.update = function(javaObject) { this.setDescription(javaObject.notes); this.setOther(javaObject.other); this.setReferences(javaObject.references); - + this.setType(javaObject.type); + if (javaObject.reactants !== "") { this.setReactants(javaObject.reactants.split(",")); } else { @@ -122,7 +123,7 @@ Reaction.prototype.update = function(javaObject) { } else { this.setModifiers([]); } - + this.setHierarchyVisibilityLevel(javaObject.hierarchyVisibilityLevel); this.setIsComplete(true); }; @@ -151,15 +152,15 @@ Reaction.prototype.setSymbol = function(symbol) { this._symbol = symbol; }; -Reaction.prototype.getAbbreviation= function() { +Reaction.prototype.getAbbreviation = function() { return this._abbreviation; }; -Reaction.prototype.setAbbreviation= function(abbreviation) { +Reaction.prototype.setAbbreviation = function(abbreviation) { this._abbreviation = abbreviation; }; -Reaction.prototype.getFormula= function() { +Reaction.prototype.getFormula = function() { return this._formula; }; @@ -167,7 +168,7 @@ Reaction.prototype.setFormula = function(formula) { this._formula = formula; }; -Reaction.prototype.getMechanicalConfidenceScore= function() { +Reaction.prototype.getMechanicalConfidenceScore = function() { return this._mechanicalConfidenceScore; }; @@ -175,7 +176,7 @@ Reaction.prototype.setMechanicalConfidenceScore = function(mechanicalConfidenceS this._mechanicalConfidenceScore = mechanicalConfidenceScore; }; -Reaction.prototype.getLowerBound= function() { +Reaction.prototype.getLowerBound = function() { return this._lowerBound; }; @@ -183,7 +184,7 @@ Reaction.prototype.setLowerBound = function(lowerBound) { this._lowerBound = lowerBound; }; -Reaction.prototype.getUpperBound= function() { +Reaction.prototype.getUpperBound = function() { return this._upperBound; }; @@ -195,7 +196,7 @@ Reaction.prototype.setGeneProteinReaction = function(geneProteinReaction) { this._geneProteinReaction = geneProteinReaction; }; -Reaction.prototype.getGeneProteinReaction= function() { +Reaction.prototype.getGeneProteinReaction = function() { return this._geneProteinReaction; }; @@ -203,7 +204,7 @@ Reaction.prototype.setSubsystem = function(subsystem) { this._subsystem = subsystem; }; -Reaction.prototype.getSubsystem= function() { +Reaction.prototype.getSubsystem = function() { return this._subsystem; }; @@ -211,7 +212,7 @@ Reaction.prototype.setSynonyms = function(synonyms) { this._synonyms = synonyms; }; -Reaction.prototype.getSynonyms= function() { +Reaction.prototype.getSynonyms = function() { return this._synonyms; }; @@ -219,7 +220,7 @@ Reaction.prototype.setDescription = function(description) { this._description = description; }; -Reaction.prototype.getDescription= function() { +Reaction.prototype.getDescription = function() { return this._description; }; @@ -255,6 +256,14 @@ Reaction.prototype.getModifiers = function() { return this._modifiers; }; +Reaction.prototype.setType = function(type) { + this._type = type; +}; + +Reaction.prototype.getType = function() { + return this._type; +}; + Reaction.prototype.getOther = function(type) { if (this._other !== undefined) { return this._other[type]; diff --git a/frontend-js/src/test/js/map/data/Reaction-test.js b/frontend-js/src/test/js/map/data/Reaction-test.js index 8b3887d1648d09e19f13b178ded5df80e440fc49..dd8a99701eb20a5686acafb956a57e1368a1c4f6 100644 --- a/frontend-js/src/test/js/map/data/Reaction-test.js +++ b/frontend-js/src/test/js/map/data/Reaction-test.js @@ -17,30 +17,13 @@ describe('Reaction', function() { }); it("contructor", function() { - var javaObject = { - lines : [ { - start : Object, - end : Object, - type : "START" - }, { - start : Object, - end : Object, - type : "END" - }, { - start : Object, - end : Object, - type : "MIDDLE" - } ], - modelId : 319, - idObject : "13178", - centerPoint : { - x : 10, - y : 12, - }, - }; - var reaction = new Reaction(javaObject); - assert.ok(reaction); - assert.ok(reaction.getId()); + return ServerConnector.readFile("testFiles/reaction.json").then(function(content) { + var javaObject = JSON.parse(content); + var reaction = new Reaction(javaObject); + assert.ok(reaction); + assert.ok(reaction.getId()); + assert.ok(reaction.getType()); + }); }); it("constructor from invalid", function() { var javaObject = { diff --git a/frontend-js/testFiles/reaction.json b/frontend-js/testFiles/reaction.json new file mode 100644 index 0000000000000000000000000000000000000000..d87ae1c97ee466e0c42ec906a5afbc404b3869a7 --- /dev/null +++ b/frontend-js/testFiles/reaction.json @@ -0,0 +1,44 @@ + { + "modelId" : 15781, + "reactants" : "329166", + "reactionId" : "re21", + "id" : 153508, + "type" : "State transition", + "lines" : [ { + "start" : { + "x" : 129.00000000000003, + "y" : 269.9853478599471 + }, + "end" : { + "x" : 217.3857151822324, + "y" : 271.4614610007049 + }, + "type" : "START" + }, { + "start" : { + "x" : 217.3857151822324, + "y" : 271.4614610007049 + }, + "end" : { + "x" : 217.98919008325365, + "y" : 297.73178548394236 + }, + "type" : "MIDDLE" + }, { + "start" : { + "x" : 218.17291548409574, + "y" : 305.7296755167626 + }, + "end" : { + "x" : 218.77639038511697, + "y" : 332.0 + }, + "type" : "END" + } ], + "modifiers" : "", + "centerPoint" : { + "x" : 218.0810527836747, + "y" : 301.7307305003525 + }, + "products" : "329171" +} \ No newline at end of file