]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/tabular/JcrTabularWriter.java
Improve CSV and tabular
[lgpl/argeo-commons.git] / server / runtime / org.argeo.server.jcr / src / main / java / org / argeo / jcr / tabular / JcrTabularWriter.java
index cd6feb565545b0e643ed3a41f8e9b1ca9a76e15a..0727b784e617507dd8e2dc171d1b671371fab91a 100644 (file)
@@ -30,10 +30,17 @@ public class JcrTabularWriter implements TabularWriter {
                        String contentNodeType) {
                try {
                        for (TabularColumn column : columns) {
-                               Node columnNode = tableNode.addNode(column.getName(),
+                               String normalized = JcrUtils.replaceInvalidChars(column
+                                               .getName());
+                               Node columnNode = tableNode.addNode(normalized,
                                                ArgeoTypes.ARGEO_COLUMN);
-                               columnNode.setProperty(Property.JCR_REQUIRED_TYPE,
-                                               PropertyType.nameFromValue(column.getType()));
+                               columnNode.setProperty(Property.JCR_TITLE, column.getName());
+                               if (column.getType() != null)
+                                       columnNode.setProperty(Property.JCR_REQUIRED_TYPE,
+                                                       PropertyType.nameFromValue(column.getType()));
+                               else
+                                       columnNode.setProperty(Property.JCR_REQUIRED_TYPE,
+                                                       PropertyType.TYPENAME_STRING);
                        }
                        contentNode = tableNode.addNode(Property.JCR_CONTENT,
                                        contentNodeType);
@@ -48,7 +55,7 @@ public class JcrTabularWriter implements TabularWriter {
                }
        }
 
-       public void appendRow(List<?> row) {
+       public void appendRow(Object[] row) {
                csvWriter.writeLine(row);
        }