Adding JABA web services usage statistics web application. Stat database is to follow
[jabaws.git] / webservices / compbio / stat / servlet / Totals.java
1 package compbio.stat.servlet;\r
2 \r
3 import java.util.Map;\r
4 \r
5 import compbio.stat.collector.StatProcessor;\r
6 import compbio.ws.client.Services;\r
7 \r
8 public class Totals {\r
9         int total;\r
10         int incomplete;\r
11         int abandoned;\r
12         int cancelled;\r
13         int failed;\r
14 \r
15         public int getTotal() {\r
16                 return total;\r
17         }\r
18 \r
19         public int getIncomplete() {\r
20                 return incomplete;\r
21         }\r
22 \r
23         public int getAbandoned() {\r
24                 return abandoned;\r
25         }\r
26 \r
27         public int getCancelled() {\r
28                 return cancelled;\r
29         }\r
30 \r
31         public int getFailed() {\r
32                 return failed;\r
33         }\r
34 \r
35         static Totals sumStats(Map<Services, StatProcessor> stat) {\r
36                 Totals total = new Totals();\r
37                 for (Map.Entry<Services, StatProcessor> serv : stat.entrySet()) {\r
38                         total.total += serv.getValue().getJobNumber();\r
39                         total.incomplete += serv.getValue().getIncompleteJobs().size();\r
40                         total.abandoned += serv.getValue().getAbandonedJobs().size();\r
41                         total.cancelled += serv.getValue().getCancelledJobs().size();\r
42                         total.failed += serv.getValue().getFailedJobs().size();\r
43                 }\r
44                 return total;\r
45         }\r
46 }