com.facetmap.simple
Class SimpleResource

java.lang.Object
  extended by com.facetmap.simple.SimpleResource
All Implemented Interfaces:
Resource
Direct Known Subclasses:
DynamicFacetSpaceResource, SqlResource

public class SimpleResource
extends java.lang.Object
implements Resource

Resource for use with SimpleResourceSpace.

If you're using a FacetSpace that may change after this Resource has been created, consider using DynamicFacetSpaceResource instead.

See Also:
SimpleResourceSpace, DynamicFacetSpaceResource

Field Summary
protected  java.util.Map attributes
           
protected  FacetSpace facetSpace
           
protected  Heading[] headings
           
protected  int id
           
 
Fields inherited from interface com.facetmap.Resource
LOCATION, TITLE
 
Constructor Summary
SimpleResource(FacetSpace facetSpace)
           
SimpleResource(FacetSpace facetSpace, java.lang.String title)
           
SimpleResource(FacetSpace facetSpace, java.lang.String title, java.lang.String location)
           
 
Method Summary
 void compoundHeading(CompoundHeadingFacet facet, CompoundHeading headingToAdd)
           
 java.lang.String getAttribute(java.lang.Object key)
          Recognizes keys Resource.LOCATION and Resource.TITLE, as well as the string IDs of each facet in the map.
 Heading getHeading(int i)
          A Heading bound to this Resource.
 int getHeadingCount()
          Bind this Resource to the specified Heading.
 int getId()
          Unique identifier.
 void setAttribute(java.lang.Object key, java.lang.String value)
           
 void setHeading(Heading f)
           
 void setHeading(int index, Heading heading)
           
 void setHeadings(Heading[] headings)
           
 void setId(int id)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

facetSpace

protected FacetSpace facetSpace

id

protected int id

attributes

protected java.util.Map attributes

headings

protected Heading[] headings
Constructor Detail

SimpleResource

public SimpleResource(FacetSpace facetSpace)

SimpleResource

public SimpleResource(FacetSpace facetSpace,
                      java.lang.String title)

SimpleResource

public SimpleResource(FacetSpace facetSpace,
                      java.lang.String title,
                      java.lang.String location)
Method Detail

getId

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

Specified by:
getId in interface Resource

getAttribute

public java.lang.String getAttribute(java.lang.Object key)
Recognizes keys Resource.LOCATION and Resource.TITLE, as well as the string IDs of each facet in the map. Passing a facet ID to this function will return the title of the heading assigned in that facet, if any.

Specified by:
getAttribute in interface Resource

setAttribute

public void setAttribute(java.lang.Object key,
                         java.lang.String value)

getHeading

public Heading getHeading(int i)
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.

setHeading

public void setHeading(Heading f)
                throws DataException
Throws:
DataException

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

setId

public void setId(int id)

setHeading

public void setHeading(int index,
                       Heading heading)

setHeadings

public void setHeadings(Heading[] headings)

compoundHeading

public void compoundHeading(CompoundHeadingFacet facet,
                            CompoundHeading headingToAdd)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object