[MNT-10814] When querying Alfresco using a Java CMIS client and the AtomPub binding, specifying descending order on a date field the results are coming back sorted in ascending order. Created: 28-Feb-14  Updated: 18-Jul-14  Resolved: 02-Apr-14

Status: Closed
Project: Service Packs and Hot Fixes
Component/s: CMIS
Affects Version/s: 4.1.5
Fix Version/s: 4.1.9

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

Postgres,Tomcat, opencmis 0.8


Issue Links:
Cloners
is cloned by MNT-10996 When querying Alfresco using a Java C... Closed
Related
Bug Priority:
Category 2
ACT Numbers:

00147370

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

 Description   

Technical Description of the issue:
When querying Alfresco using a Java CMIS client and the AtomPub binding, specifying descending order on a date field the results are coming back sorted in ascending order. If the Web Service binding is used then the dates are sorted correctly.

Customers Description of the problem:
Descending date sort is not working using new CMIS binding (http://<server>:<port>/alfresco/cmisatom). Results are being sorted
in ascending order. If I change to the deprecated CMIS binding (http://<server>:<port>/alfresco/service/cmis), the descending date
sort works correctly.

Supporting evidence:
This was reproduced locally in 4.1.5 and 4.1.7.3 when retrieving from session cache via getObjectByPath.

Steps to reproduce:

1. With a java cmis client Create session
2. Retrieve folder contents with session.getObjectByPath
3. Set operationcontent orderBy to DESC
4. Retrieve folder children

String orderBy = "cmis:creationDate DESC";
System.out.println("Testing sort on" + orderBy);
Folder folder = (Folder)session.getObjectByPath("/Sites/training/documentlibrary");
OperationContext operationContext = session.getDefaultContext();
operationContext.setMaxItemsPerPage(20);
operationContext.setOrderBy(orderBy);
ItemIterable<CmisObject> page = folder.getChildren(operationContext).skipTo(0).getPage(20);
for( CmisObject cmisObject : page )

{ System.out.println(cmisObject.getName() + " - " + cmisObject.getCreationDate().getTime()); }

Expected Behaviour
Children should come back sorted in DESC order per the OrderBy clause set on operationContext.

Observed Behaviour
Children are returned in ASC order instead.

Analysis to date
I've noted that in 4.2 and above this does not happen, the results are returned in the order specified however cannot find an existing Jira.
I've also noticed if a query is performed against the Repo via session.Query rather than retrieving from Cache then the results
are returned in the order specified.


Generated at Sun Oct 25 16:13:48 GMT 2020 using Jira 7.13.15#713015-sha1:7c5ddd2c3e1709974ae9c48c17df8edd3919fe2c.