From 21842924fdef15275914bcc9dbdb3502ab84e02b Mon Sep 17 00:00:00 2001 From: Frederic Debuire Date: Mon, 4 Feb 2008 16:55:43 +0000 Subject: [PATCH] Diverse modif Policy failures: Code warning - failed on resource ValidateSubmission.java. Reason: Class is a raw type. References to generic type Class should be parameterized, line 10 - failed on resource DispatchArticleController.java. Reason: HashMap is a raw type. References to generic type HashMap should be parameterized, line 72 - failed on resource DispatchArticleController.java. Reason: Map is a raw type. References to generic type Map should be parameterized, line 70 - failed on resource DispatchArticleController.java. Reason: Map is a raw type. References to generic type Map should be parameterized, line 72 - failed on resource DispatchArticleController.java. Reason: The import java.util.ArrayList is never used, line 3 ... and more. Override reason: hu --- .../WEB-INF/jsp/choosePreference.jsp | 1 + .../WebContent/WEB-INF/jsp/listArticle.jsp | 11 +++++--- .../WEB-INF/jsp/submissionArticle.jsp | 5 ++-- YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml | 18 ------------- .../ChoosePreferenceController.java | 9 ++++--- .../author/controller/SArticleController.java | 8 +++--- .../author/validator/ValidateSubmission.java | 6 ++--- .../controller/DispatchArticleController.java | 27 ++++++++++++++----- 8 files changed, 42 insertions(+), 43 deletions(-) diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp index 5408f4b..0c93c84 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/choosePreference.jsp @@ -9,6 +9,7 @@ +huhu diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp index d91d7d9..e34d308 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/listArticle.jsp @@ -6,11 +6,14 @@
    -
  • ${article.title}
  • -
  • Author: ${article.mainAuthor}
  • -
  • Topic: ${article.topic}
  • +
  • ${article.title}
  • +
  • Author: ${article.mainAuthor.firstName} ${article.mainAuthor.lastName}
  • +
  • Topic: ${article.topic}
  • ">Download the article
  • -
+ +
+
+
diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp index 0d9e822..4affcbc 100644 --- a/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp +++ b/YACOSWeb/WebContent/WEB-INF/jsp/submissionArticle.jsp @@ -29,9 +29,8 @@ function Supprimer(form) {



- - -

+ : ${currentUser.firstName} ${currentUser.lastName} +

>

diff --git a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml index dcb9aba..19eb0d6 100644 --- a/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml +++ b/YACOSWeb/WebContent/WEB-INF/yacos-servlet.xml @@ -25,9 +25,6 @@ SArticleControllerOK - - ChoosePreferenceControllerOK - ListArticleController @@ -43,18 +40,6 @@ DispatchArticleController - AddConferenceController @@ -87,9 +72,6 @@ - - diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceController.java index 9a84663..46bdb5b 100644 --- a/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceController.java +++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/ChoosePreferenceController.java @@ -3,11 +3,13 @@ package org.yacos.web.PCmember.controller; import java.util.*; + import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.validation.BindException; +import org.springframework.validation.Errors; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import org.springframework.web.servlet.view.RedirectView; @@ -81,11 +83,10 @@ public class ChoosePreferenceController extends SimpleFormController { preference.getPcMember().getLogin(), preference.getPreference()); } - - Map model = new HashMap(); + + Map model = new HashMap(); model.put("message", "preference.ok"); - return new ModelAndView(new RedirectView(getSuccessView()),model); - + return new ModelAndView(new RedirectView(getSuccessView()), model); } public IArticleManager getArticleManager() { diff --git a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java index 670f55d..538a6f8 100644 --- a/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java +++ b/YACOSWeb/src/org/yacos/web/author/controller/SArticleController.java @@ -41,9 +41,9 @@ public class SArticleController extends SimpleFormController { String title = ((FormSubmission) command).getTitle(); String theme = ((FormSubmission) command).getTheme(); - String mainauthor = ((FormSubmission) command).getMainauthor(); + //String mainauthor = ((FormSubmission) command).getMainauthor(); //String secondaryauthor = ((FormSubmission) command).getSecondaryauthor(); - List liste = ((FormSubmission) command).getListe(); + List listeSecondary = ((FormSubmission) command).getListe(); String nomFile=""; @@ -73,7 +73,7 @@ public class SArticleController extends SimpleFormController { System.out.println(e); } - articleManager.addArticle(title, theme, nomFile, mainauthor, liste, Article.State.SUMMARY, conf.getId()); + articleManager.addArticle(title, theme, nomFile, user.getLogin(), listeSecondary, Article.State.SUMMARY, conf.getId()); return new ModelAndView(new RedirectView(getSuccessView())); } @@ -82,7 +82,7 @@ public class SArticleController extends SimpleFormController { FormSubmission myArticle = new FormSubmission(); myArticle.setTitle(""); myArticle.setTheme(""); - myArticle.setMainauthor(""); + //myArticle.setMainauthor(""); myArticle.setSecondaryauthor(""); return myArticle; } diff --git a/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java b/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java index 22aec2a..239c275 100644 --- a/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java +++ b/YACOSWeb/src/org/yacos/web/author/validator/ValidateSubmission.java @@ -24,7 +24,7 @@ public class ValidateSubmission implements Validator { if (title== null || title.trim().length() == 0) { arg1.rejectValue("title", "submissionArticle.title", - "Le title est n¨¦cessaire !"); + "Le title est n��cessaire !"); } @@ -42,11 +42,11 @@ public class ValidateSubmission implements Validator { } - if (mainauthor==null|mainauthor.trim().length()==0) + /*if (mainauthor==null|mainauthor.trim().length()==0) { arg1.rejectValue("mainauthor", "submissionArticle.mainauthor"); - } + }*/ /* if (file==null|file.trim().length()==0) diff --git a/YACOSWeb/src/org/yacos/web/chairman/controller/DispatchArticleController.java b/YACOSWeb/src/org/yacos/web/chairman/controller/DispatchArticleController.java index 4e3ced9..e0dca24 100644 --- a/YACOSWeb/src/org/yacos/web/chairman/controller/DispatchArticleController.java +++ b/YACOSWeb/src/org/yacos/web/chairman/controller/DispatchArticleController.java @@ -2,6 +2,8 @@ package org.yacos.web.chairman.controller; import java.util.ArrayList; import java.util.Collection; +import java.util.HashMap; +import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -9,6 +11,7 @@ import javax.servlet.http.HttpServletResponse; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.validation.BindException; +import org.springframework.validation.Errors; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.SimpleFormController; import org.yacos.core.article.Article; @@ -20,6 +23,7 @@ import org.yacos.core.users.IUserManager; import org.yacos.core.users.Role.RoleType; import org.yacos.core.users.User; import org.yacos.web.PCmember.form.FormDispatcher; +import org.yacos.web.system.session.SessionService; public class DispatchArticleController extends SimpleFormController{ @@ -57,23 +61,32 @@ public class DispatchArticleController extends SimpleFormController{ int conf_id = (Integer)request.getSession().getAttribute("idCurrentConference"); Collection members = userManager.getUsers(conf_id,RoleType.PCMEMBER); - request.getSession().setAttribute("members",members); - request.getSession().setAttribute("articles",articleManager.getArticles(conf_id)); + request.getSession().setAttribute("members",members); return new FormDispatcher(); } + @Override + protected Map referenceData(HttpServletRequest request, Object command, + Errors errors) throws Exception { + Map model = new HashMap(); + // Fetching conference + Conference conf = SessionService.getInstance().getCurrentConference(); + model.put("articles", articleManager.getArticles(conf.getId())); + return model; + } + protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, - Object formDispatcher, BindException errors) throws Exception { + Object command, BindException errors) throws Exception { - //on recupere l'id de conference - int conf_id = (Integer)request.getSession().getAttribute("idCurrentConference"); + // Fetching conference + Conference conf = SessionService.getInstance().getCurrentConference(); - FormDispatcher fd = (FormDispatcher)formDispatcher; + FormDispatcher fd = (FormDispatcher)command; Article article = articleManager.getArticle(fd.getIdArticle()); - return new ModelAndView("dispatchArticle", "articles", articleManager.getArticles(conf_id)); + return new ModelAndView("dispatchArticle", "articles", articleManager.getArticles(conf.getId())); } }