|
SPT RWT Application API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.rwt.Queries
public class Queries
A serializable wrapper used to represent saved SQL queries for the application. This class will be serialised to the following file and initialised from the same file during application load:
<sptrwt.data.directory>/queries.xml
© Copyright 2007 Sans Pareil Technologies, Inc.
| Field Summary | |
|---|---|
private TreeMap<String,Category> |
categories
A map used to quickly look up Query instances by their
Category.name. |
static String |
DIRECTORY
The system property used to configure the location of the root directory under which persistent state information for the application is stored. |
static String |
ENCODING
The encoding to use to serialise and deserialise instances of this class. |
static String |
FILE_NAME
The name of the file to which this class will be serialised. |
private String |
fileName
The fully qualified file name to use to serialise this instance into. |
protected static XStream |
xstream
The XStream instance used to serialise
and deserialise instances of this class. |
| Constructor Summary | |
|---|---|
protected |
Queries()
Default constructor. |
| Method Summary | |
|---|---|
void |
add(String category,
Query query)
Add the specified query parameters value object to the application persistent state. |
void |
delete(String name)
Remove the specified category from persistent state. |
void |
delete(String category,
String name)
Remove the specified query parameters from the application persistent state. |
protected void |
deserialise(String user)
Deserialise the contents of FILE_NAME into this instance. |
Collection<Category> |
getCategories()
Returns the names of the categories under which queries have been saved. |
Category |
getCategory(String name)
Returns the category identified by the name specified. |
static Queries |
getInstance(String user)
Create a new instance of the class for the specified user. |
Query |
getQuery(String category,
String name)
Return a Query for the specified category and saved
with the specified unique name. |
protected void |
serialise()
Serialise this instance to the FILE_NAME. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String ENCODING
public static final String FILE_NAME
public static final String DIRECTORY
protected static final XStream xstream
XStream instance used to serialise
and deserialise instances of this class.
private final TreeMap<String,Category> categories
Query instances by their
Category.name.
private transient String fileName
| Constructor Detail |
|---|
protected Queries()
| Method Detail |
|---|
public static Queries getInstance(String user)
user
under DIRECTORY.
RuntimeException - If errors are encountered while deserialising
the persistent state of this instance.deserialise(java.lang.String)
public Query getQuery(String category,
String name)
Query for the specified category and saved
with the specified unique name.
category - The category under which the query is saved.name - The unique name used to identify the saved query.
null if no such mapping exists.
public void add(String category,
Query query)
category - The category to associate the query with.query - The query to be saved.serialise()
public void delete(String category,
String name)
category - The category under which the query was saved.name - The unique name to use to identify the saved query.serialise()public void delete(String name)
name - The name of the category to remove from saved state.serialise()
protected void deserialise(String user)
throws RuntimeException
FILE_NAME into this instance.
user - The name of the user to use to construct the full filename.
RuntimeException - If errors are encountered while deserialising
the persistent state. No exceptions are thrown if the file does
not exist.
protected void serialise()
throws RuntimeException
FILE_NAME.
RuntimeException - If errors are encountered while serialising
the instance.public Category getCategory(String name)
name - The name of the category.
null if no such category exists.public Collection<Category> getCategories()
|
SPT RWT Application API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||