|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.floggy.persistence.PersistableManager
public abstract class PersistableManager
This is the main class of the framework. All persistence operations methods (such as loading, saving, deleting and searching for objects) are declared in this class.
Field Summary | |
---|---|
static String |
BATCH_MODE
|
static String |
STORE_INDEX_AFTER_SAVE_OPERATION
|
Constructor Summary | |
---|---|
PersistableManager()
|
Method Summary | |
---|---|
abstract int |
batchSave(Persistable persistable)
Store an object in the repository, it will always create a new entry on the repository. The main use of this method is to import data from a remote source. Set the property BATCH_MODE to true to improve the performance and create only one object to save the data. |
abstract void |
delete(Persistable persistable)
Removes an object from the repository. |
abstract void |
deleteAll()
Removes all objects from the repository. |
abstract void |
deleteAll(Class persistableClass)
Removes all objects that belongs to the class passed as parameter from the repository. |
abstract SingleObjectSet |
find(Class persistableClass,
Filter filter,
Comparator comparator)
Searches objects of an especific persistable class from the repository. |
abstract SingleObjectSet |
find(Class persistableClass,
Filter filter,
Comparator comparator,
boolean lazy)
Searches objects of a specific persistable class from the repository. |
abstract SingleObjectSet |
find(Class persistableClass,
IndexFilter indexFilter,
boolean lazy)
Searches objects of a specific persistable class from the repository. |
abstract int |
getId(Persistable persistable)
Gets the id under the persistable is stored. |
static PersistableManager |
getInstance()
Returns the current instance of PersistableManager. |
abstract Object |
getProperty(String name)
Get a property |
abstract boolean |
isPersisted(Persistable persistable)
Check if the object is already persisted. |
abstract void |
load(Persistable persistable,
int id)
Load an previously stored object from the repository using the object ID. The object ID is the result of a save operation or you can obtain it executing a search. |
abstract void |
load(Persistable persistable,
int id,
boolean lazy)
Load an previously stored object from the repository using the object ID. The object ID is the result of a save operation or you can obtain it executing a search. |
abstract PolymorphicObjectSet |
polymorphicFind(Class persistableClass,
Filter filter,
boolean lazy)
Searches objects of an persistable class and its subclasses from the repository. |
abstract int |
save(Persistable persistable)
Store an object in the repository. |
abstract void |
setProperty(String name,
Object value)
Set a property |
abstract void |
shutdown()
Shutdown the PersistableManager. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String BATCH_MODE
public static final String STORE_INDEX_AFTER_SAVE_OPERATION
Constructor Detail |
---|
public PersistableManager()
Method Detail |
---|
public static PersistableManager getInstance()
RuntimeException
- DOCUMENT ME!public abstract int batchSave(Persistable persistable) throws FloggyException
PersistableManager manager = PersistableManager.getInstance();
* manager.setProperty(PersistableManager.BATCH_MODE, Boolean.TRUE);
* Customer customer = new Customer();
* for(int i = 0; i < ...; i++) {
* loadDataFromServerOnCustomer(customer);
* manager.batchSave(customer);
* } manager.setProperty(PersistableManager.BATCH_MODE, Boolean.FALSE);
*
persistable
- Object to be stored.
FloggyException
- Exception thrown if an error occurs while storing
the object.load(Persistable, int)
public abstract void delete(Persistable persistable) throws FloggyException
FloggyException
will be thrown.
persistable
- Object to be removed.
FloggyException
- Exception thrown if an error occurs while removing
the object.public abstract void deleteAll() throws FloggyException
FloggyException
- Exception thrown if an error occurs while removing
the objects.public abstract void deleteAll(Class persistableClass) throws FloggyException
persistableClass
- The persistable class to search the objects.
FloggyException
- Exception thrown if an error occurs while removing
the objects.public abstract SingleObjectSet find(Class persistableClass, Filter filter, Comparator comparator) throws FloggyException
Filter
.Comparator
.
persistableClass
- The persistable class to search the objects.filter
- An optional application-defined criteria for searching
objects.comparator
- An optional application-defined criteria for sorting
objects.
FloggyException
- DOCUMENT ME!public abstract SingleObjectSet find(Class persistableClass, IndexFilter indexFilter, boolean lazy) throws FloggyException
persistableClass
- The persistable class to search the objects.indexFilter
- The filter object based on an index.lazy
- A flag indicating to load or not all composite relationships.
FloggyException
- DOCUMENT ME!public abstract SingleObjectSet find(Class persistableClass, Filter filter, Comparator comparator, boolean lazy) throws FloggyException
Filter
.Comparator
.
persistableClass
- The persistable class to search the objects.filter
- An optional application-defined criteria for searching
objects.comparator
- An optional application-defined criteria for sorting
objects.lazy
- A flag indicating to load or not all composite relationships.
FloggyException
- DOCUMENT ME!public abstract int getId(Persistable persistable)
persistable
- Object to be retrieved the id.
public abstract Object getProperty(String name)
name
- the property's name
public abstract boolean isPersisted(Persistable persistable)
persistable
- Object to be checked the persistable state.
public abstract void load(Persistable persistable, int id) throws FloggyException
persistable
- An instance where the object data will be loaded into.
Cannot be null
.id
- The ID of the object to be loaded from the repository.
FloggyException
- Exception thrown if an error occurs while loading
the object.save(Persistable)
public abstract void load(Persistable persistable, int id, boolean lazy) throws FloggyException
persistable
- An instance where the object data will be loaded into.
Cannot be null
.id
- The ID of the object to be loaded from the repository.lazy
- A flag indicating to load or not all composite relationships.
FloggyException
- Exception thrown if an error occurs while loading
the object.save(Persistable)
public abstract PolymorphicObjectSet polymorphicFind(Class persistableClass, Filter filter, boolean lazy) throws FloggyException
Filter
.Comparator
.
persistableClass
- The persistable class to search the objects.filter
- An optional application-defined criteria for searching
objects.lazy
- A flag indicating to load or not all composite relationships.
FloggyException
- DOCUMENT ME!public abstract int save(Persistable persistable) throws FloggyException
persistable
- Object to be stored.
FloggyException
- Exception thrown if an error occurs while storing
the object.load(Persistable, int)
public abstract void setProperty(String name, Object value)
name
- the property's namevalue
- the property's valuepublic abstract void shutdown() throws FloggyException
FloggyException
- DOCUMENT ME!
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |