0001: /**
0002: * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE, version 2.1, dated February 1999.
0003: *
0004: * This program is free software; you can redistribute it and/or modify
0005: * it under the terms of the latest version of the GNU Lesser General
0006: * Public License as published by the Free Software Foundation;
0007: *
0008: * This program is distributed in the hope that it will be useful,
0009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
0010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0011: * GNU Lesser General Public License for more details.
0012: *
0013: * You should have received a copy of the GNU Lesser General Public License
0014: * along with this program (LICENSE.txt); if not, write to the Free Software
0015: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
0016: */package org.jamwiki.db;
0017:
0018: import java.sql.Connection;
0019: import java.sql.Types;
0020: import java.util.Properties;
0021: import org.apache.commons.lang.StringUtils;
0022: import org.jamwiki.Environment;
0023: import org.jamwiki.WikiException;
0024: import org.jamwiki.WikiMessage;
0025: import org.jamwiki.model.Category;
0026: import org.jamwiki.model.RecentChange;
0027: import org.jamwiki.model.Role;
0028: import org.jamwiki.model.Topic;
0029: import org.jamwiki.model.TopicVersion;
0030: import org.jamwiki.model.VirtualWiki;
0031: import org.jamwiki.model.WikiFile;
0032: import org.jamwiki.model.WikiFileVersion;
0033: import org.jamwiki.model.WikiGroup;
0034: import org.jamwiki.model.WikiUser;
0035: import org.jamwiki.model.WikiUserInfo;
0036: import org.jamwiki.utils.Pagination;
0037: import org.jamwiki.utils.Utilities;
0038: import org.jamwiki.utils.WikiLogger;
0039:
0040: /**
0041: * Default implementation of the QueryHandler implementation for retrieving, inserting,
0042: * and updating data in the database. This method uses ANSI SQL and should therefore
0043: * work with any fully ANSI-compliant database.
0044: */
0045: public class AnsiQueryHandler implements QueryHandler {
0046:
0047: private static final WikiLogger logger = WikiLogger
0048: .getLogger(AnsiQueryHandler.class.getName());
0049: protected static final String SQL_PROPERTY_FILE_NAME = "sql.ansi.properties";
0050:
0051: protected static String STATEMENT_CONNECTION_VALIDATION_QUERY = null;
0052: protected static String STATEMENT_CREATE_GROUP_TABLE = null;
0053: protected static String STATEMENT_CREATE_ROLE_MAP_TABLE = null;
0054: protected static String STATEMENT_CREATE_ROLE_TABLE = null;
0055: protected static String STATEMENT_CREATE_VIRTUAL_WIKI_TABLE = null;
0056: protected static String STATEMENT_CREATE_WIKI_USER_TABLE = null;
0057: protected static String STATEMENT_CREATE_WIKI_USER_INFO_TABLE = null;
0058: protected static String STATEMENT_CREATE_WIKI_USER_LOGIN_INDEX = null;
0059: protected static String STATEMENT_CREATE_TOPIC_CURRENT_VERSION_CONSTRAINT = null;
0060: protected static String STATEMENT_CREATE_TOPIC_TABLE = null;
0061: protected static String STATEMENT_CREATE_TOPIC_VERSION_TABLE = null;
0062: protected static String STATEMENT_CREATE_WIKI_FILE_TABLE = null;
0063: protected static String STATEMENT_CREATE_WIKI_FILE_VERSION_TABLE = null;
0064: protected static String STATEMENT_CREATE_CATEGORY_TABLE = null;
0065: protected static String STATEMENT_CREATE_RECENT_CHANGE_TABLE = null;
0066: protected static String STATEMENT_CREATE_WATCHLIST_TABLE = null;
0067: protected static String STATEMENT_DELETE_RECENT_CHANGES = null;
0068: protected static String STATEMENT_DELETE_RECENT_CHANGES_TOPIC = null;
0069: protected static String STATEMENT_DELETE_ROLE_MAP_GROUP = null;
0070: protected static String STATEMENT_DELETE_ROLE_MAP_USER = null;
0071: protected static String STATEMENT_DELETE_TOPIC_CATEGORIES = null;
0072: protected static String STATEMENT_DELETE_WATCHLIST_ENTRY = null;
0073: protected static String STATEMENT_DROP_GROUP_TABLE = null;
0074: protected static String STATEMENT_DROP_ROLE_TABLE = null;
0075: protected static String STATEMENT_DROP_ROLE_MAP_TABLE = null;
0076: protected static String STATEMENT_DROP_VIRTUAL_WIKI_TABLE = null;
0077: protected static String STATEMENT_DROP_WIKI_USER_TABLE = null;
0078: protected static String STATEMENT_DROP_WIKI_USER_INFO_TABLE = null;
0079: protected static String STATEMENT_DROP_WIKI_USER_LOGIN_INDEX = null;
0080: protected static String STATEMENT_DROP_TOPIC_CURRENT_VERSION_CONSTRAINT = null;
0081: protected static String STATEMENT_DROP_TOPIC_TABLE = null;
0082: protected static String STATEMENT_DROP_TOPIC_VERSION_TABLE = null;
0083: protected static String STATEMENT_DROP_WIKI_FILE_TABLE = null;
0084: protected static String STATEMENT_DROP_WIKI_FILE_VERSION_TABLE = null;
0085: protected static String STATEMENT_DROP_CATEGORY_TABLE = null;
0086: protected static String STATEMENT_DROP_RECENT_CHANGE_TABLE = null;
0087: protected static String STATEMENT_DROP_WATCHLIST_TABLE = null;
0088: protected static String STATEMENT_INSERT_CATEGORY = null;
0089: protected static String STATEMENT_INSERT_GROUP = null;
0090: protected static String STATEMENT_INSERT_RECENT_CHANGE = null;
0091: protected static String STATEMENT_INSERT_RECENT_CHANGES = null;
0092: protected static String STATEMENT_INSERT_ROLE = null;
0093: protected static String STATEMENT_INSERT_ROLE_MAP = null;
0094: protected static String STATEMENT_INSERT_TOPIC = null;
0095: protected static String STATEMENT_INSERT_TOPIC_VERSION = null;
0096: protected static String STATEMENT_INSERT_VIRTUAL_WIKI = null;
0097: protected static String STATEMENT_INSERT_WATCHLIST_ENTRY = null;
0098: protected static String STATEMENT_INSERT_WIKI_FILE = null;
0099: protected static String STATEMENT_INSERT_WIKI_FILE_VERSION = null;
0100: protected static String STATEMENT_INSERT_WIKI_USER = null;
0101: protected static String STATEMENT_INSERT_WIKI_USER_INFO = null;
0102: protected static String STATEMENT_SELECT_CATEGORIES = null;
0103: protected static String STATEMENT_SELECT_CATEGORY_TOPICS = null;
0104: protected static String STATEMENT_SELECT_GROUP_SEQUENCE = null;
0105: protected static String STATEMENT_SELECT_RECENT_CHANGES = null;
0106: protected static String STATEMENT_SELECT_RECENT_CHANGES_TOPIC = null;
0107: protected static String STATEMENT_SELECT_ROLE_MAP_GROUP = null;
0108: protected static String STATEMENT_SELECT_ROLE_MAP_GROUPS = null;
0109: protected static String STATEMENT_SELECT_ROLE_MAP_LOGIN = null;
0110: protected static String STATEMENT_SELECT_ROLE_MAP_ROLE = null;
0111: protected static String STATEMENT_SELECT_ROLE_MAP_USER = null;
0112: protected static String STATEMENT_SELECT_ROLES = null;
0113: protected static String STATEMENT_SELECT_TOPIC_BY_TYPE = null;
0114: protected static String STATEMENT_SELECT_TOPIC_COUNT = null;
0115: protected static String STATEMENT_SELECT_TOPIC = null;
0116: protected static String STATEMENT_SELECT_TOPIC_LOWER = null;
0117: protected static String STATEMENT_SELECT_TOPICS = null;
0118: protected static String STATEMENT_SELECT_TOPICS_ADMIN = null;
0119: protected static String STATEMENT_SELECT_TOPIC_SEQUENCE = null;
0120: protected static String STATEMENT_SELECT_TOPIC_VERSION = null;
0121: protected static String STATEMENT_SELECT_TOPIC_VERSION_SEQUENCE = null;
0122: protected static String STATEMENT_SELECT_VIRTUAL_WIKIS = null;
0123: protected static String STATEMENT_SELECT_VIRTUAL_WIKI_SEQUENCE = null;
0124: protected static String STATEMENT_SELECT_WATCHLIST = null;
0125: protected static String STATEMENT_SELECT_WATCHLIST_CHANGES = null;
0126: protected static String STATEMENT_SELECT_WIKI_FILE = null;
0127: protected static String STATEMENT_SELECT_WIKI_FILE_COUNT = null;
0128: protected static String STATEMENT_SELECT_WIKI_FILE_SEQUENCE = null;
0129: protected static String STATEMENT_SELECT_WIKI_FILE_VERSION_SEQUENCE = null;
0130: protected static String STATEMENT_SELECT_WIKI_FILE_VERSIONS = null;
0131: protected static String STATEMENT_SELECT_WIKI_USER = null;
0132: protected static String STATEMENT_SELECT_WIKI_USER_CHANGES_ANONYMOUS = null;
0133: protected static String STATEMENT_SELECT_WIKI_USER_CHANGES_LOGIN = null;
0134: protected static String STATEMENT_SELECT_WIKI_USER_COUNT = null;
0135: protected static String STATEMENT_SELECT_WIKI_USER_INFO = null;
0136: protected static String STATEMENT_SELECT_WIKI_USER_LOGIN = null;
0137: protected static String STATEMENT_SELECT_WIKI_USER_PASSWORD = null;
0138: protected static String STATEMENT_SELECT_WIKI_USER_SEQUENCE = null;
0139: protected static String STATEMENT_SELECT_WIKI_USERS = null;
0140: protected static String STATEMENT_UPDATE_GROUP = null;
0141: protected static String STATEMENT_UPDATE_ROLE = null;
0142: protected static String STATEMENT_UPDATE_TOPIC = null;
0143: protected static String STATEMENT_UPDATE_TOPIC_CURRENT_VERSION = null;
0144: protected static String STATEMENT_UPDATE_TOPIC_CURRENT_VERSIONS = null;
0145: protected static String STATEMENT_UPDATE_VIRTUAL_WIKI = null;
0146: protected static String STATEMENT_UPDATE_WIKI_FILE = null;
0147: protected static String STATEMENT_UPDATE_WIKI_USER = null;
0148: protected static String STATEMENT_UPDATE_WIKI_USER_INFO = null;
0149: private static Properties props = null;
0150:
0151: /**
0152: *
0153: */
0154: protected AnsiQueryHandler() {
0155: props = Environment.loadProperties(SQL_PROPERTY_FILE_NAME);
0156: this .init(props);
0157: }
0158:
0159: /**
0160: *
0161: */
0162: private static void checkLength(String value, int maxLength)
0163: throws WikiException {
0164: if (value != null && value.length() > maxLength) {
0165: throw new WikiException(new WikiMessage(
0166: "error.fieldlength", value, new Integer(maxLength)
0167: .toString()));
0168: }
0169: }
0170:
0171: /**
0172: *
0173: */
0174: public String connectionValidationQuery() {
0175: return STATEMENT_CONNECTION_VALIDATION_QUERY;
0176: }
0177:
0178: /**
0179: *
0180: */
0181: public void createTables(Connection conn) throws Exception {
0182: DatabaseConnection.executeUpdate(
0183: STATEMENT_CREATE_VIRTUAL_WIKI_TABLE, conn);
0184: DatabaseConnection.executeUpdate(
0185: STATEMENT_CREATE_WIKI_USER_TABLE, conn);
0186: DatabaseConnection.executeUpdate(
0187: STATEMENT_CREATE_WIKI_USER_INFO_TABLE, conn);
0188: DatabaseConnection.executeUpdate(
0189: STATEMENT_CREATE_WIKI_USER_LOGIN_INDEX, conn);
0190: DatabaseConnection.executeUpdate(STATEMENT_CREATE_TOPIC_TABLE,
0191: conn);
0192: DatabaseConnection.executeUpdate(
0193: STATEMENT_CREATE_TOPIC_VERSION_TABLE, conn);
0194: DatabaseConnection
0195: .executeUpdate(
0196: STATEMENT_CREATE_TOPIC_CURRENT_VERSION_CONSTRAINT,
0197: conn);
0198: DatabaseConnection.executeUpdate(
0199: STATEMENT_CREATE_WIKI_FILE_TABLE, conn);
0200: DatabaseConnection.executeUpdate(
0201: STATEMENT_CREATE_WIKI_FILE_VERSION_TABLE, conn);
0202: DatabaseConnection.executeUpdate(
0203: STATEMENT_CREATE_CATEGORY_TABLE, conn);
0204: DatabaseConnection.executeUpdate(STATEMENT_CREATE_GROUP_TABLE,
0205: conn);
0206: DatabaseConnection.executeUpdate(STATEMENT_CREATE_ROLE_TABLE,
0207: conn);
0208: DatabaseConnection.executeUpdate(
0209: STATEMENT_CREATE_ROLE_MAP_TABLE, conn);
0210: DatabaseConnection.executeUpdate(
0211: STATEMENT_CREATE_RECENT_CHANGE_TABLE, conn);
0212: DatabaseConnection.executeUpdate(
0213: STATEMENT_CREATE_WATCHLIST_TABLE, conn);
0214: }
0215:
0216: /**
0217: *
0218: */
0219: public void deleteRecentChanges(int topicId, Connection conn)
0220: throws Exception {
0221: WikiPreparedStatement stmt = new WikiPreparedStatement(
0222: STATEMENT_DELETE_RECENT_CHANGES_TOPIC);
0223: stmt.setInt(1, topicId);
0224: stmt.executeUpdate(conn);
0225: }
0226:
0227: /**
0228: *
0229: */
0230: public void deleteRoleMapGroup(int groupId, Connection conn)
0231: throws Exception {
0232: WikiPreparedStatement stmt = new WikiPreparedStatement(
0233: STATEMENT_DELETE_ROLE_MAP_GROUP);
0234: stmt.setInt(1, groupId);
0235: stmt.executeUpdate(conn);
0236: }
0237:
0238: /**
0239: *
0240: */
0241: public void deleteRoleMapUser(int userId, Connection conn)
0242: throws Exception {
0243: WikiPreparedStatement stmt = new WikiPreparedStatement(
0244: STATEMENT_DELETE_ROLE_MAP_USER);
0245: stmt.setInt(1, userId);
0246: stmt.executeUpdate(conn);
0247: }
0248:
0249: /**
0250: *
0251: */
0252: public void deleteTopicCategories(int childTopicId, Connection conn)
0253: throws Exception {
0254: WikiPreparedStatement stmt = new WikiPreparedStatement(
0255: STATEMENT_DELETE_TOPIC_CATEGORIES);
0256: stmt.setInt(1, childTopicId);
0257: stmt.executeUpdate(conn);
0258: }
0259:
0260: /**
0261: *
0262: */
0263: public void deleteWatchlistEntry(int virtualWikiId,
0264: String topicName, int userId, Connection conn)
0265: throws Exception {
0266: WikiPreparedStatement stmt = new WikiPreparedStatement(
0267: STATEMENT_DELETE_WATCHLIST_ENTRY);
0268: stmt.setInt(1, virtualWikiId);
0269: stmt.setString(2, topicName);
0270: stmt.setInt(3, userId);
0271: stmt.executeUpdate(conn);
0272: }
0273:
0274: /**
0275: *
0276: */
0277: public void dropTables(Connection conn) {
0278: // note that this method is called during creation failures, so be careful to
0279: // catch errors that might result from a partial failure during install. also
0280: // note that the coding style violation here is intentional since it makes the
0281: // actual work of the method more obvious.
0282: try {
0283: DatabaseConnection.executeUpdate(
0284: STATEMENT_DROP_WATCHLIST_TABLE, conn);
0285: } catch (Exception e) {
0286: logger.severe(e.getMessage());
0287: }
0288: try {
0289: DatabaseConnection.executeUpdate(
0290: STATEMENT_DROP_RECENT_CHANGE_TABLE, conn);
0291: } catch (Exception e) {
0292: logger.severe(e.getMessage());
0293: }
0294: try {
0295: DatabaseConnection.executeUpdate(
0296: STATEMENT_DROP_ROLE_MAP_TABLE, conn);
0297: } catch (Exception e) {
0298: logger.severe(e.getMessage());
0299: }
0300: try {
0301: DatabaseConnection.executeUpdate(STATEMENT_DROP_ROLE_TABLE,
0302: conn);
0303: } catch (Exception e) {
0304: logger.severe(e.getMessage());
0305: }
0306: try {
0307: DatabaseConnection.executeUpdate(
0308: STATEMENT_DROP_GROUP_TABLE, conn);
0309: } catch (Exception e) {
0310: logger.severe(e.getMessage());
0311: }
0312: try {
0313: DatabaseConnection.executeUpdate(
0314: STATEMENT_DROP_CATEGORY_TABLE, conn);
0315: } catch (Exception e) {
0316: logger.severe(e.getMessage());
0317: }
0318: try {
0319: DatabaseConnection.executeUpdate(
0320: STATEMENT_DROP_WIKI_FILE_VERSION_TABLE, conn);
0321: } catch (Exception e) {
0322: logger.severe(e.getMessage());
0323: }
0324: try {
0325: DatabaseConnection.executeUpdate(
0326: STATEMENT_DROP_WIKI_FILE_TABLE, conn);
0327: } catch (Exception e) {
0328: logger.severe(e.getMessage());
0329: }
0330: try {
0331: DatabaseConnection.executeUpdate(
0332: STATEMENT_DROP_TOPIC_CURRENT_VERSION_CONSTRAINT,
0333: conn);
0334: } catch (Exception e) {
0335: logger.severe(e.getMessage());
0336: }
0337: try {
0338: DatabaseConnection.executeUpdate(
0339: STATEMENT_DROP_TOPIC_VERSION_TABLE, conn);
0340: } catch (Exception e) {
0341: logger.severe(e.getMessage());
0342: }
0343: try {
0344: DatabaseConnection.executeUpdate(
0345: STATEMENT_DROP_TOPIC_TABLE, conn);
0346: } catch (Exception e) {
0347: logger.severe(e.getMessage());
0348: }
0349: try {
0350: DatabaseConnection.executeUpdate(
0351: STATEMENT_DROP_WIKI_USER_LOGIN_INDEX, conn);
0352: } catch (Exception e) {
0353: logger.severe(e.getMessage());
0354: }
0355: try {
0356: DatabaseConnection.executeUpdate(
0357: STATEMENT_DROP_WIKI_USER_INFO_TABLE, conn);
0358: } catch (Exception e) {
0359: logger.severe(e.getMessage());
0360: }
0361: try {
0362: DatabaseConnection.executeUpdate(
0363: STATEMENT_DROP_WIKI_USER_TABLE, conn);
0364: } catch (Exception e) {
0365: logger.severe(e.getMessage());
0366: }
0367: try {
0368: DatabaseConnection.executeUpdate(
0369: STATEMENT_DROP_VIRTUAL_WIKI_TABLE, conn);
0370: } catch (Exception e) {
0371: logger.severe(e.getMessage());
0372: }
0373: }
0374:
0375: /**
0376: * Return a simple query, that if successfully run indicates that JAMWiki
0377: * tables have been initialized in the database.
0378: *
0379: * @return Returns a simple query that, if successfully run, indicates
0380: * that JAMWiki tables have been set up in the database.
0381: */
0382: public String existenceValidationQuery() {
0383: return STATEMENT_SELECT_VIRTUAL_WIKIS;
0384: }
0385:
0386: /**
0387: *
0388: */
0389: public WikiResultSet getAllTopicNames(int virtualWikiId)
0390: throws Exception {
0391: WikiPreparedStatement stmt = new WikiPreparedStatement(
0392: STATEMENT_SELECT_TOPICS);
0393: stmt.setInt(1, virtualWikiId);
0394: return stmt.executeQuery();
0395: }
0396:
0397: /**
0398: *
0399: */
0400: public WikiResultSet getAllWikiFileVersions(WikiFile wikiFile,
0401: boolean descending) throws Exception {
0402: WikiPreparedStatement stmt = new WikiPreparedStatement(
0403: STATEMENT_SELECT_WIKI_FILE_VERSIONS);
0404: // FIXME - sort order ignored
0405: stmt.setInt(1, wikiFile.getFileId());
0406: return stmt.executeQuery();
0407: }
0408:
0409: /**
0410: *
0411: */
0412: public WikiResultSet getCategories(int virtualWikiId,
0413: Pagination pagination) throws Exception {
0414: WikiPreparedStatement stmt = new WikiPreparedStatement(
0415: STATEMENT_SELECT_CATEGORIES);
0416: stmt.setInt(1, virtualWikiId);
0417: stmt.setInt(2, pagination.getNumResults());
0418: stmt.setInt(3, pagination.getOffset());
0419: return stmt.executeQuery();
0420: }
0421:
0422: /**
0423: *
0424: */
0425: public WikiResultSet getRecentChanges(String virtualWiki,
0426: Pagination pagination, boolean descending) throws Exception {
0427: WikiPreparedStatement stmt = new WikiPreparedStatement(
0428: STATEMENT_SELECT_RECENT_CHANGES);
0429: stmt.setString(1, virtualWiki);
0430: stmt.setInt(2, pagination.getNumResults());
0431: stmt.setInt(3, pagination.getOffset());
0432: // FIXME - sort order ignored
0433: return stmt.executeQuery();
0434: }
0435:
0436: /**
0437: *
0438: */
0439: public WikiResultSet getRecentChanges(int topicId,
0440: Pagination pagination, boolean descending) throws Exception {
0441: WikiPreparedStatement stmt = new WikiPreparedStatement(
0442: STATEMENT_SELECT_RECENT_CHANGES_TOPIC);
0443: stmt.setInt(1, topicId);
0444: stmt.setInt(2, pagination.getNumResults());
0445: stmt.setInt(3, pagination.getOffset());
0446: // FIXME - sort order ignored
0447: return stmt.executeQuery();
0448: }
0449:
0450: /**
0451: *
0452: */
0453: public WikiResultSet getRoleMapByLogin(String loginFragment)
0454: throws Exception {
0455: if (StringUtils.isBlank(loginFragment)) {
0456: return new WikiResultSet();
0457: }
0458: WikiPreparedStatement stmt = new WikiPreparedStatement(
0459: STATEMENT_SELECT_ROLE_MAP_LOGIN);
0460: loginFragment = '%' + loginFragment.toLowerCase() + '%';
0461: stmt.setString(1, loginFragment);
0462: return stmt.executeQuery();
0463: }
0464:
0465: /**
0466: *
0467: */
0468: public WikiResultSet getRoleMapByRole(String roleName)
0469: throws Exception {
0470: WikiPreparedStatement stmt = new WikiPreparedStatement(
0471: STATEMENT_SELECT_ROLE_MAP_ROLE);
0472: stmt.setString(1, roleName);
0473: stmt.setString(2, roleName);
0474: return stmt.executeQuery();
0475: }
0476:
0477: /**
0478: *
0479: */
0480: public WikiResultSet getRoleMapGroup(String groupName)
0481: throws Exception {
0482: WikiPreparedStatement stmt = new WikiPreparedStatement(
0483: STATEMENT_SELECT_ROLE_MAP_GROUP);
0484: stmt.setString(1, groupName);
0485: return stmt.executeQuery();
0486: }
0487:
0488: /**
0489: *
0490: */
0491: public WikiResultSet getRoleMapGroups() throws Exception {
0492: return DatabaseConnection
0493: .executeQuery(STATEMENT_SELECT_ROLE_MAP_GROUPS);
0494: }
0495:
0496: /**
0497: *
0498: */
0499: public WikiResultSet getRoleMapUser(String login) throws Exception {
0500: WikiPreparedStatement stmt = new WikiPreparedStatement(
0501: STATEMENT_SELECT_ROLE_MAP_USER);
0502: stmt.setString(1, login);
0503: return stmt.executeQuery();
0504: }
0505:
0506: /**
0507: *
0508: */
0509: public WikiResultSet getRoles() throws Exception {
0510: return DatabaseConnection.executeQuery(STATEMENT_SELECT_ROLES);
0511: }
0512:
0513: /**
0514: *
0515: */
0516: public WikiResultSet getTopicsAdmin(int virtualWikiId,
0517: Pagination pagination) throws Exception {
0518: WikiPreparedStatement stmt = new WikiPreparedStatement(
0519: STATEMENT_SELECT_TOPICS_ADMIN);
0520: stmt.setInt(1, virtualWikiId);
0521: stmt.setInt(2, pagination.getNumResults());
0522: stmt.setInt(3, pagination.getOffset());
0523: return stmt.executeQuery();
0524: }
0525:
0526: /**
0527: *
0528: */
0529: public WikiResultSet getUserContributions(String virtualWiki,
0530: String userString, Pagination pagination, boolean descending)
0531: throws Exception {
0532: WikiPreparedStatement stmt = null;
0533: if (Utilities.isIpAddress(userString)) {
0534: stmt = new WikiPreparedStatement(
0535: STATEMENT_SELECT_WIKI_USER_CHANGES_ANONYMOUS);
0536: } else {
0537: stmt = new WikiPreparedStatement(
0538: STATEMENT_SELECT_WIKI_USER_CHANGES_LOGIN);
0539: }
0540: stmt.setString(1, virtualWiki);
0541: stmt.setString(2, userString);
0542: stmt.setInt(3, pagination.getNumResults());
0543: stmt.setInt(4, pagination.getOffset());
0544: // FIXME - sort order ignored
0545: return stmt.executeQuery();
0546: }
0547:
0548: /**
0549: *
0550: */
0551: public WikiResultSet getVirtualWikis(Connection conn)
0552: throws Exception {
0553: return DatabaseConnection.executeQuery(
0554: STATEMENT_SELECT_VIRTUAL_WIKIS, conn);
0555: }
0556:
0557: /**
0558: *
0559: */
0560: public WikiResultSet getWatchlist(int virtualWikiId, int userId)
0561: throws Exception {
0562: WikiPreparedStatement stmt = new WikiPreparedStatement(
0563: STATEMENT_SELECT_WATCHLIST);
0564: stmt.setInt(1, virtualWikiId);
0565: stmt.setInt(2, userId);
0566: return stmt.executeQuery();
0567: }
0568:
0569: /**
0570: *
0571: */
0572: public WikiResultSet getWatchlist(int virtualWikiId, int userId,
0573: Pagination pagination) throws Exception {
0574: WikiPreparedStatement stmt = new WikiPreparedStatement(
0575: STATEMENT_SELECT_WATCHLIST_CHANGES);
0576: stmt.setInt(1, virtualWikiId);
0577: stmt.setInt(2, userId);
0578: stmt.setInt(3, pagination.getNumResults());
0579: stmt.setInt(4, pagination.getOffset());
0580: return stmt.executeQuery();
0581: }
0582:
0583: /**
0584: *
0585: */
0586: protected void init(Properties props) {
0587: STATEMENT_CONNECTION_VALIDATION_QUERY = props
0588: .getProperty("STATEMENT_CONNECTION_VALIDATION_QUERY");
0589: STATEMENT_CREATE_GROUP_TABLE = props
0590: .getProperty("STATEMENT_CREATE_GROUP_TABLE");
0591: STATEMENT_CREATE_ROLE_MAP_TABLE = props
0592: .getProperty("STATEMENT_CREATE_ROLE_MAP_TABLE");
0593: STATEMENT_CREATE_ROLE_TABLE = props
0594: .getProperty("STATEMENT_CREATE_ROLE_TABLE");
0595: STATEMENT_CREATE_VIRTUAL_WIKI_TABLE = props
0596: .getProperty("STATEMENT_CREATE_VIRTUAL_WIKI_TABLE");
0597: STATEMENT_CREATE_WIKI_USER_TABLE = props
0598: .getProperty("STATEMENT_CREATE_WIKI_USER_TABLE");
0599: STATEMENT_CREATE_WIKI_USER_INFO_TABLE = props
0600: .getProperty("STATEMENT_CREATE_WIKI_USER_INFO_TABLE");
0601: STATEMENT_CREATE_WIKI_USER_LOGIN_INDEX = props
0602: .getProperty("STATEMENT_CREATE_WIKI_USER_LOGIN_INDEX");
0603: STATEMENT_CREATE_TOPIC_CURRENT_VERSION_CONSTRAINT = props
0604: .getProperty("STATEMENT_CREATE_TOPIC_CURRENT_VERSION_CONSTRAINT");
0605: STATEMENT_CREATE_TOPIC_TABLE = props
0606: .getProperty("STATEMENT_CREATE_TOPIC_TABLE");
0607: STATEMENT_CREATE_TOPIC_VERSION_TABLE = props
0608: .getProperty("STATEMENT_CREATE_TOPIC_VERSION_TABLE");
0609: STATEMENT_CREATE_WIKI_FILE_TABLE = props
0610: .getProperty("STATEMENT_CREATE_WIKI_FILE_TABLE");
0611: STATEMENT_CREATE_WIKI_FILE_VERSION_TABLE = props
0612: .getProperty("STATEMENT_CREATE_WIKI_FILE_VERSION_TABLE");
0613: STATEMENT_CREATE_CATEGORY_TABLE = props
0614: .getProperty("STATEMENT_CREATE_CATEGORY_TABLE");
0615: STATEMENT_CREATE_RECENT_CHANGE_TABLE = props
0616: .getProperty("STATEMENT_CREATE_RECENT_CHANGE_TABLE");
0617: STATEMENT_CREATE_WATCHLIST_TABLE = props
0618: .getProperty("STATEMENT_CREATE_WATCHLIST_TABLE");
0619: STATEMENT_DELETE_RECENT_CHANGES = props
0620: .getProperty("STATEMENT_DELETE_RECENT_CHANGES");
0621: STATEMENT_DELETE_RECENT_CHANGES_TOPIC = props
0622: .getProperty("STATEMENT_DELETE_RECENT_CHANGES_TOPIC");
0623: STATEMENT_DELETE_ROLE_MAP_GROUP = props
0624: .getProperty("STATEMENT_DELETE_ROLE_MAP_GROUP");
0625: STATEMENT_DELETE_ROLE_MAP_USER = props
0626: .getProperty("STATEMENT_DELETE_ROLE_MAP_USER");
0627: STATEMENT_DELETE_TOPIC_CATEGORIES = props
0628: .getProperty("STATEMENT_DELETE_TOPIC_CATEGORIES");
0629: STATEMENT_DELETE_WATCHLIST_ENTRY = props
0630: .getProperty("STATEMENT_DELETE_WATCHLIST_ENTRY");
0631: STATEMENT_DROP_GROUP_TABLE = props
0632: .getProperty("STATEMENT_DROP_GROUP_TABLE");
0633: STATEMENT_DROP_ROLE_TABLE = props
0634: .getProperty("STATEMENT_DROP_ROLE_TABLE");
0635: STATEMENT_DROP_ROLE_MAP_TABLE = props
0636: .getProperty("STATEMENT_DROP_ROLE_MAP_TABLE");
0637: STATEMENT_DROP_VIRTUAL_WIKI_TABLE = props
0638: .getProperty("STATEMENT_DROP_VIRTUAL_WIKI_TABLE");
0639: STATEMENT_DROP_WIKI_USER_LOGIN_INDEX = props
0640: .getProperty("STATEMENT_DROP_WIKI_USER_LOGIN_INDEX");
0641: STATEMENT_DROP_WIKI_USER_TABLE = props
0642: .getProperty("STATEMENT_DROP_WIKI_USER_TABLE");
0643: STATEMENT_DROP_WIKI_USER_INFO_TABLE = props
0644: .getProperty("STATEMENT_DROP_WIKI_USER_INFO_TABLE");
0645: STATEMENT_DROP_TOPIC_CURRENT_VERSION_CONSTRAINT = props
0646: .getProperty("STATEMENT_DROP_TOPIC_CURRENT_VERSION_CONSTRAINT");
0647: STATEMENT_DROP_TOPIC_TABLE = props
0648: .getProperty("STATEMENT_DROP_TOPIC_TABLE");
0649: STATEMENT_DROP_TOPIC_VERSION_TABLE = props
0650: .getProperty("STATEMENT_DROP_TOPIC_VERSION_TABLE");
0651: STATEMENT_DROP_WIKI_FILE_TABLE = props
0652: .getProperty("STATEMENT_DROP_WIKI_FILE_TABLE");
0653: STATEMENT_DROP_WIKI_FILE_VERSION_TABLE = props
0654: .getProperty("STATEMENT_DROP_WIKI_FILE_VERSION_TABLE");
0655: STATEMENT_DROP_CATEGORY_TABLE = props
0656: .getProperty("STATEMENT_DROP_CATEGORY_TABLE");
0657: STATEMENT_DROP_RECENT_CHANGE_TABLE = props
0658: .getProperty("STATEMENT_DROP_RECENT_CHANGE_TABLE");
0659: STATEMENT_DROP_WATCHLIST_TABLE = props
0660: .getProperty("STATEMENT_DROP_WATCHLIST_TABLE");
0661: STATEMENT_INSERT_CATEGORY = props
0662: .getProperty("STATEMENT_INSERT_CATEGORY");
0663: STATEMENT_INSERT_GROUP = props
0664: .getProperty("STATEMENT_INSERT_GROUP");
0665: STATEMENT_INSERT_RECENT_CHANGE = props
0666: .getProperty("STATEMENT_INSERT_RECENT_CHANGE");
0667: STATEMENT_INSERT_RECENT_CHANGES = props
0668: .getProperty("STATEMENT_INSERT_RECENT_CHANGES");
0669: STATEMENT_INSERT_ROLE = props
0670: .getProperty("STATEMENT_INSERT_ROLE");
0671: STATEMENT_INSERT_ROLE_MAP = props
0672: .getProperty("STATEMENT_INSERT_ROLE_MAP");
0673: STATEMENT_INSERT_TOPIC = props
0674: .getProperty("STATEMENT_INSERT_TOPIC");
0675: STATEMENT_INSERT_TOPIC_VERSION = props
0676: .getProperty("STATEMENT_INSERT_TOPIC_VERSION");
0677: STATEMENT_INSERT_VIRTUAL_WIKI = props
0678: .getProperty("STATEMENT_INSERT_VIRTUAL_WIKI");
0679: STATEMENT_INSERT_WATCHLIST_ENTRY = props
0680: .getProperty("STATEMENT_INSERT_WATCHLIST_ENTRY");
0681: STATEMENT_INSERT_WIKI_FILE = props
0682: .getProperty("STATEMENT_INSERT_WIKI_FILE");
0683: STATEMENT_INSERT_WIKI_FILE_VERSION = props
0684: .getProperty("STATEMENT_INSERT_WIKI_FILE_VERSION");
0685: STATEMENT_INSERT_WIKI_USER = props
0686: .getProperty("STATEMENT_INSERT_WIKI_USER");
0687: STATEMENT_INSERT_WIKI_USER_INFO = props
0688: .getProperty("STATEMENT_INSERT_WIKI_USER_INFO");
0689: STATEMENT_SELECT_CATEGORIES = props
0690: .getProperty("STATEMENT_SELECT_CATEGORIES");
0691: STATEMENT_SELECT_CATEGORY_TOPICS = props
0692: .getProperty("STATEMENT_SELECT_CATEGORY_TOPICS");
0693: STATEMENT_SELECT_GROUP_SEQUENCE = props
0694: .getProperty("STATEMENT_SELECT_GROUP_SEQUENCE");
0695: STATEMENT_SELECT_RECENT_CHANGES = props
0696: .getProperty("STATEMENT_SELECT_RECENT_CHANGES");
0697: STATEMENT_SELECT_RECENT_CHANGES_TOPIC = props
0698: .getProperty("STATEMENT_SELECT_RECENT_CHANGES_TOPIC");
0699: STATEMENT_SELECT_ROLE_MAP_GROUP = props
0700: .getProperty("STATEMENT_SELECT_ROLE_MAP_GROUP");
0701: STATEMENT_SELECT_ROLE_MAP_GROUPS = props
0702: .getProperty("STATEMENT_SELECT_ROLE_MAP_GROUPS");
0703: STATEMENT_SELECT_ROLE_MAP_LOGIN = props
0704: .getProperty("STATEMENT_SELECT_ROLE_MAP_LOGIN");
0705: STATEMENT_SELECT_ROLE_MAP_ROLE = props
0706: .getProperty("STATEMENT_SELECT_ROLE_MAP_ROLE");
0707: STATEMENT_SELECT_ROLE_MAP_USER = props
0708: .getProperty("STATEMENT_SELECT_ROLE_MAP_USER");
0709: STATEMENT_SELECT_ROLES = props
0710: .getProperty("STATEMENT_SELECT_ROLES");
0711: STATEMENT_SELECT_TOPIC_BY_TYPE = props
0712: .getProperty("STATEMENT_SELECT_TOPIC_BY_TYPE");
0713: STATEMENT_SELECT_TOPIC_COUNT = props
0714: .getProperty("STATEMENT_SELECT_TOPIC_COUNT");
0715: STATEMENT_SELECT_TOPIC = props
0716: .getProperty("STATEMENT_SELECT_TOPIC");
0717: STATEMENT_SELECT_TOPIC_LOWER = props
0718: .getProperty("STATEMENT_SELECT_TOPIC_LOWER");
0719: STATEMENT_SELECT_TOPICS = props
0720: .getProperty("STATEMENT_SELECT_TOPICS");
0721: STATEMENT_SELECT_TOPICS_ADMIN = props
0722: .getProperty("STATEMENT_SELECT_TOPICS_ADMIN");
0723: STATEMENT_SELECT_TOPIC_SEQUENCE = props
0724: .getProperty("STATEMENT_SELECT_TOPIC_SEQUENCE");
0725: STATEMENT_SELECT_TOPIC_VERSION = props
0726: .getProperty("STATEMENT_SELECT_TOPIC_VERSION");
0727: STATEMENT_SELECT_TOPIC_VERSION_SEQUENCE = props
0728: .getProperty("STATEMENT_SELECT_TOPIC_VERSION_SEQUENCE");
0729: STATEMENT_SELECT_VIRTUAL_WIKIS = props
0730: .getProperty("STATEMENT_SELECT_VIRTUAL_WIKIS");
0731: STATEMENT_SELECT_VIRTUAL_WIKI_SEQUENCE = props
0732: .getProperty("STATEMENT_SELECT_VIRTUAL_WIKI_SEQUENCE");
0733: STATEMENT_SELECT_WATCHLIST = props
0734: .getProperty("STATEMENT_SELECT_WATCHLIST");
0735: STATEMENT_SELECT_WATCHLIST_CHANGES = props
0736: .getProperty("STATEMENT_SELECT_WATCHLIST_CHANGES");
0737: STATEMENT_SELECT_WIKI_FILE = props
0738: .getProperty("STATEMENT_SELECT_WIKI_FILE");
0739: STATEMENT_SELECT_WIKI_FILE_COUNT = props
0740: .getProperty("STATEMENT_SELECT_WIKI_FILE_COUNT");
0741: STATEMENT_SELECT_WIKI_FILE_SEQUENCE = props
0742: .getProperty("STATEMENT_SELECT_WIKI_FILE_SEQUENCE");
0743: STATEMENT_SELECT_WIKI_FILE_VERSION_SEQUENCE = props
0744: .getProperty("STATEMENT_SELECT_WIKI_FILE_VERSION_SEQUENCE");
0745: STATEMENT_SELECT_WIKI_FILE_VERSIONS = props
0746: .getProperty("STATEMENT_SELECT_WIKI_FILE_VERSIONS");
0747: STATEMENT_SELECT_WIKI_USER = props
0748: .getProperty("STATEMENT_SELECT_WIKI_USER");
0749: STATEMENT_SELECT_WIKI_USER_CHANGES_ANONYMOUS = props
0750: .getProperty("STATEMENT_SELECT_WIKI_USER_CHANGES_ANONYMOUS");
0751: STATEMENT_SELECT_WIKI_USER_CHANGES_LOGIN = props
0752: .getProperty("STATEMENT_SELECT_WIKI_USER_CHANGES_LOGIN");
0753: STATEMENT_SELECT_WIKI_USER_COUNT = props
0754: .getProperty("STATEMENT_SELECT_WIKI_USER_COUNT");
0755: STATEMENT_SELECT_WIKI_USER_INFO = props
0756: .getProperty("STATEMENT_SELECT_WIKI_USER_INFO");
0757: STATEMENT_SELECT_WIKI_USER_LOGIN = props
0758: .getProperty("STATEMENT_SELECT_WIKI_USER_LOGIN");
0759: STATEMENT_SELECT_WIKI_USER_PASSWORD = props
0760: .getProperty("STATEMENT_SELECT_WIKI_USER_PASSWORD");
0761: STATEMENT_SELECT_WIKI_USER_SEQUENCE = props
0762: .getProperty("STATEMENT_SELECT_WIKI_USER_SEQUENCE");
0763: STATEMENT_SELECT_WIKI_USERS = props
0764: .getProperty("STATEMENT_SELECT_WIKI_USERS");
0765: STATEMENT_UPDATE_GROUP = props
0766: .getProperty("STATEMENT_UPDATE_GROUP");
0767: STATEMENT_UPDATE_ROLE = props
0768: .getProperty("STATEMENT_UPDATE_ROLE");
0769: STATEMENT_UPDATE_TOPIC = props
0770: .getProperty("STATEMENT_UPDATE_TOPIC");
0771: STATEMENT_UPDATE_TOPIC_CURRENT_VERSION = props
0772: .getProperty("STATEMENT_UPDATE_TOPIC_CURRENT_VERSION");
0773: STATEMENT_UPDATE_TOPIC_CURRENT_VERSIONS = props
0774: .getProperty("STATEMENT_UPDATE_TOPIC_CURRENT_VERSIONS");
0775: STATEMENT_UPDATE_VIRTUAL_WIKI = props
0776: .getProperty("STATEMENT_UPDATE_VIRTUAL_WIKI");
0777: STATEMENT_UPDATE_WIKI_FILE = props
0778: .getProperty("STATEMENT_UPDATE_WIKI_FILE");
0779: STATEMENT_UPDATE_WIKI_USER = props
0780: .getProperty("STATEMENT_UPDATE_WIKI_USER");
0781: STATEMENT_UPDATE_WIKI_USER_INFO = props
0782: .getProperty("STATEMENT_UPDATE_WIKI_USER_INFO");
0783: }
0784:
0785: /**
0786: *
0787: */
0788: public void insertCategory(Category category, int virtualWikiId,
0789: Connection conn) throws Exception {
0790: // FIXME - clean this code up
0791: this .validateCategory(category);
0792: WikiResultSet rs = this .lookupTopic(virtualWikiId, category
0793: .getChildTopicName(), false, conn);
0794: int topicId = -1;
0795: while (rs.next()) {
0796: if (rs.getTimestamp("delete_date") == null) {
0797: topicId = rs.getInt(AnsiDataHandler.DATA_TOPIC_ID);
0798: break;
0799: }
0800: }
0801: if (topicId == -1) {
0802: throw new Exception("Unable to find child topic "
0803: + category.getChildTopicName() + " for category "
0804: + category.getName());
0805: }
0806: WikiPreparedStatement stmt = new WikiPreparedStatement(
0807: STATEMENT_INSERT_CATEGORY);
0808: stmt.setInt(1, rs.getInt(AnsiDataHandler.DATA_TOPIC_ID));
0809: stmt.setString(2, category.getName());
0810: stmt.setString(3, category.getSortKey());
0811: stmt.executeUpdate(conn);
0812: }
0813:
0814: /**
0815: *
0816: */
0817: public void insertRecentChange(RecentChange change,
0818: int virtualWikiId, Connection conn) throws Exception {
0819: this .validateRecentChange(change);
0820: WikiPreparedStatement stmt = new WikiPreparedStatement(
0821: STATEMENT_INSERT_RECENT_CHANGE);
0822: stmt.setInt(1, change.getTopicVersionId());
0823: if (change.getPreviousTopicVersionId() == null) {
0824: stmt.setNull(2, Types.INTEGER);
0825: } else {
0826: stmt.setInt(2, change.getPreviousTopicVersionId()
0827: .intValue());
0828: }
0829: stmt.setInt(3, change.getTopicId());
0830: stmt.setString(4, change.getTopicName());
0831: stmt.setTimestamp(5, change.getEditDate());
0832: stmt.setString(6, change.getEditComment());
0833: if (change.getAuthorId() == null) {
0834: stmt.setNull(7, Types.INTEGER);
0835: } else {
0836: stmt.setInt(7, change.getAuthorId().intValue());
0837: }
0838: stmt.setString(8, change.getAuthorName());
0839: stmt.setInt(9, change.getEditType());
0840: stmt.setInt(10, virtualWikiId);
0841: stmt.setString(11, change.getVirtualWiki());
0842: stmt.executeUpdate(conn);
0843: }
0844:
0845: /**
0846: *
0847: */
0848: public void insertRole(Role role, Connection conn) throws Exception {
0849: this .validateRole(role);
0850: WikiPreparedStatement stmt = new WikiPreparedStatement(
0851: STATEMENT_INSERT_ROLE);
0852: stmt.setString(1, role.getAuthority());
0853: stmt.setString(2, role.getDescription());
0854: stmt.executeUpdate(conn);
0855: }
0856:
0857: /**
0858: *
0859: */
0860: public void insertRoleMap(int userId, int groupId, String role,
0861: Connection conn) throws Exception {
0862: this .validateRoleMap(role);
0863: WikiPreparedStatement stmt = new WikiPreparedStatement(
0864: STATEMENT_INSERT_ROLE_MAP);
0865: stmt.setString(1, role);
0866: if (userId > 0) {
0867: stmt.setInt(2, userId);
0868: } else {
0869: stmt.setNull(2, Types.INTEGER);
0870: }
0871: if (groupId > 0) {
0872: stmt.setInt(3, groupId);
0873: } else {
0874: stmt.setNull(3, Types.INTEGER);
0875: }
0876: stmt.executeUpdate(conn);
0877: }
0878:
0879: /**
0880: *
0881: */
0882: public void insertTopic(Topic topic, int virtualWikiId,
0883: Connection conn) throws Exception {
0884: this .validateTopic(topic);
0885: WikiPreparedStatement stmt = new WikiPreparedStatement(
0886: STATEMENT_INSERT_TOPIC);
0887: stmt.setInt(1, topic.getTopicId());
0888: stmt.setInt(2, virtualWikiId);
0889: stmt.setString(3, topic.getName());
0890: stmt.setInt(4, topic.getTopicType());
0891: stmt.setInt(5, (topic.getReadOnly() ? 1 : 0));
0892: if (topic.getCurrentVersionId() == null) {
0893: stmt.setNull(6, Types.INTEGER);
0894: } else {
0895: stmt.setInt(6, topic.getCurrentVersionId().intValue());
0896: }
0897: stmt.setTimestamp(7, topic.getDeleteDate());
0898: stmt.setInt(8, (topic.getAdminOnly() ? 1 : 0));
0899: stmt.setString(9, topic.getRedirectTo());
0900: stmt.executeUpdate(conn);
0901: }
0902:
0903: /**
0904: *
0905: */
0906: public void insertTopicVersion(TopicVersion topicVersion,
0907: Connection conn) throws Exception {
0908: this .validateTopicVersion(topicVersion);
0909: WikiPreparedStatement stmt = new WikiPreparedStatement(
0910: STATEMENT_INSERT_TOPIC_VERSION);
0911: stmt.setInt(1, topicVersion.getTopicVersionId());
0912: stmt.setInt(2, topicVersion.getTopicId());
0913: stmt.setString(3, topicVersion.getEditComment());
0914: stmt.setString(4, topicVersion.getVersionContent());
0915: if (topicVersion.getAuthorId() == null) {
0916: stmt.setNull(5, Types.INTEGER);
0917: } else {
0918: stmt.setInt(5, topicVersion.getAuthorId().intValue());
0919: }
0920: stmt.setInt(6, topicVersion.getEditType());
0921: stmt.setString(7, topicVersion.getAuthorIpAddress());
0922: stmt.setTimestamp(8, topicVersion.getEditDate());
0923: if (topicVersion.getPreviousTopicVersionId() == null) {
0924: stmt.setNull(9, Types.INTEGER);
0925: } else {
0926: stmt.setInt(9, topicVersion.getPreviousTopicVersionId()
0927: .intValue());
0928: }
0929: stmt.executeUpdate(conn);
0930: stmt = new WikiPreparedStatement(
0931: STATEMENT_UPDATE_TOPIC_CURRENT_VERSION);
0932: stmt.setInt(1, topicVersion.getTopicId());
0933: stmt.setInt(2, topicVersion.getTopicId());
0934: stmt.executeUpdate(conn);
0935: }
0936:
0937: /**
0938: *
0939: */
0940: public void insertVirtualWiki(VirtualWiki virtualWiki,
0941: Connection conn) throws Exception {
0942: this .validateVirtualWiki(virtualWiki);
0943: WikiPreparedStatement stmt = new WikiPreparedStatement(
0944: STATEMENT_INSERT_VIRTUAL_WIKI);
0945: stmt.setInt(1, virtualWiki.getVirtualWikiId());
0946: stmt.setString(2, virtualWiki.getName());
0947: stmt.setString(3, virtualWiki.getDefaultTopicName());
0948: stmt.executeUpdate(conn);
0949: }
0950:
0951: /**
0952: *
0953: */
0954: public void insertWatchlistEntry(int virtualWikiId,
0955: String topicName, int userId, Connection conn)
0956: throws Exception {
0957: this .validateWatchlistEntry(topicName);
0958: WikiPreparedStatement stmt = new WikiPreparedStatement(
0959: STATEMENT_INSERT_WATCHLIST_ENTRY);
0960: stmt.setInt(1, virtualWikiId);
0961: stmt.setString(2, topicName);
0962: stmt.setInt(3, userId);
0963: stmt.executeUpdate(conn);
0964: }
0965:
0966: /**
0967: *
0968: */
0969: public void insertWikiFile(WikiFile wikiFile, int virtualWikiId,
0970: Connection conn) throws Exception {
0971: this .validateWikiFile(wikiFile);
0972: WikiPreparedStatement stmt = new WikiPreparedStatement(
0973: STATEMENT_INSERT_WIKI_FILE);
0974: stmt.setInt(1, wikiFile.getFileId());
0975: stmt.setInt(2, virtualWikiId);
0976: stmt.setString(3, wikiFile.getFileName());
0977: stmt.setString(4, wikiFile.getUrl());
0978: stmt.setString(5, wikiFile.getMimeType());
0979: stmt.setInt(6, wikiFile.getTopicId());
0980: stmt.setTimestamp(7, wikiFile.getDeleteDate());
0981: stmt.setInt(8, (wikiFile.getReadOnly() ? 1 : 0));
0982: stmt.setInt(9, (wikiFile.getAdminOnly() ? 1 : 0));
0983: stmt.setInt(10, wikiFile.getFileSize());
0984: stmt.executeUpdate(conn);
0985: }
0986:
0987: /**
0988: *
0989: */
0990: public void insertWikiFileVersion(WikiFileVersion wikiFileVersion,
0991: Connection conn) throws Exception {
0992: this .validateWikiFileVersion(wikiFileVersion);
0993: WikiPreparedStatement stmt = new WikiPreparedStatement(
0994: STATEMENT_INSERT_WIKI_FILE_VERSION);
0995: stmt.setInt(1, wikiFileVersion.getFileVersionId());
0996: stmt.setInt(2, wikiFileVersion.getFileId());
0997: stmt.setString(3, wikiFileVersion.getUploadComment());
0998: stmt.setString(4, wikiFileVersion.getUrl());
0999: if (wikiFileVersion.getAuthorId() == null) {
1000: stmt.setNull(5, Types.INTEGER);
1001: } else {
1002: stmt.setInt(5, wikiFileVersion.getAuthorId().intValue());
1003: }
1004: stmt.setString(6, wikiFileVersion.getAuthorIpAddress());
1005: stmt.setTimestamp(7, wikiFileVersion.getUploadDate());
1006: stmt.setString(8, wikiFileVersion.getMimeType());
1007: stmt.setInt(9, wikiFileVersion.getFileSize());
1008: stmt.executeUpdate(conn);
1009: }
1010:
1011: /**
1012: *
1013: */
1014: public void insertWikiGroup(WikiGroup group, Connection conn)
1015: throws Exception {
1016: this .validateWikiGroup(group);
1017: WikiPreparedStatement stmt = new WikiPreparedStatement(
1018: STATEMENT_INSERT_GROUP);
1019: stmt.setInt(1, group.getGroupId());
1020: stmt.setString(2, group.getName());
1021: stmt.setString(3, group.getDescription());
1022: stmt.executeUpdate(conn);
1023: }
1024:
1025: /**
1026: *
1027: */
1028: public void insertWikiUser(WikiUser user, Connection conn)
1029: throws Exception {
1030: this .validateWikiUser(user);
1031: WikiPreparedStatement stmt = new WikiPreparedStatement(
1032: STATEMENT_INSERT_WIKI_USER);
1033: stmt.setInt(1, user.getUserId());
1034: stmt.setString(2, user.getUsername());
1035: stmt.setString(3, user.getDisplayName());
1036: stmt.setTimestamp(4, user.getCreateDate());
1037: stmt.setTimestamp(5, user.getLastLoginDate());
1038: stmt.setString(6, user.getCreateIpAddress());
1039: stmt.setString(7, user.getLastLoginIpAddress());
1040: stmt.setString(8, user.getPassword());
1041: stmt.setString(9, user.getDefaultLocale());
1042: stmt.executeUpdate(conn);
1043: }
1044:
1045: /**
1046: *
1047: */
1048: public void insertWikiUserInfo(WikiUserInfo userInfo,
1049: Connection conn) throws Exception {
1050: this .validateWikiUserInfo(userInfo);
1051: WikiPreparedStatement stmt = new WikiPreparedStatement(
1052: STATEMENT_INSERT_WIKI_USER_INFO);
1053: stmt.setInt(1, userInfo.getUserId());
1054: stmt.setString(2, userInfo.getUsername());
1055: stmt.setString(3, userInfo.getEmail());
1056: stmt.setString(4, userInfo.getFirstName());
1057: stmt.setString(5, userInfo.getLastName());
1058: stmt.setString(6, userInfo.getEncodedPassword());
1059: stmt.executeUpdate(conn);
1060: }
1061:
1062: /**
1063: *
1064: */
1065: public WikiResultSet lookupCategoryTopics(int virtualWikiId,
1066: String categoryName) throws Exception {
1067: WikiPreparedStatement stmt = new WikiPreparedStatement(
1068: STATEMENT_SELECT_CATEGORY_TOPICS);
1069: // category name must be lowercase since search is case-insensitive
1070: categoryName = categoryName.toLowerCase();
1071: stmt.setInt(1, virtualWikiId);
1072: stmt.setString(2, categoryName);
1073: return stmt.executeQuery();
1074: }
1075:
1076: /**
1077: *
1078: */
1079: public WikiResultSet lookupTopic(int virtualWikiId,
1080: String topicName, boolean caseSensitive, Connection conn)
1081: throws Exception {
1082: WikiPreparedStatement stmt = null;
1083: if (caseSensitive) {
1084: stmt = new WikiPreparedStatement(STATEMENT_SELECT_TOPIC);
1085: } else {
1086: topicName = topicName.toLowerCase();
1087: stmt = new WikiPreparedStatement(
1088: STATEMENT_SELECT_TOPIC_LOWER);
1089: }
1090: stmt.setInt(1, virtualWikiId);
1091: stmt.setString(2, topicName);
1092: return stmt.executeQuery(conn);
1093: }
1094:
1095: /**
1096: *
1097: */
1098: public WikiResultSet lookupTopicByType(int virtualWikiId,
1099: int topicType, Pagination pagination) throws Exception {
1100: WikiPreparedStatement stmt = new WikiPreparedStatement(
1101: STATEMENT_SELECT_TOPIC_BY_TYPE);
1102: stmt.setInt(1, virtualWikiId);
1103: stmt.setInt(2, topicType);
1104: stmt.setInt(3, pagination.getNumResults());
1105: stmt.setInt(4, pagination.getOffset());
1106: return stmt.executeQuery();
1107: }
1108:
1109: /**
1110: * Return a count of all topics, including redirects, comments pages and templates,
1111: * currently available on the Wiki. This method excludes deleted topics.
1112: *
1113: * @param virtualWikiId The virtual wiki id for the virtual wiki of the topics
1114: * being retrieved.
1115: */
1116: public WikiResultSet lookupTopicCount(int virtualWikiId)
1117: throws Exception {
1118: WikiPreparedStatement stmt = new WikiPreparedStatement(
1119: STATEMENT_SELECT_TOPIC_COUNT);
1120: stmt.setInt(1, virtualWikiId);
1121: return stmt.executeQuery();
1122: }
1123:
1124: /**
1125: *
1126: */
1127: public WikiResultSet lookupTopicVersion(int topicVersionId,
1128: Connection conn) throws Exception {
1129: WikiPreparedStatement stmt = new WikiPreparedStatement(
1130: STATEMENT_SELECT_TOPIC_VERSION);
1131: stmt.setInt(1, topicVersionId);
1132: return stmt.executeQuery(conn);
1133: }
1134:
1135: /**
1136: *
1137: */
1138: public WikiResultSet lookupWikiFile(int virtualWikiId, int topicId)
1139: throws Exception {
1140: WikiPreparedStatement stmt = new WikiPreparedStatement(
1141: STATEMENT_SELECT_WIKI_FILE);
1142: stmt.setInt(1, virtualWikiId);
1143: stmt.setInt(2, topicId);
1144: return stmt.executeQuery();
1145: }
1146:
1147: /**
1148: * Return a count of all wiki files currently available on the Wiki. This
1149: * method excludes deleted files.
1150: *
1151: * @param virtualWikiId The virtual wiki id for the virtual wiki of the files
1152: * being retrieved.
1153: */
1154: public WikiResultSet lookupWikiFileCount(int virtualWikiId)
1155: throws Exception {
1156: WikiPreparedStatement stmt = new WikiPreparedStatement(
1157: STATEMENT_SELECT_WIKI_FILE_COUNT);
1158: stmt.setInt(1, virtualWikiId);
1159: return stmt.executeQuery();
1160: }
1161:
1162: /**
1163: *
1164: */
1165: public WikiResultSet lookupWikiUser(int userId, Connection conn)
1166: throws Exception {
1167: WikiPreparedStatement stmt = new WikiPreparedStatement(
1168: STATEMENT_SELECT_WIKI_USER);
1169: stmt.setInt(1, userId);
1170: return stmt.executeQuery(conn);
1171: }
1172:
1173: /**
1174: *
1175: */
1176: public WikiResultSet lookupWikiUser(String username, Connection conn)
1177: throws Exception {
1178: WikiPreparedStatement stmt = new WikiPreparedStatement(
1179: STATEMENT_SELECT_WIKI_USER_LOGIN);
1180: stmt.setString(1, username);
1181: return stmt.executeQuery(conn);
1182: }
1183:
1184: /**
1185: *
1186: */
1187: public WikiResultSet lookupWikiUser(String username,
1188: String encryptedPassword, Connection conn) throws Exception {
1189: WikiPreparedStatement stmt = new WikiPreparedStatement(
1190: STATEMENT_SELECT_WIKI_USER_PASSWORD);
1191: stmt.setString(1, username);
1192: stmt.setString(2, encryptedPassword);
1193: return stmt.executeQuery(conn);
1194: }
1195:
1196: /**
1197: * Return a count of all wiki users.
1198: */
1199: public WikiResultSet lookupWikiUserCount() throws Exception {
1200: return DatabaseConnection
1201: .executeQuery(STATEMENT_SELECT_WIKI_USER_COUNT);
1202: }
1203:
1204: /**
1205: *
1206: */
1207: public WikiResultSet lookupWikiUserInfo(String username)
1208: throws Exception {
1209: WikiPreparedStatement stmt = new WikiPreparedStatement(
1210: STATEMENT_SELECT_WIKI_USER_INFO);
1211: stmt.setString(1, username);
1212: return stmt.executeQuery();
1213: }
1214:
1215: /**
1216: *
1217: */
1218: public WikiResultSet lookupWikiUsers(Pagination pagination)
1219: throws Exception {
1220: WikiPreparedStatement stmt = new WikiPreparedStatement(
1221: STATEMENT_SELECT_WIKI_USERS);
1222: stmt.setInt(1, pagination.getNumResults());
1223: stmt.setInt(2, pagination.getOffset());
1224: return stmt.executeQuery();
1225: }
1226:
1227: /**
1228: *
1229: */
1230: public int nextTopicId(Connection conn) throws Exception {
1231: WikiResultSet rs = DatabaseConnection.executeQuery(
1232: STATEMENT_SELECT_TOPIC_SEQUENCE, conn);
1233: int nextId = 0;
1234: if (rs.size() > 0) {
1235: nextId = rs.getInt(AnsiDataHandler.DATA_TOPIC_ID);
1236: }
1237: // note - this returns the last id in the system, so add one
1238: return nextId + 1;
1239: }
1240:
1241: /**
1242: *
1243: */
1244: public int nextTopicVersionId(Connection conn) throws Exception {
1245: WikiResultSet rs = DatabaseConnection.executeQuery(
1246: STATEMENT_SELECT_TOPIC_VERSION_SEQUENCE, conn);
1247: int nextId = 0;
1248: if (rs.size() > 0) {
1249: nextId = rs.getInt("topic_version_id");
1250: }
1251: // note - this returns the last id in the system, so add one
1252: return nextId + 1;
1253: }
1254:
1255: /**
1256: *
1257: */
1258: public int nextVirtualWikiId(Connection conn) throws Exception {
1259: WikiResultSet rs = DatabaseConnection.executeQuery(
1260: STATEMENT_SELECT_VIRTUAL_WIKI_SEQUENCE, conn);
1261: int nextId = 0;
1262: if (rs.size() > 0) {
1263: nextId = rs.getInt("virtual_wiki_id");
1264: }
1265: // note - this returns the last id in the system, so add one
1266: return nextId + 1;
1267: }
1268:
1269: /**
1270: *
1271: */
1272: public int nextWikiFileId(Connection conn) throws Exception {
1273: WikiResultSet rs = DatabaseConnection.executeQuery(
1274: STATEMENT_SELECT_WIKI_FILE_SEQUENCE, conn);
1275: int nextId = 0;
1276: if (rs.size() > 0) {
1277: nextId = rs.getInt("file_id");
1278: }
1279: // note - this returns the last id in the system, so add one
1280: return nextId + 1;
1281: }
1282:
1283: /**
1284: *
1285: */
1286: public int nextWikiFileVersionId(Connection conn) throws Exception {
1287: WikiResultSet rs = DatabaseConnection.executeQuery(
1288: STATEMENT_SELECT_WIKI_FILE_VERSION_SEQUENCE, conn);
1289: int nextId = 0;
1290: if (rs.size() > 0) {
1291: nextId = rs.getInt("file_version_id");
1292: }
1293: // note - this returns the last id in the system, so add one
1294: return nextId + 1;
1295: }
1296:
1297: /**
1298: *
1299: */
1300: public int nextWikiGroupId(Connection conn) throws Exception {
1301: WikiResultSet rs = DatabaseConnection.executeQuery(
1302: STATEMENT_SELECT_GROUP_SEQUENCE, conn);
1303: int nextId = 0;
1304: if (rs.size() > 0) {
1305: nextId = rs.getInt(AnsiDataHandler.DATA_GROUP_ID);
1306: }
1307: // note - this returns the last id in the system, so add one
1308: return nextId + 1;
1309: }
1310:
1311: /**
1312: *
1313: */
1314: public int nextWikiUserId(Connection conn) throws Exception {
1315: WikiResultSet rs = DatabaseConnection.executeQuery(
1316: STATEMENT_SELECT_WIKI_USER_SEQUENCE, conn);
1317: int nextId = 0;
1318: if (rs.size() > 0) {
1319: nextId = rs.getInt(AnsiDataHandler.DATA_WIKI_USER_ID);
1320: }
1321: // note - this returns the last id in the system, so add one
1322: return nextId + 1;
1323: }
1324:
1325: /**
1326: *
1327: */
1328: public void reloadRecentChanges(Connection conn) throws Exception {
1329: DatabaseConnection.executeUpdate(
1330: STATEMENT_DELETE_RECENT_CHANGES, conn);
1331: DatabaseConnection.executeUpdate(
1332: STATEMENT_INSERT_RECENT_CHANGES, conn);
1333: }
1334:
1335: /**
1336: *
1337: */
1338: public void updateRole(Role role, Connection conn) throws Exception {
1339: this .validateRole(role);
1340: WikiPreparedStatement stmt = new WikiPreparedStatement(
1341: STATEMENT_UPDATE_ROLE);
1342: stmt.setString(1, role.getDescription());
1343: stmt.setString(2, role.getAuthority());
1344: stmt.executeUpdate(conn);
1345: }
1346:
1347: /**
1348: *
1349: */
1350: public void updateTopic(Topic topic, int virtualWikiId,
1351: Connection conn) throws Exception {
1352: this .validateTopic(topic);
1353: WikiPreparedStatement stmt = new WikiPreparedStatement(
1354: STATEMENT_UPDATE_TOPIC);
1355: stmt.setInt(1, virtualWikiId);
1356: stmt.setString(2, topic.getName());
1357: stmt.setInt(3, topic.getTopicType());
1358: stmt.setInt(4, (topic.getReadOnly() ? 1 : 0));
1359: if (topic.getCurrentVersionId() == null) {
1360: stmt.setNull(5, Types.INTEGER);
1361: } else {
1362: stmt.setInt(5, topic.getCurrentVersionId().intValue());
1363: }
1364: stmt.setTimestamp(6, topic.getDeleteDate());
1365: stmt.setInt(7, (topic.getAdminOnly() ? 1 : 0));
1366: stmt.setString(8, topic.getRedirectTo());
1367: stmt.setInt(9, topic.getTopicId());
1368: stmt.executeUpdate(conn);
1369: }
1370:
1371: /**
1372: *
1373: */
1374: public void updateVirtualWiki(VirtualWiki virtualWiki,
1375: Connection conn) throws Exception {
1376: this .validateVirtualWiki(virtualWiki);
1377: WikiPreparedStatement stmt = new WikiPreparedStatement(
1378: STATEMENT_UPDATE_VIRTUAL_WIKI);
1379: stmt.setString(1, virtualWiki.getDefaultTopicName());
1380: stmt.setInt(2, virtualWiki.getVirtualWikiId());
1381: stmt.executeUpdate(conn);
1382: }
1383:
1384: /**
1385: *
1386: */
1387: public void updateWikiFile(WikiFile wikiFile, int virtualWikiId,
1388: Connection conn) throws Exception {
1389: this .validateWikiFile(wikiFile);
1390: WikiPreparedStatement stmt = new WikiPreparedStatement(
1391: STATEMENT_UPDATE_WIKI_FILE);
1392: stmt.setInt(1, virtualWikiId);
1393: stmt.setString(2, wikiFile.getFileName());
1394: stmt.setString(3, wikiFile.getUrl());
1395: stmt.setString(4, wikiFile.getMimeType());
1396: stmt.setInt(5, wikiFile.getTopicId());
1397: stmt.setTimestamp(6, wikiFile.getDeleteDate());
1398: stmt.setInt(7, (wikiFile.getReadOnly() ? 1 : 0));
1399: stmt.setInt(8, (wikiFile.getAdminOnly() ? 1 : 0));
1400: stmt.setInt(9, wikiFile.getFileSize());
1401: stmt.setInt(10, wikiFile.getFileId());
1402: stmt.executeUpdate(conn);
1403: }
1404:
1405: /**
1406: *
1407: */
1408: public void updateWikiGroup(WikiGroup group, Connection conn)
1409: throws Exception {
1410: this .validateWikiGroup(group);
1411: WikiPreparedStatement stmt = new WikiPreparedStatement(
1412: STATEMENT_UPDATE_GROUP);
1413: stmt.setString(1, group.getName());
1414: stmt.setString(2, group.getDescription());
1415: stmt.setInt(3, group.getGroupId());
1416: stmt.executeUpdate(conn);
1417: }
1418:
1419: /**
1420: *
1421: */
1422: public void updateWikiUser(WikiUser user, Connection conn)
1423: throws Exception {
1424: this .validateWikiUser(user);
1425: WikiPreparedStatement stmt = new WikiPreparedStatement(
1426: STATEMENT_UPDATE_WIKI_USER);
1427: stmt.setString(1, user.getUsername());
1428: stmt.setString(2, user.getDisplayName());
1429: stmt.setTimestamp(3, user.getLastLoginDate());
1430: stmt.setString(4, user.getLastLoginIpAddress());
1431: stmt.setString(5, user.getDefaultLocale());
1432: stmt.setInt(6, user.getUserId());
1433: stmt.executeUpdate(conn);
1434: }
1435:
1436: /**
1437: *
1438: */
1439: public void updateWikiUserInfo(WikiUserInfo userInfo,
1440: Connection conn) throws Exception {
1441: this .validateWikiUserInfo(userInfo);
1442: WikiPreparedStatement stmt = new WikiPreparedStatement(
1443: STATEMENT_UPDATE_WIKI_USER_INFO);
1444: stmt.setString(1, userInfo.getUsername());
1445: stmt.setString(2, userInfo.getEmail());
1446: stmt.setString(3, userInfo.getFirstName());
1447: stmt.setString(4, userInfo.getLastName());
1448: stmt.setString(5, userInfo.getEncodedPassword());
1449: stmt.setInt(6, userInfo.getUserId());
1450: stmt.executeUpdate(conn);
1451: }
1452:
1453: /**
1454: *
1455: */
1456: protected void validateCategory(Category category)
1457: throws WikiException {
1458: checkLength(category.getName(), 200);
1459: checkLength(category.getSortKey(), 200);
1460: }
1461:
1462: /**
1463: *
1464: */
1465: protected void validateRecentChange(RecentChange change)
1466: throws WikiException {
1467: checkLength(change.getTopicName(), 200);
1468: checkLength(change.getAuthorName(), 200);
1469: checkLength(change.getVirtualWiki(), 100);
1470: change.setEditComment(StringUtils.substring(change
1471: .getEditComment(), 0, 200));
1472: }
1473:
1474: /**
1475: *
1476: */
1477: protected void validateRole(Role role) throws WikiException {
1478: checkLength(role.getAuthority(), 30);
1479: role.setDescription(StringUtils.substring(
1480: role.getDescription(), 0, 200));
1481: }
1482:
1483: /**
1484: *
1485: */
1486: protected void validateRoleMap(String role) throws WikiException {
1487: checkLength(role, 30);
1488: }
1489:
1490: /**
1491: *
1492: */
1493: protected void validateTopic(Topic topic) throws WikiException {
1494: checkLength(topic.getName(), 200);
1495: checkLength(topic.getRedirectTo(), 200);
1496: }
1497:
1498: /**
1499: *
1500: */
1501: protected void validateTopicVersion(TopicVersion topicVersion)
1502: throws WikiException {
1503: checkLength(topicVersion.getAuthorIpAddress(), 39);
1504: topicVersion.setEditComment(StringUtils.substring(topicVersion
1505: .getEditComment(), 0, 200));
1506: }
1507:
1508: /**
1509: *
1510: */
1511: protected void validateVirtualWiki(VirtualWiki virtualWiki)
1512: throws WikiException {
1513: checkLength(virtualWiki.getName(), 100);
1514: checkLength(virtualWiki.getDefaultTopicName(), 200);
1515: }
1516:
1517: /**
1518: *
1519: */
1520: protected void validateWatchlistEntry(String topicName)
1521: throws WikiException {
1522: checkLength(topicName, 200);
1523: }
1524:
1525: /**
1526: *
1527: */
1528: protected void validateWikiFile(WikiFile wikiFile)
1529: throws WikiException {
1530: checkLength(wikiFile.getFileName(), 200);
1531: checkLength(wikiFile.getUrl(), 200);
1532: checkLength(wikiFile.getMimeType(), 100);
1533: }
1534:
1535: /**
1536: *
1537: */
1538: protected void validateWikiFileVersion(
1539: WikiFileVersion wikiFileVersion) throws WikiException {
1540: checkLength(wikiFileVersion.getUrl(), 200);
1541: checkLength(wikiFileVersion.getMimeType(), 100);
1542: checkLength(wikiFileVersion.getAuthorIpAddress(), 39);
1543: wikiFileVersion.setUploadComment(StringUtils.substring(
1544: wikiFileVersion.getUploadComment(), 0, 200));
1545: }
1546:
1547: /**
1548: *
1549: */
1550: protected void validateWikiGroup(WikiGroup group)
1551: throws WikiException {
1552: checkLength(group.getName(), 30);
1553: group.setDescription(StringUtils.substring(group
1554: .getDescription(), 0, 200));
1555: }
1556:
1557: /**
1558: *
1559: */
1560: protected void validateWikiUser(WikiUser user) throws WikiException {
1561: checkLength(user.getUsername(), 100);
1562: checkLength(user.getDisplayName(), 100);
1563: checkLength(user.getCreateIpAddress(), 39);
1564: checkLength(user.getLastLoginIpAddress(), 39);
1565: checkLength(user.getDefaultLocale(), 8);
1566: // do not throw exception containing password info
1567: if (user.getPassword() != null
1568: && user.getPassword().length() > 100) {
1569: throw new WikiException(new WikiMessage(
1570: "error.fieldlength", "-", "100"));
1571: }
1572: }
1573:
1574: /**
1575: *
1576: */
1577: protected void validateWikiUserInfo(WikiUserInfo userInfo)
1578: throws WikiException {
1579: checkLength(userInfo.getUsername(), 100);
1580: checkLength(userInfo.getEmail(), 100);
1581: checkLength(userInfo.getFirstName(), 100);
1582: checkLength(userInfo.getLastName(), 100);
1583: // do not throw exception containing password info
1584: if (userInfo.getEncodedPassword() != null
1585: && userInfo.getEncodedPassword().length() > 100) {
1586: throw new WikiException(new WikiMessage(
1587: "error.fieldlength", "-", "100"));
1588: }
1589: }
1590: }
|