<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title><![CDATA[Latest posts for the topic "Making post from another application"]]></title>
		<link>https://forum.andowson.com/posts/list/7.page</link>
		<description><![CDATA[Latest messages posted in the topic "Making post from another application"]]></description>
		<generator>JForum - http://www.jforum.net</generator>
			<item>
				<title>Making post from another application</title>
				<description><![CDATA[ Hi, 
<br>
<br>
I'm new to jforum. Does anyone know what is the best way to make a post from another web application? We have an existing web application that when a user post a message to the application, we want to make a post to our jforum without the user having to make a post twice. Does anyone have any suggestion? I tried to manually insert a record into the jforum_posts, jforum_posts_text, and jforum_topics table, but the post does not show up on jforum. 
<br>
<br>
Thanks.]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/555/1148.page</guid>
				<link>https://forum.andowson.com/posts/preList/555/1148.page</link>
				<pubDate><![CDATA[Wed, 28 Sep 2011 05:13:19]]> GMT</pubDate>
				<author><![CDATA[ jforumrookie]]></author>
			</item>
			<item>
				<title>回覆:Making post from another application</title>
				<description><![CDATA[ I don't have any experience on this kind of application. Here are some hints, you can try them yourself. 
<br>
1.You may reference the net.jforum.view.install.InstallAction.java's saveMessage() method: 
<br>
[code] 
<br>
 private void saveMessage(final Connection conn, final String subject, final String message, final int topicType, final int forumId, final int userId, final String sourceIp) 
<br>
 { 
<br>
 try { 
<br>
 ConfigLoader.createLoginAuthenticator(); 
<br>
 ConfigLoader.loadDaoImplementation(); 
<br>
 SystemGlobals.loadQueries(SystemGlobals.getValue(ConfigKeys.SQL_QUERIES_GENERIC)); 
<br>
 SystemGlobals.loadQueries(SystemGlobals.getValue(ConfigKeys.SQL_QUERIES_DRIVER)); 
<br>
<br>
 final JForumExecutionContext executionContext = JForumExecutionContext.get(); 
<br>
 executionContext.setConnection(conn); 
<br>
 JForumExecutionContext.set(executionContext); 
<br>
<br>
 final User user = new User(userId); 
<br>
<br>
 // Create topic 
<br>
 final Topic topic = new Topic(); 
<br>
 topic.setPostedBy(user); 
<br>
 topic.setTitle(subject); 
<br>
 topic.setTime(new Date()); 
<br>
 topic.setType(topicType); 
<br>
 topic.setForumId(forumId); 
<br>
<br>
 final TopicDAO topicDao = DataAccessDriver.getInstance().newTopicDAO(); 
<br>
 topicDao.addNew(topic); 
<br>
<br>
 // Create post 
<br>
 final Post post = new Post(); 
<br>
 post.setSubject(topic.getTitle()); 
<br>
 post.setTime(topic.getTime()); 
<br>
 post.setUserId(user.getId()); 
<br>
 post.setText(message); 
<br>
 post.setForumId(topic.getForumId()); 
<br>
 post.setSmiliesEnabled(true); 
<br>
 post.setHtmlEnabled(true); 
<br>
 post.setBbCodeEnabled(true); 
<br>
 post.setUserIp(sourceIp); 
<br>
 post.setTopicId(topic.getId()); 
<br>
<br>
 final PostDAO postDao = DataAccessDriver.getInstance().newPostDAO(); 
<br>
 postDao.addNew(post); 
<br>
<br>
 // Update topic 
<br>
 topic.setFirstPostId(post.getId()); 
<br>
 topic.setLastPostId(post.getId()); 
<br>
<br>
 topicDao.update(topic); 
<br>
 DataAccessDriver.getInstance().newUserDAO().incrementPosts(post.getUserId()); 
<br>
<br>
 // Update forum stats 
<br>
 final ForumDAO forumDao = DataAccessDriver.getInstance().newForumDAO(); 
<br>
 forumDao.incrementTotalTopics(forumId, 1); 
<br>
 forumDao.setLastPost(forumId, post.getId()); 
<br>
 } 
<br>
 finally { 
<br>
 final JForumExecutionContext executionContext = JForumExecutionContext.get(); 
<br>
 executionContext.setConnection(null); 
<br>
 JForumExecutionContext.set(executionContext); 
<br>
 } 
<br>
 } 
<br>
[/code] 
<br>
<br>
2.You may reference the net.jforum.api.integration.mail.pop.POPPostAction.java's insertMessages() method. 
<br>]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/555/1149.page</guid>
				<link>https://forum.andowson.com/posts/preList/555/1149.page</link>
				<pubDate><![CDATA[Wed, 28 Sep 2011 07:52:22]]> GMT</pubDate>
				<author><![CDATA[ andowson]]></author>
			</item>
			<item>
				<title>Re:Making post from another application</title>
				<description><![CDATA[ Thanks. Will give it a try.]]></description>
				<guid isPermaLink="true">https://forum.andowson.com/posts/preList/555/1150.page</guid>
				<link>https://forum.andowson.com/posts/preList/555/1150.page</link>
				<pubDate><![CDATA[Thu, 29 Sep 2011 01:11:29]]> GMT</pubDate>
				<author><![CDATA[ jforumrookie]]></author>
			</item>
	</channel>
</rss>