Author: ygrego Date: 2015-04-02 16:01:36 +0000 (Thu, 02 Apr 2015) New Revision: 1060 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1060 Log: This class permit to manage severals sources of metadata. Added: oipf/js/utils/MetadataManager.js Added: oipf/js/utils/MetadataManager.js =================================================================== --- oipf/js/utils/MetadataManager.js (rev 0) +++ oipf/js/utils/MetadataManager.js 2015-04-02 16:01:36 UTC (rev 1060) @@ -0,0 +1,34 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +var MetadataManager = Class.extend({ + + metadata: {}, + + init: function(metadata) { + + if (metadata && metadata.type) { + this.metadata[metadata.type] = metadata; + } + }, + + addMetadata: function(metadata) { + var type = metadata.type; + + if (type) { + this.metadata[type] = metadata; + return true; + } + return false; + }, + + getMetadata: function(type) { + if (type && this.metadata) { + return this.metadata[type]; + } + return null; + } +}); +
participants (1)
-
ygregoï¼ users.nuiton.org