| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 | 'use strict';function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }/** * Licensed Materials - Property of IBM * IBM Cognos Products: Dashboard * (C) Copyright IBM Corp. 2019, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */define(['../../../lib/@waca/dashboard-common/dist/core/APIFactory', '../../../widgets/livewidget/query/CommonQueryHelper', './QueryDefinition', './api/QueryService2API'], function (APIFactory, CommonQueryHelper, QueryDefinition, QueryServiceAPI2) {	var QueryService2 = function (_CommonQueryHelper) {		_inherits(QueryService2, _CommonQueryHelper);		function QueryService2(options) {			_classCallCheck(this, QueryService2);			var internalQueryService = options.features['QueryService.internal'];			var _this = _possibleConstructorReturn(this, _CommonQueryHelper.call(this, {				queryService: internalQueryService			}, options.features['Logger']));			_this.dashboard = options.features['API'];			_this.internalQueryService = internalQueryService;			_this.queryClasses = {};			return _this;		}		QueryService2.prototype.getAPI = function getAPI() {			if (!this.queryServiceAPI) {				this.queryServiceAPI = APIFactory.createAPI(this, [QueryServiceAPI2]);			}			return this.queryServiceAPI;		};		QueryService2.prototype.registerQueryClass = function registerQueryClass(queryProtocol, QueryClass) {			if (this.queryClasses[queryProtocol]) {				throw new Error('There is already a query class registered for ' + queryProtocol);			}			this.queryClasses[queryProtocol] = QueryClass;		};		QueryService2.prototype.createQueryDefinition = function createQueryDefinition(id, type) {			return new QueryDefinition({ id: id, type: type }).getAPI();		};		QueryService2.prototype._getProtocol = function _getProtocol(definitionList) {			var datasource = definitionList && definitionList.length > 0 ? definitionList[0].getDataSource() : null;			return datasource && datasource.getProtocol();		};		QueryService2.prototype.createQuery = function createQuery(definitionList) {			var queryProtocol = this._getProtocol(definitionList);			var QueryClass = this.queryClasses[queryProtocol];			if (QueryClass) {				return new QueryClass({					dashboard: this.dashboard,					internalQueryService: this.internalQueryService,					definitionList: definitionList				});			} else {				throw new Error('Query class is not registered for ' + queryProtocol);			}		};		return QueryService2;	}(CommonQueryHelper);	return QueryService2;});//# sourceMappingURL=QueryService2.js.map
 |