?? proassignwebinfoutil.java.svn-base
字號:
package com.nsi.components.web.util;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.nsi.control.exceptions.NsiEventException;
import com.nsi.persistence.DataSrcUtil;
import com.nsi.persistence.IsqlDataSource;
import com.nsi.util.ValHelper;
/**
* @author Chris Ye, created on Oct 8, 2008
*
* ProAssignWebInfoUtil
*/
public final class ProAssignWebInfoUtil
{
private static Log log = LogFactory.getLog(ProAssignWebInfoUtil.class);
/**
* private constructor of ProAssignWebInfoUtil, provent for instantiation
*/
private ProAssignWebInfoUtil()
{
}
private static class ProAssignWebInfoUtilHolder
{
static final ProAssignWebInfoUtil proAssignWebInfoUtil = new ProAssignWebInfoUtil();
}
/**
* @return an instance of ProAssignWebInfoUtil
*/
public static ProAssignWebInfoUtil getInstance()
{
return ProAssignWebInfoUtilHolder.proAssignWebInfoUtil;
}
public Map<String, String> setChargetypemap() throws NsiEventException
{
Map<String, String> chargetypemap = new HashMap<String, String>();
List<Map<String,String>> result = new ArrayList<Map<String,String>>();
String sSql = "select chargetypeid, chargetype from ct_charge_type order by chargetypeid";
IsqlDataSource src = DataSrcUtil.getInstance().getDataSource();
Connection conn = null;
try
{
conn = src.getConnection();
result = src.executeRetrieve(conn, sSql);
}
catch( SQLException se )
{
log.error( "getEmployeeTypeList() caught SQLException: " + se );
}
catch( Exception ex )
{
log.error( "getEmployeeTypeList() caught Exception: " + ex );
}
finally
{
src.closeConn(conn);
}
if(!result.isEmpty())
{
int size = result.size();
for (int i = 0; i < size; i++)
{
Map<String,String> resultmap = result.get(i);
chargetypemap.put(ValHelper.getInstance().getValue(resultmap, "chargetypeid"), ValHelper.getInstance().getValue(resultmap, "chargetype"));
}
}
return chargetypemap;
}
public Map<String, String> setRolemap() throws NsiEventException
{
Map<String, String> rolemap = new HashMap<String, String>();
List<Map<String,String>> result = new ArrayList<Map<String,String>>();
String sSql = "select projroleid, projrole from ct_proj_role order by projrole";
IsqlDataSource src = DataSrcUtil.getInstance().getDataSource();
Connection conn = null;
try
{
conn = src.getConnection();
result = src.executeRetrieve(conn, sSql);
}
catch( SQLException se )
{
log.error( "getEmployeeTypeList() caught SQLException: " + se );
}
catch( Exception ex )
{
log.error( "getEmployeeTypeList() caught Exception: " + ex );
}
finally
{
src.closeConn(conn);
}
if(!result.isEmpty())
{
int size = result.size();
for (int i = 0; i < size; i++)
{
Map<String,String> resultmap = result.get(i);
rolemap.put(ValHelper.getInstance().getValue(resultmap, "projroleid"), ValHelper.getInstance().getValue(resultmap, "projrole"));
}
}
return rolemap;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -