"use strict";
/**
* Licensed Materials - Property of IBM
* IBM Cognos Products: Cognos Analytics
* Copyright IBM Corp. 2015, 2017
* US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
define(['underscore', 'bi/admin/common/utils/parameters/SimpleParmValueItem'], function (_, SimpleParmValueItem) {
function HierarchicalParmValueItem() {
//NOSONAR
this._inclusive = true;
this._value = new SimpleParmValueItem();
this._subNodes = [];
}
HierarchicalParmValueItem.prototype.fromJSON = function (json) {
if (json.inclusive) {
this._inclusive = json.inclusive;
}
if (json.value) {
this._value.fromJSON(json.value);
}
if (json.subNodes) {
_.each(json.subNodes, function (subNodeJSON) {
var subNode = new HierarchicalParmValueItem();
subNode.fromJSON(subNodeJSON);
this._subNodes.push(subNode);
}.bind(this));
}
};
HierarchicalParmValueItem.prototype.toXML = function (nodeName) {
var subNodesXML = '';
_.each(this._subNodes, function (subNode) {
subNodesXML += subNode.toXML('item');
});
subNodesXML += '';
var hierarchicalParmValueItem = '<' + nodeName + ' xsi:type="bus:hierarchicalParmValueItem">' + '' + this._inclusive + '' + this._value.toXML('value') + subNodesXML + '' + nodeName + '>';
return hierarchicalParmValueItem;
};
return HierarchicalParmValueItem;
});