org.ocap.hn.content.navigation
Interface ContentList

All Superinterfaces:
Enumeration

public interface ContentList
extends Enumeration

This interface represents a list of filtered ContentEntry objects. A ContentList may contain a complete or partial subset of entries resulting from an application requested filter, browse or search.


Method Summary
 ContentList filterContentList(ContentDatabaseFilter filter)
          Filters the ContentList.
 ContentEntry find(String[] keys, Object[] values)
          Finds the first ContentEntry which matches the search.
 ContentEntry find(String key, Object value)
          Finds the first ContentEntry which identifier for the key 'key' equals the given object obj.
 ContentList findAll(String[] keys, Object[] values)
          Finds all ContentEntry objects which match the search.
 String getSortOrder()
          Gets the sort order set by the #setSortOrder method.
 void setSortOrder(String sortOrder)
          Sets the metadata sort order of the items in this list based on metadata key identifiers using signed property values.
 int size()
          Gets the number of ContentEntry objects in this ContentList.
 int totalMatches()
          Gets to total number of ContentEntry matches in the filter, browse or search operation that generated this ContentList.
 
Methods inherited from interface java.util.Enumeration
hasMoreElements, nextElement
 

Method Detail

size

int size()
Gets the number of ContentEntry objects in this ContentList.

Returns:
Number of entries in this list. Returns 0 if the list is empty.

totalMatches

int totalMatches()
Gets to total number of ContentEntry matches in the filter, browse or search operation that generated this ContentList. This value SHALL be greater than or equal to the value returned from the size() method of this ContentList. This value SHALL be greater than the value returned from the size() method of this ContentList if the requestedCount parameter of the originating content entry request was less than the total entry matches of the requesting operation. See ContentServerNetModule.

Returns:
the total number of ContentEntry matches from the originating content entry request

setSortOrder

void setSortOrder(String sortOrder)
Sets the metadata sort order of the items in this list based on metadata key identifiers using signed property values. The sortOrder parameter of this method is a string containing the properties and sort modifiers to be used to sort the resulting ContentList. The format of the string containing the sort criteria shall follow the format defined in UPnP Content Directory Service 3.0 specification section 2.3.16: A_ARG_TYPE_SortCriteria.

Parameters:
sortOrder - a String representing the sortOrder for this ContentList.

getSortOrder

String getSortOrder()
Gets the sort order set by the #setSortOrder method.

Returns:
The array of sort keys, or null if the setPreferredSortOrder method has not been called for this list.

find

ContentEntry find(String key,
                  Object value)
Finds the first ContentEntry which identifier for the key 'key' equals the given object obj. For instance, if key == "Title" then obj represents the title, e.g. "Best movie ever" and this method will return the first ContentEntry in the list than contains a match for the (key, value) pair.

Parameters:
key - The identifier key.
value - The object to compare to
Returns:
The first matched ContentEntry, or null if no match found.

find

ContentEntry find(String[] keys,
                  Object[] values)
Finds the first ContentEntry which matches the search. The keys and values parameters are parallel arrays. For example, if keys[0] == "TITLE" and values[0] == "Best movie ever", the implementation SHALL match the first ContentEntry in the list where the metadata contains that (key, value) pair, as well as matches any other entries in the parameter arrays.

Parameters:
keys - Array of identifier keys.
values - Array of values.
Returns:
The first matching ContentEntry found, or null if no match. If the parameter arrays are not the same length this method returns null.

findAll

ContentList findAll(String[] keys,
                    Object[] values)
Finds all ContentEntry objects which match the search. Same as the #find(String[], Object[]) method except all matches are returned instead of just the first match.

Parameters:
keys - Array of identifier keys.
values - Array of values.
Returns:
A ContentList containing all matches, or null if no matches were found.

filterContentList

ContentList filterContentList(ContentDatabaseFilter filter)
                              throws DatabaseException
Filters the ContentList. The returned ContentList is a new ContentList only containing ContentItems on which ContentDatabaseFilter.accept returned true.

Parameters:
filter - the ContentDatabaseFilter
Returns:
newly created ContentList containing only the filtered ContentItems.
Throws:
DatabaseException; - see DatabaseException for exception reasons.
DatabaseException


Copyright © 2011. All Rights Reserved.