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:
@@ -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.mvc.SimpleFormController;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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.mvc.SimpleFormController;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
@@ -13,16 +13,16 @@ import org.apache.commons.logging.LogFactory;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
public class SArticleController extends SimpleFormController {
|
public class SArticleControllerOK extends SimpleFormController {
|
||||||
|
|
||||||
protected final Log logger = LogFactory.getLog(getClass());
|
protected final Log logger = LogFactory.getLog(getClass());
|
||||||
|
|
||||||
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
|
||||||
throws ServletException, IOException {
|
throws ServletException, IOException {
|
||||||
|
|
||||||
logger.info("Returning submissionArticle view");
|
logger.info("Returning submission OK view");
|
||||||
|
|
||||||
return new ModelAndView("submissionArticle");
|
return new ModelAndView("submissionArticleOK");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
46
YACOSWeb/src/org/yacos/web/author/form/FormSubmission.java
Normal file
46
YACOSWeb/src/org/yacos/web/author/form/FormSubmission.java
Normal 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user