页面树结构
转至元数据结尾
转至元数据起始
Sample9_5.zip

1、简介

Smartbi 提供了资源的导入、导出功能,允许在不同的服务器上进行迁移,当扩展插件增加了资源类型后,如需要实现资源迁移的功能,则可以添加导入、导出的处理类:

 

文档目录:

  1. 新建一个导出处理类继承 smartbi.catalogtree.Exporter,例如 smartbi.extension.test.TestExporter;
  2. 新建一个导入处理类继承 smartbi.catalogtree.Importer,例如 smartbi.extension.test.TestImporter;
  3. 在组件激活方法public void activate()中调用catalogTreeModule中的public void registerExporter(Importer importer, Exporter exporter);方法
  4. 在导出资源时,Smartbi会进行以下步骤:
    1. 调用Exporter中的public boolean accept(ICatalogElement element);方法,询问Exporter是否能够处理导出该节点,返回true表示当前Exporter能够处理该节点的导出。
    2. 调用Exporter中的获取到正确的public void export(ICatalogElement element, TransformerHandler handler) throws SAXException;方法导出该节点。
  5. 在导入资源时,Smartbi会进行以下步骤:
    1. 调用Importer中的public boolean accept(ImportResourceItem item);方法,询问Importer是否可以处理导入该节点,返回true表示当前Importer处理该节点的导入。
    2. 调用Importer中的获取到正确的public void importResource(ImportResourceItem item, ICatalogElement parent);方法导入该节点。

2、示例说明

其中在升级类"UpgradeTask_New.java"中创建了一个知识库表,该表与"ExtSample9_5_File.java"中的描述相对应,该资源代表需要进行导出或导入操作的资源。

资源的创建方法定义在"Sample9_5_Service.java"中,导出操作的实现定义在"Sample9_5_Exporter.java"中,导入操作的实现定义在"Sample9_5_Importer.java"中。测试界面如下:

 

3、示例代码下载

示例代码下载: Sample9_5.zip


  • 无标签