@Override
  public String doExecute() throws ParseException, GenericEntityException {
    boolean isUserLogged = JiraTimetrackerUtil.isUserLogged();
    if (!isUserLogged) {
      setReturnUrl(JIRA_HOME_URL);
      return getRedirect(NONE);
    }

    normalizeContextPath();
    PluginSettingsValues pluginSettings = jiraTimetrackerPlugin.loadPluginSettings();
    setIssuesRegex(pluginSettings.getFilteredSummaryIssues());

    setDefaultDates();

    Calendar startDate = null;
    Calendar lastDate = null;
    try {
      setCurrentUserFromParam();
      setUserPickerObjectBasedOnCurrentUser();
      startDate = getStartDate();
      lastDate = getLastDate();
      validateDates(startDate, lastDate);
    } catch (IllegalArgumentException e) {
      message = e.getMessage();
      return INPUT;
    }

    worklogs = new ArrayList<EveritWorklog>();
    try {
      worklogs.addAll(
          jiraTimetrackerPlugin.getWorklogs(currentUser, startDate.getTime(), lastDate.getTime()));
    } catch (DataAccessException | SQLException e) {
      LOGGER.error(GET_WORKLOGS_ERROR_MESSAGE, e);
      return ERROR;
    }

    Collections.sort(worklogs, new OrderByDate());

    for (EveritWorklog worklog : worklogs) {
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(worklog.getDate());

      boolean isRealWorklog = isRealWorklog(worklog);

      addToMonthSummary(worklog);
      addToRealMonthSummary(worklog, isRealWorklog);

      addToWeekSummary(worklog);
      addToRealWeekSummary(worklog, isRealWorklog);

      addToDaySummary(worklog);
      addToRealDaySummary(worklog, isRealWorklog);
    }

    return SUCCESS;
  }
 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 boolean isRealWorklog(final EveritWorklog worklog) {
   boolean isRealWorklog = true;
   if (issuesRegex != null) {
     for (Pattern issuePattern : issuesRegex) {
       boolean issueMatches = issuePattern.matcher(worklog.getIssue()).matches();
       // if match not count in summary
       if (issueMatches) {
         isRealWorklog = false;
         break;
       }
     }
   }
   return isRealWorklog;
 }
 @Override
 public int compare(final EveritWorklog wl1, final EveritWorklog wl2) {
   return wl1.getDate().compareTo(wl2.getDate());
 }