1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
package org.kuali.rice.kew.xml.export; |
18 | |
|
19 | |
import java.util.Iterator; |
20 | |
|
21 | |
import org.jdom.Element; |
22 | |
import org.kuali.rice.kew.export.ExportDataSet; |
23 | |
import org.kuali.rice.kew.help.HelpEntry; |
24 | |
import org.kuali.rice.kew.xml.XmlConstants; |
25 | |
import org.kuali.rice.kew.xml.XmlRenderer; |
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | 0 | public class HelpEntryXmlExporter implements XmlExporter, XmlConstants { |
36 | |
|
37 | 0 | protected final org.apache.log4j.Logger LOG = org.apache.log4j.Logger.getLogger(getClass()); |
38 | |
|
39 | 0 | private XmlRenderer renderer = new XmlRenderer(HELP_NAMESPACE); |
40 | |
|
41 | |
public Element export(ExportDataSet dataSet) { |
42 | 0 | if (!dataSet.getHelp().isEmpty()) { |
43 | 0 | Element rootElement = renderer.renderElement(null, HELP_ENTRIES); |
44 | 0 | rootElement.setAttribute(SCHEMA_LOCATION_ATTR, HELP_SCHEMA_LOCATION, SCHEMA_NAMESPACE); |
45 | 0 | for (Iterator iterator = dataSet.getHelp().iterator(); iterator.hasNext();) { |
46 | 0 | HelpEntry helpEntry = (HelpEntry)iterator.next(); |
47 | 0 | exportHelpEntry(rootElement, helpEntry); |
48 | 0 | } |
49 | 0 | return rootElement; |
50 | |
} |
51 | 0 | return null; |
52 | |
} |
53 | |
|
54 | |
private void exportHelpEntry(Element parent, HelpEntry helpEntry) { |
55 | 0 | Element helpElement = renderer.renderElement(parent, HELP_ENTRY); |
56 | 0 | renderer.renderTextElement(helpElement, HELP_NAME, helpEntry.getHelpName()); |
57 | 0 | renderer.renderTextElement(helpElement, HELP_KEY, helpEntry.getHelpKey()); |
58 | 0 | renderer.renderCDATAElement(helpElement, HELP_TEXT, helpEntry.getHelpText()); |
59 | 0 | } |
60 | |
|
61 | |
} |