From d922edeaefd5189dd7f34d9ded3d3b09710ec97f Mon Sep 17 00:00:00 2001 From: Jialin Wang Date: Mon, 4 Feb 2008 23:10:55 +0000 Subject: [PATCH] =?UTF-8?q?modif=20ds=20evaluation=20Policy=20failures:=20?= =?UTF-8?q?Code=20warning=20-=20failed=20on=20resource=20EvaluationControl?= =?UTF-8?q?ler.java.=20Reason:=20ArrayList=20is=20a=20raw=20type.=20Refere?= =?UTF-8?q?nces=20to=20generic=20type=20ArrayList=20should=20be=20param?= =?UTF-8?q?eterized,=20line=20100=20-=20failed=20on=20resource=20Evaluatio?= =?UTF-8?q?nController.java.=20Reason:=20The=20local=20variable=20idd=20is?= =?UTF-8?q?=20never=20read,=20line=20124=20-=20failed=20on=20resource=20Ev?= =?UTF-8?q?aluationController.java.=20Reason:=20Type=20safety:=20The=20exp?= =?UTF-8?q?ression=20of=20type=20ArrayList=20needs=20unchecked=20conversio?= =?UTF-8?q?n=20to=20conform=20to=20List,=20line=2010=20Override=20?= =?UTF-8?q?reason:=20o(=E2=88=A9=5F=E2=88=A9)o?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WEB-INF/classes/messages.properties | 3 ++ .../WEB-INF/decorators/usermenu.jsp | 2 +- .../WebContent/WEB-INF/jsp/listEvaluation.jsp | 21 ++++++++ .../controller/EvaluationController.java | 25 ++++++---- .../controller/ListEvaluationController.java | 48 +++++++++++++++++++ 5 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 YACOSWeb/WebContent/WEB-INF/jsp/listEvaluation.jsp create mode 100644 YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java diff --git a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties index 8d40cee..82450c2 100644 --- a/YACOSWeb/WebContent/WEB-INF/classes/messages.properties +++ b/YACOSWeb/WebContent/WEB-INF/classes/messages.properties @@ -124,6 +124,8 @@ evaluation.commentAuthor=Comment of author evaluation.headPage=Here is a report of the evaluation evaluation.titleArticle=The title of article is evaluation.note=The note for the criterion +evaluation.thisArticle=evaluate this article +evaluation.choose=Choose an title to evaluation from the list #Validation messages for errors submissionArticle.title=The title should not be null @@ -138,3 +140,4 @@ validate.download=download the article validate.report=consulter the result of the evaluation validate.validate=validate validate.reject=reject + diff --git a/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp b/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp index bd866c4..76819a5 100644 --- a/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp +++ b/YACOSWeb/WebContent/WEB-INF/decorators/usermenu.jsp @@ -16,7 +16,7 @@
  • ">
  • ">
  • ">
  • -
  • ">
  • +
  • ">
  • ">
  • ">
  • diff --git a/YACOSWeb/WebContent/WEB-INF/jsp/listEvaluation.jsp b/YACOSWeb/WebContent/WEB-INF/jsp/listEvaluation.jsp new file mode 100644 index 0000000..5bb4e04 --- /dev/null +++ b/YACOSWeb/WebContent/WEB-INF/jsp/listEvaluation.jsp @@ -0,0 +1,21 @@ +<%@ include file="/WEB-INF/decorators/include.jsp"%> + + + + +

    + +
      +
    • Title: ">${article.title}
    • +
    • Author: ${article.mainAuthor.firstName} ${article.mainAuthor.lastName}
    • +
    • Topic: ${article.topic}
    • +
    • ">
    • +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/EvaluationController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/EvaluationController.java index d4343f9..98c6974 100644 --- a/YACOSWeb/src/org/yacos/web/PCmember/controller/EvaluationController.java +++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/EvaluationController.java @@ -25,6 +25,7 @@ import org.yacos.core.users.User; import org.yacos.web.PCmember.form.FormEvaluation; import org.yacos.web.PCmember.form.SimpleCriterion; +import org.yacos.web.system.session.SessionService; public class EvaluationController extends SimpleFormController { @@ -87,13 +88,16 @@ public class EvaluationController extends SimpleFormController { protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { - + String id=request.getParameter("id"); + logger.info("my article's id is "+id); + + FormEvaluation fe=(FormEvaluation)command; List liste=fe.getSimpleRatings(); String commentAuthor=fe.getCommentAuthor(); String commentPCMember=fe.getCommentPCMember(); - ArrayList listeRating=new ArrayList(); + List listeRating=new ArrayList(); for(SimpleCriterion sc : liste){ @@ -109,17 +113,18 @@ public class EvaluationController extends SimpleFormController { // Article article=articleManager.getArticle(new Integer(1)); - Article article = new Article(); - article.setTitle("myTitle"); + Article article =articleManager.getArticle(Integer.parseInt(id)); + System.out.println("le title est: "+article.getTitle()); - User toto = userManager.getUser("toto"); - if(toto == null){ - toto = userManager.addUser("toto",User.hashPassword("toto"), "Toto", "Toto", "Toto corp.", "toto@totocorp.com"); + User current = SessionService.getInstance().getCurrentUser(); + if(current == null){ + current = userManager.addUser("toto",User.hashPassword("toto"), "Toto", "Toto", "Toto corp.", "toto@totocorp.com"); } - Report rpt =new Report(commentPCMember,commentAuthor,listeRating,toto,article); - //evaluationManager.addReport(article, commentPCMember, commentAuthor, listeRating, toto); - request.getSession().setAttribute("report", rpt); + int idd=Integer.parseInt(id); + Report rpt =new Report(commentPCMember,commentAuthor,listeRating,current,article); + //evaluationManager.addReport(idd, commentPCMember, commentAuthor, listeRating, current.getLogin()); + request.getSession().setAttribute("report", rpt); //Map model1 = new HashMap(); //model1.put("report", rpt); //return new ModelAndView(new RedirectView("createReport.htm"),model1); diff --git a/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java b/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java new file mode 100644 index 0000000..feb7aa7 --- /dev/null +++ b/YACOSWeb/src/org/yacos/web/PCmember/controller/ListEvaluationController.java @@ -0,0 +1,48 @@ +package org.yacos.web.PCmember.controller; + +import org.springframework.web.servlet.mvc.SimpleFormController; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import java.io.IOException; +import java.util.List; +import org.yacos.web.system.controller.NoConferenceSelectedException; +import org.yacos.web.system.session.SessionService; +import org.yacos.core.article.Article; +import org.yacos.core.article.IArticleManager; +import org.yacos.core.exceptions.ConferenceDoesntExistException; + +public class ListEvaluationController extends SimpleFormController { + + protected final Log logger = LogFactory.getLog(getClass()); + + private IArticleManager articleManager; + + public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException, NoConferenceSelectedException { + + logger.info("Returning listArticle view"); + + List
    listArticle; + try { + listArticle = articleManager.getArticles(SessionService.getInstance().getCurrentConferenceId()); + getServletContext().setAttribute("listArticle", listArticle); + } catch (ConferenceDoesntExistException e) { + logger.error(e.getMessage()); + } + + return new ModelAndView("listEvaluation"); + } + + public IArticleManager getArticleManager() { + return articleManager; + } + + public void setArticleManager(IArticleManager articleManager) { + this.articleManager = articleManager; + } +} \ No newline at end of file