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

📄 rsmailinfoutil.java.svn-base

📁 一个timesheet程序,用来统计开发人员的度量衡web在线程序.用于软件行业
💻 SVN-BASE
字号:
package com.nsi.scheduling;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
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 10, 2008
 *
 * RsMailInfoUtil
 */
public final class RsMailInfoUtil
{
	private static Log log = LogFactory.getLog(RsMailInfoUtil.class);
	/**
	 * private constructor of RsMailInfoUtil, prevent instantiation
	 */
	private RsMailInfoUtil()
	{
	}
	private static class RsMailInfoUtilHolder
	{
		static final RsMailInfoUtil rsMailInfoUtil = new RsMailInfoUtil();
	}
	/**
	 * @return an instance of RsMailInfoUtil
	 */
	public static RsMailInfoUtil getInstance()
	{
		return RsMailInfoUtilHolder.rsMailInfoUtil;
	}
	public List<RsEmailInfo> getEmaillist() throws NsiEventException
	{
		List<RsEmailInfo> emaillist = new ArrayList<RsEmailInfo>();
		List<Map<String,String>> result = new ArrayList<Map<String,String>>();
		String sSql = 	"select a.firstname, a.lastname, a.middlename, a.email " + 
							"from t_resource a, t_res_position b " + 
							"where a.resourceid = b.resourceid " + 
							"and b.departmentid in(2,8) " + 
							"and a.bactive = 'T' " + 
							"order by a.firstname desc, a.lastname desc";
		IsqlDataSource src = DataSrcUtil.getInstance().getDataSource();
		Connection conn = null;
		try
		{
			conn = src.getConnection();
			result = src.executeRetrieve(conn, sSql);
		}
		catch(SQLException se)
		{
			log.error("getEmaillist() -- caught SQLException: ", se);
			throw new NsiEventException( "getEmaillist() -- caught SQLException: ", se );
		}
		catch(Exception ex)
		{
			log.error("getEmaillist() -- caught Exception: ",  ex);
			throw new NsiEventException( "getEmaillist() -- 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);
				RsEmailInfo info = new RsEmailInfo();
				String email = ValHelper.getInstance().getValue(resultmap, "email");
				if( ValHelper.getInstance().isNotNullAndEmpty(email))
				{
					info.setFirstname(ValHelper.getInstance().getValue(resultmap, "firstname"));
					info.setLastname(ValHelper.getInstance().getValue(resultmap, "lastname"));
					info.setMiddlename(ValHelper.getInstance().getValue(resultmap, "middlename"));
					info.setEmail(email);
					emaillist.add(info);
				}
			}
		}
		return emaillist;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -