| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 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 | |
|
| 21 | |
|
| 22 | |
|
| 23 | 0 | public class ChainListDom { |
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 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 | |
} |