Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ILabel


  @Test
  @SuppressWarnings( { "nls", "null", "unused", "unchecked" })
  public void testImport_Labels_Order_ExistingLabels() throws Exception {
    IFolder root = DynamicDAO.save(Owl.getModelFactory().createFolder(null, null, "Root"));

    ILabel fooLabel = Owl.getModelFactory().createLabel(null, "Foo");
    fooLabel.setOrder(0);

    ILabel barLabel = Owl.getModelFactory().createLabel(null, "Bar");
    barLabel.setOrder(1);

    DynamicDAO.save(fooLabel);
    DynamicDAO.save(barLabel);

    /* Import */
 
View Full Code Here


  @Test
  @SuppressWarnings( { "nls", "null", "unused", "unchecked" })
  public void testImport_Labels_Order_ExistingLabels_Merge() throws Exception {
    IFolder root = DynamicDAO.save(Owl.getModelFactory().createFolder(null, null, "Root"));

    ILabel laterLabel = Owl.getModelFactory().createLabel(null, "Later");
    laterLabel.setOrder(1);

    ILabel personalLabel = Owl.getModelFactory().createLabel(null, "Personal");
    personalLabel.setOrder(0);

    DynamicDAO.save(laterLabel);
    DynamicDAO.save(personalLabel);

    /* Import */
    List<? extends IEntity> elements = Owl.getInterpreter().importFrom(getClass().getResourceAsStream("/data/importer/labels.opml"));
    assertEquals(5, elements.size());
    assertEquals(5, count(Label.class.getName(), elements));

    ImportUtils.doImport(null, elements, false);

    for (IEntity entity : elements) {
      ILabel label = (ILabel) entity;
      if ("Later".equals(label.getName()))
        assertEquals(0, label.getOrder());
      else if ("Personal".equals(label.getName()))
        assertEquals(1, label.getOrder());
      else if ("Important".equals(label.getName()))
        assertEquals(2, label.getOrder());
      else if ("Work".equals(label.getName()))
        assertEquals(3, label.getOrder());
      else if ("To Do".equals(label.getName()))
        assertEquals(4, label.getOrder());
    }
  }
View Full Code Here

    DynamicDAO.save(filter);
  }

  private void fillLabels() {
    ILabel label = fFactory.createLabel(null, "Later");
    label.setColor("113,21,88");
    label.setOrder(4);
    DynamicDAO.save(label);

    label = fFactory.createLabel(null, "Personal");
    label.setColor("105,130,73");
    label.setOrder(3);
    DynamicDAO.save(label);

    fImportantLabel = fFactory.createLabel(null, "Important");
    fImportantLabel.setColor("177,39,52");
    fImportantLabel.setOrder(2);
    DynamicDAO.save(fImportantLabel);

    label = fFactory.createLabel(null, "Work");
    label.setColor("234,152,79");
    label.setOrder(1);
    DynamicDAO.save(label);

    label = fFactory.createLabel(null, "To Do");
    label.setColor("113,160,168");
    label.setOrder(0);
    DynamicDAO.save(label);
  }
View Full Code Here

  @Test
  @SuppressWarnings( { "nls", "null" })
  public void testExportImportCompleteBackupOPML() throws Exception {

    /* Pre-Create some Labels for Testing merge behavior */
    ILabel label = fFactory.createLabel(null, "Later");
    label.setColor("113,21,88");
    label.setOrder(0);
    DynamicDAO.save(label);

    label = fFactory.createLabel(null, "Personal");
    label.setColor("0,0,0");
    label.setOrder(1);
    DynamicDAO.save(label);

    exportImportCompleteOPML(true);
  }
View Full Code Here

        assertEquals(1, filter.getActions().size());
        assertEquals(LabelNewsAction.ID, filter.getActions().get(0).getActionId());
        Object data = filter.getActions().get(0).getData();
        assertNotNull(data);
        assertEquals(true, data instanceof Long);
        ILabel label = DynamicDAO.getDAO(ILabelDAO.class).load(((Long) data).longValue());
        assertNotNull(label);
        assertEquals(fImportantLabel.getName(), label.getName());
      }

      else if ("Filter 7".equals(filter.getName())) {
        assertEquals(3, filter.getActions().size());
        assertEquals(LabelNewsAction.ID, filter.getActions().get(0).getActionId());
        Object data = filter.getActions().get(0).getData();
        assertNotNull(data);
        assertEquals(true, data instanceof Long);
        ILabel label = DynamicDAO.getDAO(ILabelDAO.class).load(((Long) data).longValue());
        assertNotNull(label);
        assertEquals(fImportantLabel.getName(), label.getName());

        assertEquals(MoveNewsAction.ID, filter.getActions().get(1).getActionId());
        data = filter.getActions().get(1).getData();
        assertNotNull(data);
        assertEquals(true, data instanceof Long[]);
View Full Code Here

      }
    }

    /* Group by Label */
    {
      ILabel label1 = fFactory.createLabel(null, "Label 1");
      ILabel label2 = fFactory.createLabel(null, "Label 2");
      news6.addLabel(label1);
      news7.addLabel(label2);

      fGrouping.setType(NewsGrouping.Type.GROUP_BY_LABEL);
      Collection<EntityGroup> group = fGrouping.group(input);
View Full Code Here

      IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com/feed.xml"));

      INews news1 = createNews(feed, "Foo", "http://www.news.com/news1.html", State.READ);
      ICategory news1cat1 = fFactory.createCategory(null, news1);
      news1cat1.setName("apple");
      ILabel label1 = fFactory.createLabel(null, "work");
      news1.addLabel(label1);

      INews news2 = createNews(feed, " Bar", "http://www.news.com/news2.html", State.NEW);
      IPerson author2 = fFactory.createPerson(null, news2);
      author2.setName("Benjamin Pilazzi");
      ICategory news2cat1 = fFactory.createCategory(null, news2);
      news2cat1.setName("apple");
      ICategory news2cat2 = fFactory.createCategory(null, news2);
      news2cat2.setName("windows");
      ILabel label2 = fFactory.createLabel(null, "todo");
      news2.addLabel(label2);

      INews news3 = createNews(feed, "Foo Bar", "http://www.news.com/news3.html", State.NEW);
      IPerson author3 = fFactory.createPerson(null, news3);
      author3.setName("Benjamin Pasero");
View Full Code Here

      IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com/feed.xml"));

      INews news1 = createNews(feed, "Foo", "http://www.news.com/news1.html", State.READ);
      ICategory news1cat1 = fFactory.createCategory(null, news1);
      news1cat1.setName("apple");
      ILabel label1 = fFactory.createLabel(null, "work");
      news1.addLabel(label1);

      INews news2 = createNews(feed, " Bar", "http://www.news.com/news2.html", State.NEW);
      IPerson author2 = fFactory.createPerson(null, news2);
      author2.setName("Benjamin Pilazzi");
      ICategory news2cat1 = fFactory.createCategory(null, news2);
      news2cat1.setName("apple");
      ICategory news2cat2 = fFactory.createCategory(null, news2);
      news2cat2.setName("windows");
      ILabel label2 = fFactory.createLabel(null, "todo");
      news2.addLabel(label2);

      INews news3 = createNews(feed, "Foo Bar", "http://www.news.com/news3.html", State.NEW);
      IPerson author3 = fFactory.createPerson(null, news3);
      author3.setName("Benjamin Pasero");
View Full Code Here

      IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com/feed.xml"));

      INews news1 = createNews(feed, "Foo", "http://www.news.com/news1.html", State.READ);
      ICategory news1cat1 = fFactory.createCategory(null, news1);
      news1cat1.setName("apple");
      ILabel label1 = fFactory.createLabel(null, "work");
      news1.addLabel(label1);
      IAttachment att1news1 = fFactory.createAttachment(null, news1);
      att1news1.setLink(new URI("http://www.attachment.com/att1news1.file"));
      att1news1.setType("bin/mp3");

      INews news2 = createNews(feed, " Bar", "http://www.news.com/news2.html", State.NEW);
      news2.setRating(10);
      ICategory news2cat1 = fFactory.createCategory(null, news2);
      news2cat1.setName("apple");
      ICategory news2cat2 = fFactory.createCategory(null, news2);
      news2cat2.setName("windows");
      ILabel label2 = fFactory.createLabel(null, "todo");
      news2.addLabel(label2);
      IAttachment att1news2 = fFactory.createAttachment(null, news2);
      att1news2.setLink(new URI("http://www.attachment.com/att1news2.file"));
      att1news2.setType("bin/doc");
      IAttachment att2news2 = fFactory.createAttachment(null, news2);
View Full Code Here

      IFeed feed = fFactory.createFeed(null, new URI("http://www.feed.com/feed.xml"));

      INews news1 = createNews(feed, "Foo", "http://www.news.com/news1.html", State.READ);
      ICategory news1cat1 = fFactory.createCategory(null, news1);
      news1cat1.setName("apple");
      ILabel label1 = fFactory.createLabel(null, "work");
      news1.addLabel(label1);
      IAttachment att1news1 = fFactory.createAttachment(null, news1);
      att1news1.setLink(new URI("http://www.attachment.com/att1news1.file"));
      att1news1.setType("bin/mp3 Pasero");

      INews news2 = createNews(feed, " Bar", "http://www.news.com/news2.html", State.NEW);
      news2.setRating(10);
      ICategory news2cat1 = fFactory.createCategory(null, news2);
      news2cat1.setName("apple");
      ICategory news2cat2 = fFactory.createCategory(null, news2);
      news2cat2.setName("pasero");
      ILabel label2 = fFactory.createLabel(null, "todo");
      news2.addLabel(label2);
      IAttachment att1news2 = fFactory.createAttachment(null, news2);
      att1news2.setLink(new URI("http://www.attachment.com/att1news2.file"));
      att1news2.setType("bin/doc");
      IAttachment att2news2 = fFactory.createAttachment(null, news2);
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.