You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/11/17 02:15:41 UTC
svn commit: r476014 - in /incubator/roller/trunk:
src/org/apache/roller/business/WeblogManager.java
src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
tests/org/apache/roller/business/WeblogEntryTest.java
Author: agilliland
Date: Thu Nov 16 17:15:40 2006
New Revision: 476014
URL: http://svn.apache.org/viewvc?view=rev&rev=476014
Log:
Cleaning up WeblogManager.
- removed method getNextEntries(entry, cat, locale) because it wasn't really being used
- removed method getPreviousEntries(entry, cat, locale) because it wasn't really being used
- removed getWeblogLastPublishTime() methods because we now have a lastModified attribute stored for each weblog.
Modified:
incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java
incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java
Modified: incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java?view=diff&rev=476014&r1=476013&r2=476014
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/WeblogManager.java Thu Nov 16 17:15:40 2006
@@ -181,43 +181,15 @@
*/
public WeblogEntryData getPreviousEntry(WeblogEntryData current,
String catName, String locale) throws RollerException;
-
- /**
- * Get entries next after current entry.
- * @param entry Current entry.
- * @param catName Only return entries in this category (if not null).
- * @param maxEntries Maximum number of entries to return.
- */
- public List getNextEntries(WeblogEntryData entry,
- String catName, String locale, int maxEntries) throws RollerException;
-
- /**
- * Get entries previous to current entry.
- * @param entry Current entry.
- * @param catName Only return entries in this category (if not null).
- * @param maxEntries Maximum number of entries to return.
- */
- public List getPreviousEntries(WeblogEntryData entry,
- String catName, String locale, int maxEntries) throws RollerException;
+
/**
* Get specified number of most recent pinned and published Weblog Entries.
* @param max Maximum number to return.
* @return Collection of WeblogEntryData objects.
*/
- public List getWeblogEntriesPinnedToMain(Integer max) throws RollerException;
+ public List getWeblogEntriesPinnedToMain(Integer max) throws RollerException;
- /** Get time of last update for a weblog specified by username */
- public Date getWeblogLastPublishTime(WebsiteData website) throws RollerException;
-
- /**
- * Gets returns most recent pubTime, optionally restricted by category.
- * @param handle Handle of website or null for all users
- * @param catName Category name of posts or null for all categories
- * @return Date Of last publish time
- */
- public Date getWeblogLastPublishTime(WebsiteData website, String catName )
- throws RollerException;
/**
* Save weblog category.
Modified: incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java?view=diff&rev=476014&r1=476013&r2=476014
==============================================================================
--- incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java (original)
+++ incubator/roller/trunk/src/org/apache/roller/business/hibernate/HibernateWeblogManagerImpl.java Thu Nov 16 17:15:40 2006
@@ -539,47 +539,9 @@
}
}
- public Date getWeblogLastPublishTime(WebsiteData website, String catName)
- throws RollerException {
- WeblogCategoryData cat = null;
-
- if (catName != null && website != null) {
- cat = getWeblogCategoryByPath(website, null, catName);
- if (cat == null) catName = null;
- }
- if (catName != null && catName.trim().equals("/")) {
- catName = null;
- }
-
- try {
- Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
- Criteria criteria = session.createCriteria(WeblogEntryData.class);
- criteria.add(Expression.eq("status", WeblogEntryData.PUBLISHED));
- criteria.add(Expression.le("pubTime", new Date()));
-
- if (website != null) {
- criteria.add(Expression.eq("website", website));
- }
-
- if ( cat != null ) {
- criteria.add(Expression.eq("category", cat));
- }
-
- criteria.addOrder(Order.desc("pubTime"));
- criteria.setMaxResults(1);
- List list = criteria.list();
- if (list.size() > 0) {
- return ((WeblogEntryData)list.get(0)).getPubTime();
- } else {
- return null;
- }
- } catch (HibernateException e) {
- throw new RollerException(e);
- }
- }
public List getWeblogEntries(WeblogCategoryData cat, boolean subcats)
- throws RollerException {
+ throws RollerException {
try {
Session session = ((HibernatePersistenceStrategy)this.strategy).getSession();
@@ -954,15 +916,7 @@
return (WeblogEntryData) this.strategy.load(
id, WeblogEntryData.class);
}
-
- /**
- * Gets the Date of the latest Entry publish time, before the end of today,
- * for all WeblogEntries
- */
- public Date getWeblogLastPublishTime(WebsiteData website)
- throws RollerException {
- return getWeblogLastPublishTime(website, null);
- }
+
public Map getWeblogEntryObjectMap(
WebsiteData website,
@@ -1127,28 +1081,12 @@
}
- public List getNextEntries(WeblogEntryData current, String catName,
- String locale, int maxEntries)
- throws RollerException {
-
- return getNextPrevEntries(current, catName, locale, maxEntries, true);
- }
-
-
- public List getPreviousEntries(WeblogEntryData current, String catName,
- String locale, int maxEntries)
- throws RollerException {
-
- return getNextPrevEntries(current, catName, locale, maxEntries, false);
- }
-
-
public WeblogEntryData getNextEntry(WeblogEntryData current, String catName,
String locale)
throws RollerException {
WeblogEntryData entry = null;
- List entryList = getNextEntries(current, catName, locale, 1);
+ List entryList = getNextPrevEntries(current, catName, locale, 1, true);
if (entryList != null && entryList.size() > 0) {
entry = (WeblogEntryData)entryList.get(0);
}
@@ -1161,7 +1099,7 @@
throws RollerException {
WeblogEntryData entry = null;
- List entryList = getPreviousEntries(current, catName, locale, 1);
+ List entryList = getNextPrevEntries(current, catName, locale, 1, false);
if (entryList != null && entryList.size() > 0) {
entry = (WeblogEntryData)entryList.get(0);
}
Modified: incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java?view=diff&rev=476014&r1=476013&r2=476014
==============================================================================
--- incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java (original)
+++ incubator/roller/trunk/tests/org/apache/roller/business/WeblogEntryTest.java Thu Nov 16 17:15:40 2006
@@ -246,25 +246,11 @@
assertEquals(1, entries.size());
assertEquals(entry2, entries.get(0));
- // get next entries
- entries = null;
- entries = mgr.getNextEntries(entry1, null, null, 5);
- assertNotNull(entries);
- assertEquals(1, entries.size());
- assertEquals(entry2, entries.get(0));
-
// get next entry
entry = null;
entry = mgr.getNextEntry(entry1, null, null);
assertNotNull(entry);
assertEquals(entry2, entry);
-
- // get previous entries
- entries = null;
- entries = mgr.getPreviousEntries(entry2, null, null, 5);
- assertNotNull(entries);
- assertEquals(1, entries.size());
- assertEquals(entry1, entries.get(0));
// get previous entry
entry = null;