in src/main/java/org/apache/sling/jcr/resource/internal/helper/jcr/JcrResourceProvider.java [547:563]
public boolean orderBefore(@NotNull ResolveContext<JcrProviderState> ctx, @NotNull Resource parent, @NotNull String name,
@Nullable String followingSiblingName) throws PersistenceException {
Node node = parent.adaptTo(Node.class);
if (node == null) {
throw new PersistenceException("The resource " + parent.getPath() + " cannot be adapted to Node. It is probably not provided by the JcrResourceProvider");
}
try {
// check if reordering necessary
if (requiresReorder(node, name, followingSiblingName)) {
node.orderBefore(name, followingSiblingName);
return true;
}
return false;
} catch (final RepositoryException e) {
throw new PersistenceException("Unable to reorder children below " + parent.getPath(), e, parent.getPath(), null);
}
}