[jboss-svn-commits] JBL Code SVN: r38337 - in labs/jbossforums/branches/noejbforums130P27/forums/src: main/org/jboss/portlet/forums/search/bridge and 4 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri May 31 15:23:31 EDT 2013
Author: sviluppatorefico
Date: 2013-05-31 15:23:30 -0400 (Fri, 31 May 2013)
New Revision: 38337
Modified:
labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java
labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java
labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml
labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml
Log:
fixed the insert updte problems for topics and forums
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2013-05-31 19:23:30 UTC (rev 38337)
@@ -710,9 +710,11 @@
try
{
Session session = getSession();
-
- session.save(poster);
- session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required for clustered versions
+
+ if (poster.getId() == null || session.get(PosterImpl.class, poster.getId()) == null)
+ session.persist(poster);
+ session.merge(poster);
+ // Luca Stancapiano - 8 feb 2008 - it is required for clustered versions
session.save(poll);
session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required for clustered versions
@@ -751,11 +753,15 @@
forum.addTopicSize();
forum.addPostSize();
-
+ session.merge(forum);
post.setTopic(topic);
session.save(post);
notificationEngine.scheduleForNotification(post.getId(), NotificationEngine.MODE_POST);
- session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required for clustered versions
+ try {
+ session.flush(); // Luca Stancapiano - 8 feb 2008 - it is required for clustered versions
+ } catch(Exception ex) {
+
+ }
return post;
}
catch (HibernateException e)
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/impl/PosterImpl.java 2013-05-31 19:23:30 UTC (rev 38337)
@@ -22,10 +22,8 @@
******************************************************************************/
package org.jboss.portlet.forums.impl;
-import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.jboss.portal.core.modules.ModuleConstants;
import org.jboss.portal.identity.IdentityException;
import org.jboss.portal.identity.NoSuchUserException;
import org.jboss.portal.identity.User;
@@ -75,7 +73,7 @@
{
try
{
- UserModule userModule = (UserModule)new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME);
+ UserModule userModule = PortalUtil.getUserModule();
user = userModule.findUserById(userId);
}
catch (NamingException e)
@@ -94,7 +92,10 @@
{
e.printStackTrace();
return null;
- }
+ } catch (Exception e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
}
return user;
}
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/search/bridge/UserNameTextBridge.java 2013-05-31 19:23:30 UTC (rev 38337)
@@ -22,11 +22,8 @@
******************************************************************************/
package org.jboss.portlet.forums.search.bridge;
-import javax.naming.InitialContext;
-
import org.apache.log4j.Logger;
import org.hibernate.search.bridge.builtin.StringBridge;
-import org.jboss.portal.core.modules.ModuleConstants;
import org.jboss.portal.identity.User;
import org.jboss.portal.identity.UserModule;
import org.jboss.portlet.forums.model.Poster;
@@ -45,7 +42,7 @@
try {
String id = poster.getUserId();
- UserModule userModule = (UserModule)new InitialContext().lookup(ModuleConstants.USERMODULE_JNDINAME);
+ UserModule userModule = PortalUtil.getUserModule();
User user = userModule.findUserById(id);
if (user != null) {
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/action/NewTopic.java 2013-05-31 19:23:30 UTC (rev 38337)
@@ -136,6 +136,8 @@
poll.setOptions(pollOptions);
validatePoll(poll);
}
+
+ poster.incrementPostCount();
//actually create the topic in this forum
//use this method when poll and attachments are actually integrated
@@ -148,8 +150,6 @@
(List)this.produceAttachments(this.attachments), //attachments
this.topicType
);
-
- poster.incrementPostCount();
//setup the navigation state
navState = Constants.SUCCESS;
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/main/org/jboss/portlet/forums/ui/view/ViewCategory.java 2013-05-31 19:23:30 UTC (rev 38337)
@@ -319,4 +319,4 @@
}
}
//-------------------------------------------------------------------------------------------------------------------------------------
-}
+}
\ No newline at end of file
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/category/viewcategory_body.xhtml 2013-05-31 19:23:30 UTC (rev 38337)
@@ -32,7 +32,6 @@
class="forumscontainer"
>
-<c:if test="#{category.initialized}">
<ui:composition template="/views/common/common.xhtml">
<ui:define name="mainContent">
<h:form>
@@ -42,7 +41,7 @@
<h:commandLink value="#{shared.mainPageName}" action="viewCategory"/>
- <c:if test="#{category.categories ne null and category.categorySelected eq true}" >
+ <c:if test="#{category.initialized and category.categories ne null and category.categorySelected eq true}" >
<ul>
<li>>
<c:forEach items="#{category.categories}" var="catrow">
@@ -227,5 +226,4 @@
</h:form>
</ui:define>
</ui:composition>
-</c:if>
</div>
Modified: labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml
===================================================================
--- labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml 2013-05-28 21:10:53 UTC (rev 38336)
+++ labs/jbossforums/branches/noejbforums130P27/forums/src/resources/portal-forums-war/views/topics/posting_new_body.xhtml 2013-05-31 19:23:30 UTC (rev 38337)
@@ -290,7 +290,7 @@
</div>
<div class="PostviewStyle">
-<h:form id="post" enctype="multipart/form-data">
+<h:form id="post">
<table border="0" cellpadding="5" cellspacing="0" width="100%" name="table" id="table" >
<!-- keeps the forum where this topic is being created in context, this is a control parameter -->
More information about the jboss-svn-commits
mailing list