📄 grouplist.java
字号:
/*
* 创建日期 2005-8-26
*
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package org.infosys.logic;
import java.util.ArrayList;
import java.util.List;
import net.sf.hibernate.HibernateException;
import net.sf.hibernate.Session;
import com.infosys.Hibernate.PGroup;
import com.infosys.Hibernate.SessionFactory;
/**
* @author Administrator
* group List
*/
public class GroupList {
private List list=new ArrayList();
public GroupList(){
List group=new ArrayList();
Session session;
try {
session = SessionFactory.currentSession();
group=session.find("from PGroup p where p.status=1");
} catch (HibernateException e) {
e.printStackTrace();
} finally {
try {
SessionFactory.closeSession();
} catch (HibernateException e1) {
e1.printStackTrace();
}
}
list=new ArrayList();
PGroup pgroup;
ComParam param;
for(int i=0;i<group.size();i++){
pgroup=(PGroup)group.get(i);
param=new ComParam();
param.setParam0(pgroup.getGroupid());
param.setParam1(pgroup.getName());
list.add(param);
}
}
/**
* 有默认选项的构造器
* @param selGroup
*/
public GroupList(String selGroup){
List group=new ArrayList();
Session session;
try {
session = SessionFactory.currentSession();
group=session.find("from PGroup p where p.status=1");
} catch (HibernateException e) {
e.printStackTrace();
} finally {
try {
SessionFactory.closeSession();
} catch (HibernateException e1) {
e1.printStackTrace();
}
}
String selStatus="";
list=new ArrayList();
PGroup pgroup;
ComParam param;
for(int i=0;i<group.size();i++){
pgroup=(PGroup)group.get(i);
param=new ComParam();
param.setParam0(pgroup.getGroupid());
param.setParam1(pgroup.getName());
if(pgroup.getGroupid().equals(selGroup)){
selStatus="selected";
}else{
selStatus="";
}
param.setParam2(selStatus);
list.add(param);
}
}
/**
* @return 返回 list。
*/
public List getList() {
return list;
}
/**
* @param list 要设置的 list。
*/
public void setList(List list) {
this.list = list;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -