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

map model contains information about creation and modification dates

parent 08dfb081
No related branches found
No related tags found
1 merge request!717Resolve "process vcard data that can appear in model annotations"
......@@ -34,6 +34,8 @@ var Reaction = require('./Reaction');
* @property {number} defaultZoomLevel
* @property {Annotation[]|AnnotationOptions[]} references
* @property {Author[]} authors
* @property {string[]} modificationDates
* @property {string} creationDate
*/
/**
......@@ -68,7 +70,8 @@ function MapModel(configuration) {
this._sbmlParameters = [];
this._references = [];
this._authors = [];
this._modificationDates = [];
this._creationDate = undefined;
if (configuration !== undefined) {
if (configuration instanceof MapModel) {
......@@ -85,6 +88,8 @@ function MapModel(configuration) {
this.setDefaultZoomLevel(configuration.getDefaultZoomLevel());
this.setReferences(configuration.getReferences());
this.setAuthors(configuration.getAuthors());
this.setModificationDates(configuration.getModificationDates());
this.setCreationDate(configuration.getCreationDate());
} else {
this.setId(configuration.idObject);
this.setName(configuration.name);
......@@ -99,6 +104,8 @@ function MapModel(configuration) {
this.setDefaultZoomLevel(configuration.defaultZoomLevel);
this.setReferences(configuration.references);
this.setAuthors(configuration.authors);
this.setModificationDates(configuration.modificationDates);
this.setCreationDate(configuration.creationDate);
}
}
}
......@@ -932,4 +939,45 @@ MapModel.prototype.setAuthors = function (authors) {
}
};
/**
*
* @returns {string[]}
*/
MapModel.prototype.getModificationDates = function () {
return this._modificationDates;
};
/**
*
* @param {string[]} modificationDates
*/
MapModel.prototype.setModificationDates = function (modificationDates) {
if (modificationDates === undefined) {
throw new Error("modification dates must be defined");
}
this._modificationDates = [];
for (var i = 0; i < modificationDates.length; i++) {
this._modificationDates.push(modificationDates[i]);
}
};
/**
*
* @returns {string}
*/
MapModel.prototype.getCreationDate = function () {
return this._creationDate;
};
/**
*
* @param {string|null} creationDate
*/
MapModel.prototype.setCreationDate = function (creationDate) {
if (creationDate === null) {
creationDate = undefined;
}
this._creationDate = creationDate;
};
module.exports = MapModel;
......@@ -19,7 +19,8 @@ describe('MapModel', function () {
var emptyData = {
idObject: 123,
references: [],
authors: []
authors: [],
modificationDates: []
};
it("constructor", function () {
......
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