Package org.rssowl.core.persist.event

Examples of org.rssowl.core.persist.event.NewsEvent


    feed.addNews(news4);
    feed.addNews(news5);
    feed.addNews(news6);
    feed.addNews(news7);

    NewsEvent event1 = new NewsEvent(news1, news2, true);
    assertEquals(false, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news1, news3, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news1, news4, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news4, news1, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news5, news6, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news6, news5, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news7, news4, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));

    event1 = new NewsEvent(news4, news7, true);
    assertEquals(true, CoreUtils.isCategoryChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event1 }))));
  }
View Full Code Here


    feed.addNews(news1);
    feed.addNews(news2);
    feed.addNews(news3);
    feed.addNews(news4);

    NewsEvent event = new NewsEvent(news1, news2, true);
    assertEquals(false, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));

    event = new NewsEvent(news1, news3, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));

    event = new NewsEvent(news1, news4, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));

    event = new NewsEvent(news4, news1, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));
  }
View Full Code Here

    feed.addNews(news1);
    feed.addNews(news2);
    feed.addNews(news3);
    feed.addNews(news4);

    NewsEvent event = new NewsEvent(news1, news2, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));

    event = new NewsEvent(news1, news3, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));

    event = new NewsEvent(news1, news4, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));

    event = new NewsEvent(news4, news1, true);
    assertEquals(true, CoreUtils.isLabelChange(new HashSet<ModelEvent>(Arrays.asList(new ModelEvent[] { event }))));
  }
View Full Code Here

   * its value for any of the given Events, <code>FALSE</code> otherwise.
   */
  public static boolean isNewStateChange(Set<? extends ModelEvent> events) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;
        boolean oldStateNew = INews.State.NEW.equals(newsEvent.getOldNews() != null ? newsEvent.getOldNews().getState() : null);
        boolean currentStateNew = INews.State.NEW.equals(newsEvent.getEntity().getState());

        if (oldStateNew != currentStateNew)
          return true;
      }
    }
View Full Code Here

   * otherwise. Respects the onlyHasBecomeSticky parameter.
   */
  public static boolean isStickyStateChange(Set<? extends ModelEvent> events, boolean onlyHasBecomeSticky) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;
        boolean oldSticky = (newsEvent.getOldNews() != null) ? newsEvent.getOldNews().isFlagged() : false;
        boolean currentSticky = newsEvent.getEntity().isVisible() && newsEvent.getEntity().isFlagged();

        /* Only return true if sticky state is now TRUE */
        if (onlyHasBecomeSticky) {
          if (!oldSticky && currentSticky)
            return true;
View Full Code Here

   * onlyHasBecomeUnread parameter.
   */
  public static boolean isReadStateChange(Set<? extends ModelEvent> events, boolean onlyHasBecomeUnread) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;
        boolean oldStateUnread = isUnread(newsEvent.getOldNews() != null ? newsEvent.getOldNews().getState() : null);
        boolean newStateUnread = isUnread(newsEvent.getEntity().getState());

        /* Only return true if unread state is now TRUE */
        if (onlyHasBecomeUnread) {
          if (!oldStateUnread && newStateUnread)
            return true;
View Full Code Here

   * Events, <code>FALSE</code> otherwise.
   */
  public static boolean isNewOrReadStateChange(Set<? extends ModelEvent> events) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;

        boolean oldStateNew = INews.State.NEW.equals(newsEvent.getOldNews() != null ? newsEvent.getOldNews().getState() : null);
        boolean currentStateNew = INews.State.NEW.equals(newsEvent.getEntity().getState());

        if (oldStateNew != currentStateNew)
          return true;

        boolean oldStateUnread = isUnread(newsEvent.getOldNews() != null ? newsEvent.getOldNews().getState() : null);
        boolean newStateUnread = isUnread(newsEvent.getEntity().getState());

        if (oldStateUnread != newStateUnread)
          return true;
      }
    }
View Full Code Here

   * <code>FALSE</code> otherwise.
   */
  public static boolean isStateChange(Set<? extends ModelEvent> events) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;
        INews.State oldState = newsEvent.getOldNews() != null ? newsEvent.getOldNews().getState() : null;
        if (oldState != newsEvent.getEntity().getState())
          return true;
      }
    }

    return false;
View Full Code Here

   * <code>FALSE</code> otherwise.
   */
  public static boolean gotDeleted(Set<? extends ModelEvent> events) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;

        boolean isVisible = newsEvent.getEntity().isVisible();
        boolean wasVisible = newsEvent.getOldNews() != null ? newsEvent.getOldNews().isVisible() : false;

        if (!isVisible && wasVisible)
          return true;
      }
    }
View Full Code Here

   * <code>FALSE</code> otherwise.
   */
  public static boolean gotRestored(Set<? extends ModelEvent> events) {
    for (ModelEvent event : events) {
      if (event instanceof NewsEvent) {
        NewsEvent newsEvent = (NewsEvent) event;

        boolean isVisible = newsEvent.getEntity().isVisible();
        boolean wasVisible = newsEvent.getOldNews() != null ? newsEvent.getOldNews().isVisible() : false;

        if (isVisible && !wasVisible && newsEvent.getOldNews() != null)
          return true;
      }
    }

    return false;
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.event.NewsEvent

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.