SPT Core API

com.sptci.jdo
Class StartLetterFactory

java.lang.Object
  extended by com.sptci.jdo.Factory<StartLetter>
      extended by com.sptci.jdo.StartLetterFactory

public class StartLetterFactory
extends Factory<StartLetter>

A repository class for abstracting interactions between the StartLetter JDO JavaBean and the JDO data store.

© Copyright 2007 Sans Pareil Technologies, Inc.

Version:
$Id: StartLetterFactory.java 4594 2009-01-29 17:43:03Z rakesh $
Author:
Rakesh Vidyadharan 2007-05-31

Field Summary
static StartLetterFactory startLetterFactory
          The singleton instance of the class.
 
Fields inherited from class com.sptci.jdo.Factory
logger
 
Constructor Summary
StartLetterFactory()
           
 
Method Summary
 StartLetter create(char letter, Class source, javax.jdo.PersistenceManager pm)
          Create a new persistent instance with the specified name.
 StartLetter create(char letter, String source, javax.jdo.PersistenceManager pm)
          Create a new persistent instance with the specified name.
 StartLetter fetch(char letter, String source, javax.jdo.PersistenceManager pm)
          Fetch the StartLetter identified by the StartLetter.letter and StartLetter.source values.
 Collection<StartLetter> fetchAll(javax.jdo.PersistenceManager pm)
          Return all the instance of StartLetter from the JDO data store.
 Collection<StartLetter> fetchBySource(Class source, javax.jdo.PersistenceManager pm)
          Return all the instances of StartLetter that are associated with the specified StartLetter.source.
 Collection<StartLetter> fetchBySource(String source, javax.jdo.PersistenceManager pm)
          Return all the instances of StartLetter that are associated with the specified StartLetter.source.
static StartLetterFactory getInstance()
          Return the singleton instance of the class.
protected  String getPrimaryKey(char letter, String source)
          Create the primary key for the specified combination of start letter and source class.
 
Methods inherited from class com.sptci.jdo.Factory
addAlphabeticalIndex, begin, close, close, commit, count, delete, fetch, fetch, fetch, fetchAll, getPersistenceManager, removeStartLetter, rollback, save
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

startLetterFactory

public static final StartLetterFactory startLetterFactory
The singleton instance of the class.

Constructor Detail

StartLetterFactory

public StartLetterFactory()
Method Detail

getInstance

public static StartLetterFactory getInstance()
Return the singleton instance of the class.

Returns:
StartLetterFactory The startLetterFactory instance.

create

public StartLetter create(char letter,
                          Class source,
                          javax.jdo.PersistenceManager pm)
Create a new persistent instance with the specified name. Check the data store to see if an existing instance exists with the specified name. If an instance exists, return the persistent instance instead. If no instance exists, return a new persistent ready object.

Parameters:
letter - The StartLetter.letter value to use.
source - The class whose fully qualified name is to be used for StartLetter.source.
pm - The persistence manager to use to interact with the data store.
Returns:
The non persistent new instance of the class.
See Also:
create(char, String, javax.jdo.PersistenceManager)

create

public StartLetter create(char letter,
                          String source,
                          javax.jdo.PersistenceManager pm)
Create a new persistent instance with the specified name. Check the data store to see if an existing instance exists with the specified name. If an instance exists, return the persistent instance instead. If no instance exists, return a new persistent object.

Parameters:
letter - The StartLetter.letter value to use.
source - The StartLetter.source value to use.
pm - The persistence manager to use to interact with the data store.
Returns:
The non persistent new instance of the class.
See Also:
fetch( char, String, PersistenceManager )

fetchAll

public Collection<StartLetter> fetchAll(javax.jdo.PersistenceManager pm)
Return all the instance of StartLetter from the JDO data store.

Parameters:
pm - The persistence manager to use to interact with the data store. It is assumed that an active transaction is in operation.
Returns:
All instances fetched by iterating the Extent.

fetch

public StartLetter fetch(char letter,
                         String source,
                         javax.jdo.PersistenceManager pm)
Fetch the StartLetter identified by the StartLetter.letter and StartLetter.source values.

Parameters:
letter - The letter value to use.
source - The source value to use.
pm - The persistence manager to use to interact with the data store. It is assumed that an active transaction is in operation.
Returns:
The appropriate object instance or null if no such object exists in the data store.

fetchBySource

public Collection<StartLetter> fetchBySource(Class source,
                                             javax.jdo.PersistenceManager pm)
Return all the instances of StartLetter that are associated with the specified StartLetter.source.

Parameters:
source - The source class whose start letters are to be retrieved.
pm - The persistence manager to use to interact with the data store. It is assumed that an active transaction is in operation.
Returns:
The appropriate object instances or an empty collection if no such objects exist in the data store.
See Also:
fetchBySource(String, javax.jdo.PersistenceManager)

fetchBySource

public Collection<StartLetter> fetchBySource(String source,
                                             javax.jdo.PersistenceManager pm)
Return all the instances of StartLetter that are associated with the specified StartLetter.source.

Parameters:
source - The source object whose start letters are to be retrieved.
pm - The persistence manager to use to interact with the data store. It is assumed that an active transaction is in operation.
Returns:
The appropriate object instances or an empty collection if no such objects exist in the data store.

getPrimaryKey

protected String getPrimaryKey(char letter,
                               String source)
Create the primary key for the specified combination of start letter and source class.

Parameters:
letter - The start letter character.
source - The class name of the source object.
Returns:
The primary key value to use.

SPT Core API