com.facetmap.simple
Class SimpleDateFacet

java.lang.Object
  extended by com.facetmap.simple.SimpleDateFacet
All Implemented Interfaces:
DateFacet, Facet

public class SimpleDateFacet
extends java.lang.Object
implements DateFacet

Basic DateFacet implementation, which automatically provides rudimentary calendar browsing (year, month, day). This implementation does not allow IDs to be assigned to date ranges.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.facetmap.Facet
Facet.Util
 
Field Summary
protected  java.lang.String id
           
protected  Heading rootHeading
           
protected  java.lang.String title
           
 
Constructor Summary
SimpleDateFacet(java.lang.String id, java.lang.String title, java.lang.String rootHeadingTitle, java.util.Date startInstant, java.util.Date endInstant)
           
 
Method Summary
 SimpleDateHeading getDateHeading(CalendarUnit calendarUnit)
           
 DateHeading getDateHeading(java.util.Date instant)
          Return a DateHeading in this facet which represents only an instant.
 DateHeading getDateHeading(java.util.Date startInstant, java.util.Date endInstant)
          Return a DateHeading in this facet which represents a timespan.
 DateHeading getDateHeading(java.lang.String id)
          Return a previously defined DateHeading.
 Heading getHeading(java.lang.String id)
          Retrieves the Heading, with the specified ID, that is contained by this Facet.
 java.lang.String getId()
          Unique identifier.
 Heading getRootHeading()
          A facet structure is rooted at the heading returned by this method.
 java.lang.String getTitle()
          The descriptive name of this structure, for display to users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected java.lang.String id

title

protected java.lang.String title

rootHeading

protected Heading rootHeading
Constructor Detail

SimpleDateFacet

public SimpleDateFacet(java.lang.String id,
                       java.lang.String title,
                       java.lang.String rootHeadingTitle,
                       java.util.Date startInstant,
                       java.util.Date endInstant)
Method Detail

getDateHeading

public SimpleDateHeading getDateHeading(CalendarUnit calendarUnit)

getDateHeading

public DateHeading getDateHeading(java.util.Date startInstant,
                                  java.util.Date endInstant)
Description copied from interface: DateFacet
Return a DateHeading in this facet which represents a timespan. This is a low-level heading factory method that uses java.util.Date . The java.util.Date object represents an instant in time, and is therefore not really suitable for most browsing experiences, where you want to specify an interval, say, a DateHeading that represents a certain month. So it's usually easier to create common DateHeading objects with com.facetmap.simple.DateHeadingBuilder, which wraps DateFacet and provides more usable methods to get DateHeadings.

Specified by:
getDateHeading in interface DateFacet
See Also:
com.facetmap.simple.DateHeadingBuilder

getDateHeading

public DateHeading getDateHeading(java.util.Date instant)
Description copied from interface: DateFacet
Return a DateHeading in this facet which represents only an instant. The returned Heading is typically appropriate for mapping to a Resource, but usually not so useful for making a Selection.

Specified by:
getDateHeading in interface DateFacet

getDateHeading

public DateHeading getDateHeading(java.lang.String id)
                           throws UnknownReferenceException
Description copied from interface: DateFacet
Return a previously defined DateHeading.

Specified by:
getDateHeading in interface DateFacet
Throws:
UnknownReferenceException

getHeading

public Heading getHeading(java.lang.String id)
                   throws UnknownReferenceException
Description copied from interface: Facet
Retrieves the Heading, with the specified ID, that is contained by this Facet. If the facet doesn't recognize the ID, it will throw UnknownReferenceException.

Specified by:
getHeading in interface Facet
Throws:
UnknownReferenceException

getId

public java.lang.String getId()
Description copied from interface: Facet
Unique identifier.

Specified by:
getId in interface Facet

getRootHeading

public Heading getRootHeading()
Description copied from interface: Facet
A facet structure is rooted at the heading returned by this method. The root provides a starting point for navigation through this facet structure; the root will be one of the headings in the Selection that contains all Resources. The root Heading should have no backward Heading.

In most cases, Resources that are not mapped to any Heading in this Facet are implicitly mapped to this function's return value. Selection.getBackwardSelections(). In some subinterfaces, the root takes on a more familiar role, e.g. the root node of a Taxonomy.

Specified by:
getRootHeading in interface Facet
See Also:
Selection.getForwardSelections(com.facetmap.Facet)

getTitle

public java.lang.String getTitle()
Description copied from interface: Facet
The descriptive name of this structure, for display to users.

Specified by:
getTitle in interface Facet