Thanks, documented this now in 
https://github.com/apache/sling-site/commit/8426d528f19848caf9084959be85d751742c4424.
I will share some comments in https://issues.apache.org/jira/browse/SLING-11712.

Konrad

> On 2. Jun 2025, at 14:31, Carsten Ziegeler <cziege...@apache.org> wrote:
> 
> It's an oversight, see https://issues.apache.org/jira/browse/SLING-11712
> 
> Regards
> Carsten
> 
> On 02.06.2025 13:53, Konrad Windszus wrote:
>> Hi,
>> According to 
>> https://sling.apache.org/documentation/the-sling-engine/sling-api-crud-support.html
>>  and the javadoc of the ResourceResolver 
>> (https://sling.apache.org/apidocs/sling13/org/apache/sling/api/resource/ResourceResolver.html)
>>  there is no method suitable for renaming an existing resource.
>> Even 
>> https://sling.apache.org/apidocs/sling13/org/apache/sling/api/resource/ResourceResolver.html#move(java.lang.String,java.lang.String)
>>  keeps all existing resource names.
>> Is that an oversight?
>> IIUC one currently needs to do the following to perform a rename:
>> 1. Create a new resource with the new name and copy over all old properties.
>> 2. Move all child resources of the resource which is supposed to be renamed 
>> individually with 
>> https://sling.apache.org/apidocs/sling13/org/apache/sling/api/resource/ResourceResolver.html#move(java.lang.String,java.lang.String)
>>  as child of the the resource in 1.
>> 3. Delete the resource with the old name
>> Wouldn’t it make sense to directly support a rename option in order to speed 
>> up the operations (i.e. JCR has Session.move(…) which allows to rename, 
>> https://developer.adobe.com/experience-manager/reference-materials/spec/javax.jcr/javadocs/jcr-2.0/javax/jcr/Session.html#move(java.lang.String,%20java.lang.String)).
>> One alternative is to make Sling RR move behave like JCR Session move (i.e. 
>> destPath is created if it does not exist yet and is used as the new resource 
>> name).
>> Thanks for your input,
>> Konrad
>>  
> 
> -- 
> Carsten Ziegeler
> Adobe
> cziege...@apache.org
> 

Reply via email to