roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ganes...@apache.org
Subject svn commit: r768897 - in /roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger: business/ ui/rendering/model/ ui/rendering/pagers/
Date Mon, 27 Apr 2009 08:44:40 GMT
Author: ganeshmb
Date: Mon Apr 27 08:44:39 2009
New Revision: 768897

URL: http://svn.apache.org/viewvc?rev=768897&view=rev
Log:
Bug in atom feed for media file fixed.

Modified:
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManager.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/FeedModel.java
    roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManager.java?rev=768897&r1=768896&r2=768897&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManager.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManager.java
Mon Apr 27 08:44:39 2009
@@ -50,5 +50,7 @@
     public void moveMediaFiles(Collection<MediaFile> mediaFiles, MediaFileDirectory
directory) throws WebloggerException;
     public void moveMediaFile(MediaFile mediaFile, MediaFileDirectory directory) throws WebloggerException;
 
-	public void release();
+ 	public List<MediaFile> fetchRecentPublicMediaFiles(int length) throws WebloggerException;
+
+ 	public void release();
 }

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java?rev=768897&r1=768896&r2=768897&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/business/MediaFileManagerImpl.java
Mon Apr 27 08:44:39 2009
@@ -252,6 +252,21 @@
         }
 	}
 	
+ 	public List<MediaFile> fetchRecentPublicMediaFiles(int length) 
+ 	    throws WebloggerException {
+
+ 		List<Object> params = new ArrayList<Object>();
+        int size = 0;
+        StringBuffer queryString = new StringBuffer();
+        
+        queryString.append("SELECT m FROM MediaFile m WHERE m.sharedForGallery = true");
+        queryString.append(" order by m.dateUploaded");
+        Query query = persistenceStrategy.getDynamicQuery(queryString.toString());
+        query.setFirstResult(0);
+        query.setMaxResults(length);
+        return query.getResultList();
+ 	}
+ 	
 	public List<MediaFile> searchMediaFiles(Weblog weblog, MediaFileFilter filter) 
 	     throws WebloggerException {
         

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/FeedModel.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/FeedModel.java?rev=768897&r1=768896&r2=768897&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/FeedModel.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/model/FeedModel.java
Mon Apr 27 08:44:39 2009
@@ -223,7 +223,7 @@
             super(urlStrategy, urlStrategy.getWeblogFeedURL(feedRequest.getWeblog(), 
                     feedRequest.getLocale(), feedRequest.getType(),
                     feedRequest.getFormat(), null, null,
-                    null, false, true), feedRequest.getWeblog(), -1, feedRequest.getPage(),
DEFAULT_ENTRIES);
+                    null, false, true), feedRequest.getWeblog(), -1, feedRequest.getPage(),
10);
             this.feedRequest = feedRequest;
         }
         

Modified: roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java
URL: http://svn.apache.org/viewvc/roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java?rev=768897&r1=768896&r2=768897&view=diff
==============================================================================
--- roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java
(original)
+++ roller/branches/roller_mediablogging/apps/weblogger/src/java/org/apache/roller/weblogger/ui/rendering/pagers/MediaFilesPager.java
Mon Apr 27 08:44:39 2009
@@ -20,7 +20,6 @@
 
 import java.sql.Timestamp;
 import java.util.ArrayList;
-import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
 
@@ -28,12 +27,9 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.MediaFileManager;
 import org.apache.roller.weblogger.business.URLStrategy;
-import org.apache.roller.weblogger.business.Weblogger;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.MediaFile;
-import org.apache.roller.weblogger.pojos.MediaFileFilter;
 import org.apache.roller.weblogger.pojos.Weblog;
-import org.apache.roller.weblogger.pojos.MediaFileFilter.MediaFileOrder;
 
 
 /**
@@ -79,26 +75,13 @@
         
         if (this.mediaFiles == null) {
             // calculate offset
-            int offset = getPage() * length;
+            //int offset = getPage() * length;
             
             List<MediaFile> results = new ArrayList<MediaFile>();
             
-            Date startDate = null;
-            if(sinceDays > 0) {
-                Calendar cal = Calendar.getInstance();
-                cal.setTime(new Date());
-                cal.add(Calendar.DATE, -1 * sinceDays);
-                startDate = cal.getTime();
-            }
-            
             try {
-                Weblogger roller = WebloggerFactory.getWeblogger();
-                MediaFileManager mgr = roller.getMediaFileManager();
-                MediaFileFilter fileFilter = new MediaFileFilter();
-                fileFilter.setStartIndex(offset);
-                fileFilter.setLength(length + 1);
-                fileFilter.setOrder(MediaFileOrder.DATE_UPLOADED);
-                results = mgr.searchMediaFiles(weblog, fileFilter);
+                MediaFileManager mgr = WebloggerFactory.getWeblogger().getMediaFileManager();
+                results = mgr.fetchRecentPublicMediaFiles(length);
             } catch (Exception e) {
                 log.error("ERROR: fetching comment list", e);
             }



Mime
View raw message