コード例 #1
0
 private List<NextEventsDate> getNextEvents(boolean fetchOnlyImportant, String... almanachIds) {
   List<NextEventsDate> result = new ArrayList<NextEventsDate>();
   try {
     List<EventOccurrence> events = getAlmanachBm().getNextEventOccurrences(almanachIds);
     Date today = new Date();
     Date date = null;
     NextEventsDate nextEventsDate = null;
     for (EventOccurrence event : events) {
       if (Administration.get()
           .isComponentAvailable(event.getEventDetail().getInstanceId(), getUserId())) {
         if (!fetchOnlyImportant || (fetchOnlyImportant && event.isPriority())) {
           Date eventDate = event.getStartDate().asDate();
           if (DateUtil.compareTo(today, eventDate, true) != 0) {
             if (date == null || DateUtil.compareTo(date, eventDate, true) != 0) {
               nextEventsDate = new NextEventsDate(eventDate);
               result.add(nextEventsDate);
               date = eventDate;
             }
             nextEventsDate.addEvent(event);
           }
         }
       }
     }
   } catch (Exception e) {
     SilverTrace.error("lookAurora", "LookAuroraHelper.getNextEvents", "", e);
   }
   return result;
 }
コード例 #2
0
 private List<News> getNewsByComponentId(String appId) {
   try {
     if (!Administration.get().isComponentAvailable(appId, getUserId())) {
       return new ArrayList<News>();
     }
   } catch (Exception e) {
     SilverTrace.error("lookAurora", "LookAuroraHelper.getNewsByComponentId", "", e);
   }
   QuickInfoService service = QuickInfoService.get();
   return service.getVisibleNews(appId);
 }
コード例 #3
0
  private List<News> getDelegatedNews() {
    List<News> news = new ArrayList<News>();
    List<DelegatedNews> delegatedNews = delegatedNewsService.getAllValidDelegatedNews();
    try {
      for (DelegatedNews delegated : delegatedNews) {
        if (Administration.get().isComponentAvailable(delegated.getInstanceId(), getUserId())) {
          News aNews = new News(delegated.getPublicationDetail());
          aNews.setPublicationId(delegated.getPublicationDetail().getId());
          news.add(aNews);
        }
      }
    } catch (Exception e) {
      SilverTrace.error("lookAurora", "LookAuroraHelper.getDelegatedNews", "", e);
    }

    return news;
  }
コード例 #4
0
  public List<EventOccurrence> getTodayEvents() {
    List<EventOccurrence> availableEvents = new ArrayList<EventOccurrence>();
    try {
      List<EventOccurrence> events =
          getAlmanachBm()
              .getEventOccurrencesInPeriod(
                  Period.from(new Date(), PeriodType.day, "fr"), getAlmanachIds());
      for (EventOccurrence event : events) {
        if (Administration.get()
            .isComponentAvailable(event.getEventDetail().getInstanceId(), getUserId())) {
          availableEvents.add(event);
        }
      }
    } catch (Exception e) {
      SilverTrace.error("lookAurora", "LookAuroraHelper.getTodayEvents", "", e);
    }

    return availableEvents;
  }