You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2021/10/27 07:50:21 UTC

[sling-org-apache-sling-api] branch feature/resource-reorder-api created (now 979fae3)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch feature/resource-reorder-api
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git.


      at 979fae3  SLING-9850 API for reordering of resources

This branch includes the following new commits:

     new 979fae3  SLING-9850 API for reordering of resources

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[sling-org-apache-sling-api] 01/01: SLING-9850 API for reordering of resources

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch feature/resource-reorder-api
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-api.git

commit 979fae3df0dc0ad66778d9796277be9a5711e13a
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Wed Oct 27 09:50:12 2021 +0200

    SLING-9850 API for reordering of resources
---
 .../org/apache/sling/api/resource/ResourceResolver.java  | 16 ++++++++++++++++
 .../java/org/apache/sling/api/resource/package-info.java |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/api/resource/ResourceResolver.java b/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
index 372ec13..963f56b 100644
--- a/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
+++ b/src/main/java/org/apache/sling/api/resource/ResourceResolver.java
@@ -692,6 +692,22 @@ public interface ResourceResolver extends Adaptable, Closeable {
     throws PersistenceException;
 
     /**
+     * Reorders the given resource so that it is listed before the given sibling resource.
+     * 
+     * The changes are transient and require a call to {@link #commit()} for persisting.
+     * 
+     * @param parent the parent resource containing the child resource to reorder.
+     * @param name the name of the resource child in {@code parent} to reorder. Must be an existing child name.
+     * @param followingSiblingName the name of the resource child in {@code parent} which should come after the reordered resource. If {@code null} is given the resource is ordered as last among all sibling resources.
+     * @return {@code true} in case the ordering of the child resources of {@code parent} have changed, {@code false} otherwise.
+     * @throws UnsupportedOperationException in case the underlying resource provider does not support ordering or the child resources of {@code parent} are provided by different providers.
+     * @throws IllegalArgumentException if either {@code name} or {@code followingSiblingName} are not existing child names of {@code parent}.
+     * @throws PersistenceException If the operation fails in the underlying resource provider, e.g. in case the parent resource does not support orderable children.
+     * @since 2.13.0 (Sling API Bundle 2.24.0)
+     */
+    boolean orderBefore(@NotNull Resource parent, @NotNull String name, @Nullable String followingSiblingName) throws UnsupportedOperationException;
+
+    /**
      * Revert all pending changes.
      * @throws IllegalStateException if this resource resolver has already been
      *             {@link #close() closed}.
diff --git a/src/main/java/org/apache/sling/api/resource/package-info.java b/src/main/java/org/apache/sling/api/resource/package-info.java
index 2c8f5ae..ac05b61 100644
--- a/src/main/java/org/apache/sling/api/resource/package-info.java
+++ b/src/main/java/org/apache/sling/api/resource/package-info.java
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-@Version("2.12.3")
+@Version("2.13.0")
 package org.apache.sling.api.resource;
 
 import org.osgi.annotation.versioning.Version;