"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: Cognos Analytics * Copyright IBM Corp. 2015, 2018 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['underscore', 'bi/commons/ui/core/Class', 'bi/admin/common/utils/XMLUtils', 'bi/admin/globalparameters/helpers/SoapHelper', 'doT', 'text!bi/admin/common/templates/getParameters.xml'], function (_, Class, XMLUtils, SoapHelper, doT, GetParametersTemplate) { var Parameter = Class.extend({ init: function init(options) { Parameter.inherited('init', this, arguments); _.extend(this, options); }, get: function get() { return this.glassContext.services.fetch.get('v1/objects/' + this.report.id + '?fields=routingServerGroup').then(function (cmResponse) { var getParametersRequest = doT.template(GetParametersTemplate)({ 'cafContextId': this.glassContext.authInfo.cafContextId, 'objectPath': SoapHelper.xml_encode(this.report.searchPath), 'parameterValues': '', 'routingServerGroup': cmResponse.data.data[0].routingServerGroup }); return this.glassContext.services.fetch.post('v1/reports', { 'headers': { 'SOAPAction': 'http://www.ibm.com/xmlns/prod/cognos/reportService/201701/.high' }, 'contentType': 'text/xml; charset=UTF-8', 'data': getParametersRequest }).then(function (response) { return SoapHelper.processResponse(this.report, response.data); }.bind(this)); }.bind(this)).catch(function (response) { return { status: 'error', report_id: this.report.id, message: response.message, code: response.code }; }); } }); return Parameter; });