jive回复主题,post a reply

post.jsp line 80
i
f (reply); {
thread = forum.getThread(threadID);;
// a message ID might not be passed in. If this is the case, we're
// replying to the root message so get the message ID from the root
// message of the thread
if (messageID == -1L); {
parentMessage = thread.getRootMessage();;
messageID = parentMessage.getID();;
} else {
parentMessage = thread.getMessage(messageID);;
}
}

得到parentMessage 以后,就可以在parentMessage 后添加节点了(reply)

// if this is a reply, add it to the thread
if (reply); {
thread.addMessage(parentMessage,newMessage);;
}

thread.addMessage()
public void addMessage(ForumMessage parentMessage, ForumMessage newMessage);
throws UnauthorizedException
{
// Get the underlying DbForumMessage object.
DbForumMessage dbMessage = null;
if (newMessage instanceof ForumMessageProxy); {
ForumMessageProxy proxyMessage = (ForumMessageProxy);newMessage;
dbMessage = (DbForumMessage);proxyMessage.getProxiedForumMessage();;
}
else {
dbMessage = (DbForumMessage);newMessage;
}
DbForum dbForum = null;

boolean abortTransaction = false;
Connection con = null;
try {
con = ConnectionManager.getTransactionConnection();;
[b]
// Insert the message into the database.
dbMessage.insertIntoDb(this, parentMessage.getID();, con);;
}[/b]
// Check the moderation value of the message. If the value is above
// the visible threshold for the forum, then update the modified
// date of the thread and forum. Otherwise, we'll wait to update
// the modified dates to when the message is moderated to be visible.
dbForum = factory.cacheManager.forumCache.get(forumID);;
if (newMessage.getModerationValue(); >=
dbForum.getModerationMinMessageValue(););
{
long modifiedDate = newMessage.getModifiedDate();.getTime();;
updateModifiedDate(modifiedDate, con);;
dbForum.updateModifiedDate(modifiedDate, con);;
}
}
catch( Exception e ); {
e.printStackTrace();;
abortTransaction = true;
}
finally {
ConnectionManager.closeTransactionConnection(con, abortTransaction);;
}

// Thread count has been modified, remove thread and forum from cache.
factory.cacheManager.threadCache.remove(this.id);;
factory.cacheManager.forumCache.remove(this.forumID);;

// Expire the userMessageCountCache if this message was not posted
// anonymously.
if (!newMessage.isAnonymous();); {
factory.userMessageCountCache.remove(newMessage.getUser();.getID(););;
}

// If above the moderation threshold...
if (newMessage.getModerationValue(); >=
dbForum.getModerationMinMessageValue(););
{
// Notify the watch manager that the thread has been updated.
factory.watchManager.notifyWatches(this);;
// Notify the gateway manager of a new message.
// dbForum.getGatewayManager();.exportData(dbMessage);;
}
}


DBforumThread insertIntoDb(DbForumThread thread, long parentMessageID,



private static final String INSERT_MESSAGE =
"INSERT INTO bisMessage(messageID, parentMessageID, threadID, forumID, " +
"userID, subject, body, modValue, rewardPoints, creationDate, modifiedDate); " +
"VALUES(?,?,?,?,?,?,?,?,?,?,?);";
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值