if (version == null || version.getStatus() == EntityStatus.OBSOLETE ||
version.getProject().getStatus() == EntityStatus.OBSOLETE) {
throw new NoSuchEntityException(projectSlug + "/" + versionSlug);
}
HPerson person = personDAO.findByUsername(username);
if (person == null) {
throw new NoSuchEntityException(username);
}
String[] dateRange = dateRangeParam.split("\\.\\.");
if (dateRange.length != 2) {
throw new InvalidDateParamException(dateRangeParam);
}
Date fromDate, toDate;
try {
fromDate = DateUtil.getDate(dateRange[0], DATE_FORMAT);
toDate = DateUtil.getDate(dateRange[1], DATE_FORMAT);
fromDate = DateUtil.getStartOfDay(fromDate);
toDate = DateUtil.getEndOfTheDay(toDate);
if (fromDate.after(toDate) || !DateUtil.isDatesInRange(fromDate,
toDate, MAX_STATS_DAYS)) {
throw new InvalidDateParamException(dateRangeParam);
}
} catch (IllegalArgumentException e) {
throw new InvalidDateParamException(dateRangeParam);
}
LocaleStatistics localeStatistics = new LocaleStatistics();
List<Object[]> data =
textFlowTargetHistoryDAO.getUserTranslationHistoryInVersion(
version.getId(), person.getId(), fromDate, toDate);
for (Object[] entry : data) {
int count = ((BigDecimal) entry[0]).intValue();
ContentState state = ContentState.values()[(int) entry[1]];
LocaleId localeId = new LocaleId(entry[2].toString());