public static String processActivities(
     RestRequest rest, HttpServletRequest request, String userId) {
   switch (rest.getAction()) {
     case RestRequest.DELETE:
     case RestRequest.UPDATE:
     case RestRequest.FIND:
     default:
       MailingList list =
           MailingListServicesProvider.getMailingListService()
               .findMailingList(rest.getComponentId());
       MailingListActivity mailingListActivity =
           MailingListServicesProvider.getMessageService().getActivity(list);
       Map<String, Map<String, String>> years = new HashMap<>(10);
       for (final Activity activity : mailingListActivity.getActivities()) {
         Map<String, String> month = years.get("" + activity.getYear());
         if (month == null) {
           month = new HashMap<>(12);
           years.put("" + activity.getYear(), month);
         }
         month.put("" + activity.getMonth(), "" + activity.getNbMessages());
       }
       if (!list.isSupportRSS()) {
         request.removeAttribute(RSS_URL_ATT);
       }
       request.setAttribute(IS_USER_SUBSCRIBER_ATT, isSubscriber(list, userId));
       request.setAttribute(ACTIVITY_LIST_ATT, mailingListActivity);
       request.setAttribute(ACTIVITY_MAP_ATT, years);
       List<String> yearsList = new ArrayList<>();
       yearsList.addAll(years.keySet());
       Collections.sort(yearsList);
       request.setAttribute(ACTIVITY_YEARS_ATT, yearsList);
       request.setAttribute(MAILING_LIST_ATT, list);
       return JSP_BASE + DESTINATION_DISPLAY_ACTIVITY;
   }
 }
 private static boolean isSubscriber(MailingList list, String userId) {
   Collection<InternalUserSubscriber> subscribers = list.getInternalSubscribers();
   if (subscribers != null && !subscribers.isEmpty()) {
     for (InternalUserSubscriber user : subscribers) {
       if (userId.equals(user.getExternalId())) {
         return true;
       }
     }
   }
   return false;
 }
 @Override
 public void init() throws Exception {
   try {
     Scheduler scheduler = SchedulerProvider.getScheduler();
     if (scheduler.isJobScheduled(MAILING_LIST_JOB_NAME)) {
       scheduler.unscheduleJob(MAILING_LIST_JOB_NAME);
     }
     if (hasToCheckForNewMails()) {
       SilverLogger.getLogger(this)
           .info("Check mails from mailing lists every " + getFrequency() + " minutes");
       MessageChecker checker = getMessageChecker();
       JobTrigger trigger = JobTrigger.triggerEvery(getFrequency(), TimeUnit.MINUTE);
       scheduler.scheduleJob(MAILING_LIST_JOB_NAME, trigger, checker);
       List<MailingList> mailingLists = getMailingListService().listAllMailingLists();
       for (MailingList list : mailingLists) {
         MailingListComponent component = new MailingListComponent(list.getComponentId());
         checker.addMessageListener(component);
       }
     }
   } catch (SchedulerException ex) {
     SilverLogger.getLogger(this).error(ex.getMessage(), ex);
   }
 }