Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ILabel


   */
  @Test
  public void testProcessFeedWithLabeledNewsByCountKeepUnreadKeepNew() throws Exception {
    long today = DateUtils.getToday().getTimeInMillis();

    ILabel label = DynamicDAO.save(fFactory.createLabel(null, "Label"));

    IFolder folder = DynamicDAO.save(fFactory.createFolder(null, null, "Root"));

    IFeed feed = createFeedWithNews(new URI("http://www.url.com"), 100, 100, today - 7 * DAY, today - 6 * DAY, 0, true, label);
    fFactory.createBookMark(null, folder, new FeedLinkReference(feed.getLink()), "BookMark1");
View Full Code Here


  /**
   * @throws Exception
   */
  @Test
  public void testCachingLabelDAO() throws Exception {
    ILabel label1 = fFactory.createLabel(null, "Hello");
    label1.setOrder(5);
    label1= DynamicDAO.save(label1);
    Long label1Id = label1.getId();

    ILabel label2 = fFactory.createLabel(null, "Hello World");
    label2.setColor("255,255,0");
    label2= DynamicDAO.save(label2);
    Long label2Id = label2.getId();

    ILabel label3 = fFactory.createLabel(null, "Foo Bar");
    label3.setProperty("key", "value");
    label3= DynamicDAO.save(label3);
    Long label3Id = label3.getId();

    DynamicDAO.save(label1);
    DynamicDAO.save(label2);
    DynamicDAO.save(label3);

    label1 = null;
    label2 = null;
    label3 = null;

    /* Reopen Database */
    Owl.getPersistenceService().shutdown(false);
    System.gc();
    Owl.getPersistenceService().startup(new NullOperationMonitor());

    /* Assert Folders */
    CachingDAO dao = (CachingDAO) DynamicDAO.getDAO(ILabelDAO.class);

    label1 = (ILabel) dao.load(label1Id);
    assertEquals("Hello", label1.getName());
    assertEquals(5, label1.getOrder());

    label2 = (ILabel) dao.load(label2Id);
    assertEquals("Hello World", label2.getName());
    assertEquals("255,255,0", label2.getColor());

    label3 = (ILabel) dao.load(label3Id);
    assertEquals("Foo Bar", label3.getName());
    assertEquals("value", label3.getProperty("key"));
  }
View Full Code Here

      public void entitiesUpdated(Set<LabelEvent> events) {
        if (!fShuttingDown) {
          updateLabelCommands();

          for (LabelEvent event : events) {
            ILabel oldLabel = event.getOldLabel();
            ILabel updatedLabel = event.getEntity();
            if (!oldLabel.getName().equals(updatedLabel.getName())) {
              updateLabelConditions(oldLabel.getName(), updatedLabel.getName());
            }
          }
        }
      }
View Full Code Here

      fShowWelcome = true;
    }
  }

  private void addDefaultLabels() throws PersistenceException {
    ILabel label = fFactory.createLabel(null, Messages.Controller_IMPORTANT);
    label.setColor("163,21,2"); //$NON-NLS-1$
    label.setOrder(0);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, Messages.Controller_WORK);
    label.setColor("200,118,10"); //$NON-NLS-1$
    label.setOrder(1);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, Messages.Controller_PERSONAL);
    label.setColor("82,92,58"); //$NON-NLS-1$
    label.setOrder(2);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, Messages.Controller_TODO);
    label.setColor("92,101,126"); //$NON-NLS-1$
    label.setOrder(3);
    fLabelDao.save(label);

    label = fFactory.createLabel(null, Messages.Controller_LATER);
    label.setColor("82,16,0"); //$NON-NLS-1$
    label.setOrder(4);
    fLabelDao.save(label);
  }
View Full Code Here

  /**
   * @throws Exception
   */
  @Test
  public void testLabelAction() throws Exception {
    ILabel label1 = DynamicDAO.save(fFactory.createLabel(null, "Foo"));

    IFeed feed = Owl.getModelFactory().createFeed(null, new URI("feed"));
    INews news1 = Owl.getModelFactory().createNews(null, feed, new Date());
    news1.setTitle("News 1");
    INews news2 = Owl.getModelFactory().createNews(null, feed, new Date());
View Full Code Here

    assertEquals("C News", ((INews) elements[0]).getTitle());
    assertEquals("B News", ((INews) elements[1]).getTitle());
    assertEquals("A News", ((INews) elements[2]).getTitle());

    ILabel label1 = Owl.getModelFactory().createLabel(null, "Label 1");
    label1.setOrder(0);

    ILabel label2 = Owl.getModelFactory().createLabel(null, "Label 2");
    label2.setOrder(1);

    ILabel label3 = Owl.getModelFactory().createLabel(null, "Label 3");
    label3.setOrder(2);

    news1.addLabel(label1);
    comp.setAscending(true);

    comp.sort(null, elements);
View Full Code Here

  @Test
  public void testApplicationServer() throws Exception {
    ApplicationServer server = ApplicationServer.getDefault();
    server.startup();

    ILabel label = DynamicDAO.save(fFactory.createLabel(null, "Label"));

    IFeed feed = Owl.getModelFactory().createFeed(null, new URI("feed"));
    INews news1 = Owl.getModelFactory().createNews(null, feed, new Date(0));
    news1.setTitle("A News");
    news1.setDescription("Foo Bar");
View Full Code Here

        LabelDialog dialog = new LabelDialog(shellProvider.getShell(), DialogMode.ADD, null);
        if (dialog.open() == IDialogConstants.OK_ID) {
          String name = dialog.getName();
          RGB color = dialog.getColor();

          ILabel newLabel = Owl.getModelFactory().createLabel(null, name);
          newLabel.setColor(OwlUI.toString(color));
          newLabel.setOrder(labels.size());
          DynamicDAO.save(newLabel);

          LabelAction labelAction = new LabelAction(newLabel, selection);
          labelAction.run();
        }
View Full Code Here

    assertTrue(category.isIdentical(categories.iterator().next()));
    DynamicDAO.deleteAll(categories);
  }

  private ILabel createLabel() {
    ILabel label = fTypesFactory.createLabel(null, "someLabel");
    label.setColor("200,100,009");
    return label;
  }
View Full Code Here

        }
      };
      DynamicDAO.addEntityListener(ILabel.class, labelListener);
      long savedLabelId = DynamicDAO.save(initialLabel).getId().longValue();
      System.gc();
      ILabel dbLabel = DynamicDAO.load(ILabel.class, savedLabelId);
      initialLabel.setId(dbLabel.getId());
      assertTrue(initialLabel.isIdentical(dbLabel));
      dbLabel.setColor("255,255,137");
      updatedLabel[0] = (Label) dbLabel;
      DynamicDAO.save(dbLabel);
      assertTrue(labelAddedCalled[0]);
      assertTrue(labelUpdatedCalled[0]);
      DynamicDAO.delete(updatedLabel[0]);
View Full Code Here

TOP

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

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.