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

来源:互联网 发布:怎样投诉淘宝卖家客服 编辑:程序博客网 时间:2024/06/06 10:00

新建个文本文档,保存名字为 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 .
 页面上就会显示。

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

 

以后很多事情都可以这么做。

原创粉丝点击