[jboss-svn-commits] JBL Code SVN: r12023 - in labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums: impl and 1 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon May 21 11:10:55 EDT 2007
Author: unibrew
Date: 2007-05-21 11:10:55 -0400 (Mon, 21 May 2007)
New Revision: 12023
Modified:
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
Log:
[JBFORUMS-237] Now moderator panel shows all topics(announcements, stickies and normal).
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-05-21 15:10:10 UTC (rev 12022)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ForumsModule.java 2007-05-21 15:10:55 UTC (rev 12023)
@@ -90,8 +90,7 @@
throws ModuleException;
/**
- * Returns some topics of a forum that are not of a certain type
- * The topics are ordered by creation date from newest to oldest
+ * Returns topics that are ordered by creation date from newest to oldest.
*
* @param forum Forum in which we want to search for topics
* @param type Type to avoid
@@ -106,8 +105,36 @@
int perPage)
throws ModuleException;
+ /**
+ * Returns topics that are ordered by creation date from oldest to newest.
+ *
+ * @param forum Forum in which we want to search for topics
+ * @param start Index for fetching result
+ * @param perPage Number of result to return
+ * @return List of perPage topics ordered by creation date.
+ * @throws ModuleException Throws an excpetion if unable to find the topics.
+ */
+ List findTopicsAsc(Forum forum,
+ int start,
+ int perPage)
+ throws ModuleException;
/**
+ * Returns some topics of a forum that are not of a certain type
+ * The topics are ordered by creation date from newest to oldest
+ *
+ * @param forum Forum in which we want to search for topics
+ * @param start Index for fetching result
+ * @param perPage Number of result to return
+ * @return List of perPage topics ordered by opposite creation date.
+ * @throws ModuleException Throws an excpetion if unable to find the topics.
+ */
+ List findTopicsDesc(Forum forum,
+ int start,
+ int perPage)
+ throws ModuleException;
+
+ /**
* *
*
* @param forum Forum in which we want to search for topics
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-05-21 15:10:10 UTC (rev 12022)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/impl/ForumsModuleImpl.java 2007-05-21 15:10:55 UTC (rev 12023)
@@ -499,6 +499,45 @@
}
+ /**
+ *
+ * @param forum
+ * @param start
+ * @param perPage
+ * @param order
+ * @return
+ * @throws ModuleException
+ */
+ private List findTopics(Forum forum,
+ int start,
+ int perPage,
+ String order)
+ throws ModuleException
+ {
+ try
+ {
+ Session session = getSession();
+ Query query =
+ session.createQuery("from TopicImpl as t " +
+ "join fetch t.poster " +
+ "where t.forum = :forumid " +
+ "order by t.lastPostDate " + order);
+ query.setFirstResult(start);
+ query.setMaxResults(perPage);
+ query.setString("forumid", "" + forum.getId());
+ List list = query.list();
+ return list;
+ }
+ catch (HibernateException e)
+ {
+ String message = "Cannot find topics";
+ throw new ModuleException(message, e);
+ } catch (Exception e) {
+ String message = "Error while using ForumsModule.";
+ log.error(message, e);
+ throw new ModuleException(message, e);
+ }
+ }
public List findTopicsAsc(Forum forum,
int type,
@@ -518,7 +557,24 @@
{
return findTopics(forum, type, start, perPage, "desc");
}
+
+ public List findTopicsAsc(Forum forum,
+ int start,
+ int perPage)
+ throws ModuleException
+ {
+ return findTopics(forum, start, perPage, "asc");
+ }
+
+ public List findTopicsDesc(Forum forum,
+ int start,
+ int perPage)
+ throws ModuleException
+ {
+ return findTopics(forum, start, perPage, "desc");
+ }
+
public List findTopicsBefore(Forum forum,
int type,
int start,
Modified: labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java
===================================================================
--- labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2007-05-21 15:10:10 UTC (rev 12022)
+++ labs/jbossforums/branches/forums101P22/forums/src/main/org/jboss/portlet/forums/ui/action/ModeratorAction.java 2007-05-21 15:10:55 UTC (rev 12023)
@@ -480,7 +480,6 @@
try {
return fm.findTopicsDesc(forum,
- Constants.POST_NORMAL,
beginIndex,
pageSize);
} catch (ModuleException e) {
More information about the jboss-svn-commits
mailing list