View Javadoc

1   package org.sourceforge.vlibrary;
2   
3   /**
4    * Constants used in the Virtual Library application
5    * @version $Revision$ $Date$
6    */
7   public class Constants {
8   
9       // Forwards
10      public static final String SUCCESS = "success";
11      public static final String CANCEL = "cancel";
12      public static final String ERROR = "error";
13      public static final String MENU = "menu";
14  
15      // Actions
16      public static final String CHECKIN = "checkin";
17      public static final String CHECKOUT = "checkout";
18  
19      // Request Keys
20      public static final String ERRORS = "processingErrors";
21      public static final String BOOK = "book";
22      public static final String SEARCH_RESULTS = "searchResults";
23      public static final String POSSESSOR = "possessor";
24      public static final String TRANSACTIONS = "transactions";
25      public static final String USER_MESSAGE = "userMessage";
26      public static final String TRANS = "trans";
27      public static final String LOCATIONS = "locations";
28  
29      // Request Parameters
30      public static final String ACTION = "action";
31      public static final String ID = "id";
32      public static final String REQUEST = "request";
33      public static final String PWD = "pwd";
34      public static final String UID = "uid";
35      public static final String ISBN = "isbn";
36  
37      // Context keys
38      public static final String APPLICATION_RESOURCES = "ApplicationResources";
39  
40      // Search query types
41      public static final String AND = "And";
42      public static final String OR = "Or";
43  
44      // Search selectors
45      public static final String NONE = "None";
46      public static final String TITLE = "Title";
47      public static final String SUBJECT = "Subject";
48      public static final String AUTHOR = "Author";
49      public static final String MINE = "Mine";
50  
51      // Action parameters
52      public static final String CREATE = "Create";
53      public static final String UPDATE = "Update";
54      public static final String DELETE = "Delete";
55      public static final String PREFILLBOOKDETAILS= "PrefillBookDetails";
56  
57      // User roles
58      public static final String ADMINISTRATOR = "administrator";
59  
60      // Character constants
61      public static final String APOSTROPHE = "'";
62      public static final String ESCAPED_APOSTROPHE = "''";
63  
64      // Path prefixes
65      public static final String SECURE_PATH = "/a/";
66      public static final String ADMIN_PATH = "/r/";
67  
68  
69      // Book prefill keys
70      public static final String BOOKTITLE="TITLE";
71      public static final String BOOKSUBJECTSLIST="SUBJECTSLIST";
72      public static final String BOOKAUTHOR="AUTHOR";
73      public static final String BOOKPUBLISHER="PUBLISHER";
74      public static final String BOOKDATE="DATE";
75  
76      /**************************************************************************
77       *                                                                        *
78       *   TRANSACTION CODES                                                    *
79       *                                                                        *
80       *   ACTION codes are written with book state change transactions to the *
81       *   database. The status and location of a book can be determined by     *
82       *   locating the last transaction associated with the book and examining *
83       *   its transaction code.  Newly added books have no associated          *
84       *   transactions in the database (i.e., there is no "add" transaction    *
85       *   generated), so methods that query transaction history return a       *
86       *   "dummy" transaction with code ADD_ACTION signaling this state.      *
87       *                                                                        *
88       *************************************************************************/
89  
90      /**
91       * REQUEST_ACTION - codes a pending request
92       */
93      public static final long REQUEST_ACTION = 0;
94  
95      /**
96       * CHECKOUT_ACTION - codes a checkout event
97       */
98      public static final long CHECKOUT_ACTION = 1;
99  
100     /**
101      * CHECKIN_ACTION - codes a checkin event
102      */
103     public static final long CHECKIN_ACTION = 2;
104 
105     /**
106      * ADD_ACTION - codes a new addition (inferred from no transactions in db)
107      */
108     public static final long ADD_ACTION = 3;
109 
110     /*************************************************************************/
111 
112     /**
113      * CHECKED_IN
114      *
115      * Value returned by <code>getPossessor</code> methods to represent the
116      * checked in state.  Has a value that is not a valid reader id, so can
117      * be used in tests on the result of <code>getPossessor</code> queries.
118      */
119     public static final long CHECKED_IN = -1;
120 
121     /**
122      * NO_TRANSACTIONS
123      *
124      * Value returned by <code>LibraryTransactionDAO.getPossesor()</code>
125      * to indicate that there have been no transactions for a book. In this
126      * state, the possessor should be the owner of the book.  Has a value
127      * that is not a valid reader id, so can be used in tests on the result
128      * of <code>getPossessor</code> queries.
129      */
130     public static final long NO_TRANSACTIONS = -2;
131     
132     /** Special negative value for books that have not yet been checked in so have no last location */
133     public static final long UNKNOWN_LOCATION = -5;
134 
135 }