Skip to content
Snippets Groups Projects
Commit df371221 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Merge branch 'master' into '111-full-reaction-with-aliases'

# Conflicts:
#   frontend-js/src/main/js/map/data/Reaction.js
parents c33a50a5 1c795e72
No related branches found
No related tags found
1 merge request!16Resolve "full reaction returned by API should have info about reactants/products/modifiers"
This commit is part of merge request !16. Comments created here will be created in the context of that merge request.
...@@ -108,6 +108,7 @@ Reaction.prototype.update = function(javaObject) { ...@@ -108,6 +108,7 @@ Reaction.prototype.update = function(javaObject) {
this.setDescription(javaObject.notes); this.setDescription(javaObject.notes);
this.setOther(javaObject.other); this.setOther(javaObject.other);
this.setReferences(javaObject.references); this.setReferences(javaObject.references);
this.setType(javaObject.type);
if (javaObject.reactants !== "") { if (javaObject.reactants !== "") {
this.setReactants(javaObject.reactants.split(",")); this.setReactants(javaObject.reactants.split(","));
...@@ -267,6 +268,14 @@ Reaction.prototype.getModifiers = function() { ...@@ -267,6 +268,14 @@ Reaction.prototype.getModifiers = function() {
return this._modifiers; return this._modifiers;
}; };
Reaction.prototype.setType = function(type) {
this._type = type;
};
Reaction.prototype.getType = function() {
return this._type;
};
Reaction.prototype.getOther = function(type) { Reaction.prototype.getOther = function(type) {
if (this._other !== undefined) { if (this._other !== undefined) {
return this._other[type]; return this._other[type];
...@@ -293,4 +302,4 @@ Reaction.prototype.setHierarchyVisibilityLevel = function(hierarchyVisibilityLev ...@@ -293,4 +302,4 @@ Reaction.prototype.setHierarchyVisibilityLevel = function(hierarchyVisibilityLev
this._hierarchyVisibilityLevel = hierarchyVisibilityLevel; this._hierarchyVisibilityLevel = hierarchyVisibilityLevel;
}; };
module.exports = Reaction; module.exports = Reaction;
\ No newline at end of file
...@@ -17,30 +17,13 @@ describe('Reaction', function() { ...@@ -17,30 +17,13 @@ describe('Reaction', function() {
}); });
it("contructor", function() { it("contructor", function() {
var javaObject = { return ServerConnector.readFile("testFiles/reaction.json").then(function(content) {
lines : [ { var javaObject = JSON.parse(content);
start : Object, var reaction = new Reaction(javaObject);
end : Object, assert.ok(reaction);
type : "START" assert.ok(reaction.getId());
}, { assert.ok(reaction.getType());
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());
}); });
it("constructor from invalid", function() { it("constructor from invalid", function() {
var javaObject = { var javaObject = {
......
{
"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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment