com.facetmap.example.movies
Class Movie

java.lang.Object
  extended by com.facetmap.example.movies.Movie
All Implemented Interfaces:
Resource

public class Movie
extends java.lang.Object
implements Resource

Contains all the data about a movie. This object is also a Resource, so it translates business-specific calls like getActors() to Facetmap-specific calls like getHeading(4) .

You could instead create a Resource object which wraps a Movie object, which would be just as good. We have taken the inheritance shortcut here because it better illustrates the use of the Resource interface.

We have also sacrificed typesafety, for the sake of brevity. Studio and genre values could be typed enumerations; facets could be classes. Here they are all addressed by simple Strings to keep excess code out of the example.


Field Summary
protected  java.util.Collection actors
           
protected  int domesticBoxOffice
           
protected  java.lang.String genre
           
protected  Heading[] headings
           
protected  int id
           
protected  java.lang.String link
           
protected  java.util.Date releaseDate
           
protected  java.lang.String studio
           
protected  java.lang.String title
           
 
Fields inherited from interface com.facetmap.Resource
LOCATION, TITLE
 
Constructor Summary
Movie(int id, java.lang.String title, java.util.Date releaseDate, int domesticBoxOffice, java.lang.String genre, java.lang.String studio, java.util.Collection actors)
           
 
Method Summary
 java.util.Collection getActors()
           
 java.lang.String getAttribute(java.lang.Object key)
           
 int getDomesticBoxOffice()
           
 java.lang.String getGenre()
           
 Heading getHeading(int index)
          A Heading bound to this Resource.
 int getHeadingCount()
          Bind this Resource to the specified Heading.
 int getId()
          Unique identifier.
 java.util.Date getReleaseDate()
           
 java.lang.String getStudio()
           
 java.lang.String getTitle()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected int id

title

protected java.lang.String title

link

protected java.lang.String link

releaseDate

protected java.util.Date releaseDate

domesticBoxOffice

protected int domesticBoxOffice

studio

protected java.lang.String studio

genre

protected java.lang.String genre

actors

protected java.util.Collection actors

headings

protected Heading[] headings
Constructor Detail

Movie

public Movie(int id,
             java.lang.String title,
             java.util.Date releaseDate,
             int domesticBoxOffice,
             java.lang.String genre,
             java.lang.String studio,
             java.util.Collection actors)
      throws UnknownReferenceException
Throws:
UnknownReferenceException
Method Detail

getAttribute

public java.lang.String getAttribute(java.lang.Object key)
Specified by:
getAttribute in interface Resource

getHeading

public Heading getHeading(int index)
Description copied from interface: Resource
A Heading bound to this Resource. Because Facetmap requires that each Facet be explicitly listed in the FacetSpace, an integer index must be provided. The index corresponds to the order of the Facets in the FacetSpace.

Specified by:
getHeading in interface Resource
Returns:
The bound Heading in the specified Facet.

getHeadingCount

public int getHeadingCount()
Description copied from interface: Resource
Bind this Resource to the specified Heading. If a different Heading in the same Facet has already been bound to this Resource, that bond may be erased.

Specified by:
getHeadingCount in interface Resource

getId

public int getId()
Description copied from interface: Resource
Unique identifier.

Specified by:
getId in interface Resource

getActors

public java.util.Collection getActors()

getDomesticBoxOffice

public int getDomesticBoxOffice()

getGenre

public java.lang.String getGenre()

getReleaseDate

public java.util.Date getReleaseDate()

getStudio

public java.lang.String getStudio()

getTitle

public java.lang.String getTitle()