Policy failures:

Code warning
- failed on resource author. Reason: The import java.util.Date is never used, line 14
- failed on resource web. Reason: The import java.util.Date is never used, line 14
- failed on resource controller. Reason: The import java.util.Date is never used, line 14
- failed on resource controller. Reason: The import java.util.Date is never used, line 14
- failed on resource author. Reason: The import java.util.Date is never used, line 14
... and more.  
Override reason:   
hihi
This commit is contained in:
Frederic Debuire
2007-12-14 13:13:36 +00:00
parent d99b7bb934
commit 139ea84f02
4 changed files with 107 additions and 5 deletions

View File

@@ -1,4 +1,4 @@
package org.yacos.core.web;
package org.yacos.web.author.controller;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView;

View File

@@ -0,0 +1,56 @@
package org.yacos.web.author.controller;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.view.RedirectView;
import org.yacos.core.article.*;
import org.yacos.web.author.form.*;
public class SArticleController extends SimpleFormController {
/** Logger for this class and subclasses */
protected final Log logger = LogFactory.getLog(getClass());
private IArticleManager articleManager;
public ModelAndView onSubmit(Object command)
throws ServletException {
String title = ((FormSubmission) command).getTitle();
String theme = ((FormSubmission) command).getTheme();
String mainauthor = ((FormSubmission) command).getMainauthor();
String secondaryauthor = ((FormSubmission) command).getSecondaryauthor();
String file = ((FormSubmission) command).getFile();
Article a = new Article(0, title, theme, "", mainauthor, null, 1);
articleManager.addArticle(a);
return new ModelAndView(new RedirectView(getSuccessView()));
}
protected Object formBackingObject(HttpServletRequest request) throws ServletException {
FormSubmission myArticle = new FormSubmission();
myArticle.setTitle("Le titre de l'article");
myArticle.setTheme("Le theme de l'article");
myArticle.setMainauthor("L'auteur principal");
myArticle.setSecondaryauthor("Les auteurs n°2");
myArticle.setFile("Le fichier");
return myArticle;
}
public IArticleManager getArticleManager() {
return articleManager;
}
public void setArticleManager(IArticleManager articleManager) {
this.articleManager = articleManager;
}
}

View File

@@ -1,4 +1,4 @@
package org.yacos.core.web;
package org.yacos.web.author.controller;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView;
@@ -13,16 +13,16 @@ import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import java.util.Date;
public class SArticleController extends SimpleFormController {
public class SArticleControllerOK extends SimpleFormController {
protected final Log logger = LogFactory.getLog(getClass());
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
logger.info("Returning submissionArticle view");
logger.info("Returning submission OK view");
return new ModelAndView("submissionArticle");
return new ModelAndView("submissionArticleOK");
}
}

View File

@@ -0,0 +1,46 @@
package org.yacos.web.author.form;
public class FormSubmission {
private String title;
private String theme;
private String mainauthor;
private String secondaryauthor;
private String file;
public FormSubmission() {
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getTheme() {
return theme;
}
public void setTheme(String theme) {
this.theme = theme;
}
public String getMainauthor() {
return mainauthor;
}
public void setMainauthor(String mainauthor) {
this.mainauthor = mainauthor;
}
public String getSecondaryauthor() {
return secondaryauthor;
}
public void setSecondaryauthor(String secondaryauthor) {
this.secondaryauthor = secondaryauthor;
}
public String getFile() {
return file;
}
public void setFile(String file) {
this.file = file;
}
}