Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.IFolder


    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(2, 10, 10));

    /* Location */
    IFolder sameParent = getSameParent(fEntities);
    if (sameParent != null) {
      separateFromTop = true;

      Label locationLabel = new Label(container, SWT.None);
      locationLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
View Full Code Here


    return container;
  }

  private IFolder getSameParent(List<IEntity> entities) {
    IFolder parent = null;

    for (IEntity entity : entities) {
      if (!(entity instanceof IFolderChild))
        return null;

      IFolderChild folderChild = (IFolderChild) entity;
      IFolder folder = folderChild.getParent();
      if (parent == null)
        parent = folder;
      else if (parent != folder)
        return null;
    }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testNoUpdateEventWithRemoveEvent() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    fFactory.createFolder(null, folder, "Child folder #1");
    fFactory.createFolder(null, folder, "Child folder #2");
    fFactory.createFolder(null, folder, "Child folder #3");
    final IFolder savedFolder = DynamicDAO.save(folder);
    final IFolder savedChildFolder1 = savedFolder.getFolders().get(0);
    final IFolder savedChildFolder2 = savedFolder.getFolders().get(1);
    final IFolder savedChildFolder3 = savedFolder.getFolders().get(2);
    List<IFolder> foldersToRemove = new ArrayList<IFolder>();
    foldersToRemove.add(savedChildFolder1);
    foldersToRemove.add(savedChildFolder2);

    final boolean[] folderDeletedCalled = new boolean[1];
    final boolean[] folderUpdatedCalled = new boolean[1];
    FolderListener listener = new FolderAdapter() {
      @Override
      public void entitiesAdded(Set<FolderEvent> events) {
        fail("Unexpected folder added event");
      }

      @Override
      public void entitiesDeleted(Set<FolderEvent> events) {
        assertEquals(2, events.size());
        for (FolderEvent event : events) {
          IFolder folder = event.getEntity();
          if (!folder.equals(savedChildFolder1) && (!folder.equals(savedChildFolder2)))
            fail("No delete event expected for folder: " + folder.getId());

          folderDeletedCalled[0] = true;
        }
      }

View Full Code Here

   * Tests that updating a folder's property and saving it again has the desired
   * effect.
   */
  @Test
  public void testUpdateFolderProperties() {
    IFolder folder = fFactory.createFolder(null, null, "folder");
    String key = "key";
    String value = "value";
    folder.setProperty(key, value);
    DynamicDAO.save(folder);

    String newValue = "newValue";
    folder.setProperty(key, newValue);
    DynamicDAO.save(folder);

    folder = null;
    System.gc();
    folder = Owl.getPersistenceService().getDAOService().getFolderDAO().loadRoots().iterator().next();
    assertEquals(newValue, folder.getProperty(key));
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testRemoveSearchConditionWithoutSearchMark() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    ISearchMark searchMark = fFactory.createSearchMark(null, folder, "Mark");
    ISearchField searchField = fFactory.createSearchField(0, INews.class.getName());
    fFactory.createSearchCondition(null, searchMark, searchField, SearchSpecifier.BEGINS_WITH, "Some value");
    IFolder savedFolder = DynamicDAO.save(folder);
    ISearchMark savedMark = (ISearchMark) savedFolder.getMarks().get(0);
    DynamicDAO.delete(savedMark.getSearchConditions().get(0));
    assertNotNull(DynamicDAO.load(ISearchMark.class, savedMark.getId()));
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testRemoveFolderWithoutParentFolder() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    fFactory.createFolder(null, folder, "Child folder");
    IFolder savedFolder = DynamicDAO.save(folder);
    IFolder savedChildFolder = savedFolder.getFolders().get(0);
    DynamicDAO.delete(savedChildFolder);
    assertNotNull(DynamicDAO.load(IFolder.class, savedFolder.getId()));
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testRemoveSearchMarkWithoutFolder() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    fFactory.createSearchMark(null, folder, "Mark");
    IFolder savedFolder = DynamicDAO.save(folder);
    ISearchMark savedMark = (ISearchMark) savedFolder.getMarks().get(0);
    DynamicDAO.delete(savedMark);
    assertNotNull(DynamicDAO.load(IFolder.class, savedFolder.getId()));
  }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testRemoveSearchUpdatesFolder() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    fFactory.createSearchMark(null, folder, "Mark");
    final IFolder savedFolder = DynamicDAO.save(folder);

    final boolean[] folderUpdatedCalled = new boolean[1];
    FolderListener folderListener = new FolderListener() {
      public void entitiesAdded(Set<FolderEvent> events) {
        fail("folderAdded should not be called");
      }

      public void entitiesDeleted(Set<FolderEvent> events) {
        fail("folderDeleted should not be called");
      }

      public void entitiesUpdated(Set<FolderEvent> events) {
        assertEquals(1, events.size());
        assertEquals(true, events.iterator().next().getEntity().equals(savedFolder));
        folderUpdatedCalled[0] = true;
      }
    };
    DynamicDAO.addEntityListener(IFolder.class, folderListener);
    try {
      ISearchMark savedMark = (ISearchMark) savedFolder.getMarks().get(0);
      DynamicDAO.delete(savedMark);
      assertTrue("folderUpdated was not called", folderUpdatedCalled[0]);
    } finally {
      DynamicDAO.removeEntityListener(IFolder.class, folderListener);
    }
View Full Code Here

   *
   * @throws Exception
   */
  @Test
  public void testRemoveBookMarkWithoutFolder() throws Exception {
    IFolder folder = fFactory.createFolder(null, null, "Folder");
    IFeed feed = createFeed("http://www.someurl.com");
    feed = DynamicDAO.save(feed);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
    IFolder savedFolder = DynamicDAO.save(folder);
    IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
    DynamicDAO.delete(savedMark);
    assertNotNull(DynamicDAO.load(IFolder.class, savedFolder.getId()));
  }
View Full Code Here

   * @throws Exception
   */
  @Test
  public void testRemoveBookMarkAndFeed() throws Exception {
    {
      IFolder folder = fFactory.createFolder(null, null, "Folder");
      IFeed feed = createFeed("http://www.someurl.com");
      feed = DynamicDAO.save(feed);
      fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark");
      IFolder savedFolder = DynamicDAO.save(folder);
      IBookMark savedMark = (IBookMark) savedFolder.getMarks().get(0);
      IFeed savedFeed = savedMark.getFeedLinkReference().resolve();
      DynamicDAO.delete(savedMark);
      assertNull("Feed must also be deleted since no more bookmarks reference it", DynamicDAO.load(IFeed.class, savedFeed.getId()));
    }
    {
      IFolder folder = fFactory.createFolder(null, null, "AnotherFolder");
      IFeed feed = createFeed("http://www.anotherurl.com");
      feed = DynamicDAO.save(feed);
      fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark1");
      fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "Mark2");
      IFolder savedFolder = DynamicDAO.save(folder);
      IBookMark savedMark1 = (IBookMark) savedFolder.getMarks().get(0);
      IBookMark savedMark2 = (IBookMark) savedFolder.getMarks().get(1);
      if (savedMark1.getName().equals("Mark2")) {
        IBookMark tempMark = savedMark1;
        savedMark1 = savedMark2;
        savedMark2 = tempMark;
      }
View Full Code Here

TOP

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

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.