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

📄 bulletinserviceimp.java

📁 天乙社区6.0是一套基于JAVA技术的网络虚拟社区
💻 JAVA
字号:
package com.laoer.bbscs.business.service;

import com.laoer.bbscs.business.IBulletinService;
import com.laoer.bbscs.dao.IBulletinDAO;
import com.laoer.bbscs.bean.Bulletin;
import com.laoer.bbscs.sys.PageList;
import com.laoer.bbscs.sys.Pages;
import com.laoer.bbscs.sys.SysUtil;
import com.laoer.bbscs.sys.Constant;
import com.laoer.comm.util.*;
import java.util.*;

/**
 * <p>Title: TianYi BBS</p>
 * <p>Description: TianYi BBS System</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: LAOER.COM/TIANYISOFT.NET</p>
 * @author laoer
 * @version 6.0
 */

public class BulletinServiceImp
    implements IBulletinService {

  private IBulletinDAO bulletinDAO;

  public BulletinServiceImp() {
  }

  /**
   * getBulletinDAO
   *
   * @return IBulletinDAO
   * @todo Implement this com.laoer.bbscs.business.IBulletinService method
   */
  public IBulletinDAO getBulletinDAO() {
    return this.bulletinDAO;
  }

  /**
   * setBulletinDAO
   *
   * @param bulletinDAO IBulletinDAO
   * @todo Implement this com.laoer.bbscs.business.IBulletinService method
   */
  public void setBulletinDAO(IBulletinDAO bulletinDAO) {
    this.bulletinDAO = bulletinDAO;
  }

  /**
   * saveBulletin
   *
   * @param bulletin Bulletin
   * @return Bulletin
   * @todo Implement this com.laoer.bbscs.business.IBulletinService method
   */
  public Bulletin saveBulletin(Bulletin bulletin) {
    bulletin = getBulletinDAO().saveBulletin(bulletin);
    createBulletinFile();
    return bulletin;
  }

  /**
   * getBulletin
   *
   * @param id long
   * @return Bulletin
   * @todo Implement this com.laoer.bbscs.business.IBulletinService method
   */
  public Bulletin getBulletin(long id) {
    return this.getBulletinDAO().getBulletin(id);
  }

  /**
   * getBulletinList
   *
   * @param pages Pages
   * @return PageList
   * @todo Implement this com.laoer.bbscs.business.IBulletinService method
   */
  public PageList getBulletinList(Pages pages) {
    //return this.getBulletinDAO().getBulletinList(pages);

    PageList pl = new PageList();

    if (pages.getTotals() == -1) {
      pages.setTotals(this.getBulletinDAO().getBulletinNum());
    }
    pages.doPageBreak();

    List l = this.getBulletinDAO().getBulletinList(pages.getSpage(),
        pages.getPerPageNum());

    pl.setObjectList(l);
    pl.setPageShowString(pages.getListPageBreak());
    pl.setPages(pages);
    return pl;

  }

  /**
   * removeBulletin
   *
   * @param id long
   * @todo Implement this com.laoer.bbscs.business.IBulletinService method
   */
  public void removeBulletin(long id) {
    this.getBulletinDAO().removeBulletin(id);
    createBulletinFile();
  }

  public void createBulletinFile() {
    Pages pages = new Pages();
    pages.setPage(1);
    pages.setPerPageNum(10);
    pages.setTotals(10);
    PageList pl = this.getBulletinList(pages);
    List l = pl.getObjectList();
    int len = l.size();
    Bulletin bull;
    StringBuffer sb = new StringBuffer();
    System.out.println(len);
    for (int i = 0; i < len; i++) {
      bull = (Bulletin) l.get(i);
      sb.append("<a href='bulllist");
      sb.append(Constant.FILEPREFIX);
      sb.append("#");
      sb.append(bull.getId().longValue());
      sb.append("'>");
      sb.append(bull.getTitle());
      sb.append("</a>    ");
    }
    FileIO.writeFile(sb.toString(),
                     SysUtil.getIncludeFilePath() + Constant.BULLETINFILE,
                     Constant.CHARSET);
  }

}

⌨️ 快捷键说明

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