X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=jcr%2Forg.argeo.cms.jcr%2Fsrc%2Forg%2Fargeo%2Fcms%2Fjcr%2Facr%2FJcrContent.java;h=b0326f48bca43a0b4bc7957b53a80a5e0254f74b;hb=82046539dc06f6b13ddfe2fa1d87051445471477;hp=41672a0e9e24b68ca9ca0a49f64776330d2948d7;hpb=5c9bae758b5bb13ff3b046ad680886ae540865e8;p=lgpl%2Fargeo-commons.git diff --git a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java index 41672a0e9..b0326f48b 100644 --- a/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java +++ b/jcr/org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java @@ -178,6 +178,26 @@ public class JcrContent extends AbstractContent { } + @Override + public String getPath() { + 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(); + } catch (RepositoryException e) { + throw new JcrException("Cannot get depth of " + getJcrNode(), e); + } + } + + @Override + public int getDepth() { + try { + return getJcrNode().getDepth() + 1; + } catch (RepositoryException e) { + throw new JcrException("Cannot get depth of " + getJcrNode(), e); + } + } + @Override public Content getParent() { if (Jcr.isRoot(getJcrNode())) // root @@ -291,7 +311,7 @@ public class JcrContent extends AbstractContent { * TYPING */ @Override - public List getTypes() { + public List getContentClasses() { try { // Node node = getJcrNode(); // List res = new ArrayList<>(); @@ -353,7 +373,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(CmsConstants.SYS_WORKSPACE + node.getPath()); + return contentSession.get(ContentUtils.SLASH + CmsConstants.SYS_WORKSPACE + node.getPath()); } catch (RepositoryException e) { throw new JcrException("Cannot adapt " + node + " to a content", e); }