0 – Set parent
#set( $theChild = "Talk.WebHome" )
#set( $theParent = "" )
#if( !$xwiki.exists($theChild) )
{{warning}}“$theChild” does not exist{{/warning}}
#else
#set( $childDoc = $xwiki.getDocument($theChild) )
#if( !$xwiki.exists($theParent) )
{{warning}}“$theParent” does not exist{{/warning}}
#else
#set( $discard = $childDoc.setParent($theParent) )
#set( $discard = $childDoc.save() )
#if( $theParent == $childDoc.getParent() )
{{info}}$theParent is now parent of $theChild{{/info}}
#else
{{error}}WTF!! $theParent $childDoc.getParent() $theChild{{/error}}
#end
#end
#end
#set( $theParent = "" )
#if( !$xwiki.exists($theChild) )
{{warning}}“$theChild” does not exist{{/warning}}
#else
#set( $childDoc = $xwiki.getDocument($theChild) )
#if( !$xwiki.exists($theParent) )
{{warning}}“$theParent” does not exist{{/warning}}
#else
#set( $discard = $childDoc.setParent($theParent) )
#set( $discard = $childDoc.save() )
#if( $theParent == $childDoc.getParent() )
{{info}}$theParent is now parent of $theChild{{/info}}
#else
{{error}}WTF!! $theParent $childDoc.getParent() $theChild{{/error}}
#end
#end
#end
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Talks.TalkClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Publications.PublicationClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Journals.JournalClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Internships.InternshipClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Events.EventClass'" )
#set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Courses.CourseClass'" )
###set( $thesisFound = $xwiki.searchDocuments($sql) )
###set( $talkFound = $xwiki.searchDocuments($sql) )
###set( $pubFound = $xwiki.searchDocuments($sql) )
###set( $internshipFound = $xwiki.searchDocuments($sql) )
###set( $eventFound = $xwiki.searchDocuments($sql) )
#set( $courseFound = $xwiki.searchDocuments($sql) )
##set( $thesisFoundNo = $thesisFound.size() )
###set( $talkFoundNo = $talkFound.size() )
###set( $pubFoundNo = $pubFound.size() )
###set( $journalFoundNo = $journalFound.size() )
###set( $internshipFoundNo = $internshipFound.size() )
###set( $eventFoundNo = $eventFound.size() )
#set( $courseFoundNo = $courseFound.size() )
###if( $thesisFoundNo > 0 )
###if( $talkFoundNo > 0 )
###if( $pubFoundNo > 0 )
###if( $journalFoundNo > 0 )
###if( $internshipFoundNo > 0 )
###if( $eventFoundNo > 0 )
#if( $courseFoundNo > 0 )
##>$thesisFoundNo thesis
##>$talkFoundNo talks
##>$pubFoundNo publications
##>$journalFoundNo journals or series
##>$internshipFoundNo internships
##>$eventFoundNo events
>$courseFoundNo courses
## #foreach( $thesis in $thesisFound )
## #foreach( $talk in $talkFound )
## #foreach( $internship in $internshipFound )
## #foreach( $event in $eventFound )
#foreach( $course in $courseFound )
##* {{thesis}}$thesis{{/thesis}}
##* {{talk}}$talk{{/talk}}
##* {{pub}}$pub{{/pub}}
## #set( $thesisDoc = $xwiki.getDocument($thesis) )
## #set( $talkDoc = $xwiki.getDocument($talk) )
## #set( $internshipDoc = $xwiki.getDocument($internship) )
## #set( $eventDoc = $xwiki.getDocument($event) )
#set( $courseDoc = $xwiki.getDocument($course) )
## #if( $pubDoc.getParent() != "Talks.WebHome" )
## #if( $pubDoc.getParent() != "Publications.WebHome" )
## #if( $journalDoc.getParent() != "Journals.WebHome" )
## #if( $internshipDoc.getParent() != "Internships.WebHome" )
## #if( $eventDoc.getParent() != "Events.WebHome" )
#if( $courseDoc.getParent() != "Courses.WebHome" )
## #set( $discard = $thesisDoc.setParent("Theses.WebHome") )
## #set( $discard = $talkDoc.setParent("Talks.WebHome") )
## #set( $discard = $pubDoc.setParent("Publications.WebHome") )
## #set( $discard = $journalDoc.setParent("Journals.WebHome") )
## #set( $discard = $internshipDoc.setParent("Internships.WebHome") )
## #set( $discard = $eventDoc.setParent("Events.WebHome") )
#set( $discard = $courseDoc.setParent("Courses.WebHome") )
## #set( $discard = $thesisDoc.save() )
## #set( $discard = $talkDoc.save() )
## #set( $discard = $pubDoc.save() )
## #set( $discard = $journalDoc.save() )
## #set( $discard = $internshipDoc.save() )
## #set( $discard = $eventDoc.save() )
#set( $discard = $courseDoc.save() )
#end
##($foreach.count) $thesisDoc.getParent()
##($foreach.count) $talkDoc.getParent()
##($foreach.count) $internshipDoc.getParent()
##($foreach.count) $eventDoc.getParent()
($foreach.count) $courseDoc.getParent()
###if( $foreach.count > 1500 )#stop#end
#end
#end
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Talks.TalkClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Publications.PublicationClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Journals.JournalClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Internships.InternshipClass'" )
###set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Events.EventClass'" )
#set ($sql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Courses.CourseClass'" )
###set( $thesisFound = $xwiki.searchDocuments($sql) )
###set( $talkFound = $xwiki.searchDocuments($sql) )
###set( $pubFound = $xwiki.searchDocuments($sql) )
###set( $internshipFound = $xwiki.searchDocuments($sql) )
###set( $eventFound = $xwiki.searchDocuments($sql) )
#set( $courseFound = $xwiki.searchDocuments($sql) )
##set( $thesisFoundNo = $thesisFound.size() )
###set( $talkFoundNo = $talkFound.size() )
###set( $pubFoundNo = $pubFound.size() )
###set( $journalFoundNo = $journalFound.size() )
###set( $internshipFoundNo = $internshipFound.size() )
###set( $eventFoundNo = $eventFound.size() )
#set( $courseFoundNo = $courseFound.size() )
###if( $thesisFoundNo > 0 )
###if( $talkFoundNo > 0 )
###if( $pubFoundNo > 0 )
###if( $journalFoundNo > 0 )
###if( $internshipFoundNo > 0 )
###if( $eventFoundNo > 0 )
#if( $courseFoundNo > 0 )
##>$thesisFoundNo thesis
##>$talkFoundNo talks
##>$pubFoundNo publications
##>$journalFoundNo journals or series
##>$internshipFoundNo internships
##>$eventFoundNo events
>$courseFoundNo courses
## #foreach( $thesis in $thesisFound )
## #foreach( $talk in $talkFound )
## #foreach( $internship in $internshipFound )
## #foreach( $event in $eventFound )
#foreach( $course in $courseFound )
##* {{thesis}}$thesis{{/thesis}}
##* {{talk}}$talk{{/talk}}
##* {{pub}}$pub{{/pub}}
## #set( $thesisDoc = $xwiki.getDocument($thesis) )
## #set( $talkDoc = $xwiki.getDocument($talk) )
## #set( $internshipDoc = $xwiki.getDocument($internship) )
## #set( $eventDoc = $xwiki.getDocument($event) )
#set( $courseDoc = $xwiki.getDocument($course) )
## #if( $pubDoc.getParent() != "Talks.WebHome" )
## #if( $pubDoc.getParent() != "Publications.WebHome" )
## #if( $journalDoc.getParent() != "Journals.WebHome" )
## #if( $internshipDoc.getParent() != "Internships.WebHome" )
## #if( $eventDoc.getParent() != "Events.WebHome" )
#if( $courseDoc.getParent() != "Courses.WebHome" )
## #set( $discard = $thesisDoc.setParent("Theses.WebHome") )
## #set( $discard = $talkDoc.setParent("Talks.WebHome") )
## #set( $discard = $pubDoc.setParent("Publications.WebHome") )
## #set( $discard = $journalDoc.setParent("Journals.WebHome") )
## #set( $discard = $internshipDoc.setParent("Internships.WebHome") )
## #set( $discard = $eventDoc.setParent("Events.WebHome") )
#set( $discard = $courseDoc.setParent("Courses.WebHome") )
## #set( $discard = $thesisDoc.save() )
## #set( $discard = $talkDoc.save() )
## #set( $discard = $pubDoc.save() )
## #set( $discard = $journalDoc.save() )
## #set( $discard = $internshipDoc.save() )
## #set( $discard = $eventDoc.save() )
#set( $discard = $courseDoc.save() )
#end
##($foreach.count) $thesisDoc.getParent()
##($foreach.count) $talkDoc.getParent()
##($foreach.count) $internshipDoc.getParent()
##($foreach.count) $eventDoc.getParent()
($foreach.count) $courseDoc.getParent()
###if( $foreach.count > 1500 )#stop#end
#end
#end
#foreach( $userSpace in ["AndreaAgiollo","RobertaCalegari","MatteoCasadei","GiovanniCiatto","AngeloCroatti","EnricoDenti","StefanoMariani","AmbraMolesini","SaraMontagna","AndreaOmicini","DaniloPianini","GiuseppePisano","AlessandroRicci","AndreaRoli","FedericoSabbatini","MirkoViroli","AntonioNatali","ElenaNardini","AndreaSanti","MichelePiunti","GiacomoDomeniconi","MarcoAlberti"] )
#foreach( $userPage in ["TagCloud","PerYear","PerSort"] )
##
#set( $theChild = "${userSpace}.Talks.${userPage}" )
#set( $theParent = "${userSpace}.Talks.WebHome" )
#if( !$xwiki.exists($theChild) )
{{warning}}“$theChild” does not exist{{/warning}}
#else
#set( $childDoc = $xwiki.getDocument($theChild) )
#if( !$xwiki.exists($theParent) )
{{warning}}“$theParent” does not exist{{/warning}}
#else
#set( $discard = $childDoc.setParent($theParent) )
#set( $discard = $childDoc.save() )
#if( $theParent == $childDoc.getParent() )
{{info}}$theParent is now parent of $theChild{{/info}}
#else
{{error}}WTF!! $theParent $childDoc.getParent() $theChild{{/error}}
#end
#end
#end
##
#end
#end
#foreach( $userPage in ["TagCloud","PerYear","PerSort"] )
##
#set( $theChild = "${userSpace}.Talks.${userPage}" )
#set( $theParent = "${userSpace}.Talks.WebHome" )
#if( !$xwiki.exists($theChild) )
{{warning}}“$theChild” does not exist{{/warning}}
#else
#set( $childDoc = $xwiki.getDocument($theChild) )
#if( !$xwiki.exists($theParent) )
{{warning}}“$theParent” does not exist{{/warning}}
#else
#set( $discard = $childDoc.setParent($theParent) )
#set( $discard = $childDoc.save() )
#if( $theParent == $childDoc.getParent() )
{{info}}$theParent is now parent of $theChild{{/info}}
#else
{{error}}WTF!! $theParent $childDoc.getParent() $theChild{{/error}}
#end
#end
#end
##
#end
#end
#set( $childSpace = 'AndreaOmicini.Publications' )
#set( $childPages = ["Clouds","TagCloud","AuthorCloud","EditorCloud","JournalCloud"] )
#set( $parentSpace = "AndreaOmicini.Publications" )
#set( $parentPage = "WebHome" )
##
#foreach( $childPage in $childPages )
#set( $child = "$childSpace.$childPage" )
#set( $parent = "$parentSpace.$parentPage" )
#if( $xwiki.exists($child) || $xwiki.exists($parent) )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $newParentDoc = $xwiki.getDocument($parent) )
#set( $currentParentDoc = $childDoc.getParent() )
$currentParentDoc parent of $childDoc —> $newParentDoc
#*
#set( $discard = $childDoc.setParent($newParentDoc) )
#set( $discard = $childDoc.save() )
#set( $actualParentDoc = $childDoc.getParent() )
$actualParentDoc parent of $childDoc
*#
#else
??? $child ???
#end
#end
#set( $childPages = ["Clouds","TagCloud","AuthorCloud","EditorCloud","JournalCloud"] )
#set( $parentSpace = "AndreaOmicini.Publications" )
#set( $parentPage = "WebHome" )
##
#foreach( $childPage in $childPages )
#set( $child = "$childSpace.$childPage" )
#set( $parent = "$parentSpace.$parentPage" )
#if( $xwiki.exists($child) || $xwiki.exists($parent) )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $newParentDoc = $xwiki.getDocument($parent) )
#set( $currentParentDoc = $childDoc.getParent() )
$currentParentDoc parent of $childDoc —> $newParentDoc
#*
#set( $discard = $childDoc.setParent($newParentDoc) )
#set( $discard = $childDoc.save() )
#set( $actualParentDoc = $childDoc.getParent() )
$actualParentDoc parent of $childDoc
*#
#else
??? $child ???
#end
#end
#set( $childSpace = 'PSyKE' )
#set( $childPages = ['WebHome'] )
#set( $parentPage = "WebHome" )
#set( $parentSpace = "Products" )
##
#foreach( $childPage in $childPages )
#set( $child = "$childSpace.$childPage" )
#set( $parent = "$parentSpace.$parentPage" )
#if( $xwiki.exists($child) || $xwiki.exists($parent) )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $newParentDoc = $xwiki.getDocument($parent) )
#set( $currentParentDoc = $childDoc.getParent() )
$currentParentDoc parent of $childDoc —> $newParentDoc
#*
#set( $discard = $childDoc.setParent($newParentDoc) )
#set( $discard = $childDoc.save() )
#set( $actualParentDoc = $childDoc.getParent() )
$actualParentDoc parent of $childDoc
*#
#else
??? $child ???
#end
#end
#set( $childPages = ['WebHome'] )
#set( $parentPage = "WebHome" )
#set( $parentSpace = "Products" )
##
#foreach( $childPage in $childPages )
#set( $child = "$childSpace.$childPage" )
#set( $parent = "$parentSpace.$parentPage" )
#if( $xwiki.exists($child) || $xwiki.exists($parent) )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $newParentDoc = $xwiki.getDocument($parent) )
#set( $currentParentDoc = $childDoc.getParent() )
$currentParentDoc parent of $childDoc —> $newParentDoc
#*
#set( $discard = $childDoc.setParent($newParentDoc) )
#set( $discard = $childDoc.save() )
#set( $actualParentDoc = $childDoc.getParent() )
$actualParentDoc parent of $childDoc
*#
#else
??? $child ???
#end
#end
#set( $spaces = ['RobertaCalegari','MatteoCasadei','GiovanniCiatto','EnricoDenti','StefanoMariani','AmbraMolesini','SaraMontagna','AndreaOmicini','AlessandroRicci','MirkoViroli'] )
#set( $childPage = "ThesesPerStatus" )
#set( $parentPage = "Theses" )
#foreach( $space in $spaces )
#set( $child = "$space.$childPage" )
#if( $xwiki.exists($child) )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $parentDoc = $childDoc.getParent() )
$parentDoc parent of $childDoc
#*
#set( $parent = "$space.$parentPage" )
#set( $discard = $childDoc.setParent($parent) )
#set( $discard = $childDoc.save() )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $parentDoc = $childDoc.getParent() )
$parentDoc parent of $childDoc
*#
#else
??? $child ???
#end
#end
#set( $childPage = "ThesesPerStatus" )
#set( $parentPage = "Theses" )
#foreach( $space in $spaces )
#set( $child = "$space.$childPage" )
#if( $xwiki.exists($child) )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $parentDoc = $childDoc.getParent() )
$parentDoc parent of $childDoc
#*
#set( $parent = "$space.$parentPage" )
#set( $discard = $childDoc.setParent($parent) )
#set( $discard = $childDoc.save() )
#set( $childDoc = $xwiki.getDocument($child) )
#set( $parentDoc = $childDoc.getParent() )
$parentDoc parent of $childDoc
*#
#else
??? $child ???
#end
#end