+++ /dev/null
-package compbio.stat.servlet;\r
-\r
-import java.io.IOException;\r
-import java.sql.SQLException;\r
-import java.sql.Timestamp;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.Map;\r
-import java.util.TreeMap;\r
-\r
-import javax.servlet.RequestDispatcher;\r
-import javax.servlet.ServletException;\r
-import javax.servlet.http.HttpServlet;\r
-import javax.servlet.http.HttpServletRequest;\r
-import javax.servlet.http.HttpServletResponse;\r
-\r
-import compbio.stat.collector.StatDB;\r
-import compbio.stat.collector.StatProcessor;\r
-import compbio.ws.client.Services;\r
-\r
-public class YearStat extends HttpServlet {\r
-\r
- @Override\r
- protected void doGet(HttpServletRequest req, HttpServletResponse resp)\r
- throws ServletException, IOException {\r
- // TODO\r
- Calendar startTime = Calendar.getInstance();\r
- startTime.roll(Calendar.YEAR, false);\r
- Timestamp startDate = new Timestamp(startTime.getTimeInMillis());\r
- Timestamp stopDate = new Timestamp(new Date().getTime());\r
- StatDB statdb = null;\r
- try {\r
- statdb = new StatDB();\r
-\r
- Map<Services, StatProcessor> stats = new TreeMap<Services, StatProcessor>();\r
- for (Services service : Services.values()) {\r
- stats.put(\r
- service,\r
- new StatProcessor(statdb.readData(startDate, stopDate,\r
- service, null)));\r
- }\r
-\r
- Map<Services, StatProcessor> statsCluster = new TreeMap<Services, StatProcessor>();\r
- for (Services service : Services.values()) {\r
- statsCluster.put(\r
- service,\r
- new StatProcessor(statdb.readData(startDate, stopDate,\r
- service, true)));\r
- }\r
-\r
- Map<Services, StatProcessor> statsLocal = new TreeMap<Services, StatProcessor>();\r
- for (Services service : Services.values()) {\r
- statsLocal.put(\r
- service,\r
- new StatProcessor(statdb.readData(startDate, stopDate,\r
- service, false)));\r
- }\r
- req.setAttribute("stat", stats);\r
- req.setAttribute("statTotal", Totals.sumStats(stats));\r
-\r
- req.setAttribute("statCluster", statsCluster);\r
- req.setAttribute("statLocal", statsLocal);\r
- req.setAttribute("startDate", startDate.getTime());\r
- req.setAttribute("stopDate", stopDate.getTime());\r
-\r
- RequestDispatcher dispatcher = req\r
- .getRequestDispatcher("statpages/Statistics.jsp");\r
- dispatcher.forward(req, resp);\r
-\r
- } catch (SQLException e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
-\r
-}\r