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}}

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
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to