rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
if (Environment.getBooleanValue(Environment.PROP_TOPIC_NON_ADMIN_TOPIC_MOVE) || user.getAdmin()) { pageInfo.setCanMove(true); }
} if (Environment.getBooleanValue(Environment.PROP_TOPIC_NON_ADMIN_TOPIC_MOVE) || (user != null && user.getAdmin())) { pageInfo.setCanMove(true);
protected void loadDefaults(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) { // load cached top area, nav bar, etc. try { this.buildLayout(request, next); } catch (Exception e) { logger.error("Unable to build default page layout", e); } // add link to user page and comments page WikiUs...
if (userId > 0) user = WikiBase.getHandler().lookupWikiUser(userId);
if (userId > 0) { user = WikiBase.getHandler().lookupWikiUser(userId); userInfo = WikiBase.getHandler().lookupWikiUserInfo(user.getLogin()); }
private void register(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { pageInfo.setSpecial(true); pageInfo.setAction(WikiPageInfo.ACTION_REGISTER); pageInfo.setPageTitle(new WikiMessage("register.title")); String virtualWikiName = Utilities.getVirtualWikiFromURI(request); W...
user.setEmail(request.getParameter("email"));
userInfo.setEmail(request.getParameter("email"));
private void register(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { pageInfo.setSpecial(true); pageInfo.setAction(WikiPageInfo.ACTION_REGISTER); pageInfo.setPageTitle(new WikiMessage("register.title")); String virtualWikiName = Utilities.getVirtualWikiFromURI(request); W...
user.setEncodedPassword(Encryption.encrypt(newPassword));
userInfo.setEncodedPassword(Encryption.encrypt(newPassword)); user.setRememberKey(Encryption.encrypt(newPassword));
private void register(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { pageInfo.setSpecial(true); pageInfo.setAction(WikiPageInfo.ACTION_REGISTER); pageInfo.setPageTitle(new WikiMessage("register.title")); String virtualWikiName = Utilities.getVirtualWikiFromURI(request); W...
WikiBase.getHandler().writeWikiUser(user);
WikiBase.getHandler().writeWikiUser(user, userInfo);
private void register(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { pageInfo.setSpecial(true); pageInfo.setAction(WikiPageInfo.ACTION_REGISTER); pageInfo.setPageTitle(new WikiMessage("register.title")); String virtualWikiName = Utilities.getVirtualWikiFromURI(request); W...
String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromURI(request);
virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { try { String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromURI(request); String stylesheet = JAMWikiServlet.getCachedContent(request, virtualWiki, Wi...
ModelAndView next = new ModelAndView("wiki"); viewError(request, next, e);
logger.error("Failure while loading stylesheet for virtualWiki " + virtualWiki, e);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { try { String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromURI(request); String stylesheet = JAMWikiServlet.getCachedContent(request, virtualWiki, Wi...
if (WIKI_USER_ID_HASH == null && userIdHashFile.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(userIdHashFile); WIKI_USER_ID_HASH.load(fis); } finally { if (fis != null) fis.close();
if (WIKI_USER_ID_HASH == null) { WIKI_USER_ID_HASH = new Properties(); if (userIdHashFile.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(userIdHashFile); WIKI_USER_ID_HASH.load(fis); } finally { if (fis != null) fis.close(); }
private void saveWikiUser(WikiUser user) throws Exception { if (user.getUserId() > NEXT_WIKI_USER_ID) { NEXT_WIKI_USER_ID = user.getUserId(); nextFileWrite(NEXT_WIKI_USER_ID, getPathFor(null, null, NEXT_WIKI_USER_ID_FILE)); } StringBuffer content = new StringBuffer(); content.append("<mediawiki xmlns=\"http://...
} else if (WIKI_USER_ID_HASH == null) { WIKI_USER_ID_HASH = new Properties();
private void saveWikiUser(WikiUser user) throws Exception { if (user.getUserId() > NEXT_WIKI_USER_ID) { NEXT_WIKI_USER_ID = user.getUserId(); nextFileWrite(NEXT_WIKI_USER_ID, getPathFor(null, null, NEXT_WIKI_USER_ID_FILE)); } StringBuffer content = new StringBuffer(); content.append("<mediawiki xmlns=\"http://...
} } Collection locks = fromHandler.getLockList(virtualWiki); for (Iterator lockIterator = locks.iterator(); lockIterator.hasNext();) { Topic topic = (Topic)lockIterator.next(); String topicName = topic.getName(); try { toHandler.lockTopic(virtualWiki, topicName, topic.getLockSessionKey()); } catch (Exception e) { logg...
public static void convert(PersistencyHandler fromHandler, PersistencyHandler toHandler) throws Exception { Collection virtualWikis = fromHandler.getVirtualWikiList(); for (Iterator virtualWikiIterator = virtualWikis.iterator(); virtualWikiIterator.hasNext();) { String virtualWiki = (String) virtualWikiIterator.ne...
public abstract boolean lockTopic(String virtualWiki, String topicName, String key) throws Exception;
public boolean lockTopic(String virtualWiki, String topicName, String key) throws Exception { Topic topic = lookupTopic(virtualWiki, topicName); if (topic == null) return true; if (topic.getLockSessionKey() != null) { if (topic.getLockSessionKey().equals(key)) { return true; } Timestamp expireDate = new Timestamp(to...
public abstract boolean lockTopic(String virtualWiki, String topicName, String key) throws Exception;
public abstract void unlockTopic(Topic topic) throws Exception;
public void unlockTopic(Topic topic) throws Exception { topic.setLockSessionKey(null); topic.setLockedDate(null); topic.setLockedBy(-1); addTopic(topic); }
public abstract void unlockTopic(Topic topic) throws Exception;
if (WikiBase.getInstance().getHandler() instanceof FileHandler) { unlockTopic(topic); }
public synchronized void write(Topic topic, TopicVersion topicVersion) throws Exception { int previousTopicVersionId = 0; if (topic.getTopicId() > 0) { TopicVersion oldVersion = lookupLastTopicVersion(topic.getVirtualWiki(), topic.getName()); if (oldVersion != null) previousTopicVersionId = oldVersion.getTopicVe...
next.addObject(WikiServlet.PARAMETER_ACTION, WikiServlet.ACTION_HISTORY);
next.addObject(JAMController.PARAMETER_ACTION, JAMController.ACTION_HISTORY);
private void history(HttpServletRequest request, ModelAndView next) throws Exception { PersistencyHandler handler; String virtualWiki = JAMController.getVirtualWikiFromURI(request); String topicName = JAMController.getTopicFromRequest(request); try { handler = WikiBase.getInstance().getHandler(); String type =...
if (vetoListener == null) { throw new IllegalArgumentException("VetoListener cannot be null."); }
public boolean subscribeVetoListenerWeakly(Class eventClass, VetoEventListener vetoListener) { return subscribeVetoListener(eventClass, vetoListenersByClass, new WeakReference(vetoListener)); }
String url = Utilities.buildInternalLink(context, virtualWiki, topic);
String section = ""; pos = topic.indexOf('#'); if (pos > 0) { section = topic.substring(pos+1).trim(); topic = topic.substring(0, pos).trim(); } String url = Utilities.buildInternalLink(context, virtualWiki, topic, section);
protected static String buildWikiLink(String context, String virtualWiki, String raw) { if (raw == null || raw.length() <= 4) { // no topic, display the raw text return raw; } // strip the first and last brackets String topic = raw.substring(2, raw.length() - 2).trim(); if (topic.length() <= 0) { // empty b...
return (request.getParameter("lastTopicVersionId") == null) ? topic.getCurrentVersionId() : new Integer(request.getParameter("lastTopicVersionId"));
return (!StringUtils.hasText(request.getParameter("lastTopicVersionId"))) ? topic.getCurrentVersionId() : new Integer(request.getParameter("lastTopicVersionId"));
private Integer retrieveLastTopicVersionId(HttpServletRequest request, Topic topic) throws Exception { return (request.getParameter("lastTopicVersionId") == null) ? topic.getCurrentVersionId() : new Integer(request.getParameter("lastTopicVersionId")); }
Topic childTopic = lookupTopic(category.getVirtualWiki(), category.getChildTopicName(), false, conn);
Topic childTopic = this.lookupTopic(category.getVirtualWiki(), category.getChildTopicName(), false, conn);
private void addCategory(Category category, Connection conn) throws Exception { Topic childTopic = lookupTopic(category.getVirtualWiki(), category.getChildTopicName(), false, conn); int childTopicId = childTopic.getTopicId(); this.queryHandler().insertCategory(childTopicId, category.getName(), category.getSortKey()...
public static Vector convertFromFile(WikiUser user, Locale locale, FileHandler fromHandler, AnsiDataHandler toHandler) throws Exception {
public static Vector convertFromFile(WikiUser user, Locale locale, FileHandler fromHandler, AnsiDataHandler toHandler, Object transactionObject) throws Exception {
public static Vector convertFromFile(WikiUser user, Locale locale, FileHandler fromHandler, AnsiDataHandler toHandler) throws Exception { Connection conn = null; try { toHandler.setup(locale, user); WikiCache.removeCache(CACHE_VIRTUAL_WIKI); conn = WikiDatabase.getConnection(); // FIXME - hard coding of mess...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public static Vector convertFromFile(WikiUser user, Locale locale, FileHandler fromHandler, AnsiDataHandler toHandler) throws Exception { Connection conn = null; try { toHandler.setup(locale, user); WikiCache.removeCache(CACHE_VIRTUAL_WIKI); conn = WikiDatabase.getConnection(); // FIXME - hard coding of mess...
toHandler.reloadRecentChanges();
toHandler.reloadRecentChanges(conn);
public static Vector convertFromFile(WikiUser user, Locale locale, FileHandler fromHandler, AnsiDataHandler toHandler) throws Exception { Connection conn = null; try { toHandler.setup(locale, user); WikiCache.removeCache(CACHE_VIRTUAL_WIKI); conn = WikiDatabase.getConnection(); // FIXME - hard coding of mess...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public static Vector convertFromFile(WikiUser user, Locale locale, FileHandler fromHandler, AnsiDataHandler toHandler) throws Exception { Connection conn = null; try { toHandler.setup(locale, user); WikiCache.removeCache(CACHE_VIRTUAL_WIKI); conn = WikiDatabase.getConnection(); // FIXME - hard coding of mess...
TopicVersion version1 = lookupTopicVersion(topicName, topicVersionId1); TopicVersion version2 = lookupTopicVersion(topicName, topicVersionId2);
TopicVersion version1 = lookupTopicVersion(topicName, topicVersionId1, null); TopicVersion version2 = lookupTopicVersion(topicName, topicVersionId2, null);
public Collection diff(String topicName, int topicVersionId1, int topicVersionId2) throws Exception { TopicVersion version1 = lookupTopicVersion(topicName, topicVersionId1); TopicVersion version2 = lookupTopicVersion(topicName, topicVersionId2); if (version1 == null && version2 == null) { String msg = "Versions "...
public Collection getVirtualWikiList() throws Exception {
public Collection getVirtualWikiList(Object transactionObject) throws Exception {
public Collection getVirtualWikiList() throws Exception { Connection conn = null; Vector results = new Vector(); try { conn = WikiDatabase.getConnection(); WikiResultSet rs = this.queryHandler().getVirtualWikis(conn); while (rs.next()) { VirtualWiki virtualWiki = initVirtualWiki(rs); results.add(virtual...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public Collection getVirtualWikiList() throws Exception { Connection conn = null; Vector results = new Vector(); try { conn = WikiDatabase.getConnection(); WikiResultSet rs = this.queryHandler().getVirtualWikis(conn); while (rs.next()) { VirtualWiki virtualWiki = initVirtualWiki(rs); results.add(virtual...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public Collection getVirtualWikiList() throws Exception { Connection conn = null; Vector results = new Vector(); try { conn = WikiDatabase.getConnection(); WikiResultSet rs = this.queryHandler().getVirtualWikis(conn); while (rs.next()) { VirtualWiki virtualWiki = initVirtualWiki(rs); results.add(virtual...
public TopicVersion lookupTopicVersion(String topicName, int topicVersionId) throws Exception {
public TopicVersion lookupTopicVersion(String topicName, int topicVersionId, Object transactionObject) throws Exception {
public TopicVersion lookupTopicVersion(String topicName, int topicVersionId) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); return this.lookupTopicVersion(topicName, topicVersionId, conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } final...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public TopicVersion lookupTopicVersion(String topicName, int topicVersionId) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); return this.lookupTopicVersion(topicName, topicVersionId, conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } final...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public TopicVersion lookupTopicVersion(String topicName, int topicVersionId) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); return this.lookupTopicVersion(topicName, topicVersionId, conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } final...
Collection virtualWikis = this.getVirtualWikiList();
Collection virtualWikis = this.getVirtualWikiList(null);
public VirtualWiki lookupVirtualWiki(String virtualWikiName) throws Exception { VirtualWiki virtualWiki = (VirtualWiki)WikiCache.retrieveFromCache(CACHE_VIRTUAL_WIKI, virtualWikiName); if (virtualWiki != null) { return virtualWiki; } Collection virtualWikis = this.getVirtualWikiList(); for (Iterator iterator = ...
Collection virtualWikis = this.getVirtualWikiList();
Collection virtualWikis = this.getVirtualWikiList(null);
public String lookupVirtualWikiName(int virtualWikiId) throws Exception { VirtualWiki virtualWiki = (VirtualWiki)WikiCache.retrieveFromCache(CACHE_VIRTUAL_WIKI, virtualWikiId); if (virtualWiki != null) { return virtualWiki.getName(); } Collection virtualWikis = this.getVirtualWikiList(); for (Iterator iterator ...
public void moveTopic(Topic fromTopic, TopicVersion fromVersion, String destination) throws Exception {
public void moveTopic(Topic fromTopic, TopicVersion fromVersion, String destination, Object transactionObject) throws Exception {
public void moveTopic(Topic fromTopic, TopicVersion fromVersion, String destination) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); if (!this.canMoveTopic(fromTopic, destination)) { throw new WikiException(new WikiMessage("move.exception.destinationexists", destination))...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public void moveTopic(Topic fromTopic, TopicVersion fromVersion, String destination) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); if (!this.canMoveTopic(fromTopic, destination)) { throw new WikiException(new WikiMessage("move.exception.destinationexists", destination))...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public void moveTopic(Topic fromTopic, TopicVersion fromVersion, String destination) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); if (!this.canMoveTopic(fromTopic, destination)) { throw new WikiException(new WikiMessage("move.exception.destinationexists", destination))...
public void reloadRecentChanges() throws Exception {
public void reloadRecentChanges(Object transactionObject) throws Exception {
public void reloadRecentChanges() throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); this.queryHandler().reloadRecentChanges(conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } finally { WikiDatabase.releaseConnection(conn); } }
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public void reloadRecentChanges() throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); this.queryHandler().reloadRecentChanges(conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } finally { WikiDatabase.releaseConnection(conn); } }
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public void reloadRecentChanges() throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); this.queryHandler().reloadRecentChanges(conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } finally { WikiDatabase.releaseConnection(conn); } }
public void setupSpecialPages(Locale locale, WikiUser user, VirtualWiki virtualWiki) throws Exception {
public void setupSpecialPages(Locale locale, WikiUser user, VirtualWiki virtualWiki, Object transactionObject) throws Exception {
public void setupSpecialPages(Locale locale, WikiUser user, VirtualWiki virtualWiki) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); // create the default topics WikiDatabase.setupSpecialPage(locale, virtualWiki.getName(), WikiBase.SPECIAL_PAGE_STARTING_POINTS, user, false...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public void setupSpecialPages(Locale locale, WikiUser user, VirtualWiki virtualWiki) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); // create the default topics WikiDatabase.setupSpecialPage(locale, virtualWiki.getName(), WikiBase.SPECIAL_PAGE_STARTING_POINTS, user, false...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public void setupSpecialPages(Locale locale, WikiUser user, VirtualWiki virtualWiki) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); // create the default topics WikiDatabase.setupSpecialPage(locale, virtualWiki.getName(), WikiBase.SPECIAL_PAGE_STARTING_POINTS, user, false...
public void undeleteTopic(Topic topic, TopicVersion topicVersion, boolean userVisible) throws Exception {
public void undeleteTopic(Topic topic, TopicVersion topicVersion, boolean userVisible, Object transactionObject) throws Exception {
public void undeleteTopic(Topic topic, TopicVersion topicVersion, boolean userVisible) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); this.undeleteTopic(topic, topicVersion, userVisible, conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } ...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public void undeleteTopic(Topic topic, TopicVersion topicVersion, boolean userVisible) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); this.undeleteTopic(topic, topicVersion, userVisible, conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } ...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public void undeleteTopic(Topic topic, TopicVersion topicVersion, boolean userVisible) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(); this.undeleteTopic(topic, topicVersion, userVisible, conn); } catch (Exception e) { DatabaseConnection.handleErrors(conn); throw e; } ...
public void updateSpecialPage(Locale locale, String virtualWiki, String topicName, WikiUser user, String ipAddress) throws Exception {
public void updateSpecialPage(Locale locale, String virtualWiki, String topicName, WikiUser user, String ipAddress, Object transactionObject) throws Exception {
public void updateSpecialPage(Locale locale, String virtualWiki, String topicName, WikiUser user, String ipAddress) throws Exception { logger.info("Updating special page " + virtualWiki + " / " + topicName); Connection conn = null; try { conn = WikiDatabase.getConnection(); String contents = Utilities.readSpeci...
conn = WikiDatabase.getConnection();
conn = WikiDatabase.getConnection(transactionObject);
public void updateSpecialPage(Locale locale, String virtualWiki, String topicName, WikiUser user, String ipAddress) throws Exception { logger.info("Updating special page " + virtualWiki + " / " + topicName); Connection conn = null; try { conn = WikiDatabase.getConnection(); String contents = Utilities.readSpeci...
WikiDatabase.releaseConnection(conn);
WikiDatabase.releaseConnection(conn, transactionObject);
public void updateSpecialPage(Locale locale, String virtualWiki, String topicName, WikiUser user, String ipAddress) throws Exception { logger.info("Updating special page " + virtualWiki + " / " + topicName); Connection conn = null; try { conn = WikiDatabase.getConnection(); String contents = Utilities.readSpeci...
WikiUser user = lookupWikiUser(topicVersion.getAuthorId().intValue(), conn);
WikiUser user = this.lookupWikiUser(topicVersion.getAuthorId().intValue(), conn);
public void writeTopic(Topic topic, TopicVersion topicVersion, ParserDocument parserDocument, boolean userVisible, Object transactionObject) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(transactionObject); Utilities.validateTopicName(topic.getName()); if (topic.getTopicId(...
addRecentChange(change, conn);
this.addRecentChange(change, conn);
public void writeTopic(Topic topic, TopicVersion topicVersion, ParserDocument parserDocument, boolean userVisible, Object transactionObject) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(transactionObject); Utilities.validateTopicName(topic.getName()); if (topic.getTopicId(...
String key = WikiCache.key(topic.getVirtualWiki(), topic.getName()); WikiCache.removeFromCache(WikiBase.CACHE_PARSED_TOPIC_CONTENT, key); WikiCache.removeFromCache(CACHE_TOPICS, key);
public void writeTopic(Topic topic, TopicVersion topicVersion, ParserDocument parserDocument, boolean userVisible, Object transactionObject) throws Exception { Connection conn = null; try { conn = WikiDatabase.getConnection(transactionObject); Utilities.validateTopicName(topic.getName()); if (topic.getTopicId(...
setUsername(request, response, next);
if (false) { notify(request, response, next); } username(request, response, next);
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView next = new ModelAndView("wiki"); JMController.buildLayout(request, next); setUsername(request, response, next); return next; }
public synchronized String cook(String context, String virtualWiki, BufferedReader in) throws Exception { String parserClass = Environment.getValue(Environment.PROP_PARSER_CLASS); logger.debug("Using parser: " + parserClass); Class clazz = Class.forName(parserClass); Class[] parameterTypes = null; Constructor construct...
public synchronized String cook(String context, String virtualWiki, String content) throws Exception { if (content == null) { return "";
public synchronized String cook(String context, String virtualWiki, BufferedReader in) throws Exception { String parserClass = Environment.getValue(Environment.PROP_PARSER_CLASS); logger.debug("Using parser: " + parserClass); Class clazz = Class.forName(parserClass); Class[] parameterTypes = null; Constructor con...
return parser.parseHTML(context, virtualWiki, raw.toString());
BufferedReader in = new BufferedReader(new StringReader(content)); return cook(context, virtualWiki, in);
public synchronized String cook(String context, String virtualWiki, BufferedReader in) throws Exception { String parserClass = Environment.getValue(Environment.PROP_PARSER_CLASS); logger.debug("Using parser: " + parserClass); Class clazz = Class.forName(parserClass); Class[] parameterTypes = null; Constructor con...
protected void addCategory(int childTopicId, String categoryName, String sortKey, Object[] params) throws Exception { throw new UnsupportedOperationException();
protected void addCategory(Category category, Object[] params) throws Exception { this.saveCategory(category);
protected void addCategory(int childTopicId, String categoryName, String sortKey, Object[] params) throws Exception { // FIXME - implement this throw new UnsupportedOperationException(); }
throw new UnsupportedOperationException();
String filename = categoryTopicFilename(topic.getName()); File categoryTopicFile = getPathFor(topic.getVirtualWiki(), CATEGORIES_DIR, CATEGORY_TOPICS_DIR, filename); Properties categoryTopicHash = new Properties(); if (categoryTopicFile.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(categoryTop...
protected void deleteTopicCategories(Topic topic, Object params[]) throws Exception { // FIXME - implement this throw new UnsupportedOperationException(); }
throw new UnsupportedOperationException();
String filename = categoryFilename(categoryName); File categoryFile = getPathFor(virtualWiki, CATEGORIES_DIR, filename); Properties categoryHash = new Properties(); if (categoryFile.exists()) { FileInputStream fis = null; try { fis = new FileInputStream(categoryFile); categoryHash.load(fis); } finally { if (fis != null...
public Collection lookupCategoryTopics(String virtualWiki, String categoryName, int topicType) throws Exception { // FIXME - implement this throw new UnsupportedOperationException(); }
throw new UnsupportedOperationException();
Collection topicNames = this.getAllTopicNames(virtualWiki); Collection results = new Vector(); for (Iterator topicIterator = topicNames.iterator(); topicIterator.hasNext();) { String topicName = (String)topicIterator.next(); Topic topic = lookupTopic(virtualWiki, topicName); if (topic.getTopicType() == topicType) { res...
public Collection lookupTopicByType(String virtualWiki, int topicType) throws Exception { // FIXME - implement this throw new UnsupportedOperationException(); }
WIKI_USER_ID_HASH.load(new FileInputStream(userIdHashFile));
FileInputStream fis = null; try { fis = new FileInputStream(userIdHashFile); WIKI_USER_ID_HASH.load(fis); } finally { if (fis != null) fis.close(); }
private static String retrieveWikiUserLogin(int userId) throws Exception { if (WIKI_USER_ID_HASH == null) { WIKI_USER_ID_HASH = new Properties(); File userIdHashFile = getPathFor(null, null, WIKI_USER_ID_HASH_FILE); if (userIdHashFile.exists()) { WIKI_USER_ID_HASH.load(new FileInputStream(userIdHashFile)); ...
WIKI_USER_ID_HASH.load(new FileInputStream(userIdHashFile));
FileInputStream fis = null; try { fis = new FileInputStream(userIdHashFile); WIKI_USER_ID_HASH.load(fis); } finally { if (fis != null) fis.close(); }
private void saveWikiUser(WikiUser user) throws Exception { if (user.getUserId() > NEXT_WIKI_USER_ID) { NEXT_WIKI_USER_ID = user.getUserId(); nextFileWrite(NEXT_WIKI_USER_ID, getPathFor(null, null, NEXT_WIKI_USER_ID_FILE)); } StringBuffer content = new StringBuffer(); content.append("<mediawiki xmlns=\"http://...
WIKI_USER_ID_HASH.store(new FileOutputStream(userIdHashFile), null);
FileOutputStream fos = null; try { fos = new FileOutputStream(userIdHashFile); WIKI_USER_ID_HASH.store(fos, null); } finally { if (fos != null) fos.close(); }
private void saveWikiUser(WikiUser user) throws Exception { if (user.getUserId() > NEXT_WIKI_USER_ID) { NEXT_WIKI_USER_ID = user.getUserId(); nextFileWrite(NEXT_WIKI_USER_ID, getPathFor(null, null, NEXT_WIKI_USER_ID_FILE)); } StringBuffer content = new StringBuffer(); content.append("<mediawiki xmlns=\"http://...
UiUtil.writeAttributes(out, attributes);
protected int doEndTag(Writer out) throws Exception { StringArrayRequestControl.ViewModel viewModel = ((StringArrayRequestControl.ViewModel) controlViewModel); UiUtil.writeOpenStartTag(out, "span"); UiUtil.writeAttribute(out, "class", getStyleClass()); UiUtil.writeAttribute(out, "style", getStyle()); UiUtil...
Topic childTopic = lookupTopic(category.getVirtualWiki(), category.getChildTopicName());
Topic childTopic = lookupTopic(category.getVirtualWiki(), category.getChildTopicName(), params);
protected void addCategory(Category category, Object[] params) throws Exception { Connection conn = (Connection)params[0]; Topic childTopic = lookupTopic(category.getVirtualWiki(), category.getChildTopicName()); int childTopicId = childTopic.getTopicId(); DatabaseHandler.queryHandler.insertCategory(childTopicId, c...
if (increment < 0 || (maxDimension > original.getWidth() && maxDimension > original.getHeight())) {
if (increment <= 0 || (maxDimension > original.getWidth() && maxDimension > original.getHeight())) {
public static BufferedImage resizeImage(WikiImage wikiImage, int maxDimension) throws Exception { File imageFile = new File(Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH), wikiImage.getUrl()); BufferedImage original = ImageUtil.loadImage(imageFile); maxDimension = calculateImageIncrement(maxDimension); ...
sql = "alter table jam_wiki_user ALTER COLUMN remember_key SET NOT NULL ";
if (Environment.getValue(Environment.PROP_DB_TYPE).equals(WikiBase.DATA_HANDLER_MYSQL)) { sql = "alter table jam_wiki_user MODIFY COLUMN remember_key VARCHAR(100) NOT NULL "; } else if (Environment.getValue(Environment.PROP_DB_TYPE).equals(WikiBase.DATA_HANDLER_MSSQL)) { sql = "alter table jam_wiki_user ALTER COLUMN re...
public static Vector upgrade050(Vector messages) throws Exception { Connection conn = null; try { conn = DatabaseConnection.getConnection(); conn.setAutoCommit(false); // add remember_key to jam_wiki_user String sql = "alter table jam_wiki_user add column remember_key VARCHAR(100) "; DatabaseConnection.exe...
history(request, next);
history(request, next, pageInfo);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { ModelAndView next = new ModelAndView("wiki"); try { if (!StringUtils.hasText(request.getParameter("topicVersionId"))) { history(request, next); } else { viewVersion(request, next); } } catch (Exception ...
viewVersion(request, next);
viewVersion(request, next, pageInfo);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { ModelAndView next = new ModelAndView("wiki"); try { if (!StringUtils.hasText(request.getParameter("topicVersionId"))) { history(request, next); } else { viewVersion(request, next); } } catch (Exception ...
viewError(request, next, e);
return viewError(request, e);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { ModelAndView next = new ModelAndView("wiki"); try { if (!StringUtils.hasText(request.getParameter("topicVersionId"))) { history(request, next); } else { viewVersion(request, next); } } catch (Exception ...
loadDefaults(request, next, this.pageInfo);
loadDefaults(request, next, pageInfo);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { ModelAndView next = new ModelAndView("wiki"); try { if (!StringUtils.hasText(request.getParameter("topicVersionId"))) { history(request, next); } else { viewVersion(request, next); } } catch (Exception ...
private void history(HttpServletRequest request, ModelAndView next) throws Exception {
private void history(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
private void history(HttpServletRequest request, ModelAndView next) throws Exception { String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromRequest(request); this.pageInfo.setPageAction(JAMWikiServlet.ACTION_HISTORY); this.pageInfo.setTopicName(topicName...
this.pageInfo.setPageAction(JAMWikiServlet.ACTION_HISTORY); this.pageInfo.setTopicName(topicName); this.pageInfo.setPageTitle(new WikiMessage("history.title", topicName));
pageInfo.setPageAction(JAMWikiServlet.ACTION_HISTORY); pageInfo.setTopicName(topicName); pageInfo.setPageTitle(new WikiMessage("history.title", topicName));
private void history(HttpServletRequest request, ModelAndView next) throws Exception { String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromRequest(request); this.pageInfo.setPageAction(JAMWikiServlet.ACTION_HISTORY); this.pageInfo.setTopicName(topicName...
private void viewVersion(HttpServletRequest request, ModelAndView next) throws Exception {
private void viewVersion(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception {
private void viewVersion(HttpServletRequest request, ModelAndView next) throws Exception { // display an older version String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromRequest(request); int topicVersionId = Integer.parseInt(request.getParameter("topi...
viewTopic(request, next, pageTitle, topic, false);
viewTopic(request, next, pageInfo, pageTitle, topic, false);
private void viewVersion(HttpServletRequest request, ModelAndView next) throws Exception { // display an older version String virtualWiki = JAMWikiServlet.getVirtualWikiFromURI(request); String topicName = JAMWikiServlet.getTopicFromRequest(request); int topicVersionId = Integer.parseInt(request.getParameter("topi...
usergroupType = "";
usergroupType = "0";
private void properties(HttpServletRequest request, ModelAndView next) throws Exception { next.addObject(JAMController.PARAMETER_ACTION, JAMController.ACTION_ADMIN); next.addObject(JAMController.PARAMETER_SPECIAL, new Boolean(true)); next.addObject(JAMController.PARAMETER_TITLE, "Special:Admin"); try { Encryptio...
JspUtil.writeEscaped(out, line.charAt(i));
JspUtil.writeEscaped(out, line.substring(i, i+1));
protected int doEndTag(Writer out) throws Exception { StringArrayRequestControl.ViewModel viewModel = ((StringArrayRequestControl.ViewModel) controlViewModel); JspUtil.writeOpenStartTag(out, "span"); JspUtil.writeAttribute(out, "class", getStyleClass()); JspUtil.writeAttribute(out, "style", getSty...
public void action(Path path, InputData input, OutputData output) {
public void action(Path path, InputData input, OutputData output) throws Exception {
public void action(Path path, InputData input, OutputData output) { actionCalled = true; this.path = path; this.input = input; this.output = output; }
super.action(path, input, output);
public void action(Path path, InputData input, OutputData output) { actionCalled = true; this.path = path; this.input = input; this.output = output; }
super.event(path, input);
public void event(Path path, InputData input) throws Exception { eventProcessed = true; this.path = path; this.input = input; }
public static int calculateImageIncrement(int maxDimension) {
private static int calculateImageIncrement(int maxDimension) {
public static int calculateImageIncrement(int maxDimension) { int increment = Environment.getIntValue(Environment.PROP_IMAGE_RESIZE_INCREMENT); double result = Math.ceil((double)maxDimension / (double)increment) * increment; return (int)result; }
public static BufferedImage imageToBufferedImage(Image image) throws Exception {
private static BufferedImage imageToBufferedImage(Image image) throws Exception {
public static BufferedImage imageToBufferedImage(Image image) throws Exception { BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB ); Graphics2D graphics = bufferedImage.createGraphics(); graphics.drawImage(image, 0, 0, null); graphics.dispose()...
public static BufferedImage loadImage(File file) throws Exception {
private static BufferedImage loadImage(File file) throws Exception {
public static BufferedImage loadImage(File file) throws Exception { FileInputStream fis = null; try { fis = new FileInputStream(file); return ImageIO.read(fis); } finally { if (fis != null) { try { fis.close(); } catch (Exception e) {} } } }
public static BufferedImage resizeImage(WikiImage wikiImage, int maxDimension) throws Exception {
private static BufferedImage resizeImage(WikiImage wikiImage, int maxDimension) throws Exception {
public static BufferedImage resizeImage(WikiImage wikiImage, int maxDimension) throws Exception { File imageFile = new File(Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH), wikiImage.getUrl()); BufferedImage original = ImageUtil.loadImage(imageFile); maxDimension = calculateImageIncrement(maxDimension); ...
public static void saveImage(BufferedImage image, File file) throws Exception {
private static void saveImage(BufferedImage image, File file) throws Exception {
public static void saveImage(BufferedImage image, File file) throws Exception { String filename = file.getName(); int pos = filename.lastIndexOf("."); if (pos == -1 || (pos + 1) >= filename.length()) { throw new Exception("Unknown image type " + filename); } String imageType = filename.substring(pos + 1); File...
personForm.writeBean((PersonMO) getGeneralDAO().getById(PersonMO.class, personId));
personForm.addBeanElement("salary", "#Salary", new FloatControl(), false); personForm.writeBean(getGeneralDAO().getById(PersonMO.class, personId));
protected void init() throws Exception { super.init(); setViewSelector("person/personView"); BeanFormWidget personForm = new BeanFormWidget(PersonMO.class); personForm.addBeanElement("name", "#First name", new DisplayControl(), true); personForm.addBeanElement("surname", "#Last name", new DisplayControl(), fals...
buffer.append("&action=").append(WikiServlet.ACTION_MEMBER);
buffer.append("&action=").append(JAMController.ACTION_MEMBER);
protected void mailMember(String username, HttpServletRequest request, WikiMember aMember, String email) { ResourceBundle messages = ResourceBundle.getBundle("ApplicationResources", request.getLocale()); // Send an email to the requester with the generated key logger.debug("Sending email to " + email); StringBuf...
DemoComplexForm.this.getMessageCtx().showInfoMessage("Value in multiselect has changed to " + (String)beastSelectionControl.getRawValue() + ".");
protected void init() throws Exception { super.init(); setViewSelector("demo/demoComplexForm"); putViewData("formLabel", "Complex_Form"); beastSelectionControl = new SelectControl(); /* SelectControls can be added DisplayItems, one by one ... */ beastSelectionControl.addItem(new DisplayItem(null, "-choose-"));...
DemoComplexForm.this.getMessageCtx().showInfoMessage("Value in multiselect has changed to " + (String)beastSelectionControl.getRawValue() + ".");
public void onChange() throws Exception { /* Form must be converted before new values can be read from form. As we want to be sure that entered data is valid (no random strings where numbers are expected, length and content constraints are met) we usually also validate data before using it for a...
setProperty(props, request, Environment.PROP_LDAP_CONTEXT); setProperty(props, request, Environment.PROP_LDAP_FACTORY_CLASS); setProperty(props, request, Environment.PROP_LDAP_FIELD_EMAIL); setProperty(props, request, Environment.PROP_LDAP_FIELD_FIRST_NAME); setProperty(props, request, Environment.PROP_LDAP_FIELD_LAST_...
private void properties(HttpServletRequest request, ModelAndView next, WikiPageInfo pageInfo) throws Exception { Properties props = new Properties(); try { setProperty(props, request, Environment.PROP_BASE_DEFAULT_TOPIC); setProperty(props, request, Environment.PROP_BASE_LOGO_IMAGE); setProperty(props, request...
beastSelectionControl.addItem(new DisplayItem("-choose-", "-choose-"));
beastSelectionControl.addItem(new DisplayItem(null, "-choose-"));
protected void init() throws Exception { super.init(); setViewSelector("demo/demoComplexForm"); putViewData("formLabel", "Complex_Form"); beastSelectionControl = new SelectControl(); /* SelectControls can be added DisplayItems, one by one ... */ beastSelectionControl.addItem(new DisplayItem("-choose-", "-choos...
if (selectedBeast.equals("-choose-")) {
if (selectedBeast == null) {
protected void init() throws Exception { super.init(); setViewSelector("demo/demoComplexForm"); putViewData("formLabel", "Complex_Form"); beastSelectionControl = new SelectControl(); /* SelectControls can be added DisplayItems, one by one ... */ beastSelectionControl.addItem(new DisplayItem("-choose-", "-choos...
complexForm.addElement("beastSelection", "#Nature's Beasts", beastSelectionControl, new StringData(), true);
complexForm.addElement("beastSelection", "#Nature's Beasts", beastSelectionControl, new StringData(), false);
protected void init() throws Exception { super.init(); setViewSelector("demo/demoComplexForm"); putViewData("formLabel", "Complex_Form"); beastSelectionControl = new SelectControl(); /* SelectControls can be added DisplayItems, one by one ... */ beastSelectionControl.addItem(new DisplayItem("-choose-", "-choos...
if (selectedBeast.equals("-choose-")) {
if (selectedBeast == null) {
public void onChange() throws Exception { /* Form must be converted before new values can be read from form. As we want to be sure that entered data is valid (no random strings where numbers are expected, length and content constraints are met) we usually also validate data before using it for a...
return;
private void redirect(HttpServletRequest request, HttpServletResponse response, String url) throws IOException, ServletException { response.sendRedirect(url); return; }
wikiFile.setMimeType(item.getContentType());
private void upload(HttpServletRequest request, ModelAndView next) throws Exception { // FIXME - this method is a mess and needs to be split up. File file = new File(Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH)); if (!file.exists()) { // FIXME - hard coding throw new Exception("Uploads not supporte...
wikiFileVersion.setMimeType(context.getMimeType(fileName));
wikiFileVersion.setMimeType(contentType); wikiFile.setMimeType(contentType);
private void upload(HttpServletRequest request, ModelAndView next) throws Exception { // FIXME - this method is a mess and needs to be split up. File file = new File(Environment.getValue(Environment.PROP_FILE_DIR_FULL_PATH)); if (!file.exists()) { // FIXME - hard coding throw new Exception("Uploads not supporte...
super.doStartTag(out); UiAttributedTagInterface attributedTag = (UiAttributedTagInterface)requireContextEntry(UiPresentationTag.ATTRIBUTED_TAG_KEY); attributedTag.addAttribute(name, value); return SKIP_BODY; }
super.doStartTag(out); String elementKey = (String)getContextEntry(UiAttributedTagInterface.HTML_ELEMENT_KEY); if (elementKey != null) { writeAttributeScript(out, elementKey); return SKIP_BODY; } UiAttributedTagInterface attributedTag = (UiAttributedTagInterface)requireContextEntry(UiPresentationTag.ATTRIBUTED_TAG_KE...
protected int doStartTag(Writer out) throws Exception { super.doStartTag(out); UiAttributedTagInterface attributedTag = (UiAttributedTagInterface)requireContextEntry(UiPresentationTag.ATTRIBUTED_TAG_KEY); attributedTag.addAttribute(name, value); // Continue return SKIP_BODY; }
out.write("<button type=\"button\">" + JspUtil.getResourceString(pageContext, "button.search").toUpperCase(JspUtil.getLocalizationContext(pageContext).getLocale()) + "</button>");
out.write("<button type=\"button\">" + JspUtil.getResourceString(pageContext, "button.search").toUpperCase(getLocalizationContext().getLocale()) + "</button>");
public int doStartTag(Writer out) throws Exception { addAttribute("style", getStyle()); super.doStartTag(out); out.write("<button type=\"button\">" + JspUtil.getResourceString(pageContext, "button.search").toUpperCase(JspUtil.getLocalizationContext(pageContext).getLocale()) + "</button>"); FormEnterKeyboa...
query += "&amp;topic=" + Utilities.encodeURL(topic);
query += "&amp;topic=" + Utilities.encodeForURL(topic);
public static String buildEditLinkUrl(String context, String virtualWiki, String topic, String query, int section) throws Exception { if (StringUtils.hasText(query)) { if (!query.startsWith("?")) query = "?" + query; query += "&amp;topic=" + Utilities.encodeURL(topic); } else { query = "?topic=" + Utilities.en...
query = "?topic=" + Utilities.encodeURL(topic);
query = "?topic=" + Utilities.encodeForURL(topic);
public static String buildEditLinkUrl(String context, String virtualWiki, String topic, String query, int section) throws Exception { if (StringUtils.hasText(query)) { if (!query.startsWith("?")) query = "?" + query; query += "&amp;topic=" + Utilities.encodeURL(topic); } else { query = "?topic=" + Utilities.en...
return Utilities.encodeURL(section);
return Utilities.encodeForURL(section);
public static String extractLinkSection(String text) { int pos = text.indexOf('#'); if (pos == -1 || text.length() <= pos) return null; String section = text.substring(pos+1).trim(); return Utilities.encodeURL(section); }
return Utilities.decodeURL(topic.trim());
return Utilities.decodeFromRequest(topic.trim());
public static String extractLinkTopic(String text) { String topic = text; int pos = topic.indexOf("#"); if (pos == 0) { // no topic, just a section return ""; } if (pos != -1) { topic = topic.substring(0, pos); } pos = text.indexOf('?'); if (pos > 0) { topic = text.substring(0, pos).trim(); } // conv...
if (register(request, response, next, pageInfo)) { return null; }
register(request, next, pageInfo);
public ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) { ModelAndView next = new ModelAndView("wiki"); WikiPageInfo pageInfo = new WikiPageInfo(); try { if (request.getParameter("function") != null) { if (register(request, response, next, pageInfo)) { // FIXME -...