01: package org.getahead.dwrdemo.gidemo.bus;
02:
03: import jsx3.xml.CdfDocument;
04: import jsx3.xml.Record;
05:
06: import org.apache.commons.logging.Log;
07: import org.apache.commons.logging.LogFactory;
08:
09: /**
10: *
11: * @author Joe Walker [joe at getahead dot ltd dot uk]
12: */
13: public class ConvertedCountries {
14: /**
15: * Convert to a {@link CdfDocument} to export
16: * @return A {@link CdfDocument} that contains the countries
17: */
18: public CdfDocument getCountries() {
19: CdfDocument document = new CdfDocument("root");
20:
21: int index = 1;
22: for (Country country : countries.getCountries()) {
23: document.appendRecord(new Record(country.getId())
24: .setAttribute("index", String.valueOf(index++))
25: .setText(country.getName()));
26: }
27:
28: log.info("XML=" + document.toXml());
29: return document;
30: }
31:
32: private Countries countries = new Countries();
33:
34: /**
35: * The log stream
36: */
37: private static Log log = LogFactory
38: .getLog(ConvertedCountries.class);
39: }
|