Package org.rssowl.core.persist.reference

Examples of org.rssowl.core.persist.reference.NewsReference


  /*
   * @see org.rssowl.core.persist.IEntity#toReference()
   */
  public NewsReference toReference() {
    return new NewsReference(getIdAsPrimitive());
  }
View Full Code Here


         * way (e.g. the OS shutting down while RSSOwl is running). To avoid
         * issues, we filter out duplicate results from the search. See
         * http://dev.rssowl.org/show_bug.cgi?id=1264
         */
        if (!fSearchResultNewsIds.containsKey(newsId)) {
          fResultList.add(new NewsReference(newsId));
          fSearchResultNewsIds.put(newsId, newsId);
        }
      } catch (IOException e) {
        Activator.safeLogError(e.getMessage(), e);
      }
View Full Code Here

  }

  private static List<NewsReference> getEntityIds(LongArrayList list) {
    List<NewsReference> newsRef = new ArrayList<NewsReference>(list.size());
    for (int i = 0, c = list.size(); i < c; ++i) {
      newsRef.add(new NewsReference(list.get(i)));
    }
    return newsRef;
  }
View Full Code Here

    fNavigationToolBarManager.createControl(parent);
  }

  private void openContext(WebBrowserContext context) {
    NewsReference newsReference = context.getNewsReference();
    INewsMark newsMark = context.getNewsMark();

    PerformAfterInputSet perform = null;
    if (newsReference != null)
      perform = PerformAfterInputSet.selectNews(newsReference);
View Full Code Here

          if (monitor.isCanceled())
            return;

          Set<NewsReference> newsOfMarkToDelete = new HashSet<NewsReference>();
          for (int i = 0; i < resolvedNews.size() && i < toDeleteValue; i++)
            newsOfMarkToDelete.add(new NewsReference(resolvedNews.get(i).getId()));

          if (!newsOfMarkToDelete.isEmpty() && !monitor.isCanceled()) {
            newsToDelete.put(mark, newsOfMarkToDelete);
            group.addTask(new NewsTask(group, mark, newsOfMarkToDelete));
          }
View Full Code Here

        if (end < 0)
          end = parameters.length();

        StringTokenizer tokenizer = new StringTokenizer(parameters.substring(start, end), ",");//$NON-NLS-1$
        while (tokenizer.hasMoreElements()) {
          NewsReference ref = new NewsReference(Long.valueOf((String) tokenizer.nextElement()));
          elements.addAll(Arrays.asList(newsContentProvider.getElements(ref)));
        }
      }
    }
View Full Code Here

  public NewsNotificationItem(INews news, RGB color) {
    super(makeText(news), OwlUI.BOOKMARK); //We resolve the real favicon later lazily

    fNewsLink = CoreUtils.getLink(news);
    fFeedReference = news.getFeedReference();
    fNewsReference = new NewsReference(news.getId());
    fRecentNewsDate = DateUtils.getRecentDate(news);
    fIsNewsSticky = news.isFlagged();
    fIsNewsRead = (INews.State.READ == news.getState());

    if (color != null)
View Full Code Here

    if (explorer != null && child != null && !explorer.isLinkingEnabled())
      explorer.reveal(child, false);
  }

  private void openAndSelect(IWorkbenchPage page, INews news, INewsMark newsmark) {
    PerformAfterInputSet perform = PerformAfterInputSet.selectNews(new NewsReference(news.getId()));
    perform.setActivate(false);

    /* Open this Bookmark */
    FeedViewInput fvInput = new FeedViewInput(newsmark, perform);
    FeedView feedview = null;
View Full Code Here

   */
  public List<NewsReference> getNewsRefs() {
    synchronized (this) {
      List<NewsReference> news = new ArrayList<NewsReference>(fNewsContainer.size());
      for (Long id : fNewsContainer) {
        news.add(new NewsReference(id));
      }

      return news;
    }
  }
View Full Code Here

    /* Show News Downloaded while Minimized */
    if (!fTeasingNewsCache.isEmpty()) {
      synchronized (fTeasingNewsCache) {
        int counter = 0;
        for (int i = fTeasingNewsCache.size() - 1; i >= 0; i--) {
          NewsReference reference = new NewsReference(fTeasingNewsCache.get(i));
          INews newsitem = reference.resolve();
          if (newsitem != null && newsitem.getState() == INews.State.NEW && service.shouldShow(newsitem)) {
            newsToShow.add(newsitem);

            if (++counter >= TEASE_LIMIT)
              break;
          } else
            CoreUtils.reportIndexIssue();

          /* Return early if Notifier already showing */
          if (service.isPopupVisible())
            return;
        }
      }
      mode = Mode.INCOMING_MANUAL;
    }

    /* Show Recent News if no teasing news present */
    if (newsToShow.isEmpty()) {

      /* Build the Search if not yet done */
      if (fTodaysNewsSearch == null) {
        IModelFactory factory = Owl.getModelFactory();

        String newsClassName = INews.class.getName();
        ISearchField ageInDaysField = factory.createSearchField(INews.AGE_IN_DAYS, newsClassName);
        ISearchField ageInMinutesField = factory.createSearchField(INews.AGE_IN_MINUTES, newsClassName);

        ISearchCondition dayCondition = factory.createSearchCondition(ageInDaysField, SearchSpecifier.IS_LESS_THAN, 1); // From Today after Midnight
        ISearchCondition recentCondition = factory.createSearchCondition(ageInMinutesField, SearchSpecifier.IS_LESS_THAN, -60 * 6); // Up to 6 Hours Ago

        fTodaysNewsSearch = factory.createSearch(null);
        fTodaysNewsSearch.setMatchAllConditions(false);
        fTodaysNewsSearch.addSearchCondition(dayCondition);
        fTodaysNewsSearch.addSearchCondition(recentCondition);
      }

      /* Sort by Id (simulate sorting by date) */
      List<SearchHit<NewsReference>> result = Owl.getPersistenceService().getModelSearch().searchNews(fTodaysNewsSearch);
      Set<NewsReference> recentNews = new TreeSet<NewsReference>(new Comparator<NewsReference>() {
        public int compare(NewsReference ref1, NewsReference ref2) {
          if (ref1.equals(ref2))
            return 0;

          return ref1.getId() > ref2.getId() ? -1 : 1;
        }
      });

      for (SearchHit<NewsReference> hit : result) {
        recentNews.add(hit.getResult());
      }

      /* Resolve and Add News from Result */
      int counter = 0;
      for (NewsReference reference : recentNews) {
        INews newsitem = reference.resolve();
        if (newsitem != null && newsitem.isVisible() && service.shouldShow(newsitem)) {
          newsToShow.add(newsitem);

          if (++counter >= TEASE_LIMIT)
            break;
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.reference.NewsReference

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.