From de5021bf07e76b048d49b37e8b67dad0168b9cfb Mon Sep 17 00:00:00 2001 From: Aron Roberts Date: Thu, 4 Apr 2013 14:23:27 -0700 Subject: [PATCH] CSPACE-5943: Sort results returned by primary termDisplayName. --- .../AuthorityItemDocumentModelHandler.java | 2 ++ .../client/java/RepositoryJavaClientImpl.java | 32 ++++++++++++++----- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java index ddd4a7708..1b97743f6 100644 --- a/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java +++ b/services/authority/service/src/main/java/org/collectionspace/services/common/vocabulary/nuxeo/AuthorityItemDocumentModelHandler.java @@ -711,10 +711,12 @@ public abstract class AuthorityItemDocumentModelHandler // FIXME: Get all of the following values from appropriate external constants. // At present, these are duplicated in both RepositoryJavaClientImpl // and in AuthorityItemDocumentModelHandler. + final String TERM_GROUP_LIST_NAME = "TERM_GROUP_LIST_NAME"; final String TERM_GROUP_TABLE_NAME_PARAM = "TERM_GROUP_TABLE_NAME"; final String IN_AUTHORITY_PARAM = "IN_AUTHORITY"; Map params = super.getJDBCQueryParams(); + params.put(TERM_GROUP_LIST_NAME, getItemTermInfoGroupXPathBase()); params.put(TERM_GROUP_TABLE_NAME_PARAM, getTermGroupTableName()); params.put(IN_AUTHORITY_PARAM, getInAuthorityValue()); return params; diff --git a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java index ef460e73d..b9de12ebb 100644 --- a/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java +++ b/services/common/src/main/java/org/collectionspace/services/nuxeo/client/java/RepositoryJavaClientImpl.java @@ -23,6 +23,8 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; @@ -923,6 +925,7 @@ public class RepositoryJavaClientImpl implements RepositoryClient() { + @Override + public int compare(DocumentModel doc1, DocumentModel doc2) { + String termDisplayName1 = (String) NuxeoUtils.getXPathValue(doc1, COMMON_PART_SCHEMA, DISPLAY_NAME_XPATH); + String termDisplayName2 = (String) NuxeoUtils.getXPathValue(doc2, COMMON_PART_SCHEMA, DISPLAY_NAME_XPATH); + return termDisplayName1.compareTo(termDisplayName2); + } + }); return result; } -- 2.47.3