1、服务接口
当扩展插件需要调用系统原有方法时,建议使用SDK中的services接口进行调用以统一管理。 服务器端SDK通过Java API提供七项服务接口:
服务接口名称 | 描述 |
---|---|
smartbi.sdk.service.analysisreport.AnalysisReportService | 多维服务接口。 |
smartbi.sdk.service.catalog.CatalogService | 资源目录服务接口。 |
smartbi.sdk.service.managereport.ManageReportService | 指标类报表和复杂报表服务对象,包括取报表对象、汇总报表、校验报表等。 |
smartbi.sdk.service.operationLog.OperationLogService | 此类为smartbi操作日志的服务接口,提供对日志操作需要的方法。 |
smartbi.sdk.service.simplereport.SimpleReportService | 提供Report对象的工厂方法,实现报表的相关操作。 |
smartbi.sdk.service.systemconfig.SystemConfigService | 此类为系统设置的服务接口,获取系统设置选取项。 |
smartbi.sdk.service.user.UserManagerService | 此类为用户管理模块的服务接口,提供对用户进行管理时需要的方法,包括新建、修改、删除用户,新建、修改、删除组,新建、修改、删除角色, 给用户设置所属组、给角色添加用户等。 |
- 具体描述请参考Smartbi 服务器端SDK文档。
2、调用示例
请参考以下调用示例代码。
//获取本地连接 LocalClientConnector conn = new LocalClientConnector(); //资源目录树 CatalogService catalogService = new CatalogService(conn); String elementId = "I2c9490741d4647ab011d4b92363f2061"; String elementType = "SIMPLE_REPORT"; boolean result = catalogService.isCatalogElementAccessible(elementId, elementType); System.out.println(result); //灵活报表 SimpleReportService simpleReportService = new SimpleReportService(conn); String reportId = "I2c9490741d2370a8011d2df3b1fd1fa0"; Report report = simpleReportService.openReport(reportId); System.out.println(report.getCurrentReportName()); //指标类报表 ManageReportService reportService = new ManageReportService (conn); //用户管理 UserManagerService userManagerService = new UserManagerService(conn); String departmentId = "DEPARTMENT"; IDepartment department = userManagerService.getDepartmentById(departmentId); System.out.println(department.getName());