org.apache.shale.usecases.rolodex
Class RolodexDao

java.lang.Object
  extended by org.apache.shale.usecases.rolodex.RolodexDao

public class RolodexDao
extends Object

Data Access Object for the roledex use case.


Field Summary
static char[][] TAB_INDEX
           Tab indexes for the rolodex.
 
Constructor Summary
RolodexDao()
           The constructor loads some default data.
 
Method Summary
 void deleteContact(Contact entity)
           Removes the contact from the mock data store.
 Contact findContact(String name)
           Returns the latest copy of the Contact by primary key.
 List findContactsForTab(int index)
           Retuns a subset of contacts within the index of a a tab defined by TAB_INDEX from the mock data store.
 int findTabForContact(Contact contact)
          This function will find the tabIndex that the Contact will be located on.
 javax.faces.model.SelectItem[] getCountries()
           Returns an array of countries used to populate a select list.
 javax.faces.model.SelectItem[] getStates()
           Returns an array of states used to populate a select list.
 List getTabs()
           Returns a list of SelectItem that will be used to build the links.
 void loadStates()
           Loads the State codes and contacts from an XML data source.
 int saveContact(Contact entity)
           Saves a Contact to the mock data store.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TAB_INDEX

public static final char[][] TAB_INDEX

Tab indexes for the rolodex. Each sub array represents the starting and ending character index.

Constructor Detail

RolodexDao

public RolodexDao()

The constructor loads some default data.

Method Detail

getTabs

public List getTabs()

Returns a list of SelectItem that will be used to build the links.


saveContact

public int saveContact(Contact entity)

Saves a Contact to the mock data store.


findTabForContact

public int findTabForContact(Contact contact)

This function will find the tabIndex that the Contact will be located on. It will default to the first page.


findContactsForTab

public List findContactsForTab(int index)

Retuns a subset of contacts within the index of a a tab defined by TAB_INDEX from the mock data store. If this was a RDBMS data store, the contacts returned might be a "ghost" object meaning that maybe only the name attribute would be populated.


deleteContact

public void deleteContact(Contact entity)

Removes the contact from the mock data store.


loadStates

public void loadStates()

Loads the State codes and contacts from an XML data source. The stateDataStore set will hold the states where the countryDataStore set will hold the countries. The target type of these collections will be SelectItem. The contacts are held in the entityDataStore set.


getStates

public javax.faces.model.SelectItem[] getStates()

Returns an array of states used to populate a select list. The target type is an array of SelectItem.


getCountries

public javax.faces.model.SelectItem[] getCountries()

Returns an array of countries used to populate a select list. The target type is an array of SelectItem.


findContact

public Contact findContact(String name)

Returns the latest copy of the Contact by primary key.

Parameters:
name - contact name that uniquely identifies a Contact.
Returns:
the target, fully populated Contact


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.