Пример #1
0
 @Override
 public void onEvent(Event<PortalContainer, HttpSessionEvent> event) throws Exception {
   if (LOG.isTraceEnabled()) {
     LOG.trace("Adding the key: " + event.getData().getSession().getId());
   }
   try {
     SessionManager sessionManager =
         (SessionManager) RootContainer.getComponent(SessionManager.class);
     sessionManager.addSessionContainer(
         event.getData().getSession().getId(), event.getSource().getName());
   } catch (Exception e) {
     LOG.warn("Can't add the key: " + event.getData().getSession().getId(), e);
   }
   if (LOG.isTraceEnabled()) {
     LOG.trace("Added the key: " + event.getData().getSession().getId());
   }
 }
 @Override
 public void onEvent(Event<ExoSocialActivity, String> event) throws Exception {
   ExoSocialActivity activity = event.getSource();
   if (CalendarSpaceActivityPublisher.CALENDAR_APP_ID.equals(activity.getType())) {
     String eventId =
         activity.getTemplateParams().get(CalendarSpaceActivityPublisher.EVENT_ID_KEY);
     String calendarId =
         activity.getTemplateParams().get(CalendarSpaceActivityPublisher.CALENDAR_ID_KEY);
     //
     Node calendarNode = getJCRDataStorage().getPublicCalendarHome().getNode(calendarId);
     Node eventNode = calendarNode.getNode(eventId);
     ActivityTypeUtils.attachActivityId(eventNode, event.getData());
     //
     eventNode.getSession().save();
     LOG.info(
         String.format(
             "Done migration the calendar activity with old id's %s and new id's %s",
             activity.getId(), event.getData()));
   }
 }