1 package org
.argeo
.slc
.web
.mvc
.result
;
3 import java
.util
.Comparator
;
4 import java
.util
.SortedSet
;
5 import java
.util
.TreeSet
;
7 import javax
.servlet
.http
.HttpServletRequest
;
8 import javax
.servlet
.http
.HttpServletResponse
;
10 import org
.springframework
.web
.servlet
.ModelAndView
;
11 import org
.springframework
.web
.servlet
.mvc
.ParameterizableViewController
;
13 import org
.argeo
.slc
.core
.test
.tree
.TreeTestResult
;
14 import org
.argeo
.slc
.dao
.test
.tree
.TreeTestResultDao
;
16 public class ResultListController
extends ParameterizableViewController
{
17 private final TreeTestResultDao testResultDao
;
19 public ResultListController(TreeTestResultDao testResultDao
) {
20 this.testResultDao
= testResultDao
;
24 protected ModelAndView
handleRequestInternal(HttpServletRequest request
,
25 HttpServletResponse response
) throws Exception
{
27 ModelAndView modelAndView
= new ModelAndView();
29 Comparator
<TreeTestResult
> comparator
= new Comparator
<TreeTestResult
>() {
31 public int compare(TreeTestResult arg0
, TreeTestResult arg1
) {
32 if (arg0
.getCloseDate() != null && arg1
.getCloseDate() != null) {
33 return -arg0
.getCloseDate().compareTo(arg1
.getCloseDate());
34 } else if (arg0
.getCloseDate() != null
35 && arg1
.getCloseDate() == null) {
37 } else if (arg0
.getCloseDate() == null
38 && arg1
.getCloseDate() != null) {
41 return arg0
.getUuid().compareTo(arg1
.getUuid());
45 SortedSet
<TreeTestResult
> results
= new TreeSet
<TreeTestResult
>(
47 results
.addAll(testResultDao
.listTestResults());
48 modelAndView
.addObject("results", results
);
49 modelAndView
.setViewName(getViewName());