[jboss-svn-commits] JBL Code SVN: r5203 - labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jul 20 14:30:57 EDT 2006
Author: szimano
Date: 2006-07-20 14:30:52 -0400 (Thu, 20 Jul 2006)
New Revision: 5203
Modified:
labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiCommon.java
Log:
pages wouldn't save it somebody was using global watch
Modified: labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiCommon.java
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiCommon.java 2006-07-20 16:40:32 UTC (rev 5202)
+++ labs/jbosslabs/trunk/portal-extensions/jbosswiki/wiki-common/src/java/org/jboss/wiki/WikiCommon.java 2006-07-20 18:30:52 UTC (rev 5203)
@@ -78,19 +78,22 @@
try {
InitialContext context = new InitialContext();
- //QueueSession sess = null;
- //Queue queue = null;
+ // QueueSession sess = null;
+ // Queue queue = null;
EMailNotifier notifer = null;
try {
- /*queue = (Queue) context.lookup("queue/wikiNotifications");
- QueueConnectionFactory factory = (QueueConnectionFactory) context
- .lookup("java:/ConnectionFactory");
- sess = factory.createQueueConnection().createQueueSession(
- false, QueueSession.AUTO_ACKNOWLEDGE);*/
+ /*
+ * queue = (Queue) context.lookup("queue/wikiNotifications");
+ * QueueConnectionFactory factory = (QueueConnectionFactory)
+ * context .lookup("java:/ConnectionFactory"); sess =
+ * factory.createQueueConnection().createQueueSession( false,
+ * QueueSession.AUTO_ACKNOWLEDGE);
+ */
- notifer = (EMailNotifier)context.lookup(EMailNotifier.class.getName());
-
- //if (sess != null) {
+ notifer = (EMailNotifier) context.lookup(EMailNotifier.class
+ .getName());
+
+ // if (sess != null) {
if (notifer != null) {
String notifs = page
.getMetaDataProperty(WatchListPlugin.WATCH_PROPERTY);
@@ -122,18 +125,25 @@
engine.refreshPage(page.getName(), page.getLangCode());
- WikiPage orgPage = engine.getByName(page.getName(),
- null, page.getLastVersion() - 1, page
- .getLangCode());
+ WikiPage orgPage;
+
+ if (page.getLastVersion() > 1) {
+ orgPage = engine.getByName(page.getName(),
+ null, page.getLastVersion() - 1, page
+ .getLangCode());
+ }
+ else {
+ orgPage = (WikiPage)page.clone();
+ }
WikiPage pageHtml = engine.getWikiType("htmlClear")
.process(page, wikiSession);
-
- WikiPage link = (WikiPage)page.clone();
- link.setContent("["+page.getName()+"]");
-
+
+ WikiPage link = (WikiPage) page.clone();
+ link.setContent("[" + page.getName() + "]");
+
String pageLink = engine.getWikiType("htmlClear")
- .process(link, wikiSession).getContent();
+ .process(link, wikiSession).getContent();
DifferenceEngine differenceEngine = new DifferenceEngine(
"UTF-8");
@@ -150,12 +160,16 @@
e);
}
- NotificationMsg notifMsg = new NotificationMsg(users,
- diffs + "<br /><hr />\n<br/>\nThis is notification of page: " + pageLink + "<br/>\n"
+ NotificationMsg notifMsg = new NotificationMsg(
+ users,
+ diffs
+ + "<br /><hr />\n<br/>\nThis is notification of page: "
+ + pageLink + "<br/>\n"
+ pageHtml.getContent(),
page.getName(), fromEmail, pageLink);
- //ObjectMessage msg = sess.createObjectMessage(notifMsg);
- //sess.createSender(queue).send(msg);
+ // ObjectMessage msg =
+ // sess.createObjectMessage(notifMsg);
+ // sess.createSender(queue).send(msg);
notifer.sendNotification(notifMsg);
}
} else {
@@ -163,9 +177,9 @@
}
} catch (CloneNotSupportedException e) {
log.error(e);
- }/* catch (JMSException e) {
- log.error(e);
- }*/
+ }/*
+ * catch (JMSException e) { log.error(e); }
+ */
} catch (NamingException e1) {
log.error(e1);
}
More information about the jboss-svn-commits
mailing list