Hi,
On 3 Sep 2015 at 15:49:55, qvendeville (quentin.vendevi...@capgemini.com(mailto:quentin.vendevi...@capgemini.com)) wrote: > Hi, > > I try to rename document to put them in the same space. > I did it with a groovy script but i have a problem ; documents which contain > dot are not renamed. > > This is my script : > > {{groovy}} > def context = xcontext.getContext(); > def xwiki = context.getWiki(); > String spaceDestination = "NewSpace" > def spaceNameList = ["Space1","Space2","Space3"]; > def document = ""; > for (spaceName in spaceNameList) > { > for(docName in xwiki.getSpaceDocsName(spaceName, context)) > { > document = xwiki.getDocument(spaceName+"."+docName, > context); > if (docName=="WebHome") > { > document.setParent(spaceDestination+".WebHome"); > document.rename(spaceDestination+"."+spaceName, > context); > } > else > { > //The problem appears here > document.rename(spaceDestination+"."+docName, context); > } > } > } > > {{/groovy}} Two comments: 1) If you’re a on recent version of XWiki you should use the Refactoring script service: http://extensions.xwiki.org/xwiki/bin/view/Extension/Refactoring+Module 2) You should not manually create references, you should use the model script service for this, see http://extensions.xwiki.org/xwiki/bin/view/Extension/Model+Module#HScriptServiceAPI Thanks -Vincent > I have already tried to espace the dot on the docName but it didn't work. > > Thank you, > > Quentin > > > > -- > View this message in context: > http://xwiki.475771.n2.nabble.com/Rename-document-with-dot-in-groovy-tp7595887.html > Sent from the XWiki- Users mailing list archive at Nabble.com. > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users