Examples of ItemIF


Examples of de.nava.informa.core.ItemIF

      throw new RuntimeException("link required for item " + title + " for persistence uniqueness");
    }
   
    Query query = session.createQuery("from Item as item where item.linkString = ? ");
    query.setString(0, link.toString());
    ItemIF obj = (ItemIF) query.uniqueResult();
    if (obj == null) {
      obj = new Item(channel, title, description, link);
      if (channel != null) {
        channel.addItem(obj);
      }
View Full Code Here

Examples of de.nava.informa.core.ItemIF

    }

    Collection items = channel.getItems();
    Iterator it = items.iterator();
    while (it.hasNext()) {
      ItemIF item = (ItemIF) it.next();
      Element itemElem = new Element("item");
      itemElem.addContent(new Element("title").setText(item.getTitle()));
      if (item.getLink() != null) {
        itemElem.addContent(new Element("link")
                            .setText(item.getLink().toString()));
      }
      if (item.getDescription() != null) {
        itemElem.addContent(new Element("description")
                            .setText(item.getDescription()));
      }
      if (item.getDate() != null) {
        itemElem.addContent(new Element("pubDate")
                            .setText(ParserUtils.formatDate(item.getDate())));
      }
      channelElem.addContent(itemElem);
    }

    // export channel image           
View Full Code Here

Examples of de.nava.informa.core.ItemIF

      if (channel == null) {
        throw new UnretrievableException("channel " + channelId);
      }
      // TODO: could this be done in another fashion or using a context?
      long itemId = Long.parseLong(doc.get(ItemFieldConstants.ITEM_ID));
      ItemIF item = channel.getItem(itemId);
      if (item == null) {
        throw new UnretrievableException("item " + itemId);
      }
      results.add(new ItemResult(item, hits.score(i)));
    }
View Full Code Here

Examples of de.nava.informa.core.ItemIF

    Element itemsElem = new Element("items", defNs);
    Element seqElem = new Element("Seq", rdfNs);
    Collection items = channel.getItems();
    Iterator it = items.iterator();
    while (it.hasNext()) {
      ItemIF item = (ItemIF) it.next();
      Element itemElem = new Element("li", rdfNs);
      if (item.getLink() != null) {
        itemElem.setAttribute("resource", item.getLink().toString());
      }
      seqElem.addContent(itemElem);
    }
    itemsElem.addContent(seqElem);
    channelElem.addContent(itemsElem);
    rootElem.addContent(channelElem);

    // item-by-item en detail
    items = channel.getItems();
    it = items.iterator();
    while (it.hasNext()) {
      ItemIF item = (ItemIF) it.next();
      Element itemElem = new Element("item", defNs);
      if (item.getLink() != null) {
        itemElem.setAttribute("about",
                              item.getLink().toString(), rdfNs);
      }
      itemElem.addContent(new Element("title", defNs).setText(item.getTitle()));
      if (item.getLink() != null) {
        itemElem.addContent(new Element("link", defNs)
                            .setText(item.getLink().toString()));
      }
      if (item.getDescription() != null) {
        itemElem.addContent(new Element("description", dcNs)
                            .setText(item.getDescription()));
      }
      if (item.getDate() != null) {
        itemElem.addContent(new Element("date", dcNs)
                            .setText(ParserUtils.formatDate(item.getDate())));
      }
                         
      rootElem.addContent(itemElem);
    }
View Full Code Here

Examples of de.nava.informa.core.ItemIF

   
    logger.info("Start writing index.");
    IndexWriter writer = new IndexWriter(indexDir, analyzer, createNewIndex);
    Iterator<ItemIF> itI = items.iterator();
    while (itI.hasNext()) {
      ItemIF item = itI.next();
      if (logger.isDebugEnabled()) {
        logger.debug("Add item " + item + " to index.");
      }
      writer.addDocument(ItemDocument.makeDocument(item));
    }
View Full Code Here

Examples of de.nava.informa.core.ItemIF

        //     }
       
        Collection items = channel.getItems();
        Iterator it = items.iterator();
        while (it.hasNext()) {
            ItemIF item = (ItemIF) it.next();
            Element itemElem = new Element("item");
            itemElem.addContent(new Element("title").setText(item.getTitle()));
            if (item.getLink() != null) {
                itemElem.addContent(new Element("link").setText(item.getLink()
                        .toString()));
            }
            if (item.getDescription() != null) {
                itemElem.addContent(new Element("description").setText(item
                        .getDescription()));
            }
            if (item.getCategories() != null) {
                Collection categories = item.getCategories();
                Iterator catIt = categories.iterator();
                while (catIt.hasNext()) {
                    CategoryIF cat = (CategoryIF) catIt.next();
                    itemElem = getCategoryElements(itemElem, cat, null);
                }
            }
            if (item.getDate() != null) {
                itemElem.addContent(new Element("pubDate").setText(ParserUtils
                        .formatDate(item.getDate())));
            }
            if (item.getGuid() != null) {
                Element guid = new Element("guid").setText(item.getGuid().getLocation());
                guid.setAttribute("isPermaLink", Boolean.toString(item.getGuid().isPermaLink()));
                itemElem.addContent(guid);
            }
            if (item.getComments() != null) {
                itemElem.addContent(new Element("comments").setText(item.getComments()
                        .toString()));
            }
            channelElem.addContent(itemElem);
        }
View Full Code Here

Examples of de.nava.informa.core.ItemIF

    // Create temp and main channels.
    try {
      final ChannelIF cMain = pm.createChannel("main", getTestURL());
      final ChannelIF cTemp = pm.createChannel("temp", getTestURL());
      final ItemIF item1 = pm.createItem(cTemp, "wanted");
      pm.createItem(cTemp, "unwanted");

      // Check items in temp agains main channel.
      ChannelRecord rec = new ChannelRecord(cMain, 0, 0);
      worker.checkItems(cTemp, rec);
View Full Code Here

Examples of de.nava.informa.core.ItemIF

      final ChannelIF cTemp = pm.createChannel("temp", getTestURL());
      pm.createItem(cTemp, "wanted");
      pm.createItem(cTemp, "unwanted");

      // Add duplicate "wanted" item to main channel.
      final ItemIF item3 = pm.createItem(cMain, "wanted");

      // Check items in temp agains main channel.
      worker.checkItems(cTemp, new ChannelRecord(cMain, 0, 0));

      // Check results.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.