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.core.evaluation.IEvaluationManager;
import org.yacos.core.evaluation.Report;


public class ListReportController extends SimpleFormController {

    protected final Log logger = LogFactory.getLog(getClass());
  
    private IEvaluationManager evaluationManager;

	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException, NoConferenceSelectedException {
		
        logger.info("Returning listReport view");
        
        List<Report> listReport;
        String id=request.getParameter("id");
        int idd=Integer.parseInt(id);
		
		listReport = evaluationManager.getReportsForArticle(idd);
	 getServletContext().setAttribute("listReport", listReport);
		
        return new ModelAndView("listReport");
    }
	
    public IEvaluationManager getEvaluationManager() {
		return evaluationManager;
	}

	public void setEvaluationManager(IEvaluationManager evaluationManager) {
		this.evaluationManager = evaluationManager;
	}
}