Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.INewsBin


    DynamicDAO.save(feed);

    IFolder folder = fFactory.createFolder(null, null, "Root");
    IBookMark bookmark = fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Bookmark");
    INewsBin bin = fFactory.createNewsBin(null, folder, "Bin");

    DynamicDAO.save(folder);

    INews copiedNews = fFactory.createNews(news, bin);
    DynamicDAO.save(copiedNews);
    DynamicDAO.save(bin);

    UndoStack.getInstance().addOperation(new MoveOperation(Collections.singletonList(news), Collections.singletonList(copiedNews)));

    /* Remove (it's a move!) */
    DynamicDAO.getDAO(INewsDAO.class).setState(Collections.singletonList(news), INews.State.HIDDEN, false, false);

    assertTrue(bin.containsNews(copiedNews));
    assertTrue(bookmark.getNewsCount(INews.State.getVisible()) == 0);

    UndoStack.getInstance().undo();

    assertTrue(bin.getNewsCount(INews.State.getVisible()) == 0);

    assertTrue(bookmark.containsNews(news));
    assertTrue(bookmark.getNewsCount(INews.State.getVisible()) > 0);

    UndoStack.getInstance().redo();

    assertTrue(bin.containsNews(copiedNews));
    assertTrue(bookmark.getNewsCount(INews.State.getVisible()) == 0);
  }
View Full Code Here


    for (NewsEvent event : events) {
      INews news = event.getEntity();
      long parentId = news.getParentId();
      if (!fBookmarkGrouping.isActive() && parentId != 0) {
        if (!handledBins.contains(parentId)) {
          INewsBin bin = newsBinDao.load(parentId);
          if (bin != null) //Could have been deleted meanwhile
            affectedBinFolders.add(bin.getParent());
          handledBins.add(parentId);
        }
      } else
        affectedFeeds.add(news.getFeedReference());
    }
View Full Code Here

    Long id = null;
    Attribute idAttribute = newsBinElement.getAttribute(Attributes.ID.get(), RSSOWL_NS);
    if (idAttribute != null)
      id = Long.valueOf(idAttribute.getValue());

    INewsBin newsbin = Owl.getModelFactory().createNewsBin(null, folder, name);

    /* Assign old ID value */
    if (id != null)
      newsbin.setProperty(ID_KEY, id);

    /* Recursively Interpret Children */
    List<?> children = newsBinElement.getChildren();
    for (Iterator<?> iter = children.iterator(); iter.hasNext();) {
      Element child = (Element) iter.next();
View Full Code Here

   * @return a list of {@link INewsBin} loaded from the provided IDs.
   */
  public static List<INewsBin> toBins(Long[] primitives) {
    List<INewsBin> bins = new ArrayList<INewsBin>(primitives.length);
    for (Long id : primitives) {
      INewsBin bin = DynamicDAO.load(INewsBin.class, id);
      if (bin != null)
        bins.add(bin);
    }

    return bins;
View Full Code Here

    /* News Bins */
    if (primitives.length == 3) {
      for (int i = 0; primitives[NEWSBIN] != null && i < primitives[NEWSBIN].length; i++) {
        try {
          if (primitives[NEWSBIN][i] != null && primitives[NEWSBIN][i] != 0) {
            INewsBin newsbin = new NewsBinReference(primitives[NEWSBIN][i]).resolve();
            if (newsbin != null)
              childs.add(newsbin);
          }
        } catch (PersistenceException e) {
          /* Ignore - Could be deleted already */
 
View Full Code Here

    }
    if (!statesUpdateInfos.isEmpty()) {
      Set<FeedLinkReference> removedFeedRefs = new HashSet<FeedLinkReference>();
      INewsBinDAO newsBinDAO = DynamicDAO.getDAO(INewsBinDAO.class);
      for (Map.Entry<Long, List<StatesUpdateInfo>> mapEntry : statesUpdateInfos.entrySet()) {
        INewsBin newsBin = newsBinDAO.load(mapEntry.getKey());
        if (newsBin.updateNewsStates(mapEntry.getValue())) {
          removeNews(db, removedFeedRefs, newsBin.removeNews(EnumSet.of(INews.State.DELETED)));
          putEventTemplate(new NewsBinEvent(newsBin, null, true));
          db.ext().store(newsBin, Integer.MAX_VALUE);
        }
      }
      removeFeedsAfterNewsBinUpdate(db, removedFeedRefs);
View Full Code Here

      /* Receive NewsBins */
      if (value.length == 3) {
        for (int i = 0; value[2] != null && i < value[2].length; i++) {
          if (value[2][i] != null) {
            INewsBin newsbin = new NewsBinReference(value[2][i]).resolve();
            if (newsbin != null)
              addNewsBinLocationClause(bQuery, newsbin);
          }
        }
      }
View Full Code Here

      SearchMarkEvent eventTemplate = (SearchMarkEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new SearchMarkEvent(mark, oldParent, root);
    }
    else if (entity instanceof INewsBin) {
      INewsBin newsBin = (INewsBin) entity;
      NewsBinEvent eventTemplate = (NewsBinEvent) template;
      IFolder oldParent = eventTemplate == null ? null : eventTemplate.getOldParent();
      modelEvent = new NewsBinEvent(newsBin, oldParent, root);
    }
    else if (entity instanceof IFolder) {
View Full Code Here

    /* Get the parent Folder */
    IFolder parent = fPage.getFolder();

    /* Create the NewsBin */
    INewsBin fNewsbin = factory.createNewsBin(null, parent, name, fPosition, fPosition != null ? true : null);

    /* Copy all Properties from Parent into this Mark */
    Map<String, Serializable> properties = parent.getProperties();
    for (Map.Entry<String, Serializable> property : properties.entrySet())
      fNewsbin.setProperty(property.getKey(), property.getValue());

    DynamicDAO.save(parent);

    return true;
  }
View Full Code Here

        name = bookMark.getName();
      else
        name = feedRef;

      if (news.getParentId() != 0) {
        INewsBin bin = DynamicDAO.load(INewsBin.class, news.getParentId());
        if (bin != null) {
          name = NLS.bind(Messages.SearchNewsDialog_BIN_NAME, bin.getName(), name);
        }
      }

      return StringUtils.replaceAll(name, "&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
    }
View Full Code Here

TOP

Related Classes of org.rssowl.core.persist.INewsBin

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.