您的位置:首页 > 产品设计 > UI/UE

随手记下通过API获取LOV名称和UUID的便捷方式

2013-03-04 10:00 218 查看
新建个文本文档,保存名字为 xxx.bsh.

内容仿照如下:

import java.util.*;

import com.hansky.apps.butterfly.server.ButterflyServer;

import com.hansky.intf.sat.IBusObject;

import com.hansky.intf.sat.IDataCollection;

import com.hansky.intf.sat.IDataQuery;

import com.hansky.intf.sat.IFieldFilter;

import com.hansky.intf.sat.ILOV;

import com.hansky.intf.sat.IOption;

import com.hansky.intf.sat.ISession;

import com.hansky.intf.sat.PersistenceException;

import com.hansky.intf.sat.SATConstants;

ButterflyServer bs = ButterflyServer.getSingleton();

String udboid ="62BF0B61-8E59-3CA2-CBC2-4B699C3F89A5"; //UDB的 uuid

ISession session = bs.getServerContext().getUserDB(udboid).getSessionManager().createSession(); //创建session的方法

ILOV pmsflov = bs.getServerContext().getUserDB(udboid).getLovManager().getLOV("name", "pmsf_adddepa");

List arr = new ArrayList();

arr.add("xxx");

arr.add("xxx");

response.setContentType("text/html;charset=UTF-8");

for( int i = 0 ;i <arr.size() ; i++){

String name =(String)arr.get(i);

IOption op = pmsflov.getOption("text", name);

String val = op.getText("zh_CN");

response.getWriter().write(name+"-"+val+"<br>");

}

然后放到应用目录下,比如 chtml目录下。网页中访问http://xx.xx.xx.xx:7080/butterfly/xxx.bsh .

页面上就会显示。

这样就不必后台查数据库。

以后很多事情都可以这么做。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: