private void addToWeekSummary(final EveritWorklog worklog) { ArrayList<Object> list = new ArrayList<Object>(); int weekNo = worklog.getWeekNo(); Long prevWeekSum = weekSum.get(weekNo) == null ? Long.valueOf(0) : (Long) weekSum.get(weekNo).get(0); Long sumSec = prevWeekSum + (worklog.getMilliseconds() / MILLISEC_IN_SEC); list.add(sumSec); list.add(DateTimeConverterUtil.secondConvertToString(sumSec)); weekSum.put(weekNo, list); }
private void addToMonthSummary(final EveritWorklog worklog) { int monthNo = worklog.getMonthNo(); ArrayList<Object> list = new ArrayList<Object>(); Long prevMonthSum = (monthSum.get(monthNo) == null) ? Long.valueOf(0) : (Long) monthSum.get(monthNo).get(0); Long sumSec = prevMonthSum + (worklog.getMilliseconds() / MILLISEC_IN_SEC); list.add(sumSec); list.add(DateTimeConverterUtil.secondConvertToString(sumSec)); monthSum.put(monthNo, list); }
private void addToRealWeekSummary(final EveritWorklog worklog, final boolean isRealWorklog) { int weekNo = worklog.getWeekNo(); ArrayList<Object> realList = new ArrayList<Object>(); Long prevRealWeekSum = realWeekSum.get(weekNo) == null ? Long.valueOf(0) : (Long) realWeekSum.get(weekNo).get(0); Long realSumSec = prevRealWeekSum; if (isRealWorklog) { realSumSec += (worklog.getMilliseconds() / MILLISEC_IN_SEC); } realList.add(realSumSec); realList.add(DateTimeConverterUtil.secondConvertToString(realSumSec)); realWeekSum.put(weekNo, realList); }
private Calendar getStartDate() throws IllegalArgumentException { String dateFromParam = getHttpRequest().getParameterValues(PARAM_DATEFROM)[0]; if (!"".equals(dateFromParam)) { dateFromFormated = dateFromParam; } else { throw new IllegalArgumentException(INVALID_START_TIME); } Calendar startDate = Calendar.getInstance(); try { startDate.setTime(DateTimeConverterUtil.stringToDate(dateFromParam)); } catch (ParseException e) { throw new IllegalArgumentException(INVALID_START_TIME); } return startDate; }
/** Set dateTo and dateToFormated default value. */ private void dateToDefaultInit() { Calendar calendarTo = Calendar.getInstance(); dateTo = calendarTo.getTime(); dateToFormated = DateTimeConverterUtil.dateToString(dateTo); }
/** Set dateFrom and dateFromFormated default value. */ private void dateFromDefaultInit() { Calendar calendarFrom = Calendar.getInstance(); calendarFrom.add(Calendar.WEEK_OF_MONTH, -1); dateFrom = calendarFrom.getTime(); dateFromFormated = DateTimeConverterUtil.dateToString(dateFrom); }