Coverage Report - com.buckosoft.PicMan.dom.ChainListDom
 
Classes in this File Line Coverage Branch Coverage Complexity
ChainListDom
0%
0/16
0%
0/4
3
 
 1  
 /******************************************************************************
 2  
  * ChainListDom.java - XML Chains for PicMan's Editors
 3  
  * 
 4  
  * PicMan - The BuckoSoft Picture Manager in Java
 5  
  * Copyright(c) 2008 - Dick Balaska
 6  
  * 
 7  
  */
 8  
 package com.buckosoft.PicMan.dom;
 9  
 
 10  
 import java.util.Iterator;
 11  
 import java.util.List;
 12  
 
 13  
 import org.dom4j.Document;
 14  
 import org.dom4j.DocumentHelper;
 15  
 import org.dom4j.Element;
 16  
 
 17  
 import com.buckosoft.PicMan.business.PicManFacade;
 18  
 import com.buckosoft.PicMan.domain.Chain;
 19  
 
 20  
 /** XML Chain List
 21  
  * @author Dick Balaska
 22  
  */
 23  0
 public class ChainListDom {
 24  
         /** Create a DOM of a list of all Chains in the database
 25  
          * @param pmf The PicManFacade
 26  
          * @return a Document
 27  
          */
 28  
         static public Document createDocument(PicManFacade pmf) {
 29  0
                 Document document = DocumentHelper.createDocument();
 30  0
                 Element root = document.addElement("PicManChainList");
 31  0
                 List<Chain> chains = pmf.getDB().getChains();
 32  0
                 Iterator<Chain> iter = chains.iterator();
 33  0
                 while (iter.hasNext()) {
 34  0
                         Chain chain = iter.next();
 35  0
                         Element ele = DocumentHelper.createElement("Chain");
 36  0
                         ele.addElement("cid").addText(((Integer)chain.getCid()).toString());
 37  0
                         ele.addElement("name").addText(chain.getName());
 38  0
                         ele.addElement("description").addText(chain.getDescription());
 39  0
                         ele.addElement("active").addText(chain.isActive() ? "1" : "0");
 40  0
                         ele.addElement("contactCount").addText("" + chain.getContactCount());
 41  0
                         root.add(ele);
 42  0
                 }
 43  0
                 return document;
 44  
         }
 45  
 
 46  
 }