@sapui5/sap.ui.export 1.101.0 → 1.103.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +1 -1
  2. package/src/sap/ui/export/.library +1 -1
  3. package/src/sap/ui/export/ExportBase.js +29 -7
  4. package/src/sap/ui/export/ExportDialog.js +30 -22
  5. package/src/sap/ui/export/ExportHandler.js +463 -0
  6. package/src/sap/ui/export/ExportUtils.js +179 -91
  7. package/src/sap/ui/export/PortableDocument.js +35 -24
  8. package/src/sap/ui/export/Spreadsheet.js +35 -22
  9. package/src/sap/ui/export/SpreadsheetExport.js +1 -1
  10. package/src/sap/ui/export/fragments/SettingsDialog.fragment.xml +24 -17
  11. package/src/sap/ui/export/js/XLSXBuilder.js +1 -1
  12. package/src/sap/ui/export/js/XLSXBuilder.js.map +1 -1
  13. package/src/sap/ui/export/library.js +27 -2
  14. package/src/sap/ui/export/messagebundle.properties +34 -4
  15. package/src/sap/ui/export/messagebundle_ar.properties +22 -2
  16. package/src/sap/ui/export/messagebundle_bg.properties +22 -2
  17. package/src/sap/ui/export/messagebundle_ca.properties +22 -2
  18. package/src/sap/ui/export/messagebundle_cs.properties +22 -2
  19. package/src/sap/ui/export/messagebundle_cy.properties +22 -2
  20. package/src/sap/ui/export/messagebundle_da.properties +22 -2
  21. package/src/sap/ui/export/messagebundle_de.properties +22 -2
  22. package/src/sap/ui/export/messagebundle_el.properties +22 -2
  23. package/src/sap/ui/export/messagebundle_en.properties +22 -2
  24. package/src/sap/ui/export/messagebundle_en_GB.properties +22 -2
  25. package/src/sap/ui/export/messagebundle_en_US_sappsd.properties +22 -2
  26. package/src/sap/ui/export/messagebundle_en_US_saprigi.properties +28 -2
  27. package/src/sap/ui/export/messagebundle_en_US_saptrc.properties +22 -2
  28. package/src/sap/ui/export/messagebundle_es.properties +22 -2
  29. package/src/sap/ui/export/messagebundle_es_MX.properties +22 -2
  30. package/src/sap/ui/export/messagebundle_et.properties +22 -2
  31. package/src/sap/ui/export/messagebundle_fi.properties +22 -2
  32. package/src/sap/ui/export/messagebundle_fr.properties +22 -2
  33. package/src/sap/ui/export/messagebundle_fr_CA.properties +22 -2
  34. package/src/sap/ui/export/messagebundle_hi.properties +22 -2
  35. package/src/sap/ui/export/messagebundle_hr.properties +22 -2
  36. package/src/sap/ui/export/messagebundle_hu.properties +22 -2
  37. package/src/sap/ui/export/messagebundle_id.properties +23 -3
  38. package/src/sap/ui/export/messagebundle_it.properties +22 -2
  39. package/src/sap/ui/export/messagebundle_iw.properties +22 -2
  40. package/src/sap/ui/export/messagebundle_ja.properties +22 -2
  41. package/src/sap/ui/export/messagebundle_kk.properties +22 -2
  42. package/src/sap/ui/export/messagebundle_ko.properties +22 -2
  43. package/src/sap/ui/export/messagebundle_lt.properties +22 -2
  44. package/src/sap/ui/export/messagebundle_lv.properties +22 -2
  45. package/src/sap/ui/export/messagebundle_ms.properties +22 -2
  46. package/src/sap/ui/export/messagebundle_nl.properties +22 -2
  47. package/src/sap/ui/export/messagebundle_no.properties +22 -2
  48. package/src/sap/ui/export/messagebundle_pl.properties +22 -2
  49. package/src/sap/ui/export/messagebundle_pt.properties +22 -2
  50. package/src/sap/ui/export/messagebundle_pt_PT.properties +22 -2
  51. package/src/sap/ui/export/messagebundle_ro.properties +22 -2
  52. package/src/sap/ui/export/messagebundle_ru.properties +22 -2
  53. package/src/sap/ui/export/messagebundle_sh.properties +22 -2
  54. package/src/sap/ui/export/messagebundle_sk.properties +22 -2
  55. package/src/sap/ui/export/messagebundle_sl.properties +22 -2
  56. package/src/sap/ui/export/messagebundle_sv.properties +22 -2
  57. package/src/sap/ui/export/messagebundle_th.properties +22 -2
  58. package/src/sap/ui/export/messagebundle_tr.properties +22 -2
  59. package/src/sap/ui/export/messagebundle_uk.properties +22 -2
  60. package/src/sap/ui/export/messagebundle_vi.properties +22 -2
  61. package/src/sap/ui/export/messagebundle_zh_CN.properties +22 -2
  62. package/src/sap/ui/export/messagebundle_zh_TW.properties +22 -2
  63. package/src/sap/ui/export/provider/DataProviderBase.js +10 -10
@@ -0,0 +1,463 @@
1
+ /*!
2
+ * SAPUI5
3
+ * (c) Copyright 2009-2022 SAP SE. All rights reserved.
4
+ */
5
+ sap.ui.define(['./library', './ExportUtils', './ExportDialog', 'sap/m/MessageToast', 'sap/ui/core/Core', 'sap/ui/base/EventProvider', 'sap/ui/model/odata/v4/ODataModel', 'sap/ui/util/openWindow'], function(library, ExportUtils, ExportDialog, MessageToast, Core, EventProvider, ODataModel, openWindow) {
6
+ 'use strict';
7
+
8
+ var Destination = library.Destination;
9
+
10
+ /**
11
+ * Any export related functionality is encapsuled in the <code>ExportHandler</code> which also stores user settings throughout the session.
12
+ *
13
+ * @param {object} [mCapabilities] Mapping object which references certain export capabilities
14
+ * @constructor The <code>sap.ui.export.ExportHandler</code> class allows you to export table data from a UI5 application.
15
+ *
16
+ * @author SAP SE
17
+ * @version 1.103.0
18
+ *
19
+ * @since 1.102
20
+ * @name sap.ui.export.ExportHandler
21
+ * @extends sap.ui.base.EventProvider
22
+ * @namespace
23
+ * @private
24
+ * @ui5-restricted sap.ui.comp.smarttable.SmartTable, sap.ui.mdc.Table
25
+ */
26
+ var ExportHandler = EventProvider.extend('sap.ui.export.ExportHandler', {
27
+ constructor: function(mCapabilities) {
28
+ EventProvider.call(this);
29
+
30
+ /* Apply default capabilities if nothing is provided */
31
+ this._mCapabilities = mCapabilities instanceof Object ? mCapabilities : { XLSX: {} };
32
+ }
33
+ });
34
+
35
+ /**
36
+ * The <code>beforeExport</code> event is fired just before the export process is started.
37
+ *
38
+ * @name sap.ui.export.ExportHandler#beforeExport
39
+ * @event
40
+ * @param {sap.ui.base.Event} oEvent
41
+ * @param {sap.ui.base.EventProvider} oEvent.getSource
42
+ * @param {object} oEvent.getParameters
43
+ * @param {object} oEvent.getParameter.exportSettings Contains export-related configuration
44
+ * @param {object} oEvent.getParameter.userExportSettings User specific settings from the "Export As" dialog
45
+ *
46
+ * @since 1.102
47
+ * @public
48
+ */
49
+
50
+ /**
51
+ * Attaches event handler <code>fnFunction</code> to the {@link sap.ui.export.ExportHandler#event:beforeExport}
52
+ * event of this <code>sap.ui.export.ExportHandler</code>.</br>
53
+ * When called, the context of the event handler (its <code>this</code>) will be bound to <code>oListener</code> if specified,
54
+ * otherwise it will be bound to this <code>sap.ui.export.ExportHandler</code> itself.</br>
55
+ * This event is fired just before the export process is started.
56
+ *
57
+ * @param {object} [oData] An application-specific payload object that will be passed to the event handler along with the event object when firing the event
58
+ * @param {function} fnHandler The function to be called when the event occurs
59
+ * @param {object} [oListener] Context object to call the event handler with. Defaults to the <code>sap.ui.export.ExportHandler</code> instance itself
60
+ *
61
+ * @returns {this} Reference to <code>this</code> in order to allow method chaining
62
+ *
63
+ * @name sap.ui.export.ExportHandler#attachBeforeExport
64
+ * @function
65
+ * @since 1.102
66
+ * @public
67
+ */
68
+ ExportHandler.prototype.attachBeforeExport = function(oData, fnHandler, oListener) {
69
+ return this.attachEvent('beforeExport', oData, fnHandler, oListener);
70
+ };
71
+
72
+ /**
73
+ * Detaches event handler <code>fnFunction</code> from the {@link sap.ui.export.ExportHandler#event:beforeExport}
74
+ * event of this <code>sap.ui.export.ExportHandler</code>.</br>
75
+ * The passed function and listener object must match the ones used for event registration.
76
+ *
77
+ * @param {function} fnHandler The function to be called when the event occurs
78
+ * @param {object} [oListener] Context object on which the given function had to be called
79
+ *
80
+ * @returns {this} Reference to <code>this</code> in order to allow method chaining
81
+ *
82
+ * @name sap.ui.export.ExportHandler#detachBeforeExport
83
+ * @function
84
+ * @since 1.102
85
+ * @public
86
+ */
87
+ ExportHandler.prototype.detachBeforeExport = function(fnHandler, oListener) {
88
+ return this.detachEvent('beforeExport', fnHandler, oListener);
89
+ };
90
+
91
+ /**
92
+ * Cleans up the internal structures and removes all event handlers.
93
+ *
94
+ * The object must not be used anymore after destroy was called.
95
+ *
96
+ * @see sap.ui.base.Object#destroy
97
+ * @public
98
+ */
99
+ ExportHandler.prototype.destroy = function() {
100
+ EventProvider.prototype.destroy.apply(this, arguments);
101
+
102
+ if (this._oModel) {
103
+ this._oModel.destroy();
104
+ }
105
+
106
+ this._mCapabilities = null;
107
+ this._oDataSource = null;
108
+ this._mDialogSettings = null;
109
+ this._oModel = null;
110
+ this.bIsDestroyed = true;
111
+ };
112
+
113
+ /**
114
+ * Loads the FileShareSupport module and requests
115
+ * available destinations. If no FileShareSupport
116
+ * module is registered or the module does not
117
+ * provide a destination, the Promise resolves
118
+ * without any result.
119
+ *
120
+ * @returns {Promise} A Promise that gets resolved with the FileShareSupport datasource or undefined if there is none
121
+ */
122
+ ExportHandler.prototype.fetchDataSource = function() {
123
+ var that = this;
124
+ var sFileShareSupportModuleName;
125
+
126
+ if (this._oDataSource) {
127
+ return Promise.resolve(this._oDataSource);
128
+ }
129
+
130
+ sFileShareSupportModuleName = Core.getConfiguration().getFileShareSupport();
131
+
132
+ if (!sFileShareSupportModuleName) {
133
+ return Promise.resolve();
134
+ }
135
+
136
+ return new Promise(function(fnResolve) {
137
+ sap.ui.require([sFileShareSupportModuleName], function(oFileShareSupport) {
138
+ oFileShareSupport.getDataSource().then(function(oDataSource) {
139
+ that._oDataSource = oDataSource;
140
+ fnResolve(oDataSource);
141
+ }).catch(function () {
142
+ fnResolve();
143
+ });
144
+ });
145
+ });
146
+ };
147
+
148
+ /**
149
+ * Opens the <code>CloudFilePicker</code> control and
150
+ * returns a <code>Promise</code> that gets resolved
151
+ * when the user selected a particular location for
152
+ * the file that should be created.
153
+ *
154
+ * @param {object} oDataSource DataSource object containing the serviceUrl for the CloudFilePicker
155
+ * @param {string} [sFileName] Suggested name of the file including file extension
156
+ * @returns {Promise} Resolves with the file location selected in the <code>CloudFilePicker</code>
157
+ */
158
+ ExportHandler.prototype.getRemoteFileLocation = function(oDataSource, sFileName) {
159
+ return new Promise(function(fnResolve, fnReject) {
160
+ ExportUtils.getResourceBundle().then(function(oResourceBundle) {
161
+ sap.ui.require(['sap/suite/ui/commons/CloudFilePicker'], function(CloudFilePicker) {
162
+ var oFilePicker;
163
+
164
+ oFilePicker = new CloudFilePicker({
165
+ serviceUrl: oDataSource.uri,
166
+ suggestedFileName: sFileName,
167
+ enableDuplicateCheck: true,
168
+ fileNameMandatory: true,
169
+ confirmButtonText: oResourceBundle.getText('EXPORT_BUTTON'),
170
+ title: oResourceBundle.getText('DESTINATION_DIALOG_TITLE')
171
+ });
172
+
173
+ oFilePicker.attachSelect(function(oEvent) {
174
+ var aSelectedFiles, oSelectedFolder, bReplaceFile, mCloudFileInfo = {};
175
+
176
+ aSelectedFiles = oEvent.getParameter('selectedFiles');
177
+ oSelectedFolder = oEvent.getParameter('selectedFolder');
178
+ bReplaceFile = oEvent.getParameter('replaceExistingFile');
179
+
180
+ mCloudFileInfo = {};
181
+ mCloudFileInfo['FileShare'] = oSelectedFolder.getFileShareId();
182
+ mCloudFileInfo['FileShareItemKind'] = 'document';
183
+ mCloudFileInfo['FileShareItemName'] = oEvent.getParameter('selectedFileName');
184
+ mCloudFileInfo['ParentFileShareItem'] = oSelectedFolder.getFileShareItemId();
185
+
186
+ if (bReplaceFile && Array.isArray(aSelectedFiles) && aSelectedFiles.length > 0) {
187
+ var oCloudFile = aSelectedFiles.shift();
188
+
189
+ mCloudFileInfo['FileShareItem'] = oCloudFile.getFileShareItemId();
190
+ }
191
+
192
+ /* Check whether the user has selected a valid FileShare */
193
+ if (!mCloudFileInfo['FileShare']) {
194
+ fnReject(oResourceBundle.getText('DESTINATION_SELECTION_INCOMPLETE'));
195
+ }
196
+
197
+ fnResolve(mCloudFileInfo);
198
+ });
199
+
200
+ oFilePicker.open();
201
+ });
202
+ });
203
+ });
204
+ };
205
+
206
+ /**
207
+ * Creates an export instance according to the given file type
208
+ * and adds default event handlers.
209
+ *
210
+ * @param {object} mExportSettings mExportSettings ExportSettings that are used for the export
211
+ * @param {object} mCustomSettings Additional settings that are passed into the event
212
+ * @param {object} mCloudFileInfo FileShareItem representation of the file
213
+ * @returns {Promise} A Promise that resolves with the desired export instance
214
+ */
215
+ ExportHandler.prototype.getExportInstance = function(mExportSettings, mCustomSettings, mCloudFileInfo) {
216
+ var that = this;
217
+
218
+ return Promise.all([
219
+ ExportUtils.getResourceBundle(),
220
+ ExportUtils.getExportInstance(mExportSettings)
221
+ ]).then(function(aResolve) {
222
+ var oResourceBundle = aResolve[0];
223
+ var oExportInstance = aResolve[1];
224
+
225
+ oExportInstance.attachBeforeExport(function(oEvent) {
226
+ var mEventExportSettings = oEvent.getParameter('exportSettings');
227
+
228
+ that.fireEvent('beforeExport', {
229
+ exportSettings: mEventExportSettings,
230
+ userExportSettings: mCustomSettings || {}
231
+ }, false, false);
232
+ });
233
+
234
+ if (mCloudFileInfo && typeof oExportInstance.attachBeforeSave === 'function') {
235
+ oExportInstance.attachBeforeSave(function(oEvent) {
236
+ var aArrayBuffer, oExportDialog;
237
+
238
+ aArrayBuffer = oEvent.getParameter('data');
239
+ oExportDialog = oEvent.getParameter('exportDialog');
240
+ mCloudFileInfo['FileShareItemContentType'] = oExportInstance.getMimeType();
241
+
242
+ var uInt8Array = new Uint8Array(aArrayBuffer);
243
+ var stringArray = new Array(uInt8Array.length);
244
+ for (var i = 0; i < uInt8Array.length; i++) {
245
+ stringArray[i] = String.fromCharCode(uInt8Array[i]); // often a bit faster, especially with huge files, than string concatenation
246
+ }
247
+ mCloudFileInfo['FileShareItemContent'] = btoa(stringArray.join(""));
248
+
249
+ oExportDialog.updateStatus(oResourceBundle.getText('DESTINATION_DIALOG_STATUS'));
250
+ oEvent.preventDefault();
251
+
252
+ that.uploadFile(mCloudFileInfo).then(function() {
253
+ MessageToast.show(oResourceBundle.getText('DESTINATION_TRANSFER_SUCCESS'));
254
+ }).catch(function() {
255
+ ExportDialog.showErrorMessage(oResourceBundle.getText('DESTINATION_TRANSFER_ERROR'));
256
+ }).finally(function() {
257
+ oExportDialog.finish();
258
+ });
259
+ });
260
+ }
261
+
262
+ return oExportInstance;
263
+ });
264
+ };
265
+
266
+ /**
267
+ * Uploads the file to the FileShareSupport OData service.
268
+ *
269
+ * @param {object} mCloudFileInfo FileShareItem representation of the file
270
+ * @returns {Promise} A Promise that gets resolved after the generated file has been transferred to the FileShareSupport OData service
271
+ */
272
+ ExportHandler.prototype.uploadFile = function(mCloudFileInfo) {
273
+ return this.fetchDataSource().then(function(oDestination) {
274
+ var oBinding, oContext, oModel, sContentProperty, sTypeProperty, sPath;
275
+
276
+ sContentProperty = "FileShareItemContent";
277
+ sTypeProperty = 'FileShareItemContentType';
278
+ oModel = this._getModel(oDestination);
279
+
280
+ /* Overwrite existing file */
281
+ if (mCloudFileInfo['FileShareItem']) {
282
+ oContext = oModel.getKeepAliveContext("/FileShareItems(FileShare='" + mCloudFileInfo.FileShare + "',FileShareItem='" + mCloudFileInfo.FileShareItem + "')");
283
+
284
+ /*
285
+ * We have to set the FileShareItemContentLink as well
286
+ * as the FileShareItemContentType property explicitly
287
+ * to ensure that the properties will be filled with
288
+ * the content of the PATCH response when updating the
289
+ * FileShareItemContent. Adding the <code>null</code>
290
+ * prevents an additional PATCH for the link. It is also
291
+ * important to set all properties without waiting for
292
+ * the Promise to resolve. This allows the binding to
293
+ * bundle multiple PATCH requests into a single $batch.
294
+ */
295
+ oContext.setProperty('FileShareItemContentLink', '', null);
296
+ oContext.setProperty(sTypeProperty, mCloudFileInfo[sTypeProperty]);
297
+ return oContext.setProperty(sContentProperty, mCloudFileInfo[sContentProperty]).then(function() {
298
+ return oContext.getProperty('FileShareItemContentLink');
299
+ });
300
+ }
301
+
302
+ /* Creating new file in specific folder or _Root */
303
+ if (mCloudFileInfo.ParentFileShareItem) {
304
+ sPath = "/FileShareItems(FileShare='" + mCloudFileInfo.FileShare + "',FileShareItem='" + mCloudFileInfo.ParentFileShareItem + "')/_Children";
305
+ } else {
306
+ sPath = "/FileShares(FileShare='" + mCloudFileInfo.FileShare + "')/_Root/_Children";
307
+ }
308
+
309
+ oBinding = oModel.bindList(sPath);
310
+ return this._createFile(oBinding, mCloudFileInfo);
311
+ }.bind(this)).then(function(sUrl) {
312
+ if (sUrl) {
313
+ openWindow(sUrl);
314
+ }
315
+ });
316
+ };
317
+
318
+ /**
319
+ * Creates a new file via the <code>ODataListBinding</code> based
320
+ * on the FileShareItem representation.
321
+ *
322
+ * @param {sap.ui.model.odata.v4.ODataListBinding} oBinding ListBinding that is bound to the desired folder
323
+ * @param {object} mCloudFileInfo FileShareItem representation of the file
324
+ * @returns {Promise} Promise that resolves with a Link to the created file
325
+ */
326
+ ExportHandler.prototype._createFile = function(oBinding, mCloudFileInfo) {
327
+ return new Promise(function(fnResolve, fnReject) {
328
+ function fnCreateCompleted(oEvent) {
329
+ var bSuccess, oContext;
330
+
331
+ bSuccess = oEvent.getParameter('success');
332
+ oContext = oEvent.getParameter('context');
333
+
334
+ if (bSuccess) {
335
+ oBinding.detachCreateCompleted(fnCreateCompleted);
336
+ fnResolve(oContext.getObject()['FileShareItemContentLink']);
337
+ } else {
338
+ oContext.destroy();
339
+ fnReject();
340
+ }
341
+ }
342
+
343
+ oBinding.attachCreateCompleted(fnCreateCompleted);
344
+ oBinding.create(mCloudFileInfo, /* bSkipRefresh */ true);
345
+ });
346
+ };
347
+
348
+ /**
349
+ * Exports the data as defined via parameter.
350
+ *
351
+ * @param {object} mExportSettings ExportSettings that are used for the export
352
+ * @returns {Promise} A Promise that gets resolved after the export process has been finished
353
+ *
354
+ * @since 1.102
355
+ * @public
356
+ */
357
+ ExportHandler.prototype.export = function(mExportSettings) {
358
+ if (this.bIsDestroyed) {
359
+ Promise.reject('ExportHandler must not be used after calling #destroy');
360
+ }
361
+
362
+ return this.getExportInstance(mExportSettings).then(function(oExportInstance) {
363
+ return oExportInstance.build().finally(function() {
364
+ oExportInstance.destroy();
365
+ });
366
+ });
367
+ };
368
+
369
+ /**
370
+ * Exports the data as defined by the user. This function
371
+ * will show up a export settings dialog where the user
372
+ * can define certain settings that influence the output
373
+ * of the export functionality.
374
+ *
375
+ * @param {object} oSettings General export settings containing workbook and dataSource information
376
+ * @param {function} [fnResolveColumnLabel] Resolves the label for a particular column that is not directly reflected
377
+ * @returns {Promise} A Promise that resolves once the data has been exported
378
+ *
379
+ * @since 1.102
380
+ * @public
381
+ */
382
+ ExportHandler.prototype.exportAs = function(oSettings, fnResolveColumnLabel) {
383
+ var that = this;
384
+ var mExportSettings = Object.assign({}, oSettings, this._mDialogSettings);
385
+ var mUserSettings = {};
386
+
387
+ if (this.bIsDestroyed) {
388
+ return Promise.reject('ExportHandler must not be used after calling #destroy');
389
+ }
390
+
391
+ return this.fetchDataSource().then(function(oDestination) {
392
+ return ExportUtils.getExportSettingsViaDialog(mExportSettings, that._mCapabilities, !!oDestination);
393
+ }).then(function(mDialogSettings) {
394
+
395
+ /* Cache settings dialog settings */
396
+ that._mDialogSettings = mDialogSettings;
397
+
398
+ /* Merge export settings with user settings from the dialog */
399
+ Object.assign(mExportSettings, mDialogSettings);
400
+ ExportUtils.validateFileSettings(mExportSettings);
401
+
402
+ mUserSettings.splitCells = mDialogSettings.splitCells;
403
+ mUserSettings.includeFilterSettings = mDialogSettings.includeFilterSettings;
404
+
405
+ /* Split columns if configured */
406
+ if (mDialogSettings.splitCells) {
407
+ mExportSettings.workbook.columns = ExportUtils.splitColumns(mExportSettings.workbook.columns, fnResolveColumnLabel);
408
+ }
409
+
410
+ if (mDialogSettings.includeFilterSettings) {
411
+ return ExportUtils.parseFilterConfiguration(oSettings.dataSource, fnResolveColumnLabel);
412
+ }
413
+
414
+ return Promise.resolve();
415
+ }).then(function(oFilterConfig) {
416
+ if (oFilterConfig) {
417
+ var oContext = mExportSettings.workbook.context;
418
+
419
+ if (!oContext) {
420
+ oContext = mExportSettings.workbook.context = {};
421
+ }
422
+
423
+ oContext.metaSheetName = oFilterConfig.name;
424
+ oContext.metainfo = Array.isArray(oContext.metainfo) ? oContext.metainfo.push(oFilterConfig) : [oFilterConfig];
425
+ }
426
+ }).then(function() {
427
+ if (mExportSettings.destination === Destination.LOCAL) {
428
+ return Promise.resolve();
429
+ }
430
+
431
+ return that.fetchDataSource().then(function(oDataSource) {
432
+ return that.getRemoteFileLocation(oDataSource, mExportSettings.fileName);
433
+ });
434
+ }).then(function(mCloudFileInfo) {
435
+ return that.getExportInstance(mExportSettings, mUserSettings, mCloudFileInfo).then(function(oExportInstance) {
436
+ return oExportInstance.build().finally(function() {
437
+ oExportInstance.destroy();
438
+ });
439
+ });
440
+ }).catch(ExportDialog.showErrorMessage);
441
+ };
442
+
443
+ /**
444
+ * Returns the <code>ODataModel</code> that is required to
445
+ * create or update binding contexts.
446
+ *
447
+ * @param {object} oDataSource DataSource obtained by the FileShareSupport module
448
+ * @returns {sap.ui.model.odata.v4.ODataModel} ODataModel for the FileShareSupport service
449
+ */
450
+ ExportHandler.prototype._getModel = function(oDataSource) {
451
+ if (!this._oModel) {
452
+ this._oModel = new ODataModel({
453
+ serviceUrl: oDataSource.uri,
454
+ synchronizationMode: 'None',
455
+ autoExpandSelect: true
456
+ });
457
+ }
458
+
459
+ return this._oModel;
460
+ };
461
+
462
+ return ExportHandler;
463
+ }, /* bExports */ true);