Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.core.api
Class DocumentModelComparator

java.lang.Object
  extended by org.nuxeo.ecm.core.api.DocumentModelComparator
All Implemented Interfaces:
Serializable, Comparator<DocumentModel>, Sorter

public class DocumentModelComparator
extends Object
implements Sorter

DocumentModel comparator. Uses ordering independent of case or accent. If two values are integers/longs, numbering comparison is used.

Author:
Florent Guillaume, Anahide Tchertchian
See Also:
Serialized Form

Field Summary
static String ORDER_ASC
           
 
Constructor Summary
DocumentModelComparator(Map<String,String> orderBy)
          Constructor using a map of property names to compare on.
DocumentModelComparator(String schemaName, Map<String,String> orderBy)
          Constructor using a schema and a map of field names to compare on.
 
Method Summary
 int compare(DocumentModel doc1, DocumentModel doc2)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

ORDER_ASC

public static final String ORDER_ASC
See Also:
Constant Field Values
Constructor Detail

DocumentModelComparator

public DocumentModelComparator(String schemaName,
                               Map<String,String> orderBy)
Constructor using a schema and a map of field names to compare on.

Parameters:
schemaName - the schema name
orderBy - map using property names as keys, and "asc" or "desc" as values. Should be a LinkedHashMap if order of criteria matters.

DocumentModelComparator

public DocumentModelComparator(Map<String,String> orderBy)
Constructor using a map of property names to compare on.

Parameters:
orderBy - map using property names as keys, and "asc" or "desc" as values. Should be a LinkedHashMap if order of criteria matters.
Method Detail

compare

public int compare(DocumentModel doc1,
                   DocumentModel doc2)
Specified by:
compare in interface Comparator<DocumentModel>

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.