Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

84926: Merged PLATFORM1 (5.0/Cloud) to HEAD-BUG-FIX (5.0/Cloud)
      83488: ACE-2639. Added a natural ordering (alphabetical) to FacetablePropertyData to ensure predictable result ordering.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@85243 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Mark Rogers
2014-09-20 09:13:04 +00:00
parent 2798ba02dd
commit dd26455cf4
2 changed files with 10 additions and 4 deletions

View File

@@ -123,7 +123,7 @@ public interface SolrFacetService
public Set<FacetablePropertyData> getFacetableProperties(QName contentClass); public Set<FacetablePropertyData> getFacetableProperties(QName contentClass);
/** A simple POJO/DTO intended primarily for use in an FTL model and rendering in the JSON API. */ /** A simple POJO/DTO intended primarily for use in an FTL model and rendering in the JSON API. */
public static class FacetablePropertyData public static class FacetablePropertyData implements Comparable<FacetablePropertyData>
{ {
private final PropertyDefinition propDef; private final PropertyDefinition propDef;
private final String localisedTitle; private final String localisedTitle;
@@ -180,6 +180,12 @@ public interface SolrFacetService
return false; return false;
return true; return true;
} }
@Override public int compareTo(FacetablePropertyData that)
{
final int modelComparison = this.propDef.getModel().getName().compareTo(that.propDef.getModel().getName());
return modelComparison != 0 ? modelComparison :
this.propDef.getName().compareTo(that.propDef.getName());
}
} }
} }

View File

@@ -771,7 +771,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
@Override public Set<FacetablePropertyData> getFacetableProperties() @Override public Set<FacetablePropertyData> getFacetableProperties()
{ {
final Set<FacetablePropertyData> result = new HashSet<>(); final Set<FacetablePropertyData> result = new TreeSet<>();
final List<QName> allContentClasses = CollectionUtils.flatten(dictionaryService.getAllAspects(), dictionaryService.getAllTypes()); final List<QName> allContentClasses = CollectionUtils.flatten(dictionaryService.getAllAspects(), dictionaryService.getAllTypes());
@@ -785,7 +785,7 @@ public class SolrFacetServiceImpl extends AbstractLifecycleBean implements SolrF
@Override public Set<FacetablePropertyData> getFacetableProperties(QName contentClass) @Override public Set<FacetablePropertyData> getFacetableProperties(QName contentClass)
{ {
final Set<FacetablePropertyData> result = new HashSet<>(); final Set<FacetablePropertyData> result = new TreeSet<>();
final Map<QName, PropertyDefinition> propertyDefs = dictionaryService.getPropertyDefs(contentClass); final Map<QName, PropertyDefinition> propertyDefs = dictionaryService.getPropertyDefs(contentClass);