View Javadoc
1   /******************************************************************************
2    * SetsInChainDom.java - XML Partial  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.Set;
19  
20  /** XML Sets in a chain
21   * @author Dick Balaska
22   */
23  public class SetsInChainDom {
24  	/** Create a DOM of the Sets in this Chain
25  	 * @param pmf The PicMan Facade
26  	 * @param cid The chain Id to query
27  	 * @return A Document of the Sets in this chain
28  	 */
29  	static public Document createDocument(PicManFacade pmf, int cid) {
30  		Document document = DocumentHelper.createDocument();
31  		Element root = document.addElement("PicManSetsInChain");
32  		List<Set> sets = pmf.getDB().getSetsInChain(cid);
33  		Iterator<Set> iter = sets.iterator();
34  		while (iter.hasNext()) {
35  			Set set = iter.next();
36  			root.add(SetManDom.getSetElement(set));
37  		}
38  		return document;
39  	}
40  
41  }