com.jwpepper.inv
Class QueryImpl
java.lang.Object
|
+--java.rmi.server.RemoteObject
|
+--java.rmi.server.RemoteServer
|
+--java.rmi.server.UnicastRemoteObject
|
+--com.imaginary.lwp.BaseEntity
|
+--com.jwpepper.inv.QueryImpl
- public class QueryImpl
- extends BaseEntity
- implements Query
In EJB terms, a session bean that supports the querying of the J.W. Pepper
Product database. Two kinds of queries are supported: anonymous and saved.
An anonymous query is an unnamed query that will not be saved. A saved
query has a name associated with it and is saved across time so
that the owner can use it to generate new results or view the most
recent set of results it generated.
Last modified $Date: 1999/10/07 20:39:50 $
- Version:
- $Revision: 1.1 $
- Author:
- George Reese (george@ancept.com)
- See Also:
- Serialized Form
Fields inherited from class java.rmi.server.RemoteObject |
ref |
Constructor Summary |
QueryImpl()
Empty constructor required of all LWP implementation objects. |
Method Summary |
void |
create(Identifier id,
SearchCriteria sc,
java.lang.String nom)
Works like the other version of create() , but the
query is saved to the data store. |
void |
create(SearchCriteria sc)
Creates a new Query object based on the specified
search criteria. |
void |
generateResults(Identifier id)
Generates a new set of results based on this query's search criteria. |
SearchCriteria |
getCriteria()
Provides the criteria on which this search is based. |
java.lang.String |
getName()
Provides the name associated with this query. |
java.lang.String |
getUser()
Provides the user ID of the person who owns this query. |
com.sun.java.util.collections.Iterator |
lastResults()
Provides a list of the most recently generated results. |
protected void |
load(Memento mem)
Loads this query's state from the specified memento. |
protected void |
store(Memento mem)
Stores the current state of the query into the specified memento. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
clone,
exportObject,
exportObject,
exportObject,
unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
getClientHost,
getLog,
setLog |
Methods inherited from class java.rmi.server.RemoteObject |
equals,
getRef,
hashCode,
toString,
toStub |
Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
QueryImpl
public QueryImpl()
throws PersistenceException,
java.rmi.RemoteException
- Empty constructor required of all LWP implementation objects.
- Throws:
- PersistenceException - a persistence
handler could not be assigned
- java.rmi.RemoteException - the object could not be exported
create
public void create(SearchCriteria sc)
throws FindException,
java.rmi.RemoteException
- Creates a new
Query
object based on the specified
search criteria. This method does not save the query in the database.
If a saved query is desired, then the other create
method should be used. This method will perform an initial query.
- Specified by:
- create in interface Query
- Parameters:
sc
- the search criteria to use for the query- Throws:
- FindException - an error occurred performing
the initial query
- java.rmi.RemoteException - a network error occurred
create
public void create(Identifier id,
SearchCriteria sc,
java.lang.String nom)
throws FindException,
PersistenceException,
java.rmi.RemoteException
- Works like the other version of
create()
, but the
query is saved to the data store. This method is fully transactional,
meaning that it starts and ends a transaction.
- Specified by:
- create in interface Query
- Parameters:
id
- the client identifier to use both for the query and to
save the resultssc
- the search criteria to use for the searchnom
- the name to give the query- Throws:
- FindException - an error occurred performing
the query
- PersistenceException - an error occurred
saving the query
- java.rmi.RemoteException - a network error occurred
generateResults
public void generateResults(Identifier id)
throws FindException,
PersistenceException,
java.rmi.RemoteException
- Generates a new set of results based on this query's search criteria.
You can then call
lastResults
to iterate through the
newly generated results. This method is fully transactional, meaning
that it starts and ends a transaction.
- Specified by:
- generateResults in interface Query
- Parameters:
id
- the client identifier to use for the transaction- Throws:
- FindException - an error occurred performing
the query
- PersistenceException - an error occurred
saving the query
- java.rmi.RemoteException - a network error occurred
getCriteria
public SearchCriteria getCriteria()
- Provides the criteria on which this search is based.
- Specified by:
- getCriteria in interface Query
- Returns:
- the search criteria
getName
public java.lang.String getName()
- Provides the name associated with this query.
- Specified by:
- getName in interface Query
- Returns:
- the query name
getUser
public java.lang.String getUser()
- Provides the user ID of the person who owns this query.
- Specified by:
- getUser in interface Query
- Returns:
- the user ID of the query owner
- Throws:
- java.rmi.RemoteException - a network error occurred
lastResults
public com.sun.java.util.collections.Iterator lastResults()
- Provides a list of the most recently generated results.
- Specified by:
- lastResults in interface Query
- Returns:
- the list of products matching the search criteria
- Throws:
- java.rmi.RemoteException - a network error occurred
load
protected void load(Memento mem)
throws LoadException
- Loads this query's state from the specified memento.
- Parameters:
mem
- the memento containing the query state- Throws:
- LoadException - an error occurred loading
the data from the memento
- Overrides:
- load in class BaseEntity
store
protected void store(Memento mem)
throws StoreException
- Stores the current state of the query into the specified memento.
- Parameters:
mem
- the memento into which the query state should be stored- Throws:
- StoreException - an error occurred storing
the state
- Overrides:
- store in class BaseEntity