|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object magoffin.matt.ma2.support.AbstractPlugin magoffin.matt.ma2.dao.support.AbstractJdbcBrowseModePlugin magoffin.matt.ma2.dao.support.RatingAverageBrowseModePlugin
public class RatingAverageBrowseModePlugin
Browse mode based on average media item ratings.
The configurable properties of this class are:
The SQL to generate the browse results. This must return the aggregate
count of all browsable items, grouped by average user ratings each
item has, e.g. "0.5", "1", etc. These "buckets" will be turned
into index keys. The SQL must return two columns: a float avg_rating
for the average rating bucket, and an integer item_count
for the count of items that fall within this bucket.
The following positional SQL parameters will be set:
The boolean flags are set as positional parameters for cross-database support for boolean values.
The SQL to generate the results for a single index section (i.e. average rating) and also to populate the items in a single album for viewing a single album. The following positional SQL parameters will be set:
The average rating section is set twice to allow the SQL to set lower and upper bounds for that section.
The SQL must return the following columns:
Field Summary | |
---|---|
static int |
DEFAULT_SECTION_ALBUM_MAX_SIZE
The default value for the sectionAlbumMaxSize property. |
static java.lang.String |
MESSAGE_KEY_ALBUM_TITLE_MULTI
The message key for an album title with more than one item in it. |
static java.lang.String |
MESSAGE_KEY_ALBUM_TITLE_SINGLE
The message key for an album title with just one item in it. |
static java.lang.String |
MODE_RATING_AVERAGE
Browse mode key for average rating. |
Fields inherited from class magoffin.matt.ma2.support.AbstractPlugin |
---|
log |
Constructor Summary | |
---|---|
RatingAverageBrowseModePlugin()
|
Method Summary | |
---|---|
SearchResults |
find(BrowseAlbumsCommand command,
PaginationCriteria pagination)
Perform the search, returning SearchResults populated with
AlbumSearchResult objects. |
java.lang.String[] |
getMessageResourceNames()
Get a list of message resource names to register. |
org.springframework.context.MessageSource |
getMessages()
|
int |
getSectionAlbumMaxSize()
|
java.lang.String |
getSqlBrowse()
|
java.lang.String |
getSqlBrowseSection()
|
java.lang.String[] |
getSupportedModes()
Get the supported modes of this plugin. |
void |
init()
Manual initialization method. |
protected void |
init(org.springframework.context.ApplicationContext application)
Initialization hook for subclasses. |
void |
setMessages(org.springframework.context.MessageSource messages)
|
void |
setSectionAlbumMaxSize(int sectionAlbumMaxSize)
|
void |
setSqlBrowse(java.lang.String sqlBrowse)
|
void |
setSqlBrowseSection(java.lang.String sqlBrowseSection)
|
boolean |
supportsMode(java.lang.String mode)
Test if this plugin supports a given browse mode. |
Methods inherited from class magoffin.matt.ma2.dao.support.AbstractJdbcBrowseModePlugin |
---|
getDomainObjectFactory, getJdbcTemplate, getPluginType, getUserBiz, setDomainObjectFactory, setJdbcTemplate, setUserBiz |
Methods inherited from class magoffin.matt.ma2.support.AbstractPlugin |
---|
getConfigName, initialize |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface magoffin.matt.ma2.plugin.Plugin |
---|
initialize |
Field Detail |
---|
public static final java.lang.String MODE_RATING_AVERAGE
public static final int DEFAULT_SECTION_ALBUM_MAX_SIZE
sectionAlbumMaxSize
property.
public static final java.lang.String MESSAGE_KEY_ALBUM_TITLE_SINGLE
public static final java.lang.String MESSAGE_KEY_ALBUM_TITLE_MULTI
Constructor Detail |
---|
public RatingAverageBrowseModePlugin()
Method Detail |
---|
public boolean supportsMode(java.lang.String mode)
BrowseModePlugin
mode
- the mode to test
protected void init(org.springframework.context.ApplicationContext application)
AbstractPlugin
This method will be called at the end of the AbstractPlugin.initialize(org.springframework.context.ApplicationContext)
method.
init
in class AbstractPlugin
application
- the ApplicationContextpublic java.lang.String[] getMessageResourceNames()
Plugin
public java.lang.String[] getSupportedModes()
BrowseModePlugin
public void init()
This is used by unit tests.
public SearchResults find(BrowseAlbumsCommand command, PaginationCriteria pagination)
BrowseModePlugin
SearchResults
populated with
AlbumSearchResult
objects.
command
- the browse commandpagination
- the pagination criteria
public java.lang.String getSqlBrowse()
public void setSqlBrowse(java.lang.String sqlBrowse)
sqlBrowse
- the sqlBrowse to setpublic java.lang.String getSqlBrowseSection()
public void setSqlBrowseSection(java.lang.String sqlBrowseSection)
sqlBrowseSection
- the sqlBrowseSection to setpublic int getSectionAlbumMaxSize()
public void setSectionAlbumMaxSize(int sectionAlbumMaxSize)
sectionAlbumMaxSize
- the sectionAlbumMaxSize to setpublic org.springframework.context.MessageSource getMessages()
public void setMessages(org.springframework.context.MessageSource messages)
messages
- the messages to set
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |