Uploaded image for project: 'Service Packs and Hot Fixes'
  1. Service Packs and Hot Fixes
  2. MNT-11120

FileFolderService.list does not order properly

    Details

    • Type: Service Pack Request
    • Status: Closed
    • Resolution: Fixed
    • Affects Version/s: 4.1.7
    • Fix Version/s: 4.1.9
    • Component/s: Foundation Java APIs
    • Labels:
      None

      Description

      Steps to reproduce

      1. Create 4 documents in the same folder: A, B, C, and D; and two properties: user:a and user:b which are mutually exclusive. Say that the properties are set on the files in the following way:

      A: user:a="foo"
      B: user:a="bar"
      C: user:b="biz"
      D: user:b="baz"

      2. Use FileFolderService.list() on this folder with sortProps set to

      {("user:a", true),("user:b", true")}

      to list the contents.

      Actual Result

      documents are listed:

      { C, D, B, A }

      Expected Result

      documents should have been listed

      { D, C, B, A }

      Notes

      Created a js to easily replicate the issue, it's not necessary to create custom properties.

      js code for Javascript console
      var PROP_USERA = Packages.org.alfresco.service.namespace.QName.createQName("user","a");
      var PROP_USERB = Packages.org.alfresco.service.namespace.QName.createQName("user","b");
      
      var ctx = Packages.org.springframework.web.context.ContextLoader.getCurrentWebApplicationContext();
      
      var nodeService = ctx.getBean("NodeService");
      var ffService = ctx.getBean("FileFolderService");
      
      var testFolder = companyhome.createFolder("testFolder");
      
      var docA = testFolder.createFile("docA");
      nodeService.setProperty(docA.nodeRef,PROP_USERA,"foo");
      
      var docB = testFolder.createFile("docB");
      nodeService.setProperty(docB.nodeRef,PROP_USERA,"bar");
      
      var docC = testFolder.createFile("docC");
      nodeService.setProperty(docB.nodeRef,PROP_USERB,"biz");
      
      var docD = testFolder.createFile("docD");
      nodeService.setProperty(docB.nodeRef,PROP_USERB,"baz");
      
      var ArrayList = Packages.java.util.ArrayList;
      var Pair = Packages.org.alfresco.util.Pair;
      
      al = new ArrayList();
      al.add(new Pair(PROP_USERA,true));
      al.add(new Pair(PROP_USERB,true));
      
      var pagingRequest = new Packages.org.alfresco.query.PagingRequest(0, java.lang.Integer.MAX_VALUE);
      pagingRequest.setRequestTotalCountMax(10000);
      
      result = ffService.list(testFolder.nodeRef,true,false,null,al,pagingRequest);
      var page = result.getPage()
      
      print(page)
      

        Attachments

          Structure

            Activity

              People

              • Assignee:
                closedbugs Closed Bugs (Inactive)
                Reporter:
                mmancuso Marco Mancuso [X] (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 4 hours, 30 minutes
                  1d 4h 30m

                    Structure Helper Panel