userinfoserviceimp.java

来自「是一个网站的博客系统」· Java 代码 · 共 108 行

JAVA
108
字号
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;
  }
}

⌨️ 快捷键说明

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