Skip to content

Commit

Permalink
Expose methods to get the expanded name/path from Item in
Browse files Browse the repository at this point in the history
JackrabbitSession
  • Loading branch information
kwin committed Jan 17, 2025
1 parent 09905fc commit 1b911c7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,24 @@ default Node getParentOrNull(@NotNull Item item) throws RepositoryException {
return null;
}
}

/**
* Returns the expanded name of the given {@code Item}.
* @param item the item for which to retrieve the name
* @return the name of the item in expanded form.
* @throws RepositoryException if another error occurs.
* @since 1.76.0
* @see <a href="https://s.apache.org/jcr-2.0-spec/3_Repository_Model.html#3.2.5.1%20Expanded%20Form">JCR 2.0, 3.2.5.1 Expanded Form</a>
*/
@NotNull String getExpandedName(@NotNull Item item) throws RepositoryException;

/**
* Returns the expanded path of the given {@code Item}.
* @param item the item for which to retrieve the name
* @return the path of the item in expanded form.
* @throws RepositoryException if another error occurs.
* @since 1.76.0
* @see <a href="https://s.apache.org/jcr-2.0-spec/3_Repository_Model.html#3.2.5.1%20Expanded%20Form">JCR 2.0, 3.2.5.1 Expanded Form</a>
*/
@NotNull String getExpandedPath(@NotNull Item item) throws RepositoryException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
/**
* Jackrabbit extensions for JCR core interfaces
*/
@org.osgi.annotation.versioning.Version("2.9.0")
@org.osgi.annotation.versioning.Version("2.10.0")
package org.apache.jackrabbit.api;

Original file line number Diff line number Diff line change
Expand Up @@ -852,4 +852,16 @@ public String toString() {
}
return "null";
}

@Override
@NotNull
public String getExpandedName(@NotNull Item item) throws RepositoryException {
return checkItemImpl(item).sessionContext.getExpandedJcrName(item.getName());
}

@Override
@NotNull
public String getExpandedPath(@NotNull Item item) throws RepositoryException {
return checkItemImpl(item).sessionContext.getExpandedJcrPath(item.getPath());
}
}

0 comments on commit 1b911c7

Please sign in to comment.