View Javadoc
1   /******************************************************************************
2    * ImportAnalyzeDom.java - XML for PicMan's Import Pics Editor
3    * 
4    * PicMan - The BuckoSoft Picture Manager in Java
5    * Copyright(c) 2015 - Dick Balaska
6    * 
7    */
8   package com.buckosoft.PicMan.dom;
9   
10  import java.util.List;
11  
12  import org.dom4j.Document;
13  import org.dom4j.DocumentHelper;
14  import org.dom4j.Element;
15  
16  import com.buckosoft.PicMan.business.PicImporterImpl.PossibleDates;
17  import com.buckosoft.PicMan.domain.Pic;
18  
19  /** XML for PicMan's Import Pics Editor
20   * @author Dick Balaska
21   */
22  public class ImportAnalyzeDom {
23  
24  	static public Document createDocument(List<Pic> possibleDups, PossibleDates pds) {
25  		Document document = DocumentHelper.createDocument();
26  		Element root = document.addElement("ImportAnalysis");
27  		if (possibleDups != null && !possibleDups.isEmpty()) {
28  			Element ele = root.addElement("PossibleDuplicates");
29  			for (Pic pic : possibleDups) {
30  				ele.addElement("pic").addText(pic.getName());
31  			}
32  		}
33  		if (pds.getFileDate() != null)
34  			root.addElement("fileDate").addText("" + pds.getFileDate().getTime());
35  		if (pds.getTakenDate() != null)
36  			root.addElement("takenDate").addText("" + pds.getTakenDate().getTime());
37  		if (pds.getCustomDate() != null)
38  			root.addElement("customDate").addText("" + pds.getCustomDate().getTime());
39  		return(document);
40  	}
41  
42  }