'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| IBM Cognos Products: Dashboard *| (C) Copyright IBM Corp. 2017, 2020 *| *| US Government Users Restricted Rights - Use, duplication or disclosure *| restricted by GSA ADP Schedule Contract with IBM Corp. *+----------------------------------------------met--------------------------+ */ define(['./modelmanagers/ShapingModelManager', '../utils/ShapingUIUtils'], function (ShapingModelManager, ShapingUIUtils) { 'use strict'; /** * INTENT: ModuleAPI provides a UI-Oriented interface to the moser module * It hides the implementation of the underlying model. */ var ShapingModelAPI = /** * Contructor * @param {Object} options.dashboardApi The dashboard API * @param {Object} options.sourceModel The source model */ function ShapingModelAPI(options) { var _this = this; _classCallCheck(this, ShapingModelAPI); var shapingModelManager = new ShapingModelManager(options); var shapingModel = options.sourceModel.get('shaping'); var sourceModelManager = options.sourceModelManager; var sourcesCollectionManager = sourceModelManager.sourcesCollectionManager; // event APIs this.on = shapingModel.on.bind(shapingModel); this.off = shapingModel.off.bind(shapingModel); // Temp hack until all our UIs are moved to live-widget. We don't want dashbboard to have a direct // depency on live-widget classes. this.getShapingUIUtils = function () { return ShapingUIUtils; }; // DEFINE THE API.... this.load = shapingModelManager.load.bind(shapingModelManager); this.queryData = shapingModelManager.queryData.bind(shapingModelManager); this.queryPredictData = shapingModelManager.queryPredictData.bind(shapingModelManager); this.querySmartsExploreRelationshipData = shapingModelManager.querySmartsExploreRelationshipData.bind(shapingModelManager); this.getModuleId = shapingModelManager.getModuleId.bind(shapingModelManager); this.getShapingHelper = shapingModelManager.getShapingHelper.bind(shapingModelManager); this.addCalculation = shapingModelManager.addCalculation.bind(shapingModelManager); this.getMetadataColumn = shapingModelManager.getMetadataColumn.bind(shapingModelManager); this.getMetadataColumns = shapingModelManager.getMetadataColumns.bind(shapingModelManager); this.getMoserObject = shapingModelManager.getMoserObject.bind(shapingModelManager); this.addToUndoStack = shapingModelManager.addToUndoStack.bind(shapingModelManager); this.getDrillGroups = shapingModelManager.getDrillGroups.bind(shapingModelManager); this.getDrillGroupsForColumn = shapingModelManager.getDrillGroupsForColumn.bind(shapingModelManager); this.relink = shapingModelManager.relink.bind(shapingModelManager); this.reloadMetadata = shapingModelManager.reloadMetadata.bind(shapingModelManager); this.tablesHaveJointRelationship = shapingModelManager.tablesHaveJointRelationship.bind(shapingModelManager); this.getTableNames = shapingModelManager.getTableNames.bind(shapingModelManager); this.getLocalizedName = shapingModelManager.getLocalizedName.bind(shapingModelManager); this.ensureTemporaryModule = shapingModelManager.ensureTemporaryModule.bind(shapingModelManager); this.getShapingId = shapingModel.getShapingId.bind(shapingModel); this.getEmbeddedModuleId = shapingModel.get.bind(shapingModel, 'embeddedModuleId'); this.getState = sourceModelManager.getState.bind(sourceModelManager); this.getSourceId = options.sourceModel.get.bind(options.sourceModel, 'id'); this.getSourceName = options.sourceModel.get.bind(options.sourceModel, 'name'); this.getAssetId = options.sourceModel.get.bind(options.sourceModel, 'assetId'); this.isOlapPackage = options.sourceModel.getIsOlapPackage.bind(options.sourceModel); this.getSourceType = options.sourceModel.get.bind(options.sourceModel, 'type'); this.getLastModified = sourceModelManager.getLastModified.bind(options.sourceModel); this.setLastModified = sourceModelManager.setLastModified.bind(options.sourceModel); this.getSourceIdsFromAssetId = sourcesCollectionManager && sourcesCollectionManager.getSourceIdsFromAssetId.bind(sourcesCollectionManager); this.addWADerivedAttribute = shapingModelManager.addWADerivedAttribute.bind(shapingModelManager); this.getTemporarySessionModuleJSON = shapingModelManager.getTemporarySessionModuleJSON.bind(shapingModelManager); this.copyPartialMoserModuleJSON = shapingModelManager.copyPartialMoserModuleJSON.bind(shapingModelManager); this.saveTemporaryModule = shapingModelManager.saveTemporaryModule.bind(shapingModelManager); this.clearTemporaryModule = shapingModelManager.clearTemporaryModule.bind(shapingModelManager); this.whenTemporaryModuleReady = shapingModelManager.whenTemporaryModuleReady.bind(shapingModelManager); this.getMetadataSubsetIds = shapingModelManager.getMetadataSubsetIds.bind(shapingModelManager); this.isMultiSheetUploadedFile = function () { return _this.getSourceType() === 'uploadedFile' && _this.getTableNames().length > 1; }; }; return ShapingModelAPI; }); //# sourceMappingURL=ModuleAPI.js.map