001: /**
002: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
003: *
004: * This program is free software; you can redistribute it and/or modify
005: * it under the terms of the latest version of the GNU Lesser General
006: * Public License as published by the Free Software Foundation;
007: *
008: * This program is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
011: * GNU Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public License
014: * along with this program (LICENSE.txt); if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
016: */package org.jamwiki.db;
017:
018: import java.sql.Connection;
019: import org.jamwiki.model.Category;
020: import org.jamwiki.model.RecentChange;
021: import org.jamwiki.model.Role;
022: import org.jamwiki.model.Topic;
023: import org.jamwiki.model.TopicVersion;
024: import org.jamwiki.model.VirtualWiki;
025: import org.jamwiki.model.WikiFile;
026: import org.jamwiki.model.WikiFileVersion;
027: import org.jamwiki.model.WikiGroup;
028: import org.jamwiki.model.WikiUser;
029: import org.jamwiki.model.WikiUserInfo;
030: import org.jamwiki.utils.Pagination;
031:
032: /**
033: * This interface provides all methods needed for retrieving, inserting, or updating
034: * data from the database.
035: */
036: public interface QueryHandler {
037:
038: /**
039: * Returns the simplest possible query that can be used to validate
040: * whether or not a database connection is valid. Note that the query
041: * returned MUST NOT query any JAMWiki tables since it will be used prior
042: * to setting up the JAMWiki tables.
043: *
044: * @return Returns a simple query that can be used to validate a database
045: * connection.
046: */
047: String connectionValidationQuery();
048:
049: /**
050: * Method called to set up all JAMWiki system tables, indexes, and other
051: * required database objects. If a failure occurs during object creation
052: * then this method will not attempt to clean up any objects that were
053: * created prior to the failure.
054: *
055: * @param conn A database connection to use when connecting to the database
056: * from this method.
057: * @throws Exception Thrown if any error occurs during method execution.
058: */
059: void createTables(Connection conn) throws Exception;
060:
061: /**
062: * Delete all records from the recent changes table for a specific topic.
063: *
064: * @param topicId The topic id for which recent changes are being deleted.
065: * @param conn A database connection to use when connecting to the database
066: * from this method.
067: * @throws Exception Thrown if any error occurs during method execution.
068: */
069: void deleteRecentChanges(int topicId, Connection conn)
070: throws Exception;
071:
072: /**
073: * Delete all role records for a specific group.
074: *
075: * @param groupId The group id for which role records are being deleted.
076: * @param conn A database connection to use when connecting to the database
077: * from this method.
078: * @throws Exception Thrown if any error occurs during method execution.
079: */
080: void deleteRoleMapGroup(int groupId, Connection conn)
081: throws Exception;
082:
083: /**
084: * Delete all role records for a specific user.
085: *
086: * @param userId The user id for which role records are being deleted.
087: * @param conn A database connection to use when connecting to the database
088: * from this method.
089: * @throws Exception Thrown if any error occurs during method execution.
090: */
091: void deleteRoleMapUser(int userId, Connection conn)
092: throws Exception;
093:
094: /**
095: * Delete all categories associated with a topic.
096: *
097: * @param topicId The topic for which category association records are being
098: * deleted.
099: * @param conn A database connection to use when connecting to the database
100: * from this method.
101: * @throws Exception Thrown if any error occurs during method execution.
102: */
103: void deleteTopicCategories(int topicId, Connection conn)
104: throws Exception;
105:
106: /**
107: * Delete a user's watchlist entry using the topic name to determine which
108: * entry to remove.
109: *
110: * @param virtualWikiId The id of the virtual wiki for which the watchlist
111: * entry is being deleted.
112: * @param topicName The topic name for which the watchlist entry is being
113: * deleted.
114: * @param userId The user for which the watchlist entry is being deleted.
115: * @param conn A database connection to use when connecting to the database
116: * from this method.
117: * @throws Exception Thrown if any error occurs during method execution.
118: */
119: void deleteWatchlistEntry(int virtualWikiId, String topicName,
120: int userId, Connection conn) throws Exception;
121:
122: /**
123: * Drop all JAMWiki database objects. This method drops tables, indexes, and
124: * any database objects, as well as all data in those objects. Note that if
125: * a failure occurs while deleting any one object the method will continue
126: * trying to delete any remaining objects.
127: *
128: * @param conn A database connection to use when connecting to the database
129: * from this method.
130: */
131: void dropTables(Connection conn);
132:
133: /**
134: * Return a simple query, that if successfully run indicates that JAMWiki
135: * tables have been initialized in the database.
136: *
137: * @return Returns a simple query that, if successfully run, indicates
138: * that JAMWiki tables have been set up in the database.
139: */
140: String existenceValidationQuery();
141:
142: /**
143: * Retrieve a WikiResultSet containing all topic names that exist for a
144: * virtual wiki. This method will not return the names of previously
145: * deleted topics.
146: *
147: * @param virtualWikiId The id of the virtual wiki for which topic names
148: * are being retrieved.
149: * @return A WikiResultSet containing the names of all topics for the virtual
150: * wiki, not including any previously deleted topics.
151: * @throws Exception Thrown if any error occurs during method execution.
152: */
153: WikiResultSet getAllTopicNames(int virtualWikiId) throws Exception;
154:
155: /**
156: * Retrieve a WikiResultSet consisting of all wiki file version information for
157: * a given wiki file. Version information is sorted by wiki file version id, which
158: * in effect sorts the wiki file versions from newest to oldest.
159: *
160: * @param wikiFile A WikiFile object for which version information is to be retrieved.
161: * @param descending If <code>true</code> then results are sorted newest to
162: * oldest.
163: * @return A WikiResultSet containing wiki file version information for all
164: * versions of the specified wiki file.
165: * @throws Exception Thrown if any error occurs during method execution.
166: */
167: WikiResultSet getAllWikiFileVersions(WikiFile wikiFile,
168: boolean descending) throws Exception;
169:
170: /**
171: * Retrieve a WikiResultSet containing all categories associated with a particular
172: * virtual wiki. The result set may be limited by specifying the number of results
173: * to retrieve in a Pagination object.
174: *
175: * @param virtualWikiId The virtual wiki id for the virtual wiki from which all
176: * categories are to be retrieved.
177: * @param pagination A Pagination object that specifies the number of results
178: * and starting result offset for the result set to be retrieved.
179: * @return A WikiResultSet containing all categories associated with a particular
180: * virtual wiki.
181: * @throws Exception Thrown if any error occurs during method execution.
182: */
183: WikiResultSet getCategories(int virtualWikiId, Pagination pagination)
184: throws Exception;
185:
186: /**
187: * Retrieve a WikiResultSet containing all recent changes made to the wiki for a
188: * specific virtual wiki.
189: *
190: * @param virtualWiki The name of the virtual wiki for which changes are being
191: * retrieved.
192: * @param pagination A Pagination object that specifies the number of results
193: * and starting result offset for the result set to be retrieved.
194: * @param descending If <code>true</code> then results are sorted newest to
195: * oldest.
196: * @return A WikiResultSet containing all recent changes for a particular virtual
197: * wiki.
198: * @throws Exception Thrown if any error occurs during method execution.
199: */
200: WikiResultSet getRecentChanges(String virtualWiki,
201: Pagination pagination, boolean descending) throws Exception;
202:
203: /**
204: * Retrieve a WikiResultSet containing all recent changes made to the wiki for a
205: * specific topic.
206: *
207: * @param topicId The id of the topic for which recent changes are being
208: * retrieved.
209: * @param pagination A Pagination object that specifies the number of results
210: * and starting result offset for the result set to be retrieved.
211: * @param descending If <code>true</code> then results are sorted newest to
212: * oldest.
213: * @return A WikiResultSet containing all recent changes for a particular virtual
214: * wiki.
215: * @throws Exception Thrown if any error occurs during method execution.
216: */
217: WikiResultSet getRecentChanges(int topicId, Pagination pagination,
218: boolean descending) throws Exception;
219:
220: /**
221: * Retrieve a WikiResultSet of user ids, group ids and role names for all
222: * users whose login contains the given login fragment.
223: *
224: * @param loginFragment A value that must be contained with the user's
225: * login. This method will return partial matches, so "name" will
226: * match "name", "firstname" and "namesake".
227: * @return A WikiResultSet of user ids, group ids and role names for all
228: * users whose login contains the login fragment. If no matches are
229: * found then this method returns an empty WikiResultSet.
230: * @throws Exception Thrown if any error occurs during method execution.
231: */
232: WikiResultSet getRoleMapByLogin(String loginFragment)
233: throws Exception;
234:
235: /**
236: * Retrieve a WikiResultSet of user ids, group ids and role names for
237: * all users and groups who have been assigned the specified role.
238: *
239: * @param roleName The name of the role being queried against.
240: * @return A WikiResultSet of user ids, group ids and role names for all
241: * users and groups who have been assigned the specified role, or an
242: * empty WikiResultSet if no matches are found.
243: * @throws Exception Thrown if any error occurs during method execution.
244: */
245: WikiResultSet getRoleMapByRole(String roleName) throws Exception;
246:
247: /**
248: * Retrieve a WikiResultSet containing all roles assigned to a given group.
249: *
250: * @param groupName The name of the group for whom roles are being retrieved.
251: * @return A WikiResultSet of role names for the given user, or an empty
252: * WikiResultSet if no roles are assigned to the user.
253: * @throws Exception Thrown if any error occurs during method execution.
254: */
255: WikiResultSet getRoleMapGroup(String groupName) throws Exception;
256:
257: /**
258: * Retrieve a WikiResultSet of user ids, group ids and role names for
259: * all groups that have been assigned a role.
260: *
261: * @return A WikiResultSet of user ids, group ids and role names for all
262: * groups that have been assigned a role. If no matches are found then
263: * this method returns an empty WikiResultSet.
264: * @throws Exception Thrown if any error occurs during method execution.
265: */
266: WikiResultSet getRoleMapGroups() throws Exception;
267:
268: /**
269: * Retrieve a WikiResultSet containing all roles assigned to a given user.
270: *
271: * @param login The login of the user for whom roles are being retrieved.
272: * @return A WikiResultSet of role names for the given user, or an empty
273: * WikiResultSet if no roles are assigned to the user.
274: * @throws Exception Thrown if any error occurs during method execution.
275: */
276: WikiResultSet getRoleMapUser(String login) throws Exception;
277:
278: /**
279: * Retrieve a WikiResultSet containing all roles that have been defined for
280: * the wiki.
281: *
282: * @return Returns a WikiResult set containing all roles that have been
283: * defined for the wiki.
284: * @throws Exception Thrown if any error occurs during method execution.
285: */
286: WikiResultSet getRoles() throws Exception;
287:
288: /**
289: * Retrieve a WikiResultSet containing the topic names of all admin-only
290: * topics for the virtual wiki.
291: *
292: * @param virtualWikiId The id of the virtual wiki for which topic names
293: * are being retrieved.
294: * @param pagination A Pagination object that specifies the number of results
295: * and starting result offset for the result set to be retrieved.
296: * @return A WikiResultSet containing the topic names of all admin-only
297: * topics for the virtual wiki.
298: * @throws Exception Thrown if any error occurs during method execution.
299: */
300: WikiResultSet getTopicsAdmin(int virtualWikiId,
301: Pagination pagination) throws Exception;
302:
303: /**
304: * Retrieve a WikiResultSet containing all recent changes made to the wiki by a
305: * specific user.
306: *
307: * @param virtualWiki The name of the virtual wiki for which user contributions
308: * are being retrieved.
309: * @param userString The login of the user for whom changes are being retrieved; or
310: * for anonymous users, the IP address of the user.
311: * @param pagination A Pagination object that specifies the number of results
312: * and starting result offset for the result set to be retrieved.
313: * @param descending If <code>true</code> then results are sorted newest to
314: * oldest.
315: * @return A WikiResultSet containing all recent changes made by a particular user.
316: * @throws Exception Thrown if any error occurs during method execution.
317: */
318: WikiResultSet getUserContributions(String virtualWiki,
319: String userString, Pagination pagination, boolean descending)
320: throws Exception;
321:
322: /**
323: * Retrieve a WikiResultSet containing all virtual wiki information for all
324: * virtual wikis.
325: *
326: * @param conn A database connection to use when connecting to the database
327: * from this method.
328: * @return Returns a WikiResult set containing all virtual wiki information
329: * for every virtual wiki.
330: * @throws Exception Thrown if any error occurs during method execution.
331: */
332: WikiResultSet getVirtualWikis(Connection conn) throws Exception;
333:
334: /**
335: * Retrieve a WikiResultSet containing the topic ID and topic name for
336: * topics in the user's watchlist.
337: *
338: * @param virtualWikiId The virtual wiki ID for the virtual wiki for the
339: * watchlist topics.
340: * @param userId The user ID for the user retrieving the watchlist.
341: * @return A WikiResultSet containing topic ID and topic name for all
342: * watchlist items.
343: * @throws Exception Thrown if any error occurs during method execution.
344: */
345: WikiResultSet getWatchlist(int virtualWikiId, int userId)
346: throws Exception;
347:
348: /**
349: * Retrieve a WikiResultSet containing all recent changes for topics in the
350: * user's watchlist.
351: *
352: * @param virtualWikiId The virtual wiki ID for the virtual wiki for the
353: * watchlist topics.
354: * @param userId The user ID for the user retrieving the watchlist.
355: * @param pagination A Pagination object that specifies the number of results
356: * and starting result offset for the result set to be retrieved.
357: * @return A WikiResultSet containing recent changes for the watchlist.
358: * @throws Exception Thrown if any error occurs during method execution.
359: */
360: WikiResultSet getWatchlist(int virtualWikiId, int userId,
361: Pagination pagination) throws Exception;
362:
363: /**
364: * Add a new category record to the database. Note that this method will fail
365: * if an existing category of the same name is already associated with the
366: * topic.
367: *
368: * @param category The category record that is being created.
369: * @param virtualWikiId The virtual wiki id for the record that is being added.
370: * @param conn A database connection to use when connecting to the database
371: * from this method.
372: * @throws Exception Thrown if any error occurs during method execution.
373: */
374: void insertCategory(Category category, int virtualWikiId,
375: Connection conn) throws Exception;
376:
377: /**
378: * Add a new recent change record to the database.
379: *
380: * @param change The RecentChange record that is to be added to the database.
381: * @param virtualWikiId The virtual wiki id for the record that is being added.
382: * @param conn A database connection to use when connecting to the database
383: * from this method.
384: * @throws Exception Thrown if any error occurs during method execution.
385: */
386: void insertRecentChange(RecentChange change, int virtualWikiId,
387: Connection conn) throws Exception;
388:
389: /**
390: * Add a new role record to the database. The role must not already exist
391: * in the database or else an error will be thrown.
392: *
393: * @param role The Role record that is to be added to the database.
394: * @param conn A database connection to use when connecting to the database
395: * from this method.
396: * @throws Exception Thrown if any error occurs during method execution.
397: */
398: void insertRole(Role role, Connection conn) throws Exception;
399:
400: /**
401: * Add a new role mapping for a specific user or group. The role
402: * mapping must not already exist in the database or else an error will
403: * be thrown.
404: *
405: * @param userId The user id for the user being assigned a role, or -1 if
406: * a group is being assigned a role.
407: * @param groupId The group id for the group being assigned a role, or -1
408: * if a user is being assigned a role.
409: * @param role The role name for the role being assigned.
410: * @param conn A database connection to use when connecting to the database
411: * from this method.
412: * @throws Exception Thrown if any error occurs during method execution.
413: */
414: void insertRoleMap(int userId, int groupId, String role,
415: Connection conn) throws Exception;
416:
417: /**
418: * Add a new topic record to the database. The topic must not already exist
419: * in the database or else an error will be thrown.
420: *
421: * @param topic The Topic record that is to be added to the database.
422: * @param virtualWikiId The virtual wiki id for the record that is being added.
423: * @param conn A database connection to use when connecting to the database
424: * from this method.
425: * @throws Exception Thrown if any error occurs during method execution.
426: */
427: void insertTopic(Topic topic, int virtualWikiId, Connection conn)
428: throws Exception;
429:
430: /**
431: * Add a new topic version record to the database. The topic version must
432: * not already exist in the database or else an error will be thrown.
433: *
434: * @param topicVersion The TopicVersion record that is to be added to the database.
435: * @param conn A database connection to use when connecting to the database
436: * from this method.
437: * @throws Exception Thrown if any error occurs during method execution.
438: */
439: void insertTopicVersion(TopicVersion topicVersion, Connection conn)
440: throws Exception;
441:
442: /**
443: * Add a new virtual wiki record to the database. The virtual wiki must
444: * not already exist in the database or else an error will be thrown.
445: *
446: * @param virtualWiki The VirtualWiki record that is to be added to the database.
447: * @param conn A database connection to use when connecting to the database
448: * from this method.
449: * @throws Exception Thrown if any error occurs during method execution.
450: */
451: void insertVirtualWiki(VirtualWiki virtualWiki, Connection conn)
452: throws Exception;
453:
454: /**
455: * Add a new watchlist entry record to the database. An identical entry
456: * must not already exist or else an exception will be thrown.
457: *
458: * @param virtualWikiId The virtual wiki id for the watchlist entry being
459: * inserted.
460: * @param topicName The name of the topic for the watchlist entry. This
461: * value should be set only for topics that do not yet exist, and should
462: * be set to <code>null</code> for existing topics.
463: * @param userId The ID of the user for the watchlist entry.
464: * @param conn A database connection to use when connecting to the database
465: * from this method.
466: * @throws Exception Thrown if any error occurs during method execution.
467: */
468: void insertWatchlistEntry(int virtualWikiId, String topicName,
469: int userId, Connection conn) throws Exception;
470:
471: /**
472: * Add a new wiki file record to the database. The wiki file must not
473: * already exist in the database or else an error will be thrown.
474: *
475: * @param wikiFile The WikiFile record that is to be added to the database.
476: * @param virtualWikiId The virtual wiki id for the record that is being added.
477: * @param conn A database connection to use when connecting to the database
478: * from this method.
479: * @throws Exception Thrown if any error occurs during method execution.
480: */
481: void insertWikiFile(WikiFile wikiFile, int virtualWikiId,
482: Connection conn) throws Exception;
483:
484: /**
485: * Add a new wiki file version record to the database. The wiki file
486: * version must not already exist in the database or else an error will
487: * be thrown.
488: *
489: * @param wikiFileVersion The WikiFileVersion record that is to be added
490: * to the database.
491: * @param conn A database connection to use when connecting to the database
492: * from this method.
493: * @throws Exception Thrown if any error occurs during method execution.
494: */
495: void insertWikiFileVersion(WikiFileVersion wikiFileVersion,
496: Connection conn) throws Exception;
497:
498: /**
499: * Add a new group record to the database. The group must not already exist
500: * in the database or else an error will be thrown.
501: *
502: * @param group The WikiGroup record that is to be added to the database.
503: * @param conn A database connection to use when connecting to the database
504: * from this method.
505: * @throws Exception Thrown if any error occurs during method execution.
506: */
507: void insertWikiGroup(WikiGroup group, Connection conn)
508: throws Exception;
509:
510: /**
511: * Add a new user record to the database. The user must not already exist
512: * in the database or else an error will be thrown.
513: *
514: * @param user The WikiUser record that is to be added to the database.
515: * @param conn A database connection to use when connecting to the database
516: * from this method.
517: * @throws Exception Thrown if any error occurs during method execution.
518: */
519: void insertWikiUser(WikiUser user, Connection conn)
520: throws Exception;
521:
522: /**
523: * Add a new user information record to the database. The user information
524: * must not already exist in the database or else an error will be thrown.
525: *
526: * @param userInfo The WikiUserInfo record that is to be added to the
527: * database.
528: * @param conn A database connection to use when connecting to the database
529: * from this method.
530: * @throws Exception Thrown if any error occurs during method execution.
531: */
532: void insertWikiUserInfo(WikiUserInfo userInfo, Connection conn)
533: throws Exception;
534:
535: /**
536: * Retrieve a result set containing the topic name and sort key for all
537: * topics associated with a category.
538: *
539: * @param virtualWikiId The virtual wiki id for the virtual wiki of the topics
540: * being retrieved.
541: * @param categoryName The name of the category for which associated topics
542: * are to be retrieved.
543: * @return A WikiResultSet containing topic name and sort key for all topics
544: * associated with a specific category.
545: * @throws Exception Thrown if any error occurs during method execution.
546: */
547: WikiResultSet lookupCategoryTopics(int virtualWikiId,
548: String categoryName) throws Exception;
549:
550: /**
551: * Retrieve a WikiResultSet containing all topic information for a given topic.
552: *
553: * @param virtualWikiId The virtual wiki id for the virtual wiki of the topic
554: * being retrieved.
555: * @param topicName The name of the topic being retrieved.
556: * @param caseSensitive Set to <code>true</code> if the topic name should be
557: * searched for in a case-sensitive manner.
558: * @param conn A database connection to use when connecting to the database
559: * from this method.
560: * @return A WikiResultSet containing all topic information for the given topic
561: * name and virtual wiki. If no matching topic is found an empty result set is
562: * returned.
563: * @throws Exception Thrown if any error occurs during method execution.
564: */
565: WikiResultSet lookupTopic(int virtualWikiId, String topicName,
566: boolean caseSensitive, Connection conn) throws Exception;
567:
568: /**
569: * Retrieve a result set of all topics of a given type within a virtual wiki.
570: *
571: * @param virtualWikiId The virtual wiki id for the virtual wiki of the topics
572: * being retrieved.
573: * @param topicType The topic type (image, normal, etc) for the topics to be
574: * retrieved.
575: * @param pagination A Pagination object that specifies the number of results
576: * and starting result offset for the result set to be retrieved.
577: * @return A WikiResult set of all non-deleted topics for the given virtual wiki
578: * of the specified topic type, and within the bounds specified by the pagination
579: * object.
580: * @throws Exception Thrown if any error occurs during method execution.
581: */
582: WikiResultSet lookupTopicByType(int virtualWikiId, int topicType,
583: Pagination pagination) throws Exception;
584:
585: /**
586: * Return a count of all topics, including redirects, comments pages and templates,
587: * currently available on the Wiki. This method excludes deleted topics.
588: *
589: * @param virtualWikiId The virtual wiki id for the virtual wiki of the topics
590: * being retrieved.
591: */
592: WikiResultSet lookupTopicCount(int virtualWikiId) throws Exception;
593:
594: /**
595: * Retrieve a result set containing a specific topic version.
596: *
597: * @param topicVersionId The id for the topic version record being retrieved.
598: * @param conn A database connection to use when connecting to the database
599: * from this method.
600: * @return A WikiResultSet containing the topic version record, or an empty
601: * result set if no matching record is found.
602: * @throws Exception Thrown if any error occurs during method execution.
603: */
604: WikiResultSet lookupTopicVersion(int topicVersionId, Connection conn)
605: throws Exception;
606:
607: /**
608: * Retrieve a result set containing all wiki file information for a given WikiFile.
609: *
610: * @param virtualWikiId The virtual wiki id for the virtual wiki of the wiki file
611: * being retrieved.
612: * @param topicId The id of the parent topic for the wiki file being retrieved.
613: * @return A WikiResultSet containing all wiki file information for the given topic
614: * id and virtual wiki. If no matching wiki file is found an empty result set is
615: * returned.
616: * @throws Exception Thrown if any error occurs during method execution.
617: */
618: WikiResultSet lookupWikiFile(int virtualWikiId, int topicId)
619: throws Exception;
620:
621: /**
622: * Return a count of all wiki files currently available on the Wiki. This
623: * method excludes deleted files.
624: *
625: * @param virtualWikiId The virtual wiki id for the virtual wiki of the files
626: * being retrieved.
627: */
628: WikiResultSet lookupWikiFileCount(int virtualWikiId)
629: throws Exception;
630:
631: /**
632: * Retrieve a result set containing all user information for a given WikiUser.
633: *
634: * @param userId The id of the user record being retrieved.
635: * @param conn A database connection to use when connecting to the database
636: * from this method.
637: * @return A WikiResultSet containing all information for the given user, or
638: * an empty result set if no matching user exists.
639: * @throws Exception Thrown if any error occurs during method execution.
640: */
641: WikiResultSet lookupWikiUser(int userId, Connection conn)
642: throws Exception;
643:
644: /**
645: * Retrieve a result set containing all user information for a given WikiUser.
646: *
647: * @param login The login of the user record being retrieved.
648: * @param conn A database connection to use when connecting to the database
649: * from this method.
650: * @return A WikiResultSet containing all information for the given user, or
651: * an empty result set if no matching user exists.
652: * @throws Exception Thrown if any error occurs during method execution.
653: */
654: WikiResultSet lookupWikiUser(String login, Connection conn)
655: throws Exception;
656:
657: /**
658: * Retrieve a result set containing all user information for a given WikiUser.
659: *
660: * @param login The login of the user record being retrieved.
661: * @param encryptedPassword The encrypted password for the user record being
662: * retrieved.
663: * @param conn A database connection to use when connecting to the database
664: * from this method.
665: * @return A WikiResultSet containing all information for the given user, or
666: * an empty result set if no matching user exists.
667: * @throws Exception Thrown if any error occurs during method execution.
668: */
669: WikiResultSet lookupWikiUser(String login,
670: String encryptedPassword, Connection conn) throws Exception;
671:
672: /**
673: * Return a count of all wiki users.
674: */
675: WikiResultSet lookupWikiUserCount() throws Exception;
676:
677: /**
678: * Retrieve a result set containing all user information for a given
679: * WikiUserInfo.
680: *
681: * @param login The login of the user record being retrieved.
682: * @return A WikiResultSet containing all information for the given user, or
683: * an empty result set if no matching user exists.
684: * @throws Exception Thrown if any error occurs during method execution.
685: */
686: WikiResultSet lookupWikiUserInfo(String login) throws Exception;
687:
688: /**
689: * Retrieve a result set of all logins for every wiki user.
690: *
691: * @param pagination A Pagination object that specifies the number of results
692: * and starting result offset for the result set to be retrieved.
693: * @return A WikiResult set of all logins for all wiki users, within the
694: * bounds specified by the pagination object.
695: * @throws Exception Thrown if any error occurs during method execution.
696: */
697: WikiResultSet lookupWikiUsers(Pagination pagination)
698: throws Exception;
699:
700: /**
701: * Retrieve the next available topic id from the topic table.
702: *
703: * @param conn A database connection to use when connecting to the database
704: * from this method.
705: * @return The next available topic id from the topic table.
706: * @throws Exception Thrown if any error occurs during method execution.
707: */
708: int nextTopicId(Connection conn) throws Exception;
709:
710: /**
711: * Retrieve the next available topic version id from the topic version table.
712: *
713: * @param conn A database connection to use when connecting to the database
714: * from this method.
715: * @return The next available topic version id from the topic version table.
716: * @throws Exception Thrown if any error occurs during method execution.
717: */
718: int nextTopicVersionId(Connection conn) throws Exception;
719:
720: /**
721: * Retrieve the next available virtual wiki id from the virtual wiki table.
722: *
723: * @param conn A database connection to use when connecting to the database
724: * from this method.
725: * @return The next available virtual wiki id from the virtual wiki table.
726: * @throws Exception Thrown if any error occurs during method execution.
727: */
728: int nextVirtualWikiId(Connection conn) throws Exception;
729:
730: /**
731: * Retrieve the next available wiki file id from the wiki file table.
732: *
733: * @param conn A database connection to use when connecting to the database
734: * from this method.
735: * @return The next available wiki file id from the wiki file table.
736: * @throws Exception Thrown if any error occurs during method execution.
737: */
738: int nextWikiFileId(Connection conn) throws Exception;
739:
740: /**
741: * Retrieve the next available wiki file version id from the wiki file
742: * version table.
743: *
744: * @param conn A database connection to use when connecting to the database
745: * from this method.
746: * @return The next available wiki file version id from the wiki file
747: * version table.
748: * @throws Exception Thrown if any error occurs during method execution.
749: */
750: int nextWikiFileVersionId(Connection conn) throws Exception;
751:
752: /**
753: * Retrieve the next available wiki group id from the wiki group table.
754: *
755: * @param conn A database connection to use when connecting to the database
756: * from this method.
757: * @return The next available wiki group id from the wiki group table.
758: * @throws Exception Thrown if any error occurs during method execution.
759: */
760: int nextWikiGroupId(Connection conn) throws Exception;
761:
762: /**
763: * Retrieve the next available wiki user id from the wiki user table.
764: *
765: * @param conn A database connection to use when connecting to the database
766: * from this method.
767: * @return The next available wiki user id from the wiki user table.
768: * @throws Exception Thrown if any error occurs during method execution.
769: */
770: int nextWikiUserId(Connection conn) throws Exception;
771:
772: /**
773: * Refresh the recent changes content by reloading the recent changes table.
774: *
775: * @param conn A database connection to use when connecting to the database
776: * from this method.
777: * @throws Exception Thrown if any error occurs during method execution.
778: */
779: void reloadRecentChanges(Connection conn) throws Exception;
780:
781: /**
782: * Update a role record in the database.
783: *
784: * @param role The Role record that is to be updated in the database.
785: * @param conn A database connection to use when connecting to the database
786: * from this method.
787: * @throws Exception Thrown if any error occurs during method execution.
788: */
789: void updateRole(Role role, Connection conn) throws Exception;
790:
791: /**
792: * Update a topic record in the database.
793: *
794: * @param topic The Topic record that is to be updated in the database.
795: * @param virtualWikiId The virtual wiki id for the record that is being updated.
796: * @param conn A database connection to use when connecting to the database
797: * from this method.
798: * @throws Exception Thrown if any error occurs during method execution.
799: */
800: void updateTopic(Topic topic, int virtualWikiId, Connection conn)
801: throws Exception;
802:
803: /**
804: * Update a virtual wiki record in the database.
805: *
806: * @param virtualWiki The VirtualWiki record that is to be updated in the database.
807: * @param conn A database connection to use when connecting to the database
808: * from this method.
809: * @throws Exception Thrown if any error occurs during method execution.
810: */
811: void updateVirtualWiki(VirtualWiki virtualWiki, Connection conn)
812: throws Exception;
813:
814: /**
815: * Update a wiki file record in the database.
816: *
817: * @param wikiFile The WikiFile record that is to be updated in the database.
818: * @param virtualWikiId The virtual wiki id for the record that is being updated.
819: * @param conn A database connection to use when connecting to the database
820: * from this method.
821: * @throws Exception Thrown if any error occurs during method execution.
822: */
823: void updateWikiFile(WikiFile wikiFile, int virtualWikiId,
824: Connection conn) throws Exception;
825:
826: /**
827: * Update a group record in the database.
828: *
829: * @param group The WikiGroup record that is to be updated in the database.
830: * @param conn A database connection to use when connecting to the database
831: * from this method.
832: * @throws Exception Thrown if any error occurs during method execution.
833: */
834: void updateWikiGroup(WikiGroup group, Connection conn)
835: throws Exception;
836:
837: /**
838: * Update a wiki user record in the database.
839: *
840: * @param user The WikiUser record that is to be updated in the database.
841: * @param conn A database connection to use when connecting to the database
842: * from this method.
843: * @throws Exception Thrown if any error occurs during method execution.
844: */
845: void updateWikiUser(WikiUser user, Connection conn)
846: throws Exception;
847:
848: /**
849: * Update a wiki user information record in the database.
850: *
851: * @param userInfo The WikiUserInfo record that is to be updated in the
852: * database.
853: * @param conn A database connection to use when connecting to the database
854: * from this method.
855: * @throws Exception Thrown if any error occurs during method execution.
856: */
857: void updateWikiUserInfo(WikiUserInfo userInfo, Connection conn)
858: throws Exception;
859: }
|