Improve JCR
authorMathieu Baudier <mbaudier@argeo.org>
Wed, 5 Oct 2011 15:09:08 +0000 (15:09 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Wed, 5 Oct 2011 15:09:08 +0000 (15:09 +0000)
git-svn-id: https://svn.argeo.org/commons/trunk@4801 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/JcrUtils.java
server/runtime/org.argeo.server.jcr/src/main/java/org/argeo/jcr/tabular/JcrTabularRowIterator.java

index 08f8d55c393727aecb32259c6b6f45df97db931c..eeaff3a924f505cee38124e3ac85a090dbc5295e 100644 (file)
@@ -39,6 +39,7 @@ import javax.jcr.Node;
 import javax.jcr.NodeIterator;
 import javax.jcr.Property;
 import javax.jcr.PropertyIterator;
+import javax.jcr.PropertyType;
 import javax.jcr.Repository;
 import javax.jcr.RepositoryException;
 import javax.jcr.RepositoryFactory;
@@ -379,15 +380,17 @@ public class JcrUtils implements ArgeoJcrConstants {
                        NodeIterator it = node.getNodes();
                        while (it.hasNext()) {
                                Node childNode = it.nextNode();
-                               debug(childNode);
+                               debug(childNode, log);
                        }
 
                        // Then output the properties
                        PropertyIterator properties = node.getProperties();
                        // log.debug("Property are : ");
 
-                       while (properties.hasNext()) {
+                       properties: while (properties.hasNext()) {
                                Property property = properties.nextProperty();
+                               if (property.getType() == PropertyType.BINARY)
+                                       continue properties;// skip
                                if (property.getDefinition().isMultiple()) {
                                        // A multi-valued property, print all values
                                        Value[] values = property.getValues();
index 8223e1d4830d2c5c76995022890ccb23d66b8192..47578f61bc567697edfa5935e50b580f2857e5bc 100644 (file)
@@ -39,7 +39,6 @@ public class JcrTabularRowIterator implements TabularRowIterator {
 
        public JcrTabularRowIterator(Node tableNode) {
                try {
-                       Node contentNode = tableNode.getNode(Property.JCR_CONTENT);
                        for (NodeIterator it = tableNode.getNodes(); it.hasNext();) {
                                Node node = it.nextNode();
                                if (node.isNodeType(ArgeoTypes.ARGEO_COLUMN)) {
@@ -48,13 +47,9 @@ public class JcrTabularRowIterator implements TabularRowIterator {
                                        TabularColumn tc = new TabularColumn(node.getProperty(
                                                        Property.JCR_TITLE).getString(), type);
                                        header.add(tc);
-                                       // } else if (node.getName().equals(Property.JCR_CONTENT)) {
-                                       // contentNode = node;
                                }
                        }
-                       // should not happen since content is mandatory
-                       assert contentNode != null;
-
+                       Node contentNode = tableNode.getNode(Property.JCR_CONTENT);
                        if (contentNode.isNodeType(ArgeoTypes.ARGEO_CSV)) {
                                textLines = new ArrayBlockingQueue<List<String>>(1000);
                                csvParser = new CsvParser() {
@@ -168,4 +163,8 @@ public class JcrTabularRowIterator implements TabularRowIterator {
                return currentRowNumber;
        }
 
+       public List<TabularColumn> getHeader() {
+               return header;
+       }
+
 }