[MNT-11120] FileFolderService.list does not order properly Created: 03-Apr-14  Updated: 18-Jul-14  Resolved: 21-May-14

Status: Closed
Project: Service Packs and Hot Fixes
Component/s: Foundation Java APIs
Affects Version/s: 4.1.7
Fix Version/s: 4.1.9

Type: Service Pack Request
Reporter: Marco Mancuso [X] (Inactive) Assignee: Closed Bugs (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: 0 minutes
Time Spent: 1 day, 4 hours, 30 minutes
Original Estimate: Not Specified

Attachments: Text File fixed(changes in PropComparatorAsc ).txt     Text File original(4.1.N behavior).txt    
Bug Priority:
Category 3
ACT Numbers:


Build Location: http://releases.alfresco.com/Enterprise%204.1/4.1.9/build-00036/


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 }


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");

var docB = testFolder.createFile("docB");

var docC = testFolder.createFile("docC");

var docD = testFolder.createFile("docD");

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);

result = ffService.list(testFolder.nodeRef,true,false,null,al,pagingRequest);
var page = result.getPage()


Generated at Sun Mar 07 18:13:50 GMT 2021 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.