|
SPT Object Database API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.prevayler.PrevalentManager<P>
public class PrevalentManager<P extends PrevalentObject>
A facade around the prevalent system used to present a more natural programming interface than that provided by prevayler.
The following shows sample use of this class:
import com.sptci.prevayler.PrevalentException;
import com.sptci.prevayler.PrevalentManager;
...
MyPrevalentObject po = new MyPrevalentObject( ... );
po.setXxx( ... );
final PrevalentManager pm = new PrevalentManager();
try
{
po = pm.save( po );
System.out.format( "Total MyPrevalentObjects in system: %d%n",
po.count( MyPrevalentObject.class ) );
}
catch ( PrevalentException pex )
{
// handle error
}
© Copyright 2008 Sans Pareil Technologies, Inc.
PrevalentSystemFactory,
Serialized Form| Field Summary | |
|---|---|
private static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
PrevalentManager()
|
|
| Method Summary | |
|---|---|
int |
count(Class type)
Return the total number of persistent instance of the specified type in the prevalent system. |
P |
delete(P object)
Delete the specified prevalent object from the prevalent system. |
Collection<P> |
fetch(Class type,
long start,
long end)
Return the collection of prevalent objects in the specified range. |
P |
fetch(Class type,
Object objectId)
Return the prevalent object identified by the object id specified. |
Collection<P> |
fetch(Class type,
String field,
Object value)
Retrieve the collection of prevelant objects of the specified type that are indexed by the specified field and value. |
protected Collection<P> |
fetchByIndices(Class type,
Map<String,?> parameters,
FetchByIndices.AggregationType resultType)
Retrieve the collection of prevelant objects of the specified type that are indexed by the specified fields and values. |
Collection<P> |
fetchIntersection(Class type,
Map<String,?> parameters)
Retrieve the collection of prevelant objects of the specified type that are indexed by the specified fields and values. |
Collection<P> |
fetchUnion(Class type,
Map<String,?> parameters)
Retrieve the collection of prevelant objects of the specified type that are indexed by the specified fields and values. |
P |
save(P object)
Save the specified prevalent object to the prevalent system. |
Collection<P> |
search(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter,
int count)
Execute the specified lucene query and return the collection of matching prevalent objects. |
Collection<P> |
search(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter,
int count,
org.apache.lucene.search.Sort sort)
Execute the specified lucene query and return the collection of matching prevalent objects. |
Collection<P> |
search(org.apache.lucene.search.Query query,
int count)
Execute the specified lucene query and return the collection of matching prevalent objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final long serialVersionUID
| Constructor Detail |
|---|
public PrevalentManager()
| Method Detail |
|---|
public P save(P object)
throws PrevalentException
save in interface Database<P extends PrevalentObject>object - The prevalent object to save to the prevalent system.
PrevalentException - If errors are encountered while saving the
prevalent object.
public P delete(P object)
throws PrevalentException
delete in interface Database<P extends PrevalentObject>object - The prevalent object to delete from the prevalent system.
PrevalentObject.getObjectId() will return
null if the object is deleted.
PrevalentException - If errors are encountered while deleting the
object. More specific sub-classes such as DeleteException
are thrown when configured rules are violated.
public int count(Class type)
throws PrevalentException
count in interface AbstractDatabase<P extends PrevalentObject>type - The type of object whose persistent instance count is to
be retrieved.
PrevalentException - If errors are encountered while fetching the
object count.
public P fetch(Class type,
Object objectId)
throws PrevalentException
fetch in interface AbstractDatabase<P extends PrevalentObject>type - The type of the persisted object which has the specified
object id.objectId - The object id of the prevalent object.
null.
PrevalentException - If errors are encountered while fetching the
persistent object.
public Collection<P> fetch(Class type,
long start,
long end)
throws PrevalentException
fetch in interface AbstractDatabase<P extends PrevalentObject>type - The type of the persisted objects which are to be fetched.start - The starting index (inclusive) of the range of objects
to fetch.end - The ending index (exclusive) of the range of objects to
fetch.
PrevalentException - If errors are encountered while retrieving
the persisted objects.PrimaryStorage.get( long, long )
public Collection<P> fetch(Class type,
String field,
Object value)
throws PrevalentException
fetch in interface AbstractDatabase<P extends PrevalentObject>type - The type of the persisted objects which are to be fetched.field - The name of the indexed field in the prevalent class.value - The value of the indexed field in the prevalent class.
PrevalentException - If errors are encountered while retrieving
the persisted objects.
public Collection<P> fetchUnion(Class type,
Map<String,?> parameters)
throws PrevalentException
union of the prevalent objects matching each
parameter in the collection of parameters (an or query).
fetchUnion in interface AbstractDatabase<P extends PrevalentObject>type - The type of the persisted objects which are to be fetched.parameters - The map of field-name to value mappings to use
to fetch instances.
PrevalentException - If errors are encountered while retrieving
the persisted objects.fetchByIndices(java.lang.Class, java.util.Map, com.sptci.prevayler.query.FetchByIndices.AggregationType)
public Collection<P> fetchIntersection(Class type,
Map<String,?> parameters)
throws PrevalentException
intersection of the prevalent objects matching
each parameter in the collection of parameters (an or query).
fetchIntersection in interface AbstractDatabase<P extends PrevalentObject>type - The type of the persisted objects which are to be fetched.parameters - The map of field-name to value mappings to use
to fetch instances.
PrevalentException - If errors are encountered while retrieving
the persisted objects.fetchByIndices(java.lang.Class, java.util.Map, com.sptci.prevayler.query.FetchByIndices.AggregationType)
public Collection<P> search(org.apache.lucene.search.Query query,
int count)
throws PrevalentException
search in interface Database<P extends PrevalentObject>query - The lucene query that is to be executed to find matching
prevalent object instances.count - The maximum number to top hits for the search to return.
PrevalentException - If errors are encountered
while reconstituting the prevalent objects being returned.
public Collection<P> search(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter,
int count)
throws PrevalentException
search in interface Database<P extends PrevalentObject>query - The lucene query that is to be executed to find matching
prevalent object instances.filter - The filter to apply to restrict the query results.count - The maximum number to top hits for the search to return.
PrevalentException - If errors are encountered
while reconstituting the prevalent objects being returned.
public Collection<P> search(org.apache.lucene.search.Query query,
org.apache.lucene.search.Filter filter,
int count,
org.apache.lucene.search.Sort sort)
throws PrevalentException
Notes:
class
Field
which contains the fully qualified class name of the prevalent object.
search in interface AbstractDatabase<P extends PrevalentObject>query - The lucene query that is to be executed to find matching
prevalent object instances.filter - The filter to apply to restrict the query results.count - The maximum number to top hits for the search to return.sort - The sort criteria to use for the results.
PrevalentException - If errors are encountered while reconstituting
the prevalent objects being returned.
protected Collection<P> fetchByIndices(Class type,
Map<String,?> parameters,
FetchByIndices.AggregationType resultType)
throws PrevalentException
type - The type of the persisted objects which are to be fetched.parameters - The map of field-name to value mappings to use
to fetch instances.resultType - The type of aggregation to be used for the result set.
PrevalentException - If errors are encountered while retrieving
the persisted objects.
|
SPT Object Database API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||