com.facetmap.example.movies
Class PreferenceResourceIdQuery

java.lang.Object
  extended by com.facetmap.example.movies.PreferenceResourceIdQuery
All Implemented Interfaces:
ResourceIdQuery

public class PreferenceResourceIdQuery
extends java.lang.Object
implements ResourceIdQuery

wraps the PreferenceEngine in a query object so that the Facetmap engine can use it. When Facetmap is processing a request, it will send a heading ID to this class (our movie-browsing user interface is responsible for creating the heading ID; in this case it's created from the user ID). This class must fetch the IDs of all records that correspond to the provided heading -- in this case, all movies recommended for the user.

Other methods here control the display of general facet information; namely, the titles of the facet and its root heading.


Constructor Summary
PreferenceResourceIdQuery(PreferenceEngine engine)
           
 
Method Summary
 java.lang.String getDisplayTitle(java.lang.String headingId)
          Return a title that describes the query corresponding to a Heading ID.
 int[] getResourceIds(java.lang.String headingId)
          A real-life preference engine might set the headingID to be the username or user ID of whoever is browsing the site.
 java.lang.String getRootDisplayTitle()
          Return the title that describes the set of all resources.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PreferenceResourceIdQuery

public PreferenceResourceIdQuery(PreferenceEngine engine)
Method Detail

getDisplayTitle

public java.lang.String getDisplayTitle(java.lang.String headingId)
Description copied from interface: ResourceIdQuery
Return a title that describes the query corresponding to a Heading ID.

Specified by:
getDisplayTitle in interface ResourceIdQuery

getRootDisplayTitle

public java.lang.String getRootDisplayTitle()
Description copied from interface: ResourceIdQuery
Return the title that describes the set of all resources. (In other words, the title of the root heading in this facet.)

Specified by:
getRootDisplayTitle in interface ResourceIdQuery

getResourceIds

public int[] getResourceIds(java.lang.String headingId)
A real-life preference engine might set the headingID to be the username or user ID of whoever is browsing the site. Then this method would retrieve recommended movies for that user.

Alternatively the user could be stored in the HTTP session anyway, or in other persistent state. But we don't need to give this object access to the session if we convey the information in an argument.

Specified by:
getResourceIds in interface ResourceIdQuery