⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 proassignwebinfoutil.java.svn-base

📁 一个timesheet程序,用来统计开发人员的度量衡web在线程序.用于软件行业
💻 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 + -