kwin commented on a change in pull request #36:
URL: 
https://github.com/apache/sling-org-apache-sling-api/pull/36#discussion_r737425332



##########
File path: src/main/java/org/apache/sling/api/resource/ResourceResolver.java
##########
@@ -691,6 +691,24 @@ void delete(@NotNull Resource resource)
     @NotNull Resource create(@NotNull Resource parent, @NotNull String name, 
Map<String, Object> properties)
     throws PersistenceException;
 
+    /**
+     * Reorders the child resources returned by {@link #getChildren(Resource)} 
and {@link #listChildren(Resource)} so that a given resource 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 resources to 
reorder.
+     * @param name the name of the child resource 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 order of the child resources in {@code 
parent} has 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)
+     * @see #listChildren(Resource)
+     * @see #getChildren(Resource)
+     */
+    boolean orderBefore(@NotNull Resource parent, @NotNull String name, 
@Nullable String followingSiblingName) throws UnsupportedOperationException, 
PersistenceException, IllegalArgumentException;

Review comment:
       Throwing is more in line with other modifying operations like create, 
delete IMHO. I now clarified when to expect the return value `false`.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@sling.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to