package cn.cocoa.career.action;
import java.io.File;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import cn.cocoa.career.service.IArticleService;
import cn.cocoa.career.model.Article;
import cn.cocoa.career.model.User;
import cn.cocoa.career.commons.Pager;
import cn.cocoa.career.commons.PagerService;
import com.opensymphony.xwork2.ActionSupport;
@SuppressWarnings(“serial“)
public class ArticleAction extends ActionSupport {
// COMMON
private IArticleService articleService;
private PagerService pagerService;
// query method
private String articleType;
private int currentPage;
private String pagerMethod;
private Pager pager;
private List articleList;
// save method
private String articletitle;
private String source;
private String url;
private String content;
private File profile1;
private String profile1FileName;
private File profile2;
private String profile2FileName;
private File profile3;
private String profile3FileName;
// queryUnique method
private int articleId;
private Article article;
// deleteProfile method
private String filePath;
// deleteArticle method
private String articleIds;
public String query() throws Exception {
int totalRows = articleService.getRows(articleType);
pager = pagerService.getPager(currentPage pagerMethod totalRows);
articleList = articleService.getArticles(articleType pager);
return SUCCESS;
}
public String queryUnique() throws Exception {
article = articleService.getArticleById(articleId);
return SUCCESS;
}
public String deleteArticle() throws Exception {
String[] ids = articleIds.split(““);
for (int i = 0; i < ids.length; i++) {
Article article = articleService
.getArticleById(new Integer(ids[i]));
deleteFile(ServletActionContext.getServletContext()
.getRealPath(“/“)
+ article.getProfile1Path());
deleteFile(ServletActionContext.getServletContext()
.getRealPath(“/“)
+ article.getProfile2Path());
deleteFile(ServletActionContext.getServletContext()
.getRealPath(“/“)
+ article.getProfile3Path());
}
articleService.deleteByArticleIds(articleIds.split(““));
return SUCCESS;
}
public String deleteProfile() throws Exception {
Article article = articleService.getArticleById(articleId);
deleteFile(filePath);
if (article.getProfile1Path() != null
&& article.getProfile1Path().equals(filePath)) {
article.setProfile1(null);
article.setProfile1Path(null);
}
if (article.getProfile2Path() != null
&& article.getProfile2Path().equals(filePath)) {
article.setProfile2(null);
article.setProfile2Path(null);
}
if (article.getProfile3Path() != null
&& article.getProfile3Path().equals(filePath)) {
article.setProfile3(null);
article.setProfile3Path(null);
}
//
articleService.updateArticle
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1432 2010-05-02 20:02 SchoolCareer\.project
文件 6303 2010-05-18 23:54 SchoolCareer\src\struts.xm
l
文件 8380 2010-05-18 21:51 SchoolCareer\src\applicationContext.xml
文件 156 2010-05-18 20:44 SchoolCareer\src\jdbc.properties
文件 684 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\action\UserAction.class
文件 9000 2010-05-11 21:35 SchoolCareer\src\cn\cocoa\career\action\ArticleAction.java
文件 3083 2010-05-18 22:15 SchoolCareer\src\cn\cocoa\career\action\JobAction.java
文件 138 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\action\MenuAction.java
文件 3168 2010-05-17 21:56 SchoolCareer\src\cn\cocoa\career\action\ProfessionalAction.java
文件 2776 2010-05-12 10:39 SchoolCareer\src\cn\cocoa\career\action\QuestionAction.java
文件 4714 2010-05-16 12:44 SchoolCareer\src\cn\cocoa\career\action\UserAction.java
文件 1737 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\action\LoginAction.java
文件 519 2010-05-18 21:31 SchoolCareer\src\cn\cocoa\career\action\LogoutAction.java
文件 2945 2010-05-11 09:16 SchoolCareer\src\cn\cocoa\career\action\FileUploadAction.java
文件 4066 2010-05-18 23:58 SchoolCareer\src\cn\cocoa\career\action\CompanyAction.java
文件 4393 2010-05-16 20:57 SchoolCareer\src\cn\cocoa\career\action\linkAction.java
文件 1587 2010-05-18 21:10 SchoolCareer\src\cn\cocoa\career\action\ULoginAction.java
文件 1681 2010-05-18 21:49 SchoolCareer\src\cn\cocoa\career\action\UCompanyChangePsw.java
目录 0 2010-05-02 19:56 SchoolCareer\src\cn\cocoa\career\action
文件 693 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\dao\UserDAO.class
文件 2757 2010-05-15 21:25 SchoolCareer\src\cn\cocoa\career\dao\ArticleDAO.java
文件 798 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\dao\ArticleTypeDAO.java
文件 2200 2010-05-18 22:04 SchoolCareer\src\cn\cocoa\career\dao\JobDAO.java
文件 2006 2010-05-16 14:02 SchoolCareer\src\cn\cocoa\career\dao\linkDAO.java
文件 923 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\dao\MenuDAO.java
文件 1653 2010-05-15 23:07 SchoolCareer\src\cn\cocoa\career\dao\ProfessionalDAO.java
文件 1986 2010-05-12 10:38 SchoolCareer\src\cn\cocoa\career\dao\QuestionDAO.java
文件 2726 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\dao\UserDAO.java
文件 2459 2010-05-18 23:13 SchoolCareer\src\cn\cocoa\career\dao\CompanyDAO.java
文件 740 2010-05-10 21:24 SchoolCareer\src\cn\cocoa\career\dao\QuesionDAO.java
............此处省略702个文件信息
评论
共有 条评论