UserInfoServiceImp.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:3k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.opensource.blog.service.imp;
- import com.opensource.blog.dao.*;
- import com.opensource.blog.exception.*;
- import com.opensource.blog.model.*;
- import com.opensource.blog.service.*;
- import org.apache.commons.logging.LogFactory;
- import org.apache.commons.logging.Log;
- public class UserInfoServiceImp
- implements UserInfoService {
- private static final Log logger = LogFactory.getLog(UserInfoServiceImp.class);
- private UserInfoDAO userInfoDAO;
- private BlogDAO blogDAO;
- public UserInfoServiceImp() {
- }
- /**
- *
- * @param ui UserInfo
- * @return UserInfo
- * @throws BlogException
- * @todo Implement this com.opensource.blog.service.UserInfoService method
- */
- public UserInfo saveUserInfo(UserInfo ui) throws BlogException {
- try {
- return this.getUserInfoDAO().saveUserInfo(ui);
- }
- catch (Exception ex) {
- logger.error(ex);
- throw new BlogException(ex);
- }
- }
- /**
- *
- * @param id long
- * @return UserInfo
- * @todo Implement this com.opensource.blog.service.UserInfoService method
- */
- public UserInfo findUserInfoByID(long id) {
- return this.getUserInfoDAO().findUserInfoByID(id);
- }
- /**
- *
- * @param userName String
- * @return UserInfo
- * @todo Implement this com.opensource.blog.service.UserInfoService method
- */
- public UserInfo findUserInfoByUserName(String userName) {
- return this.getUserInfoDAO().findUserInfoByUserName(userName);
- }
- /**
- *
- * @param email String
- * @return UserInfo
- * @todo Implement this com.opensource.blog.service.UserInfoService method
- */
- public UserInfo findUserInfoByEmail(String email) {
- return this.getUserInfoDAO().findUserInfoByEmail(email);
- }
- /**
- *
- * @param ui UserInfo
- * @param blog Blog
- * @return Object[]
- * @throws BlogException
- * @todo Implement this com.opensource.blog.service.UserInfoService method
- */
- public Object[] createUserAndBlog(UserInfo ui, Blog blog) throws BlogException {
- try {
- ui = this.getUserInfoDAO().saveUserInfo(ui);
- blog = this.getBlogDAO().saveBlog(blog);
- Object[] o = {ui, blog};
- return o;
- }
- catch (Exception ex) {
- logger.error(ex);
- throw new BlogException(ex);
- }
- }
- public UserInfoDAO getUserInfoDAO() {
- return userInfoDAO;
- }
- public BlogDAO getBlogDAO() {
- return blogDAO;
- }
- public void setUserInfoDAO(UserInfoDAO userInfoDAO) {
- this.userInfoDAO = userInfoDAO;
- }
- public void setBlogDAO(BlogDAO blogDAO) {
- this.blogDAO = blogDAO;
- }
- }