com.facetmap.example.movies
Class PreferenceEngine

java.lang.Object
  extended by com.facetmap.example.movies.PreferenceEngine

public class PreferenceEngine
extends java.lang.Object

In real life, this would be a component that uses your movie preferences and other's movies preferences to generate personal results for you. This is just a dummy implementation.

We want "Movies recommended for me" to be a facet option when users are browsing movies; however, the Facetmap engine doesn't directly support it. So we use ResourceIdFacet to tie the preference engine into the Facetmap process. This can be done in two ways:

1. Facetmap control. If you provide a callback function that tells the Facetmap engine which IDs are in a given heading, then Facetmap will run the browsing process and query the function when necessary. This is the approach we use in this example; the callback function is implemented in PreferenceResourceIdQuery.

2. External control. You can control the process yourself by querying this engine for recommended movies and then giving Facetmap a ResourceIdHeading containing those IDs. You then retrieve a Selection from Facetmap, using that ResourceIdHeading and headings from any other relevant facets.


Field Summary
static int[] DUMMY_RESULTS
           
 
Constructor Summary
PreferenceEngine(MovieList movies)
           
 
Method Summary
 int[] getMoviesRecommendedForUser(java.lang.Object user)
          Returns an array of IDs of movies in our movie list that are recommended for the given user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMMY_RESULTS

public static final int[] DUMMY_RESULTS
Constructor Detail

PreferenceEngine

public PreferenceEngine(MovieList movies)
Method Detail

getMoviesRecommendedForUser

public int[] getMoviesRecommendedForUser(java.lang.Object user)
Returns an array of IDs of movies in our movie list that are recommended for the given user. Note that our own MovieList object, not Facetmap, is in charge of assigning IDs, so we can use the same IDs here.

Parameters:
user - would in real life be a typed representation of user