BlogServiceImp.java
资源名称:Myblog.rar [点击查看]
上传用户:wlfwy2004
上传日期:2016-12-12
资源大小:33978k
文件大小:2k
源码类别:
Jsp/Servlet
开发平台:
Java
- package com.opensource.blog.service.imp;
- import java.util.List;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import com.laoer.comm.web.PageList;
- import com.laoer.comm.web.Pages;
- import com.opensource.blog.dao.BlogDAO;
- import com.opensource.blog.exception.BlogException;
- import com.opensource.blog.model.Blog;
- import com.opensource.blog.service.BlogService;
- public class BlogServiceImp
- implements BlogService {
- private static final Log logger = LogFactory.getLog(BlogServiceImp.class);
- private BlogDAO blogDAO;
- public BlogServiceImp() {
- }
- /**
- *
- * @param blog Blog
- * @return Blog
- * @throws BlogException
- * @todo Implement this com.opensource.blog.service.BlogService method
- */
- public Blog saveBlog(Blog blog) throws BlogException {
- try {
- return this.getBlogDAO().saveBlog(blog);
- }
- catch (Exception ex) {
- logger.error(ex);
- throw new BlogException(ex);
- }
- }
- public Blog findBlogByID(long id) {
- return this.getBlogDAO().findBlogByID(id);
- }
- /**
- *
- * @param userName String
- * @return Blog
- * @todo Implement this com.opensource.blog.service.BlogService method
- */
- public Blog findBlogByUserName(String userName) {
- return this.getBlogDAO().findBlogByUserName(userName);
- }
- /**
- *
- * @param blog Blog
- * @todo Implement this com.opensource.blog.service.BlogService method
- */
- public void createBlogIndexFile(Blog blog) {
- }
- public PageList findBlogAll(Pages pages) {
- PageList pl = new PageList();
- if (pages.getTotals() == -1) {
- pages.setTotals(this.getBlogDAO().getBlogCount());
- }
- pages.doPageBreak();
- List l = this.getBlogDAO().findBlogAll(pages.getSpage(), pages.getPerPageNum());
- pl.setObjectList(l);
- pl.setPageShowString(pages.getListPageBreak());
- pl.setPages(pages);
- return pl;
- }
- public BlogDAO getBlogDAO() {
- return blogDAO;
- }
- public void setBlogDAO(BlogDAO blogDAO) {
- this.blogDAO = blogDAO;
- }
- }