DataSourceAPI.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287
  1. 'use strict';
  2. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4. /**
  5. * Licensed Materials - Property of IBM
  6. * IBM Business Analytics (C) Copyright IBM Corp. 2018, 2020
  7. * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. */
  9. /**
  10. * @class DataSourceAPI
  11. * @hideconstructor
  12. *
  13. * @classdesc implementation of the DataSourceAPI interface.
  14. */
  15. define([], function () {
  16. var DataSourceAPI = function () {
  17. function DataSourceAPI() {
  18. _classCallCheck(this, DataSourceAPI);
  19. }
  20. /**
  21. * @function DataSourceAPI#destroy
  22. * @description Used to destroy the SourceModelAPI object
  23. */
  24. DataSourceAPI.prototype.destroy = function destroy() {};
  25. /**
  26. * @function DataSourceAPI#getId
  27. * @description Get the ID used to reference this data source internally.
  28. * @public
  29. *
  30. * @return {String} The ID to use internally to reference this data source
  31. */
  32. DataSourceAPI.prototype.getId = function getId() {};
  33. /**
  34. * @function DataSourceAPI#getAssetId
  35. * @description Get the asset ID (Content Store ID) for the data source.
  36. * @public
  37. *
  38. * @return {String} Content store ID of the data source
  39. */
  40. DataSourceAPI.prototype.getAssetId = function getAssetId() {};
  41. /**
  42. * @function DataSourceAPI#getType
  43. * @description Get the type of the data source.
  44. * @public
  45. *
  46. * @return {String} The type of the data source (uploadedFile, dataSet2, package, ...)
  47. */
  48. DataSourceAPI.prototype.getType = function getType() {};
  49. /**
  50. * @public
  51. * @function DataSourceAPI.getProtocol
  52. * @description Get the the protocol of the datasource which determines the platform of the data source and query engine
  53. * @return {String} The protocol of the datasource
  54. */
  55. DataSourceAPI.prototype.getProtocol = function getProtocol() {};
  56. /**
  57. * @function DataSourceAPI#getLocalizedName
  58. * @description Get the localized name of the data source.
  59. * @public
  60. *
  61. * @return {String} the localized name of the data source
  62. * @deprecated Should use the synchronous call {@link DataSourceAPI#getName}
  63. */
  64. DataSourceAPI.prototype.getLocalizedName = function getLocalizedName() {};
  65. /**
  66. * @function DataSourceAPI#getSearchPath
  67. * @description Get the search path of the data source.
  68. * @public
  69. *
  70. * @return {String} the search path of the data source
  71. */
  72. DataSourceAPI.prototype.getSearchPath = function getSearchPath() {};
  73. /**
  74. * @function DataSourceAPI#getName
  75. * @description Get the localized name of the data source.
  76. * @public
  77. *
  78. * @return {String} the localized name of the data source
  79. * @todo Needs to be implemented synchronously
  80. */
  81. DataSourceAPI.prototype.getName = function getName() {};
  82. /**
  83. * @function DataSourceAPI#getState
  84. * @description Get the state of the data source.
  85. * @public
  86. *
  87. * @return {String} 'ready', 'error' otherwise 'loaded'
  88. */
  89. DataSourceAPI.prototype.getState = function getState() {};
  90. /**
  91. * @function DataSourceAPI#loadMetadata
  92. * @description Makes the necessary server calls to make metadata available on the client
  93. * @return {Promise} Promise that will resolve once the data source has been loaded
  94. */
  95. DataSourceAPI.prototype.loadMetadata = function loadMetadata() {};
  96. /**
  97. * @function DataSourceAPI#getMetadataColumn
  98. * @description Returns a {@link MetadataColumnAPI} object. Note, you must call {@link DataSourceAPI#loadMetadata} before making this call.
  99. * @public
  100. *
  101. * @param {String} columnId The columnId to get the metadata column
  102. *
  103. * @return {MetadataColumnAPI} Returns a MetadataColumnAPI object. Throws an exception if called before {@link DataSourceAPI#loadMetadata} is called
  104. */
  105. DataSourceAPI.prototype.getMetadataColumn = function getMetadataColumn() {};
  106. /**
  107. * @function DataSourceAPI#relink
  108. * @description relink to new datasource.
  109. * @public
  110. * @async
  111. *
  112. * @param {DataSourceInfo} newSourceInfo Information (assetId, name, type, searchPath, ..) of the new source
  113. *
  114. * @return {Promise} Promise that resolved once the dataSource has been relinked and the dashboard has been reloaded.
  115. */
  116. DataSourceAPI.prototype.relink = function relink() {};
  117. /**
  118. * @function DataSourceAPI#registerUsage
  119. * @description Widgets should call this method registering themselves to the dataSource. This is to enforce.
  120. * that a dataSource that's still in use cannot be deleted.
  121. * @public
  122. *
  123. * @param {String} widgetId The id of the widget which will be using this module. Used to keep track of usage.
  124. */
  125. DataSourceAPI.prototype.registerUsage = function registerUsage() {};
  126. /**
  127. * @function DataSourceAPI#deregisterUsage
  128. * @description Should be called when a widget is deleted or no longer references a dataSource.
  129. * @public
  130. *
  131. * @param {String} widgetId The id of the widget which will be using this module. Used to keep track of usage.
  132. */
  133. DataSourceAPI.prototype.deregisterUsage = function deregisterUsage() {};
  134. /**
  135. * @function DataSourceAPI#isDataSourceUsed
  136. * @description Check to see if the dataSource is referenced by a widget in the dashboard.
  137. * @public
  138. *
  139. * @return {Boolean} true if the dataSource is being used by a widget otherwise false
  140. */
  141. DataSourceAPI.prototype.isDataSourceUsed = function isDataSourceUsed() {};
  142. /**
  143. * @function DataSourceAPI#isDataSourceUsedByWidget
  144. * @description Check to see if the dataSource is being referenced by a given widget.
  145. * @public
  146. *
  147. * @param {String} widgetId The id of the widget we want to check
  148. *
  149. * @return {Boolean} True if the dataSource used by widget otherwise false
  150. */
  151. DataSourceAPI.prototype.isUsedBy = function isUsedBy() {};
  152. /**
  153. * @function DataSourceAPI#isOlapPackage
  154. * @description Check to see if the current data source references an OLAP package
  155. * @return {Boolen} True if the data source references an OLAP package
  156. */
  157. DataSourceAPI.prototype.isOlapPackage = function isOlapPackage() {};
  158. /**
  159. * @function DataSourceAPI#getModule
  160. * @description Get the data source module
  161. * @return {Object} Data module
  162. */
  163. DataSourceAPI.prototype.getModule = function getModule() {};
  164. /**
  165. * @function DataSourceAPI#getModificationTime
  166. * @description Get the data source modification time
  167. * @return {Promise} Promise which resolves a string whose value is the last modification time of the datasource
  168. */
  169. DataSourceAPI.prototype.getModificationTime = function getModificationTime() {};
  170. /**
  171. * @function DataSourceAPI#hasJoinedTables
  172. * @description verifies if the given table names have a joined relationship within the data source
  173. * @public
  174. *
  175. * @param {string} tableName1
  176. * @param {String} tableName2
  177. *
  178. * @return {Boolean} True if the table names have a joined relationship
  179. */
  180. DataSourceAPI.prototype.hasJoinedTables = function hasJoinedTables() /* tableName1, tableName2 */{};
  181. /**
  182. * @function DataSourceAPI#getMetadataColumnList
  183. * @description Returns all the metadataColumns from a dataSource that have the type specified by the selector
  184. * @public
  185. * @deprecated Please use findMetadataColumns
  186. * @param {string} [selector] type of the metadataColumn. e.g. 'fact', 'attribute', or all columns if undefined.
  187. *
  188. * @return {Array} List of metadataColumn objects
  189. */
  190. DataSourceAPI.prototype.getMetadataColumnList = function getMetadataColumnList() /* selector */{};
  191. /**
  192. * @function DataSourceAPI#findMetadataColumns
  193. * @description Returns all the metadataColumns from a dataSource that have the name and type specified by the selector
  194. * @public
  195. *
  196. * @param {string} searchTerm - the search term that name of metadata column contains
  197. * @param {string} type - type of the metadataColumn to search. e.g. 'fact', 'attribute', or all columns if undefined.
  198. *
  199. * @return {Array} List of metadataColumn objects
  200. */
  201. DataSourceAPI.prototype.findMetadataColumns = function findMetadataColumns() /* searchTerm , type */{};
  202. _createClass(DataSourceAPI, null, [{
  203. key: 'STATE',
  204. get: function get() {
  205. return {
  206. LOADING: 'loading',
  207. READY: 'ready',
  208. ERROR: 'error'
  209. };
  210. }
  211. }]);
  212. return DataSourceAPI;
  213. }();
  214. return DataSourceAPI;
  215. });
  216. //# sourceMappingURL=DataSourceAPI.js.map