文件导出到服务器的自定义文件管理中心接口
背景说明
...
需要支持文件在【文件导出到服务器】系统选项中新增自定义的文件服务器类型,如简道云。需要支持文件在【文件导出到服务器】系统选项中新增自定义的文件服务器类型,实现将导出的文件上传到第三方平台,如简道云等。
IFileManagerStore接口类定义
...
基本信息
...
功能 | 初始化服务器相关成员变量 |
参数说明 | serverConfig:服务器配置 |
返回值 | 无 |
PS. serverConfig调用者会获取系统选项【SPREAD注:serverConfig调用者会获取系统选项【SPREAD_SHEET_REPORT_WRITEBACK_FILE】中的单个json对象,然后往这个json对象中添加一个“offlineDirectory”键用于记录当前导出的目录,需要注意两个场景:
...
功能 | 上传文件前调用者会执行的服务器初始化动作,一般用于创建目录 |
参数说明 | 无 |
返回值 | 无 |
备注 | 继承自 smartbi.module.export.offline.downloader.IOfflineFileStorer |
...
不同场景下的接口调用情况
在线导出、离线导出后的下载
iFileManagerStore.initServer(config); iFileManagerStore.download(request, response, fileName, downloadName); |
...
说明 | 测试连接前执行的操作,用于复制服务器配置信息。 |
入参 | configObj:服务器配置信息(对象形式) currentTableLine:当前行的原始数据(数组形式) |
输出 | 无 |
扩展包使用步骤
...
1、创建类实现IFileManagerStore接口
public class CustomManagerStore implements IFileManagerStore{ //实现接口相关方法处理服务器逻辑 } |
...
2、在Module的activate()方法中注册上述接口实现类,并指定一个String的类型名
IFileManagerFactory.getInstance().registerFileManagerStoreHandlerIfNotExist("MyFileSystem",new JDYFileManagerStore()); |
...
3、创建 js/smartbi/spreadsheetreport/ftpsetting/SpreadsheetReportWriteBackFileSettingDialog.js.patch处理国际化
SpreadsheetReportWriteBackFileSettingDialog.prototype.getType_SMS_61642 = SpreadsheetReportWriteBackFileSettingDialog.prototype.getType; SpreadsheetReportWriteBackFileSettingDialog.prototype.getType = function(options){ this.getType_SMS_61642(options); //遍历options,将指定键名国际化处理 for(var i=0;i<options.length;i++){ if(options[i].value === "MyFileSystem"){ options[i].text = "自定义文件系统"; options[i].value = "自定义文件系统"; break; } } } SpreadsheetReportWriteBackFileSettingDialog.prototype.handleBeforeWriteBack_SMS_61642 = SpreadsheetReportWriteBackFileSettingDialog.prototype.handleBeforeWriteBack SpreadsheetReportWriteBackFileSettingDialog.prototype.handleBeforeWriteBack = function (obj,ctl) { this.handleBeforeWriteBack_SMS_61642(obj,ctl) if(obj.addressType ==="自定义文件系统"){ obj.addressType ="MyFileSystem"; } } SpreadsheetReportWriteBackFileSettingDialog.prototype.handleBeforeShowUp_SMS_61642 = SpreadsheetReportWriteBackFileSettingDialog.prototype.handleBeforeShowUp SpreadsheetReportWriteBackFileSettingDialog.prototype.handleBeforeShowUp = function (array,tline){ this.handleBeforeShowUp_SMS_61642(array,tline); if(array[1]==="MyFileSystem"){ array[1]="自定义文件系统"; } } |
...
4、创建js/smartbi/spreadsheetreport/ftpsetting/FTPRemovableGrid.js.patch处理国际化
FTPRemovableGrid.prototype.handleBeforeTestConnection_SMS_61642 = FTPRemovableGrid.prototype.handleBeforeTestConnection FTPRemovableGrid.prototype.handleBeforeTestConnection = function(configObj,currentTableLine){ this.handleBeforeTestConnection_SMS_61642(configObj,currentTableLine); if("自定义文件系统" === configObj.serverType){ configObj.serverType = "MyFileSystem"; } } |
扩展包示例:
View file