Package org.olat.core.util.notifications

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


    // subscriberIdentity instead to make this controller also be usable in the
    // admin environment (admins might change notifications for a user)
    NotificationsManager man = NotificationsManager.getInstance();
    List<Subscriber> subs = man.getSubscribers(subscriberIdentity);
    for(Iterator<Subscriber> subIt=subs.iterator(); subIt.hasNext(); ) {
      Subscriber sub = subIt.next();
      if(!man.isPublisherValid(sub.getPublisher())) {
        subIt.remove();
      }
    }
   
    subscriptionsTableModel.setObjects(subs);
View Full Code Here


  protected void event(UserRequest ureq, Controller source, Event event) {
    if (source == subscriptionsTableCtr) {
      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        Subscriber sub = subscriptionsTableModel.getObject(te.getRowId());
        if (actionid.equals("launch")) {
          // User want to go to the subscription source, e.g. the forum or the
          // folder
          NotificationUIFactory.launchSubscriptionResource(ureq, getWindowControl(), sub);
        } else if (actionid.equals("del")) {
          delYesNoC = activateYesNoDialog(ureq, null, translate("confirm.delete"), delYesNoC);
          delYesNoC.setUserObject(sub);
          return;
        }
      }
    } else if (source == delYesNoC) {
      if (DialogBoxUIFactory.isYesEvent(event)) { // ok
        // Remove subscription and update data model
        Subscriber sub = (Subscriber) delYesNoC.getUserObject();
        NotificationsManager.getInstance().unsubscribe(sub);
        updateSubscriptionsDataModel();
        showInfo("info.notification.deleted");
        // Notify parent controller
        fireEvent(ureq, Event.CHANGED_EVENT);
View Full Code Here

 
  private List<PortletEntry> getAllPortletEntries() {
    notificationsList = man.getValidSubscribers(identity);
    // calc subscriptioninfo for all subscriptions and, if only those with news are to be shown, remove the other ones
    for (Iterator<Subscriber> it_subs = notificationsList.iterator(); it_subs.hasNext();) {
      Subscriber subscriber = it_subs.next();
      Publisher pub = subscriber.getPublisher();
      NotificationsHandler notifHandler = man.getNotificationsHandler(pub);
      SubscriptionInfo subsInfo = notifHandler.createSubscriptionInfo(subscriber, locale, compareDate);
      if (!subsInfo.hasNews()) {
        it_subs.remove();
      }
View Full Code Here

  protected void reloadModel(SortingCriteria sortingCriteria) {
    if (sortingCriteria.getSortingType() == SortingCriteria.AUTO_SORTING) {
    notificationsList = man.getValidSubscribers(identity);
    // calc subscriptioninfo for all subscriptions and, if only those with news are to be shown, remove the other ones
    for (Iterator<Subscriber> it_subs = notificationsList.iterator(); it_subs.hasNext();) {
      Subscriber subscriber = it_subs.next();
      Publisher pub = subscriber.getPublisher();
      try {
        NotificationsHandler notifHandler = man.getNotificationsHandler(pub);
        SubscriptionInfo subsInfo = notifHandler.createSubscriptionInfo(subscriber, locale, compareDate);
        if (!subsInfo.hasNews()) {
          it_subs.remove();
View Full Code Here

      if (event.getCommand().equals(Table.COMMANDLINK_ROWACTION_CLICKED)) {
        TableEvent te = (TableEvent) event;
        String actionid = te.getActionId();
        if (actionid.equals(CMD_LAUNCH)) {
          int rowid = te.getRowId();
          Subscriber sub = notificationListModel.getSubscriberAt(rowid);
          if (actionid.equals(CMD_LAUNCH)) {
            Publisher pub = sub.getPublisher();
            if (!man.isPublisherValid(pub)) {
              getWindowControl().setError(getTranslator().translate("error.publisherdeleted"));
            } else {           
              String resName = pub.getResName();
              Long resId = pub.getResId();
View Full Code Here

 
  private void removeSubscriptions(Identity identity, BusinessGroup group) {
    NotificationsManager notiMgr = NotificationsManager.getInstance();
    List<Subscriber> l = notiMgr.getSubscribers(identity);
    for (Iterator iterator = l.iterator(); iterator.hasNext();) {
      Subscriber subscriber = (Subscriber) iterator.next();
      Long resId = subscriber.getPublisher().getResId();
      Long groupKey = group.getKey();
      if (resId != null && groupKey != null && resId.equals(groupKey)) {
        notiMgr.unsubscribe(subscriber);
      }
    }
View Full Code Here

    List<Subscriber> subsToUpdate = null;
    StringBuilder mailLog = new StringBuilder();
    StringBuilder mailErrorLog = new StringBuilder();
   
    boolean veto = false;
    Subscriber latestSub = null;
    Identity ident = null;
    Translator translator = null;
    Locale locale = null;
   
    Date defaultCompareDate = getDefaultCompareDate();
    long start = System.currentTimeMillis();
   
    // loop all subscriptions, as its ordered by identity, they get collected for each identity
    for(Subscriber sub : subs){
      try {
        ident = sub.getIdentity();

        if (latestSub == null || (!ident.equalsByPersistableKey(latestSub.getIdentity()))) {
          // first time or next identity => prepare for a new user and send old data.
         
          // send a mail
          notifySubscribersByEmail(latestSub, items, subsToUpdate, translator, start, veto, mailLog, mailErrorLog);
         
View Full Code Here

    boolean sentOk = sendEmail(curIdent, translator.translate("rss.title", new String[] { NotificationHelper.getFormatedName(curIdent) }), items);
    // save latest email sent date for the subscription just emailed
    // do this only if the mail was successfully sent
    if (sentOk) {
      for (Iterator<Subscriber> it_subs = subscribersToUpdate.iterator(); it_subs.hasNext();) {
        Subscriber subscriber = it_subs.next();
        subscriber.setLatestEmailed(new Date());
        updateSubscriber(subscriber);
      }
    }
    return sentOk;
  }
View Full Code Here

      Publisher pub = it_pub.next();
     
      //grab all subscribers to the publisher and delete them
      List<Subscriber> subs = getValidSubscribersOf(pub);
      for (Iterator<Subscriber> iterator = subs.iterator(); iterator.hasNext();) {
        Subscriber sub = iterator.next();
        unsubscribe(sub);
      }
      deletePublisher(pub);
    }
  }
View Full Code Here

    query.setEntity("publisher", publisher);
    query.setEntity("identity", identity);
    List<Subscriber> res = query.list();
    if (res.size() == 0) return null;
    if (res.size() != 1) throw new AssertException("only one subscriber per person and publisher!!");
    Subscriber s = res.get(0);
    return s;
  }
View Full Code Here

TOP

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

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.