Clover coverage report - Flock Flock - 0.7-dev
Coverage timestamp: Thu Jan 30 2003 01:35:37 EST
file stats: LOC: 54   Methods: 1
NCLOC: 33   Classes: 1
This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
OpmlSubscriptionExport.java 0% 0% 0% 0%
 1   
 package net.sf.flock.support;
 2   
 
 3   
 import java.util.Collection;
 4   
 import java.util.Iterator;
 5   
 
 6   
 import net.sf.flock.FeedInfoI;
 7   
 import net.sf.flock.SubscriptionInfoI;
 8   
 import org.jdom.Document;
 9   
 import org.jdom.Element;
 10   
 
 11   
 /**
 12   
  * Exports subscriptions to an AmphetaDesk-style OPML document.
 13   
  *
 14   
  * @version    $Revision: 1.10 $
 15   
  * @author    $Author: phraktle $
 16   
  */
 17   
 public class OpmlSubscriptionExport {
 18   
 
 19  0
     public Document export(Collection subscriptions) {
 20   
 
 21  0
         Element root = new Element("opml");
 22  0
         root.setAttribute("version", "1.0");
 23   
 
 24  0
         Element head = new Element("head");
 25  0
         head.addContent( new Element("title").addContent("Flock subscriptions") );
 26  0
         root.addContent( head );
 27   
 
 28  0
         Element body = new Element("body");
 29   
 
 30  0
         for (Iterator i=subscriptions.iterator(); i.hasNext(); ) {
 31  0
             SubscriptionInfoI sub = (SubscriptionInfoI)i.next();
 32  0
             FeedInfoI feed = sub.getFeedInfo();
 33  0
             Element outline = new Element("outline");
 34  0
             outline.setAttribute("description", feed.getTitle());
 35   
 
 36  0
             outline.setAttribute("type", "link");
 37  0
             outline.setAttribute("xmlUrl", sub.getLocation().toExternalForm());
 38  0
             if (feed.getSite()!=null) {
 39  0
                 outline.setAttribute("htmlUrl", feed.getSite().toExternalForm());
 40   
             }
 41   
 
 42  0
             outline.setAttribute("path", sub.getMetaData().get("path") );
 43   
             
 44  0
             body.addContent( outline );            
 45   
         }
 46   
 
 47  0
         root.addContent( body );
 48   
 
 49  0
         Document doc = new Document(root);
 50  0
         return doc;
 51   
     }
 52   
 
 53   
 }
 54