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

common column definition extracted to super class

parent cc320207
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!490Resolve "common functionality of NetworkExportPanel and GraphicsExportPanel should be extracted to abstract class"
......@@ -589,4 +589,59 @@ AbstractExportPanel.prototype.createResponseHeader = function (columns, miriamTy
};
/**
*
* @returns {ExportColumn[]}
*/
AbstractExportPanel.prototype.getBioEntityAllColumns = function () {
return [{
"columnName": "id",
"method": "getId",
"name": "Id"
}, {
"columnName": "description",
"method": "getDescription",
"name": "Description"
}, {
"columnName": "modelId",
"method": "getModelId",
"name": "Map id"
}, {
/**
*
* @param {BioEntity} bioEntity
* @param {Project} project
* @returns {string}
*/
"method": function (bioEntity, project) {
return project.getModelById(bioEntity.getModelId()).getName();
},
"name": "Map name"
}, {
"columnName": "symbol",
"method": "getSymbol",
"name": "Symbol"
}, {
"columnName": "abbreviation",
"method": "getAbbreviation",
"name": "Abbreviation"
}, {
"columnName": "synonyms",
"method": "getSynonyms",
"name": "Synonyms"
}, {
"columnName": "references",
"method": "getReferences",
"name": "References",
"formatFunction": function (references) {
var stringBuilder = [];
for (var i = 0; i < references.length; i++) {
var reference = references[i];
stringBuilder.push(reference.getType() + ":" + reference.getResource());
}
return stringBuilder.join(",");
}
}];
};
module.exports = AbstractExportPanel;
......@@ -184,33 +184,10 @@ ElementExportPanel.prototype.createResponseRow = function (alias, columns, miria
* @returns {ExportColumn[]}
*/
ElementExportPanel.prototype.getAllColumns = function () {
return [{
"columnName": "id",
"method": "getId",
"name": "Id"
}, {
return this.getBioEntityAllColumns().concat([{
"columnName": "name",
"method": "getName",
"name": "Name"
}, {
"columnName": "description",
"method": "getDescription",
"name": "Description"
}, {
"columnName": "modelId",
"method": "getModelId",
"name": "Map id"
}, {
/**
*
* @param {BioEntity} bioEntity
* @param {Project} project
* @returns {string}
*/
"method": function (bioEntity, project) {
return project.getModelById(bioEntity.getModelId()).getName();
},
"name": "Map name"
}, {
"columnName": "type",
"method": "getType",
......@@ -234,7 +211,7 @@ ElementExportPanel.prototype.getAllColumns = function () {
id: complexId,
modelId: modelId,
type: "ALIAS"
}), true).then(function(complex){
}), true).then(function (complex) {
return complex.getName();
});
} else {
......@@ -261,7 +238,7 @@ ElementExportPanel.prototype.getAllColumns = function () {
id: compartmentId,
modelId: modelId,
type: "ALIAS"
}), true).then(function(complex){
}), true).then(function (complex) {
return complex.getName();
});
} else {
......@@ -273,42 +250,18 @@ ElementExportPanel.prototype.getAllColumns = function () {
"columnName": "charge",
"method": "getCharge",
"name": "Charge"
}, {
"columnName": "symbol",
"method": "getSymbol",
"name": "Symbol"
}, {
"columnName": "fullName",
"method": "getFullName",
"name": "Full name"
}, {
"columnName": "abbreviation",
"method": "getAbbreviation",
"name": "Abbreviation"
}, {
"columnName": "formula",
"method": "getFormula",
"name": "Formula"
}, {
"columnName": "synonyms",
"method": "getSynonyms",
"name": "Synonyms"
}, {
"columnName": "formerSymbols",
"method": "getFormerSymbols",
"name": "Former symbols"
}, {
"columnName": "references",
"method": "getReferences",
"name": "References",
"formatFunction": function (references) {
var stringBuilder = [];
for (var i = 0; i < references.length; i++) {
var reference = references[i];
stringBuilder.push(reference.getType() + ":" + reference.getResource());
}
return stringBuilder.join(",");
}
}, {
"columnName": "linkedSubmodelId",
"method": "getLinkedSubmodelId",
......@@ -317,7 +270,7 @@ ElementExportPanel.prototype.getAllColumns = function () {
"columnName": "elementId",
"method": "getElementId",
"name": "Element external id"
}];
}]);
};
......
......@@ -64,7 +64,7 @@ NetworkExportPanel.prototype.init = function () {
* @returns {*[]}
*/
NetworkExportPanel.prototype.getAllColumns = function () {
return [{
return this.getBioEntityAllColumns().concat([{
"columnName": "elements",
"method": "getElements",
"name": "Elements",
......@@ -86,61 +86,6 @@ NetworkExportPanel.prototype.getAllColumns = function () {
return stringBuilder.join(",");
}
}, {
"columnName": "id",
"method": "getId",
"name": "Id"
}, {
"columnName": "description",
"method": "getDescription",
"name": "Description"
}, {
"columnName": "modelId",
"method": "getModelId",
"name": "Map id"
}, {
/**
*
* @param {BioEntity} bioEntity
* @param {Project} project
* @returns {string}
*/
"method": function (bioEntity, project) {
return project.getModelById(bioEntity.getModelId()).getName();
},
"name": "Map name"
}, {
"columnName": "type",
"method": "getType",
"name": "Reaction type"
}, {
"columnName": "symbol",
"method": "getSymbol",
"name": "Symbol"
}, {
"columnName": "abbreviation",
"method": "getAbbreviation",
"name": "Abbreviation"
}, {
"columnName": "formula",
"method": "getFormula",
"name": "Formula"
}, {
"columnName": "synonyms",
"method": "getSynonyms",
"name": "Synonyms"
}, {
"columnName": "references",
"method": "getReferences",
"name": "References",
"formatFunction": function (references) {
var stringBuilder = [];
for (var i = 0; i < references.length; i++) {
var reference = references[i];
stringBuilder.push(reference.getType() + ":" + reference.getResource());
}
return stringBuilder.join(",");
}
}, {
"columnName": "reactionId",
"method": "getReactionId",
"name": "Reaction external id"
......@@ -164,7 +109,7 @@ NetworkExportPanel.prototype.getAllColumns = function () {
"columnName": "subsystem",
"method": "getSubsystem",
"name": "Subsystem"
}];
}]);
};
/**
......
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