?? bulletinserviceimp.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 + -