| java.lang.Object com.jcorporate.expresso.core.dbobj.NextNumber
All known Subclasses: com.jcorporate.expresso.core.dbobj.NextNumberImpl,
NextNumber | abstract public class NextNumber (Code) | | Base class for pluggable next number autoincrementing system.
author: Original by Michael Nash, rewritten by Michael Rimov author: author: Modify by Yves Henri AMAIZO See Also: com.jcorporate.expresso.core.dbobj.NextNumberImpl See Also: for more information since: $DatabaseSchema $Date: 2004/11/17 20:48:11 $ |
Constructor Summary | |
protected | NextNumber() Constructor - Do not call directly. |
Method Summary | |
public static synchronized void | destroy() Fill in for potential resource removal Should be called by ConfigInit.
destroy() Or by unit tests to reset everything to a pristine state.
Note: Do not call getInstance() to call destroy. | public static synchronized NextNumber | getInstance() Factory Method returns a constructed instance of the NextNumber Manager. | protected String | getKey(DBObject callingDBObject, String fieldName) Builds the key string for lookup within the dbobject hashmap. | protected long | getMax(String db, DBObject callingObject, String oneField) Gets the maximum value for a particular object and field Used if there's
no value loaded in memory or state. | abstract public long | getNext(String db, DBObject callingDBObject, String fieldName) Get the nextnumber for this dbobject. | abstract public void | registerField(String db, DBObject callingDBObject, String fieldName) Register a field for next number information. | abstract public void | reset(String db) Reset the counts for the paritcular db each subsequent operation will
require a new getMax(). | abstract public void | reset(String db, DBObject callingObject) Clears the table on a particular dbobject. |
CHECK_PARAMETERS | final protected static boolean CHECK_PARAMETERS(Code) | | Set this to false and recompile to cause NextNumber to not check it's input
parameters. May result in NullPointerExceptions if there's bugs in the
code. But will result in a speed increase.
|
DEFAULT_CLASS_HANDLER | final public static String DEFAULT_CLASS_HANDLER(Code) | | |
log | protected static Logger log(Code) | | The lo4j log category.
|
theInstance | protected static NextNumber theInstance(Code) | | The actual static instance of the Next Number implementation
|
NextNumber | protected NextNumber()(Code) | | Constructor - Do not call directly. Use getInstance() instead.
|
destroy | public static synchronized void destroy()(Code) | | Fill in for potential resource removal Should be called by ConfigInit.
destroy() Or by unit tests to reset everything to a pristine state.
Note: Do not call getInstance() to call destroy. Simply use
NextNumber.destroy();
|
getInstance | public static synchronized NextNumber getInstance() throws DBException(Code) | | Factory Method returns a constructed instance of the NextNumber Manager.
instantiated NextNumber object |
getKey | protected String getKey(DBObject callingDBObject, String fieldName) throws DBException(Code) | | Builds the key string for lookup within the dbobject hashmap.
Parameters: callingDBObject - the calling DBObject Parameters: fieldName - the fieldName to get the key for a string formatted in [callingDBObject].[fieldName] throws: DBException - upon errorModify by Yves Henri AMAIZO since: $DatabaseSchema $Date: 2004/11/17 20:48:11 $ |
getMax | protected long getMax(String db, DBObject callingObject, String oneField) throws DBException(Code) | | Gets the maximum value for a particular object and field Used if there's
no value loaded in memory or state.
Parameters: db - The dataContext to get for Parameters: callingObject - the calling DBObject Parameters: oneField - the field name to query long value covering the max used for the field so far |
getNext | abstract public long getNext(String db, DBObject callingDBObject, String fieldName) throws DBException(Code) | | Get the nextnumber for this dbobject. Increments the internal value.
Parameters: db - The datacontext. MAKE SURE THIS IS CORRECT or else you will get duplicate running counts for each incorrect DB name, and thus Duplicate key errors when trying to write rows. Parameters: callingDBObject - The calling DBOBject Parameters: fieldName - the name of the field to get the next number value for long integer representing the next number to use for that field |
registerField | abstract public void registerField(String db, DBObject callingDBObject, String fieldName) throws DBException(Code) | | Register a field for next number information. This may happen even if it isn't an
auto-inc field.
Parameters: db - The database context to work with. Parameters: callingDBObject - The calling database object to register the field for Parameters: fieldName - The field name to register into the NextNumber engine |
reset | abstract public void reset(String db)(Code) | | Reset the counts for the paritcular db each subsequent operation will
require a new getMax(). There is questionable threadsafety about the
reset methods. Please only do it on a "non-live" server. Used after a
DBCreate or DeleteSchema has been called.
Parameters: db - the db context to clear all the next number values for. |
reset | abstract public void reset(String db, DBObject callingObject)(Code) | | Clears the table on a particular dbobject. Similar to reset db, but
Parameters: db - The db context that the next number resides in. Parameters: callingObject - the object that links to the various nextnumberobjects |
|
|