[xwiki-devs] XWIKI-6790: Add 'copy' and 'rename' values for the 'method' parameter
Dear all, I am working on extend the putPage method to add 'copy' and 'rename'. uriInfo is used to get the additional query parameter, e.g., (1) ?copyFrom=aWiki:aSpace.oldPage (2) ?moveFrom=aWiki:aSpace.oldPage Following Eduard and Sergiu's emails, XWiki.copyDocument(sourceDocumentReference, targetDocumentReference, context) and XWikiDocument.rename(newDocumentReference, context) are utilized to solve (1) and (2), respectively. Now I want to confirm the behaviors of copyFrom and moveFrom. a) If the new page resource does not exist, 1. copyFrom method will return the newly created resource, and "copied from xxx" is mentioned in the page history of new page. The source page remains untouched. 2. moveFrom method will also return the newly created page and source page is deleted. b) If the new page resource already exists, both copyFrom and moveFrom will do nothing. The existing page and source page remain untouched. Are these the desired functions for copyFrom and moveFrom methods? Best regards Jun Han
On 08/18/2011 12:34 AM, Jun Han wrote:
Dear all,
I am working on extend the putPage method to add 'copy' and 'rename'.
uriInfo is used to get the additional query parameter, e.g., (1) ?copyFrom=aWiki:aSpace.oldPage (2) ?moveFrom=aWiki:aSpace.oldPage
Following Eduard and Sergiu's emails, XWiki.copyDocument(sourceDocumentReference, targetDocumentReference, context) and XWikiDocument.rename(newDocumentReference, context) are utilized to solve (1) and (2), respectively.
Now I want to confirm the behaviors of copyFrom and moveFrom.
a) If the new page resource does not exist, 1. copyFrom method will return the newly created resource, and "copied from xxx" is mentioned in the page history of new page. The source page remains untouched. 2. moveFrom method will also return the newly created page and source page is deleted.
b) If the new page resource already exists, both copyFrom and moveFrom will do nothing. The existing page and source page remain untouched.
Are these the desired functions for copyFrom and moveFrom methods?
Yes. Also, b) should not respond with a 200 OK status, but a 409 Conflict. -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Jun Han -
Sergiu Dumitriu