...
获取Smartbi的依赖jar包可到部署Smartbi的服务器上找到smartbi.war或解压出来的war包文件夹,然后到将smartbi.war\\WEB-INF\\lib\\目录下拿到依赖的jar包文件。所需的jar包参考如下文档。
...
代码块 | ||
---|---|---|
| ||
package smartbi.test.thirdparty; import java.util.List; import smartbi.sdk.ClientConnector; import smartbi.sdk.service.user.UserManagerService; import smartbi.user.IDepartment; public class SmartbiSDKTest { private final static String SMARTBI_URL = "http://localhost:18080/smartbi"; private final static String USER_NAME = "admin"; private final static String PASS_WORD = "admin"; public static void main(String[] args) { // 1、指定Smartbi服务器地址 ClientConnector connector = new ClientConnector(SMARTBI_URL); // 2、完成登录 boolean isLogin = connector.open(USER_NAME, PASS_WORD); if(!isLogin) { System.out.println("服务器登录访问失败"); return; } // 3、创建调用的接口对象 UserManagerService userManagerService = new UserManagerService(connector); List<? extends IDepartment> department = userManagerService.getDepartmentsOfCurrentUser(); for (IDepartment item : department) { System.out.println(item.getAlias()); } } } |
三、视频教学
宏代码简介:https://my.smartbi.com.cn/edu/course-148