2 – Deprecated

###set( $classNameToRemove = "Courseprojects.Class" )
###set( $classNameToRemove = "Courses.Pages.Projects.Class" )
###set( $classNameToRemove = "Courses.Pages.Slides.Class" )
###set( $classNameToRemove = "Courses.Class" )
###set( $classNameToRemove = "Journals.Class" )
###set( $classNameToRemove = "Events.Class" )
###set( $classNameToRemove = "Publications.Personal.Class" )
###set( $classNameToRemove = "Events.Personal.Class" )
###set( $classNameToRemove = "Theses.Personal.Class" )
###set( $classNameToRemove = "Theses.Class" )
###set( $classNameToRemove = "XWiki.XWikiUsers" )
###set( $classNameToRemove = "Projects.Class" )
#set( $classNameToRemove = "Publications.Class" )
###set( $classNameToRemove = "Internships.Class" )
###set( $classNameToRemove = "Talks.Class" )
##
#set( $query = ", BaseObject as obj where obj.name = doc.fullName and obj.className = '$classNameToRemove' " )
#set( $itemFound = $xwiki.searchDocuments($query) )
#set( $cleanedDocuments = 0 )
#foreach( $documentName in $itemFound )
 ## * received: $documentName $xwiki.getURL($documentName)
 #set( $documentToClean = $xwiki.getXWiki().getDocument($documentName, $xcontext.context) )
 #set( $deprecatedBaseObject = $documentToClean.getObject($classNameToRemove) )
 #set( $needsSave = false )
 #foreach( $baseProp in $deprecatedBaseObject.getXClass($xcontext.context).getDeprecatedObjectProperties($deprecatedBaseObject) )
   #set( $discard = $deprecatedBaseObject.removeField($baseProp.name) )
   #set( $needsSave = true )
 #end
 #if( $needsSave )
   #set( $discard = $documentToClean.setAuthorReference($xcontext.context.getUserReference()) )
   #set( $discard = $xwiki.getXWiki().saveDocument($documentToClean, $msg.get("core.model.xobject.synchronizeObjects.versionSummary"),true, $xcontext.context) )
   #set( $cleanedDocuments = $cleanedDocuments + 1 )
    1. ($cleanedDocuments) cleaned document [[$documentToClean.prefixedFullName]]
 #else
    1. NO deprecated property found in [[$documentToClean.prefixedFullName]]
 #end
 #if( $cleanedDocuments > 250 )
   #break
 #end
#end
##set( $itemSpace = 'Publications' )
#set( $itemClass = 'Publications.Class' )
##set( $itemSpace = 'XWiki' )
##set( $itemClass = 'XWiki.XWikiUsers' )
###set( $itemSpace = 'Tirocini' )
###set( $itemClass = 'Tirocini.InternshipClass' )
###set( $itemTemplate = 'Tirocini.InternshipClassTemplate' )
####set( $itemClassTemplate = 'InternshipClassTemplate' )
###set( $xwql = "where doc.space in ('$itemSpace')" )
#set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass'" )
###set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass' and doc.name <> '$itemTemplate' and doc.name <> '$itemClassTemplate'" )
#set( $itemDocFound = $services.query.xwql($xwql).execute() )
#set( $itemDocNo = $itemDocFound.size() )
$itemDocNo
#foreach( $item in $itemDocFound )
## $foreach.first
## $foreach.last
###set( $itemOutOfPlace = 0 )
###set( $itemInPlace = 0 )
###set( $otherDocItems = 0 )
###foreach( $item in $itemDocFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
##  #set ($parentDoc = $itemDoc.getParent())
  #set( $obj = $itemDoc.getObject($itemClass))
  #if( $obj )
    #if( $itemDoc.getSyntaxId() != 'xwiki/2.1' )
      ($foreach.count)  $parentDoc parent of $itemDoc  /  $itemDoc.getSyntaxId()
##      #set( $itemOutOfPlace = $itemOutOfPlace + 1 )
##      #set( $discard = $itemDoc.setParent($itemClass) )
##      #set( $discard = $itemDoc.setSyntaxId('xwiki/2.1') )
##      #set( $discard = $itemDoc.setTitle('') )
##      #set( $discard = $itemDoc.setContent('') )
##      #set( $discard = $itemDoc.save() )
    #else
      #if( $itemDoc.getValue("company") == "ALMA MATER STUDIORUM &mdash; Universit&agrave; di Bologna" )
        ($foreach.count)  $parentDoc parent of $itemDoc  /  $itemDoc.getSyntaxId()
##        $itemDoc.set("company","Alma Mater Studiorum – Università di Bologna" )
##        #set( $discard = $itemDoc.save() )
      #end
##    #set( $otherDocItems = $otherDocItems + 1 )
##    #set( $itemInPlace = $itemInPlace + 1 )
    #end
  #end
#end
##$itemInPlace
##$itemOutOfPlace
##$otherDocItems
##$itemDocNo
#set( $classNameToRemove = "Internships.InternshipClass" )
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Internships.InternshipClass'" )
#set( $docFound = $xwiki.searchDocuments($hql) )
#foreach( $documentName in $docFound )
  ## * received: $documentName $xwiki.getURL($documentName)
  #set($documentToClean = $xwiki.getXWiki().getDocument($documentName, $xcontext.context))
  #set($deprecatedBaseObject = $documentToClean.getObject($classNameToRemove))
  #set($needsSave = false)
  #foreach ($baseProp in $deprecatedBaseObject.getXClass($xcontext.context).getDeprecatedObjectProperties($deprecatedBaseObject))
    #set($discard = $deprecatedBaseObject.removeField($baseProp.name))
    #set($needsSave = true)
  #end
  #if ($needsSave)
    ## Set the new author
    #set($discard = $documentToClean.setAuthorReference($xcontext.context.getUserReference()))
    #set($discard = $xwiki.getXWiki().saveDocument($documentToClean, $msg.get("core.model.xobject.synchronizeObjects.versionSummary"),true, $xcontext.context))
    1. cleaned document [[$documentToClean.prefixedFullName]]
  #else
    1. NO deprecated property found in [[$documentToClean.prefixedFullName]]
  #end
#end
#set( $itemSpace = 'Internships' )
#set( $itemClass = 'Internships.Class' )
#set( $itemTemplate = 'Internships.Template' )
#set( $itemClassTemplate = 'InternshipClassTemplate' )
###set( $xwql = "where doc.space in ('$itemSpace')" )
#set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass'" )
###set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass' and doc.name <> '$itemTemplate' and doc.name <> '$itemClassTemplate'" )
#set( $itemDocFound = $services.query.xwql($xwql).execute() )
#set( $itemDocNo = $itemDocFound.size() )
#foreach( $item in $itemDocFound )
  #set( $itemDoc = $xwiki.getDocument( $item ) )
  #set( $itemObj = $itemDoc.getObject($itemClass) )
  #set( $type = $itemObj.type )
  #if( $type != "")
$foreach.count [[$itemDoc]]  $type
  #else
$foreach.count [[$itemDoc]]
  #end
##  #set( $where = $itemObj.place )
##  #set( $discard = $itemObj.set('where',$where) )
##  #set( $discard = $itemDoc.save())
#end
#set ($sql = ", BaseObject as obj, StringProperty as prop1
      where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisTemplate' and prop1.id.id = obj.id and prop1.name = 'studentLastName' and prop1.value <> '' " )
#set( $thesisFound = $xwiki.searchDocuments($sql) )
#set( $thesisFoundNo = $thesisFound.size() )
$thesisFoundNo
#if( $thesisFoundNo > 0 )
  #foreach( $thesis in $thesisFound )
(% style="border-style:hidden hidden hidden hidden" %)|{{thesis}}$thesis{{/thesis}}
    #set( $thesisDoc = $xwiki.getDocument($thesis) )
##    #set( $thesisObj = $thesisDoc.getObject('Theses.ThesisClass') )
-  $thesisDoc.getValue("student")
##    #set( $discard = $thesisObj.set('student',$student) )
##    #set( $discard = $thesisDoc.save())
  #end
#end
#set( $itemSpace = 'Internships' )
#set( $itemClass = 'Internships.InternshipClass' )
#set( $itemTemplate = 'Internships.InternshipTemplate' )
#set( $itemClassTemplate = 'InternshipTemplate' )
###set( $xwql = "where doc.space in ('$itemSpace')" )
#set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass'" )
###set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass' and doc.name <> '$itemTemplate' and doc.name <> '$itemClassTemplate'" )
#set( $itemDocFound = $services.query.xwql($xwql).execute() )
#set( $itemDocNo = $itemDocFound.size() )
$itemDocNo
#foreach( $item in $itemDocFound )
  #set( $itemDoc = $xwiki.getDocument( $item ) )
  #set( $itemObj = $itemDoc.getObject($itemClass) )
  #set( $where = $itemObj.where )
  $where
##  #set( $where = $itemObj.place )
##  #set( $discard = $itemObj.set('where',$where) )
##  #set( $discard = $itemDoc.save())
#end
#set( $xwql = "where doc.space in ('Courses')" )
###set( $xwql = "where doc.space in ('AmbraMolesini')" )
###set( $xwql = "where doc.space in ('ElenaNardini')" )
###set( $xwql = "where doc.space in ('Events')" )
###set( $xwql = "where doc.space in ('Arg2p')" )
###set( $xwql = "where doc.space in ('TuCSoN')" )
###set( $xwql = "where doc.space in ('Tuprolog')" )
###set( $xwql = "where doc.space in ('Journals') and doc.parent <> 'Journals.JournalClass'" )
###set( $xwql = "where doc.space in ('Journals')" )
###set( $xwql = "where doc.space in ('MoK')" )
###set( $xwql = "where doc.space in ('Publications') and doc.parent <> 'Publications.PublicationClass'" )
###set( $xwql = "where doc.space in ('Talks') and doc.parent <> 'Talks.TalkClass'" )
###set( $xwql = "where doc.space in ('Theses') and doc.parent <> 'Theses.ThesisClass'" )
###set( $xwql = "where doc.space in ('Macros')" )
#set( $docFound = $services.query.xwql($xwql).execute() )
$docFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $plain10 = 0 )
#set( $noxwiki = 0 )
#foreach( $item in $docFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
  #set( $parentDoc = $itemDoc.getParent() )
  #if( $itemDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
    (xwiki 1.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
    (xwiki 2.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
##    (xwiki 2.1) [[$itemDoc]]  / parent: $parentDoc
  #elseif( $itemDoc.getSyntaxId() == 'plain/1.0' )
    #set( $plain10 = $plain10 + 1 )
##    (plain 1.0) [[$itemDoc]]
  #else
    #set( $noxwiki = $noxwiki + 1 )
   (??) [[$itemDoc]]
  #end
#end
xwiki 1.0 $xwiki10
xwiki 2.0 $xwiki20
xwiki 2.1 $xwiki21
plain 1.0 $plain10
??? $noxwiki
#set( $xwql = "where doc.space in ('AndreaOmicini')" )
#set( $docFound = $services.query.xwql($xwql).execute() )
{{html}}#displayDocumentList($docFound false $var){{/html}}
###set( $xwql = "where doc.space in ('StefanoMariani')" )
###set( $xwql = "where doc.space in ('SemHealthCoord')" )
###set( $xwql = "where doc.space in ('Projects')" )
###set( $xwql = "where doc.space in ('AndreaAgiollo')" )
###set( $xwql = "where doc.space in ('GiuseppePisano')" )
###set( $xwql = "where doc.space in ('SAPERE')" )
###set( $xwql = "where doc.space in ('MEnSA')" )
###set( $xwql = "where doc.space in ('EnricoDenti')" )
###set( $xwql = "where doc.space in ('RobertaCalegari')" )
###set( $xwql = "where doc.space in ('GiovanniCiatto')" )
###set( $xwql = "where doc.space in ('AndreaOmicini')" )
###set( $xwql = "where doc.space in ('BISON')" )
###set( $xwql = "where doc.space in ('Expectation')" )
###set( $xwql = "where doc.space in ('Courses')" )
###set( $xwql = "where doc.space in ('AmbraMolesini')" )
###set( $xwql = "where doc.space in ('ElenaNardini')" )
###set( $xwql = "where doc.space in ('Events')" )
###set( $xwql = "where doc.space in ('Arg2p')" )
###set( $xwql = "where doc.space in ('TuCSoN')" )
###set( $xwql = "where doc.space in ('Tuprolog')" )
###set( $xwql = "where doc.space in ('Journals') and doc.parent <> 'Journals.JournalClass'" )
###set( $xwql = "where doc.space in ('Journals')" )
###set( $xwql = "where doc.space in ('MoK')" )
###set( $xwql = "where doc.space in ('Publications') and doc.parent <> 'Publications.PublicationClass'" )
###set( $xwql = "where doc.space in ('Talks') and doc.parent <> 'Talks.TalkClass'" )
###set( $xwql = "where doc.space in ('Theses') and doc.parent <> 'Theses.ThesisClass'" )
###set( $xwql = "where doc.space in ('Macros')" )
#set( $docFound = $services.query.xwql($xwql).execute() )
$docFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $plain10 = 0 )
#set( $mdown12 = 0 )
#set( $other = 0 )
##
#foreach( $item in $docFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
  #set( $parentDoc = $itemDoc.getParent() )
  #if( $itemDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
    (xwiki 1.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
    (xwiki 2.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
##    (xwiki 2.1) [[$itemDoc]]  / parent: $parentDoc
  #elseif( $itemDoc.getSyntaxId() == 'plain/1.0' )
    #set( $plain10 = $plain10 + 1 )
    (plain 1.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'markdown/1.2' )
    #set( $mdown12 = $mdown12 + 1 )
##    (mdown 1.2) [[$itemDoc]]
  #else
    #set( $other = $other + 1 )
   (??) [[$itemDoc]] $itemDoc.getSyntaxId()
  #end
#end
xwiki 1.0 $xwiki10
xwiki 2.0 $xwiki20
xwiki 2.1 $xwiki21
plain 1.0 $plain10
mdown 1.2 $mdown12
??? $other
#set( $itemSpace = 'Courses' )
#set( $itemClass = 'Courses.CourseClass' )
#set( $itemTemplate = 'Courses.CourseTemplate' )
  #set( $hql = ", BaseObject as obj, StringProperty as prop0 where obj.name = doc.fullName and obj.className = '$itemClass' and obj.name <> '$itemTemplate'  and prop0.id.id = obj.id and prop0.name = 'aY' order by prop0.value desc" )
#set( $itemFound = $xwiki.searchDocuments($hql) )
#set( $itemNo = $itemFound.size() )
###set( $itemSorted = $sorttool.sort($itemFound) )
#foreach( $item in $itemFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
##  #set( $itemObj = $itemDoc.getObject($itemClass) )
##  #set( $aYear = $itemDoc.get('aY') )
##  #set( $yearString = $itemDoc.getValue('aY') )
##  #set( $yearInt = $util.parseInt($yearString) )
##  #set( $yearInt1 = $yearInt + 1 )
##  #set( $aY = "$yearInt"+"/"+"$yearInt1" )
##  #set( $discard = $itemObj.set('ay',$aY) )
##  $itemDoc.save()
## ($foreach.count) $aY $aYear [[$itemDoc]]
($foreach.count) $itemDoc.getValue('ay') $itemDoc.getValue('aY') [[$itemDoc]]
#end
#set( $itemSpace = 'Courses' )
#set( $itemClass = 'Courses.CourseClass' )
#set( $itemTemplate = 'Courses.CourseTemplate' )
  #set( $hql = ", BaseObject as obj, StringProperty as prop0 where obj.name = doc.fullName and obj.className = '$itemClass' and obj.name <> '$itemTemplate'  and prop0.id.id = obj.id and prop0.name = 'cycle' order by prop0.value desc" )
#set( $itemFound = $xwiki.searchDocuments($hql) )
#set( $itemNo = $itemFound.size() )
#foreach( $item in $itemFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
  #set( $itemObj = $itemDoc.getObject($itemClass) )
  #set( $cycle = $itemDoc.getValue("cycle") )
  #if( !$overallCourseCycles.contains($cycle) )
(L $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle') $itemObj.get('cycle')
  #else
    #set( $itemNo = $itemNo - 1 )
  #end
#end
$itemNo
#set( $itemSpace = 'Courses' )
#set( $itemClass = 'Courses.CourseClass' )
#set( $itemTemplate = 'Courses.CourseTemplate' )
  #set( $hql = ", BaseObject as obj, StringProperty as prop0 where obj.name = doc.fullName and obj.className = '$itemClass' and obj.name <> '$itemTemplate'  and prop0.id.id = obj.id and prop0.name = 'cycle' order by prop0.value desc" )
#set( $itemFound = $xwiki.searchDocuments($hql) )
#set( $itemNo = $itemFound.size() )
###set( $itemSorted = $sorttool.sort($itemFound) )
#set( $cycle1 = 0 )
#set( $cycle2 = 0 )
#set( $cycle3 = 0 )
#set( $cycleM = 0 )
#set( $cycleOther = 0 )
#foreach( $item in $itemFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
  #set( $itemObj = $itemDoc.getObject($itemClass) )
  #if( $itemDoc.getValue("cycle") == "Laurea" )
    #set( $cycle1 =  $cycle1 + 1 )
## (L $foreach.count) [[$itemDoc]] $itemObj.set('cycle','L') $itemDoc.save() $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "L" )
    #set( $cycle1 =  $cycle1 + 1 )
## (L $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "Laurea Magistralis" )
    #set( $cycle2 =  $cycle2 + 1 )
(LM $foreach.count) [[$itemDoc]] $itemObj.set('cycle','LM') $itemDoc.save() $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "LM" )
    #set( $cycle2 =  $cycle2 + 1 )
## (LM $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "PhD" )
    #set( $cycle3 =  $cycle3 + 1 )
(PHD $foreach.count) [[$itemDoc]] $itemObj.set('cycle','PHD') $itemDoc.save() $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "PHD" )
    #set( $cycle3 =  $cycle3 + 1 )
## (PHD $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "Full-time Master" )
    #set( $cycleM =  $cycleM + 1 )
(M $foreach.count) [[$itemDoc]] $itemObj.set('cycle','M') $itemDoc.save() $itemObj.getValue('cycle') $itemObj.get('cycle')
  #elseif( $itemDoc.getValue("cycle") == "M" )
    #set( $cycleM =  $cycleM + 1 )
(M $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle') $itemObj.get('cycle')
##  #elseif( $itemDoc.getValue("cycle") == "U" )
##    #set( $cycleM =  $cycleM + 1 )
##(U $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle')
##  #else
##    #set( $cycleOther =  $cycleOther + 1 )
##(O $foreach.count) $itemDoc $itemObj.get('cycle') $itemObj.set('cycle','U') $itemDoc.save() $itemObj.get('cycle')
##    (? $foreach.count) [[$itemDoc]] $itemObj.getValue('cycle')
  #end
#end
$cycle1
$cycle2
$cycle3
$cycleM
## $cycleOther
#set( $itemSpace = 'Courses' )
#set( $itemClass = 'Courses.CourseClass' )
#set( $itemTemplate = 'CourseTemplate' )
#set( $itemClassTemplate = 'CourseClassTemplate' )
###set( $xwql = "where doc.space in ('$itemSpace')" )
#set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass'" )
###set( $xwql = "where doc.space in ('$itemSpace') and doc.parent = '$itemClass' and doc.name <> '$itemTemplate' and doc.name <> '$itemClassTemplate'" )
#set( $itemDocFound = $services.query.xwql($xwql).execute() )
#set( $itemDocNo = $itemDocFound.size() )
#set( $itemOutOfPlace = 0 )
#set( $itemInPlace = 0 )
#set( $otherDocItems = 0 )
#foreach( $item in $itemDocFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
  #set ($parentDoc = $itemDoc.getParent())
  #set( $obj = $itemDoc.getObject($itemClass))
  #if( $obj )
##  #if( $itemDoc.getSyntaxId() != 'xwiki/2.1' )
##    ($foreach.count)  $parentDoc parent of $itemDoc
##    #set( $itemOutOfPlace = $itemOutOfPlace + 1 )
##    #set( $discard = $itemDoc.setParent($itemClass) )
##   #set( $discard = $itemDoc.setSyntaxId('xwiki/2.1') )
##    #set( $discard = $itemDoc.setTitle('') )
##    #set( $discard = $itemDoc.setContent('') )
##    #set( $discard = $itemDoc.save())
  #else
##    ($foreach.count)  $parentDoc parent of $itemDoc
##    #set( $otherDocItems = $otherDocItems + 1 )
##    #set( $itemInPlace = $itemInPlace + 1 )
  #end
#end
##$itemInPlace
$itemOutOfPlace
$otherDocItems
$itemDocNo
#set( $xwql = "where doc.space in ('Courses')" )
###set( $xwql = "where doc.space in ('AmbraMolesini')" )
###set( $xwql = "where doc.space in ('ElenaNardini')" )
###set( $xwql = "where doc.space in ('Events')" )
###set( $xwql = "where doc.space in ('Arg2p')" )
###set( $xwql = "where doc.space in ('TuCSoN')" )
###set( $xwql = "where doc.space in ('Tuprolog')" )
###set( $xwql = "where doc.space in ('Journals') and doc.parent <> 'Journals.JournalClass'" )
###set( $xwql = "where doc.space in ('Journals')" )
###set( $xwql = "where doc.space in ('MoK')" )
###set( $xwql = "where doc.space in ('Publications') and doc.parent <> 'Publications.PublicationClass'" )
###set( $xwql = "where doc.space in ('Talks') and doc.parent <> 'Talks.TalkClass'" )
###set( $xwql = "where doc.space in ('Theses') and doc.parent <> 'Theses.ThesisClass'" )
###set( $xwql = "where doc.space in ('Macros')" )
#set( $docFound = $services.query.xwql($xwql).execute() )
$docFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $plain10 = 0 )
#set( $noxwiki = 0 )
#foreach( $item in $docFound )
  #set( $itemDoc = $xwiki.getDocument($item) )
  #set( $parentDoc = $itemDoc.getParent() )
  #if( $itemDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
    (xwiki 1.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
    (xwiki 2.0) [[$itemDoc]]
  #elseif( $itemDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
##    (xwiki 2.1) [[$itemDoc]]  / parent: $parentDoc
  #elseif( $itemDoc.getSyntaxId() == 'plain/1.0' )
    #set( $plain10 = $plain10 + 1 )
##    (plain 1.0) [[$itemDoc]]
  #else
    #set( $noxwiki = $noxwiki + 1 )
   (??) [[$itemDoc]]
  #end
#end
xwiki 1.0 $xwiki10
xwiki 2.0 $xwiki20
xwiki 2.1 $xwiki21
plain 1.0 $plain10
??? $noxwiki
#set( $xwql = "where doc.space in ('Events') and doc.parent <> 'Events.EventClass'" )
#set( $eventDocFound = $services.query.xwql($xwql).execute() )
#set( $eventDocNo = $eventDocFound.size() )
#set( $eventOutOfPlace = 0 )
#set( $otherDocEvents = 0 )
#foreach( $event in $eventDocFound )
  #set( $eventDoc = $xwiki.getDocument($event) )
  #set ($parentDoc = $eventDoc.getParent())
  #set( $obj = $eventDoc.getObject("Events.EventClass"))
  #if( $obj )
    ($foreach.count)  $parentDoc parent of $eventDoc
    #set( $eventOutOfPlace = $eventOutOfPlace + 1 )
##    #set ($discard = $eventDoc.setParent("Events.EventClass"))
##    #set ($discard = $eventDoc.save())
  #else
    ($foreach.count)  $parentDoc parent of $eventDoc
    #set( $otherDocEvents = $otherDocEvents + 1 )
  #end
#end
$eventOutOfPlace
$otherDocEvents
$eventDocNo
###set( $xwql = "where doc.space in ('Theses') and doc.parent <> 'Theses.WebHome'" )
#set( $xwql = "where doc.space in ('Theses')" )
#set( $thesisFound = $services.query.xwql($xwql).execute() )
$thesisFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $noxwiki = 0 )
#foreach( $thesis in $thesisFound )
  #set( $thesisDoc = $xwiki.getDocument($thesis) )
  #if( $thesisDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
    [[$thesisDoc]]
  #elseif( $thesisDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
    [[$thesisDoc]]
  #elseif( $thesisDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
  #else
    #set( $noxwiki = $noxwiki + 1 )
  #end
#end
1.0 $xwiki10
2.0 $xwiki20
2.1 $xwiki21
??? $noxwiki
###set( $xwql = "where doc.space in ('Publications') and doc.parent <> 'Publications.WebHome'" )
#set( $xwql = "where doc.space in ('Publications')" )
#set( $pubFound = $services.query.xwql($xwql).execute() )
$pubFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $noxwiki = 0 )
#foreach( $pub in $pubFound )
  #set( $pubDoc = $xwiki.getDocument($pub) )
##  #set( $parentDoc = $pubDoc.getParent() )
  #if( $pubDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
    [[$pubDoc]]
  #elseif( $pubDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
    [[$pubDoc]]
  #elseif( $pubDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
  #else
    #set( $noxwiki = $noxwiki + 1 )
  #end
#end
1.0 $xwiki10
2.0 $xwiki20
2.1 $xwiki21
??? $noxwiki
###set( $xwql = "where doc.space in ('Talks') and doc.parent <> 'Talks.WebHome'" )
#set( $xwql = "where doc.space in ('Talks')" )
#set( $talkFound = $services.query.xwql($xwql).execute() )
$talkFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $noxwiki = 0 )
#foreach( $talk in $talkFound )
  #set( $talkDoc = $xwiki.getDocument($talk) )
  #set( $parentDoc = $talkDoc.getParent() )
  #if( $talkDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
    [[$talkDoc]]
  #elseif( $talkDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
    [[$talkDoc]]
  #elseif( $talkDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
  #else
    #set( $noxwiki = $noxwiki + 1 )
  #end
#end
1.0 $xwiki10
2.0 $xwiki20
2.1 $xwiki21
??? $noxwiki
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
##   #if( $xwiki.exists( "${userSpace}.PublicationClouds") )
##     #if( $foreach.count > 1 )
##       #stop
##     #end
   #set( $userDocCloud = $xwiki.getDocument("${userSpace}.PublicationClouds") )
   $userDocCloud.setTitle('#if($services.localization.currentLocale=="it")Nuvole delle pubblicazioni#{else}Publication Clouds#end')
   $userDocCloud.setContent('{{include reference="Publications.UserClouds"/}}')
   $userDocCloud.setParent("${userSpace}.Publications")
   $userDocCloud.save()
   $userDocCloud
## $userDocCloud.getContent()
##   #end
 #end
#end
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
##   #if( $xwiki.exists( "${userSpace}.PublicationJournalCloud") )
##     #if( $foreach.index > 0 )
##       #stop
##     #end
   #set( $userDocCloud = $xwiki.getDocument("${userSpace}.PublicationJournalCloud") )
   $userDocCloud.setTitle('#if($services.localization.currentLocale=="it")Nuvola delle riviste#{else}Journal Cloud#end')
   $userDocCloud.setContent('{{include reference="Publications.JournalCloud"/}}')
   $userDocCloud.save()
   $userDocCloud
## $userDocCloud.getContent()
##   #end
 #end
#end
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
##   #if( $xwiki.exists( "${userSpace}.PublicationEditorCloud") )
##     #if( $foreach.index > 0 )
##       #stop
##     #end
   #set( $userDocCloud = $xwiki.getDocument("${userSpace}.PublicationEditorCloud") )
   $userDocCloud.setTitle('#if($services.localization.currentLocale=="it")Nuvola dei co-curatori e delle co-curatrici#{else}Co-editors’ Cloud#end')
   $userDocCloud.setContent('{{include reference="Publications.EditorCloud"/}}')
   $userDocCloud.save()
   $userDocCloud
## $userDocCloud.getContent()
##   #end
 #end
#end
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
##   #if( $xwiki.exists( "${userSpace}.PublicationAuthorCloud") )
##     #if( $foreach.index > 0 )
##       #stop
##     #end
     #set( $userDocCloud = $xwiki.getDocument("${userSpace}.PublicationAuthorCloud") )
     $userDocCloud.setTitle('#if($services.localization.currentLocale=="it")Nuvola dei co-autori e delle co-autrici#{else}Co-authors’ Cloud#end')
     $userDocCloud.setContent('{{include reference="Publications.AuthorCloud"/}}')
     $userDocCloud.save()
     $userDocCloud
## $userDocCloud.getContent()
##   #end
 #end
#end
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' " )
#set( $thesisFound = $xwiki.searchDocuments($hql) )
#foreach( $thesis in $thesisFound )
  #set( $thesisDoc = $xwiki.getDocument($thesis) )
  #set( $parentDoc = $thesisDoc.getParent() )
  #if( $parentDoc != 'Theses.ThesisClass' )
$parentDoc parent of $thesisDoc
  #end
#end
#set( $xwql = "where doc.space in ('Theses') and doc.parent <> 'Theses.ThesisClass'" )
#set( $thesisDocFound = $services.query.xwql($xwql).execute() )
#set( $thesisDocNo = $thesisDocFound.size() )
#set( $thesisOutOfPlace = 0 )
#set( $otherDocThesis = 0 )
#foreach( $thesis in $thesisDocFound )
  #set( $thesisDoc = $xwiki.getDocument($thesis) )
  #set ($parentDoc = $thesisDoc.getParent())
  #set( $obj = $thesisDoc.getObject("Theses.ThesisClass"))
  #if( $obj )
    ($foreach.count)  $parentDoc parent of $thesisDoc
    #set( $thesisOutOfPlace = $thesisOutOfPlace + 1 )
##    #set ($discard = $thesisDoc.setParent("Theses.ThesisClass"))
##    #set ($discard = $thesisDoc.save())
  #else
    #set( $otherDocThesis = $otherDocThesis + 1 )
  #end
#end
$thesisOutOfPlace
$otherDocThesis
$thesisDocNo
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
   #if( $xwiki.exists( "${userSpace}.Theses") && !$xwiki.exists( "${userSpace}.ThesesPerYear") )
     $userSpace
     #set( $userDocThesesPerYear = $xwiki.getDocument("${userSpace}.ThesesPerYear") )
     $userDocThesesPerYear.setTitle('#if($services.localization.currentLocale=="it")Tesi per anno e livello#{else}Theses per Year & Cycle#end')
     $userDocThesesPerYear.setContent('{{include reference="Theses.PerYear"/}}')
     $userDocThesesPerYear.save()
##     #if( $foreach.index > 0 )
##       #stop
##     #end
   #end
 #end
#end
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
   #if( $xwiki.exists( "${userSpace}.PublicationService") )
##     #if( $foreach.index > 0 )
##       #stop
##     #end
     #set( $userDocPubserv = $xwiki.getDocument("${userSpace}.PublicationService") )
##     $userDocPubserv.setTitle('#if($services.localization.currentLocale=="it")Servizi bibliografici#{else}Bibliographic Services#end')
     $userDocPubserv.setContent('{{include reference="Publications.Services"/}}')
     $userDocPubserv.save()
     $userDocPubserv ## $userDocPubserv.getContent()
   #end
 #end
#end
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
   #if( $xwiki.exists( "${userSpace}.PublicationsPerStatus") )
##     #if( $foreach.index > 0 )
##       #stop
##     #end
     #set( $userDocPubperstatus = $xwiki.getDocument("${userSpace}.PublicationsPerStatus") )
     $userDocPubperstatus.setTitle('#if($services.localization.currentLocale=="it")Pubblicazioni per stato#{else}Publications per Status#end')
     $userDocPubperstatus.save()
     $userDocPubperstatus $userDocPubperstatus.getTitle()
   #end
 #end
#end
#foreach( $user in $userList )
  #if( $xwiki.exists( "XWiki.$user") )
   #set( $userDoc = $xwiki.getDocument("XWiki.$user") )
   #set( $userSpace = $userDoc.getValue('personalWiki') )
   #if( $xwiki.exists( "${userSpace}.PublicationsPerSort") )
##     #if( $foreach.index > 0 )
##       #stop
##     #end
     #set( $userDocPubpersort = $xwiki.getDocument("${userSpace}.PublicationsPerSort") )
     $userDocPubpersort.setTitle('#if($services.localization.currentLocale=="it")Pubblicazioni per tipo e anno#{else}Publications per Sort & Year#end')
     $userDocPubpersort.save()
     $userDocPubpersort $userDocPubpersort.getTitle()
   #end
 #end
#end
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' " )
#set( $thesisFound = $xwiki.searchDocuments($hql) )
$thesisFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $noxwiki = 0 )
#foreach( $thesis in $thesisFound )
  #set( $thesisDoc = $xwiki.getDocument($thesis) )
  #if( $thesisDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
  #elseif( $thesisDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
  #elseif( $thesisDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
  #else
    #set( $noxwiki = $noxwiki + 1 )
  #end
#end
1.0 $xwiki10
2.0 $xwiki20
2.1 $xwiki21
??? $noxwiki
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Theses.ThesisClass' and obj.name <> 'Theses.ThesisClassTemplate' and obj.name <> 'Theses.ThesisTemplate' " )
#set( $thesisFound = $xwiki.searchDocuments($hql) )
$thesisFound.size()
#set( $done = 0 )
#foreach( $thesis in $thesisFound )
  #set( $thesisDoc = $xwiki.getDocument($thesis) )
  #if( $thesisDoc.getSyntaxId() != 'xwiki/2.1' )
    $thesisDoc.setSyntaxId('xwiki/2.1')
    $thesisDoc.setTitle('')
    $thesisDoc.setContent('')
    $thesisDoc.save()
    #set( $done = $done + 1 )
  #end
#end
$done
#set( $classNameToRemove = "Talks.TalkClass" )
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Talks.TalkClass' and obj.name <> 'Talks.TalkClassTemplate' and obj.name <> 'Talks.TalkTemplate' " )
#set( $talkFound = $xwiki.searchDocuments($hql) )
#foreach( $documentName in $talkFound )
  ## * received: $documentName $xwiki.getURL($documentName)
  #set($documentToClean = $xwiki.getXWiki().getDocument($documentName, $xcontext.context))
  #set($deprecatedBaseObject = $documentToClean.getObject($classNameToRemove))
  #set($needsSave = false)
  #foreach ($baseProp in $deprecatedBaseObject.getXClass($xcontext.context).getDeprecatedObjectProperties($deprecatedBaseObject))
    #set($discard = $deprecatedBaseObject.removeField($baseProp.name))
    #set($needsSave = true)
  #end
  #if ($needsSave)
    ## Set the new author
    #set($discard = $documentToClean.setAuthorReference($xcontext.context.getUserReference()))
    #set($discard = $xwiki.getXWiki().saveDocument($documentToClean, $msg.get("core.model.xobject.synchronizeObjects.versionSummary"),true, $xcontext.context))
    1. cleaned document [[$documentToClean.prefixedFullName]]
  #else
    1. NO deprecated property found in [[$documentToClean.prefixedFullName]]
  #end
#end
#set( $classNameToRemove = "Publications.PublicationClass" )
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Publications.PublicationClass' and obj.name <> 'Publications.PublicationClassTemplate' and obj.name <> 'Publications.PublicationTemplate' " )
#set( $pubFound = $xwiki.searchDocuments($hql) )
#foreach( $documentName in $pubFound )
  ## * received: $documentName $xwiki.getURL($documentName)
  #set($documentToClean = $xwiki.getXWiki().getDocument($documentName, $xcontext.context))
  #set($deprecatedBaseObject = $documentToClean.getObject($classNameToRemove))
  #set($needsSave = false)
  #foreach ($baseProp in $deprecatedBaseObject.getXClass($xcontext.context).getDeprecatedObjectProperties($deprecatedBaseObject))
    #set($discard = $deprecatedBaseObject.removeField($baseProp.name))
    #set($needsSave = true)
  #end
  #if ($needsSave)
    ## Set the new author
    #set($discard = $documentToClean.setAuthorReference($xcontext.context.getUserReference()))
    #set($discard = $xwiki.getXWiki().saveDocument($documentToClean, $msg.get("core.model.xobject.synchronizeObjects.versionSummary"),true, $xcontext.context))
    1. cleaned document [[$documentToClean.prefixedFullName]]
  #else
    1. NO deprecated property found in [[$documentToClean.prefixedFullName]]
  #end
#end
#set( $xwql = "where doc.space in ('Publications') and doc.parent = 'Publications.PublicationClass'" )
#foreach( $pub in $services.query.xwql($xwql).execute() )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #set( $pubObj = $pubDoc.getObject('Publications.PublicationClass') )
  #if( $pubDoc.getTitle() != '' || $pubDoc.getContent() != '' )
 [[$pubDoc.title>>$pubDoc]]
##    $pubDoc.setTitle('')
##    $pubDoc.setContent('')
##    $pubDoc.save()
  #end
#end
#set( $xwql = "where doc.space in ('Talks') and doc.parent = 'Talks.WebHome'" )
#set( $talkFound = $services.query.xwql($xwql).execute() )
$talkFound.size()
#set( $syntaxOk = 0 )
#set( $syntaxNotok = 0 )
#foreach( $talk in $talkFound )
  #set( $talkDoc = $xwiki.getDocument($talk) )
  #if( $talkDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $syntaxOk = $syntaxOk + 1 )
  #else
    #set( $syntaxNotok = $syntaxNotok + 1 )
[[$talkDoc.title>>$talkDoc]]
  #end
#end
NO  $syntaxNotok
YES $syntaxOk
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Talks.TalkClass' and obj.name <> 'Talks.TalkClassTemplate' and obj.name <> 'Talks.TalkTemplate' " )
#set( $talkFound = $xwiki.searchDocuments($hql) )
$talkFound.size()
#set( $done = 0 )
#foreach( $talk in $talkFound )
  #set( $talkDoc = $xwiki.getDocument($talk) )
  #if( $talkDoc.getSyntaxId() != 'xwiki/2.1' )
    $talkDoc.setSyntaxId('xwiki/2.1')
    $talkDoc.setTitle('')
    $talkDoc.setContent('')
    $talkDoc.save()
    #set( $done = $done + 1 )
  #end
#end
$done
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Talks.TalkClass' and obj.name <> 'Talks.TalkClassTemplate' and obj.name <> 'Talks.TalkTemplate' " )
#set( $talkFound = $xwiki.searchDocuments($hql) )
$talkFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $noxwiki = 0 )
#foreach( $talk in $talkFound )
  #set( $talkDoc = $xwiki.getDocument($talk) )
  #if( $talkDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
  #elseif( $talkDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
  #elseif( $talkDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
  #else
    #set( $noxwiki = $noxwiki + 1 )
  #end
#end
1.0 $xwiki10
2.0 $xwiki20
2.1 $xwiki21
??? $noxwiki
#set( $xwql = "where doc.space in ('Publications') and doc.parent = 'Publications.WebHome'" )
#set( $pubFound = $services.query.xwql($xwql).execute() )
$pubFound.size()
#set( $syntaxOk = 0 )
#set( $syntaxNotok = 0 )
#foreach( $pub in $pubFound )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #if( $pubDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $syntaxOk = $syntaxOk + 1 )
  #else
    #set( $syntaxNotok = $syntaxNotok + 1 )
[[$pubDoc.title>>$pubDoc]]
  #end
#end
NO  $syntaxNotok
YES $syntaxOk
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Publications.PublicationClass' and obj.name <> 'Publications.PublicationClassTemplate' and obj.name <> 'Publications.PublicationTemplate' " )
#set( $pubFound = $xwiki.searchDocuments($hql) )
$pubFound.size()
#set( $syntaxOk = 0 )
#set( $syntaxNotok = 0 )
#foreach( $pub in $pubFound )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #if( $pubDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $syntaxOk = $syntaxOk + 1 )
  #else
    #set( $syntaxNotok = $syntaxNotok + 1 )
  #end
#end
NO  $syntaxNotok
YES $syntaxOk
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Publications.PublicationClass' and obj.name <> 'Publications.PublicationClassTemplate' and obj.name <> 'Publications.PublicationTemplate' " )
#set( $pubFound = $xwiki.searchDocuments($hql) )
#foreach( $pub in $pubFound )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #if( $pubDoc.getSyntaxId() != 'xwiki/2.1' )
    $pubDoc.setSyntaxId('xwiki/2.1')
    $pubDoc.setTitle('')
    $pubDoc.setContent('')
    $pubDoc.save()
##      $foreach.count
  #end
#end
#set( $hql = ", BaseObject as obj where obj.name = doc.fullName and obj.className = 'Publications.PublicationClass' and obj.name <> 'Publications.PublicationClassTemplate' and obj.name <> 'Publications.PublicationTemplate' " )
#set( $pubFound = $xwiki.searchDocuments($hql) )
$pubFound.size()
#set( $xwiki10 = 0 )
#set( $xwiki20 = 0 )
#set( $xwiki21 = 0 )
#set( $noxwiki = 0 )
#foreach( $pub in $pubFound )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #if( $pubDoc.getSyntaxId() == 'xwiki/1.0' )
    #set( $xwiki10 = $xwiki10 + 1 )
  #elseif( $pubDoc.getSyntaxId() == 'xwiki/2.0' )
    #set( $xwiki20 = $xwiki20 + 1 )
  #elseif( $pubDoc.getSyntaxId() == 'xwiki/2.1' )
    #set( $xwiki21 = $xwiki21 + 1 )
  #else
    #set( $noxwiki = $noxwiki + 1 )
  #end
#end
1.0 $xwiki10
2.0 $xwiki20
2.1 $xwiki21
??? $noxwiki
## xwiki/2.1
## #set( $pubDoc = $xwiki.getDocument('Publications.2pktSwx16') )
## $pubDoc.getSyntaxId()
## xwiki/1.0
#set( $pubDoc = $xwiki.getDocument('Publications.TucsonsituatedE4mas2014') )
#if( $pubDoc.getSyntaxId() == 'xwiki/1.0' )
- old syntax
  $pubDoc.setSyntaxId('xwiki/2.1')
--new syntax
  $pubDoc.save()
--which syntax?
  $pubDoc.getSyntaxId()
#end
#set( $xwql = "where doc.space in ('Publications') and doc.parent = 'Publications.PublicationClass'" )
#foreach( $pub in $services.query.xwql($xwql).execute() )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #set( $pubObj = $pubDoc.getObject('Publications.PublicationClass') )
  #if( $pubObj && $pubDoc.getTitle() == '' && $pubDoc.getContent() != '' )
[[$pubDoc.title>>$pubDoc]]
##  $pubDoc.setTitle('$doc.getValue("title")')
##  $pubDoc.save()
  #end
#end

#set( $xwql = "where doc.space in ('Publications') and doc.parent = 'Publications.PublicationClass'" )
#foreach( $pub in $services.query.xwql($xwql).execute() )
  #set( $pubDoc = $xwiki.getDocument($pub) )
  #set( $pubObj = $pubDoc.getObject('Publications.PublicationClass') )
  #if( $pubDoc.title.contains('display') && !$pubDoc.title.contains('getValue') )
[[$pubDoc.title>>$pubDoc]]
##  $pubDoc.setTitle('$doc.getValue("title")')
##  $pubDoc.save()
  #end
#end
#set( $xwql = "where doc.space in ('Talks') and doc.parent = 'Talks.TalkClass'" )
#foreach( $talk in $services.query.xwql($xwql).execute() )
  #set( $talkDoc = $xwiki.getDocument($talk) )
  #set( $talkObj = $talkDoc.getObject('Talks.TalkClass') )
  #if( $talkDoc.title.contains('display') && !$talkDoc.title.contains('getValue') )
[[$talkDoc.title>>$talkDoc]]
  #end
#end
#set( $xwql = "where doc.space in ('Talks') and doc.parent <> 'Talks.WebHome'" )
#foreach( $talk in $services.query.xwql($xwql).execute() )
  #set( $talkDoc = $xwiki.getDocument($talk) )
  #set ($parentDoc = $talkDoc.getParent())
  #set( $obj = $talkDoc.getObject("Talks.TalkClass"))
  #if ($obj )
    ($foreach.count)  $parentDoc parent of $talkDoc<br />
##    #set ($discard = $talkDoc.setParent("Talks.WebHome"))
##    #set ($discard = $talkDoc.save())
  #end
#end

[[[[image:Publications.Scopus@logo.png||width=20px]]>>http://www.scopus.com/record/display.url||queryString="origin=inward&eid=$pubObj.scopusId"]]