Examples of Subscriber


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

    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

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

    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

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

      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

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

    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

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

   */
  public void markSubscriberRead(Identity identity, SubscriptionContext subsContext) {
    Publisher p = getPublisher(subsContext.getResName(), subsContext.getResId(), subsContext.getSubidentifier());
    if (p == null) throw new AssertException("cannot markRead for identity " + identity.getName()
        + ", since the publisher for the given subscriptionContext does not exist: subscontext = " + subsContext);
    Subscriber sub = getSubscriber(identity, p);
    if (sub == null) throw new AssertException("cannot markRead, since identity " + identity.getName()
        + " is not subscribed to subscontext " + subsContext);
    updateSubscriber(sub);
  }
View Full Code Here

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

   * @param publisherData
   */
  public void subscribe(Identity identity, SubscriptionContext subscriptionContext, PublisherData publisherData) {
    // no need to sync, since an identity only has one gui thread / one mouse
    Publisher p = findOrCreatePublisher(subscriptionContext, publisherData);
    Subscriber s = getSubscriber(identity, p);
    if (s == null) {
      // no subscriber -> create.
      // s.latestReadDate >= p.latestNewsDate == no news for subscriber when no
      // news after subscription time
      doCreateAndPersistSubscriber(p, identity);
View Full Code Here

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

    }
   
    // no need to sync, since there is only one gui thread at a time from one
    // user
    if (ignoreNewsFor != null) {
      Subscriber sub = getSubscriber(ignoreNewsFor, publisher);
      if (sub != null) { // mark as read if subscribed
        updateSubscriber(sub);
      }
    }
   
   
    // channel-notify all interested listeners (e.g. the pnotificationsportletruncontroller)
    // 1. find all subscribers which can be affected
    List<Subscriber> subscribers = getValidSubscribersOf(publisher);
   
    Set<Long> subsKeys = new HashSet<Long>();
    // 2. collect all keys of the affected subscribers
    for (Iterator<Subscriber> it_subs = subscribers.iterator(); it_subs.hasNext();) {
      Subscriber su = it_subs.next();
      subsKeys.add(su.getKey());
    }
    // fire the event
    MultiUserEvent mue = EventFactory.createAffectedEvent(subsKeys);
    CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(mue, oresMyself);
   
View Full Code Here

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

    // no need to sync, since an identity only has one gui thread / one mouse
    Publisher p = getPublisher(subscriptionContext);
    // if no publisher yet.
    //TODO: check race condition: can p be null at all?
    if (p == null) return;
    Subscriber s = getSubscriber(identity, p);
    if (s != null) {
      deleteSubscriber(s);
    } else {
      logWarn("could not unsubscribe " + identity.getName() + " from publisher:" + p.getResName() + ","  + p.getResId() + "," + p.getSubidentifier(), null);
    }
View Full Code Here

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

  /**
   *
   * @see org.olat.core.util.notifications.NotificationsManager#unsubscribe(org.olat.core.util.notifications.Subscriber)
   */
  public void unsubscribe(Subscriber s) {
    Subscriber foundSub = getSubscriber(s.getKey());
    if (foundSub != null) {
      deleteSubscriber(foundSub);
    } else {
      logWarn("could not unsubscribe " + s.getIdentity().getName() + " from publisher:" + s.getPublisher().getResName() + ","  + s.getPublisher().getResId() + "," + s.getPublisher().getSubidentifier(), null);
    }
View Full Code Here

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

  }

   protected Comparator getComparator(final SortingCriteria sortingCriteria) {
      return new Comparator(){     
        public int compare(final Object o1, final Object o2) {
          Subscriber subscriber1= (Subscriber)o1;
          Subscriber subscriber2 = (Subscriber)o2;   
          int comparisonResult = 0;
          if(sortingCriteria.getSortingTerm()==SortingCriteria.ALPHABETICAL_SORTING) {         
            comparisonResult = collator.compare(subscriber1.getPublisher().getResName(), subscriber1.getPublisher().getResName());               
          } else if(sortingCriteria.getSortingTerm()==SortingCriteria.DATE_SORTING) {
            comparisonResult = subscriber1.getLastModified().compareTo(subscriber1.getLastModified());
          } else if(sortingCriteria.getSortingTerm()==SortingCriteria.TYPE_SORTING) {
            String type1 = ControllerFactory.translateResourceableTypeName(subscriber1.getPublisher().getType(), getTranslator().getLocale());
            String type2 = ControllerFactory.translateResourceableTypeName(subscriber2.getPublisher().getType(), getTranslator().getLocale());
            comparisonResult = type1.compareTo(type2);
          }
          if(!sortingCriteria.isAscending()) {
            //if not isAscending return (-comparisonResult)         
            return -comparisonResult;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.