| orion.Export = function(header, exportingBundle) { |
| if (header === null) |
| throw "header cannot be null"; |
| |
| if (exportingBundle === null) |
| throw "exportingBundle cannot be null"; |
| |
| this._name = null; |
| this._version = orion.Version.EMPTY_VERSION; |
| this._attributes = {}; |
| this._mandatory = []; |
| this._exportingBundle = exportingBundle; |
| |
| this._parseExport(header); |
| }; |
| |
| orion.Export.prototype = { |
| _parseExport : function(header) { |
| if (typeof header == "string") { |
| this._name = header; |
| return; |
| } |
| |
| this._name = header.name; |
| if (header.version) |
| this._version = orion.Version.parseVersion(header.version); |
| |
| if (header.mandatory) |
| this._parseMandatory(header.mandatory); |
| |
| var attributeName; |
| for (attributeName in header) { |
| if (header.hasOwnProperty(attributeName)) |
| this._attributes[attributeName] = header[attributeName]; |
| } |
| }, |
| _parseMandatory : function(mandatory) { |
| for ( var i = 0; i < mandatory.length; i++) { |
| this._mandatory.push(mandatory[i]); |
| } |
| }, |
| getName : function() { |
| return this._name; |
| }, |
| getVersion : function() { |
| return this._version; |
| }, |
| getBundleId : function() { |
| return this._exportingBundle.getBundleId(); |
| }, |
| getBundleName : function() { |
| return this._exportingBundle.getName(); |
| }, |
| getBundleVersion : function() { |
| return this._exportingBundle.getVersion(); |
| }, |
| getAttributes : function() { |
| return this._attributes; |
| }, |
| getExportingBundle : function() { |
| return this._exportingBundle; |
| }, |
| getMandatory : function() { |
| return this._mandatory; |
| } |
| }; |