comparison artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java @ 7981:45cced06490c facet-metadata

merged with default.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 30 Jun 2014 11:29:45 +0200
parents a310b1f85ce0
children 705f8b92fd66
comparison
equal deleted inserted replaced
7894:42076d94977e 7981:45cced06490c
60 public static final String DEFAULT_CSV_CHARSET = "UTF-8"; 60 public static final String DEFAULT_CSV_CHARSET = "UTF-8";
61 61
62 /** The default separator for the CSV export. */ 62 /** The default separator for the CSV export. */
63 public static final char DEFAULT_CSV_SEPARATOR = ';'; 63 public static final char DEFAULT_CSV_SEPARATOR = ';';
64 64
65 public static final String START_META_CHAR = "#";
66
65 /** XPath that points to the desired export facet. */ 67 /** XPath that points to the desired export facet. */
66 public static final String XPATH_FACET = "/art:action/@art:type"; 68 public static final String XPATH_FACET = "/art:action/@art:type";
67 69
68 /** The out name to serve. */ 70 /** The out name to serve. */
69 protected String outName; 71 protected String outName;
99 * 101 *
100 * @param writer The CSVWriter. 102 * @param writer The CSVWriter.
101 */ 103 */
102 protected abstract void writeCSVData(CSVWriter writer) throws IOException; 104 protected abstract void writeCSVData(CSVWriter writer) throws IOException;
103 105
106
107 /**
108 * Write lines of informative content to CSV file.
109 * Usually this will be done above the column headers from within
110 * the implementation of writeCSVData in concret subclasses.
111 *
112 * @param writer The CSVWriter
113 * @param infolines Array of Strings with informative content.
114 * Each will be written to a separate line prefixed with START_META_CHAR.
115 */
116 protected void writeCSVInfo(CSVWriter writer, String[] infolines) {
117 String[] metaline = new String[1];
118
119 for (String infoline: infolines) {
120 metaline[0] = START_META_CHAR + " " + infoline;
121 writer.writeNext(metaline);
122 }
123
124 }
104 125
105 /** 126 /**
106 * Concrete subclasses need to use this method to write their special data 127 * Concrete subclasses need to use this method to write their special data
107 * objects into the PDF document. 128 * objects into the PDF document.
108 */ 129 */
261 protected String getFacetFromRequest() { 282 protected String getFacetFromRequest() {
262 return XMLUtils.xpathString( 283 return XMLUtils.xpathString(
263 request, XPATH_FACET, ArtifactNamespaceContext.INSTANCE); 284 request, XPATH_FACET, ArtifactNamespaceContext.INSTANCE);
264 } 285 }
265 286
287 protected String msg(String key) {
288 return Resources.getMsg(context.getMeta(), key, key);
289 }
266 290
267 protected String msg(String key, String def) { 291 protected String msg(String key, String def) {
268 return Resources.getMsg(context.getMeta(), key, def); 292 return Resources.getMsg(context.getMeta(), key, def);
269 } 293 }
270 294

http://dive4elements.wald.intevation.org