/** * Licensed Materials - Property of IBM * IBM Cognos Products: rs * (C) Copyright IBM Corp. 2018 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * */ define([ 'baglass/core-client/js/core-client/ui/core/Class', 'q', 'bi/authoring/utils/V5ToDashboard' ], function(Class, Q, V5ToDashboard) { 'use strict'; var rsReportToDashboardService = Class.extend({ init: function(attributes) { this._glassContext = attributes.glassContext; rsReportToDashboardService.inherited('init', this, arguments); }, convertReportToDashboard: function() { this.deferred = Q.defer(); this._glassContext.getCoreSvc('.Clipboard').get().then(function(v_oExternalCopy) { if (v_oExternalCopy && v_oExternalCopy.type == "REPORT") { var v_nSourceReport = (new DOMParser()).parseFromString(v_oExternalCopy.spec, "text/xml").documentElement; var v_aSelectionIids = v_oExternalCopy.selectionIids; V5ToDashboard.ConvertV5toDB(v_nSourceReport, v_aSelectionIids, this._glassContext).then(function(v_oDBSpec) { this.deferred.resolve(JSON.stringify(v_oDBSpec)); }.bind(this)); } else { this.deferred.resolve(""); } }.bind(this)); return this.deferred.promise; } }); return rsReportToDashboardService; });