[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/blogdirectory ...
Christian Bauer
christian at hibernate.org
Tue Aug 28 20:29:23 EDT 2007
User: cbauer
Date: 07/08/28 20:29:23
Modified: examples/wiki/src/main/org/jboss/seam/wiki/plugin/blogdirectory
BlogDirectory.java BlogDAO.java
Log:
First attempt at bloxsom importer
Revision Changes Path
1.15 +11 -0 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/blogdirectory/BlogDirectory.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BlogDirectory.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/blogdirectory/BlogDirectory.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -b -r1.14 -r1.15
--- BlogDirectory.java 25 Aug 2007 22:35:10 -0000 1.14
+++ BlogDirectory.java 29 Aug 2007 00:29:23 -0000 1.15
@@ -65,6 +65,7 @@
this.day = day;
}
private long numOfBlogEntries;
+ private long totalNumOfBlogEntries;
private List<BlogEntry> blogEntries;
private List<BlogEntryCount> blogEntryCountsByYearAndMonth;
// Need to expose this as a datamodel so Seam can convert our map to a collection of Map.Entry objects
@@ -100,6 +101,9 @@
private void queryBlogEntryCountsByYearAndMonth() {
blogEntryCountsByYearAndMonth = blogDAO.countAllBlogEntriesGroupByYearMonth(currentDirectory, currentDocument);
+ for (BlogEntryCount blogEntryCount : blogEntryCountsByYearAndMonth) {
+ totalNumOfBlogEntries = totalNumOfBlogEntries + blogEntryCount.getNumOfEntries();
+ }
}
@Factory(value = "recentBlogEntries")
@@ -148,6 +152,13 @@
}
}
+ public long getTotalNumOfBlogEntries() {
+ if (blogEntryCountsByYearAndMonth == null) {
+ queryBlogEntryCountsByYearAndMonth();
+ }
+ return totalNumOfBlogEntries;
+ }
+
public long getNumOfBlogEntries() {
return numOfBlogEntries;
}
1.4 +6 -2 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/blogdirectory/BlogDAO.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: BlogDAO.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/plugin/blogdirectory/BlogDAO.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- BlogDAO.java 25 Aug 2007 22:35:10 -0000 1.3
+++ BlogDAO.java 29 Aug 2007 00:29:23 -0000 1.4
@@ -42,7 +42,10 @@
queryString.append("and n1.nsLeft between n2.nsLeft and n2.nsRight").append(" ");
queryString.append("and n2.nsLeft > :startLeft and n2.nsRight < :startRight").append(" ");
queryString.append("and n2.class = :clazz").append(" ");
+
+ if (ignoreNode.getId() != null)
queryString.append("and not n1 = :ignoreNode").append(" ");
+
queryString.append("and not n1.pluginsUsed like '%blogDirectory%'").append(" ");
if (year != null) queryString.append("and year(n1.createdOn) = :limitYear").append(" ");
@@ -64,6 +67,7 @@
nestedSetQuery.setParameter("startLeft", startNode.getNsLeft());
nestedSetQuery.setParameter("startRight", startNode.getNsRight());
nestedSetQuery.setParameter("clazz", "DOCUMENT"); // TODO: Hibernate can't bind the discriminator? Not even with Hibernate.CLASS type...
+ if (ignoreNode.getId() != null)
nestedSetQuery.setParameter("ignoreNode", ignoreNode);
if (year != null) nestedSetQuery.setParameter("limitYear", year);
More information about the jboss-cvs-commits
mailing list