typos
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / statistics / Statistics.java
index 9750d419187df99e701fad0eeaaef024c464c0f1..be0b9041b502c111d8d2867127fc8239cbfb5d86 100644 (file)
@@ -1,43 +1,48 @@
 // $Id$\r
 /**\r
-* Copyright (C) 2009 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
+ * Copyright (C) 2009 EDIT\r
+ * European Distributed Institute of Taxonomy \r
+ * http://www.e-taxonomy.eu\r
+ \r
+ * The contents of this file are subject to the Mozilla Public License Version 1.1\r
+ * See LICENSE.TXT at the top of this package for the full license terms.\r
+ */\r
 package eu.etaxonomy.cdm.api.service.statistics;\r
 \r
+import java.util.ArrayList;\r
+import java.util.HashMap;\r
 import java.util.List;\r
 import java.util.Map;\r
 \r
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;\r
 \r
 /**\r
- * This class is meant to hold the result of a statistical request\r
- * to a CDM Store.\r
- * It e.g. holds the information how many classifications, taxa,\r
- * names, synonyms, references, etc. are stored in the store.\r
- * This information may also be hold for certain parts of a store. E.g.\r
- * may store the statistical information for each classification.\r
- * This partitioninc is recursive so a partition is again represented\r
- * by a {@link Statistics}.\r
+ * This class is meant to hold the result of a statistical request to a CDM\r
+ * Store. It e.g. holds the information how many classifications, taxa, names,\r
+ * synonyms, references, etc. are stored in the store. This information may also\r
+ * be hold for certain parts of a store. E.g. may store the statistical\r
+ * information for each classification. This partitioninc is recursive so a\r
+ * partition is again represented by a {@link Statistics}.\r
  * \r
- * @author a.mueller\r
+ * @author a.mueller, a.kohlbecker, s.buers\r
  * @date 21.09.2012\r
  */\r
 public class Statistics {\r
-       \r
+\r
        private StatisticsConfigurator request;\r
-       \r
-       private Map<StatisticsTypeEnum, Number> countMap;\r
-       \r
-       private Map<StatisticsPartEnum, Map<IdentifiableEntity, Statistics>> partList;\r
 \r
-       \r
-       \r
-       \r
+       // it's a pitty, but for JSON Map keys must be Strings\r
+       // see also: JSONObject _fromMap( Map map, JsonConfig jsonConfig )\r
+       // --> TODO: modify MapJSONValueProcessor.processArrayValue(Object value,\r
+       // JsonConfig jsonConfig)???\r
+\r
+       private Map<String, Number> countMap;\r
+\r
+       public Statistics(StatisticsConfigurator configurator) {\r
+               this.request = configurator;\r
+               this.countMap = new HashMap<String, Number>();\r
+       }\r
+\r
        public void setRequest(StatisticsConfigurator request) {\r
                this.request = request;\r
        }\r
@@ -46,12 +51,12 @@ public class Statistics {
                return request;\r
        }\r
 \r
-       public Map<StatisticsTypeEnum, Number> getCountMap() {\r
+       public Map<String, Number> getCountMap() {\r
                return countMap;\r
        }\r
 \r
-       public Map<StatisticsPartEnum, Map<IdentifiableEntity, Statistics>> getPartList() {\r
-               return partList;\r
+       public void addCount(StatisticsTypeEnum type, Long number) {\r
+               this.countMap.put(type.getLabel(), number);\r
        }\r
        \r
 }\r