1
2
3
4
5
6
7
8 package com.buckosoft.PicMan.dom;
9
10 import java.util.Date;
11
12 import org.dom4j.Document;
13 import org.dom4j.DocumentHelper;
14 import org.dom4j.Element;
15
16 import com.buckosoft.PicMan.business.PicManFacade;
17 import com.buckosoft.PicMan.business.mosaic.MosaicEngine;
18 import com.buckosoft.PicMan.domain.User;
19
20
21
22
23
24
25 public class MosaicManDom {
26
27
28
29
30
31
32
33 static public Document createDocument(PicManFacade pmf, User user) {
34 Document document = DocumentHelper.createDocument();
35 Element root = document.addElement("MosaicMan");
36 getDateElement(root);
37 MosaicEngine me = pmf.getMosaicMan().getMosaicEngine();
38 if (me != null) {
39 root.addElement("masterPic").addText(me.getMasterPicName());
40 root.addElement("lastMosaicUpdate").addText(me.getLastMosaicUpdate().toString());
41 root.addElement("status").addText(me.getStatus());
42 root.addElement("info").addText(me.getInfo());
43 root.addElement("name").addText(me.getName());
44 root.addElement("fileName").addText(me.getOutputFileName());
45 root.addElement("duration").addText(me.getDurationAsString());
46 }
47 return document;
48 }
49
50 private static void getDateElement(Element ele) {
51 Date now = new Date();
52 ele.addElement("date").addText(now.toString());
53 }
54
55 }