Class SimpleDocumentList<T extends SimpleDocument>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList<T>
-
- org.silverpeas.core.contribution.attachment.util.SimpleDocumentList<T>
-
- Type Parameters:
T
- the type of simple document that the list contains.
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,List<T>
,RandomAccess
public class SimpleDocumentList<T extends SimpleDocument> extends ArrayList<T>
This list provides some additional useful behaviors around simple documents.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Constructor Description SimpleDocumentList()
SimpleDocumentList(int initialCapacity)
SimpleDocumentList(Collection<? extends T> c)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getQueryLanguage()
Gets the language used to perform the JCR query in order to load the current list.int
hashCode()
protected boolean
isManuallySorted()
Indicates from the given list of documents if is manually sorted without taking care aboutAttachmentSettings.listFromYoungestToOldestAdd()
setting.SimpleDocumentList<T>
orderByLanguageAndLastUpdate(String... languageOrderedByPriority)
Orders the list by descending priority of the language and descending last update date.SimpleDocumentList<T>
removeLanguageFallbacks()
Removes from the current list all documents which content is in an other language than the one returned bygetQueryLanguage()
.SimpleDocumentList<T>
setQueryLanguage(String queryLanguage)
Sets the language used to perform the JCR query in order to load the current list.void
sortYoungestToOldestAddIfEnabled()
-
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeIf, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.List
containsAll
-
-
-
-
Constructor Detail
-
SimpleDocumentList
public SimpleDocumentList(int initialCapacity)
-
SimpleDocumentList
public SimpleDocumentList()
-
SimpleDocumentList
public SimpleDocumentList(Collection<? extends T> c)
-
-
Method Detail
-
getQueryLanguage
public String getQueryLanguage()
Gets the language used to perform the JCR query in order to load the current list.- Returns:
- the language is defined, null value otherwise.
-
setQueryLanguage
public SimpleDocumentList<T> setQueryLanguage(String queryLanguage)
Sets the language used to perform the JCR query in order to load the current list.- Parameters:
queryLanguage
- the language used to perform the JCR query in order to load the list.- Returns:
- itself.
-
removeLanguageFallbacks
public SimpleDocumentList<T> removeLanguageFallbacks()
Removes from the current list all documents which content is in an other language than the one returned bygetQueryLanguage()
. IfgetQueryLanguage()
returns null or an unknown languague, nothing is done.- Returns:
- itself.
-
orderByLanguageAndLastUpdate
public SimpleDocumentList<T> orderByLanguageAndLastUpdate(String... languageOrderedByPriority)
Orders the list by descending priority of the language and descending last update date. By default, if no language priority is given, then the language priority of the platform is taken into account. If a language priority is specified, then the language priorities of the platform are overridden.- Parameters:
languageOrderedByPriority
- manual language priority definition from the highest to the lowest.- Returns:
- itself.
-
isManuallySorted
protected boolean isManuallySorted()
Indicates from the given list of documents if is manually sorted without taking care aboutAttachmentSettings.listFromYoungestToOldestAdd()
setting.The given list MUST be provided by
DocumentRepository
listing methods which apply an ordering on the order metadata.In other words, it means that the documents MUST be ordered from lowest to greatest order index (
SimpleDocument.getOrder()
) when calling this method. Otherwise the result is not consistent.- Returns:
- true if the list is sorted manually (and so the list is ordered on order document data), false otherwise.
-
sortYoungestToOldestAddIfEnabled
public void sortYoungestToOldestAddIfEnabled()
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<T extends SimpleDocument>
- Specified by:
equals
in interfaceList<T extends SimpleDocument>
- Overrides:
equals
in classArrayList<T extends SimpleDocument>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<T extends SimpleDocument>
- Specified by:
hashCode
in interfaceList<T extends SimpleDocument>
- Overrides:
hashCode
in classArrayList<T extends SimpleDocument>
-
-