roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r1588757 [13/25] - in /roller/branches/rome2/app/src: main/java/org/apache/roller/ main/java/org/apache/roller/planet/business/ main/java/org/apache/roller/planet/business/fetcher/ main/java/org/apache/roller/planet/business/jpa/ main/java/...
Date Sun, 20 Apr 2014 13:39:01 GMT
Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Entries.java Sun Apr 20 13:38:51 2014
@@ -23,7 +23,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -31,6 +31,7 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.WeblogEntryManager;
 import org.apache.roller.weblogger.pojos.WeblogCategory;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.pagers.EntriesPager;
 import org.apache.roller.weblogger.ui.struts2.util.KeyValueObject;
@@ -85,23 +86,21 @@ public class Entries extends UIAction {
             String status = getBean().getStatus();
             
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
-            List<WeblogEntry> rawEntries = wmgr.getWeblogEntries(
-                    getActionWeblog(),
-                    null,
-                    getBean().getStartDate(),
-                    getBean().getEndDate(),
-                    getBean().getCategoryPath(),
-                    getBean().getTags(),
-                    ("ALL".equals(status)) ? null : status,
-                    getBean().getText(),
-                    getBean().getSortBy(),
-                    null,
-                    null,
-                    getBean().getPage() * COUNT,
-                    COUNT + 1);
+            WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+            wesc.setWeblog(getActionWeblog());
+            wesc.setStartDate(getBean().getStartDate());
+            wesc.setEndDate(getBean().getEndDate());
+            wesc.setCatName(getBean().getCategoryName());
+            wesc.setTags(getBean().getTags());
+            wesc.setStatus("ALL".equals(status) ? null : status);
+            wesc.setText(getBean().getText());
+            wesc.setSortBy(getBean().getSortBy());
+            wesc.setOffset(getBean().getPage() * COUNT);
+            wesc.setMaxResults(COUNT + 1);
+            List<WeblogEntry> rawEntries = wmgr.getWeblogEntries(wesc);
             entries = new ArrayList<WeblogEntry>();
             entries.addAll(rawEntries);
-            if (entries != null && entries.size() > 0) {
+            if (entries.size() > 0) {
                 log.debug("query found "+rawEntries.size()+" results");
                 
                 if(rawEntries.size() > COUNT) {
@@ -109,8 +108,8 @@ public class Entries extends UIAction {
                     hasMore = true;
                 }
                 
-                setFirstEntry((WeblogEntry)entries.get(0));
-                setLastEntry((WeblogEntry)entries.get(entries.size()-1));
+                setFirstEntry(entries.get(0));
+                setLastEntry(entries.get(entries.size()-1));
             }
         } catch (WebloggerException ex) {
             log.error("Error looking up entries", ex);
@@ -129,10 +128,10 @@ public class Entries extends UIAction {
     // use the action data to build a url representing this action, including query data
     private String buildBaseUrl() {
         
-        Map<String, String> params = new HashMap();
+        Map<String, String> params = new HashMap<String, String>();
         
-        if(!StringUtils.isEmpty(getBean().getCategoryPath())) {
-            params.put("bean.categoryPath", getBean().getCategoryPath());
+        if(!StringUtils.isEmpty(getBean().getCategoryName())) {
+            params.put("bean.categoryPath", getBean().getCategoryName());
         }
         if(!StringUtils.isEmpty(getBean().getTagsAsString())) {
             params.put("bean.tagsAsString", getBean().getTagsAsString());
@@ -149,10 +148,10 @@ public class Entries extends UIAction {
         if(!StringUtils.isEmpty(getBean().getStatus())) {
             params.put("bean.status", getBean().getStatus());
         }
-        if(!StringUtils.isEmpty(getBean().getSortBy())) {
-            params.put("bean.sortBy", getBean().getSortBy());
+        if(getBean().getSortBy() != null) {
+            params.put("bean.sortBy", getBean().getSortBy().toString());
         }
-        
+
         return WebloggerFactory.getWeblogger().getUrlStrategy().getActionURL("entries", "/roller-ui/authoring", 
                 getActionWeblog().getHandle(), params, false);
     }
@@ -164,17 +163,16 @@ public class Entries extends UIAction {
     public List<WeblogCategory> getCategories() {
         // make list of categories with first option being being a transient
         // category just meant to represent the default option of any category
-        List<WeblogCategory> cats = new ArrayList();
+        List<WeblogCategory> cats = new ArrayList<WeblogCategory>();
         
         WeblogCategory tmpCat = new WeblogCategory();
         tmpCat.setName("Any");
-        tmpCat.setPath("");
         cats.add(tmpCat);
         
-        List<WeblogCategory> weblogCats = Collections.EMPTY_LIST;
+        List<WeblogCategory> weblogCats = Collections.emptyList();
         try {
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger().getWeblogEntryManager();
-            weblogCats = wmgr.getWeblogCategories(getActionWeblog(), false);
+            weblogCats = wmgr.getWeblogCategories(getActionWeblog());
         } catch (WebloggerException ex) {
             log.error("Error getting category list for weblog - "+getWeblog(), ex);
         }
@@ -186,16 +184,16 @@ public class Entries extends UIAction {
     
     
     public List<KeyValueObject> getSortByOptions() {
-        List<KeyValueObject> opts = new ArrayList();
+        List<KeyValueObject> opts = new ArrayList<KeyValueObject>();
         
-        opts.add(new KeyValueObject("pubTime", getText("weblogEntryQuery.label.pubTime")));
-        opts.add(new KeyValueObject("updateTime", getText("weblogEntryQuery.label.updateTime")));
+        opts.add(new KeyValueObject(WeblogEntrySearchCriteria.SortBy.PUBLICATION_TIME.toString(), getText("weblogEntryQuery.label.pubTime")));
+        opts.add(new KeyValueObject(WeblogEntrySearchCriteria.SortBy.UPDATE_TIME.toString(), getText("weblogEntryQuery.label.updateTime")));
         
         return opts;
     }
     
     public List<KeyValueObject> getStatusOptions() {
-        List<KeyValueObject> opts = new ArrayList();
+        List<KeyValueObject> opts = new ArrayList<KeyValueObject>();
         
         opts.add(new KeyValueObject("ALL", getText("weblogEntryQuery.label.allEntries")));
         opts.add(new KeyValueObject("DRAFT", getText("weblogEntryQuery.label.draftOnly")));

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntriesBean.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntriesBean.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntriesBean.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntriesBean.java Sun Apr 20 13:38:51 2014
@@ -22,7 +22,8 @@ import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.util.Utilities;
 
 
@@ -33,11 +34,11 @@ public class EntriesBean {
     
     private String endDateString = null;
     private String startDateString = null;
-    private String categoryPath = null;
+    private String categoryName = null;
     private String tagsAsString = null;
     private String text = null;
     private String status = "ALL";
-    private String sortBy = "updateTime";
+    private WeblogEntrySearchCriteria.SortBy sortBy = WeblogEntrySearchCriteria.SortBy.UPDATE_TIME;
     private int page = 0;
     
     
@@ -74,12 +75,12 @@ public class EntriesBean {
     }
     
     
-    public String getCategoryPath() {
-        return categoryPath;
+    public String getCategoryName() {
+        return categoryName;
     }
     
-    public void setCategoryPath(String categoryId) {
-        this.categoryPath = categoryId;
+    public void setCategoryName(String categoryId) {
+        this.categoryName = categoryId;
     }
     
     public String getTagsAsString() {
@@ -106,14 +107,10 @@ public class EntriesBean {
         this.status = status;
     }
     
-    public String getSortBy() {
+    public WeblogEntrySearchCriteria.SortBy getSortBy() {
         return sortBy;
     }
     
-    public void setSortBy(String sortBy) {
-        this.sortBy = sortBy;
-    }
-    
     public int getPage() {
         return page;
     }
@@ -130,7 +127,7 @@ public class EntriesBean {
         buf.append("endDate = ").append(getEndDate()).append("\n");
         buf.append("status = ").append(getStatus()).append("\n");
         buf.append("sortBy = ").append(getSortBy()).append("\n");
-        buf.append("catPath = ").append(getCategoryPath()).append("\n");
+        buf.append("catName = ").append(getCategoryName()).append("\n");
         buf.append("tags = ").append(getTagsAsString()).append("\n");
         buf.append("text = ").append(getText()).append("\n");
         buf.append("page = ").append(getPage()).append("\n");

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAdd.java Sun Apr 20 13:38:51 2014
@@ -26,7 +26,7 @@ import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.UserManager;
 import org.apache.roller.weblogger.business.WeblogEntryManager;
@@ -232,12 +232,12 @@ public final class EntryAdd extends Entr
 		try {
 			WeblogEntryManager wmgr = WebloggerFactory.getWeblogger()
 					.getWeblogEntryManager();
-			return wmgr.getWeblogCategories(getActionWeblog(), false);
+			return wmgr.getWeblogCategories(getActionWeblog());
 		} catch (WebloggerException ex) {
 			log.error(
 					"Error getting category list for weblog - " + getWeblog(),
 					ex);
-			return Collections.EMPTY_LIST;
+			return Collections.emptyList();
 		}
 	}
 

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryAddWithMediaFile.java Sun Apr 20 13:38:51 2014
@@ -17,7 +17,7 @@
  */
 package org.apache.roller.weblogger.ui.struts2.editor;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.business.MediaFileManager;

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBase.java Sun Apr 20 13:38:51 2014
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -30,6 +31,7 @@ import org.apache.roller.weblogger.busin
 import org.apache.roller.weblogger.business.plugins.entry.WeblogEntryPlugin;
 import org.apache.roller.weblogger.business.search.IndexManager;
 import org.apache.roller.weblogger.pojos.WeblogEntry;
+import org.apache.roller.weblogger.pojos.WeblogEntrySearchCriteria;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.core.RollerContext;
 import org.apache.roller.weblogger.ui.core.plugins.UIPluginManager;
@@ -41,173 +43,156 @@ import org.apache.roller.weblogger.ui.st
  */
 public abstract class EntryBase extends UIAction {
 
-	private static Log log = LogFactory.getLog(EntryBase.class);
+    private static Log log = LogFactory.getLog(EntryBase.class);
 
-	/**
-	 * Trigger reindexing of modified entry.
-	 * 
-	 * @param entry
-	 *            the entry
-	 */
-	protected void reindexEntry(WeblogEntry entry) {
-		IndexManager manager = WebloggerFactory.getWeblogger()
-				.getIndexManager();
-		try {
-			manager.addEntryReIndexOperation(entry);
-		} catch (WebloggerException ex) {
-			log.warn("Trouble triggering entry indexing", ex);
-		}
-	}
-
-	/**
-	 * Trigger reindexing of modified entry.
-	 */
-	protected void removeEntryIndex(WeblogEntry entry) {
-		IndexManager manager = WebloggerFactory.getWeblogger()
-				.getIndexManager();
-		try {
-			manager.removeEntryIndexOperation(entry);
-		} catch (WebloggerException ex) {
-			log.warn("Trouble triggering entry indexing", ex);
-		}
-
-	}
-
-	/**
-	 * Get recent weblog entries using request parameters to determine username,
-	 * date, and category name parameters.
-	 * 
-	 * @return List of WeblogEntryData objects.
-	 */
-	public List<WeblogEntry> getRecentPublishedEntries() {
-		List<WeblogEntry> entries = Collections.EMPTY_LIST;
-		try {
-			entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
-					.getWeblogEntries(
-
-					getActionWeblog(), // userName
-							null, null, // startDate
-							null, // endDate
-							null, // catName
-							null, WeblogEntry.PUBLISHED, // status
-							null, // text
-							null, // sortby (null for pubTime)
-							null, null, 0, 20);
-		} catch (WebloggerException ex) {
-			log.error("Error getting entries list", ex);
-		}
-		return entries;
-	}
-
-	/**
-	 * Get recent weblog entries using request parameters to determine username,
-	 * date, and category name parameters.
-	 * 
-	 * @return List of WeblogEntryData objects.
-	 */
-	public List<WeblogEntry> getRecentScheduledEntries() {
-		List<WeblogEntry> entries = Collections.EMPTY_LIST;
-		try {
-			entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
-					.getWeblogEntries(
-
-					getActionWeblog(), // userName
-							null, null, // startDate
-							null, // endDate
-							null, // catName
-							null, WeblogEntry.SCHEDULED, // status
-							null, // text
-							null, // sortby (null for pubTime)
-							null, null, 0, 20);
-		} catch (WebloggerException ex) {
-			log.error("Error getting entries list", ex);
-		}
-		return entries;
-	}
-
-	/**
-	 * Get recent weblog entries using request parameters to determine username,
-	 * date, and category name parameters.
-	 * 
-	 * @return List of WeblogEntryData objects.
-	 */
-	public List<WeblogEntry> getRecentDraftEntries() {
-		List<WeblogEntry> entries = Collections.EMPTY_LIST;
-		try {
-			entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
-					.getWeblogEntries(
-
-					getActionWeblog(), null, null, // startDate
-							null, // endDate
-							null, // catName
-							null, WeblogEntry.DRAFT, // status
-							null, // text
-							"updateTime", // sortby
-							null, null, 0, 20); // maxEntries
-		} catch (WebloggerException ex) {
-			log.error("Error getting entries list", ex);
-		}
-		return entries;
-	}
-
-	/**
-	 * Get recent weblog entries using request parameters to determine username,
-	 * date, and category name parameters.
-	 * 
-	 * @return List of WeblogEntryData objects.
-	 */
-	public List<WeblogEntry> getRecentPendingEntries() {
-		List<WeblogEntry> entries = Collections.EMPTY_LIST;
-		try {
-			entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
-					.getWeblogEntries(
-
-					getActionWeblog(), null, null, // startDate
-							null, // endDate
-							null, // catName
-							null, WeblogEntry.PENDING, // status
-							null, // text
-							"updateTime", // sortby
-							null, null, 0, 20);
-		} catch (WebloggerException ex) {
-			log.error("Error getting entries list", ex);
-		}
-		return entries;
-	}
-
-	public List<WeblogEntryPlugin> getEntryPlugins() {
-		List<WeblogEntryPlugin> availablePlugins = Collections.EMPTY_LIST;
-		try {
-			PluginManager ppmgr = WebloggerFactory.getWeblogger()
-					.getPluginManager();
-			Map<String, WeblogEntryPlugin> plugins = ppmgr
-					.getWeblogEntryPlugins(getActionWeblog());
-
-			if (plugins.size() > 0) {
-				availablePlugins = new ArrayList();
-				for (WeblogEntryPlugin plugin : plugins.values()) {
-					availablePlugins.add(plugin);
-				}
-			}
-		} catch (Exception ex) {
-			log.error("Error getting plugins list", ex);
-		}
-		return availablePlugins;
-	}
-
-	public WeblogEntryEditor getEditor() {
-		UIPluginManager pmgr = RollerContext.getUIPluginManager();
-		return pmgr.getWeblogEntryEditor(getActionWeblog().getEditorPage());
-	}
-
-	public boolean isUserAnAuthor() {
-		return getActionWeblog().hasUserPermission(getAuthenticatedUser(),
-				WeblogPermission.POST);
-	}
-
-	public String getJsonAutocompleteUrl() {
-		return WebloggerFactory.getWeblogger().getUrlStrategy()
-				.getWeblogTagsJsonURL(getActionWeblog(), false, 0);
-	}
+    /**
+     * Trigger reindexing of modified entry.
+     *
+     * @param entry the entry
+     */
+    protected void reindexEntry(WeblogEntry entry) {
+        IndexManager manager = WebloggerFactory.getWeblogger()
+                .getIndexManager();
+        try {
+            manager.addEntryReIndexOperation(entry);
+        } catch (WebloggerException ex) {
+            log.warn("Trouble triggering entry indexing", ex);
+        }
+    }
+
+    /**
+     * Trigger reindexing of modified entry.
+     */
+    protected void removeEntryIndex(WeblogEntry entry) {
+        IndexManager manager = WebloggerFactory.getWeblogger()
+                .getIndexManager();
+        try {
+            manager.removeEntryIndexOperation(entry);
+        } catch (WebloggerException ex) {
+            log.warn("Trouble triggering entry indexing", ex);
+        }
+
+    }
+
+    /**
+     * Get recent weblog entries using request parameters to determine username,
+     * date, and category name parameters.
+     *
+     * @return List of WeblogEntryData objects.
+     */
+    public List<WeblogEntry> getRecentPublishedEntries() {
+        List<WeblogEntry> entries = Collections.emptyList();
+        try {
+            WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+            wesc.setWeblog(getActionWeblog());
+            wesc.setStatus(WeblogEntry.PUBLISHED);
+            wesc.setMaxResults(20);
+            entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
+                    .getWeblogEntries(wesc);
+        } catch (WebloggerException ex) {
+            log.error("Error getting entries list", ex);
+        }
+        return entries;
+    }
+
+    /**
+     * Get recent weblog entries using request parameters to determine username,
+     * date, and category name parameters.
+     *
+     * @return List of WeblogEntryData objects.
+     */
+    public List<WeblogEntry> getRecentScheduledEntries() {
+        List<WeblogEntry> entries = Collections.emptyList();
+        try {
+            WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+            wesc.setWeblog(getActionWeblog());
+            wesc.setStatus(WeblogEntry.SCHEDULED);
+            wesc.setMaxResults(20);
+            entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
+                    .getWeblogEntries(wesc);
+        } catch (WebloggerException ex) {
+            log.error("Error getting entries list", ex);
+        }
+        return entries;
+    }
+
+    /**
+     * Get recent weblog entries using request parameters to determine username,
+     * date, and category name parameters.
+     *
+     * @return List of WeblogEntryData objects.
+     */
+    public List<WeblogEntry> getRecentDraftEntries() {
+        List<WeblogEntry> entries = Collections.emptyList();
+        try {
+            WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+            wesc.setWeblog(getActionWeblog());
+            wesc.setStatus(WeblogEntry.DRAFT);
+            wesc.setSortBy(WeblogEntrySearchCriteria.SortBy.UPDATE_TIME);
+            wesc.setMaxResults(20);
+            entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
+                    .getWeblogEntries(wesc);
+        } catch (WebloggerException ex) {
+            log.error("Error getting entries list", ex);
+        }
+        return entries;
+    }
+
+    /**
+     * Get recent weblog entries using request parameters to determine username,
+     * date, and category name parameters.
+     *
+     * @return List of WeblogEntryData objects.
+     */
+    public List<WeblogEntry> getRecentPendingEntries() {
+        List<WeblogEntry> entries = Collections.emptyList();
+        try {
+            WeblogEntrySearchCriteria wesc = new WeblogEntrySearchCriteria();
+            wesc.setWeblog(getActionWeblog());
+            wesc.setStatus(WeblogEntry.PENDING);
+            wesc.setSortBy(WeblogEntrySearchCriteria.SortBy.UPDATE_TIME);
+            wesc.setMaxResults(20);
+            entries = WebloggerFactory.getWeblogger().getWeblogEntryManager()
+                    .getWeblogEntries(wesc);
+        } catch (WebloggerException ex) {
+            log.error("Error getting entries list", ex);
+        }
+        return entries;
+    }
+
+    public List<WeblogEntryPlugin> getEntryPlugins() {
+        List<WeblogEntryPlugin> availablePlugins = Collections.emptyList();
+        try {
+            PluginManager ppmgr = WebloggerFactory.getWeblogger()
+                    .getPluginManager();
+            Map<String, WeblogEntryPlugin> plugins = ppmgr
+                    .getWeblogEntryPlugins(getActionWeblog());
+
+            if (plugins.size() > 0) {
+                availablePlugins = new ArrayList<WeblogEntryPlugin>();
+                for (WeblogEntryPlugin plugin : plugins.values()) {
+                    availablePlugins.add(plugin);
+                }
+            }
+        } catch (Exception ex) {
+            log.error("Error getting plugins list", ex);
+        }
+        return availablePlugins;
+    }
+
+    public WeblogEntryEditor getEditor() {
+        UIPluginManager pmgr = RollerContext.getUIPluginManager();
+        return pmgr.getWeblogEntryEditor(getActionWeblog().getEditorPage());
+    }
+
+    public boolean isUserAnAuthor() {
+        return getActionWeblog().hasUserPermission(getAuthenticatedUser(),
+                WeblogPermission.POST);
+    }
+
+    public String getJsonAutocompleteUrl() {
+        return WebloggerFactory.getWeblogger().getUrlStrategy()
+                .getWeblogTagsJsonURL(getActionWeblog(), false, 0);
+    }
 
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryBean.java Sun Apr 20 13:38:51 2014
@@ -18,7 +18,7 @@
 
 package org.apache.roller.weblogger.ui.struts2.editor;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -306,7 +306,7 @@ public class EntryBean {
             
             if(cat == null) {
                 throw new WebloggerException("Category could not be found - "+getCategoryId());
-            } else if(!entry.getWebsite().equals(cat.getWebsite())) {
+            } else if(!entry.getWebsite().equals(cat.getWeblog())) {
                 throw new WebloggerException("Illegal category, not owned by action weblog");
             } else {
                 entry.setCategory(cat);
@@ -381,8 +381,8 @@ public class EntryBean {
         // enclosure url, if it exists
         Set<WeblogEntryAttribute> attrs = entry.getEntryAttributes();
         if(attrs != null && attrs.size() > 0) {
-            for(WeblogEntryAttribute attr : attrs) {
-                if("att_mediacast_url".equals(attr.getName())) {
+            for (WeblogEntryAttribute attr : attrs) {
+                if ("att_mediacast_url".equals(attr.getName())) {
                     setEnclosureURL(attr.getValue());
                 }
             }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryEdit.java Sun Apr 20 13:38:51 2014
@@ -24,7 +24,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -130,34 +130,34 @@ public final class EntryEdit extends Ent
                 WeblogEntryManager weblogMgr = WebloggerFactory.getWeblogger()
                         .getWeblogEntryManager();
 
-                WeblogEntry entry = getEntry();
+                WeblogEntry weblogEntry = getEntry();
 
                 // set updatetime & pubtime
-                entry.setUpdateTime(new Timestamp(new Date().getTime()));
-                entry.setPubTime(getBean().getPubTime(getLocale(),
+                weblogEntry.setUpdateTime(new Timestamp(new Date().getTime()));
+                weblogEntry.setPubTime(getBean().getPubTime(getLocale(),
                         getActionWeblog().getTimeZoneInstance()));
 
                 // copy data to pojo
-                getBean().copyTo(entry);
+                getBean().copyTo(weblogEntry);
 
                 // handle pubtime auto set
-                if (entry.isPublished()) {
-                    if (entry.getPubTime() == null) {
+                if (weblogEntry.isPublished()) {
+                    if (weblogEntry.getPubTime() == null) {
                         // no time specified, use current time
-                        entry.setPubTime(entry.getUpdateTime());
+                        weblogEntry.setPubTime(weblogEntry.getUpdateTime());
                     }
 
                     // if user does not have author perms then force PENDING
                     // status
                     if (!getActionWeblog().hasUserPermission(
                             getAuthenticatedUser(), WeblogPermission.POST)) {
-                        entry.setStatus(WeblogEntry.PENDING);
+                        weblogEntry.setStatus(WeblogEntry.PENDING);
                     }
 
                     // If the entry was published to future, set status as
                     // SCHEDULED we only consider an entry future published if
                     // it is scheduled more than 1 minute into the future
-                    if (entry.getPubTime().after(
+                    if (weblogEntry.getPubTime().after(
                             new Date(System.currentTimeMillis() + MINUTE_IN_MILLIS))) {
                         getBean().setStatus(WeblogEntry.SCHEDULED);
                     }
@@ -169,7 +169,7 @@ public final class EntryEdit extends Ent
                         Collections.singletonList(GlobalPermission.ADMIN));
                 if (WebloggerFactory.getWeblogger().getUserManager()
                         .checkPermission(adminPerm, getAuthenticatedUser())) {
-                    entry.setPinnedToMain(getBean().getPinnedToMain());
+                    weblogEntry.setPinnedToMain(getBean().getPinnedToMain());
                 }
 
                 if (!StringUtils.isEmpty(getBean().getEnclosureURL())) {
@@ -180,11 +180,11 @@ public final class EntryEdit extends Ent
                                 .lookupResource(getBean().getEnclosureURL());
 
                         // set mediacast attributes
-                        entry.putEntryAttribute("att_mediacast_url",
+                        weblogEntry.putEntryAttribute("att_mediacast_url",
                                 mediacast.getUrl());
-                        entry.putEntryAttribute("att_mediacast_type",
+                        weblogEntry.putEntryAttribute("att_mediacast_type",
                                 mediacast.getContentType());
-                        entry.putEntryAttribute("att_mediacast_length", ""
+                        weblogEntry.putEntryAttribute("att_mediacast_length", ""
                                 + mediacast.getLength());
 
                     } catch (MediacastException ex) {
@@ -195,11 +195,11 @@ public final class EntryEdit extends Ent
                         // if MediaCast string is empty, clean out MediaCast
                         // attributes
                         weblogMgr.removeWeblogEntryAttribute(
-                                "att_mediacast_url", entry);
+                                "att_mediacast_url", weblogEntry);
                         weblogMgr.removeWeblogEntryAttribute(
-                                "att_mediacast_type", entry);
+                                "att_mediacast_type", weblogEntry);
                         weblogMgr.removeWeblogEntryAttribute(
-                                "att_mediacast_length", entry);
+                                "att_mediacast_length", weblogEntry);
 
                     } catch (WebloggerException e) {
                         addMessage(getText("weblogEdit.mediaCastErrorRemoving"));
@@ -208,35 +208,35 @@ public final class EntryEdit extends Ent
 
                 if (log.isDebugEnabled()) {
                     log.debug("entry bean is ...\n" + getBean().toString());
-                    log.debug("final status = " + entry.getStatus());
-                    log.debug("updtime = " + entry.getUpdateTime());
-                    log.debug("pubtime = " + entry.getPubTime());
+                    log.debug("final status = " + weblogEntry.getStatus());
+                    log.debug("updtime = " + weblogEntry.getUpdateTime());
+                    log.debug("pubtime = " + weblogEntry.getPubTime());
                 }
 
                 log.debug("Saving entry");
-                weblogMgr.saveWeblogEntry(entry);
+                weblogMgr.saveWeblogEntry(weblogEntry);
                 WebloggerFactory.getWeblogger().flush();
 
                 // notify search of the new entry
-                if (entry.isPublished()) {
-                    reindexEntry(entry);
+                if (weblogEntry.isPublished()) {
+                    reindexEntry(weblogEntry);
                 } else {
-                    removeEntryIndex(entry);
+                    removeEntryIndex(weblogEntry);
                 }
 
                 // notify caches
-                CacheManager.invalidate(entry);
+                CacheManager.invalidate(weblogEntry);
 
                 // Queue applicable pings for this update.
-                if (entry.isPublished()) {
+                if (weblogEntry.isPublished()) {
                     WebloggerFactory.getWeblogger().getAutopingManager()
-                            .queueApplicableAutoPings(entry);
+                            .queueApplicableAutoPings(weblogEntry);
                 }
 
-                if (entry.isPending()) {
+                if (weblogEntry.isPending()) {
                     // implies that entry just changed to pending
                     if (MailUtil.isMailConfigured()) {
-                        MailUtil.sendPendingEntryNotice(entry);
+                        MailUtil.sendPendingEntryNotice(weblogEntry);
                     }
                     addMessage("weblogEdit.submittedForReview");
                 } else {
@@ -318,12 +318,12 @@ public final class EntryEdit extends Ent
         try {
             WeblogEntryManager wmgr = WebloggerFactory.getWeblogger()
                     .getWeblogEntryManager();
-            return wmgr.getWeblogCategories(getActionWeblog(), false);
+            return wmgr.getWeblogCategories(getActionWeblog());
         } catch (WebloggerException ex) {
             log.error(
                     "Error getting category list for weblog - " + getWeblog(),
                     ex);
-            return Collections.EMPTY_LIST;
+            return Collections.emptyList();
         }
     }
 

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/EntryRemove.java Sun Apr 20 13:38:51 2014
@@ -117,6 +117,15 @@ public class EntryRemove extends EntryBa
 
 		return INPUT;
 	}
+	
+    /**
+     * Cancel.
+     * 
+     * @return the string
+     */
+    public String cancel() {
+        return CANCEL;
+    }
 
 	public String getRemoveId() {
 		return removeId;

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderAdd.java Sun Apr 20 13:38:51 2014
@@ -20,10 +20,9 @@ package org.apache.roller.weblogger.ui.s
 
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.lang.StringUtils;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
@@ -40,12 +39,9 @@ public class FolderAdd extends UIAction 
     
     private static Log log = LogFactory.getLog(FolderAdd.class);
     
-    // the id of the folder we are adding the new subfolder into
+    // the id of the folder we are working with
     private String folderId = null;
     
-    // the folder we are adding the new subfolder into
-    private WeblogBookmarkFolder folder = null;
-    
     // bean for managing form data
     private FolderBean bean = new FolderBean();
     
@@ -62,53 +58,22 @@ public class FolderAdd extends UIAction 
     }
     
     
-    public void myPrepare() {
-        try {
-            BookmarkManager bmgr = WebloggerFactory.getWeblogger().getBookmarkManager();
-            if(!StringUtils.isEmpty(getFolderId())) {
-                setFolder(bmgr.getFolder(getFolderId()));
-            }
-        } catch (WebloggerException ex) {
-            log.error("Error looking up folder - "+getFolderId(), ex);
-        }
-    }
-    
-    
     @SkipValidation
     public String execute() {
-        
-        if(getFolder() == null) {
-            // TODO: i18n
-            addError("Cannot add folder to null parent folder");
-            return ERROR;
-        }
-        
         return INPUT;
     }
 
     
     public String save() {
-        
-        if(getFolder() == null) {
-            // TODO: i18n
-            addError("Cannot add folder to null parent folder");
-            return ERROR;
-        }
-        
         // validation
         myValidate();
         
         if(!hasActionErrors())  {
             try {
                 WeblogBookmarkFolder newFolder = new WeblogBookmarkFolder(
-                        getFolder(),
                         getBean().getName(),
-                        getBean().getDescription(),
                         getActionWeblog());
 
-                // add new folder to parent
-                getFolder().addFolder(newFolder);
-
                 // save changes
                 BookmarkManager bmgr = WebloggerFactory.getWeblogger().getBookmarkManager();
                 bmgr.saveFolder(newFolder);
@@ -127,7 +92,6 @@ public class FolderAdd extends UIAction 
 
             } catch(Exception ex) {
                 log.error("Error saving new folder", ex);
-                // TODO: i18n
                 addError("Error saving new folder");
             }
         }
@@ -136,6 +100,14 @@ public class FolderAdd extends UIAction 
         return INPUT;
     }
 
+    /**
+     * Cancel.
+     * 
+     * @return the string
+     */
+    public String cancel() {
+        return CANCEL;
+    }
     
     // TODO: validation
     public void myValidate() {
@@ -143,28 +115,12 @@ public class FolderAdd extends UIAction 
         // name is required, has max length, no html
         
         // make sure new name is not a duplicate of an existing folder
-        if(getFolder().hasFolder(getBean().getName())) {
+        if(getActionWeblog().hasBookmarkFolder(getBean().getName())) {
             addError("folderForm.error.duplicateName", getBean().getName());
         }
     }
     
     
-    public String getFolderId() {
-        return folderId;
-    }
-
-    public void setFolderId(String folderId) {
-        this.folderId = folderId;
-    }
-
-    public WeblogBookmarkFolder getFolder() {
-        return folder;
-    }
-
-    public void setFolder(WeblogBookmarkFolder folder) {
-        this.folder = folder;
-    }
-
     public FolderBean getBean() {
         return bean;
     }
@@ -173,4 +129,11 @@ public class FolderAdd extends UIAction 
         this.bean = bean;
     }
     
+    public String getFolderId() {
+        return folderId;
+    }
+
+    public void setFolderId(String folderId) {
+        this.folderId = folderId;
+    }
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderBean.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderBean.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderBean.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderBean.java Sun Apr 20 13:38:51 2014
@@ -21,7 +21,6 @@ package org.apache.roller.weblogger.ui.s
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
 
-
 /**
  * Bean for managing folder data.
  */
@@ -29,9 +28,7 @@ public class FolderBean {
     
     protected String id = null;
     protected String name = null;
-    protected String description = null;
-    
-    
+
     public String getId() {
         return this.id;
     }
@@ -47,30 +44,15 @@ public class FolderBean {
     public void setName( String name ) {
         this.name = name;
     }
-    
-    public String getDescription() {
-        return this.description;
-    }
-    
-    public void setDescription( String description ) {
-        this.description = description;
-    }
-    
-    
+
     public void copyTo(WeblogBookmarkFolder dataHolder) throws WebloggerException {
-        
         if(!dataHolder.getName().equals(this.name)) {
             dataHolder.updateName(this.name);
         }
-        
-        dataHolder.setDescription(this.description);
     }
-    
-    
+
     public void copyFrom(WeblogBookmarkFolder dataHolder) {
         this.id = dataHolder.getId();
         this.name = dataHolder.getName();
-        this.description = dataHolder.getDescription();
     }
-    
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/FolderEdit.java Sun Apr 20 13:38:51 2014
@@ -20,12 +20,14 @@ package org.apache.roller.weblogger.ui.s
 
 import java.util.Collections;
 import java.util.List;
-import org.apache.commons.lang.StringUtils;
+
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
 import org.apache.roller.weblogger.business.BookmarkManager;
 import org.apache.roller.weblogger.business.WebloggerFactory;
+import org.apache.roller.weblogger.pojos.Weblog;
 import org.apache.roller.weblogger.pojos.WeblogBookmarkFolder;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
 import org.apache.roller.weblogger.ui.struts2.util.UIAction;
@@ -40,6 +42,9 @@ public class FolderEdit extends UIAction
     
     private static Log log = LogFactory.getLog(FolderEdit.class);
     
+    // the id of the folder we are working with
+    private String folderId = null;
+    
     // the folder we are editing
     private WeblogBookmarkFolder folder = null;
     
@@ -80,7 +85,6 @@ public class FolderEdit extends UIAction
     public String execute() {
         
         if(getFolder() == null) {
-            // TODO: i18n
             addError("Cannot edit null folder");
             return ERROR;
         }
@@ -98,7 +102,6 @@ public class FolderEdit extends UIAction
     public String save() {
         
         if(getFolder() == null) {
-            // TODO: i18n
             addError("Cannot edit null folder");
             return ERROR;
         }
@@ -125,7 +128,6 @@ public class FolderEdit extends UIAction
 
             } catch(Exception ex) {
                 log.error("Error saving folder", ex);
-                // TODO: i18n
                 addError("Error saving folder");
             }
         }
@@ -133,6 +135,14 @@ public class FolderEdit extends UIAction
         return INPUT;
     }
 
+    /**
+     * Cancel.
+     * 
+     * @return the string
+     */
+    public String cancel() {
+        return CANCEL;
+    }
     
     // TODO: validation
     public void myValidate() {
@@ -141,8 +151,8 @@ public class FolderEdit extends UIAction
         
         // make sure new name is not a duplicate of an existing folder
         if(!getFolder().getName().equals(getBean().getName())) {
-            WeblogBookmarkFolder parent = getFolder().getParent();
-            if(parent != null && parent.hasFolder(getBean().getName())) {
+            Weblog weblog = getFolder().getWeblog();
+            if(weblog.hasBookmarkFolder(getBean().getName())) {
                 addError("folderForm.error.duplicateName", getBean().getName());
             }
         }
@@ -165,4 +175,11 @@ public class FolderEdit extends UIAction
         this.bean = bean;
     }
     
+    public String getFolderId() {
+        return folderId;
+    }
+
+    public void setFolderId(String folderId) {
+        this.folderId = folderId;
+    }
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileAdd.java Sun Apr 20 13:38:51 2014
@@ -24,7 +24,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -38,7 +38,6 @@ import org.apache.roller.weblogger.util.
 import org.apache.roller.weblogger.util.Utilities;
 import org.apache.struts2.interceptor.validation.SkipValidation;
 
-
 /**
  * Adds a new media file.
  */
@@ -62,8 +61,7 @@ public class MediaFileAdd extends MediaF
 
     private List<MediaFile> newFiles = new ArrayList<MediaFile>();
 
-    private String directoryPath =  null;
-    
+    private String directoryPath = null;
 
     public MediaFileAdd() {
         this.actionName = "mediaFileAdd";
@@ -78,21 +76,35 @@ public class MediaFileAdd extends MediaF
         log.debug("Into myprepare");
         refreshAllDirectories();
         try {
-            MediaFileManager mgr = WebloggerFactory.getWeblogger().getMediaFileManager();
+            MediaFileManager mgr = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
             if (!StringUtils.isEmpty(bean.getDirectoryId())) {
                 setDirectory(mgr.getMediaFileDirectory(bean.getDirectoryId()));
 
             } else if (StringUtils.isNotEmpty(directoryPath)) {
-                setDirectory(mgr.getMediaFileDirectoryByPath(getActionWeblog(), directoryPath));
+                setDirectory(mgr.getMediaFileDirectoryByPath(getActionWeblog(),
+                        directoryPath));
 
             } else {
-                setDirectory(mgr.createRootMediaFileDirectory(getActionWeblog()));
+                MediaFileDirectory root = mgr
+                        .getMediaFileRootDirectory(getActionWeblog());
+                if (root == null) {
+                    root = mgr.createRootMediaFileDirectory(getActionWeblog());
+                }
+                setDirectory(root);
             }
             directoryPath = getDirectory().getPath();
             bean.setDirectoryId(getDirectory().getId());
 
         } catch (WebloggerException ex) {
             log.error("Error looking up media file directory", ex);
+        } finally {
+            // flush
+            try {
+                WebloggerFactory.getWeblogger().flush();
+            } catch (WebloggerException e) {
+                // ignored
+            }
         }
     }
 
@@ -116,8 +128,9 @@ public class MediaFileAdd extends MediaF
         myValidate();
 
         if (!hasActionErrors()) {
-            
-            MediaFileManager manager = WebloggerFactory.getWeblogger().getMediaFileManager();
+
+            MediaFileManager manager = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
 
             RollerMessages errors = new RollerMessages();
             List<MediaFile> uploaded = new ArrayList();
@@ -145,36 +158,43 @@ public class MediaFileAdd extends MediaF
                         }
 
                         // make sure fileName is valid
-                        if (fileName.indexOf('/') != -1 ||
-                                fileName.indexOf('\\') != -1 ||
-                                fileName.contains("..")) {
+                        if (fileName.indexOf('/') != -1
+                                || fileName.indexOf('\\') != -1
+                                || fileName.contains("..")) {
                             addError("uploadFiles.error.badPath", fileName);
                             continue;
                         }
 
-                        mediaFile.setName(       fileName);
-                        mediaFile.setDirectory(  getDirectory());
-                        mediaFile.setWeblog(     getActionWeblog());
-                        mediaFile.setLength(     this.uploadedFiles[i].length());
-                        mediaFile.setInputStream(new FileInputStream(this.uploadedFiles[i]));
-                        mediaFile.setContentType(this.uploadedFilesContentType[i]);
+                        mediaFile.setName(fileName);
+                        mediaFile.setDirectory(getDirectory());
+                        mediaFile.setWeblog(getActionWeblog());
+                        mediaFile.setLength(this.uploadedFiles[i].length());
+                        mediaFile.setInputStream(new FileInputStream(
+                                this.uploadedFiles[i]));
+                        mediaFile
+                                .setContentType(this.uploadedFilesContentType[i]);
 
                         // insome cases Struts2 is not able to guess the content
                         // type correctly and assigns the default, which is
                         // octet-stream. So in cases where we see octet-stream
                         // we double check and see if we can guess the content
                         // type via the Java MIME type facilities.
-                        mediaFile.setContentType(this.uploadedFilesContentType[i]);
+                        mediaFile
+                                .setContentType(this.uploadedFilesContentType[i]);
                         if (mediaFile.getContentType() == null
-                                || mediaFile.getContentType().endsWith("/octet-stream")) {
-                            
-                            String ctype = Utilities.getContentTypeFromFileName(mediaFile.getName());
+                                || mediaFile.getContentType().endsWith(
+                                        "/octet-stream")) {
+
+                            String ctype = Utilities
+                                    .getContentTypeFromFileName(mediaFile
+                                            .getName());
                             if (null != ctype) {
                                 mediaFile.setContentType(ctype);
                             }
                         }
 
-                        manager.createMediaFile(getActionWeblog(), mediaFile, errors);
+                        manager.createMediaFile(getActionWeblog(), mediaFile,
+                                errors);
                         WebloggerFactory.getWeblogger().flush();
 
                         if (mediaFile.isImageFile()) {
@@ -200,7 +220,8 @@ public class MediaFileAdd extends MediaF
                 if (uploaded.size() > 0 && !this.errorsExist()) {
                     addMessage("uploadFiles.uploadedFiles");
                     for (MediaFile upload : uploaded) {
-                        addMessage("uploadFiles.uploadedFile", upload.getPermalink());
+                        addMessage("uploadFiles.uploadedFile",
+                                upload.getPermalink());
                     }
 
                 } else {
@@ -277,7 +298,8 @@ public class MediaFileAdd extends MediaF
     }
 
     /**
-     * @param newImages the newImages to set
+     * @param newImages
+     *            the newImages to set
      */
     public void setNewImages(List<MediaFile> newImages) {
         this.newImages = newImages;
@@ -291,7 +313,8 @@ public class MediaFileAdd extends MediaF
     }
 
     /**
-     * @param newFiles the newFiles to set
+     * @param newFiles
+     *            the newFiles to set
      */
     public void setNewFiles(List<MediaFile> newFiles) {
         this.newFiles = newFiles;
@@ -305,7 +328,8 @@ public class MediaFileAdd extends MediaF
     }
 
     /**
-     * @param directoryPath the directoryPath to set
+     * @param directoryPath
+     *            the directoryPath to set
      */
     public void setDirectoryPath(String directoryPath) {
         this.directoryPath = directoryPath;

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileBase.java Sun Apr 20 13:38:51 2014
@@ -34,7 +34,7 @@ import org.apache.roller.weblogger.ui.st
 
 /**
  * Base class for all actions related to media files.
- *
+ * 
  */
 @SuppressWarnings("serial")
 public class MediaFileBase extends UIAction {
@@ -54,15 +54,17 @@ public class MediaFileBase extends UIAct
 
         try {
             log.debug("Processing delete of file id - " + this.mediaFileId);
-            MediaFileManager manager = WebloggerFactory.getWeblogger().getMediaFileManager();
+            MediaFileManager manager = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
             MediaFile mediaFile = manager.getMediaFile(this.mediaFileId);
             manager.removeMediaFile(getActionWeblog(), mediaFile);
             // flush changes
             WebloggerFactory.getWeblogger().flush();
+            WebloggerFactory.getWeblogger().release();
             addMessage("mediaFile.delete.success");
         } catch (WebloggerException e) {
             log.error("Error deleting media file", e);
-            addError("mediaFile.delete.error",this.mediaFileId);
+            addError("mediaFile.delete.error", this.mediaFileId);
         }
     }
 
@@ -72,8 +74,10 @@ public class MediaFileBase extends UIAct
     protected void doIncludeMediaFileInGallery() {
 
         try {
-            log.debug("Processing include-in-gallery of file id - " + this.mediaFileId);
-            MediaFileManager manager = WebloggerFactory.getWeblogger().getMediaFileManager();
+            log.debug("Processing include-in-gallery of file id - "
+                    + this.mediaFileId);
+            MediaFileManager manager = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
             MediaFile mediaFile = manager.getMediaFile(this.mediaFileId);
             mediaFile.setSharedForGallery(true);
             manager.updateMediaFile(getActionWeblog(), mediaFile);
@@ -82,7 +86,7 @@ public class MediaFileBase extends UIAct
             addMessage("mediaFile.includeInGallery.success");
         } catch (WebloggerException e) {
             log.error("Error including media file in gallery", e);
-            addError("mediaFile.includeInGallery.error",this.mediaFileId);
+            addError("mediaFile.includeInGallery.error", this.mediaFileId);
         }
     }
 
@@ -93,31 +97,41 @@ public class MediaFileBase extends UIAct
         String[] fileIds = getSelectedMediaFiles();
         String[] dirIds = getSelectedMediaFileDirectories();
         try {
-            MediaFileManager manager = WebloggerFactory.getWeblogger().getMediaFileManager();
+            MediaFileManager manager = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
 
             if (fileIds != null && fileIds.length > 0) {
-                log.debug("Processing delete of " + fileIds.length + " media files.");
-                for (int index = 0; index < fileIds.length; index++) {
-                    log.debug("Deleting media file - " + fileIds[index]);
-                    MediaFile mediaFile = manager.getMediaFile(fileIds[index]);
-                    manager.removeMediaFile(getActionWeblog(), mediaFile);
+                log.debug("Processing delete of " + fileIds.length
+                        + " media files.");
+                for (String fileId : fileIds) {
+                    log.debug("Deleting media file - " + fileId);
+                    MediaFile mediaFile = manager.getMediaFile(fileId);
+                    if (mediaFile != null) {
+                        manager.removeMediaFile(getActionWeblog(), mediaFile);
+                    }
                 }
             }
 
             if (dirIds != null && dirIds.length > 0) {
-                log.debug("Processing delete of " + dirIds.length + " media directories.");
+                log.debug("Processing delete of " + dirIds.length
+                        + " media directories.");
                 manager = WebloggerFactory.getWeblogger().getMediaFileManager();
-                for (int index = 0; index < dirIds.length; index++) {
-                    log.debug("Deleting media file directory - " + dirIds[index]);
-                    MediaFileDirectory mediaFileDir = manager.getMediaFileDirectory(dirIds[index]);
-                    mediaFileDir.getParent().removeChildDirectory(mediaFileDir);
-                    manager.removeMediaFileDirectory(mediaFileDir);
+                for (String dirId : dirIds) {
+                    log.debug("Deleting media file directory - " + dirId);
+                    MediaFileDirectory mediaFileDir = manager.getMediaFileDirectory(dirId);
+                    if (mediaFileDir != null) {
+                        mediaFileDir.getParent().removeChildDirectory(mediaFileDir);
+                        manager.removeMediaFileDirectory(mediaFileDir);
+                    }
                 }
+                refreshAllDirectories();
             }
-            WebloggerFactory.getWeblogger().getWeblogManager().saveWeblog(this.getActionWeblog());
-            
+            WebloggerFactory.getWeblogger().getWeblogManager()
+                    .saveWeblog(this.getActionWeblog());
+
             // flush changes
             WebloggerFactory.getWeblogger().flush();
+            WebloggerFactory.getWeblogger().release();
             addMessage("mediaFile.delete.success");
 
         } catch (WebloggerException e) {
@@ -133,33 +147,55 @@ public class MediaFileBase extends UIAct
         String[] fileIds = getSelectedMediaFiles();
         String[] dirIds = getSelectedMediaFileDirectories();
         try {
-            MediaFileManager manager = WebloggerFactory.getWeblogger().getMediaFileManager();
+            int movedFiles = 0;
+            MediaFileManager manager = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
 
             if (fileIds != null && fileIds.length > 0) {
-                log.debug("Processing move of " + fileIds.length + " media files.");
-                MediaFileDirectory targetDirectory =
-                        manager.getMediaFileDirectory(this.selectedDirectory);
-                for (int index = 0; index < fileIds.length; index++) {
-                    log.debug("Moving media file - " + fileIds[index] + " to directory - " + this.selectedDirectory);
-                    MediaFile mediaFile = manager.getMediaFile(fileIds[index]);
-                    manager.moveMediaFile(mediaFile, targetDirectory);
+                log.debug("Processing move of " + fileIds.length
+                        + " media files.");
+                MediaFileDirectory targetDirectory = manager
+                        .getMediaFileDirectory(this.selectedDirectory);
+                for (String fileId : fileIds) {
+                    log.debug("Moving media file - " + fileId
+                            + " to directory - " + this.selectedDirectory);
+                    MediaFile mediaFile = manager.getMediaFile(fileId);
+                    if (mediaFile != null && !mediaFile.getDirectory().getId().equals(targetDirectory.getId())) {
+                        manager.moveMediaFile(mediaFile, targetDirectory);
+                        movedFiles++;
+                    }
                 }
             }
 
+            int movedDirs = 0;
             if (dirIds != null && dirIds.length > 0) {
-                log.debug("Processing move of " + dirIds.length + " media files directories.");
-                MediaFileDirectory targetDirectory =
-                        manager.getMediaFileDirectory(this.selectedDirectory);
-                for (int index = 0; index < dirIds.length; index++) {
-                    log.debug("Moving media file - " + dirIds[index] + " to directory - " + this.selectedDirectory);
-                    MediaFileDirectory mediaFileDir = manager.getMediaFileDirectory(dirIds[index]);
-                    manager.moveMediaFileDirectory(mediaFileDir, targetDirectory);
+                log.debug("Processing move of " + dirIds.length
+                        + " media files directories.");
+                MediaFileDirectory targetDirectory = manager
+                        .getMediaFileDirectory(this.selectedDirectory);
+                for (String dirId : dirIds) {
+                    log.debug("Moving media file - " + dirId
+                            + " to directory - " + this.selectedDirectory);
+                    MediaFileDirectory mediaFileDir = manager
+                            .getMediaFileDirectory(dirId);
+                    if (mediaFileDir != null
+                            && !mediaFileDir.getId().equals(targetDirectory.getId())
+                            && !mediaFileDir.getParent().getId().equals(targetDirectory.getId())) {
+                        manager.moveMediaFileDirectory(mediaFileDir,targetDirectory);
+                        movedDirs++;
+                    }
                 }
             }
 
             // flush changes
             WebloggerFactory.getWeblogger().flush();
-            addMessage("mediaFile.move.success");
+            WebloggerFactory.getWeblogger().release();
+            if (movedFiles > 0 || movedDirs > 0) {
+                addMessage("mediaFile.move.success");
+                if (movedDirs > 0) {
+                    refreshAllDirectories();
+                }
+            }
 
         } catch (WebloggerException e) {
             log.error("Error moving selected media files", e);
@@ -172,11 +208,13 @@ public class MediaFileBase extends UIAct
      */
     protected void refreshAllDirectories() {
         try {
-            MediaFileManager mgr = WebloggerFactory.getWeblogger().getMediaFileManager();
+            MediaFileManager mgr = WebloggerFactory.getWeblogger()
+                    .getMediaFileManager();
             List<MediaFileDirectory> directories = mgr.getMediaFileDirectories(getActionWeblog());
             List<MediaFileDirectory> sortedDirList = new ArrayList<MediaFileDirectory>();
             sortedDirList.addAll(directories);
-            Collections.sort(sortedDirList, new MediaFileDirectoryComparator(DirectoryComparatorType.PATH));
+            Collections.sort(sortedDirList, new MediaFileDirectoryComparator(
+                    DirectoryComparatorType.PATH));
             setAllDirectories(sortedDirList);
         } catch (WebloggerException ex) {
             log.error("Error looking up media file directories", ex);
@@ -232,9 +270,11 @@ public class MediaFileBase extends UIAct
     }
 
     /**
-     * @param selectedMediaFileDirectories the selectedMediaFileDirectories to set
+     * @param selectedMediaFileDirectories
+     *            the selectedMediaFileDirectories to set
      */
-    public void setSelectedMediaFileDirectories(String[] selectedMediaFileDirectories) {
+    public void setSelectedMediaFileDirectories(
+            String[] selectedMediaFileDirectories) {
         this.selectedMediaFileDirectories = selectedMediaFileDirectories;
     }
 }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileEdit.java Sun Apr 20 13:38:51 2014
@@ -20,7 +20,7 @@ package org.apache.roller.weblogger.ui.s
 import java.io.File;
 import java.io.FileInputStream;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileImageChooser.java Sun Apr 20 13:38:51 2014
@@ -126,10 +126,10 @@ public class MediaFileImageChooser exten
         String fullPath = this.currentDirectory.getPath();
         if (fullPath.length() > 1) {
             String[] directoryNames = fullPath.substring(1).split("/");
-            String directoryPath = "";
+            String dirPath = "";
             for (String directoryName : directoryNames) {
-                directoryPath = directoryPath + "/" + directoryName;
-                directoryHierarchy.add(new KeyValueObject(directoryPath, directoryName));
+                dirPath = dirPath + "/" + directoryName;
+                directoryHierarchy.add(new KeyValueObject(dirPath, directoryName));
             }
         }
         return directoryHierarchy;

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileSearchBean.java Sun Apr 20 13:38:51 2014
@@ -21,7 +21,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 import java.util.ResourceBundle;
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.roller.util.RollerConstants;
 import org.apache.roller.weblogger.pojos.MediaFileFilter;
 import org.apache.roller.weblogger.pojos.MediaFileType;
 import org.apache.roller.weblogger.pojos.MediaFileFilter.MediaFileOrder;
@@ -34,31 +35,31 @@ public class MediaFileSearchBean {
     private transient ResourceBundle bundle =
             ResourceBundle.getBundle("ApplicationResources");
 
-    public static int PAGE_SIZE = 10;
+    public static final int PAGE_SIZE = 10;
 
     // Media file name as search criteria
-    String name;
+    private String name;
 
     // Media file type as search criteria
-    String type;
+    private String type;
 
     // Type of size filter as search criteria
-    String sizeFilterType;
+    private String sizeFilterType;
 
     // Size of file as search criteria
-    long size;
+    private long size;
 
     // Size unit
-    String sizeUnit;
+    private String sizeUnit;
 
     // Tags as search criteria
-    String tags;
+    private String tags;
 
     // Page number of results
-    int pageNum = 0;
+    private int pageNum = 0;
     
     // Sort option for search results
-    int sortOption;
+    private int sortOption;
 
     public String getName() {
         return name;
@@ -175,9 +176,9 @@ public class MediaFileSearchBean {
 
             long filterSize = this.size ;
             if ("mediaFileView.kb".equals(this.sizeUnit)) {
-                filterSize = this.size * 1024;
+                filterSize = this.size * RollerConstants.ONE_KB_IN_BYTES;
             } else if ("mediaFileView.mb".equals(this.sizeUnit)) {
-                    filterSize = this.size * 1024 * 1024;
+                    filterSize = this.size * RollerConstants.ONE_MB_IN_BYTES;
             }
             dataHolder.setSize(filterSize);
         }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MediaFileView.java Sun Apr 20 13:38:51 2014
@@ -22,7 +22,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.lang.StringUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -199,7 +199,8 @@ public class MediaFileView extends Media
                 Collections.sort(this.childFiles,
                     new MediaFileComparator(MediaFileComparatorType.DATE_UPLOADED));
 
-            } else { // default to sort by name
+            } else {
+                // default to sort by name
                 sortBy = "name";
                 Collections.sort(this.childDirectories,
                     new MediaFileDirectoryComparator(DirectoryComparatorType.NAME));

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Members.java Sun Apr 20 13:38:51 2014
@@ -84,7 +84,7 @@ public class Members extends UIAction im
 
             // we have to copy the permissions list so that when we remove permissions
             // below we don't get ConcurrentModificationExceptions
-            for( WeblogPermission perm : permissions ) {
+            for (WeblogPermission perm : permissions) {
                 permsList.add(perm);
             }
             // one iteration for each line (user) in the members table

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/MembersInvite.java Sun Apr 20 13:38:51 2014
@@ -20,6 +20,7 @@ package org.apache.roller.weblogger.ui.s
 
 import java.util.Collections;
 import java.util.List;
+
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.weblogger.WebloggerException;
@@ -162,6 +163,14 @@ public class MembersInvite extends UIAct
         return INPUT;
     }
     
+    /**
+     * Cancel.
+     * 
+     * @return the string
+     */
+    public String cancel() {
+        return CANCEL;
+    }
 
     public String getUserName() {
         return userName;

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Pings.java Sun Apr 20 13:38:51 2014
@@ -34,7 +34,6 @@ import java.net.SocketException;
 import java.net.UnknownHostException;
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import org.apache.roller.weblogger.pojos.WeblogPermission;
@@ -55,10 +54,7 @@ public class Pings extends UIAction {
     private PingTarget pingTarget = null;
     
     // commong ping targets list
-    private List commonPingTargets = Collections.EMPTY_LIST;
-    
-    // custom ping targets list for weblog
-    private List customPingTargets = Collections.EMPTY_LIST;
+    private List<PingTarget> commonPingTargets = Collections.emptyList();
     
     // track the enabled/disabled status for pings
     private Map pingStatus = Collections.EMPTY_MAP;
@@ -93,12 +89,6 @@ public class Pings extends UIAction {
         try {
             // load common ping targets list
             setCommonPingTargets(pingTargetMgr.getCommonPingTargets());
-            
-            // load custom ping targets list for weblog, if applicable
-            if(!PingConfig.getDisallowCustomTargets()) {
-                setCustomPingTargets(pingTargetMgr.getCustomPingTargets(getActionWeblog()));
-            }
-            
         } catch (WebloggerException ex) {
             log.error("Error loading ping target lists for weblog - "+getActionWeblog().getHandle(), ex);
             // TODO: i18n
@@ -220,38 +210,27 @@ public class Pings extends UIAction {
         AutoPingManager autoPingMgr = WebloggerFactory.getWeblogger().getAutopingManager();
         
         // Build isEnabled map (keyed by ping target id and values Boolean.TRUE/Boolean.FALSE)
-        Map isEnabled = new HashMap();
+        Map<String, Boolean> isEnabled = new HashMap<String, Boolean>();
         
-        List autopings = Collections.EMPTY_LIST;
+        List<AutoPing> autoPings = Collections.emptyList();
         try {
-            autopings = autoPingMgr.getAutoPingsByWebsite(getActionWeblog());
+            autoPings = autoPingMgr.getAutoPingsByWebsite(getActionWeblog());
         } catch (WebloggerException ex) {
             log.error("Error looking up auto pings for weblog - "+getActionWeblog().getHandle(), ex);
         }
         
         // Add the enabled auto ping configs with TRUE
-        for (Iterator i = autopings.iterator(); i.hasNext();) {
-            AutoPing autoPing = (AutoPing) i.next();
+        for (AutoPing autoPing : autoPings) {
             isEnabled.put(autoPing.getPingTarget().getId(), Boolean.TRUE);
         }
         
-        // Somewhat awkward, but the two loops save building a separate combined list.
-        // Add disabled common ones with FALSE
-        for (Iterator i = getCommonPingTargets().iterator(); i.hasNext();) {
-            PingTarget inPingTarget = (PingTarget) i.next();
-            if (isEnabled.get(inPingTarget.getId()) == null) {
-                isEnabled.put(inPingTarget.getId(), Boolean.FALSE);
-            }
-        }
-        
-        // Add disabled custom ones with FALSE
-        for (Iterator i = getCustomPingTargets().iterator(); i.hasNext();) {
-            PingTarget inPingTarget = (PingTarget) i.next();
+        // Add disabled ping targets ones with FALSE
+        for (PingTarget inPingTarget : getCommonPingTargets()) {
             if (isEnabled.get(inPingTarget.getId()) == null) {
                 isEnabled.put(inPingTarget.getId(), Boolean.FALSE);
             }
         }
-        
+
         if (isEnabled.size() > 0) {
             setPingStatus(isEnabled);
         }
@@ -274,22 +253,14 @@ public class Pings extends UIAction {
         this.pingTarget = pingTarget;
     }
 
-    public List getCommonPingTargets() {
+    public List<PingTarget> getCommonPingTargets() {
         return commonPingTargets;
     }
 
-    public void setCommonPingTargets(List commonPingTargets) {
+    public void setCommonPingTargets(List<PingTarget> commonPingTargets) {
         this.commonPingTargets = commonPingTargets;
     }
 
-    public List getCustomPingTargets() {
-        return customPingTargets;
-    }
-
-    public void setCustomPingTargets(List customPingTargets) {
-        this.customPingTargets = customPingTargets;
-    }
-
     public Map getPingStatus() {
         return pingStatus;
     }

Modified: roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java
URL: http://svn.apache.org/viewvc/roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java?rev=1588757&r1=1588756&r2=1588757&view=diff
==============================================================================
--- roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java (original)
+++ roller/branches/rome2/app/src/main/java/org/apache/roller/weblogger/ui/struts2/editor/Referrers.java Sun Apr 20 13:38:51 2014
@@ -38,7 +38,7 @@ public class Referrers extends UIAction 
     private static Log log = LogFactory.getLog(Referrers.class);
     
     // list of referrers to display
-    private List<WeblogReferrer> referrers = Collections.EMPTY_LIST;
+    private List<WeblogReferrer> referrers = Collections.emptyList();
 
     // referrers hits today
     private int dayHits = 0;
@@ -105,17 +105,17 @@ public class Referrers extends UIAction 
      */
     public String remove() {
         
-        String[] removeIds = getRemoveIds();
-        if(removeIds != null) {
+        String[] idsToRemove = getRemoveIds();
+        if (idsToRemove != null) {
             RefererManager refmgr = WebloggerFactory.getWeblogger().getRefererManager();
             
             try {
-                WeblogReferrer referer = null;
-                for (int i=0; i < removeIds.length; i++) {
-                    referer = refmgr.getReferer(removeIds[i]);
+                WeblogReferrer referer;
+                for (String idToRemove : idsToRemove) {
+                    referer = refmgr.getReferer(idToRemove);
                     
                     // make sure referrer belongs to action weblog
-                    if(getActionWeblog().equals(referer.getWebsite())) {
+                    if (getActionWeblog().equals(referer.getWebsite())) {
                         refmgr.removeReferer(referer);
                     }
                 }



Mime
View raw message