Changes for page RefactoringRESTXML
Last modified by Thomas Mortagne on 2022/08/08 11:05
From version 1.14
edited by Thomas Mortagne
on 2022/08/08 11:04
on 2022/08/08 11:04
Change comment:
There is no comment for this version
To version 2.1
edited by Thomas Mortagne
on 2022/08/08 11:05
on 2022/08/08 11:05
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -5,17 +5,17 @@ 5 5 // That's generally the only part you need to customize for your own request need 6 6 var source = new SpaceReference("xwiki", "MyParentPage", "MyPage"); 7 7 var destination = new SpaceReference("xwiki", "MyPageNewLocaltion", "MyPageNewName"); 8 -var moveRequest = services.component.getInstance(org.xwiki.refactoring.script.RequestFactory.class).createMoveRequest(source, destination)8 +var jobRequest = services.component.getInstance(org.xwiki.refactoring.script.RequestFactory.class).createMoveRequest(source, destination) 9 9 10 10 /////////// SERIALIZATION //////////////////// 11 11 12 12 // cleanup the request from properties which make sense for a script but are pretty much useless in the case of a REST request 13 - moveRequest.removeProperty("checkrights")14 - moveRequest.removeProperty("user.reference")15 - moveRequest.removeProperty("caller.reference")13 +jobRequest.removeProperty("checkrights") 14 +jobRequest.removeProperty("user.reference") 15 +jobRequest.removeProperty("caller.reference") 16 16 17 17 // Convert the standard move request into a REST job request 18 -var restJobRequest = services.component.getInstance(org.xwiki.rest.internal.ModelFactory.class).toRestJobRequest( moveRequest);18 +var restJobRequest = services.component.getInstance(org.xwiki.rest.internal.ModelFactory.class).toRestJobRequest(jobRequest); 19 19 20 20 // Serialize the REST job request into an XML content 21 21 var writer = new java.io.StringWriter();