Support Content getText()
[gpl/argeo-jcr.git] / org.argeo.cms.jcr / src / org / argeo / cms / jcr / acr / JcrContent.java
index da38c969ce0e3000487fe03b6d386d2aa35a48bc..a46dd859fd0e5df2f605da056eba5d9d96be80c8 100644 (file)
@@ -44,6 +44,7 @@ import org.argeo.cms.acr.ContentUtils;
 import org.argeo.jcr.Jcr;
 import org.argeo.jcr.JcrException;
 import org.argeo.jcr.JcrUtils;
+import org.argeo.jcr.JcrxApi;
 
 /** A JCR {@link Node} accessed as {@link Content}. */
 public class JcrContent extends AbstractContent {
@@ -168,7 +169,7 @@ public class JcrContent extends AbstractContent {
                try {
                        // Note: it is important to to use the default way (recursing through parents),
                        // since the session may not have access to parent nodes
-                       return ContentUtils.ROOT_SLASH + jcrWorkspace + getJcrNode().getPath();
+                       return Content.ROOT_PATH + jcrWorkspace + getJcrNode().getPath();
                } catch (RepositoryException e) {
                        throw new JcrException("Cannot get depth of " + getJcrNode(), e);
                }
@@ -201,6 +202,13 @@ public class JcrContent extends AbstractContent {
        public int getSiblingIndex() {
                return Jcr.getIndex(getJcrNode());
        }
+       
+       
+
+       @Override
+       public String getText() {
+               return  JcrxApi.getXmlValue(getJcrNode());
+       }
 
        /*
         * MAP OPTIMISATIONS
@@ -552,7 +560,7 @@ public class JcrContent extends AbstractContent {
                        if (contentSession == null)
                                throw new IllegalArgumentException(
                                                "Cannot adapt " + node + " to content, because it was not loaded from a content session");
-                       return contentSession.get(ContentUtils.SLASH + CmsConstants.SYS_WORKSPACE + node.getPath());
+                       return contentSession.get(Content.ROOT_PATH + CmsConstants.SYS_WORKSPACE + node.getPath());
                } catch (RepositoryException e) {
                        throw new JcrException("Cannot adapt " + node + " to a content", e);
                }