info.aduna.gee.spectacle.gee
Class EntityContext

java.lang.Object
  extended by info.aduna.gee.spectacle.gee.EntityContext
Direct Known Subclasses:
EntityContextImpl, JitEntityContext

public class EntityContext
extends Object

Class EntityContext represents the context for one type of Entities. It maintains the set of Entities itself, its corresponding set of labels, and any views on the content.


Field Summary
protected  Channel _channel
          The channel used to store the content and its labels in.
protected  LabelDispenser _dispenser
          The maintainer of the labels.
protected  List<String> _orderFields
          The field sequence that controls sorting.
protected  EntityProducer _producer
          The producer of the content.
protected  Map<Object,View> _views
          The views defined on the content.
 
Constructor Summary
EntityContext()
          Construct a new empty EntityContext.
EntityContext(Channel channel, EntityProducer producer, LabelDispenser dispenser)
          Constuct a new EntityContext.
 
Method Summary
protected  void _init(Channel channel, EntityProducer producer, LabelDispenser dispenser)
          Initialize this context.
 void addView(Channel channel)
          Add a view constructed from the specified channel.
 void addView(Object viewID, View view)
          Add a view.
 Channel getChannel()
           
 String getChannelName()
           
 Map<Object,Entity> getEntities()
           
 Object getLabelClassification(String label)
           
 String getLabelDescription(String label)
           
 String getNewLabel(Object classification)
           
 View getView(Object viewID)
           
 void render(EntryRenderer renderer)
          Render all information on the server.
static List<Entity> selectEntities(String label, List<Entity> entities, boolean forEmptyOnly)
          Select all entities that have the specified label.
 void setOrderField(String orderField)
           
 void setOrderFields(List<String> orderFields)
           
 void sync()
          Sync the current content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_orderFields

protected List<String> _orderFields
The field sequence that controls sorting.


_channel

protected Channel _channel
The channel used to store the content and its labels in.


_producer

protected EntityProducer _producer
The producer of the content.


_dispenser

protected LabelDispenser _dispenser
The maintainer of the labels.


_views

protected Map<Object,View> _views
The views defined on the content.

Constructor Detail

EntityContext

public EntityContext()
Construct a new empty EntityContext.


EntityContext

public EntityContext(Channel channel,
                     EntityProducer producer,
                     LabelDispenser dispenser)
Constuct a new EntityContext.

Parameters:
channel - the channel used to store the content and its labels in
producer - the producer of the content
dispenser - the maintainer of the labels
Method Detail

_init

protected void _init(Channel channel,
                     EntityProducer producer,
                     LabelDispenser dispenser)
Initialize this context. Meant to be overridden by subclasses.

Parameters:
channel - the channel used to store the content and its labels in
producer - the producer of the content
dispenser - the maintainer of the labels

getChannelName

public String getChannelName()
Returns:
the name of the channel used to store the content and its labels in.

getChannel

public Channel getChannel()
Returns:
the channel used to store the content and its labels in.

getEntities

public Map<Object,Entity> getEntities()
See Also:
EntityProducer.getEntities()

getNewLabel

public String getNewLabel(Object classification)
See Also:
LabelDispenser.getNewLabel(java.lang.Object)

getLabelDescription

public String getLabelDescription(String label)
See Also:
LabelDispenser.getLabelDescription(java.lang.String)

getLabelClassification

public Object getLabelClassification(String label)
See Also:
LabelDispenser.getLabelClassification(java.lang.String)

sync

public void sync()
          throws ChannelException
Sync the current content.

Throws:
ChannelException

setOrderFields

public void setOrderFields(List<String> orderFields)
Parameters:
orderFields - the sequence of fields that control the sequence of rendering.

setOrderField

public void setOrderField(String orderField)
Parameters:
orderField - the field that controls the sequence of rendering.

render

public void render(EntryRenderer renderer)
            throws ChannelException
Render all information on the server.

Throws:
ChannelException

addView

public void addView(Object viewID,
                    View view)
Add a view.

Parameters:
viewID - an identification for the View
view - the View to add

addView

public void addView(Channel channel)
Add a view constructed from the specified channel. The View will be stored using its name as identification.

Parameters:
channel - the channel to add as a view

getView

public View getView(Object viewID)
Parameters:
viewID - the ID of the View to get
Returns:
the View with the specified identification

selectEntities

public static List<Entity> selectEntities(String label,
                                          List<Entity> entities,
                                          boolean forEmptyOnly)
Select all entities that have the specified label.

Parameters:
label - the label
entities - the set of entities to examine
forEmptyOnly - return either 1 entity or none at all
Returns:
all entities from the specified set that have the specified label


Copyright © 1997-2008 Aduna. All Rights Reserved.