Package org.rssowl.core.persist

Examples of org.rssowl.core.persist.ICategory


        }
      };
      DynamicDAO.addEntityListener(IPerson.class, personListener);

      /* Check Category Deleted */
      final ICategory category1 = fFactory.createCategory(null, newsRef1.resolve());
      final CategoryReference categoryRef1 = new CategoryReference(DynamicDAO.save(category1).getId());
      final ICategory category2 = fFactory.createCategory(null, newsRef2.resolve());
      final CategoryReference categoryRef2 = new CategoryReference(DynamicDAO.save(category2).getId());

      final boolean categoryDeleted[] = new boolean[2];
      categoryListener = new CategoryAdapter() {
        @Override
        public void entitiesDeleted(Set<CategoryEvent> events) {
          for (CategoryEvent event : events) {
            assertFalse("Expected this Event to be no Root Event", event.isRoot());

            ICategory category = event.getEntity();

            if (categoryRef1.references(category))
              categoryDeleted[0] = true;

            else if (categoryRef2.references(category))
View Full Code Here


    IPerson author = fFactory.createPerson(null, news1);
    author.setName("Benjamin Pasero");
    author.setEmail(new URI("foo@bar.de"));
    news1.setAuthor(author);

    ICategory category = fFactory.createCategory(null, news1);
    category.setName("category");
    news1.addCategory(category);

    IAttachment attachment = fFactory.createAttachment(null, news1);
    attachment.setLink(new URI("attachment"));
    news1.addAttachment(attachment);
View Full Code Here

  /**
   * @throws Exception
   */
  @Test
  public void testIsCategoryChange() throws Exception {
    ICategory cat1 = new Category();
    cat1.setName("Cat1");

    ICategory cat2 = new Category();
    cat2.setName("Cat2");

    ICategory cat3 = new Category();
    cat3.setName("Cat3");

    IFeed feed = new Feed(new URI("http://www.link.com"));
    INews news1 = new News(null, feed, new Date());
    news1.addCategory(cat1);

View Full Code Here

    assertFalse("Unexpected Folder Event", bool[0]);
  }

  private ICategory createFeedCategory() throws PersistenceException {
    IFeed feed = DynamicDAO.save(createFeed());
    ICategory category = fTypesFactory.createCategory(null, feed);
    category.setName("categoryName");
    category.setDomain("some/domain");
    category.setProperty("one_property", "value");
    return category;
  }
View Full Code Here

  }

  private ICategory createNewsCategory() throws PersistenceException {
    IFeed feed = DynamicDAO.save(createFeed());
    INews news = DynamicDAO.save(createNews(feed));
    ICategory category = fTypesFactory.createCategory(null, news);
    category.setName("categoryName");
    category.setDomain("some/domain");
    category.setProperty("one_property", "value");
    return category;
  }
View Full Code Here

   * exception is thrown.
   */
  @Test
  public void testAddAndDeleteFeedCategory() {
    try {
      ICategory category = createFeedCategory();
      ICategory savedCategory = DynamicDAO.save(category);
      DynamicDAO.delete(savedCategory);
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

   * exception is thrown.
   */
  @Test
  public void testAddAndDeleteNewsCategory() {
    try {
      ICategory category = createNewsCategory();
      ICategory savedCategory = DynamicDAO.save(category);
      DynamicDAO.delete(savedCategory);
    } catch (PersistenceException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here

  private INews createNews(IFeed feed) {
    INews news = fTypesFactory.createNews(null, feed, createDate());
    IAttachment attachment = fTypesFactory.createAttachment(null, news);
    attachment.setLink(createURI("http://attachmenturi.com"));
    ICategory category = fTypesFactory.createCategory(null, news);
    category.setName("Category name #1");
    news.setAuthor(createPersonMary(news));
    news.setBase(createURI("http://www.someuri.com"));
    news.setComments("One comment");
    news.setState(State.HIDDEN);
    news.setDescription("News description");
View Full Code Here

        cloud.setProtocol(attribute.getValue());
    }
  }

  private void processCategory(Element element, IEntity type) {
    ICategory category = Owl.getModelFactory().createCategory(null, type);
    category.setName(element.getText());

    /* Interpret Attributes */
    List< ? > categoryAttributes = element.getAttributes();
    for (Iterator< ? > iter = categoryAttributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, category))
        continue;

      /* Domain */
      else if ("domain".equals(name)) //$NON-NLS-1$
        category.setDomain(attribute.getValue());
    }
  }
View Full Code Here

      }
    }
  }

  private void processCategory(Element element, IEntity type) {
    ICategory category = Owl.getModelFactory().createCategory(null, type);

    /* Interpret Attributes */
    List< ? > categoryAttributes = element.getAttributes();
    for (Iterator< ? > iter = categoryAttributes.iterator(); iter.hasNext();) {
      Attribute attribute = (Attribute) iter.next();
      String name = attribute.getName().toLowerCase();

      /* Check wether this Attribute is to be processed by a Contribution */
      if (processAttributeExtern(attribute, category))
        continue;

      /* Term */
      else if ("term".equals(name)) {//$NON-NLS-1$
        category.setDomain(attribute.getValue());

        /* Use as Name if not yet set */
        if (category.getName() == null)
          category.setName(attribute.getValue());
      }

      /* Label */
      else if ("label".equals(name)) //$NON-NLS-1$
        category.setName(attribute.getValue());
    }
  }
View Full Code Here

TOP

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

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.