Project

General

Profile

« Previous | Next » 

Revision e9761950

Added by Sybille Bürs over 11 years ago

replaced test class with a complete new one - first steps of testing are running

View differences:

cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/StatisticsServiceImpl.java
49 49
	private static final Logger logger = Logger
50 50
			.getLogger(StatisticsServiceImpl.class);
51 51

  
52
	private static final List<String> DESCRIPTION_SOURCE_REF_STRATEGIE = Arrays
53
			.asList(new String[] { "sources.citation" });
54
	// "descriptionSources", "citation"
55

  
56
	private static final List<String> DESCR_ELEMENT_REF_STRATEGIE = Arrays
57
			.asList(new String[] { "sources.citation", });;
58

  
59
	private List<StatisticsConfigurator> configurators;
60

  
61 52
	private ArrayList<Statistics> statisticsList;
62 53

  
63 54
	@Autowired
......
72 63
	@Autowired
73 64
	private IReferenceDao referenceDao;
74 65

  
75
	@Autowired
76
	private IDescriptionDao descriptionDao;
77

  
78
	@Autowired
79
	private IDescriptionElementDao descrElementDao;
80

  
81 66
	@Autowired
82 67
	private IStatisticsDao statisticsDao;
83 68

  
......
86 71
	 * the database referenced in the configurator
87 72
	 * 
88 73
	 * @param configurators
89
	 * @return be aware that a Statistics.countMap might contain "null" for
90
	 *         {@link Number} value, if the count failed (, if the value is "0"
91
	 *         the count succeeded and sum is 0)
74
	 * @return be aware that a Statistics.countMap might contain "null"
75
	 *         {@link Number} values, if the count failed (, if the value is "0"
76
	 *         the count succeeded in counting zero elements.)
92 77
	 */
93 78
	@Override
94 79
	@Transactional
......
116 101
		} else {
117 102
			countPart(configurator, filter);
118 103
		}
104

  
119 105
	}
120 106

  
121 107
	/**
......
175 161
			IdentifiableEntity filter) {
176 162
		// TODO maybe remove redundant parameter filter
177 163
		Statistics statistics = new Statistics(configurator);
178
		// TODO count the items in the classification - there have to be dao
179
		// method(s) for that first.
164

  
180 165
		Long counter = null;
181 166

  
182 167
		if (filter instanceof Classification) {
......
185 170

  
186 171
				switch (type) {
187 172
				case CLASSIFICATION:
188
					// there should not be any classification nested in an other
189
					// classification
173
					logger.info("there should not be any classification "
174
							+ "nested in an other classification");
190 175
					// so do nothing
191
					return;
176
					break;
192 177
				case ACCEPTED_TAXA:
193 178
					counter = statisticsDao.countTaxaInClassification(
194 179
							Taxon.class, (Classification) filter);
......
203 188
							Synonym.class, (Classification) filter);
204 189
					break;
205 190
				case TAXON_NAMES:
206
					counter = statisticsDao.countTaxonNames((Classification)filter);
191
					counter = statisticsDao
192
							.countTaxonNames((Classification) filter);
207 193
					break;
208 194
				case ALL_REFERENCES:
209 195
					break;
210 196
				case DESCRIPTIVE_SOURCE_REFERENCES:
211
					counter= statisticsDao.countDescriptiveSourceReferences((Classification) filter);
197
					counter = statisticsDao
198
							.countDescriptiveSourceReferences((Classification) filter);
212 199
					break;
213 200
				case NOMECLATURAL_REFERENCES:
214
					counter = statisticsDao.countNomenclaturalReferences((Classification) filter);
201
					counter = statisticsDao
202
							.countNomenclaturalReferences((Classification) filter);
215 203
					break;
216 204

  
217 205
				}
218 206

  
219 207
				statistics.addCount(type, counter);
220
				// System.out.println("");
221 208
			}
222 209

  
223 210
		} else {

Also available in: Unified diff