Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-22187

Cannot get revisions with a criteria on a document not stored in DB

    XMLWordPrintable

Details

    • Integration
    • Unknown
    • N/A
    • N/A

    Description

      Reproduction steps:

      • Create a page "Test" containing multiple revisions (I created 5 in my case)
      • Create a page "Script" containing the following snippet (ensure that the page created at step 1 has a reference "xwiki:Test.WebHome" or edit the script)
        {{velocity}}
        #set ($myTest = "xwiki:Test.WebHome")
        #set ($startAt = 0)
        #set ($endAt = -1)
        #set ($criteria = $xwiki.criteriaService.revisionCriteriaFactory.createRevisionCriteria('', $minorVersions))
        #set ($range = $xwiki.criteriaService.rangeFactory.createRange($startAt, $endAt))
        #set ($discard = $criteria.setRange($range))
        #set ($myDoc = $xwiki.getDocument($myTest))
        #set ($xwikiDoc = $myDoc.document)
        XWiki Doc: $xwikiDoc
        #set ($revisions = $xwikiDoc.getRevisions($criteria, $xcontext.context))
        Revision: $revisions
        #set ($discard = $xwikiDoc.setDocumentReference("xwiki:Foo.WebHome"))
        XWiki Doc: $xwikiDoc
        #set ($revisions = $xwikiDoc.getRevisions($criteria, $xcontext.context))
        Revision: $revisions
        {{/velocity}}
        
      • Save and view the page with the snippet

      Expected result:

      • The page should display:
        XWiki Doc: Test.WebHome
        Revision: [5.1]
        XWiki Doc: Foo.WebHome
        Revision: [5.1]
        

      Obtained result:

      • The page display:
        XWiki Doc: Test.WebHome
        Revision: [5.1]
        XWiki Doc: Foo.WebHome
        Revision: []
        

      Attachments

        Issue Links

          Activity

            People

              surli Simon Urli
              surli Simon Urli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: