| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DirsInDirDom |
|
| 2.0;2 |
| 1 | /****************************************************************************** | |
| 2 | * DirsInDirDom.java - DOM to fetch a list of directories in this directory | |
| 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 | ||
| 19 | /** DOM to fetch a list of directories in this directory. <br> | |
| 20 | * @author Dick Balaska | |
| 21 | * @since 2008/08/15 | |
| 22 | * @see <a href="http://cvs.buckosoft.com/Projects/java/PicMan/PicMan/src/com/buckosoft/PicMan/dom/DirsInDirDom.java">DirsInDirDom.java</a> | |
| 23 | */ | |
| 24 | 0 | public class DirsInDirDom { |
| 25 | /** Create a DOM of the dirs in this directory | |
| 26 | * @param rid The root id to look under | |
| 27 | * @param dir The subdirectory to look under. "" means look under the top directory. | |
| 28 | * @return A DOM of dirNames | |
| 29 | */ | |
| 30 | static public Document createDocument(PicManFacade pmf, int rid, String dir) { | |
| 31 | 0 | Document document = DocumentHelper.createDocument(); |
| 32 | 0 | Element root = document.addElement("DirsInDir"); |
| 33 | 0 | List<String> list = pmf.getDirsInDir(rid, dir); |
| 34 | 0 | Iterator<String> iter = list.iterator(); |
| 35 | 0 | while (iter.hasNext()) { |
| 36 | 0 | String s = iter.next(); |
| 37 | 0 | Element ele = DocumentHelper.createElement("Dir"); |
| 38 | 0 | ele.addElement("name").addText(s); |
| 39 | 0 | root.add(ele); |
| 40 | 0 | } |
| 41 | 0 | return(document); |
| 42 | } | |
| 43 | ||
| 44 | } |