as reintegration failed i copied the statistic files manually into the trunk, and...
[cdmlib.git] / cdmlib-services / src / main / java / eu / etaxonomy / cdm / api / service / statistics / Statistics.java
1 // $Id$
2 /**
3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10 package eu.etaxonomy.cdm.api.service.statistics;
11
12 import java.util.ArrayList;
13 import java.util.HashMap;
14 import java.util.List;
15 import java.util.Map;
16
17 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
18
19 /**
20 * This class is meant to hold the result of a statistical request to a CDM
21 * Store. It e.g. holds the information how many classifications, taxa, names,
22 * synonyms, references, etc. are stored in the store. This information may also
23 * be hold for certain parts of a store. E.g. may store the statistical
24 * information for each classification. This partitioninc is recursive so a
25 * partition is again represented by a {@link Statistics}.
26 *
27 * @author a.mueller, a.kohlbecker, s.buers
28 * @date 21.09.2012
29 */
30 public class Statistics {
31
32 private StatisticsConfigurator request;
33
34 // it's a pitty, but for JSON Map keys must be Strings
35 // see also: JSONObject _fromMap( Map map, JsonConfig jsonConfig )
36 // --> TODO: modify MapJSONValueProcessor.processArrayValue(Object value,
37 // JsonConfig jsonConfig)???
38
39 private Map<String, Number> countMap;
40
41 public Statistics(StatisticsConfigurator configurator) {
42 this.request = configurator;
43 this.countMap = new HashMap<String, Number>();
44 }
45
46 public void setRequest(StatisticsConfigurator request) {
47 this.request = request;
48 }
49
50 public StatisticsConfigurator getRequest() {
51 return request;
52 }
53
54 public Map<String, Number> getCountMap() {
55 return countMap;
56 }
57
58 public void addCount(StatisticsTypeEnum type, Long number) {
59 this.countMap.put(type.getLabel(), number);
60 }
61
62 }