Package org.olat.core.util.notifications

Examples of org.olat.core.util.notifications.NotificationsManager


   * and sets their state to "1" which indicates that the ressource is deleted.
   */
  private static void clearCalenderSubscriptions(ICourse course) {
    //set Publisher state to 1 (= ressource is deleted) for all calendars of the course
    CalendarManager calMan = CalendarManagerFactory.getInstance().getCalendarManager();
    NotificationsManager nfm = NotificationsManager.getInstance();
    List<BusinessGroup> learningGroups = course.getCourseEnvironment().getCourseGroupManager()
      .getAllLearningGroupsFromAllContexts();
    List<BusinessGroup> rightGroups = course.getCourseEnvironment().getCourseGroupManager()
    .getAllRightGroupsFromAllContexts();
    learningGroups.addAll(rightGroups);
    //all learning and right group calendars
    for (BusinessGroup bg : learningGroups) {
      KalendarRenderWrapper calRenderWrapper = calMan.getGroupCalendar(bg);
      SubscriptionProvider subProvider = new SubscriptionProviderImpl(calRenderWrapper);
      SubscriptionContext subsContext = subProvider.getSubscriptionContext();
      Publisher pub = nfm.getPublisher(subsContext);
      if (pub != null) {
        pub.setState(1); //int 0 is OK -> all other is not OK
      }
    }
    //the course calendar
    try {
      /**
       * TODO:gs 2010-01-26
       * OLAT-4947: if we do not have an repo entry we get an exception here.
       * This is normal in the case of courseimport and click canceling.
       */
      course.getCourseTitle();
      KalendarRenderWrapper courseCalendar = calMan.getCourseCalendar(course);
      SubscriptionProvider subProvider = new SubscriptionProviderImpl(courseCalendar, course);
      Publisher pub = nfm.getPublisher(subProvider.getSubscriptionContext());
      if (pub != null) {
        pub.setState(1);
      }
    } catch (AssertException e) {
      //if we have a broken course (e.g. canceled import or no repo entry somehow) skip calendar deletion...
View Full Code Here


    setEncoding(RSSServlet.DEFAULT_ENCODING);

    User user = identity.getUser();
    Locale locale = I18nManager.getInstance().getLocaleOrDefault(user.getPreferences().getLanguage());
    Translator translator = Util.createPackageTranslator(PersonalRSSFeed.class, locale);
    NotificationsManager man = NotificationsManager.getInstance();
    List<Bookmark> bookmarks = BookmarkManager.getInstance().findBookmarksByIdentity(identity);

    setTitle(translator.translate("rss.title", new String[] { identity.getName() }));
    setLink(RSSUtil.URI_SERVER);
    setDescription(translator.translate("rss.description", new String[] { identity.getName() }));

    // create and add an image to the feed
    SyndImage image = new SyndImageImpl();
    image.setUrl(Settings.createServerURI() + StaticMediaDispatcher.createStaticURIFor("images/olat/olatlogo32x32.png"));
    image.setTitle("OLAT - Online Learning And Training");
    image.setLink(getLink());
    setImage(image);

    List<SyndEntry> entries = new ArrayList<SyndEntry>();
    SyndEntry entry = new SyndEntryImpl();
    entry.setTitle(translator.translate("rss.olat.title", new String[] { NotificationHelper.getFormatedName(identity) }));
    entry.setLink(getLink());
    SyndContent description = new SyndContentImpl();
    description.setType("text/plain");
    description.setValue(translator.translate("rss.olat.description"));
    entry.setDescription(description);
    entries.add(entry);

    // bookmark news
    for (Bookmark bookmark : bookmarks) {
      SyndEntry item = new SyndEntryImpl();
      item.setTitle(translator.translate("rss.bookmark.title", new String[] { bookmark.getTitle() }));
      // create jump in link with factory method from manager
      String itemLink = BookmarkManager.getInstance().createJumpInURL(bookmark);
      item.setLink(itemLink);
      SyndContent itemDescription = new SyndContentImpl();
      itemDescription.setType("text/plain");
      itemDescription.setValue(bookmark.getDescription());
      item.setDescription(itemDescription);
      entries.add(item);
    }

    // notification news
    // we are only interested in subscribers which listen to a valid publisher
    List<Subscriber> subs = man.getValidSubscribers(identity);
    for (Subscriber subscriber : subs) {
      SubscriptionItem si = man.createSubscriptionItem(subscriber, locale, SubscriptionInfo.MIME_PLAIN, SubscriptionInfo.MIME_HTML);
      if (si != null) {
        SyndEntry item = new SyndEntryImpl();
        item.setTitle(si.getTitle());
        item.setLink(si.getLink());
        SyndContent itemDescription = new SyndContentImpl();
View Full Code Here

      log.audit("+-----------------------------------------------------------------------------+");
      log.audit("+... Calculate the businesspath for the publishers (notifications)         ...+");
      log.audit("+-----------------------------------------------------------------------------+");

      int counter = 0;
      NotificationsManager notificationMgr = NotificationsManager.getInstance();
      List<Publisher> allPublishers = notificationMgr.getAllPublisher();
      if (log.isDebug()) log.info("Found " + allPublishers.size() + " publishers to migrate.");

      for(Publisher publisher:allPublishers) {
        Publisher publisherToSave = upgrade(publisher);
        if(publisherToSave != null) {
View Full Code Here

TOP

Related Classes of org.olat.core.util.notifications.NotificationsManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.