Further work on statistics display
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Wed, 25 May 2011 17:42:50 +0000 (17:42 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Wed, 25 May 2011 17:42:50 +0000 (17:42 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4163 e3abac25-378b-4346-85de-24260fe3988d

webservices/compbio/stat/collector/StatDB.java
webservices/compbio/stat/collector/StatManager.java [deleted file]
webservices/compbio/stat/collector/StatProcessor.java
webservices/compbio/stat/servlet/AnnualStat.java [new file with mode: 0644]
webservices/compbio/stat/servlet/DisplayStat.java
webservices/compbio/stat/servlet/YearStat.java [deleted file]
webservices/compbio/stat/servlet/util/StatCollection.java [new file with mode: 0644]
webservices/compbio/stat/servlet/util/Totals.java [moved from webservices/compbio/stat/servlet/Totals.java with 59% similarity]

index dd7e2b7..c58974b 100644 (file)
@@ -8,6 +8,7 @@ import java.sql.SQLException;
 import java.sql.Statement;\r
 import java.sql.Timestamp;\r
 import java.util.ArrayList;\r
+import java.util.Date;\r
 import java.util.List;\r
 import java.util.Set;\r
 \r
@@ -32,15 +33,23 @@ public class StatDB {
 \r
        private static final Logger log = Logger.getLogger(StatDB.class);\r
 \r
-       Connection conn;\r
-       private static Connection getDBConnection() throws SQLException {\r
-               String dbpath = PropertyHelperManager.getLocalPath();\r
-               log.info("Looking for JABAWS access statistics database at: " + dbpath);\r
-               System.setProperty("derby.system.home", dbpath);\r
-               Connection conn = DriverManager.getConnection(protocol + statDBName\r
-                               + ";create=false");\r
+       static Connection conn;\r
 \r
-               conn.setAutoCommit(true);\r
+       private synchronized static Connection getDBConnection()\r
+                       throws SQLException {\r
+\r
+               if (conn != null && !conn.isClosed()) {\r
+                       return conn;\r
+               } else {\r
+                       String dbpath = PropertyHelperManager.getLocalPath();\r
+                       log.info("Looking for JABAWS access statistics database at: "\r
+                                       + dbpath);\r
+                       System.setProperty("derby.system.home", dbpath);\r
+                       conn = DriverManager.getConnection(protocol + statDBName\r
+                                       + ";create=false");\r
+\r
+                       conn.setAutoCommit(true);\r
+               }\r
                return conn;\r
        }\r
 \r
@@ -142,6 +151,21 @@ public class StatDB {
                pstm.close();\r
        }\r
 \r
+       public Date getEarliestRecord() throws SQLException {\r
+               String query = "select min(start) from exec_stat";\r
+               Statement st = conn.createStatement();\r
+               ResultSet res = st.executeQuery(query);\r
+               boolean exist = res.next();\r
+               Date date = new Date();\r
+               if (exist) {\r
+                       date = res.getDate(1);\r
+               }\r
+\r
+               res.close();\r
+               st.close();\r
+               return date;\r
+       }\r
+\r
        public List<JobStat> readData(Timestamp from, Timestamp to,\r
                        Services wservice, Boolean clusterOnly) throws SQLException {\r
 \r
diff --git a/webservices/compbio/stat/collector/StatManager.java b/webservices/compbio/stat/collector/StatManager.java
deleted file mode 100644 (file)
index ede4d0c..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-package compbio.stat.collector;\r
-\r
-import java.sql.SQLException;\r
-import java.sql.Timestamp;\r
-import java.util.Calendar;\r
-import java.util.Date;\r
-import java.util.GregorianCalendar;\r
-import java.util.Iterator;\r
-import java.util.Map;\r
-import java.util.TreeMap;\r
-\r
-import compbio.ws.client.Services;\r
-\r
-public class StatManager {\r
-\r
-       static class DateRoller implements Iterator<Date> {\r
-               final Date initDate;\r
-               final Calendar calendar;\r
-\r
-               public DateRoller(Date date) {\r
-                       this.initDate = date;\r
-                       calendar = GregorianCalendar.getInstance();\r
-                       calendar.setTime(date);\r
-                       calendar.add(Calendar.MONTH, -12);\r
-               }\r
-\r
-               Date getCurrentDate() {\r
-                       return initDate;\r
-               }\r
-\r
-               @Override\r
-               public boolean hasNext() {\r
-                       return !calendar.getTime().equals(initDate);\r
-               }\r
-\r
-               @Override\r
-               public Date next() {\r
-                       calendar.add(Calendar.MONTH, 1);\r
-                       return calendar.getTime();\r
-               }\r
-\r
-               @Override\r
-               public void remove() {\r
-                       throw new UnsupportedOperationException();\r
-               }\r
-\r
-       }\r
-\r
-       void getStats() throws SQLException {\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
-\r
-               statdb = new StatDB();\r
-\r
-               // Total\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
-               // Cluster\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
-               // Local\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
-\r
-       }\r
-}\r
index 8b197f8..2e6d0eb 100644 (file)
@@ -165,4 +165,9 @@ public class StatProcessor {
                return report;\r
        }\r
 \r
+       @Override\r
+       public String toString() {\r
+               return this.reportStat();\r
+       }\r
+\r
 }\r
diff --git a/webservices/compbio/stat/servlet/AnnualStat.java b/webservices/compbio/stat/servlet/AnnualStat.java
new file mode 100644 (file)
index 0000000..b54af52
--- /dev/null
@@ -0,0 +1,44 @@
+package compbio.stat.servlet;\r
+\r
+import java.io.IOException;\r
+import java.sql.SQLException;\r
+import java.util.Date;\r
+import java.util.Map;\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.servlet.util.StatCollection;\r
+import compbio.stat.servlet.util.Totals;\r
+\r
+public class AnnualStat extends HttpServlet {\r
+\r
+       @Override\r
+       protected void doGet(HttpServletRequest req, HttpServletResponse resp)\r
+                       throws ServletException, IOException {\r
+\r
+               try {\r
+                       StatDB db = new StatDB();\r
+                       Date earliestRec = db.getEarliestRecord();\r
+                       Map<Date, StatCollection> stats = StatCollection\r
+                                       .getStats(earliestRec);\r
+                       Map<Date, Totals> monthlyTotals = StatCollection\r
+                                       .getTotalStats(stats);\r
+                       req.setAttribute("stat", monthlyTotals);\r
+                       req.setAttribute("total", Totals.sumOfTotals(monthlyTotals));\r
+\r
+                       RequestDispatcher dispatcher = req\r
+                                       .getRequestDispatcher("statpages/MonthlySummary.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
index 9f88069..957dd7b 100644 (file)
@@ -2,11 +2,13 @@ package compbio.stat.servlet;
 \r
 import java.io.IOException;\r
 import java.sql.SQLException;\r
-import java.sql.Timestamp;\r
+import java.text.DateFormat;\r
+import java.text.ParseException;\r
+import java.text.SimpleDateFormat;\r
 import java.util.Calendar;\r
 import java.util.Date;\r
+import java.util.GregorianCalendar;\r
 import java.util.Map;\r
-import java.util.TreeMap;\r
 \r
 import javax.servlet.RequestDispatcher;\r
 import javax.servlet.ServletException;\r
@@ -14,54 +16,36 @@ import javax.servlet.http.HttpServlet;
 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
+import compbio.stat.servlet.util.StatCollection;\r
+import compbio.stat.servlet.util.Totals;\r
 \r
 public class DisplayStat 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
+               String month = req.getParameter("month");\r
+               System.out.println("? " + month);\r
+               DateFormat df = SimpleDateFormat.getInstance();\r
 \r
-                       req.setAttribute("statCluster", statsCluster);\r
-                       req.setAttribute("statLocal", statsLocal);\r
-                       req.setAttribute("startDate", startDate.getTime());\r
-                       req.setAttribute("stopDate", stopDate.getTime());\r
+               try {\r
+                       Date fromDate = df.parse(month);\r
+                       Map<Date, StatCollection> statsMap = StatCollection\r
+                                       .getStats(fromDate);\r
+                       assert statsMap.size() == 1;\r
+                       StatCollection stats = statsMap.values().iterator().next();\r
+                       req.setAttribute("stat", stats.getAllStat());\r
+                       req.setAttribute("statTotal", Totals.sumStats(stats.getAllStat()));\r
+                       req.setAttribute("statTotalCluster",\r
+                                       Totals.sumStats(stats.getClusterStat()));\r
+                       req.setAttribute("statTotalLocal",\r
+                                       Totals.sumStats(stats.getLocalStat()));\r
+\r
+                       req.setAttribute("startDate", fromDate.getTime());\r
+                       Calendar c = GregorianCalendar.getInstance();\r
+                       c.setTime(fromDate);\r
+                       c.add(Calendar.MONTH, 1);\r
+                       req.setAttribute("stopDate", c.getTime());\r
 \r
                        RequestDispatcher dispatcher = req\r
                                        .getRequestDispatcher("statpages/Statistics.jsp");\r
@@ -70,8 +54,10 @@ public class DisplayStat extends HttpServlet {
                } catch (SQLException e) {\r
                        // TODO Auto-generated catch block\r
                        e.printStackTrace();\r
+               } catch (ParseException e) {\r
+                       // TODO Auto-generated catch block\r
+                       e.printStackTrace();\r
                }\r
 \r
        }\r
-\r
 }\r
diff --git a/webservices/compbio/stat/servlet/YearStat.java b/webservices/compbio/stat/servlet/YearStat.java
deleted file mode 100644 (file)
index bf975ec..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-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
diff --git a/webservices/compbio/stat/servlet/util/StatCollection.java b/webservices/compbio/stat/servlet/util/StatCollection.java
new file mode 100644 (file)
index 0000000..d6644c3
--- /dev/null
@@ -0,0 +1,180 @@
+package compbio.stat.servlet.util;\r
+\r
+import java.sql.SQLException;\r
+import java.sql.Timestamp;\r
+import java.util.Calendar;\r
+import java.util.Date;\r
+import java.util.GregorianCalendar;\r
+import java.util.Map;\r
+import java.util.TreeMap;\r
+\r
+import compbio.stat.collector.StatDB;\r
+import compbio.stat.collector.StatProcessor;\r
+import compbio.ws.client.Services;\r
+\r
+public class StatCollection {\r
+\r
+       /**\r
+        * Total number of requests\r
+        * \r
+        * incomplete abandoned cancelled\r
+        * \r
+        * @author pvtroshin\r
+        * \r
+        */\r
+\r
+       public enum Stattype {\r
+               CLUSTER, LOCAL, ALL\r
+       }\r
+\r
+       private Map<Services, StatProcessor> allStat;\r
+       private Map<Services, StatProcessor> clusterStat;\r
+       private Map<Services, StatProcessor> localStat;\r
+\r
+       public Map<Services, StatProcessor> getAllStat() {\r
+               return allStat;\r
+       }\r
+       public Map<Services, StatProcessor> getClusterStat() {\r
+               return clusterStat;\r
+       }\r
+       public Map<Services, StatProcessor> getLocalStat() {\r
+               return localStat;\r
+       }\r
+\r
+       public static Map<Date, StatCollection> getStats(int monthsToReport)\r
+                       throws SQLException {\r
+               Calendar fromCal = GregorianCalendar.getInstance();\r
+               fromCal.add(Calendar.MONTH, -monthsToReport);\r
+               return getStats(fromCal.getTime());\r
+       }\r
+\r
+       public static Map<Date, StatCollection> getStats(Date fromDate)\r
+                       throws SQLException {\r
+               Map<Date, StatCollection> allstats = new TreeMap<Date, StatCollection>();\r
+\r
+               Calendar fromCal = GregorianCalendar.getInstance();\r
+               fromCal.setTime(fromDate);\r
+               fromCal.set(Calendar.DAY_OF_MONTH, 1);\r
+\r
+               Calendar toCal = GregorianCalendar.getInstance();\r
+               toCal.setTime(new Date());\r
+\r
+               if (fromCal.after(toCal)) {\r
+                       throw new AssertionError("From Date must be before ToDate! ");\r
+               }\r
+\r
+               while (true) {\r
+                       Date from = fromCal.getTime();\r
+                       fromCal.add(Calendar.MONTH, 1);\r
+                       if (toCal.before(fromCal)) {\r
+                               allstats.put(toCal.getTime(),\r
+                                               StatCollection.newStatCollecton(from, toCal.getTime()));\r
+                               break;\r
+                       }\r
+                       // System.out.println("!" + from + " !!! " + fromCal.getTime());\r
+                       allstats.put(from,\r
+                                       StatCollection.newStatCollecton(from, fromCal.getTime()));\r
+               }\r
+               return allstats;\r
+       }\r
+       public static Map<Date, Totals> getTotalStats(\r
+                       Map<Date, StatCollection> detailedStats) {\r
+               Map<Date, Totals> totals = new TreeMap<Date, Totals>();\r
+               for (Map.Entry<Date, StatCollection> stat : detailedStats.entrySet()) {\r
+                       totals.put(stat.getKey(), Totals.sumStats(stat.getValue().allStat));\r
+               }\r
+               return totals;\r
+       }\r
+\r
+       static StatCollection newStatCollecton(Date startDate, Date endDate)\r
+                       throws SQLException {\r
+\r
+               Timestamp startStamp = new Timestamp(startDate.getTime());\r
+               Timestamp stopStamp = new Timestamp(endDate.getTime());\r
+               StatCollection collection = new StatCollection();\r
+               StatDB statdb = new StatDB();\r
+\r
+               // Total\r
+               collection.allStat = new TreeMap<Services, StatProcessor>();\r
+               for (Services service : Services.values()) {\r
+                       collection.allStat.put(\r
+                                       service,\r
+                                       new StatProcessor(statdb.readData(startStamp, stopStamp,\r
+                                                       service, null)));\r
+               }\r
+\r
+               // Cluster\r
+               collection.clusterStat = new TreeMap<Services, StatProcessor>();\r
+               for (Services service : Services.values()) {\r
+                       collection.clusterStat.put(\r
+                                       service,\r
+                                       new StatProcessor(statdb.readData(startStamp, stopStamp,\r
+                                                       service, true)));\r
+               }\r
+\r
+               // Local\r
+               collection.localStat = new TreeMap<Services, StatProcessor>();\r
+               for (Services service : Services.values()) {\r
+                       collection.localStat.put(\r
+                                       service,\r
+                                       new StatProcessor(statdb.readData(startStamp, stopStamp,\r
+                                                       service, false)));\r
+               }\r
+               return collection;\r
+       }\r
+       @Override\r
+       public int hashCode() {\r
+               final int prime = 31;\r
+               int result = 1;\r
+               result = prime * result + ((allStat == null) ? 0 : allStat.hashCode());\r
+               result = prime * result\r
+                               + ((clusterStat == null) ? 0 : clusterStat.hashCode());\r
+               result = prime * result\r
+                               + ((localStat == null) ? 0 : localStat.hashCode());\r
+               return result;\r
+       }\r
+       @Override\r
+       public boolean equals(Object obj) {\r
+               if (this == obj)\r
+                       return true;\r
+               if (obj == null)\r
+                       return false;\r
+               if (getClass() != obj.getClass())\r
+                       return false;\r
+               StatCollection other = (StatCollection) obj;\r
+               if (allStat == null) {\r
+                       if (other.allStat != null)\r
+                               return false;\r
+               } else if (!allStat.equals(other.allStat))\r
+                       return false;\r
+               if (clusterStat == null) {\r
+                       if (other.clusterStat != null)\r
+                               return false;\r
+               } else if (!clusterStat.equals(other.clusterStat))\r
+                       return false;\r
+               if (localStat == null) {\r
+                       if (other.localStat != null)\r
+                               return false;\r
+               } else if (!localStat.equals(other.localStat))\r
+                       return false;\r
+               return true;\r
+       }\r
+       @Override\r
+       public String toString() {\r
+               String value = "";\r
+               for (Map.Entry<Services, StatProcessor> entry : allStat.entrySet()) {\r
+                       value += entry.getKey() + ": ";\r
+                       value += entry.getValue() + "\n";\r
+               }\r
+               for (Map.Entry<Services, StatProcessor> entry : clusterStat.entrySet()) {\r
+                       value += entry.getKey() + ": ";\r
+                       value += entry.getValue() + "\n";\r
+               }\r
+               for (Map.Entry<Services, StatProcessor> entry : localStat.entrySet()) {\r
+                       value += entry.getKey() + ": ";\r
+                       value += entry.getValue() + "\n";\r
+               }\r
+               return value;\r
+       }\r
+\r
+}\r
@@ -1,5 +1,6 @@
-package compbio.stat.servlet;\r
+package compbio.stat.servlet.util;\r
 \r
+import java.util.Date;\r
 import java.util.Map;\r
 \r
 import compbio.stat.collector.StatProcessor;\r
@@ -32,7 +33,20 @@ public class Totals {
                return failed;\r
        }\r
 \r
-       static Totals sumStats(Map<Services, StatProcessor> stat) {\r
+       public static Totals sumOfTotals(Map<Date, Totals> stat) {\r
+               Totals total = new Totals();\r
+               for (Map.Entry<Date, Totals> entry : stat.entrySet()) {\r
+                       Totals mtotal = entry.getValue();\r
+                       total.total += mtotal.getTotal();\r
+                       total.incomplete += mtotal.getIncomplete();\r
+                       total.abandoned += mtotal.getAbandoned();\r
+                       total.cancelled += mtotal.getCancelled();\r
+                       total.failed += mtotal.getFailed();\r
+               }\r
+               return total;\r
+       }\r
+\r
+       public static Totals sumStats(Map<Services, StatProcessor> stat) {\r
                Totals total = new Totals();\r
                for (Map.Entry<Services, StatProcessor> serv : stat.entrySet()) {\r
                        total.total += serv.getValue().getJobNumber();\r