Merged sdd-branch to trunk.
[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 // private Map<StatisticsTypeEnum, Number> countMap;
35
36 // private Map<StatisticsPartEnum, Map<IdentifiableEntity, Statistics>>
37 // partList;
38
39 private List<IdentifiableEntity> about;
40
41 // it's a pitty, but for JSON Map keys must be Strings
42 // see also: JSONObject _fromMap( Map map, JsonConfig jsonConfig )
43 // --> TODO: modify MapJSONValueProcessor.processArrayValue(Object value,
44 // JsonConfig jsonConfig)???
45
46 private Map<String, Number> countMap;
47
48 public Statistics(StatisticsConfigurator configurator) {
49 this.request = configurator;
50 this.countMap = new HashMap<String, Number>();
51
52 this.about = new ArrayList<IdentifiableEntity>();
53 }
54
55 public void setRequest(StatisticsConfigurator request) {
56 this.request = request;
57 }
58
59 public StatisticsConfigurator getRequest() {
60 return request;
61 }
62
63 public Map<String, Number> getCountMap() {
64 return countMap;
65 }
66
67 public void addCount(StatisticsTypeEnum type, Integer number) {
68 this.countMap.put(type.getLabel(), number);
69 }
70
71 // public Map<StatisticsPartEnum, Map<IdentifiableEntity, Statistics>>
72 // getPartList() {
73 // // return part;
74 // }
75
76 }