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

📄 userfaceserviceimpl.java

📁 新技术论坛系统 v1.0 前后台管理的初始用户名 : admin 密码 123456
💻 JAVA
字号:
package com.ntsky.bbs.service.impl;

import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.util.TreeMap;

import org.apache.log4j.Logger;

import com.ntsky.framework.util.security.MD5;
import com.ntsky.framework.util.TimeWatcher;

import com.ntsky.bbs.domain.UserFace;
import com.ntsky.bbs.dao.UserFaceDAO;
import com.ntsky.bbs.service.UserFaceService;
import com.ntsky.bbs.exception.DAOException;
import com.ntsky.bbs.exception.ServiceException;

/**
 * 用户表情数据处理接口
 * 
 * @author ntsky
 * @link www.ntsky.com
 * 
 * @version $Revision: 1.3 $ $Date: 2006/08/02 17:36:23 $ 
 */
public class UserFaceServiceImpl implements UserFaceService{
	
	public static Logger logger = Logger.getLogger(UserFaceServiceImpl.class); 
	
	private UserFaceDAO FaceDAO;
	
	public void setUserFaceDAO(UserFaceDAO FaceDAO){
		this.FaceDAO = FaceDAO;
	}

	/**
	 * 查询用户头像类别集合
	 * @return List 用户头像集合
	 */
	private List getFaceTypes () throws ServiceException {
		try{
			return FaceDAO.findFaceTypes();
		}
		catch(DAOException de){
			throw new ServiceException(de.getMessage());
		}
	}
	

	/**
	 * 根据类别查询用户头像集合
	 * 
	 * @param type 头像类别
	 * @return List 用户头像集合
	 */
	private List getFaces (int type) throws ServiceException {
		try{
			return FaceDAO.findFaces(type);
		}
		catch(DAOException de){
			throw new ServiceException(de.getMessage());
		}		
	}	
	
	/**
	 * 取得用户头像集合
	 * 
	 * <p>
	 * list中存储是的是一组Faces
	 * </p>
	 * 
	 * @return List 用户头像集合
	 */
	public List getFaces () throws ServiceException {
		TimeWatcher watcher = new TimeWatcher();
		watcher.start();
		List allFaces = null;
		try{
			allFaces = FaceDAO.findFaceTypes();
			Object[] typesArray = allFaces.toArray();
			if(logger.isDebugEnabled()){
				logger.debug("检测到的头像类别数 : " + typesArray.length);
			}
			UserFace face = null;
			for (int i = 0; i < typesArray.length; i++) {
				face = (UserFace)typesArray[i];
				face.setUserFaces(FaceDAO.findFaces(face.getType()));
			}
			watcher.stop();
			System.out.println(watcher);				
			return allFaces;		
		}
		catch(DAOException de){
			throw new ServiceException(de.getMessage());
		}	
	}
	
}

⌨️ 快捷键说明

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